Skip to content

Commit

Permalink
[MIG] l10n_ch_pain_base: Migration to 14.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon authored and ecino committed Oct 19, 2023
1 parent a2c6a1c commit 27ed96b
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 36 deletions.
2 changes: 1 addition & 1 deletion l10n_ch_pain_base/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
"author": "Akretion,Camptocamp,Odoo Community Association (OCA)",
"license": "AGPL-3",
"depends": ["account_banking_pain_base", "l10n_ch_base_bank"],
"data": ["views/account_payment_line.xml", "views/bank_payment_line.xml"],
"data": ["views/account_payment_line.xml"],
"installable": True,
}
2 changes: 1 addition & 1 deletion l10n_ch_pain_base/models/account_move_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def _prepare_payment_line_vals(self, payment_order):
vals = super()._prepare_payment_line_vals(payment_order)
if (
self.move_id
and self.move_id._is_isr_reference()
and self.move_id._has_isr_ref()
and self.move_id.partner_bank_id
):
if self.move_id.partner_bank_id._is_qr_iban():
Expand Down
10 changes: 2 additions & 8 deletions l10n_ch_pain_base/models/account_payment_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,11 @@ class AccountPaymentLine(models.Model):
_inherit = "account.payment.line"

local_instrument = fields.Selection(
selection_add=[("CH01", "CH01 (ISR)")],
ondelete={
"CH01": "set null"
}
selection_add=[("CH01", "CH01 (ISR)")], ondelete={"CH01": "set null"}
)
communication_type = fields.Selection(
selection_add=[("isr", "ISR"), ("qrr", "QRR")],
ondelete={
"isr": "set null",
"qrr": "set null"
}
ondelete={"isr": "set default", "qrr": "set default"},
)

def invoice_reference_type2communication_type(self):
Expand Down
9 changes: 5 additions & 4 deletions l10n_ch_pain_base/models/account_payment_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ def generate_pain_attrib(self):
pain_flavor = self.payment_mode_id.payment_method_id.pain_version
if pain_flavor in ["pain.001.001.03.ch.02", "pain.008.001.02.ch.01"]:
attrib = {
"{http://www.w3.org/2001/XMLSchema-instance}schemaLocation": "http://www.six-interbank-clearing.com/de/"
"{http://www.w3.org/2001/XMLSchema-instance}"
"schemaLocation": "http://www.six-interbank-clearing.com/de/"
"%s.xsd %s.xsd" % (pain_flavor, pain_flavor)
}
return attrib
Expand Down Expand Up @@ -75,7 +76,7 @@ def generate_party_agent(
self, parent_node, party_type, order, partner_bank, gen_args, bank_line=None
):
if gen_args.get("pain_flavor") == "pain.001.001.03.ch.02" and bank_line:
if bank_line.local_instrument == "CH01":
if bank_line.payment_line_ids[:1].local_instrument == "CH01":
# Don't set the creditor agent on ISR/CH01 payments
return True
elif not partner_bank.bank_bic:
Expand Down Expand Up @@ -103,7 +104,7 @@ def generate_party_acc_number(
if (
gen_args.get("pain_flavor") == "pain.001.001.03.ch.02"
and bank_line
and bank_line.local_instrument == "CH01"
and bank_line.payment_line_ids[:1].local_instrument == "CH01"
):
if not partner_bank.l10n_ch_postal:
raise UserError(
Expand Down Expand Up @@ -158,7 +159,7 @@ def generate_address_block(self, parent_node, partner, gen_args):

@api.model
def generate_remittance_info_block(self, parent_node, line, gen_args):
if line.communication_type == "qrr":
if line.payment_line_ids[:1].communication_type == "qrr":
remittance_info = etree.SubElement(parent_node, "RmtInf")
remittance_info_structured = etree.SubElement(remittance_info, "Strd")
creditor_ref_information = etree.SubElement(
Expand Down
22 changes: 0 additions & 22 deletions l10n_ch_pain_base/views/bank_payment_line.xml

This file was deleted.

0 comments on commit 27ed96b

Please sign in to comment.