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 @@ -20,15 +20,10 @@ class AccountInvoice(models.Model):
2020 @api .depends ("fiscal_position_id" )
2121 def _compute_price_unit_include_taxes (self ):
2222 # Check if fiscal_position is w ou wo taxes (just checking first line)
23- for invoice in self :
24- # Check if there is a fiscal_position
25- try :
26- tax_dest = invoice .fiscal_position_id .tax_ids [0 ].tax_dest_id
27- # No fiscal position → wo taxes
28- except IndexError :
29- invoice .price_unit_include_taxes = False
23+ # Default : no fiscal position → no taxes
24+ self .price_unit_include_taxes = False
25+ for invoice in self .filtered (lambda x : x .fiscal_position_id .tax_ids ):
26+ if invoice .fiscal_position_id .tax_ids [0 ].tax_dest_id .price_include :
27+ invoice .price_unit_include_taxes = True
3028 else :
31- if tax_dest .price_include :
32- invoice .price_unit_include_taxes = True
33- else :
34- invoice .price_unit_include_taxes = False
29+ invoice .price_unit_include_taxes = False
You can’t perform that action at this time.
0 commit comments