Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
analytic_account_id = fields.Many2one(
   "account.analytic.account", string="Analytic Account Type", store=True)

And then

_inherit = "stock. valuation.layer"

Here, add the analytic account to the account.move dictionary

account_move = self.env["account.move"].sudo().create(account_move_vals)
for lines in self.account_move_id.line_ids:
   lines. write(
       {
           "analytic_account_id": self.stock_move_id.account_analytic_id.id
       }
   )
account_move._post()

 
This section is provided by cybrosys, and its intended to add an analytic account field on the stock.move.line so we can track the cost of the products in a specific analytic account. When implemented I am getting the error that : "account_move_vals" is not defined.

How can I overcome this and fix it in Odoo 16?

Imagine profil
Abandonează
Cel mai bun răspuns

May i know if you have a solution for this? 

Imagine profil
Abandonează
Cel mai bun răspuns

You need to define the account_move_line object, something like below. Also look out for any other required fields that might be in your model

account_move_line =  {
"date": fields.Date.today(),            
'move_type': 'entry',            
'journal_id': [Your journal ID],            
'partner_id': [Your Partner ID],           
'ref': [Your Refernce] ,            
'payment_reference': [Your Payment Ref],            
'company_id': [Company ID],            
'currency_id': [Currency ID]
}

Imagine profil
Abandonează
Autor

I am doing it using automated action, can you help me fix the code?

Related Posts Răspunsuri Vizualizări Activitate
1
iul. 24
2098
6
mai 24
21591
3
mar. 16
6608
2
feb. 25
1764
2
mai 23
2441