Skip to content
Snippets Groups Projects
Commit 6c9a7592 authored by jbw's avatar jbw
Browse files

[IMP] various : remove-bic-constraint-on-sepa-operations

{ As the SEPA BIC is no longer mandatory we simplify bank creation removing constrains about BIC }
As of 01/02/2016, the BIC is no longer mandatory, you can see the page 25 ==> https://www.febelfin.be/sites/default/files/2019-04/standard-xml-sdd-initiation-_v4.1a-en.pdf
As a result, in order to simplify both the code and the process, we don’t want anymore constrains about that.

task : https://www.odoo.com/web#id=2056370&action=327&model=project.task&view_type=form&menu_id=4720



> We don't need BIC for both the company iban bank account or customer/vendor iban bank account
> If a vendor bill is linked to a valid IBAN bank account without BIC, show the QRcode (remove the BIC constrains )
> CREATE A SDD mandate should be possible without BIC (for both the company iban bank account or customer/vendor iban bank account)
> Create a SCT payment should be possible without BIC (for both the company iban bank account or customer/vendor iban bank account)
> Add a country group for SEPA zone
> Add IBAN country codes for each country in base_iban module
> Only display qr code when making a payment to an IBAN account whose country code corresponds to a SEPA member
> in account's post init hook, install SEPA modules if the country of the company belgons to SEPA zone (instead of Europe, as it is now)

closes odoo/odoo#40356

Related: odoo/enterprise#6738
Signed-off-by: default avataroco-odoo <oco-odoo@users.noreply.github.com>
parent f98b397d
No related branches found
No related tags found
No related merge requests found
......@@ -48,11 +48,11 @@ def _auto_install_l10n(cr, registry):
if country_code == 'MX':
module_list.append('l10n_mx_edi')
# European countries will be using SEPA
europe = env.ref('base.europe', raise_if_not_found=False)
if europe:
europe_country_codes = [x.code for x in europe.country_ids]
if country_code in europe_country_codes:
# SEPA zone countries will be using SEPA
sepa_zone = env.ref('base.sepa_zone', raise_if_not_found=False)
if sepa_zone:
sepa_zone_country_codes = sepa_zone.mapped('country_ids.code')
if country_code in sepa_zone_country_codes:
module_list.append('account_sepa')
module_list.append('account_bank_statement_import_camt')
module_ids = env['ir.module.module'].search([('name', 'in', module_list), ('state', '=', 'uninstalled')])
......
......@@ -1033,7 +1033,7 @@
<field eval="692" name="phone_code" />
</record>
<record id="mk" model="res.country">
<field name="name">Macedonia, the former Yugoslav Republic of</field>
<field name="name">North Macedonia</field>
<field name="code">mk</field>
<field file="base/static/img/country_flags/mk.png" name="image" type="base64" />
<field name="currency_id" ref="MKD" />
......@@ -1820,5 +1820,20 @@
ref('ec'),ref('fk'),ref('gs'),ref('gf'),ref('gy'),
ref('py'),ref('pe'),ref('sr'),ref('uy'),ref('ve')])]"/>
</record>
<record id="sepa_zone" model="res.country.group">
<field name="name">SEPA Countries</field>
<field name="country_ids" eval="[(6,0,[
ref('ad'),ref('at'),ref('ax'),ref('be'),ref('bg'),
ref('bl'),ref('ch'),ref('cy'),ref('cz'),ref('de'),
ref('dk'),ref('ee'),ref('es'),ref('fi'),ref('fr'),
ref('uk'),ref('gf'),ref('gg'),ref('gi'),ref('gp'),
ref('gr'),ref('hr'),ref('hu'),ref('ie'),ref('im'),
ref('is'),ref('it'),ref('je'),ref('li'),ref('lt'),
ref('lu'),ref('lv'),ref('mc'),ref('mf'),ref('mq'),
ref('mt'),ref('nl'),ref('no'),ref('pl'),ref('pm'),
ref('pt'),ref('re'),ref('ro'),ref('se'),ref('si'),
ref('sk'),ref('sm'),ref('va'),ref('yt')])]"/>
</record>
</data>
</odoo>
......@@ -131,12 +131,17 @@ class ResPartnerBank(models.Model):
communication = ""
if comment:
communication = (comment[:137] + '...') if len(comment) > 140 else comment
qr_code_string = 'BCD\n001\n1\nSCT\n%s\n%s\n%s\nEUR%s\n\n\n%s' % (self.bank_bic, self.company_id.name, self.acc_number, amount, communication)
qr_code_string = 'BCD\n001\n1\nSCT\n%s\n%s\n%s\nEUR%s\n\n\n%s' % (self.bank_bic or "", self.company_id.name, self.acc_number, amount, communication)
qr_code_url = '/report/barcode/?type=%s&value=%s&width=%s&height=%s&humanreadable=1' % ('QR', werkzeug.url_quote_plus(qr_code_string), 128, 128)
return qr_code_url
def _validate_qr_code_arguments(self):
sepa_zones_codes = [c.code for c in self.env.ref('base.sepa_zone').country_ids]
# Some country instances share the same IBAN country code (e.g. Åland Islands and Finland IBANs are "FI", but Åland Islands code is "AX").
# Therefore sepa_zones_codes is too permissive, "AX" is not a valid IBAN country code.
not_iban_codes = ("AX", "NC", "YT", "TF", "BL", "RE", "MF", "GP", "PM", "PF", "GF", "MQ", "JE", "GG", "IM")
sepa_zones_codes = [code for code in sepa_zones_codes if code not in not_iban_codes]
for bank in self:
bank.qr_code_valid = (bank.bank_bic
and bank.company_id.name
and bank.acc_number)
bank.qr_code_valid = (bank.company_id.name and
bank.acc_number and
bank.sanitized_acc_number[:2] in sepa_zones_codes)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment