تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
2 الردود
2314 أدوات العرض
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?

الصورة الرمزية
إهمال
أفضل إجابة

May i know if you have a solution for this? 

الصورة الرمزية
إهمال
أفضل إجابة

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

الصورة الرمزية
إهمال
الكاتب

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

المنشورات ذات الصلة الردود أدوات العرض النشاط
1
يوليو 24
2110
6
مايو 24
21609
3
مارس 16
6621
2
فبراير 25
1800
2
مايو 23
2451