diff --git a/addons/delivery/models/sale_order.py b/addons/delivery/models/sale_order.py index 9ff00b7fce3..9a32265844e 100644 --- a/addons/delivery/models/sale_order.py +++ b/addons/delivery/models/sale_order.py @@ -134,8 +134,8 @@ class SaleOrder(models.Model): return u' {pre}{0}{post}'.format(amount, pre=pre, post=post) @api.depends('order_line.is_delivery', 'order_line.is_downpayment') - def _get_invoice_status(self): - super()._get_invoice_status() + def _compute_invoice_status(self): + super()._compute_invoice_status() for order in self: if order.invoice_status in ['no', 'invoiced']: continue diff --git a/addons/sale/models/sale_order.py b/addons/sale/models/sale_order.py index a49d4f4b1fd..6f5f0648327 100644 --- a/addons/sale/models/sale_order.py +++ b/addons/sale/models/sale_order.py @@ -226,7 +226,7 @@ class SaleOrder(models.Model): invoice_status = fields.Selection( selection=INVOICE_STATUS, string="Invoice Status", - compute='_get_invoice_status', + compute='_compute_invoice_status', store=True) # Payment fields @@ -471,7 +471,7 @@ class SaleOrder(models.Model): ] @api.depends('state', 'order_line.invoice_status') - def _get_invoice_status(self): + def _compute_invoice_status(self): """ Compute the invoice status of a SO. Possible statuses: - no: if the SO is not in status 'sale' or 'done', we consider that there is nothing to diff --git a/addons/sale_loyalty/models/sale_order.py b/addons/sale_loyalty/models/sale_order.py index 898763438cb..75bbc151891 100644 --- a/addons/sale_loyalty/models/sale_order.py +++ b/addons/sale_loyalty/models/sale_order.py @@ -406,12 +406,12 @@ class SaleOrder(models.Model): self.ensure_one() return self._get_points_programs() | self._get_reward_programs() - def _get_invoice_status(self): + def _compute_invoice_status(self): # Handling of a specific situation: an order contains # a product invoiced on delivery and a promo line invoiced # on order. We would avoid having the invoice status 'to_invoice' # if the created invoice will only contain the promotion line - super()._get_invoice_status() + super()._compute_invoice_status() for order in self: if order.invoice_status != 'to invoice': continue diff --git a/addons/sale_loyalty/tests/test_sale_invoicing.py b/addons/sale_loyalty/tests/test_sale_invoicing.py index d09a7ac553e..600828c137f 100644 --- a/addons/sale_loyalty/tests/test_sale_invoicing.py +++ b/addons/sale_loyalty/tests/test_sale_invoicing.py @@ -49,7 +49,7 @@ class TestSaleInvoicing(TestSaleCouponCommon): invoiceable_lines = order._get_invoiceable_lines() # Product was not delivered, we cannot invoice # the product line nor the promotion line - order._get_invoice_status() + order._compute_invoice_status() self.assertEqual(order.invoice_status, 'no') self.assertEqual(len(invoiceable_lines), 0) with self.assertRaises(UserError): @@ -57,7 +57,7 @@ class TestSaleInvoicing(TestSaleCouponCommon): order.order_line[0].qty_delivered = 1 # Product is delivered, the two lines can be invoiced. - order._get_invoice_status() + order._compute_invoice_status() self.assertEqual(order.invoice_status, 'to invoice') invoiceable_lines = order._get_invoiceable_lines() self.assertEqual(order.order_line, invoiceable_lines) diff --git a/addons/sale_timesheet/tests/test_upsell_warning.py b/addons/sale_timesheet/tests/test_upsell_warning.py index 6811ce3cc1a..c3242077113 100644 --- a/addons/sale_timesheet/tests/test_upsell_warning.py +++ b/addons/sale_timesheet/tests/test_upsell_warning.py @@ -67,8 +67,8 @@ class TestUpsellWarning(TestCommonSaleTimesheet): timesheet._compute_so_line() so.order_line._compute_qty_delivered() so.order_line._compute_invoice_status() - so._get_invoice_status() - # Normally this method is called at the end of _get_invoice_status and other compute method. Here, we simulate for invoice_status field + so._compute_invoice_status() + # Normally this method is called at the end of _compute_invoice_status and other compute method. Here, we simulate for invoice_status field so._compute_field_value(so._fields['invoice_status']) self.assertEqual(len(so.activity_search(['sale.mail_act_sale_upsell'])), 0, 'No upsell warning should appear in the SO.') @@ -78,8 +78,8 @@ class TestUpsellWarning(TestCommonSaleTimesheet): timesheet._compute_so_line() so.order_line._compute_qty_delivered() so.order_line._compute_invoice_status() - so._get_invoice_status() - # Normally this method is called at the end of _get_invoice_status and other compute method. Here, we simulate for invoice_status field + so._compute_invoice_status() + # Normally this method is called at the end of _compute_invoice_status and other compute method. Here, we simulate for invoice_status field so._compute_field_value(so._fields['invoice_status']) # 5) Check if the SO has an 'sale.mail_act_sale_upsell' activity.