diff --git a/contract_mandate/README.rst b/contract_mandate/README.rst index 84ffb0324..7373d25f9 100644 --- a/contract_mandate/README.rst +++ b/contract_mandate/README.rst @@ -1,18 +1,37 @@ -.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg - :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html - :alt: License: AGPL-3 - ================ Contract Mandate ================ +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fcontract-lightgray.png?logo=github + :target: https://github.com/OCA/contract/tree/10.0/contract_mandate + :alt: OCA/contract +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/contract-10-0/contract-10-0-contract_mandate + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/110/10.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + This module allows to set a mandate mode on contract for creating the invoices with this mandate. -Configuration -============= +**Table of contents** -Your user should be a Sales Manager or Accountant. +.. contents:: + :local: Usage ===== @@ -25,39 +44,42 @@ Usage #. Add a product to invoice. #. If you create an invoice, new invoice will have the selected mandate. - -.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas - :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/110/9.0 - Bug Tracker =========== Bugs are tracked on `GitHub Issues `_. -In case of trouble, please -check there if your issue has already been reported. If you spotted it first, -help us smash it by providing detailed and welcomed feedback. +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 +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. Credits ======= +Authors +~~~~~~~ + +* Tecnativa + Contributors ------------- +~~~~~~~~~~~~ * Carlos Dauden +Maintainers +~~~~~~~~~~~ -Maintainer ----------- +This module is maintained by the OCA. .. image:: https://odoo-community.org/logo.png :alt: Odoo Community Association :target: https://odoo-community.org -This module is maintained by the OCA. - 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. -To contribute to this module, please visit https://odoo-community.org. +This module is part of the `OCA/contract `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/contract_mandate/__openerp__.py b/contract_mandate/__manifest__.py similarity index 76% rename from contract_mandate/__openerp__.py rename to contract_mandate/__manifest__.py index 947012ad1..5e7e96ced 100644 --- a/contract_mandate/__openerp__.py +++ b/contract_mandate/__manifest__.py @@ -5,10 +5,10 @@ { 'name': 'Contract Mandate', 'summary': 'Mandate in contracts and their invoices', - 'version': '9.0.1.0.0', - 'author': 'Tecnativa, ' - 'Odoo Community Association (OCA)', - 'website': 'http://www.tecnativa.com', + 'version': '10.0.1.0.1', + 'author': 'Odoo Community Association (OCA), ' + 'Tecnativa', + 'website': 'https://github.com/OCA/contract', 'depends': [ 'contract_payment_mode', 'account_banking_mandate', diff --git a/contract_mandate/models/contract.py b/contract_mandate/models/contract.py index deb52a28c..103d1ba33 100644 --- a/contract_mandate/models/contract.py +++ b/contract_mandate/models/contract.py @@ -2,7 +2,7 @@ # Copyright 2017 Carlos Dauden - Tecnativa # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from openerp import api, fields, models +from odoo import api, fields, models class AccountAnalyticAccount(models.Model): @@ -13,7 +13,8 @@ class AccountAnalyticAccount(models.Model): ondelete='restrict', string='Direct Debit Mandate', help="If mandate required in payment method and not set mandate, " - "invoice takes the first valid mandate" + "invoice takes the first valid mandate", + index=True, ) mandate_required = fields.Boolean( related='payment_mode_id.payment_method_id.mandate_required', @@ -33,6 +34,7 @@ class AccountAnalyticAccount(models.Model): mandate = self.env['account.banking.mandate'].search([ ('partner_id', '=', self.partner_id.commercial_partner_id.id), ('state', '=', 'valid'), + ('company_id', '=', self.company_id.id), ], limit=1) invoice_vals['mandate_id'] = mandate.id return invoice_vals diff --git a/contract_mandate/readme/CONFIGURATION.rst b/contract_mandate/readme/CONFIGURATION.rst new file mode 100644 index 000000000..5d6fd55c7 --- /dev/null +++ b/contract_mandate/readme/CONFIGURATION.rst @@ -0,0 +1 @@ +Your user should be a Sales Manager or Accountant. diff --git a/contract_mandate/readme/CONTRIBUTORS.rst b/contract_mandate/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..242bdfddd --- /dev/null +++ b/contract_mandate/readme/CONTRIBUTORS.rst @@ -0,0 +1,2 @@ +* Carlos Dauden +* Bogdan Stanciu diff --git a/contract_mandate/readme/DESCRIPTION.rst b/contract_mandate/readme/DESCRIPTION.rst new file mode 100644 index 000000000..46b7768f7 --- /dev/null +++ b/contract_mandate/readme/DESCRIPTION.rst @@ -0,0 +1,2 @@ +This module allows to set a mandate mode on contract for creating the invoices +with this mandate. diff --git a/contract_mandate/readme/USAGE.rst b/contract_mandate/readme/USAGE.rst new file mode 100644 index 000000000..d1d752408 --- /dev/null +++ b/contract_mandate/readme/USAGE.rst @@ -0,0 +1,7 @@ +#. Go to *Sales > Sales > Contracts*. +#. Create one. +#. Select a partner to which invoice. +#. Select a mandate. +#. Click on **Generate recurring invoices automatically** checkbox. +#. Add a product to invoice. +#. If you create an invoice, new invoice will have the selected mandate. diff --git a/contract_mandate/static/description/icon.png b/contract_mandate/static/description/icon.png new file mode 100644 index 000000000..3a0328b51 Binary files /dev/null and b/contract_mandate/static/description/icon.png differ diff --git a/contract_mandate/static/description/index.html b/contract_mandate/static/description/index.html new file mode 100644 index 000000000..cc3ffcdfc --- /dev/null +++ b/contract_mandate/static/description/index.html @@ -0,0 +1,434 @@ + + + + + + +Contract Mandate + + + +
+

