Skip to content

Commit

Permalink
Merge PR #394 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by dreispt
  • Loading branch information
OCA-git-bot committed Nov 28, 2023
2 parents 54ac8a8 + 7f28a4f commit d511070
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions account_avatax_sale_oca/models/sale_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,22 +271,23 @@ def onchange_avatax_calculation(self):
self.calculate_tax_on_save = True
break

@api.model
def create(self, vals):
record = super(SaleOrder, self).create(vals)
@api.model_create_multi
def create(self, vals_list):
sales = super().create(vals_list)
avatax_config = self.env.company.get_avatax_config_company()
if (
avatax_config.sale_calculate_tax
and record.calculate_tax_on_save
and not self._context.get("skip_second_write", False)
):
record.with_context(skip_second_write=True).write(
{
"calculate_tax_on_save": False,
}
)
record.avalara_compute_taxes()
return record
for sale in sales:
if (
avatax_config.sale_calculate_tax
and sale.calculate_tax_on_save
and not self._context.get("skip_second_write", False)
):
sale.with_context(skip_second_write=True).write(
{
"calculate_tax_on_save": False,
}
)
sale.avalara_compute_taxes()
return sales

def write(self, vals):
result = super(SaleOrder, self).write(vals)
Expand Down

0 comments on commit d511070

Please sign in to comment.