[IMP]: Rounding issues for sale/account discount and remove the line in the invoice when the shipment is not create in purchase order line

This commit is contained in:
Haresh Chavda 2018-09-21 16:42:10 +05:30
parent 542a1d33d1
commit 7a8c2750ff
3 changed files with 7 additions and 6 deletions

View File

@ -26,7 +26,7 @@ class AccountInvoice(models.Model):
def _get_total_amount(self):
for invoice_id in self:
invoice_id.gross_amount = sum(
[line_id.quantity * line_id.price_unit
[invoice_id.currency_id.round(line_id.quantity * line_id.price_unit)
for line_id in invoice_id.invoice_line_ids])
discount_method = fields.Selection(

View File

@ -81,9 +81,10 @@ class AccountInvoice(models.Model):
new_lines = self.env['account.invoice.line']
for line in self.purchase_id.order_line - self.invoice_line_ids.mapped('purchase_line_id'):
data = self._prepare_invoice_line_from_po_line(line)
new_line = new_lines.new(data)
new_line._set_additional_fields(self)
new_lines += new_line
if data.get('quantity', False) > 0:
new_line = new_lines.new(data)
new_line._set_additional_fields(self)
new_lines += new_line
self.invoice_line_ids += new_lines
self.payment_term_id = self.purchase_id.payment_term_id

View File

@ -26,8 +26,8 @@ class SaleOrder(models.Model):
def _get_total_amount(self):
for order_id in self:
order_id.gross_amount = sum(
[line_id.product_uom_qty *
line_id.price_unit for line_id in order_id.order_line])
[order_id.pricelist_id.currency_id.round(line_id.product_uom_qty *
line_id.price_unit) for line_id in order_id.order_line])
discount_method = fields.Selection(
[('fixed', 'Fixed'), ('per', 'Percentage')], string="Discount Method")