mirror of
https://github.com/OCA/bank-payment.git
synced 2025-02-02 10:37:31 +02:00
[IMP] account_banking_mandate: Allow to set a specific mandate reference or sequence
This commit is contained in:
committed by
David Ramia
parent
7ca44b286a
commit
6b0e4df430
@@ -7,7 +7,7 @@ Account Banking Mandate
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! source digest: sha256:65a46ee9619fe8b739d955186a289a1fe533a2aab227896d9eb915f21c05ce58
|
||||
!! source digest: sha256:4b5a2b5a27bca9e269d073e647484476b859ac1ed53a533129bf680c40304026
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
{
|
||||
"name": "Account Banking Mandate",
|
||||
"summary": "Banking mandates",
|
||||
"version": "16.0.1.1.0",
|
||||
"version": "16.0.1.1.1",
|
||||
"development_status": "Production/Stable",
|
||||
"license": "AGPL-3",
|
||||
"author": "Compassion CH, "
|
||||
|
||||
@@ -60,7 +60,7 @@ class AccountBankingMandate(models.Model):
|
||||
required=True,
|
||||
default=lambda self: self.env.company,
|
||||
)
|
||||
unique_mandate_reference = fields.Char(tracking=10, copy=False)
|
||||
unique_mandate_reference = fields.Char(tracking=10, copy=False, default="/")
|
||||
signature_date = fields.Date(
|
||||
string="Date of Signature of the Mandate",
|
||||
tracking=50,
|
||||
@@ -176,8 +176,8 @@ class AccountBankingMandate(models.Model):
|
||||
@api.model_create_multi
|
||||
def create(self, vals_list):
|
||||
for vals in vals_list:
|
||||
unique_mandate_reference = vals.get("unique_mandate_reference")
|
||||
if not unique_mandate_reference or unique_mandate_reference == "New":
|
||||
unique_mandate_reference = vals.get("unique_mandate_reference", "/")
|
||||
if unique_mandate_reference == "/":
|
||||
vals["unique_mandate_reference"] = (
|
||||
self.env["ir.sequence"].next_by_code("account.banking.mandate")
|
||||
or "New"
|
||||
|
||||
@@ -367,7 +367,7 @@ ul.auto-toc {
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! source digest: sha256:65a46ee9619fe8b739d955186a289a1fe533a2aab227896d9eb915f21c05ce58
|
||||
!! source digest: sha256:4b5a2b5a27bca9e269d073e647484476b859ac1ed53a533129bf680c40304026
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/bank-payment/tree/16.0/account_banking_mandate"><img alt="OCA/bank-payment" src="https://img.shields.io/badge/github-OCA%2Fbank--payment-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/bank-payment-16-0/bank-payment-16-0-account_banking_mandate"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/bank-payment&target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
|
||||
<p>This module adds a generic model for banking mandates.
|
||||
|
||||
@@ -124,9 +124,8 @@ class TestMandate(TransactionCase):
|
||||
|
||||
def test_mandate_reference_03(self):
|
||||
"""
|
||||
Test case: create a mandate with "New" as reference
|
||||
Expected result: the reference of the created mandate is not empty and
|
||||
is not "New"
|
||||
Test case: create a mandate with "TEST" as reference
|
||||
Expected result: the reference of the created mandate is "TEST"
|
||||
"""
|
||||
bank_account = self.env.ref("account_payment_mode.res_partner_12_iban")
|
||||
mandate = self.env["account.banking.mandate"].create(
|
||||
@@ -134,15 +133,32 @@ class TestMandate(TransactionCase):
|
||||
"partner_bank_id": bank_account.id,
|
||||
"signature_date": "2015-01-01",
|
||||
"company_id": self.company.id,
|
||||
"unique_mandate_reference": "New",
|
||||
"unique_mandate_reference": "TEST",
|
||||
}
|
||||
)
|
||||
self.assertTrue(mandate.unique_mandate_reference)
|
||||
self.assertNotEqual(mandate.unique_mandate_reference, "New")
|
||||
self.assertEqual(mandate.unique_mandate_reference, "TEST")
|
||||
|
||||
def test_mandate_reference_04(self):
|
||||
"""
|
||||
Test case: create a mandate with "/" as reference
|
||||
Expected result: the reference of the created mandate is not "/"
|
||||
"""
|
||||
bank_account = self.env.ref("account_payment_mode.res_partner_12_iban")
|
||||
mandate = self.env["account.banking.mandate"].create(
|
||||
{
|
||||
"partner_bank_id": bank_account.id,
|
||||
"signature_date": "2015-01-01",
|
||||
"company_id": self.company.id,
|
||||
"unique_mandate_reference": "/",
|
||||
}
|
||||
)
|
||||
self.assertTrue(mandate.unique_mandate_reference)
|
||||
self.assertNotEqual(mandate.unique_mandate_reference, "/")
|
||||
|
||||
def test_mandate_reference_05(self):
|
||||
"""
|
||||
Test case: create a mandate with False as reference
|
||||
Test case: create a mandate without reference
|
||||
Expected result: the reference of the created mandate is not empty
|
||||
"""
|
||||
bank_account = self.env.ref("account_payment_mode.res_partner_12_iban")
|
||||
@@ -151,23 +167,6 @@ class TestMandate(TransactionCase):
|
||||
"partner_bank_id": bank_account.id,
|
||||
"signature_date": "2015-01-01",
|
||||
"company_id": self.company.id,
|
||||
"unique_mandate_reference": False,
|
||||
}
|
||||
)
|
||||
self.assertTrue(mandate.unique_mandate_reference)
|
||||
|
||||
def test_mandate_reference_06(self):
|
||||
"""
|
||||
Test case: create a mandate with a empty string as reference
|
||||
Expected result: the reference of the created mandate is not empty
|
||||
"""
|
||||
bank_account = self.env.ref("account_payment_mode.res_partner_12_iban")
|
||||
mandate = self.env["account.banking.mandate"].create(
|
||||
{
|
||||
"partner_bank_id": bank_account.id,
|
||||
"signature_date": "2015-01-01",
|
||||
"company_id": self.company.id,
|
||||
"unique_mandate_reference": "",
|
||||
}
|
||||
)
|
||||
self.assertTrue(mandate.unique_mandate_reference)
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
<field
|
||||
name="unique_mandate_reference"
|
||||
class="oe_inline"
|
||||
readonly="1"
|
||||
attrs="{'readonly': [('id', '!=', False)]}"
|
||||
/>
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user