Merge branch 'master-account-discount' into 'master'

[IMP]: issues:104:Incorrect layout for billing orders and divide by zero issues

See merge request flectra-hq/flectra!143
This commit is contained in:
Parthiv Patel 2018-10-04 10:51:20 +00:00
commit a4ccd80351
3 changed files with 10 additions and 7 deletions

View File

@ -54,10 +54,11 @@ class AccountInvoice(models.Model):
discount_value_ratio = \
(self.discount_amount * line.price_subtotal) / \
gross_amount
discount_per_ratio = \
(discount_value_ratio * 100) / line.price_subtotal
line.write({'discount': discount_per_ratio})
self._onchange_invoice_line_ids()
if discount_value_ratio:
discount_per_ratio = \
(discount_value_ratio * 100) / line.price_subtotal
line.write({'discount': discount_per_ratio})
self._onchange_invoice_line_ids()
self._check_constrains()
@api.multi

View File

@ -23,6 +23,7 @@
<th t-if="display_discount" class="text-right" groups="sale.group_discount_per_so_line">Disc.(%)</th>
<th class="text-right">Taxes</th>
<th class="text-right">Amount</th>
<th class="text-right">Total</th>
</tr>
</thead>
<tbody class="invoice_tbody">

View File

@ -54,9 +54,10 @@ class SaleOrder(models.Model):
discount_value_ratio = \
(self.discount_amount *
line.price_subtotal) / gross_amount
discount_per_ratio = \
(discount_value_ratio * 100) / line.price_subtotal
line.write({'discount': discount_per_ratio})
if discount_value_ratio:
discount_per_ratio = \
(discount_value_ratio * 100) / line.price_subtotal
line.write({'discount': discount_per_ratio})
@api.onchange('discount_method')
def onchange_discount_method(self):