Odoo modules extending contacts / partners
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.

22 lines
596 B

# -*- coding: utf-8 -*-
import logging
from odoo import models, fields, api, tools
_logger = logging.getLogger(__name__)
class ResPartner(models.Model):
_inherit = "res.partner"
state_id = fields.Many2one(
compute="_compute_country_depatemnt",
store=True,
)
@api.depends("country_department_id")
def _compute_country_depatemnt(self):
for partner in self:
dept = partner.country_department_id
dept_stat = dept.state_id
if dept and dept_stat and not partner.state_id:
partner.state_id = dept_stat