[FIX] *: avoid non-searchable field dependencies

closes odoo/odoo#98562

Related: odoo/enterprise#30639
Signed-off-by: Raphael Collet <rco@odoo.com>
This commit is contained in:
Raphael Collet
2022-08-29 22:43:11 +02:00
parent 6edcad51a5
commit b38a5f78b6
6 changed files with 6 additions and 6 deletions
+1 -1
View File
@@ -1218,7 +1218,7 @@ class AccountMove(models.Model):
else:
record.tax_country_id = record.company_id.account_fiscal_country_id
@api.depends('tax_country_id.code')
@api.depends('tax_country_id')
def _compute_tax_country_code(self):
for record in self:
record.tax_country_code = record.tax_country_id.code
+1 -1
View File
@@ -136,7 +136,7 @@ class ResCompany(models.Model):
automatic_entry_default_journal_id = fields.Many2one('account.journal', help="Journal used by default for moving the period of an entry", domain="[('type', '=', 'general')]")
# Technical field to hide country specific fields in company form view
country_code = fields.Char(related='country_id.code')
country_code = fields.Char(related='country_id.code', depends=['country_id'])
# Taxes
account_fiscal_country_id = fields.Many2one(
+1 -1
View File
@@ -41,7 +41,7 @@ class FleetVehicle(models.Model):
)
currency_id = fields.Many2one('res.currency', related='company_id.currency_id')
country_id = fields.Many2one('res.country', related='company_id.country_id')
country_code = fields.Char(related='country_id.code')
country_code = fields.Char(related='country_id.code', depends=['country_id'])
license_plate = fields.Char(tracking=True,
help='License plate number of the vehicle (i = plate number for a car)')
vin_sn = fields.Char('Chassis Number', help='Unique number written on the vehicle motor (VIN/SN number)', copy=False)
+1 -1
View File
@@ -37,7 +37,7 @@ class HrEmployeePrivate(models.Model):
active = fields.Boolean('Active', related='resource_id.active', default=True, store=True, readonly=False)
company_id = fields.Many2one('res.company', required=True)
company_country_id = fields.Many2one('res.country', 'Company Country', related='company_id.country_id', readonly=True)
company_country_code = fields.Char(related='company_country_id.code', readonly=True)
company_country_code = fields.Char(related='company_country_id.code', depends=['company_country_id'], readonly=True)
# private partner
address_home_id = fields.Many2one(
'res.partner', 'Address', help='Enter here the private address of the employee, not the one linked to your company.',
+1 -1
View File
@@ -45,7 +45,7 @@ class Contract(models.Model):
company_id = fields.Many2one('res.company', compute='_compute_employee_contract', store=True, readonly=False,
default=lambda self: self.env.company, required=True)
company_country_id = fields.Many2one('res.country', string="Company country", related='company_id.country_id', readonly=True)
country_code = fields.Char(related='company_country_id.code', readonly=True)
country_code = fields.Char(related='company_country_id.code', depends=['company_country_id'], readonly=True)
contract_type_id = fields.Many2one('hr.contract.type', "Contract Type")
"""
@@ -39,7 +39,7 @@ class ContractHistory(models.Model):
wage = fields.Monetary('Wage', help="Employee's monthly gross wage.", readonly=True, group_operator="avg")
company_id = fields.Many2one('res.company', string='Company', readonly=True)
company_country_id = fields.Many2one('res.country', string="Company country", related='company_id.country_id', readonly=True)
country_code = fields.Char(related='company_country_id.code', readonly=True)
country_code = fields.Char(related='company_country_id.code', depends=['company_country_id'], readonly=True)
currency_id = fields.Many2one(string='Currency', related='company_id.currency_id', readonly=True)
contract_type_id = fields.Many2one('hr.contract.type', 'Contract Type', readonly=True)
contract_ids = fields.One2many('hr.contract', string='Contracts', compute='_compute_contract_ids', readonly=True)