File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ class SaleOrder(models.Model):
6060 ]
6161
6262 def _is_shoppingfeed_disable_invoicing (self ):
63- return self .shoppingfeed_channel_id .disable_invoicing
63+ return bool ( self and self .shoppingfeed_channel_id .disable_invoicing )
6464
6565 @api .depends ("shoppingfeed_channel_id" )
6666 def _compute_invoice_status (self ):
@@ -487,6 +487,7 @@ class SaleOrderLine(models.Model):
487487 def _compute_invoice_status (self ):
488488 res = super ()._compute_invoice_status ()
489489 self .filtered (
490- lambda sol : sol .order_id ._is_shoppingfeed_disable_invoicing ()
490+ lambda sol : sol .order_id
491+ and sol .order_id ._is_shoppingfeed_disable_invoicing ()
491492 ).invoice_status = "no"
492493 return res
Original file line number Diff line number Diff line change @@ -119,6 +119,12 @@ def test_invoice_not_auto_paid_when_disabled(self):
119119 self .assertNotEqual (invoice .payment_state , "paid" )
120120 self .sf_channel .auto_pay = True
121121
122+ def test_invoice_status_on_new_line_without_order (self ):
123+ """Temporary lines can compute invoice status before an order exists."""
124+ line = self .env ["sale.order.line" ].new ({"product_id" : self .product_a .id })
125+ line ._compute_invoice_status ()
126+ self .assertEqual (line .invoice_status , "no" )
127+
122128 def test_product_reference_cleaning (self ):
123129 """_shoppingfeed_clean_product_reference strips 2-char country suffixes only."""
124130 so = self .env ["sale.order" ]
You can’t perform that action at this time.
0 commit comments