File tree Expand file tree Collapse file tree 1 file changed +6
-11
lines changed Expand file tree Collapse file tree 1 file changed +6
-11
lines changed Original file line number Diff line number Diff line change @@ -17,15 +17,10 @@ class AccountInvoice(models.Model):
1717 @api .depends ("fiscal_position_id" )
1818 def _compute_price_unit_include_taxes (self ):
1919 # Check if fiscal_position is w ou wo taxes (just checking first line)
20- for invoice in self :
21- # Check if there is a fiscal_position
22- try :
23- tax_dest = invoice .fiscal_position_id .tax_ids [0 ].tax_dest_id
24- # No fiscal position → wo taxes
25- except IndexError :
26- invoice .price_unit_include_taxes = False
20+ # Default : no fiscal position → no taxes
21+ self .price_unit_include_taxes = False
22+ for invoice in self .filtered (lambda x : x .fiscal_position_id .tax_ids ):
23+ if invoice .fiscal_position_id .tax_ids [0 ].tax_dest_id .price_include :
24+ invoice .price_unit_include_taxes = True
2725 else :
28- if tax_dest .price_include :
29- invoice .price_unit_include_taxes = True
30- else :
31- invoice .price_unit_include_taxes = False
26+ invoice .price_unit_include_taxes = False
You can’t perform that action at this time.
0 commit comments