You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
817 B
28 lines
817 B
# -*- coding: utf-8 -*-
|
|
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
|
|
from odoo import fields, models, api
|
|
|
|
|
|
class ResCountryState(models.Model):
|
|
_inherit = "res.country.state"
|
|
|
|
majority_age = fields.Integer(
|
|
string="Majority age",
|
|
compute="_get_country_age",
|
|
inverse="_set_standalone_age",
|
|
store=True,
|
|
readonly=False,
|
|
)
|
|
same_country_age = fields.Boolean(
|
|
string="Same age as country",
|
|
default=True,
|
|
)
|
|
|
|
@api.depends("country_id", "country_id.majority_age")
|
|
def _get_country_age(self):
|
|
for state in self.filtered("same_country_age"):
|
|
state.majority_age = state.country_id.majority_age
|
|
|
|
def _set_standalone_age(self):
|
|
for state in self:
|
|
state.same_country_age = False
|