Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ

Hey i am trying to create a move line based on analytic account distribution like if the first line added by me has an analytic tag with a check box of analytic distribution marked true. I am confused in write or new method. Kindly help me with this

@api.onchange('analytic_tag_ids')
def analytic_account(self):
for rec in self:
if rec.analytic_tag_ids:
for record in rec.analytic_tag_ids.analytic_distribution_ids:
self.analytic_account_id = record.account_id
self.price_subtotal = (rec.price_subtotal * record.percentage) / 100
create_method = self.env['account.move.line'].create or self.env['account.move.line'].new
inv_line = create_method({
'name': self.name,
'move_id': self.id,
'account_id': rec.account_id.id,
'analytic_tag_ids': rec.analytic_tag_ids,
'analytic_account_id': rec.analytic_account_id.id
})
return inv_line

else:
self.analytic_account_id = False

Right now i am getting mode id error but i dont think i am still doing right. Kindly help
Ảnh đại diện
Huỷ bỏ
Tác giả

move_id* not mode id

Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 8 20
3332
2
thg 9 25
4866
0
thg 10 23
1634
1
thg 7 23
5173
1
thg 2 22
5716