From 74a758c9bded47ff3c1c1d3d00918e7d5aae2a4c Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Thu, 24 Dec 2020 10:33:49 +0100 Subject: [PATCH] [MIG] account_payment_sale to 14.0 --- account_payment_sale/README.rst | 19 +++---- account_payment_sale/__manifest__.py | 2 +- .../i18n/account_payment_sale.pot | 19 ++++++- account_payment_sale/i18n/ca.po | 17 +++++- account_payment_sale/i18n/fr_FR.po | 55 +++++++++++++++++++ account_payment_sale/i18n/nl.po | 9 +-- account_payment_sale/models/__init__.py | 1 - account_payment_sale/models/account_move.py | 19 ------- account_payment_sale/models/sale_order.py | 11 ++-- account_payment_sale/readme/DESCRIPTION.rst | 5 -- account_payment_sale/readme/USAGE.rst | 4 +- .../static/description/index.html | 14 ++--- account_payment_sale/tests/test_sale_order.py | 4 +- .../views/sale_order_view.xml | 3 +- .../wizard/sale_make_invoice_advance.py | 12 ++-- 15 files changed, 120 insertions(+), 74 deletions(-) create mode 100644 account_payment_sale/i18n/fr_FR.po delete mode 100644 account_payment_sale/models/account_move.py diff --git a/account_payment_sale/README.rst b/account_payment_sale/README.rst index d4e1399d0..435bb23cd 100644 --- a/account_payment_sale/README.rst +++ b/account_payment_sale/README.rst @@ -14,13 +14,13 @@ Account Payment Sale :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/13.0/account_payment_sale + :target: https://github.com/OCA/bank-payment/tree/14.0/account_payment_sale :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-13-0/bank-payment-13-0-account_payment_sale + :target: https://translation.odoo-community.org/projects/bank-payment-14-0/bank-payment-14-0-account_payment_sale :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/173/13.0 + :target: https://runbot.odoo-community.org/runbot/173/14.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -29,11 +29,6 @@ This modules adds one field on sale orders: *Payment Mode*. This field is copied from customer to sale order and then from sale order to customer invoice. -This module is similar to the *sale_payment* module; the main difference is -that it doesn't depend on the *account_payment_extension* module (it's not the -only module to conflict with *account_payment_extension*; all the SEPA -modules in the banking addons conflict with *account_payment_extension*. - **Table of contents** .. contents:: @@ -43,8 +38,8 @@ Usage ===== You are able to add a payment mode directly on a partner. -This payment mode is automatically associated to the sale order, then on related invoice. -This default value can be changed in a draft sale order or draft invoice. +This payment mode is automatically associated to the sale order, then copied to the related invoice. +This default value can be changed sale orders or on draft invoices. Bug Tracker =========== @@ -52,7 +47,7 @@ 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 `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -88,6 +83,6 @@ 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. +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_sale/__manifest__.py b/account_payment_sale/__manifest__.py index 2d09ae2b7..775aae7f0 100644 --- a/account_payment_sale/__manifest__.py +++ b/account_payment_sale/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Account Payment Sale", - "version": "13.0.1.1.1", + "version": "14.0.1.0.0", "category": "Banking addons", "license": "AGPL-3", "summary": "Adds payment mode on sale orders", diff --git a/account_payment_sale/i18n/account_payment_sale.pot b/account_payment_sale/i18n/account_payment_sale.pot index 3d4dcbd2d..ae2c55844 100644 --- a/account_payment_sale/i18n/account_payment_sale.pot +++ b/account_payment_sale/i18n/account_payment_sale.pot @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 13.0\n" +"Project-Id-Version: Odoo Server 14.0\n" "Report-Msgid-Bugs-To: \n" "Last-Translator: \n" "Language-Team: \n" @@ -19,8 +19,21 @@ msgid "Payment Mode:" msgstr "" #. module: account_payment_sale -#: model:ir.model,name:account_payment_sale.model_account_move -msgid "Journal Entries" +#: model:ir.model.fields,field_description:account_payment_sale.field_sale_advance_payment_inv__display_name +#: model:ir.model.fields,field_description:account_payment_sale.field_sale_order__display_name +msgid "Display Name" +msgstr "" + +#. module: account_payment_sale +#: model:ir.model.fields,field_description:account_payment_sale.field_sale_advance_payment_inv__id +#: model:ir.model.fields,field_description:account_payment_sale.field_sale_order__id +msgid "ID" +msgstr "" + +#. module: account_payment_sale +#: model:ir.model.fields,field_description:account_payment_sale.field_sale_advance_payment_inv____last_update +#: model:ir.model.fields,field_description:account_payment_sale.field_sale_order____last_update +msgid "Last Modified on" msgstr "" #. module: account_payment_sale diff --git a/account_payment_sale/i18n/ca.po b/account_payment_sale/i18n/ca.po index 3dd86225b..647d677cb 100644 --- a/account_payment_sale/i18n/ca.po +++ b/account_payment_sale/i18n/ca.po @@ -25,8 +25,21 @@ msgid "Payment Mode:" msgstr "Mode de pagament:" #. module: account_payment_sale -#: model:ir.model,name:account_payment_sale.model_account_move -msgid "Journal Entries" +#: model:ir.model.fields,field_description:account_payment_sale.field_sale_advance_payment_inv__display_name +#: model:ir.model.fields,field_description:account_payment_sale.field_sale_order__display_name +msgid "Display Name" +msgstr "" + +#. module: account_payment_sale +#: model:ir.model.fields,field_description:account_payment_sale.field_sale_advance_payment_inv__id +#: model:ir.model.fields,field_description:account_payment_sale.field_sale_order__id +msgid "ID" +msgstr "" + +#. module: account_payment_sale +#: model:ir.model.fields,field_description:account_payment_sale.field_sale_advance_payment_inv____last_update +#: model:ir.model.fields,field_description:account_payment_sale.field_sale_order____last_update +msgid "Last Modified on" msgstr "" #. module: account_payment_sale diff --git a/account_payment_sale/i18n/fr_FR.po b/account_payment_sale/i18n/fr_FR.po new file mode 100644 index 000000000..434ae7aa6 --- /dev/null +++ b/account_payment_sale/i18n/fr_FR.po @@ -0,0 +1,55 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_payment_sale +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2021-04-10 14:50+0000\n" +"Last-Translator: Yves Le Doeuff \n" +"Language-Team: none\n" +"Language: fr_FR\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n > 1;\n" +"X-Generator: Weblate 4.3.2\n" + +#. module: account_payment_sale +#: model_terms:ir.ui.view,arch_db:account_payment_sale.report_sale_payment_mode +msgid "Payment Mode:" +msgstr "Mode de paiement:" + +#. module: account_payment_sale +#: model:ir.model.fields,field_description:account_payment_sale.field_sale_advance_payment_inv__display_name +#: model:ir.model.fields,field_description:account_payment_sale.field_sale_order__display_name +msgid "Display Name" +msgstr "Nom affiché" + +#. module: account_payment_sale +#: model:ir.model.fields,field_description:account_payment_sale.field_sale_advance_payment_inv__id +#: model:ir.model.fields,field_description:account_payment_sale.field_sale_order__id +msgid "ID" +msgstr "" + +#. module: account_payment_sale +#: model:ir.model.fields,field_description:account_payment_sale.field_sale_advance_payment_inv____last_update +#: model:ir.model.fields,field_description:account_payment_sale.field_sale_order____last_update +msgid "Last Modified on" +msgstr "Dernière modification" + +#. module: account_payment_sale +#: model:ir.model.fields,field_description:account_payment_sale.field_sale_order__payment_mode_id +msgid "Payment Mode" +msgstr "Mode de paiement" + +#. module: account_payment_sale +#: model:ir.model,name:account_payment_sale.model_sale_advance_payment_inv +msgid "Sales Advance Payment Invoice" +msgstr "Facture d'acompte" + +#. module: account_payment_sale +#: model:ir.model,name:account_payment_sale.model_sale_order +msgid "Sales Order" +msgstr "Commande" diff --git a/account_payment_sale/i18n/nl.po b/account_payment_sale/i18n/nl.po index 2c3a80438..97148b796 100644 --- a/account_payment_sale/i18n/nl.po +++ b/account_payment_sale/i18n/nl.po @@ -9,14 +9,15 @@ msgstr "" "Project-Id-Version: Odoo Server 11.0\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-02-02 03:43+0000\n" -"PO-Revision-Date: 2018-02-02 03:43+0000\n" -"Last-Translator: OCA Transbot , 2018\n" +"PO-Revision-Date: 2021-04-22 18:47+0000\n" +"Last-Translator: Bosd \n" "Language-Team: Dutch (https://www.transifex.com/oca/teams/23907/nl/)\n" "Language: nl\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.3.2\n" #. module: account_payment_sale #: model_terms:ir.ui.view,arch_db:account_payment_sale.report_sale_payment_mode @@ -26,7 +27,7 @@ msgstr "Betaalmode:" #. module: account_payment_sale #: model:ir.model,name:account_payment_sale.model_account_move msgid "Journal Entries" -msgstr "" +msgstr "Boekingen" #. module: account_payment_sale #: model:ir.model.fields,field_description:account_payment_sale.field_sale_order__payment_mode_id diff --git a/account_payment_sale/models/__init__.py b/account_payment_sale/models/__init__.py index df48fd830..6aacb7531 100644 --- a/account_payment_sale/models/__init__.py +++ b/account_payment_sale/models/__init__.py @@ -1,2 +1 @@ -from . import account_move from . import sale_order diff --git a/account_payment_sale/models/account_move.py b/account_payment_sale/models/account_move.py deleted file mode 100644 index f2bf20f88..000000000 --- a/account_payment_sale/models/account_move.py +++ /dev/null @@ -1,19 +0,0 @@ -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). - -from odoo import api, models - - -class AccountMove(models.Model): - _inherit = "account.move" - - @api.model - def create(self, vals_list): - if vals_list.get("payment_mode_id"): - payment_mode = self.env["account.payment.mode"].browse( - vals_list["payment_mode_id"] - ) - if payment_mode.bank_account_link == "fixed": - vals_list[ - "invoice_partner_bank_id" - ] = payment_mode.fixed_journal_id.bank_account_id.id - return super().create(vals_list) diff --git a/account_payment_sale/models/sale_order.py b/account_payment_sale/models/sale_order.py index 2cdd5b1b6..3fc69c238 100644 --- a/account_payment_sale/models/sale_order.py +++ b/account_payment_sale/models/sale_order.py @@ -1,4 +1,4 @@ -# Copyright 2014-2016 Akretion - Alexis de Lattre +# Copyright 2014-2020 Akretion - Alexis de Lattre # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from odoo import api, fields, models @@ -12,7 +12,8 @@ class SaleOrder(models.Model): compute="_compute_payment_mode", store=True, readonly=False, - domain=[("payment_type", "=", "inbound")], + check_company=True, + domain="[('payment_type', '=', 'inbound'), ('company_id', '=', company_id)]", ) @api.depends("partner_id") @@ -31,11 +32,11 @@ class SaleOrder(models.Model): and self.payment_mode_id.payment_method_id.code == "manual" ): vals[ - "invoice_partner_bank_id" + "partner_bank_id" ] = self.payment_mode_id.fixed_journal_id.bank_account_id.id - return vals def _prepare_invoice(self): """Copy bank partner from sale order to invoice""" vals = super()._prepare_invoice() - return self._get_payment_mode_vals(vals) + self._get_payment_mode_vals(vals) + return vals diff --git a/account_payment_sale/readme/DESCRIPTION.rst b/account_payment_sale/readme/DESCRIPTION.rst index 3f30200f3..462a4a16b 100644 --- a/account_payment_sale/readme/DESCRIPTION.rst +++ b/account_payment_sale/readme/DESCRIPTION.rst @@ -1,8 +1,3 @@ This modules adds one field on sale orders: *Payment Mode*. This field is copied from customer to sale order and then from sale order to customer invoice. - -This module is similar to the *sale_payment* module; the main difference is -that it doesn't depend on the *account_payment_extension* module (it's not the -only module to conflict with *account_payment_extension*; all the SEPA -modules in the banking addons conflict with *account_payment_extension*. diff --git a/account_payment_sale/readme/USAGE.rst b/account_payment_sale/readme/USAGE.rst index 59244604c..bc6f451f4 100644 --- a/account_payment_sale/readme/USAGE.rst +++ b/account_payment_sale/readme/USAGE.rst @@ -1,3 +1,3 @@ You are able to add a payment mode directly on a partner. -This payment mode is automatically associated to the sale order, then on related invoice. -This default value can be changed in a draft sale order or draft invoice. +This payment mode is automatically associated to the sale order, then copied to the related invoice. +This default value can be changed sale orders or on draft invoices. diff --git a/account_payment_sale/static/description/index.html b/account_payment_sale/static/description/index.html index 6ee57eb02..952aff84c 100644 --- a/account_payment_sale/static/description/index.html +++ b/account_payment_sale/static/description/index.html @@ -367,14 +367,10 @@ ul.auto-toc { !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

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

+

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

This modules adds one field on sale orders: Payment Mode. This field is copied from customer to sale order and then from sale order to customer invoice.

-

This module is similar to the sale_payment module; the main difference is -that it doesn’t depend on the account_payment_extension module (it’s not the -only module to conflict with account_payment_extension; all the SEPA -modules in the banking addons conflict with account_payment_extension.

Table of contents

    @@ -391,15 +387,15 @@ modules in the banking addons conflict with account_payment_extension.<

    Usage

    You are able to add a payment mode directly on a partner. -This payment mode is automatically associated to the sale order, then on related invoice. -This default value can be changed in a draft sale order or draft invoice.

    +This payment mode is automatically associated to the sale order, then copied to the related invoice. +This default value can be changed sale orders or on draft invoices.

    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.

    +feedback.

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

    @@ -429,7 +425,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome

    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.

    +

    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_sale/tests/test_sale_order.py b/account_payment_sale/tests/test_sale_order.py index b6c60dbcb..a5f299b98 100644 --- a/account_payment_sale/tests/test_sale_order.py +++ b/account_payment_sale/tests/test_sale_order.py @@ -39,7 +39,7 @@ class TestSaleOrder(CommonTestCase): invoice = order.invoice_ids self.assertEqual(len(invoice), 1) self.assertEqual(invoice.payment_mode_id, expected_payment_mode) - self.assertEqual(invoice.invoice_partner_bank_id, expected_partner_bank) + self.assertEqual(invoice.partner_bank_id, expected_partner_bank) def test_sale_to_invoice_payment_mode(self): """ @@ -95,4 +95,4 @@ class TestSaleOrder(CommonTestCase): invoice = order.invoice_ids self.assertEqual(len(invoice), 1) self.assertEqual(invoice.payment_mode_id, self.payment_mode_2) - self.assertEqual(invoice.invoice_partner_bank_id, self.bank) + self.assertEqual(invoice.partner_bank_id, self.bank) diff --git a/account_payment_sale/views/sale_order_view.xml b/account_payment_sale/views/sale_order_view.xml index 9d2160a2a..5696df104 100644 --- a/account_payment_sale/views/sale_order_view.xml +++ b/account_payment_sale/views/sale_order_view.xml @@ -1,6 +1,6 @@ @@ -12,7 +12,6 @@ diff --git a/account_payment_sale/wizard/sale_make_invoice_advance.py b/account_payment_sale/wizard/sale_make_invoice_advance.py index 6aed7c2f9..9d9dc1a18 100644 --- a/account_payment_sale/wizard/sale_make_invoice_advance.py +++ b/account_payment_sale/wizard/sale_make_invoice_advance.py @@ -1,4 +1,4 @@ -# Copyright 2016 Akretion - Alexis de Lattre +# Copyright 2016-2020 Akretion - Alexis de Lattre # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from odoo import models @@ -7,10 +7,8 @@ from odoo import models class SaleAdvancePaymentInv(models.TransientModel): _inherit = "sale.advance.payment.inv" - def _create_invoice(self, order, so_line, amount): + def _prepare_invoice_values(self, order, name, amount, so_line): """Copy payment mode from sale order to invoice""" - inv = super()._create_invoice(order, so_line, amount) - vals = order._get_payment_mode_vals({}) - if vals: - inv.write(vals) - return inv + vals = super()._prepare_invoice_values(order, name, amount, so_line) + order._get_payment_mode_vals(vals) + return vals