summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorjbw <jbw@odoo.com>2021-02-03 15:01:41 +0000
committerjbw <jbw@odoo.com>2021-02-08 10:32:45 +0000
commitd68fb5f72d69d0382392afd7407f94520857f764 (patch)
treedcd713708662b27fb7a42329c55cc3981aa3a436 /addons
parent38983d123d171ac3cc1efacd99d9776f0ed08734 (diff)
[IMP] account: get default payment ref format with country
Set the payment reference standard to the one of the country of the company by default. This is a backport of task 2297165. Mimicking it's bahviour without merging the l10n_be_invoice_bba module into the l10n_be module. closes odoo/odoo#65466 Task: 2440462 Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
Diffstat (limited to 'addons')
-rw-r--r--addons/account/models/account_journal.py12
-rw-r--r--addons/l10n_be/i18n_extra/l10n_be.pot27
-rw-r--r--addons/l10n_be/models/__init__.py2
-rw-r--r--addons/l10n_be/models/account_invoice.py (renamed from addons/l10n_be_invoice_bba/models/account_invoice.py)0
-rw-r--r--addons/l10n_be/models/account_journal.py (renamed from addons/l10n_be_invoice_bba/models/account_journal.py)1
-rw-r--r--addons/l10n_be_invoice_bba/__init__.py2
-rw-r--r--addons/l10n_be_invoice_bba/__manifest__.py5
-rw-r--r--addons/l10n_be_invoice_bba/i18n/l10n_be_invoice_bba.pot1
-rw-r--r--addons/l10n_be_invoice_bba/models/__init__.py7
9 files changed, 47 insertions, 10 deletions
diff --git a/addons/account/models/account_journal.py b/addons/account/models/account_journal.py
index fec1a2c4fd9..29a726f6447 100644
--- a/addons/account/models/account_journal.py
+++ b/addons/account/models/account_journal.py
@@ -43,6 +43,16 @@ class AccountJournal(models.Model):
def _default_alias_domain(self):
return self.env["ir.config_parameter"].sudo().get_param("mail.catchall.domain")
+
+ def _default_invoice_reference_model(self):
+ """Get the invoice reference model according to the company's country."""
+ country_code = self.env.company.country_id.code
+ country_code = country_code and country_code.lower()
+ if country_code:
+ for model in self._fields['invoice_reference_model'].get_values(self.env):
+ if model.startswith(country_code):
+ return model
+ return 'odoo'
name = fields.Char(string='Journal Name', required=True)
code = fields.Char(string='Short Code', size=5, required=True, help="Shorter name used for display. The journal entries of this journal will also be named using this prefix by default.")
@@ -100,7 +110,7 @@ class AccountJournal(models.Model):
sequence = fields.Integer(help='Used to order Journals in the dashboard view', default=10)
invoice_reference_type = fields.Selection(string='Communication Type', required=True, selection=[('none', 'Free'), ('partner', 'Based on Customer'), ('invoice', 'Based on Invoice')], default='invoice', help='You can set here the default communication that will appear on customer invoices, once validated, to help the customer to refer to that particular invoice when making the payment.')
- invoice_reference_model = fields.Selection(string='Communication Standard', required=True, selection=[('odoo', 'Odoo'),('euro', 'European')], default='odoo', help="You can choose different models for each type of reference. The default one is the Odoo reference.")
+ invoice_reference_model = fields.Selection(string='Communication Standard', required=True, selection=[('odoo', 'Odoo'),('euro', 'European')], default=_default_invoice_reference_model, help="You can choose different models for each type of reference. The default one is the Odoo reference.")
#groups_id = fields.Many2many('res.groups', 'account_journal_group_rel', 'journal_id', 'group_id', string='Groups')
currency_id = fields.Many2one('res.currency', help='The currency used to enter statement', string="Currency")
diff --git a/addons/l10n_be/i18n_extra/l10n_be.pot b/addons/l10n_be/i18n_extra/l10n_be.pot
index de5426600bb..31380196de1 100644
--- a/addons/l10n_be/i18n_extra/l10n_be.pot
+++ b/addons/l10n_be/i18n_extra/l10n_be.pot
@@ -4524,3 +4524,30 @@ msgstr ""
#: model:account.group.template,name:l10n_be.be_group_09
msgid "Droits et engagements divers"
msgstr ""
+
+#. module: l10n_be
+#: model:ir.model.fields.selection,name:l10n_be.selection__account_journal__invoice_reference_model__be
+msgid "Belgium"
+msgstr ""
+
+#. module: l10n_be
+#: model:ir.model.fields,field_description:l10n_be.field_account_journal__invoice_reference_model
+msgid "Communication Standard"
+msgstr ""
+
+#. module: l10n_be
+#: model:ir.model,name:l10n_be.model_account_journal
+msgid "Journal"
+msgstr ""
+
+#. module: l10n_be
+#: model:ir.model,name:l10n_be.model_account_move
+msgid "Journal Entries"
+msgstr ""
+
+#. module: l10n_be
+#: model:ir.model.fields,help:l10n_be.field_account_journal__invoice_reference_model
+msgid ""
+"You can choose different models for each type of reference. The default one "
+"is the Odoo reference."
+msgstr ""
diff --git a/addons/l10n_be/models/__init__.py b/addons/l10n_be/models/__init__.py
index afe2e684616..e7cc9c9ee9a 100644
--- a/addons/l10n_be/models/__init__.py
+++ b/addons/l10n_be/models/__init__.py
@@ -2,3 +2,5 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import account_chart_template
+from . import account_invoice
+from . import account_journal
diff --git a/addons/l10n_be_invoice_bba/models/account_invoice.py b/addons/l10n_be/models/account_invoice.py
index 3ee6d699319..3ee6d699319 100644
--- a/addons/l10n_be_invoice_bba/models/account_invoice.py
+++ b/addons/l10n_be/models/account_invoice.py
diff --git a/addons/l10n_be_invoice_bba/models/account_journal.py b/addons/l10n_be/models/account_journal.py
index 9ec4f408cbd..9fc1baf75cc 100644
--- a/addons/l10n_be_invoice_bba/models/account_journal.py
+++ b/addons/l10n_be/models/account_journal.py
@@ -9,3 +9,4 @@ class AccountJournal(models.Model):
invoice_reference_model = fields.Selection(selection_add=[
('be', 'Belgium')
], ondelete={'be': lambda recs: recs.write({'invoice_reference_model': 'odoo'})})
+
diff --git a/addons/l10n_be_invoice_bba/__init__.py b/addons/l10n_be_invoice_bba/__init__.py
index f5bc480ccb8..36c70b731ab 100644
--- a/addons/l10n_be_invoice_bba/__init__.py
+++ b/addons/l10n_be_invoice_bba/__init__.py
@@ -2,5 +2,3 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
# Copyright (c) 2011 Noviat nv/sa (www.noviat.be). All rights reserved.
-
-from . import models
diff --git a/addons/l10n_be_invoice_bba/__manifest__.py b/addons/l10n_be_invoice_bba/__manifest__.py
index 96aa38ea70d..9f8402c2e56 100644
--- a/addons/l10n_be_invoice_bba/__manifest__.py
+++ b/addons/l10n_be_invoice_bba/__manifest__.py
@@ -3,6 +3,11 @@
# Copyright (c) 2011 Noviat nv/sa (www.noviat.be). All rights reserved.
+
+# This module is empty. It is merged whith l10n_be version 14.1. This behaviour was backported in 14.0
+# but the module can not removed in a stable version.
+
+
{
'name': 'Belgium - Structured Communication',
'version': '1.2',
diff --git a/addons/l10n_be_invoice_bba/i18n/l10n_be_invoice_bba.pot b/addons/l10n_be_invoice_bba/i18n/l10n_be_invoice_bba.pot
index 9aa40adacad..f8bbd6bf5d5 100644
--- a/addons/l10n_be_invoice_bba/i18n/l10n_be_invoice_bba.pot
+++ b/addons/l10n_be_invoice_bba/i18n/l10n_be_invoice_bba.pot
@@ -41,3 +41,4 @@ msgid ""
"You can choose different models for each type of reference. The default one "
"is the Odoo reference."
msgstr ""
+
diff --git a/addons/l10n_be_invoice_bba/models/__init__.py b/addons/l10n_be_invoice_bba/models/__init__.py
deleted file mode 100644
index 18a4627629e..00000000000
--- a/addons/l10n_be_invoice_bba/models/__init__.py
+++ /dev/null
@@ -1,7 +0,0 @@
-# -*- coding: utf-8 -*-
-# Part of Odoo. See LICENSE file for full copyright and licensing details.
-
-# Copyright (c) 2011 Noviat nv/sa (www.noviat.be). All rights reserved.
-
-from . import account_invoice
-from . import account_journal \ No newline at end of file