Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
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?

Awatar
Odrzuć
Najlepsza odpowiedź

May i know if you have a solution for this? 

Awatar
Odrzuć
Najlepsza odpowiedź

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

Awatar
Odrzuć
Autor

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

Powiązane posty Odpowiedzi Widoki Czynność
1
lip 24
2090
6
maj 24
21580
3
mar 16
6601
2
lut 25
1736
2
maj 23
2436