Skip to Content
Menu
This question has been flagged
4878 Views
@api.depends('calculate')
def _compute_amount(self):
"""
Compute the amounts of the SO line.
"""
for line in self:
linePrice = line.price_unit * (1 - (0.0) / 100.0)

if line.calculate:

if line.calculate=='product_pcs':

taxes = line.tax_ids.compute_all(linePrice,line.order_id.currency_id, line.product_pcs)


elif line.calculate=='gross_weight':
taxes = line.tax_ids.compute_all(linePrice, line.order_id.currency_id, line.gross_weight)

elif line.calculate=='measure':
taxes = line.tax_ids.compute_all(linePrice, line.order_id.currency_id, line.measure)

else:

taxes={
'total_included':0,
'total_excluded':0

}


for tax in taxes:
price_tax=tax['total_included'] - tax['total_excluded'],
# getting error after this line

price_total=tax['total_included'],
price=tax['total_excluded']

else:
price_tax = False
price_total = False
price = False




line.update({
'price_tax': price_tax,
'price_total':price_total,
'price': price
})
Avatar
Discard