(self)
Inheritable method for exceptions control when sending SII invoices.
Inheritable method for exceptions control when sending SII invoices.
Inheritable method for exceptions control when sending SII invoices .
def _sii_check_exceptions(self):
        """Inheritable method for exceptions control when sending SII invoices."""
        self.ensure_one()
        gen_type = self._get_sii_gen_type()
        partner = self._sii_get_partner()
        country_code = self._get_sii_country_code()
        is_simplified_invoice = self._is_sii_simplified_invoice()

        if is_simplified_invoice and self.move_type[:2] == "in":
            raise exceptions.UserError(
                _("You can't make a supplier simplified invoice.")
            )
        if (
            (gen_type != 3 or country_code == "ES")
            and not partner.vat
            and not is_simplified_invoice
        ):
            raise exceptions.UserError(_("The partner has not a VAT configured."))
        if not self.company_id.chart_template_id:
            raise exceptions.UserError(
                _("You have to select what account chart template use this" " company.")
            )
        if not self.company_id.sii_enabled:
            raise exceptions.UserError(_("This company doesn't have SII enabled."))
        if not self.sii_enabled:
            raise exceptions.UserError(_("This invoice is not SII enabled."))
        if not self.ref and self.move_type in ["in_invoice", "in_refund"]:
            raise exceptions.UserError(_("The supplier number invoice is required"))
def _sii_check_exceptions ( self ) : self . ensure_one ( ) gen_type = self . _get_sii_gen_type ( ) partner = self . _sii_get_partner ( ) country_code = self . _get_sii_country_code ( ) is_simplified_invoice = self . _is_sii_simplified_invoice ( ) if is_simplified_invoice and self . move_type [ : 2 ] == "in" : raise exceptions . UserError ( _ ( "You can't make a supplier simplified invoice." ) ) if ( ( gen_type != 3 or country_code == "ES" ) and not partner . vat and not is_simplified_invoice ) : raise exceptions . UserError ( _ ( "The partner has not a VAT configured." ) ) if not self . company_id . chart_template_id : raise exceptions . UserError ( _ ( "You have to select what account chart template use this" " company." ) ) if not self . company_id . sii_enabled : raise exceptions . UserError ( _ ( "This company doesn't have SII enabled." ) ) if not self . sii_enabled : raise exceptions . UserError ( _ ( "This invoice is not SII enabled." ) ) if not self . ref and self . move_type in [ "in_invoice" , "in_refund" ] : raise exceptions . UserError ( _ ( "The supplier number invoice is required" ) )