[MIG] contract_mandate: Migration to 13.0

This commit is contained in:
Guille
2020-10-21 12:32:04 +02:00
committed by hkapatel
parent 0b65e09149
commit a6305277f3
7 changed files with 21 additions and 38 deletions

View File

@@ -14,13 +14,13 @@ Contract Mandate
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3 :alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fcontract-lightgray.png?logo=github .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fcontract-lightgray.png?logo=github
:target: https://github.com/OCA/contract/tree/12.0/contract_mandate :target: https://github.com/OCA/contract/tree/13.0/contract_mandate
:alt: OCA/contract :alt: OCA/contract
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/contract-12-0/contract-12-0-contract_mandate :target: https://translation.odoo-community.org/projects/contract-13-0/contract-13-0-contract_mandate
:alt: Translate me on Weblate :alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/110/12.0 :target: https://runbot.odoo-community.org/runbot/110/13.0
:alt: Try me on Runbot :alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5| |badge1| |badge2| |badge3| |badge4| |badge5|
@@ -50,7 +50,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/contract/issues>`_. Bugs are tracked on `GitHub Issues <https://github.com/OCA/contract/issues>`_.
In case of trouble, please check there if your issue has already been reported. In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/contract/issues/new?body=module:%20contract_mandate%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. `feedback <https://github.com/OCA/contract/issues/new?body=module:%20contract_mandate%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Do not contact contributors directly about support or help with technical issues. Do not contact contributors directly about support or help with technical issues.
@@ -67,6 +67,7 @@ Contributors
* Carlos Dauden <carlos.dauden@tecnativa.com> * Carlos Dauden <carlos.dauden@tecnativa.com>
* Thomas Binsfeld <thomas.binsfeld@acsone.eu> * Thomas Binsfeld <thomas.binsfeld@acsone.eu>
* Guillermo Llinares <guillermo@studio73.es>
Maintainers Maintainers
~~~~~~~~~~~ ~~~~~~~~~~~
@@ -81,6 +82,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and mission is to support the collaborative development of Odoo features and
promote its widespread use. promote its widespread use.
This module is part of the `OCA/contract <https://github.com/OCA/contract/tree/12.0/contract_mandate>`_ project on GitHub. This module is part of the `OCA/contract <https://github.com/OCA/contract/tree/13.0/contract_mandate>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@@ -4,13 +4,13 @@
{ {
"name": "Contract Mandate", "name": "Contract Mandate",
"summary": "Mandate in contracts and their invoices", "summary": "Mandate in contracts and their invoices",
"version": "12.0.1.0.2", "version": "13.0.1.0.0",
"author": "Odoo Community Association (OCA), " "Tecnativa", "author": "Odoo Community Association (OCA), " "Tecnativa",
"website": "https://github.com/OCA/contract", "website": "https://github.com/OCA/contract",
"depends": ["contract_payment_mode", "account_banking_mandate",], "depends": ["contract_payment_mode", "account_banking_mandate"],
"category": "Sales Management", "category": "Sales Management",
"license": "AGPL-3", "license": "AGPL-3",
"data": ["views/contract_view.xml",], "data": ["views/contract_view.xml"],
"installable": True, "installable": True,
"auto_install": True, "auto_install": True,
} }

View File

@@ -4,7 +4,7 @@
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 12.0\n" "Project-Id-Version: Odoo Server 13.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"Last-Translator: <>\n" "Last-Translator: <>\n"
"Language-Team: \n" "Language-Team: \n"

View File

@@ -24,16 +24,14 @@ class ContractContract(models.Model):
string="Commercial Entity", string="Commercial Entity",
) )
@api.multi
@api.onchange("payment_mode_id") @api.onchange("payment_mode_id")
def _onchange_payment_mode_id(self): def _onchange_payment_mode_id(self):
self.ensure_one() self.ensure_one()
if not self.mandate_required: if not self.mandate_required:
self.mandate_id = False self.mandate_id = False
@api.multi
def _prepare_invoice(self, date_invoice, journal=None): def _prepare_invoice(self, date_invoice, journal=None):
invoice_vals = super(ContractContract, self)._prepare_invoice( invoice_vals, move_form = super()._prepare_invoice(
date_invoice, journal=journal date_invoice, journal=journal
) )
if self.mandate_id: if self.mandate_id:
@@ -48,18 +46,4 @@ class ContractContract(models.Model):
limit=1, limit=1,
) )
invoice_vals["mandate_id"] = mandate.id invoice_vals["mandate_id"] = mandate.id
return invoice_vals return invoice_vals, move_form
@api.model
def _finalize_invoice_creation(self, invoices):
"""
This override preserves the contract when calling the partner's
onchange.
"""
mandates_by_invoice = {}
for invoice in invoices:
mandates_by_invoice[invoice] = invoice.mandate_id
res = super(ContractContract, self)._finalize_invoice_creation(invoices)
for invoice in invoices:
invoice.mandate_id = mandates_by_invoice.get(invoice)
return res

View File

@@ -1,2 +1,3 @@
* Carlos Dauden <carlos.dauden@tecnativa.com> * Carlos Dauden <carlos.dauden@tecnativa.com>
* Thomas Binsfeld <thomas.binsfeld@acsone.eu> * Thomas Binsfeld <thomas.binsfeld@acsone.eu>
* Guillermo Llinares <guillermo@studio73.es>

View File

@@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" /> <meta name="generator" content="Docutils 0.14: http://docutils.sourceforge.net/" />
<title>Contract Mandate</title> <title>Contract Mandate</title>
<style type="text/css"> <style type="text/css">
@@ -367,7 +367,7 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !! !! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !! !! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" 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" href="https://github.com/OCA/contract/tree/12.0/contract_mandate"><img alt="OCA/contract" src="https://img.shields.io/badge/github-OCA%2Fcontract-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/contract-12-0/contract-12-0-contract_mandate"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/110/12.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p> <p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" 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" href="https://github.com/OCA/contract/tree/13.0/contract_mandate"><img alt="OCA/contract" src="https://img.shields.io/badge/github-OCA%2Fcontract-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/contract-13-0/contract-13-0-contract_mandate"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/110/13.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>This module allows to set a mandate mode on contract for creating the invoices <p>This module allows to set a mandate mode on contract for creating the invoices
with this mandate.</p> with this mandate.</p>
<p><strong>Table of contents</strong></p> <p><strong>Table of contents</strong></p>
@@ -400,7 +400,7 @@ with this mandate.</p>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/contract/issues">GitHub Issues</a>. <p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/contract/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported. In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed If you spotted it first, help us smashing it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/contract/issues/new?body=module:%20contract_mandate%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p> <a class="reference external" href="https://github.com/OCA/contract/issues/new?body=module:%20contract_mandate%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p> <p>Do not contact contributors directly about support or help with technical issues.</p>
</div> </div>
<div class="section" id="credits"> <div class="section" id="credits">
@@ -416,6 +416,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<ul class="simple"> <ul class="simple">
<li>Carlos Dauden &lt;<a class="reference external" href="mailto:carlos.dauden&#64;tecnativa.com">carlos.dauden&#64;tecnativa.com</a>&gt;</li> <li>Carlos Dauden &lt;<a class="reference external" href="mailto:carlos.dauden&#64;tecnativa.com">carlos.dauden&#64;tecnativa.com</a>&gt;</li>
<li>Thomas Binsfeld &lt;<a class="reference external" href="mailto:thomas.binsfeld&#64;acsone.eu">thomas.binsfeld&#64;acsone.eu</a>&gt;</li> <li>Thomas Binsfeld &lt;<a class="reference external" href="mailto:thomas.binsfeld&#64;acsone.eu">thomas.binsfeld&#64;acsone.eu</a>&gt;</li>
<li>Guillermo Llinares &lt;<a class="reference external" href="mailto:guillermo&#64;studio73.es">guillermo&#64;studio73.es</a>&gt;</li>
</ul> </ul>
</div> </div>
<div class="section" id="maintainers"> <div class="section" id="maintainers">
@@ -425,7 +426,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose <p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and mission is to support the collaborative development of Odoo features and
promote its widespread use.</p> promote its widespread use.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/contract/tree/12.0/contract_mandate">OCA/contract</a> project on GitHub.</p> <p>This module is part of the <a class="reference external" href="https://github.com/OCA/contract/tree/13.0/contract_mandate">OCA/contract</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p> <p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div> </div>
</div> </div>

View File

@@ -7,7 +7,7 @@ from odoo.addons.contract.tests.test_contract import TestContractBase
class TestContractMandate(TestContractBase): class TestContractMandate(TestContractBase):
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
super(TestContractMandate, cls).setUpClass() super().setUpClass()
cls.payment_method = cls.env["account.payment.method"].create( cls.payment_method = cls.env["account.payment.method"].create(
{ {
"name": "Test SDD", "name": "Test SDD",
@@ -24,14 +24,10 @@ class TestContractMandate(TestContractBase):
} }
) )
cls.partner = cls.env["res.partner"].create( cls.partner = cls.env["res.partner"].create(
{ {"name": "Test Customer", "customer_payment_mode_id": cls.payment_mode.id}
"customer": True,
"name": "Test Customer",
"customer_payment_mode_id": cls.payment_mode.id,
}
) )
cls.partner_bank = cls.env["res.partner.bank"].create( cls.partner_bank = cls.env["res.partner.bank"].create(
{"acc_number": "1234", "partner_id": cls.partner.id,} {"acc_number": "1234", "partner_id": cls.partner.id}
) )
cls.mandate = cls.env["account.banking.mandate"].create( cls.mandate = cls.env["account.banking.mandate"].create(
{ {