Skip to Content
Menu
This question has been flagged
908 Views

hello everyone I am odoo newbies I have created a module to Modify the Accounting module. I want to modify vendor bills and customer invoices and ai have added a new column called Budget to fetch all the budget it's a many2one field I want when I select a budget to show me only the analytic account related to it.




class custom_accounting_edit(models.Model):
_inherit = 'crossovered.budget.lines'

analytic_account_id = fields.Many2one('account.analytic.account', 'Budget line')

class BillsEdit(models.Model):
_inherit = 'account.invoice.line'

budget_id = fields.Many2one('crossovered.budget', string='Budget')
account_analytic_id = fields.Many2one('account.analytic.account',
string='Budget line')

@api.onchange('budget_id')
def onchange_analytic_account_id(self):
for rec in self:
return {'domain': {'analytic_account_id': [('analytic_account_id', '=', rec.budget_id.id)]}}
Avatar
Discard