diff --git a/account_banking_mandate/README.rst b/account_banking_mandate/README.rst
index 767034550a9..49f848343dc 100644
--- a/account_banking_mandate/README.rst
+++ b/account_banking_mandate/README.rst
@@ -7,7 +7,7 @@ Account Banking Mandate
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- !! source digest: sha256:a2e985ff665c753c4fc04968eca91622f81cf5c595fd9d26967c2aefea3556a3
+ !! source digest: sha256:65a46ee9619fe8b739d955186a289a1fe533a2aab227896d9eb915f21c05ce58
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png
diff --git a/account_banking_mandate/views/account_banking_mandate_view.xml b/account_banking_mandate/views/account_banking_mandate_view.xml
index 5b2335e9072..ebde21253f9 100644
--- a/account_banking_mandate/views/account_banking_mandate_view.xml
+++ b/account_banking_mandate/views/account_banking_mandate_view.xml
@@ -50,7 +50,7 @@
diff --git a/account_banking_mandate/views/res_partner_bank_view.xml b/account_banking_mandate/views/res_partner_bank_view.xml
index 1f1abe72cb2..c8ccadcf45e 100644
--- a/account_banking_mandate/views/res_partner_bank_view.xml
+++ b/account_banking_mandate/views/res_partner_bank_view.xml
@@ -15,7 +15,6 @@
name="mandate_ids"
context="{'mandate_bank_partner_view': True}"
nolabel="1"
- colspan="4"
/>
diff --git a/account_banking_pain_base/__manifest__.py b/account_banking_pain_base/__manifest__.py
index c00bebceab0..39303887640 100644
--- a/account_banking_pain_base/__manifest__.py
+++ b/account_banking_pain_base/__manifest__.py
@@ -16,11 +16,13 @@
"external_dependencies": {"python": ["unidecode", "lxml"]},
"data": [
"security/security.xml",
+ "security/ir.model.access.csv",
"views/account_payment_line.xml",
"views/account_payment_order.xml",
"views/account_payment_mode.xml",
"views/res_config_settings.xml",
"views/account_payment_method.xml",
+ "views/account_pain_regulatory_reporting.xml",
],
"post_init_hook": "set_default_initiating_party",
"installable": True,
diff --git a/account_banking_pain_base/models/__init__.py b/account_banking_pain_base/models/__init__.py
index 4f1503393fe..e66683d13b0 100644
--- a/account_banking_pain_base/models/__init__.py
+++ b/account_banking_pain_base/models/__init__.py
@@ -1,6 +1,7 @@
from . import account_payment_line
from . import account_payment_order
from . import account_payment_mode
+from . import account_pain_regulatory_reporting
from . import res_company
from . import res_config_settings
from . import account_payment_method
diff --git a/account_banking_pain_base/models/account_pain_regulatory_reporting.py b/account_banking_pain_base/models/account_pain_regulatory_reporting.py
new file mode 100644
index 00000000000..ba534128db5
--- /dev/null
+++ b/account_banking_pain_base/models/account_pain_regulatory_reporting.py
@@ -0,0 +1,49 @@
+# Copyright 2023 Akretion France (http://www.akretion.com/)
+# @author: Alexis de Lattre
+# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
+
+from odoo import api, fields, models
+
+
+class AccountPainRegulatoryReporting(models.Model):
+ _name = "account.pain.regulatory.reporting"
+ _description = "Regulatory Reporting Codes for ISO 20022/PAIN banking standard"
+ _order = "code, country_id"
+
+ code = fields.Char(required=True, copy=False, size=10)
+ name = fields.Char(required=True, translate=True, copy=False)
+ country_id = fields.Many2one("res.country", ondelete="restrict", required=False)
+ active = fields.Boolean(default=True)
+
+ _sql_constraints = [
+ (
+ "code_country_unique",
+ "unique(code, country_id)",
+ "This code already exists for that country.",
+ )
+ ]
+
+ @api.depends("code", "name")
+ def name_get(self):
+ res = []
+ for rec in self:
+ res.append((rec.id, "[%s] %s" % (rec.code, rec.name)))
+ return res
+
+ def _name_search(
+ self, name="", args=None, operator="ilike", limit=100, name_get_uid=None
+ ):
+ if args is None:
+ args = []
+ ids = []
+ if name and operator == "ilike":
+ ids = list(self._search([("code", "=", name)] + args, limit=limit))
+ if ids:
+ return ids
+ return super()._name_search(
+ name=name,
+ args=args,
+ operator=operator,
+ limit=limit,
+ name_get_uid=name_get_uid,
+ )
diff --git a/account_banking_pain_base/models/account_payment_line.py b/account_banking_pain_base/models/account_payment_line.py
index 2e3d0314753..ebb85f2dbd1 100644
--- a/account_banking_pain_base/models/account_payment_line.py
+++ b/account_banking_pain_base/models/account_payment_line.py
@@ -3,6 +3,8 @@
# Copyright 2014-2022 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
+from lxml import etree
+
from odoo import api, fields, models
@@ -163,18 +165,50 @@ class AccountPaymentLine(models.Model):
help="If neither your bank nor your local regulations oblige you to "
"set the category purpose, leave the field empty.",
)
+ # Regulatory Reporting codes are provided by national central banks for the countries
+ # where this data is required in specific circumstances
+ regulatory_reporting_id = fields.Many2one(
+ "account.pain.regulatory.reporting",
+ ondelete="restrict",
+ domain="[('country_id', 'in', (False, company_country_id))]",
+ )
+ company_country_id = fields.Many2one(related="company_id.country_id")
# PAIN allows 140 characters
communication = fields.Char(size=140)
- # The field struct_communication_type has been dropped in v9
- # We now use communication_type ; you should add an option
- # in communication_type with selection_add=[]
- communication_type = fields.Selection(
- selection_add=[("ISO", "ISO")], ondelete={"ISO": "cascade"}
- )
@api.model
def _get_payment_line_grouping_fields(self):
"""Add specific PAIN fields to the grouping criteria."""
res = super()._get_payment_line_grouping_fields()
- res += ["priority", "local_instrument", "category_purpose", "purpose"]
+ res += [
+ "priority",
+ "local_instrument",
+ "category_purpose",
+ "purpose",
+ "regulatory_reporting_id",
+ ]
return res
+
+ def generate_regulatory_reporting(self, parent_node, gen_args):
+ if self.regulatory_reporting_id:
+ regulatory_reporting = etree.SubElement(parent_node, "RgltryRptg")
+ regulatory_reporting_details = etree.SubElement(
+ regulatory_reporting, "Dtls"
+ )
+ regulatory_reporting_details_code = etree.SubElement(
+ regulatory_reporting_details, "Cd"
+ )
+ regulatory_reporting_details_code.text = self.env[
+ "account.payment.order"
+ ]._prepare_field(
+ "Regulatory Details Code",
+ "line.regulatory_reporting_id.code",
+ {"line": self},
+ 10,
+ gen_args=gen_args,
+ )
+
+ def generate_purpose(self, parent_node):
+ if self.purpose:
+ purpose = etree.SubElement(parent_node, "Purp")
+ etree.SubElement(purpose, "Cd").text = self.purpose
diff --git a/account_banking_pain_base/models/account_payment_order.py b/account_banking_pain_base/models/account_payment_order.py
index 990507247dd..b9af0d1f75c 100644
--- a/account_banking_pain_base/models/account_payment_order.py
+++ b/account_banking_pain_base/models/account_payment_order.py
@@ -285,7 +285,6 @@ def _validate_xml(self, xml_string, gen_args):
)
% str(e)
) from None
- return True
def finalize_sepa_file_creation(self, xml_root, gen_args):
xml_string = etree.tostring(
@@ -461,7 +460,6 @@ def generate_initiating_party_block(self, parent_node, gen_args):
)
% self.company_id.name
)
- return True
@api.model
def generate_party_agent(
@@ -495,7 +493,6 @@ def generate_party_agent(
# for Credit Transfers, in the 'C' block, if BIC is not provided,
# we should not put the 'Creditor Agent' block at all,
# as per the guidelines of the EPC
- return True
@api.model
def generate_party_id(self, parent_node, party_type, partner):
@@ -519,7 +516,9 @@ def generate_party_acc_number(
party_account_other = etree.SubElement(party_account_id, "Othr")
party_account_other_id = etree.SubElement(party_account_other, "Id")
party_account_other_id.text = partner_bank.sanitized_acc_number
- return True
+ if party_type == "Dbtr" and partner_bank.currency_id:
+ party_account_current = etree.SubElement(party_account, "Ccy")
+ party_account_current.text = partner_bank.currency_id.name
@api.model
def generate_address_block(self, parent_node, partner, gen_args):
@@ -567,7 +566,6 @@ def generate_address_block(self, parent_node, partner, gen_args):
gen_args=gen_args,
)
adrline2.text = val
- return True
@api.model
def generate_party_block(
@@ -625,13 +623,12 @@ def generate_party_block(
gen_args,
bank_line=bank_line,
)
- return True
@api.model
def generate_remittance_info_block(self, parent_node, line, gen_args):
remittance_info = etree.SubElement(parent_node, "RmtInf")
communication_type = line.payment_line_ids[:1].communication_type
- if communication_type == "normal":
+ if communication_type == "free":
remittance_info_unstructured = etree.SubElement(remittance_info, "Ustrd")
remittance_info_unstructured.text = self._prepare_field(
"Remittance Unstructured Information",
@@ -640,7 +637,7 @@ def generate_remittance_info_block(self, parent_node, line, gen_args):
140,
gen_args=gen_args,
)
- else:
+ elif communication_type == "structured":
remittance_info_structured = etree.SubElement(remittance_info, "Strd")
creditor_ref_information = etree.SubElement(
remittance_info_structured, "CdtrRefInf"
@@ -657,7 +654,7 @@ def generate_remittance_info_block(self, parent_node, line, gen_args):
creditor_ref_info_type_issuer = etree.SubElement(
creditor_ref_info_type, "Issr"
)
- creditor_ref_info_type_issuer.text = communication_type
+ creditor_ref_info_type_issuer.text = "ISO"
creditor_reference = etree.SubElement(
creditor_ref_information, "CdtrRef"
)
@@ -676,7 +673,7 @@ def generate_remittance_info_block(self, parent_node, line, gen_args):
creditor_ref_info_type_issuer = etree.SubElement(
creditor_ref_info_type, "Issr"
)
- creditor_ref_info_type_issuer.text = communication_type
+ creditor_ref_info_type_issuer.text = "ISO"
creditor_reference = etree.SubElement(creditor_ref_information, "Ref")
@@ -687,7 +684,6 @@ def generate_remittance_info_block(self, parent_node, line, gen_args):
35,
gen_args=gen_args,
)
- return True
@api.model
def generate_creditor_scheme_identification(
@@ -709,4 +705,3 @@ def generate_creditor_scheme_identification(
csi_scheme_name = etree.SubElement(csi_other, "SchmeNm")
csi_scheme_name_proprietary = etree.SubElement(csi_scheme_name, "Prtry")
csi_scheme_name_proprietary.text = scheme_name_proprietary
- return True
diff --git a/account_banking_pain_base/security/ir.model.access.csv b/account_banking_pain_base/security/ir.model.access.csv
new file mode 100644
index 00000000000..c866ab33ea3
--- /dev/null
+++ b/account_banking_pain_base/security/ir.model.access.csv
@@ -0,0 +1,3 @@
+id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
+access_account_pain_regulatory_reporting_read,Read access on account.pain.regulatory.reporting,model_account_pain_regulatory_reporting,base.group_user,1,0,0,0
+access_account_pain_regulatory_reporting_full,Full access on account.pain.regulatory.reporting,model_account_pain_regulatory_reporting,account.group_account_manager,1,1,1,1
diff --git a/account_banking_pain_base/views/account_pain_regulatory_reporting.xml b/account_banking_pain_base/views/account_pain_regulatory_reporting.xml
new file mode 100644
index 00000000000..5a702388643
--- /dev/null
+++ b/account_banking_pain_base/views/account_pain_regulatory_reporting.xml
@@ -0,0 +1,80 @@
+
+
+
+
+
+ account.pain.regulatory.reporting
+
+
+
+
+
+
+ account.pain.regulatory.reporting
+
+
+
+
+
+
+
+
+
+
+ account.pain.regulatory.reporting
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ PAIN Regulatory Reporting
+ account.pain.regulatory.reporting
+ tree,form
+
+
+
+
+
diff --git a/account_banking_pain_base/views/account_payment_line.xml b/account_banking_pain_base/views/account_payment_line.xml
index 918050524a7..6ae213cd6fe 100644
--- a/account_banking_pain_base/views/account_payment_line.xml
+++ b/account_banking_pain_base/views/account_payment_line.xml
@@ -17,6 +17,11 @@
+
+
@@ -30,6 +35,11 @@
+
+
+
+
+
diff --git a/account_banking_sepa_credit_transfer/models/account_payment_order.py b/account_banking_sepa_credit_transfer/models/account_payment_order.py
index ebd4047408c..35aa61dc9d4 100644
--- a/account_banking_sepa_credit_transfer/models/account_payment_order.py
+++ b/account_banking_sepa_credit_transfer/models/account_payment_order.py
@@ -191,10 +191,11 @@ def generate_payment_file(self): # noqa: C901
gen_args,
line,
)
- line_purpose = line.payment_line_ids[:1].purpose
- if line_purpose:
- purpose = etree.SubElement(credit_transfer_transaction_info, "Purp")
- etree.SubElement(purpose, "Cd").text = line_purpose
+ payment_line = line.payment_line_ids[0]
+ payment_line.generate_purpose(credit_transfer_transaction_info)
+ payment_line.generate_regulatory_reporting(
+ credit_transfer_transaction_info, gen_args
+ )
self.generate_remittance_info_block(
credit_transfer_transaction_info, line, gen_args
)
diff --git a/account_banking_sepa_credit_transfer/tests/test_sct.py b/account_banking_sepa_credit_transfer/tests/test_sct.py
index 8096c703f26..5552133d58f 100644
--- a/account_banking_sepa_credit_transfer/tests/test_sct.py
+++ b/account_banking_sepa_credit_transfer/tests/test_sct.py
@@ -231,7 +231,7 @@ def check_eur_currency_sct(self):
),
0,
)
- self.assertEqual(partner1_pay_line1.communication_type, "normal")
+ self.assertEqual(partner1_pay_line1.communication_type, "free")
self.assertEqual(partner1_pay_line1.communication, "F1341")
self.payment_order.draft2open()
self.assertEqual(self.payment_order.state, "open")
@@ -322,7 +322,7 @@ def test_usd_currency_sct(self):
),
0,
)
- self.assertEqual(partner2_pay_line1.communication_type, "normal")
+ self.assertEqual(partner2_pay_line1.communication_type, "free")
self.assertEqual(partner2_pay_line1.communication, "Inv9032")
self.payment_order.draft2open()
self.assertEqual(self.payment_order.state, "open")
@@ -392,7 +392,7 @@ def create_invoice(
}
data = {
"partner_id": partner_id,
- "reference_type": "none",
+ "reference_type": "free",
"ref": reference,
"currency_id": currency_id,
"invoice_date": time.strftime("%Y-%m-%d"),
diff --git a/account_banking_sepa_direct_debit/demo/sepa_direct_debit_demo.xml b/account_banking_sepa_direct_debit/demo/sepa_direct_debit_demo.xml
index 62bcdb05590..7d81acec755 100644
--- a/account_banking_sepa_direct_debit/demo/sepa_direct_debit_demo.xml
+++ b/account_banking_sepa_direct_debit/demo/sepa_direct_debit_demo.xml
@@ -5,7 +5,10 @@
variable
-
+
FR78ZZZ424242
diff --git a/account_banking_sepa_direct_debit/models/account_payment_order.py b/account_banking_sepa_direct_debit/models/account_payment_order.py
index bed20090fcc..78a40afff84 100644
--- a/account_banking_sepa_direct_debit/models/account_payment_order.py
+++ b/account_banking_sepa_direct_debit/models/account_payment_order.py
@@ -252,11 +252,11 @@ def generate_payment_file(self):
gen_args,
line,
)
- line_purpose = line.payment_line_ids[:1].purpose
- if line_purpose:
- purpose = etree.SubElement(dd_transaction_info, "Purp")
- etree.SubElement(purpose, "Cd").text = line_purpose
-
+ payment_line = line.payment_line_ids[0]
+ payment_line.generate_purpose(dd_transaction_info)
+ payment_line.generate_regulatory_reporting(
+ dd_transaction_info, gen_args
+ )
self.generate_remittance_info_block(dd_transaction_info, line, gen_args)
nb_of_transactions_b.text = str(transactions_count_b)
diff --git a/account_banking_sepa_direct_debit/tests/test_sdd.py b/account_banking_sepa_direct_debit/tests/test_sdd.py
index 1c25dedf027..2faa6c4ebcb 100644
--- a/account_banking_sepa_direct_debit/tests/test_sdd.py
+++ b/account_banking_sepa_direct_debit/tests/test_sdd.py
@@ -270,7 +270,7 @@ def check_sdd(self):
),
0,
)
- self.assertEqual(partner1_pay_line1.communication_type, "normal")
+ self.assertEqual(partner1_pay_line1.communication_type, "free")
self.assertEqual(partner1_pay_line1.communication, invoice1.name)
payment_order._compute_sepa()
payment_order.draft2open()
@@ -313,7 +313,7 @@ def check_sdd(self):
payment_order.generated2uploaded()
self.assertEqual(payment_order.state, "uploaded")
for inv in [invoice1, invoice2]:
- self.assertEqual(inv.payment_state, "in_payment")
+ self.assertIn(inv.payment_state, ("in_payment", "paid"))
self.assertEqual(self.partner2_mandate.recurrent_sequence_type, "recurring")
return
@@ -327,7 +327,7 @@ def create_invoice(self, partner_id, mandate, price_unit, inv_type="out_invoice"
invoice = self.invoice_model.create(
{
"partner_id": partner_id,
- "reference_type": "none",
+ "reference_type": "free",
"currency_id": self.env.ref("base.EUR").id,
"move_type": inv_type,
"journal_id": self.journal_sale_company_B.id,
diff --git a/account_payment_order/__manifest__.py b/account_payment_order/__manifest__.py
index 55689467d5b..670acdee688 100644
--- a/account_payment_order/__manifest__.py
+++ b/account_payment_order/__manifest__.py
@@ -32,7 +32,7 @@
"views/account_payment_order.xml",
"views/account_payment_line.xml",
"views/account_move_line.xml",
- "views/account_invoice_view.xml",
+ "views/account_move.xml",
"data/payment_seq.xml",
"report/print_account_payment_order.xml",
"report/account_payment_order.xml",
diff --git a/account_payment_order/migrations/16.0.2.0.0/pre-migration.py b/account_payment_order/migrations/16.0.2.0.0/pre-migration.py
index 309fd42a7aa..39bb190b1bf 100644
--- a/account_payment_order/migrations/16.0.2.0.0/pre-migration.py
+++ b/account_payment_order/migrations/16.0.2.0.0/pre-migration.py
@@ -11,3 +11,17 @@ def migrate(cr, version):
'ALTER TABLE "account_payment_method" RENAME "payment_order_only" '
'TO "payment_order_ok"'
)
+ # Harmonize values for reference_type on account.move
+ # and communication_type on account.payment.line:
+ # 2 possible values : free and structured
+ cr.execute(
+ "UPDATE account_move SET reference_type='free' WHERE reference_type='none'"
+ )
+ cr.execute(
+ "UPDATE account_payment_line SET communication_type='free' "
+ "WHERE communication_type='normal'"
+ )
+ cr.execute(
+ "UPDATE account_payment_line SET communication_type='structured' "
+ "WHERE communication_type='ISO'"
+ )
diff --git a/account_payment_order/models/account_move.py b/account_payment_order/models/account_move.py
index 2e20a9cc58a..47a23cfc21f 100644
--- a/account_payment_order/models/account_move.py
+++ b/account_payment_order/models/account_move.py
@@ -19,13 +19,14 @@ class AccountMove(models.Model):
)
payment_order_ok = fields.Boolean(compute="_compute_payment_order_ok")
# we restore this field from <=v11 for now for preserving behavior
- # TODO: Check if we can remove it and base everything in something at
- # payment mode or company level
+ # in v16, we have a field invoice_reference_type on sale journals
+ # but it's not relevant because companies don't have a sale journal per country
+ # and we need it for supplier invoices too
reference_type = fields.Selection(
- selection=[("none", "Free Reference"), ("structured", "Structured Reference")],
+ selection=[("free", "Free Reference"), ("structured", "Structured Reference")],
readonly=True,
states={"draft": [("readonly", False)]},
- default="none",
+ default="free",
)
payment_line_count = fields.Integer(compute="_compute_payment_line_count")
diff --git a/account_payment_order/models/account_move_line.py b/account_payment_order/models/account_move_line.py
index 232ab1e4ce3..01393ae0677 100644
--- a/account_payment_order/models/account_move_line.py
+++ b/account_payment_order/models/account_move_line.py
@@ -2,7 +2,7 @@
# © 2014 Serv. Tecnol. Avanzados - Pedro M. Baeza
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
-from odoo import fields, models
+from odoo import api, fields, models
class AccountMoveLine(models.Model):
diff --git a/account_payment_order/models/account_payment_line.py b/account_payment_order/models/account_payment_line.py
index 9e0111a1de9..4d27f57c9b4 100644
--- a/account_payment_order/models/account_payment_line.py
+++ b/account_payment_order/models/account_payment_line.py
@@ -105,7 +105,7 @@ class AccountPaymentLine(models.Model):
store=True,
readonly=False,
precompute=True,
- selection=[("normal", "Free")],
+ selection=[("free", "Free"), ("structured", "Structured")],
required=True,
)
payment_ids = fields.Many2many(
@@ -167,7 +167,7 @@ def payment_line_hashcode(self):
values.append(str(self.move_line_id.account_id or False))
# Don't group the payment lines that use a structured communication
# otherwise it would break the structured communication system !
- if self.communication_type != "normal":
+ if self.communication_type != "free":
values.append(str(self.id))
return "-".join(values)
@@ -175,14 +175,17 @@ def payment_line_hashcode(self):
def _compute_payment_line(self):
for line in self:
communication = False
- communication_type = "normal"
+ communication_type = "free"
currency_id = line.company_id.currency_id.id
amount_currency = 0.0
move_line = line.move_line_id
partner = line.partner_id
partner_bank_id = False
if move_line:
- communication_type, communication = move_line._get_communication()
+ communication_type = move_line.move_id.reference_type
+ communication = (
+ move_line.move_id._get_payment_order_communication_full()
+ )
currency_id = move_line.currency_id.id
amount_currency = move_line.amount_residual_currency
if line.order_id.payment_type == "outbound":
@@ -198,14 +201,6 @@ def _compute_payment_line(self):
line.partner_id = partner and partner.id or False
line.partner_bank_id = partner_bank_id
- def invoice_reference_type2communication_type(self):
- """This method is designed to be inherited by
- localization modules"""
- # key = value of 'reference_type' field on account_invoice
- # value = value of 'communication_type' field on account_payment_line
- res = {"none": "normal", "structured": "structured"}
- return res
-
def draft2open_payment_line_check(self):
self.ensure_one()
if self.bank_account_required and not self.partner_bank_id:
diff --git a/account_payment_order/models/account_payment_order.py b/account_payment_order/models/account_payment_order.py
index b25982cf2fd..bed02a47e91 100644
--- a/account_payment_order/models/account_payment_order.py
+++ b/account_payment_order/models/account_payment_order.py
@@ -329,11 +329,9 @@ def _compute_journal_id(self):
def action_uploaded_cancel(self):
self.action_cancel()
- return True
def cancel2draft(self):
self.write({"state": "draft"})
- return True
def action_cancel(self):
# Unreconcile and cancel payments
@@ -348,7 +346,6 @@ def action_cancel(self):
"generated_user_id": False,
}
)
- return True
def draft2open(self):
"""
@@ -461,7 +458,6 @@ def draft2open(self):
payment_vals.append(paydict["paylines"]._prepare_account_payment_vals())
self.env["account.payment"].create(payment_vals)
self.write({"state": "open"})
- return True
def generate_payment_file(self):
"""Returns (payment file as string, filename).
@@ -504,7 +500,6 @@ def generated2uploaded(self):
self.write(
{"state": "uploaded", "date_uploaded": fields.Date.context_today(self)}
)
- return True
def action_move_journal_line(self):
self.ensure_one()
diff --git a/account_payment_order/tests/test_payment_order_outbound.py b/account_payment_order/tests/test_payment_order_outbound.py
index 62702142110..037f3047aea 100644
--- a/account_payment_order/tests/test_payment_order_outbound.py
+++ b/account_payment_order/tests/test_payment_order_outbound.py
@@ -310,7 +310,7 @@ def test_invoice_communication_01(self):
def test_invoice_communication_02(self):
self.invoice.payment_reference = "R1234"
self.assertEqual(
- "F1242", self.invoice._get_payment_order_communication_direct()
+ "R1234", self.invoice._get_payment_order_communication_direct()
)
def test_invoice_communication_03(self):
@@ -438,7 +438,7 @@ def test_supplier_refund_reference(self):
self.invoice.payment_reference = "F/1234"
self.invoice.action_post()
self.assertEqual(
- "F1242", self.invoice._get_payment_order_communication_direct()
+ "F/1234", self.invoice._get_payment_order_communication_direct()
)
self.refund = self._create_supplier_refund(self.invoice)
with Form(self.refund) as refund_form:
@@ -448,7 +448,9 @@ def test_supplier_refund_reference(self):
line_form.price_unit = 75.0
self.refund.action_post()
- self.assertEqual("R1234", self.refund._get_payment_order_communication_direct())
+ self.assertEqual(
+ "FR/1234", self.refund._get_payment_order_communication_direct()
+ )
# The user add the outstanding payment to the invoice
invoice_line = self.invoice.line_ids.filtered(
@@ -470,8 +472,7 @@ def test_supplier_refund_reference(self):
self.assertEqual(len(payment_order.payment_line_ids), 1)
- self.assertEqual("F1242 R1234", payment_order.payment_line_ids.communication)
- self.assertNotIn("FR/1234", payment_order.payment_line_ids.communication)
+ self.assertEqual("F/1234 FR/1234", payment_order.payment_line_ids.communication)
def test_supplier_manual_refund(self):
"""
diff --git a/account_payment_order/views/account_invoice_view.xml b/account_payment_order/views/account_move.xml
similarity index 92%
rename from account_payment_order/views/account_invoice_view.xml
rename to account_payment_order/views/account_move.xml
index a9ceaf6ea70..7252672ea81 100644
--- a/account_payment_order/views/account_invoice_view.xml
+++ b/account_payment_order/views/account_move.xml
@@ -59,12 +59,7 @@
-
+
diff --git a/account_payment_order/wizard/account_payment_line_create.py b/account_payment_order/wizard/account_payment_line_create.py
index 217ba6ffed7..3fe01f724b8 100644
--- a/account_payment_order/wizard/account_payment_line_create.py
+++ b/account_payment_order/wizard/account_payment_line_create.py
@@ -190,4 +190,3 @@ def _compute_eligible_move_line_ids(self):
def create_payment_lines(self):
if self.move_line_ids:
self.move_line_ids.create_payment_line_from_move_line(self.order_id)
- return True
diff --git a/account_payment_order_notification/tests/test_account_payment_order_notification.py b/account_payment_order_notification/tests/test_account_payment_order_notification.py
index 43dec66783a..6bdb3847676 100644
--- a/account_payment_order_notification/tests/test_account_payment_order_notification.py
+++ b/account_payment_order_notification/tests/test_account_payment_order_notification.py
@@ -8,6 +8,7 @@ class TestAccountPaymentOrderNotification(TransactionCase):
def setUpClass(cls):
super().setUpClass()
cls.payment_mode = cls.env.ref("account_payment_mode.payment_mode_inbound_dd1")
+ cls.payment_mode.payment_order_ok = True
cls.partner_a = cls.env["res.partner"].create({"name": "Test partner A"})
cls.partner_a_child = cls.env["res.partner"].create(
{