Merge branch 'master-sale-account-discount' into 'master'
[IMP] Tax calculation when click on update discount button and misc changes See merge request flectra-hq/flectra!32
This commit is contained in:
commit
886e8ad7bf
@ -47,7 +47,8 @@ class AccountInvoice(models.Model):
|
|||||||
gross_amount = self.gross_amount
|
gross_amount = self.gross_amount
|
||||||
if self.discount_method == 'per':
|
if self.discount_method == 'per':
|
||||||
for line in self.invoice_line_ids:
|
for line in self.invoice_line_ids:
|
||||||
line.write({'discount': line.discount + self.discount_per})
|
line.write({'discount': self.discount_per})
|
||||||
|
self._onchange_invoice_line_ids()
|
||||||
else:
|
else:
|
||||||
for line in self.invoice_line_ids:
|
for line in self.invoice_line_ids:
|
||||||
discount_value_ratio = \
|
discount_value_ratio = \
|
||||||
@ -55,7 +56,8 @@ class AccountInvoice(models.Model):
|
|||||||
gross_amount
|
gross_amount
|
||||||
discount_per_ratio = \
|
discount_per_ratio = \
|
||||||
(discount_value_ratio * 100) / line.price_subtotal
|
(discount_value_ratio * 100) / line.price_subtotal
|
||||||
line.write({'discount': line.discount + discount_per_ratio})
|
line.write({'discount': discount_per_ratio})
|
||||||
|
self._onchange_invoice_line_ids()
|
||||||
|
|
||||||
@api.constrains('discount_per', 'discount_amount', 'invoice_line_ids')
|
@api.constrains('discount_per', 'discount_amount', 'invoice_line_ids')
|
||||||
def _check_constrains(self):
|
def _check_constrains(self):
|
||||||
|
@ -9,7 +9,8 @@ class SaleOrder(models.Model):
|
|||||||
_inherit = "sale.order"
|
_inherit = "sale.order"
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
@api.depends('discount_amount', 'discount_per', 'amount_untaxed')
|
@api.depends('discount_amount', 'discount_per',
|
||||||
|
'amount_untaxed', 'order_line')
|
||||||
def _get_discount(self):
|
def _get_discount(self):
|
||||||
total_discount = 0.0
|
total_discount = 0.0
|
||||||
for record in self:
|
for record in self:
|
||||||
@ -46,7 +47,7 @@ class SaleOrder(models.Model):
|
|||||||
gross_amount = self.gross_amount
|
gross_amount = self.gross_amount
|
||||||
if self.discount_method == 'per':
|
if self.discount_method == 'per':
|
||||||
for line in self.order_line:
|
for line in self.order_line:
|
||||||
line.write({'discount': line.discount + self.discount_per})
|
line.write({'discount': self.discount_per})
|
||||||
else:
|
else:
|
||||||
for line in self.order_line:
|
for line in self.order_line:
|
||||||
discount_value_ratio = \
|
discount_value_ratio = \
|
||||||
@ -54,7 +55,7 @@ class SaleOrder(models.Model):
|
|||||||
line.price_subtotal) / gross_amount
|
line.price_subtotal) / gross_amount
|
||||||
discount_per_ratio = \
|
discount_per_ratio = \
|
||||||
(discount_value_ratio * 100) / line.price_subtotal
|
(discount_value_ratio * 100) / line.price_subtotal
|
||||||
line.write({'discount': line.discount + discount_per_ratio})
|
line.write({'discount': discount_per_ratio})
|
||||||
|
|
||||||
@api.onchange('discount_method')
|
@api.onchange('discount_method')
|
||||||
def onchange_discount_method(self):
|
def onchange_discount_method(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user