Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
4076 มุมมอง

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

Related Posts ตอบกลับ มุมมอง กิจกรรม
5
ธ.ค. 22
5476
3
ม.ค. 20
6217
2
มี.ค. 15
3660
1
ก.ค. 25
412
0
ส.ค. 22
68