Zum Inhalt springen
Menü
Sie müssen registriert sein, um mit der Community zu interagieren.
Diese Frage wurde gekennzeichnet

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
Avatar
Verwerfen
Autor

move_id* not mode id

Verknüpfte Beiträge Antworten Ansichten Aktivität
1
Aug. 20
3354
2
Sept. 25
4890
0
Okt. 23
1645
1
Juli 23
5199
1
Feb. 22
5729