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?