Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
1 Відповісти
6595 Переглядів

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
Аватар
Відмінити
Автор

move_id* not mode id

Related Posts Відповіді Переглядів Дія
1
серп. 20
3365
2
вер. 25
4915
0
жовт. 23
1651
1
лип. 23
5214
1
лют. 22
5737