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

This commit is contained in:
Haresh Chavda 2018-10-04 15:34:20 +05:30
parent b3776bf2b0
commit ca04a370e5
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):