diff --git a/account_payment_mode/README.rst b/account_payment_mode/README.rst index 3dbfd9339..4f3ddc682 100644 --- a/account_payment_mode/README.rst +++ b/account_payment_mode/README.rst @@ -1,15 +1,39 @@ -.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg - :target: https://www.gnu.org/licenses/agpl-3.0-standalone.html - :alt: License: AGPL-3 - ==================== Account Payment Mode ==================== +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! 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%2Fbank--payment-lightgray.png?logo=github + :target: https://github.com/OCA/bank-payment/tree/12.0/account_payment_mode + :alt: OCA/bank-payment +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/bank-payment-12-0/bank-payment-12-0-account_payment_mode + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/97/12.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + This module adds a new object *account.payment.mode*, that is used to better classify and route incoming/outgoing payment orders with the banks. +**Table of contents** + +.. contents:: + :local: + Configuration ============= @@ -21,37 +45,43 @@ Usage This module doesn't add any feature, but it is used by several other modules. -.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas - :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/173/11.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 smashing it by providing a detailed and welcomed feedback. +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 +~~~~~~~ + +* Akretion + Contributors ------------- +~~~~~~~~~~~~ * Alexis de Lattre -Maintainer ----------- +Maintainers +~~~~~~~~~~~ + +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/bank-payment `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/account_payment_mode/__init__.py b/account_payment_mode/__init__.py index cde864bae..a9e337226 100644 --- a/account_payment_mode/__init__.py +++ b/account_payment_mode/__init__.py @@ -1,3 +1,2 @@ -# -*- coding: utf-8 -*- from . import models diff --git a/account_payment_mode/__manifest__.py b/account_payment_mode/__manifest__.py index 6ab7d6f85..fcb4d2f1f 100644 --- a/account_payment_mode/__manifest__.py +++ b/account_payment_mode/__manifest__.py @@ -1,10 +1,9 @@ -# -*- coding: utf-8 -*- # © 2016 Akretion (). # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). { 'name': 'Account Payment Mode', - 'version': '11.0.1.0.1', + 'version': '12.0.1.0.0', 'license': 'AGPL-3', 'author': "Akretion,Odoo Community Association (OCA)", 'website': 'https://github.com/OCA/bank-payment', diff --git a/account_payment_mode/migrations/11.0.1.0.1/pre-migration.py b/account_payment_mode/migrations/11.0.1.0.1/pre-migration.py deleted file mode 100644 index 873976730..000000000 --- a/account_payment_mode/migrations/11.0.1.0.1/pre-migration.py +++ /dev/null @@ -1,10 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2018 Akretion (Alexis de Lattre ) -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). - - -def migrate(cr, version): - if not version: - return - - cr.execute('ALTER TABLE res_partner_bank DROP COLUMN acc_type') diff --git a/account_payment_mode/models/__init__.py b/account_payment_mode/models/__init__.py index ae4c3c001..e59abce71 100644 --- a/account_payment_mode/models/__init__.py +++ b/account_payment_mode/models/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from . import account_payment_method from . import account_payment_mode diff --git a/account_payment_mode/models/account_journal.py b/account_payment_mode/models/account_journal.py index 9af2173c6..4b6d460c2 100644 --- a/account_payment_mode/models/account_journal.py +++ b/account_payment_mode/models/account_journal.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # © 2016 Akretion (Alexis de Lattre ) # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). diff --git a/account_payment_mode/models/account_payment_method.py b/account_payment_mode/models/account_payment_method.py index 554d1e0e5..3e6140322 100644 --- a/account_payment_mode/models/account_payment_method.py +++ b/account_payment_mode/models/account_payment_method.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # © 2016 Akretion (Alexis de Lattre ) # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). diff --git a/account_payment_mode/models/account_payment_mode.py b/account_payment_mode/models/account_payment_mode.py index 2a6cdf154..ca0a248a7 100644 --- a/account_payment_mode/models/account_payment_mode.py +++ b/account_payment_mode/models/account_payment_mode.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # © 2016 Akretion (Alexis de Lattre ) # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). @@ -60,58 +59,56 @@ class AccountPaymentMode(models.Model): @api.onchange('company_id') def _onchange_company_id(self): - for mode in self: - mode.variable_journal_ids = False - mode.fixed_journal_id = False + self.variable_journal_ids = False + self.fixed_journal_id = False @api.constrains( 'bank_account_link', 'fixed_journal_id', 'payment_method_id') def bank_account_link_constrains(self): - for mode in self: - if mode.bank_account_link == 'fixed': - if not mode.fixed_journal_id: - raise ValidationError(_( - "On the payment mode '%s', the bank account link is " - "'Fixed' but the fixed bank journal is not set") - % mode.name) + for mode in self.filtered(lambda x: x.bank_account_link == 'fixed'): + if not mode.fixed_journal_id: + raise ValidationError(_( + "On the payment mode '%s', the bank account link is " + "'Fixed' but the fixed bank journal is not set") + % mode.name) + else: + if mode.payment_method_id.payment_type == 'outbound': + if ( + mode.payment_method_id.id not in + mode.fixed_journal_id. + outbound_payment_method_ids.ids): + raise ValidationError(_( + "On the payment mode '%s', the payment method " + "is '%s', but this payment method is not part " + "of the payment methods of the fixed bank " + "journal '%s'") % ( + mode.name, + mode.payment_method_id.name, + mode.fixed_journal_id.name)) else: - if mode.payment_method_id.payment_type == 'outbound': - if ( - mode.payment_method_id.id not in - mode.fixed_journal_id. - outbound_payment_method_ids.ids): - raise ValidationError(_( - "On the payment mode '%s', the payment method " - "is '%s', but this payment method is not part " - "of the payment methods of the fixed bank " - "journal '%s'") % ( - mode.name, - mode.payment_method_id.name, - mode.fixed_journal_id.name)) - else: - if ( - mode.payment_method_id.id not in - mode.fixed_journal_id. - inbound_payment_method_ids.ids): - raise ValidationError(_( - "On the payment mode '%s', the payment method " - "is '%s' (it is in fact a debit method), " - "but this debit method is not part " - "of the debit methods of the fixed bank " - "journal '%s'") % ( - mode.name, - mode.payment_method_id.name, - mode.fixed_journal_id.name)) + if ( + mode.payment_method_id.id not in + mode.fixed_journal_id. + inbound_payment_method_ids.ids): + raise ValidationError(_( + "On the payment mode '%s', the payment method " + "is '%s' (it is in fact a debit method), " + "but this debit method is not part " + "of the debit methods of the fixed bank " + "journal '%s'") % ( + mode.name, + mode.payment_method_id.name, + mode.fixed_journal_id.name)) @api.constrains('company_id', 'fixed_journal_id') def company_id_fixed_journal_id_constrains(self): - for mode in self: - if mode.fixed_journal_id and mode.company_id != \ - mode.fixed_journal_id.company_id: - raise ValidationError(_( - "The company of the payment mode '%s', does not match " - "with the company of journal '%s'.") % ( - mode.name, mode.fixed_journal_id.name)) + for mode in self.filtered( + lambda x: x.fixed_journal_id + and x.company_id != x.fixed_journal_id.company_id): + raise ValidationError(_( + "The company of the payment mode '%s', does not match " + "with the company of journal '%s'.") % ( + mode.name, mode.fixed_journal_id.name)) @api.constrains('company_id', 'variable_journal_ids') def company_id_variable_journal_ids_constrains(self): diff --git a/account_payment_mode/models/res_partner_bank.py b/account_payment_mode/models/res_partner_bank.py index a87dfb801..f49c839c0 100644 --- a/account_payment_mode/models/res_partner_bank.py +++ b/account_payment_mode/models/res_partner_bank.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # © 2016 Akretion (Alexis de Lattre ) # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). diff --git a/account_payment_mode/readme/CONFIGURE.rst b/account_payment_mode/readme/CONFIGURE.rst new file mode 100644 index 000000000..70f683833 --- /dev/null +++ b/account_payment_mode/readme/CONFIGURE.rst @@ -0,0 +1,2 @@ +To configure this module, you need to go to the menu +*Invoicing/Accounting > Configuration > Management > Payment Modes*. diff --git a/account_payment_mode/readme/CONTRIBUTORS.rst b/account_payment_mode/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..ff65d68ce --- /dev/null +++ b/account_payment_mode/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +* Alexis de Lattre diff --git a/account_payment_mode/readme/DESCRIPTION.rst b/account_payment_mode/readme/DESCRIPTION.rst new file mode 100644 index 000000000..82c26ba64 --- /dev/null +++ b/account_payment_mode/readme/DESCRIPTION.rst @@ -0,0 +1,3 @@ +This module adds a new object *account.payment.mode*, that is used to better +classify and route incoming/outgoing payment orders with the banks. + diff --git a/account_payment_mode/readme/USAGE.rst b/account_payment_mode/readme/USAGE.rst new file mode 100644 index 000000000..1d0801e9b --- /dev/null +++ b/account_payment_mode/readme/USAGE.rst @@ -0,0 +1,2 @@ +This module doesn't add any feature, but it is used by several other modules. + diff --git a/account_payment_mode/static/description/index.html b/account_payment_mode/static/description/index.html new file mode 100644 index 000000000..1dff95f51 --- /dev/null +++ b/account_payment_mode/static/description/index.html @@ -0,0 +1,431 @@ + + + + + + +Account Payment Mode + + + +
+

