跳至内容
菜单
此问题已终结
2 回复
4009 查看

Trying to grammatically change the tax value of a invoice.
Tax is changing or updating in line
but to re computation works. amount,tax amount,total etc.

tried to invoke methods

line._onchange_mark_recompute_taxes()
line._onchange_price_subtotal()
move._compute_tax_lock_date_message()
move._compute_invoice_taxes_by_group()

 

形象
丢弃
最佳答案

Hi,

Try calling the _recompute_dynamic_lines or _recompute_tax_lines function.

Thanks

形象
丢弃
编写者

it thrown some error like,Cannot create unbalanced journal entry. Ids:
seems like we should call something before

pass check check_move_validity=False in the context

编写者

def _recompute_tax_lines(self, recompute_tax_base_amount=False):
def _recompute_dynamic_lines(self, recompute_all_taxes=False,recompute_tax_base_amount=False):

there is no parameter like check_move_validity

its not a parameter, its a marker which has to pass in the context.
with_context(check_move_validity=False)

suppose if you are calling self.action_test(), call it as self.with_context(check_move_validity=False).action_test()

编写者 最佳答案

Finally,
move.with_context(check_move_validity=False)._recompute_dynamic_lines(recompute_all_taxes=True)

Thanks :)

形象
丢弃

this worked. thanks.

Perfect... Thanks

相关帖文 回复 查看 活动
5
12月 22
5405
3
1月 20
6165
2
3月 15
3634
1
7月 25
364
0
8月 22
68