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

I am trying to unlink account.move.line through wizard on a button but error is getting called as "unbalanced entry debit - credit", Below is my code and screenshot of error for reference.
I can understand it wants to delete the journal items too , but how to do it?

def confirm(self):
if not self.move_lines:
raise UserError(_("Please check no any lines Available in wizard."))
move_lines = self.move_lines.filtered(lambda line: line.select_item == True)
for line in move_lines:
line.move_line_id.unlink()
return {'type': 'ir.actions.act_window_close'}


อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi,

Please try the below code using check_move_validity=False in context

def confirm(self):
if not self.move_lines:
raise UserError(_("Please check no any lines Available in wizard."))
move_lines = self.move_lines.filtered(lambda line: line.select_item == True)
for line in move_lines:
line.move_line_id.with_context(check_move_validity=False).unlink()
return {'type': 'ir.actions.act_window_close'}


Hope this will help you

Thanks


อวตาร
ละทิ้ง
ผู้เขียน

Hey thankyou buddy, It worked.

Related Posts ตอบกลับ มุมมอง กิจกรรม
0
เม.ย. 23
3056
Triggering wizard action แก้ไขแล้ว
1
ต.ค. 22
5602
2
มี.ค. 22
4538
2
มี.ค. 22
7082
0
มิ.ย. 24
3173