Account Payment Mode

+ + +

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

+

This module adds a new object account.payment.mode, that is used to better +classify and route incoming/outgoing payment orders with the banks.

+

Table of contents

+ +
+

Configuration

+

To configure this module, you need to go to the menu +Invoicing/Accounting > Configuration > Management > Payment Modes.

+
+
+

Usage

+

This module doesn’t add any feature, but it is used by several other modules.

+
+
+

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

+
    +
  • Akretion
  • +
+
+
+

Contributors

+ +
+
+

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/bank-payment project on GitHub.

+

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

+
+
+
+ + diff --git a/account_payment_mode/tests/__init__.py b/account_payment_mode/tests/__init__.py index b0f898173..6c4ef2b5d 100644 --- a/account_payment_mode/tests/__init__.py +++ b/account_payment_mode/tests/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # © 2017 Eficent Business and IT Consulting Services S.L. # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). from . import test_account_payment_mode diff --git a/account_payment_mode/tests/test_account_payment_mode.py b/account_payment_mode/tests/test_account_payment_mode.py index 24ef5823d..a0ec515ed 100644 --- a/account_payment_mode/tests/test_account_payment_mode.py +++ b/account_payment_mode/tests/test_account_payment_mode.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # © 2016 Eficent Business and IT Consulting Services S.L. # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).