From 704a58ba1c530e24c999512d9e762b5e840998a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A0=20Pallej=C3=A0?= Date: Mon, 13 May 2024 20:01:05 +0200 Subject: [PATCH] [MIG][16.0] contract_mandate --- contract_mandate/README.rst | 6 +++--- contract_mandate/models/contract.py | 6 ++---- contract_mandate/readme/USAGE.rst | 4 ++-- contract_mandate/static/description/index.html | 18 ++++++++++-------- .../tests/test_contract_mandate.py | 5 +++++ contract_mandate/views/contract_view.xml | 1 + 6 files changed, 23 insertions(+), 17 deletions(-) diff --git a/contract_mandate/README.rst b/contract_mandate/README.rst index 4a90d14b8..ee31e4fd6 100644 --- a/contract_mandate/README.rst +++ b/contract_mandate/README.rst @@ -7,7 +7,7 @@ Contract Mandate !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:a83455161d4bb4363ea205049514708dda57ac56a8f4b1ae35ea6c0da45c788b + !! source digest: sha256:720c5d6130934b9fb77aedd2189daf8a9bc219ccc94df720cecd72bb4a84b2a3 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png @@ -39,11 +39,11 @@ with this mandate. Usage ===== -#. Go to *Sales > Sales > Contracts*. +#. Go to *Sales > Orders > Contracts*. #. Create one. #. Select a partner to which invoice. #. Select a mandate. -#. Click on **Generate recurring invoices automatically** checkbox. +#. Add invoice recurrency information. #. Add a product to invoice. #. If you create an invoice, new invoice will have the selected mandate. diff --git a/contract_mandate/models/contract.py b/contract_mandate/models/contract.py index 8f7053eb2..34263a9f2 100644 --- a/contract_mandate/models/contract.py +++ b/contract_mandate/models/contract.py @@ -32,9 +32,7 @@ class ContractContract(models.Model): self.mandate_id = False def _prepare_invoice(self, date_invoice, journal=None): - invoice_vals, move_form = super()._prepare_invoice( - date_invoice, journal=journal - ) + invoice_vals = super()._prepare_invoice(date_invoice, journal=journal) if self.mandate_id: invoice_vals["mandate_id"] = self.mandate_id.id elif self.payment_mode_id.payment_method_id.mandate_required: @@ -47,4 +45,4 @@ class ContractContract(models.Model): limit=1, ) invoice_vals["mandate_id"] = mandate.id - return invoice_vals, move_form + return invoice_vals diff --git a/contract_mandate/readme/USAGE.rst b/contract_mandate/readme/USAGE.rst index d1d752408..2b4a250b1 100644 --- a/contract_mandate/readme/USAGE.rst +++ b/contract_mandate/readme/USAGE.rst @@ -1,7 +1,7 @@ -#. Go to *Sales > Sales > Contracts*. +#. Go to *Sales > Orders > Contracts*. #. Create one. #. Select a partner to which invoice. #. Select a mandate. -#. Click on **Generate recurring invoices automatically** checkbox. +#. Add invoice recurrency information. #. Add a product to invoice. #. If you create an invoice, new invoice will have the selected mandate. diff --git a/contract_mandate/static/description/index.html b/contract_mandate/static/description/index.html index 45baa1573..a9c68caf3 100644 --- a/contract_mandate/static/description/index.html +++ b/contract_mandate/static/description/index.html @@ -1,4 +1,3 @@ - @@ -9,10 +8,11 @@ /* :Author: David Goodger (goodger@python.org) -:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $ +:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $ :Copyright: This stylesheet has been placed in the public domain. Default cascading style sheet for the HTML output of Docutils. +Despite the name, some widely supported CSS2 features are used. See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to customize this style sheet. @@ -275,7 +275,7 @@ pre.literal-block, pre.doctest-block, pre.math, pre.code { margin-left: 2em ; margin-right: 2em } -pre.code .ln { color: grey; } /* line numbers */ +pre.code .ln { color: gray; } /* line numbers */ pre.code, code { background-color: #eeeeee } pre.code .comment, code .comment { color: #5C6576 } pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold } @@ -301,7 +301,7 @@ span.option { span.pre { white-space: pre } -span.problematic { +span.problematic, pre.problematic { color: red } span.section-subtitle { @@ -367,7 +367,7 @@ ul.auto-toc { !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! source digest: sha256:a83455161d4bb4363ea205049514708dda57ac56a8f4b1ae35ea6c0da45c788b +!! source digest: sha256:720c5d6130934b9fb77aedd2189daf8a9bc219ccc94df720cecd72bb4a84b2a3 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->

Beta License: AGPL-3 OCA/contract Translate me on Weblate Try me on Runboat

This module allows to set a mandate mode on contract for creating the invoices @@ -388,11 +388,11 @@ with this mandate.

Usage

    -
  1. Go to Sales > Sales > Contracts.
  2. +
  3. Go to Sales > Orders > Contracts.
  4. Create one.
  5. Select a partner to which invoice.
  6. Select a mandate.
  7. -
  8. Click on Generate recurring invoices automatically checkbox.
  9. +
  10. Add invoice recurrency information.
  11. Add a product to invoice.
  12. If you create an invoice, new invoice will have the selected mandate.
@@ -425,7 +425,9 @@ If you spotted it first, help us to smash it by providing a detailed and welcome

Maintainers

This module is maintained by the OCA.

-Odoo Community Association + +Odoo Community Association +

OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

diff --git a/contract_mandate/tests/test_contract_mandate.py b/contract_mandate/tests/test_contract_mandate.py index 5ae92dbf8..3e188d230 100644 --- a/contract_mandate/tests/test_contract_mandate.py +++ b/contract_mandate/tests/test_contract_mandate.py @@ -56,6 +56,11 @@ class TestContractMandate(TestContractBase): new_invoice = self.contract_with_mandate.recurring_create_invoice() self.assertEqual(new_invoice.mandate_id, self.mandate2) + def test_onchange_payment_mode_id(self): + self.contract_with_mandate.mandate_required = False + self.contract_with_mandate._onchange_payment_mode_id() + self.assertFalse(self.contract_with_mandate.mandate_id) + def test_contract_mandate_default(self): self.payment_mode.payment_method_id.mandate_required = False self.contract_with_mandate.mandate_id = False diff --git a/contract_mandate/views/contract_view.xml b/contract_mandate/views/contract_view.xml index 051926044..53b0b9c3a 100644 --- a/contract_mandate/views/contract_view.xml +++ b/contract_mandate/views/contract_view.xml @@ -10,6 +10,7 @@ /> +