[MIG] hr_expense_analytic_account_preselect_with_projec: migrate to 18.0
This commit is contained in:
@@ -0,0 +1 @@
|
||||
from . import hr_expense
|
||||
@@ -0,0 +1,14 @@
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class HrExpense(models.Model):
|
||||
_inherit = "hr.expense"
|
||||
|
||||
project_id = fields.Many2one("project.project", string="Projet", required=True)
|
||||
|
||||
@api.onchange("project_id")
|
||||
def set_analytic_account(self):
|
||||
if self.project_id.account_id:
|
||||
self.analytic_distribution = {str(self.project_id.account_id.id): 100}
|
||||
else:
|
||||
self.analytic_distribution = {}
|
||||
Reference in New Issue
Block a user