Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
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?

Avatar
Annuleer
Beste antwoord

May i know if you have a solution for this? 

Avatar
Annuleer
Beste antwoord

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]
}

Avatar
Annuleer
Auteur

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

Gerelateerde posts Antwoorden Weergaven Activiteit
1
jul. 24
2090
6
mei 24
21580
3
mrt. 16
6602
2
feb. 25
1740
2
mei 23
2436