(self)
Load some company data (the VAT number) when company changes.
Load some company data (the VAT number) when company changes.
Load some company data ( the VAT number ) when company changes .
def onchange_company_id(self):
        """Load some company data (the VAT number) when company changes."""
        if self.company_id.vat:
            # Remove the ES part from spanish vat numbers
            #  (ES12345678Z => 12345678Z)
            self.company_vat = re.match("(ES){0,1}(.*)", self.company_id.vat).groups()[
                1
            ]
        self.contact_name = self.env.user.name
        self.contact_email = self.env.user.email
        self.contact_phone = self._filter_phone(
            self.env.user.partner_id.phone
            or self.env.user.partner_id.mobile
            or self.env.user.company_id.phone
        )
def onchange_company_id ( self ) : if self . company_id . vat : # Remove the ES part from spanish vat numbers #  (ES12345678Z => 12345678Z) self . company_vat = re . match ( "(ES){0,1}(.*)" , self . company_id . vat ) . groups ( ) [ 1 ] self . contact_name = self . env . user . name self . contact_email = self . env . user . email self . contact_phone = self . _filter_phone ( self . env . user . partner_id . phone or self . env . user . partner_id . mobile or self . env . user . company_id . phone )