diff options
| author | Martin Trigaux <mat@odoo.com> | 2020-06-26 07:21:33 +0000 |
|---|---|---|
| committer | Martin Trigaux <mat@odoo.com> | 2020-06-30 10:19:59 +0000 |
| commit | 400cc4f14ed12bce8d11ea515041253a9271f5a5 (patch) | |
| tree | e62f8e54acf97e42325114844494b4b82fc99a07 /addons/l10n_in | |
| parent | 241f06d868296f6e2ef851d6f5d156f59f630b00 (diff) | |
[FIX] *: correct all or improve code translation lookup
This commit fixes all issues detected by the new pylint
gettext-variable test.
It converts some calls to the new syntax
_("Foo %s", bar)
to progressively migrate the code to the new syntax.
A few calls were not technically incorrect but still detected by the
linter.
_("Foo" +
"Bar")
has been converted to
_("Foo"
"Bar")
as it has the same effect and make sure the argument is of type
asteroid.Const instead of BinOp).
closes odoo/odoo#53683
Related: odoo/enterprise#11467
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
Diffstat (limited to 'addons/l10n_in')
| -rw-r--r-- | addons/l10n_in/models/account_invoice.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/addons/l10n_in/models/account_invoice.py b/addons/l10n_in/models/account_invoice.py index 5f7b203d0f3..316f461c488 100644 --- a/addons/l10n_in/models/account_invoice.py +++ b/addons/l10n_in/models/account_invoice.py @@ -46,7 +46,7 @@ class AccountMove(models.Model): Also we raise if state is not set in Indian customer. State is big role under GST because tax type is depend on.for more information check this https://www.cbic.gov.in/resources//htdocs-cbec/gst/Integrated%20goods%20&%20Services.pdf""" if partner.country_id and partner.country_id.code == 'IN' and not partner.state_id: - raise ValidationError(_("State is missing from address in '%s'. First set state after post this invoice again." %(partner.name))) + raise ValidationError(_("State is missing from address in '%s'. First set state after post this invoice again.", partner.name)) elif partner.country_id and partner.country_id.code != 'IN': return self.env.ref('l10n_in.state_in_ot') return partner.state_id @@ -96,14 +96,23 @@ class AccountMove(models.Model): """Check state is set in company/sub-unit""" company_unit_partner = move.journal_id.l10n_in_gstin_partner_id or move.journal_id.company_id if not company_unit_partner.state_id: - raise ValidationError(_("State is missing from your company/unit %s(%s).\nFirst set state in your company/unit." % (company_unit_partner.name, company_unit_partner.id))) + raise ValidationError(_( + "State is missing from your company/unit %(company_name)s (%(company_id)s).\nFirst set state in your company/unit.", + company_name=company_unit_partner.name, + company_id=company_unit_partner.id + )) elif self.journal_id.type == 'purchase': move.l10n_in_state_id = company_unit_partner.state_id shipping_partner = move._l10n_in_get_shipping_partner() move.l10n_in_gstin = move._l10n_in_get_shipping_partner_gstin(shipping_partner) if not move.l10n_in_gstin and move.l10n_in_gst_treatment in ['regular', 'composition', 'special_economic_zone', 'deemed_export']: - raise ValidationError(_("Partner %s(%s) GSTIN is required under GST Treatment %s" % (shipping_partner.name, shipping_partner.id, gst_treatment_name_mapping.get(move.l10n_in_gst_treatment)))) + raise ValidationError(_( + "Partner %(partner_name)s (%(partner_id)s) GSTIN is required under GST Treatment %(name)s", + partner_name=shipping_partner.name, + partner_id=shipping_partner.id, + name=gst_treatment_name_mapping.get(move.l10n_in_gst_treatment) + )) if self.journal_id.type == 'sale': move.l10n_in_state_id = self._l10n_in_get_indian_state(shipping_partner) if not move.l10n_in_state_id: |
