summaryrefslogtreecommitdiff
path: root/addons/l10n_ar/models
diff options
context:
space:
mode:
authorMartin Trigaux <mat@odoo.com>2020-06-15 15:23:02 +0200
committerMartin Trigaux <mat@odoo.com>2020-06-18 13:03:34 +0200
commit4a92a183e8631512a8b018eedaf9bf4956ca85e9 (patch)
treeaf8cced34ea8f6f05ff142739e91d8f26571745a /addons/l10n_ar/models
parentba244cef01132347df4d2d9553ea3105ba13a938 (diff)
[IMP] *: better construction of translatable content
Do not construct a message by putting together translatable bits, it makes it hard to translate (out of context) and may not work for some languages constructing the sentences differently. Do not try to save bits, be explict. Clarify constructions for long oneliners.
Diffstat (limited to 'addons/l10n_ar/models')
-rw-r--r--addons/l10n_ar/models/account_move.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/addons/l10n_ar/models/account_move.py b/addons/l10n_ar/models/account_move.py
index 5184de1cb8d..afb6ac9ee56 100644
--- a/addons/l10n_ar/models/account_move.py
+++ b/addons/l10n_ar/models/account_move.py
@@ -129,22 +129,20 @@ class AccountMove(models.Model):
res_code = rec.partner_id.l10n_ar_afip_responsibility_type_id.code
domain = [('company_id', '=', rec.company_id.id), ('l10n_latam_use_documents', '=', True), ('type', '=', 'sale')]
journal = self.env['account.journal']
- partner_type = journal_type = False
+ msg = False
if res_code in ['9', '10'] and rec.journal_id.l10n_ar_afip_pos_system not in expo_journals:
# if partner is foregin and journal is not of expo, we try to change to expo journal
journal = journal.search(domain + [('l10n_ar_afip_pos_system', 'in', expo_journals)], limit=1)
- partner_type, journal_type = (_('foreign partner'), _('exportation'))
+ msg = _('You are trying to create an invoice for foreign partner but you don\'t have an exportation journal')
elif res_code not in ['9', '10'] and rec.journal_id.l10n_ar_afip_pos_system in expo_journals:
# if partner is NOT foregin and journal is for expo, we try to change to local journal
journal = journal.search(domain + [('l10n_ar_afip_pos_system', 'not in', expo_journals)], limit=1)
- partner_type, journal_type = (_('domestic partner'), _('domestic market'))
+ msg = _('You are trying to create an invoice for domestic partner but you don\'t have an domestic market journal')
if journal:
rec.journal_id = journal.id
- elif partner_type and journal_type:
+ elif msg:
# Throw an error to user in order to proper configure the journal for the type of operation
action = self.env.ref('account.action_account_journal_form')
- msg = _('You are trying to create an invoice for %s but you dont have an %s journal') % (
- partner_type, journal_type)
raise RedirectWarning(msg, action.id, _('Go to Journals'))
def post(self):