Contract Mandate

+ + +

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

+

This module allows to set a mandate mode on contract for creating the invoices +with this mandate.

+

Table of contents

+ +
+

Usage

+
    +
  1. Go to Sales > Sales > Contracts.
  2. +
  3. Create one.
  4. +
  5. Select a partner to which invoice.
  6. +
  7. Select a mandate.
  8. +
  9. Click on Generate recurring invoices automatically checkbox.
  10. +
  11. Add a product to invoice.
  12. +
  13. If you create an invoice, new invoice will have the selected mandate.
  14. +
+
+
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +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 +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Tecnativa
  • +
+
+ +
+

Maintainers

+

This module is maintained by the OCA.

+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.

+

This module is part of the OCA/contract project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/contract_mandate/tests/test_contract_mandate.py b/contract_mandate/tests/test_contract_mandate.py index 685ab4107..114b382d0 100644 --- a/contract_mandate/tests/test_contract_mandate.py +++ b/contract_mandate/tests/test_contract_mandate.py @@ -2,61 +2,61 @@ # Copyright 2017 Carlos Dauden - Tecnativa # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from openerp.tests import common +from odoo.tests import HttpCase -class TestContractMandate(common.SavepointCase): - @classmethod - def setUpClass(cls): - super(TestContractMandate, cls).setUpClass() - cls.payment_method = cls.env['account.payment.method'].create({ +class TestContractMandate(HttpCase): + + def setUp(self): + super(TestContractMandate, self).setUp() + self.payment_method = self.env['account.payment.method'].create({ 'name': 'Test SDD', 'code': 'test_code_sdd', 'payment_type': 'inbound', 'mandate_required': True, }) - cls.payment_mode = cls.env['account.payment.mode'].create({ + self.payment_mode = self.env['account.payment.mode'].create({ 'name': 'Test payment mode', 'bank_account_link': 'variable', - 'payment_method_id': cls.payment_method.id, + 'payment_method_id': self.payment_method.id, }) - cls.partner = cls.env['res.partner'].create({ + self.partner = self.env['res.partner'].create({ 'customer': True, 'name': 'Test Customer', - 'customer_payment_mode_id': cls.payment_mode.id, + 'customer_payment_mode_id': self.payment_mode.id, }) - cls.partner_bank = cls.env['res.partner.bank'].create({ + self.partner_bank = self.env['res.partner.bank'].create({ 'acc_number': '1234', - 'partner_id': cls.partner.id, + 'partner_id': self.partner.id, }) - cls.mandate = cls.env['account.banking.mandate'].create({ - 'partner_id': cls.partner.id, - 'partner_bank_id': cls.partner_bank.id, + self.mandate = self.env['account.banking.mandate'].create({ + 'partner_id': self.partner.id, + 'partner_bank_id': self.partner_bank.id, 'signature_date': '2017-01-01', }) - cls.uom = cls.env.ref('product.product_uom_hour') - cls.product = cls.env['product.product'].create({ + self.uom = self.env.ref('product.product_uom_hour') + self.product = self.env['product.product'].create({ 'name': 'Custom Service', 'type': 'service', - 'uom_id': cls.uom.id, - 'uom_po_id': cls.uom.id, + 'uom_id': self.uom.id, + 'uom_po_id': self.uom.id, 'sale_ok': True, 'taxes_id': [(6, 0, [])], }) - cls.contract = cls.env['account.analytic.account'].create({ + self.contract = self.env['account.analytic.account'].create({ 'name': 'Test contract', - 'partner_id': cls.partner.id, + 'partner_id': self.partner.id, 'recurring_invoices': True, 'recurring_interval': 1, 'recurring_invoice_line_ids': [(0, 0, { 'quantity': 2.0, 'price_unit': 200.0, 'name': 'Test contract line', - 'product_id': cls.product.id, - 'uom_id': cls.product.uom_id.id, + 'product_id': self.product.id, + 'uom_id': self.product.uom_id.id, })], - 'payment_mode_id': cls.payment_mode.id, - 'mandate_id': cls.mandate.id, + 'payment_mode_id': self.payment_mode.id, + 'mandate_id': self.mandate.id, }) def test_contract_mandate(self):