[FIX] sale, delivery: invoice status updated when adding note
-Create a sales order. -Add product E-COM11 (invoicing policy "Delivered quantities"). -Add Delivery method "Normal Delivery Charges". -Confirm Sale. -Sale Order Invoice Status = "Nothing to Invoice" (OK). -Now Open Sales Order again in Edit mode. -Add Choose "Add a note" in the order line section and add a random note and don't save yet. -Check the "Invoice Status" in the "Other Information" tab. Before this commit: -The status of the invoice changed to "Fully Invoiced". -If you save the invoice with the new note, the status changes to "To Invoice". After this commit: The status stays "Nothing to Invoice" in both cases. closes odoo/odoo#38097 Opw: 2078581 X-original-commit: 86301d36fa7b0b6f7f524fff2623077c4366273a Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
committed by
fw-bot
parent
bb53ee456d
commit
e21efb18d4
@@ -126,7 +126,7 @@ class SaleOrder(models.Model):
|
||||
def _get_invoiced(self):
|
||||
super(SaleOrder, self)._get_invoiced()
|
||||
for order in self:
|
||||
order_line = order.order_line.filtered(lambda x: not x.is_delivery and not x.is_downpayment)
|
||||
order_line = order.order_line.filtered(lambda x: not x.is_delivery and not x.is_downpayment and not x.display_type)
|
||||
if all(line.product_id.invoice_policy == 'delivery' and line.invoice_status == 'no' for line in order_line):
|
||||
order.update({'invoice_status': 'no'})
|
||||
|
||||
|
||||
@@ -79,9 +79,9 @@ class SaleOrder(models.Model):
|
||||
invoice_status = 'no'
|
||||
elif any(invoice_status == 'to invoice' for invoice_status in line_invoice_status):
|
||||
invoice_status = 'to invoice'
|
||||
elif all(invoice_status == 'invoiced' for invoice_status in line_invoice_status):
|
||||
elif line_invoice_status and all(invoice_status == 'invoiced' for invoice_status in line_invoice_status):
|
||||
invoice_status = 'invoiced'
|
||||
elif all(invoice_status in ['invoiced', 'upselling'] for invoice_status in line_invoice_status):
|
||||
elif line_invoice_status and all(invoice_status in ['invoiced', 'upselling'] for invoice_status in line_invoice_status):
|
||||
invoice_status = 'upselling'
|
||||
else:
|
||||
invoice_status = 'no'
|
||||
|
||||
Reference in New Issue
Block a user