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,6 +54,7 @@ class AccountInvoice(models.Model):
discount_value_ratio = \ discount_value_ratio = \
(self.discount_amount * line.price_subtotal) / \ (self.discount_amount * line.price_subtotal) / \
gross_amount gross_amount
if discount_value_ratio:
discount_per_ratio = \ discount_per_ratio = \
(discount_value_ratio * 100) / line.price_subtotal (discount_value_ratio * 100) / line.price_subtotal
line.write({'discount': discount_per_ratio}) line.write({'discount': discount_per_ratio})

View File

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

View File

@ -54,6 +54,7 @@ class SaleOrder(models.Model):
discount_value_ratio = \ discount_value_ratio = \
(self.discount_amount * (self.discount_amount *
line.price_subtotal) / gross_amount line.price_subtotal) / gross_amount
if discount_value_ratio:
discount_per_ratio = \ discount_per_ratio = \
(discount_value_ratio * 100) / line.price_subtotal (discount_value_ratio * 100) / line.price_subtotal
line.write({'discount': discount_per_ratio}) line.write({'discount': discount_per_ratio})