diff --git a/account_payment_partner/README.rst b/account_payment_partner/README.rst new file mode 100644 index 000000000..15ee4b252 --- /dev/null +++ b/account_payment_partner/README.rst @@ -0,0 +1,82 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :alt: License: AGPL-3 + +======================= +Account Payment Partner +======================= + +This module adds severals fields : + +* the *Supplier Payment Mode* and *Customer Payment Mode* on Partners, + +* the *Payment Mode* on Invoices. + +On a Payment Order, in the wizard *Select Invoices to Pay*, the invoices will +be filtered per Payment Mode. + +Installation +============ + +This module depends on : + +* account_payment_mode + +This module is part of the OCA/bank-payment suite. + +Configuration +============= + +There is nothing to configure. + +Usage +===== + +You are able to add a payment mode directly on a partner. +This payment mode is automatically associated to the invoice related to the partner. This default value could be change in a draft invoice. +When you create an payment order, only invoices related to chosen payment mode are displayed. +Invoices without any payment mode are displayed to. + +.. 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 + +Known issues / Roadmap +====================== + + * No known issues. + +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. + +Credits +======= + +Contributors +------------ + +* Pedro M. Baeza +* Alexis de Lattre +* Raphaël Valyi +* Stefan Rijnhart (Therp) +* Alexandre Fayolle +* Stéphane Bidoul +* Danimar Ribeiro +* Angel Moya + +Maintainer +---------- + +.. 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. diff --git a/account_payment_partner/__init__.py b/account_payment_partner/__init__.py new file mode 100644 index 000000000..50def6204 --- /dev/null +++ b/account_payment_partner/__init__.py @@ -0,0 +1,5 @@ +# -*- coding: utf-8 -*- +# © 2014 Akretion - Alexis de Lattre +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from . import models diff --git a/account_payment_partner/__manifest__.py b/account_payment_partner/__manifest__.py new file mode 100644 index 000000000..2d29082d2 --- /dev/null +++ b/account_payment_partner/__manifest__.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +# © 2014 Akretion - Alexis de Lattre +# © 2014 Tecnativa - Pedro M. Baeza +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +{ + 'name': 'Account Payment Partner', + 'version': '11.0.1.0.0', + 'category': 'Banking addons', + 'license': 'AGPL-3', + 'summary': 'Adds payment mode on partners and invoices', + 'author': "Akretion, " + "Tecnativa, " + "Odoo Community Association (OCA)", + 'website': 'https://github.com/OCA/bank-payment', + 'depends': ['account_payment_mode'], + 'data': [ + 'views/res_partner_view.xml', + 'views/account_invoice_view.xml', + 'views/account_move_line.xml', + 'views/report_invoice.xml', + ], + 'demo': ['demo/partner_demo.xml'], + 'installable': True, +} diff --git a/account_payment_partner/demo/partner_demo.xml b/account_payment_partner/demo/partner_demo.xml new file mode 100644 index 000000000..bf5b8b751 --- /dev/null +++ b/account_payment_partner/demo/partner_demo.xml @@ -0,0 +1,24 @@ + + + + + + Default Supplier Payment Mode + + + + + + + Default Customer Payment Mode + + + + + + + diff --git a/account_payment_partner/i18n/de.po b/account_payment_partner/i18n/de.po new file mode 100644 index 000000000..1bf0e8d9a --- /dev/null +++ b/account_payment_partner/i18n/de.po @@ -0,0 +1,93 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_payment_partner +# +# Translators: +# Niki Waibel, 2016 +# Niki Waibel, 2016 +msgid "" +msgstr "" +"Project-Id-Version: bank-payment (10.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-05-01 14:55+0000\n" +"PO-Revision-Date: 2016-11-01 20:49+0000\n" +"Last-Translator: Niki Waibel\n" +"Language-Team: German (http://www.transifex.com/oca/OCA-bank-payment-10-0/language/de/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: de\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: account_payment_partner +#: model:ir.ui.view,arch_db:account_payment_partner.report_invoice_payment_mode +msgid "Bank Account:" +msgstr "Bankkonto:" + +#. module: account_payment_partner +#: model:ir.ui.view,arch_db:account_payment_partner.report_invoice_payment_mode +msgid "Payment Mode:" +msgstr "Zahlungsmethode:" + +#. module: account_payment_partner +#: model:ir.model.fields,help:account_payment_partner.field_account_invoice_bank_account_required +msgid "" +"Activate this option if this payment method requires you to know the bank " +"account number of your customer or supplier." +msgstr "Aktiviere diese Option, wenn mit dieser Zahlungsmethode die Bankkontonummer des Kunden oder Lieferanten bekannt sein muss." + +#. module: account_payment_partner +#: model:ir.model.fields,field_description:account_payment_partner.field_account_invoice_bank_account_required +msgid "Bank Account Required" +msgstr "Bankkonto erforderlich" + +#. module: account_payment_partner +#: model:ir.model.fields,field_description:account_payment_partner.field_res_partner_customer_payment_mode_id +#: model:ir.model.fields,field_description:account_payment_partner.field_res_users_customer_payment_mode_id +msgid "Customer Payment Mode" +msgstr "Zahlungsmethode des Kunden" + +#. module: account_payment_partner +#: model:ir.model,name:account_payment_partner.model_account_invoice +msgid "Invoice" +msgstr "Rechnung" + +#. module: account_payment_partner +#: model:ir.model,name:account_payment_partner.model_account_move_line +msgid "Journal Item" +msgstr "Logbuch Eintrag" + +#. module: account_payment_partner +#: model:ir.model,name:account_payment_partner.model_res_partner +msgid "Partner" +msgstr "Partner" + +#. module: account_payment_partner +#: model:ir.model.fields,field_description:account_payment_partner.field_account_invoice_payment_mode_id +#: model:ir.model.fields,field_description:account_payment_partner.field_account_move_line_payment_mode_id +#: model:ir.ui.view,arch_db:account_payment_partner.view_account_invoice_filter +msgid "Payment Mode" +msgstr "Zahlungsmodus" + +#. module: account_payment_partner +#: model:ir.ui.view,arch_db:account_payment_partner.view_move_line_form +msgid "Payments" +msgstr "Zahlungen" + +#. module: account_payment_partner +#: model:ir.model.fields,help:account_payment_partner.field_res_partner_customer_payment_mode_id +#: model:ir.model.fields,help:account_payment_partner.field_res_users_customer_payment_mode_id +msgid "Select the default payment mode for this customer." +msgstr "Wähle die standard Zahlungsmethode für diesen Kunden." + +#. module: account_payment_partner +#: model:ir.model.fields,help:account_payment_partner.field_res_partner_supplier_payment_mode_id +#: model:ir.model.fields,help:account_payment_partner.field_res_users_supplier_payment_mode_id +msgid "Select the default payment mode for this supplier." +msgstr "Wähle die standard Zahlungsmethode für diesen Lieferanten." + +#. module: account_payment_partner +#: model:ir.model.fields,field_description:account_payment_partner.field_res_partner_supplier_payment_mode_id +#: model:ir.model.fields,field_description:account_payment_partner.field_res_users_supplier_payment_mode_id +msgid "Supplier Payment Mode" +msgstr "Zahlungsmethode des Lieferanten" diff --git a/account_payment_partner/i18n/es.po b/account_payment_partner/i18n/es.po new file mode 100644 index 000000000..71c086681 --- /dev/null +++ b/account_payment_partner/i18n/es.po @@ -0,0 +1,93 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_payment_partner +# +# Translators: +# OCA Transbot , 2016 +# Pedro M. Baeza , 2016 +msgid "" +msgstr "" +"Project-Id-Version: bank-payment (10.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-05-01 14:55+0000\n" +"PO-Revision-Date: 2016-12-27 12:50+0000\n" +"Last-Translator: Pedro M. Baeza \n" +"Language-Team: Spanish (http://www.transifex.com/oca/OCA-bank-payment-10-0/language/es/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: es\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: account_payment_partner +#: model:ir.ui.view,arch_db:account_payment_partner.report_invoice_payment_mode +msgid "Bank Account:" +msgstr "Cuenta bancaria:" + +#. module: account_payment_partner +#: model:ir.ui.view,arch_db:account_payment_partner.report_invoice_payment_mode +msgid "Payment Mode:" +msgstr "Modo de pago:" + +#. module: account_payment_partner +#: model:ir.model.fields,help:account_payment_partner.field_account_invoice_bank_account_required +msgid "" +"Activate this option if this payment method requires you to know the bank " +"account number of your customer or supplier." +msgstr "Activa esta opción si este método de pago debe requerirte informar el número de cuenta bancaria de tu cliente o proveedor" + +#. module: account_payment_partner +#: model:ir.model.fields,field_description:account_payment_partner.field_account_invoice_bank_account_required +msgid "Bank Account Required" +msgstr "Cuenta bancaria requerida" + +#. module: account_payment_partner +#: model:ir.model.fields,field_description:account_payment_partner.field_res_partner_customer_payment_mode_id +#: model:ir.model.fields,field_description:account_payment_partner.field_res_users_customer_payment_mode_id +msgid "Customer Payment Mode" +msgstr "Modo de pago de cliente" + +#. module: account_payment_partner +#: model:ir.model,name:account_payment_partner.model_account_invoice +msgid "Invoice" +msgstr "Factura" + +#. module: account_payment_partner +#: model:ir.model,name:account_payment_partner.model_account_move_line +msgid "Journal Item" +msgstr "Apunte contable" + +#. module: account_payment_partner +#: model:ir.model,name:account_payment_partner.model_res_partner +msgid "Partner" +msgstr "Empresa" + +#. module: account_payment_partner +#: model:ir.model.fields,field_description:account_payment_partner.field_account_invoice_payment_mode_id +#: model:ir.model.fields,field_description:account_payment_partner.field_account_move_line_payment_mode_id +#: model:ir.ui.view,arch_db:account_payment_partner.view_account_invoice_filter +msgid "Payment Mode" +msgstr "Modo de pago" + +#. module: account_payment_partner +#: model:ir.ui.view,arch_db:account_payment_partner.view_move_line_form +msgid "Payments" +msgstr "Pagos" + +#. module: account_payment_partner +#: model:ir.model.fields,help:account_payment_partner.field_res_partner_customer_payment_mode_id +#: model:ir.model.fields,help:account_payment_partner.field_res_users_customer_payment_mode_id +msgid "Select the default payment mode for this customer." +msgstr "Seleccione el modo de pago por defecto cuando esta empresa actúa como cliente." + +#. module: account_payment_partner +#: model:ir.model.fields,help:account_payment_partner.field_res_partner_supplier_payment_mode_id +#: model:ir.model.fields,help:account_payment_partner.field_res_users_supplier_payment_mode_id +msgid "Select the default payment mode for this supplier." +msgstr "Seleccione el modo de pago por defecto cuando esta empresa actúa como proveedor." + +#. module: account_payment_partner +#: model:ir.model.fields,field_description:account_payment_partner.field_res_partner_supplier_payment_mode_id +#: model:ir.model.fields,field_description:account_payment_partner.field_res_users_supplier_payment_mode_id +msgid "Supplier Payment Mode" +msgstr "Modo de pago de proveedor" diff --git a/account_payment_partner/i18n/fr.po b/account_payment_partner/i18n/fr.po new file mode 100644 index 000000000..48e07c7e6 --- /dev/null +++ b/account_payment_partner/i18n/fr.po @@ -0,0 +1,88 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_payment_partner +# +# Translators: +# OCA Transbot , 2016 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-09-10 16:16+0000\n" +"PO-Revision-Date: 2016-09-10 16:16+0000\n" +"Last-Translator: OCA Transbot , 2016\n" +"Language-Team: French (https://www.transifex.com/oca/teams/23907/fr/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: fr\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +#. module: account_payment_partner +#: model:ir.ui.view,arch_db:account_payment_partner.report_invoice_payment_mode +msgid "Bank Account:" +msgstr "" + +#. module: account_payment_partner +#: model:ir.ui.view,arch_db:account_payment_partner.report_invoice_payment_mode +msgid "Payment Mode:" +msgstr "" + +#. module: account_payment_partner +#: model:ir.model.fields,help:account_payment_partner.field_account_invoice_bank_account_required +msgid "" +"Activate this option if this payment method requires you to know the bank " +"account number of your customer or supplier." +msgstr "" + +#. module: account_payment_partner +#: model:ir.model.fields,field_description:account_payment_partner.field_account_invoice_bank_account_required +msgid "Bank Account Required" +msgstr "" + +#. module: account_payment_partner +#: model:ir.model.fields,field_description:account_payment_partner.field_res_partner_customer_payment_mode_id +msgid "Customer Payment Mode" +msgstr "" + +#. module: account_payment_partner +#: model:ir.model,name:account_payment_partner.model_account_invoice +msgid "Invoice" +msgstr "" + +#. module: account_payment_partner +#: model:ir.model,name:account_payment_partner.model_account_move_line +msgid "Journal Item" +msgstr "" + +#. module: account_payment_partner +#: model:ir.model,name:account_payment_partner.model_res_partner +msgid "Partner" +msgstr "Partenaire" + +#. module: account_payment_partner +#: model:ir.model.fields,field_description:account_payment_partner.field_account_invoice_payment_mode_id +#: model:ir.model.fields,field_description:account_payment_partner.field_account_move_line_payment_mode_id +#: model:ir.ui.view,arch_db:account_payment_partner.view_account_invoice_filter +msgid "Payment Mode" +msgstr "Mode de paiement" + +#. module: account_payment_partner +#: model:ir.ui.view,arch_db:account_payment_partner.view_move_line_form +msgid "Payments" +msgstr "" + +#. module: account_payment_partner +#: model:ir.model.fields,help:account_payment_partner.field_res_partner_customer_payment_mode_id +msgid "Select the default payment mode for this customer." +msgstr "" + +#. module: account_payment_partner +#: model:ir.model.fields,help:account_payment_partner.field_res_partner_supplier_payment_mode_id +msgid "Select the default payment mode for this supplier." +msgstr "" + +#. module: account_payment_partner +#: model:ir.model.fields,field_description:account_payment_partner.field_res_partner_supplier_payment_mode_id +msgid "Supplier Payment Mode" +msgstr "" diff --git a/account_payment_partner/i18n/hr.po b/account_payment_partner/i18n/hr.po new file mode 100644 index 000000000..78d4bd9cc --- /dev/null +++ b/account_payment_partner/i18n/hr.po @@ -0,0 +1,91 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_payment_partner +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: bank-payment (10.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-06-03 00:10+0000\n" +"PO-Revision-Date: 2016-10-19 23:47+0000\n" +"Last-Translator: <>\n" +"Language-Team: Croatian (http://www.transifex.com/oca/OCA-bank-payment-10-0/language/hr/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: hr\n" +"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" + +#. module: account_payment_partner +#: model:ir.ui.view,arch_db:account_payment_partner.report_invoice_payment_mode +msgid "Bank Account:" +msgstr "" + +#. module: account_payment_partner +#: model:ir.ui.view,arch_db:account_payment_partner.report_invoice_payment_mode +msgid "Payment Mode:" +msgstr "" + +#. module: account_payment_partner +#: model:ir.model.fields,help:account_payment_partner.field_account_invoice_bank_account_required +msgid "" +"Activate this option if this payment method requires you to know the bank " +"account number of your customer or supplier." +msgstr "" + +#. module: account_payment_partner +#: model:ir.model.fields,field_description:account_payment_partner.field_account_invoice_bank_account_required +msgid "Bank Account Required" +msgstr "Bankovni račun je obavezan" + +#. module: account_payment_partner +#: model:ir.model.fields,field_description:account_payment_partner.field_res_partner_customer_payment_mode_id +#: model:ir.model.fields,field_description:account_payment_partner.field_res_users_customer_payment_mode_id +msgid "Customer Payment Mode" +msgstr "" + +#. module: account_payment_partner +#: model:ir.model,name:account_payment_partner.model_account_invoice +msgid "Invoice" +msgstr "" + +#. module: account_payment_partner +#: model:ir.model,name:account_payment_partner.model_account_move_line +msgid "Journal Item" +msgstr "" + +#. module: account_payment_partner +#: model:ir.model,name:account_payment_partner.model_res_partner +msgid "Partner" +msgstr "" + +#. module: account_payment_partner +#: model:ir.model.fields,field_description:account_payment_partner.field_account_invoice_payment_mode_id +#: model:ir.model.fields,field_description:account_payment_partner.field_account_move_line_payment_mode_id +#: model:ir.ui.view,arch_db:account_payment_partner.view_account_invoice_filter +msgid "Payment Mode" +msgstr "" + +#. module: account_payment_partner +#: model:ir.ui.view,arch_db:account_payment_partner.view_move_line_form +msgid "Payments" +msgstr "" + +#. module: account_payment_partner +#: model:ir.model.fields,help:account_payment_partner.field_res_partner_customer_payment_mode_id +#: model:ir.model.fields,help:account_payment_partner.field_res_users_customer_payment_mode_id +msgid "Select the default payment mode for this customer." +msgstr "" + +#. module: account_payment_partner +#: model:ir.model.fields,help:account_payment_partner.field_res_partner_supplier_payment_mode_id +#: model:ir.model.fields,help:account_payment_partner.field_res_users_supplier_payment_mode_id +msgid "Select the default payment mode for this supplier." +msgstr "" + +#. module: account_payment_partner +#: model:ir.model.fields,field_description:account_payment_partner.field_res_partner_supplier_payment_mode_id +#: model:ir.model.fields,field_description:account_payment_partner.field_res_users_supplier_payment_mode_id +msgid "Supplier Payment Mode" +msgstr "" diff --git a/account_payment_partner/i18n/nb_NO.po b/account_payment_partner/i18n/nb_NO.po new file mode 100644 index 000000000..a140ee50a --- /dev/null +++ b/account_payment_partner/i18n/nb_NO.po @@ -0,0 +1,88 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_payment_partner +# +# Translators: +# Imre Kristoffer Eilertsen , 2016 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-07-30 07:37+0000\n" +"PO-Revision-Date: 2016-07-30 07:37+0000\n" +"Last-Translator: Imre Kristoffer Eilertsen , 2016\n" +"Language-Team: Norwegian Bokmål (Norway) (https://www.transifex.com/oca/teams/23907/nb_NO/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: nb_NO\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: account_payment_partner +#: model:ir.ui.view,arch_db:account_payment_partner.report_invoice_payment_mode +msgid "Bank Account:" +msgstr "" + +#. module: account_payment_partner +#: model:ir.ui.view,arch_db:account_payment_partner.report_invoice_payment_mode +msgid "Payment Mode:" +msgstr "" + +#. module: account_payment_partner +#: model:ir.model.fields,help:account_payment_partner.field_account_invoice_bank_account_required +msgid "" +"Activate this option if this payment method requires you to know the bank " +"account number of your customer or supplier." +msgstr "" + +#. module: account_payment_partner +#: model:ir.model.fields,field_description:account_payment_partner.field_account_invoice_bank_account_required +msgid "Bank Account Required" +msgstr "Bankkonto påkrevd" + +#. module: account_payment_partner +#: model:ir.model.fields,field_description:account_payment_partner.field_res_partner_customer_payment_mode_id +msgid "Customer Payment Mode" +msgstr "" + +#. module: account_payment_partner +#: model:ir.model,name:account_payment_partner.model_account_invoice +msgid "Invoice" +msgstr "" + +#. module: account_payment_partner +#: model:ir.model,name:account_payment_partner.model_account_move_line +msgid "Journal Item" +msgstr "Journalgjenstand" + +#. module: account_payment_partner +#: model:ir.model,name:account_payment_partner.model_res_partner +msgid "Partner" +msgstr "" + +#. module: account_payment_partner +#: model:ir.model.fields,field_description:account_payment_partner.field_account_invoice_payment_mode_id +#: model:ir.model.fields,field_description:account_payment_partner.field_account_move_line_payment_mode_id +#: model:ir.ui.view,arch_db:account_payment_partner.view_account_invoice_filter +msgid "Payment Mode" +msgstr "" + +#. module: account_payment_partner +#: model:ir.ui.view,arch_db:account_payment_partner.view_move_line_form +msgid "Payments" +msgstr "Betalinger" + +#. module: account_payment_partner +#: model:ir.model.fields,help:account_payment_partner.field_res_partner_customer_payment_mode_id +msgid "Select the default payment mode for this customer." +msgstr "" + +#. module: account_payment_partner +#: model:ir.model.fields,help:account_payment_partner.field_res_partner_supplier_payment_mode_id +msgid "Select the default payment mode for this supplier." +msgstr "" + +#. module: account_payment_partner +#: model:ir.model.fields,field_description:account_payment_partner.field_res_partner_supplier_payment_mode_id +msgid "Supplier Payment Mode" +msgstr "" diff --git a/account_payment_partner/i18n/nl.po b/account_payment_partner/i18n/nl.po new file mode 100644 index 000000000..47ccf4f2b --- /dev/null +++ b/account_payment_partner/i18n/nl.po @@ -0,0 +1,93 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_payment_partner +# +# Translators: +# Erwin van der Ploeg , 2016 +# OCA Transbot , 2016 +msgid "" +msgstr "" +"Project-Id-Version: bank-payment (10.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-05-01 14:55+0000\n" +"PO-Revision-Date: 2016-10-19 23:47+0000\n" +"Last-Translator: OCA Transbot \n" +"Language-Team: Dutch (http://www.transifex.com/oca/OCA-bank-payment-10-0/language/nl/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: nl\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: account_payment_partner +#: model:ir.ui.view,arch_db:account_payment_partner.report_invoice_payment_mode +msgid "Bank Account:" +msgstr "Bankrekening:" + +#. module: account_payment_partner +#: model:ir.ui.view,arch_db:account_payment_partner.report_invoice_payment_mode +msgid "Payment Mode:" +msgstr "Betaalmode:" + +#. module: account_payment_partner +#: model:ir.model.fields,help:account_payment_partner.field_account_invoice_bank_account_required +msgid "" +"Activate this option if this payment method requires you to know the bank " +"account number of your customer or supplier." +msgstr "Activeer deze optie als de betaalwijze verwacht dat u het bankrekeningnummer van uw klant of leverancier kent." + +#. module: account_payment_partner +#: model:ir.model.fields,field_description:account_payment_partner.field_account_invoice_bank_account_required +msgid "Bank Account Required" +msgstr "Bankrekening verplicht" + +#. module: account_payment_partner +#: model:ir.model.fields,field_description:account_payment_partner.field_res_partner_customer_payment_mode_id +#: model:ir.model.fields,field_description:account_payment_partner.field_res_users_customer_payment_mode_id +msgid "Customer Payment Mode" +msgstr "Betaalwijze klant" + +#. module: account_payment_partner +#: model:ir.model,name:account_payment_partner.model_account_invoice +msgid "Invoice" +msgstr "Factuur" + +#. module: account_payment_partner +#: model:ir.model,name:account_payment_partner.model_account_move_line +msgid "Journal Item" +msgstr "Boekingsregel" + +#. module: account_payment_partner +#: model:ir.model,name:account_payment_partner.model_res_partner +msgid "Partner" +msgstr "Relatie" + +#. module: account_payment_partner +#: model:ir.model.fields,field_description:account_payment_partner.field_account_invoice_payment_mode_id +#: model:ir.model.fields,field_description:account_payment_partner.field_account_move_line_payment_mode_id +#: model:ir.ui.view,arch_db:account_payment_partner.view_account_invoice_filter +msgid "Payment Mode" +msgstr "Betaalwijze" + +#. module: account_payment_partner +#: model:ir.ui.view,arch_db:account_payment_partner.view_move_line_form +msgid "Payments" +msgstr "Betalingen" + +#. module: account_payment_partner +#: model:ir.model.fields,help:account_payment_partner.field_res_partner_customer_payment_mode_id +#: model:ir.model.fields,help:account_payment_partner.field_res_users_customer_payment_mode_id +msgid "Select the default payment mode for this customer." +msgstr "Selecteer de standaard betaalwijze voor deze klant." + +#. module: account_payment_partner +#: model:ir.model.fields,help:account_payment_partner.field_res_partner_supplier_payment_mode_id +#: model:ir.model.fields,help:account_payment_partner.field_res_users_supplier_payment_mode_id +msgid "Select the default payment mode for this supplier." +msgstr "Selecteer de standaard betaalwijze voor deze leverancier." + +#. module: account_payment_partner +#: model:ir.model.fields,field_description:account_payment_partner.field_res_partner_supplier_payment_mode_id +#: model:ir.model.fields,field_description:account_payment_partner.field_res_users_supplier_payment_mode_id +msgid "Supplier Payment Mode" +msgstr "Betaalwijze leverancier" diff --git a/account_payment_partner/i18n/pt_BR.po b/account_payment_partner/i18n/pt_BR.po new file mode 100644 index 000000000..065892bb0 --- /dev/null +++ b/account_payment_partner/i18n/pt_BR.po @@ -0,0 +1,92 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_payment_partner +# +# Translators: +# OCA Transbot , 2016 +msgid "" +msgstr "" +"Project-Id-Version: bank-payment (10.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-05-01 14:55+0000\n" +"PO-Revision-Date: 2016-10-19 23:47+0000\n" +"Last-Translator: OCA Transbot \n" +"Language-Team: Portuguese (Brazil) (http://www.transifex.com/oca/OCA-bank-payment-10-0/language/pt_BR/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: pt_BR\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +#. module: account_payment_partner +#: model:ir.ui.view,arch_db:account_payment_partner.report_invoice_payment_mode +msgid "Bank Account:" +msgstr "" + +#. module: account_payment_partner +#: model:ir.ui.view,arch_db:account_payment_partner.report_invoice_payment_mode +msgid "Payment Mode:" +msgstr "" + +#. module: account_payment_partner +#: model:ir.model.fields,help:account_payment_partner.field_account_invoice_bank_account_required +msgid "" +"Activate this option if this payment method requires you to know the bank " +"account number of your customer or supplier." +msgstr "" + +#. module: account_payment_partner +#: model:ir.model.fields,field_description:account_payment_partner.field_account_invoice_bank_account_required +msgid "Bank Account Required" +msgstr "" + +#. module: account_payment_partner +#: model:ir.model.fields,field_description:account_payment_partner.field_res_partner_customer_payment_mode_id +#: model:ir.model.fields,field_description:account_payment_partner.field_res_users_customer_payment_mode_id +msgid "Customer Payment Mode" +msgstr "Modo de Pagamento do Cliente" + +#. module: account_payment_partner +#: model:ir.model,name:account_payment_partner.model_account_invoice +msgid "Invoice" +msgstr "Fatura" + +#. module: account_payment_partner +#: model:ir.model,name:account_payment_partner.model_account_move_line +msgid "Journal Item" +msgstr "" + +#. module: account_payment_partner +#: model:ir.model,name:account_payment_partner.model_res_partner +msgid "Partner" +msgstr "Parceiro" + +#. module: account_payment_partner +#: model:ir.model.fields,field_description:account_payment_partner.field_account_invoice_payment_mode_id +#: model:ir.model.fields,field_description:account_payment_partner.field_account_move_line_payment_mode_id +#: model:ir.ui.view,arch_db:account_payment_partner.view_account_invoice_filter +msgid "Payment Mode" +msgstr "Modo de Pagamento" + +#. module: account_payment_partner +#: model:ir.ui.view,arch_db:account_payment_partner.view_move_line_form +msgid "Payments" +msgstr "" + +#. module: account_payment_partner +#: model:ir.model.fields,help:account_payment_partner.field_res_partner_customer_payment_mode_id +#: model:ir.model.fields,help:account_payment_partner.field_res_users_customer_payment_mode_id +msgid "Select the default payment mode for this customer." +msgstr "Selecione o modo de pagamento padrão para este cliente." + +#. module: account_payment_partner +#: model:ir.model.fields,help:account_payment_partner.field_res_partner_supplier_payment_mode_id +#: model:ir.model.fields,help:account_payment_partner.field_res_users_supplier_payment_mode_id +msgid "Select the default payment mode for this supplier." +msgstr "Selecione o modo de pagamento padrão para este fornecedor." + +#. module: account_payment_partner +#: model:ir.model.fields,field_description:account_payment_partner.field_res_partner_supplier_payment_mode_id +#: model:ir.model.fields,field_description:account_payment_partner.field_res_users_supplier_payment_mode_id +msgid "Supplier Payment Mode" +msgstr "Modo de Pagamento do Fornecedor" diff --git a/account_payment_partner/i18n/sl.po b/account_payment_partner/i18n/sl.po new file mode 100644 index 000000000..8ec6dcc80 --- /dev/null +++ b/account_payment_partner/i18n/sl.po @@ -0,0 +1,92 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_payment_partner +# +# Translators: +# OCA Transbot , 2016 +msgid "" +msgstr "" +"Project-Id-Version: bank-payment (10.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-05-01 14:55+0000\n" +"PO-Revision-Date: 2016-10-19 23:47+0000\n" +"Last-Translator: OCA Transbot \n" +"Language-Team: Slovenian (http://www.transifex.com/oca/OCA-bank-payment-10-0/language/sl/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: sl\n" +"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);\n" + +#. module: account_payment_partner +#: model:ir.ui.view,arch_db:account_payment_partner.report_invoice_payment_mode +msgid "Bank Account:" +msgstr "" + +#. module: account_payment_partner +#: model:ir.ui.view,arch_db:account_payment_partner.report_invoice_payment_mode +msgid "Payment Mode:" +msgstr "" + +#. module: account_payment_partner +#: model:ir.model.fields,help:account_payment_partner.field_account_invoice_bank_account_required +msgid "" +"Activate this option if this payment method requires you to know the bank " +"account number of your customer or supplier." +msgstr "" + +#. module: account_payment_partner +#: model:ir.model.fields,field_description:account_payment_partner.field_account_invoice_bank_account_required +msgid "Bank Account Required" +msgstr "" + +#. module: account_payment_partner +#: model:ir.model.fields,field_description:account_payment_partner.field_res_partner_customer_payment_mode_id +#: model:ir.model.fields,field_description:account_payment_partner.field_res_users_customer_payment_mode_id +msgid "Customer Payment Mode" +msgstr "Metoda plačila kupca" + +#. module: account_payment_partner +#: model:ir.model,name:account_payment_partner.model_account_invoice +msgid "Invoice" +msgstr "Račun" + +#. module: account_payment_partner +#: model:ir.model,name:account_payment_partner.model_account_move_line +msgid "Journal Item" +msgstr "" + +#. module: account_payment_partner +#: model:ir.model,name:account_payment_partner.model_res_partner +msgid "Partner" +msgstr "Partner" + +#. module: account_payment_partner +#: model:ir.model.fields,field_description:account_payment_partner.field_account_invoice_payment_mode_id +#: model:ir.model.fields,field_description:account_payment_partner.field_account_move_line_payment_mode_id +#: model:ir.ui.view,arch_db:account_payment_partner.view_account_invoice_filter +msgid "Payment Mode" +msgstr "Metoda plačila" + +#. module: account_payment_partner +#: model:ir.ui.view,arch_db:account_payment_partner.view_move_line_form +msgid "Payments" +msgstr "" + +#. module: account_payment_partner +#: model:ir.model.fields,help:account_payment_partner.field_res_partner_customer_payment_mode_id +#: model:ir.model.fields,help:account_payment_partner.field_res_users_customer_payment_mode_id +msgid "Select the default payment mode for this customer." +msgstr "Izbira privzete metode plačila za tega kupca." + +#. module: account_payment_partner +#: model:ir.model.fields,help:account_payment_partner.field_res_partner_supplier_payment_mode_id +#: model:ir.model.fields,help:account_payment_partner.field_res_users_supplier_payment_mode_id +msgid "Select the default payment mode for this supplier." +msgstr "Izbira privzete metode plačila za tega dobavitelja." + +#. module: account_payment_partner +#: model:ir.model.fields,field_description:account_payment_partner.field_res_partner_supplier_payment_mode_id +#: model:ir.model.fields,field_description:account_payment_partner.field_res_users_supplier_payment_mode_id +msgid "Supplier Payment Mode" +msgstr "Metoda plačila dobavitelja" diff --git a/account_payment_partner/models/__init__.py b/account_payment_partner/models/__init__.py new file mode 100644 index 000000000..6237433ee --- /dev/null +++ b/account_payment_partner/models/__init__.py @@ -0,0 +1,5 @@ + +from . import res_partner +from . import account_invoice +from . import account_move_line +from . import account_payment_mode diff --git a/account_payment_partner/models/account_invoice.py b/account_payment_partner/models/account_invoice.py new file mode 100644 index 000000000..d78eb5079 --- /dev/null +++ b/account_payment_partner/models/account_invoice.py @@ -0,0 +1,119 @@ +# -*- coding: utf-8 -*- +# © 2014-2016 Akretion - Alexis de Lattre +# © 2014 Serv. Tecnol. Avanzados - Pedro M. Baeza +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from odoo import api, fields, models, _ +from odoo.exceptions import ValidationError + + +class AccountInvoice(models.Model): + _inherit = 'account.invoice' + + payment_mode_id = fields.Many2one( + comodel_name='account.payment.mode', string="Payment Mode", + ondelete='restrict', + readonly=True, states={'draft': [('readonly', False)]}) + bank_account_required = fields.Boolean( + related='payment_mode_id.payment_method_id.bank_account_required', + readonly=True) + + @api.onchange('partner_id', 'company_id') + def _onchange_partner_id(self): + res = super(AccountInvoice, self)._onchange_partner_id() + if self.partner_id: + if self.type == 'in_invoice': + pay_mode = self.with_context( + force_company=self.company_id.id + ).partner_id.supplier_payment_mode_id + self.payment_mode_id = pay_mode + if ( + pay_mode and + pay_mode.payment_type == 'outbound' and + pay_mode.payment_method_id.bank_account_required and + self.commercial_partner_id.bank_ids + ): + self.partner_bank_id = \ + self.commercial_partner_id.bank_ids.filtered( + lambda b: b.company_id == self.company_id or not + b.company_id) + else: + self.partner_bank_id = False + + elif self.type == 'out_invoice': + pay_mode = self.with_context( + force_company=self.company_id.id + ).partner_id.customer_payment_mode_id + self.payment_mode_id = pay_mode + if pay_mode and pay_mode.bank_account_link == 'fixed': + self.partner_bank_id = pay_mode.fixed_journal_id. \ + bank_account_id + else: + self.payment_mode_id = False + if self.type == 'in_invoice': + self.partner_bank_id = False + return res + + @api.onchange('payment_mode_id') + def _onchange_payment_mode_id(self): + pay_mode = self.payment_mode_id + if ( + pay_mode and + pay_mode.payment_type == 'outbound' and not + pay_mode.payment_method_id.bank_account_required + ): + self.partner_bank_id = False + elif not self.payment_mode_id: + self.partner_bank_id = False + + @api.model + def create(self, vals): + """Fill the payment_mode_id from the partner if none is provided on + creation, using same method as upstream.""" + onchanges = { + '_onchange_partner_id': ['payment_mode_id'], + } + for onchange_method, changed_fields in onchanges.items(): + if any(f not in vals for f in changed_fields): + invoice = self.new(vals) + getattr(invoice, onchange_method)() + for field in changed_fields: + if field not in vals and invoice[field]: + vals[field] = invoice._fields[field].convert_to_write( + invoice[field], invoice, + ) + return super(AccountInvoice, self).create(vals) + + @api.model + def line_get_convert(self, line, part): + """Copy payment mode from invoice to account move line""" + res = super(AccountInvoice, self).line_get_convert(line, part) + if line.get('type') == 'dest' and line.get('invoice_id'): + invoice = self.browse(line['invoice_id']) + res['payment_mode_id'] = invoice.payment_mode_id.id or False + return res + + # I think copying payment mode from invoice to refund by default + # is a good idea because the most common way of "paying" a refund is to + # deduct it on the payment of the next invoice (and OCA/bank-payment + # allows to have negative payment lines since March 2016) + @api.model + def _prepare_refund( + self, invoice, date_invoice=None, date=None, description=None, + journal_id=None): + vals = super(AccountInvoice, self)._prepare_refund( + invoice, date_invoice=date_invoice, date=date, + description=description, journal_id=journal_id) + vals['payment_mode_id'] = invoice.payment_mode_id.id + if invoice.type == 'in_invoice': + vals['partner_bank_id'] = invoice.partner_bank_id.id + return vals + + @api.constrains('company_id', 'payment_mode_id') + def _check_payment_mode_company_constrains(self): + for rec in self.sudo(): + if (rec.payment_mode_id and rec.company_id != + rec.payment_mode_id.company_id): + raise ValidationError( + _("The company of the invoice %s does not match " + "with that of the payment mode") % rec.name) diff --git a/account_payment_partner/models/account_move_line.py b/account_payment_partner/models/account_move_line.py new file mode 100644 index 000000000..9bdcec4e6 --- /dev/null +++ b/account_payment_partner/models/account_move_line.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# © 2016 Akretion (https://www.akretion.com/) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from odoo import models, fields + + +class AccountMoveLine(models.Model): + _inherit = 'account.move.line' + + payment_mode_id = fields.Many2one( + 'account.payment.mode', + string='Payment Mode', + domain="[('company_id', '=', company_id)]", + ondelete='restrict' + ) diff --git a/account_payment_partner/models/account_payment_mode.py b/account_payment_partner/models/account_payment_mode.py new file mode 100644 index 000000000..2b0f618ab --- /dev/null +++ b/account_payment_partner/models/account_payment_mode.py @@ -0,0 +1,31 @@ +# Copyright 2017 Eficent Business and IT Consulting Services S.L. +# License AGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). + +from odoo import models, api, _ +from odoo.exceptions import ValidationError + + +class AccountPaymentMode(models.Model): + _inherit = "account.payment.mode" + + @api.constrains('company_id') + def account_invoice_company_constrains(self): + for mode in self: + if self.env['account.invoice'].sudo().search( + [('payment_mode_id', '=', mode.id), + ('company_id', '!=', mode.company_id.id)], limit=1): + raise ValidationError(_( + "You cannot change the Company. There exists " + "at least one Invoice with this Payment Mode, " + "already assigned to another Company.")) + + @api.constrains('company_id') + def account_move_line_company_constrains(self): + for mode in self: + if self.env['account.move.line'].sudo().search( + [('payment_mode_id', '=', mode.id), + ('company_id', '!=', mode.company_id.id)], limit=1): + raise ValidationError(_( + "You cannot change the Company. There exists " + "at least one Journal Item with this Payment Mode, " + "already assigned to another Company.")) diff --git a/account_payment_partner/models/res_partner.py b/account_payment_partner/models/res_partner.py new file mode 100644 index 000000000..246c8739c --- /dev/null +++ b/account_payment_partner/models/res_partner.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- +# © 2014 Akretion - Alexis de Lattre +# © 2014 Serv. Tecnol. Avanzados - Pedro M. Baeza +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from odoo import models, fields, api + + +class ResPartner(models.Model): + _inherit = 'res.partner' + + # v8 fields : same without the _id suffix + supplier_payment_mode_id = fields.Many2one( + 'account.payment.mode', string='Supplier Payment Mode', + company_dependent=True, + domain="[('payment_type', '=', 'outbound'), " + "('company_id', '=', company_id)]", + help="Select the default payment mode for this supplier.") + customer_payment_mode_id = fields.Many2one( + 'account.payment.mode', string='Customer Payment Mode', + company_dependent=True, + domain="[('payment_type', '=', 'inbound'), " + "('company_id', '=', company_id)]", + help="Select the default payment mode for this customer.") + + @api.model + def _commercial_fields(self): + res = super(ResPartner, self)._commercial_fields() + res += ['supplier_payment_mode_id', 'customer_payment_mode_id'] + return res diff --git a/account_payment_partner/static/description/icon.png b/account_payment_partner/static/description/icon.png new file mode 100644 index 000000000..3a0328b51 Binary files /dev/null and b/account_payment_partner/static/description/icon.png differ diff --git a/account_payment_partner/tests/__init__.py b/account_payment_partner/tests/__init__.py new file mode 100644 index 000000000..0d757b027 --- /dev/null +++ b/account_payment_partner/tests/__init__.py @@ -0,0 +1,2 @@ + +from . import test_account_payment_partner diff --git a/account_payment_partner/tests/test_account_payment_partner.py b/account_payment_partner/tests/test_account_payment_partner.py new file mode 100644 index 000000000..b02016463 --- /dev/null +++ b/account_payment_partner/tests/test_account_payment_partner.py @@ -0,0 +1,315 @@ +# Copyright 2017 Eficent Business and IT Consulting Services S.L. +# License AGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). + +from odoo import fields, _ +from odoo.tests import common +from odoo.exceptions import ValidationError + + +class TestAccountPaymentPartner(common.SavepointCase): + + @classmethod + def setUpClass(cls): + super(TestAccountPaymentPartner, cls).setUpClass() + + cls.res_users_model = cls.env['res.users'] + cls.journal_model = cls.env['account.journal'] + cls.payment_mode_model = cls.env['account.payment.mode'] + cls.partner_bank_model = cls.env['res.partner.bank'] + + # Refs + cls.company = cls.env.ref('base.main_company') + cls.acct_type_payable = cls.env.ref( + 'account.data_account_type_payable') + cls.acct_type_expenses = cls.env.ref( + 'account.data_account_type_expenses') + + cls.company_2 = cls.env['res.company'].create( + {'name': 'Company 2'}, + ) + charts = cls.env['account.chart.template'].search([]) + if charts: + cls.chart = charts[0] + else: + raise ValidationError( + _("No Chart of Account Template has been defined !")) + cls.wizard = cls.env['wizard.multi.charts.accounts'].create({ + 'company_id': cls.company_2.id, + 'chart_template_id': cls.chart.id, + 'sale_tax_id': False, + 'purchase_tax_id': False, + 'code_digits': 6, + 'currency_id': cls.env.ref('base.EUR').id, + 'transfer_account_id': cls.chart.transfer_account_id.id, + }) + cls.wizard.execute() + + # refs + cls.manual_out = cls.env.ref( + 'account.account_payment_method_manual_out') + cls.manual_in = cls.env.ref( + 'account.account_payment_method_manual_in') + + cls.journal_sale = cls.env['account.journal'].create({ + 'name': 'Test Sales Journal', + 'code': 'tSAL', + 'type': 'sale', + 'company_id': cls.company.id, + }) + + cls.journal_c1 = cls.journal_model.create({ + 'name': 'J1', + 'code': 'J1', + 'type': 'bank', + 'company_id': cls.company.id, + 'bank_acc_number': '123456', + }) + + cls.journal_c2 = cls.journal_model.create({ + 'name': 'J2', + 'code': 'J2', + 'type': 'bank', + 'company_id': cls.company_2.id, + 'bank_acc_number': '552344', + }) + + cls.supplier_payment_mode = cls.payment_mode_model.create({ + 'name': 'Suppliers Bank 1', + 'bank_account_link': 'variable', + 'payment_method_id': cls.manual_out.id, + 'company_id': cls.company.id, + 'fixed_journal_id': cls.journal_c1.id, + 'variable_journal_ids': [(6, 0, [cls.journal_c1.id])] + }) + + cls.supplier_payment_mode_c2 = cls.payment_mode_model.create({ + 'name': 'Suppliers Bank 2', + 'bank_account_link': 'variable', + 'payment_method_id': cls.manual_out.id, + 'company_id': cls.company_2.id, + 'fixed_journal_id': cls.journal_c2.id, + 'variable_journal_ids': [(6, 0, [cls.journal_c2.id])] + }) + + cls.customer_payment_mode = cls.payment_mode_model.create({ + 'name': 'Customers to Bank 1', + 'bank_account_link': 'fixed', + 'payment_method_id': cls.manual_in.id, + 'company_id': cls.company.id, + 'fixed_journal_id': cls.journal_c1.id, + 'variable_journal_ids': [(6, 0, [cls.journal_c1.id])] + }) + + cls.customer = cls.env['res.partner'].with_context( + force_company=cls.company.id).create({ + 'name': 'Test customer', + 'customer_payment_mode_id': cls.customer_payment_mode, + }) + + cls.supplier = cls.env['res.partner'].with_context( + force_company=cls.company.id).create({ + 'name': 'Test supplier', + 'supplier_payment_mode_id': cls.supplier_payment_mode, + 'bank_ids': [ + (0, 0, { + 'acc_number': '5345345', + 'company_id': cls.company.id, + }), + (0, 0, { + 'acc_number': '3452342', + 'company_id': cls.company_2.id, + })] + }) + cls.supplier.with_context( + force_company=cls.company_2.id).supplier_payment_mode_id = \ + cls.supplier_payment_mode_c2 + + cls.invoice_account = cls.env['account.account'].search( + [('user_type_id', '=', cls.acct_type_payable.id), + ('company_id', '=', cls.company.id)], + limit=1) + cls.invoice_line_account = cls.env['account.account'].search( + [('user_type_id', '=', cls.acct_type_expenses.id), + ('company_id', '=', cls.company.id)], + limit=1) + + def _create_invoice(self): + + invoice = self.env['account.invoice'].create({ + 'partner_id': self.supplier.id, + 'journal_id': self.journal_sale.id, + 'account_id': self.invoice_account.id, + 'type': 'in_invoice', + 'company_id': self.company.id, + 'payment_mode_id': self.env.ref( + 'account_payment_mode.payment_mode_outbound_ct1').id + }) + + self.env['account.invoice.line'].create({ + 'product_id': self.env.ref('product.product_product_4').id, + 'quantity': 1.0, + 'price_unit': 100.0, + 'invoice_id': invoice.id, + 'name': 'product that cost 100', + 'account_id': self.invoice_line_account.id, + }) + return invoice + + def test_create_partner(self): + customer = self.env['res.partner'].with_context( + force_company=self.company.id).create({ + 'name': 'Test customer', + 'customer_payment_mode_id': self.customer_payment_mode, + }) + + self.assertEquals(customer.with_context( + force_company=self.company.id).customer_payment_mode_id, + self.customer_payment_mode) + self.assertEquals(customer.with_context( + force_company=self.company_2.id).customer_payment_mode_id, + self.payment_mode_model) + + def test_out_invoice_onchange(self): + # Test the onchange methods in invoice + invoice = self.env['account.invoice'].new({ + 'partner_id': self.customer.id, + 'type': 'out_invoice', + 'company_id': self.company.id, + }) + + invoice._onchange_partner_id() + + self.assertEquals(invoice.payment_mode_id, self.customer_payment_mode) + self.assertEquals( + invoice.partner_bank_id, + self.customer_payment_mode.fixed_journal_id.bank_account_id) + + invoice.company_id = self.company_2 + invoice._onchange_partner_id() + self.assertEquals(invoice.payment_mode_id, self.payment_mode_model) + + invoice.payment_mode_id = False + invoice._onchange_payment_mode_id() + self.assertFalse(invoice.partner_bank_id) + + def test_in_invoice_onchange(self): + # Test the onchange methods in invoice + self.manual_out.bank_account_required = True + invoice = self.env['account.invoice'].new({ + 'partner_id': self.supplier.id, + 'type': 'in_invoice', + 'company_id': self.company.id, + }) + + invoice._onchange_partner_id() + + self.assertEquals(invoice.payment_mode_id, self.supplier_payment_mode) + bank = self.partner_bank_model.search( + [('acc_number', '=', '5345345')], limit=1) + self.assertEquals( + invoice.partner_bank_id, + bank) + + invoice.company_id = self.company_2 + invoice._onchange_partner_id() + self.assertEquals(invoice.payment_mode_id, + self.supplier_payment_mode_c2) + bank = self.partner_bank_model.search( + [('acc_number', '=', '3452342')], limit=1) + self.assertEquals(invoice.partner_bank_id, bank) + + invoice.payment_mode_id = self.supplier_payment_mode + invoice._onchange_payment_mode_id() + self.assertTrue(invoice.partner_bank_id) + + self.manual_out.bank_account_required = False + + invoice.payment_mode_id = self.supplier_payment_mode_c2 + invoice._onchange_payment_mode_id() + self.assertFalse(invoice.partner_bank_id) + + invoice.partner_id = False + invoice._onchange_partner_id() + self.assertEquals(invoice.payment_mode_id, + self.payment_mode_model) + self.assertEquals(invoice.partner_bank_id, + self.partner_bank_model) + + def test_invoice_create(self): + invoice = self._create_invoice() + invoice.action_invoice_open() + aml = invoice.move_id.line_ids.filtered( + lambda l: l.account_id.user_type_id == self.acct_type_payable) + self.assertEquals(invoice.payment_mode_id, + aml[0].payment_mode_id) + + def test_invoice_constrains(self): + with self.assertRaises(ValidationError): + self.env['account.invoice'].create({ + 'partner_id': self.supplier.id, + 'type': 'in_invoice', + 'company_id': self.company.id, + 'payment_mode_id': self.supplier_payment_mode_c2.id + }) + + def test_payment_mode_constrains_01(self): + self.env['account.invoice'].create({ + 'partner_id': self.supplier.id, + 'type': 'in_invoice', + 'company_id': self.company.id, + }) + with self.assertRaises(ValidationError): + self.supplier_payment_mode.company_id = self.company_2 + + def test_payment_mode_constrains_02(self): + self.env['account.move'].create({ + 'date': fields.Date.today(), + 'journal_id': self.journal_sale.id, + 'name': '/', + 'ref': 'reference', + 'state': 'draft', + 'line_ids': [(0, 0, { + 'account_id': self.invoice_account.id, + 'credit': 1000, + 'debit': 0, + 'name': 'Test', + 'ref': 'reference', + }), (0, 0, { + 'account_id': self.invoice_line_account.id, + 'credit': 0, + 'debit': 1000, + 'name': 'Test', + 'ref': 'reference', + })]}) + with self.assertRaises(ValidationError): + self.supplier_payment_mode.company_id = self.company_2 + + def test_invoice_refund(self): + invoice = self._create_invoice() + invoice.action_invoice_open() + # Lets create a refund invoice for invoice_1. + # I refund the invoice Using Refund Button. + context = {"active_model": 'account.invoice', + "active_ids": [invoice.id], "active_id": invoice.id} + account_invoice_refund = self.env[ + 'account.invoice.refund'].with_context(context).create(dict( + description='Refund for Invoice', + filter_refund='refund', + )) + # I clicked on refund button. + account_invoice_refund.with_context(context).invoice_refund() + invoice_refund = invoice.refund_invoice_ids[0] + + self.assertEquals(invoice_refund.payment_mode_id, + invoice.payment_mode_id) + self.assertEquals(invoice_refund.partner_bank_id, + invoice.partner_bank_id) + + def test_partner(self): + self.customer.write({ + 'customer_payment_mode_id': self.customer_payment_mode.id + }) + self.assertEqual( + self.customer.customer_payment_mode_id, + self.customer_payment_mode + ) diff --git a/account_payment_partner/views/account_invoice_view.xml b/account_payment_partner/views/account_invoice_view.xml new file mode 100644 index 000000000..859e4572c --- /dev/null +++ b/account_payment_partner/views/account_invoice_view.xml @@ -0,0 +1,84 @@ + + + + + + + account_payment_partner.account_invoice_search + account.invoice + + + + + + + + + + + account_payment_partner.invoice_form + account.invoice + + + + + + + + 0 + + + + + + + account_payment_partner.invoice_supplier_form + account.invoice + + + + + + + + + [('partner_id', '=', commercial_partner_id), + '|',('company_id', '=', company_id),('company_id', '=', False)] + 0 + {'invisible': [('bank_account_required', '=', False)], 'required': [('bank_account_required', '=', True)]} + + + + + + account_payment_partner.customer_invoice_tree + account.invoice + + + + + + + + + + account_payment_partner.supplier_invoice_tree + account.invoice + + + + + + + + + + diff --git a/account_payment_partner/views/account_move_line.xml b/account_payment_partner/views/account_move_line.xml new file mode 100644 index 000000000..1abe8b5e1 --- /dev/null +++ b/account_payment_partner/views/account_move_line.xml @@ -0,0 +1,26 @@ + + + + + + + + + account_payment_partner.move_line_form + account.move.line + + + + + + + + + + + + diff --git a/account_payment_partner/views/report_invoice.xml b/account_payment_partner/views/report_invoice.xml new file mode 100644 index 000000000..068dbf672 --- /dev/null +++ b/account_payment_partner/views/report_invoice.xml @@ -0,0 +1,17 @@ + + + + + + diff --git a/account_payment_partner/views/res_partner_view.xml b/account_payment_partner/views/res_partner_view.xml new file mode 100644 index 000000000..ad7ceeafe --- /dev/null +++ b/account_payment_partner/views/res_partner_view.xml @@ -0,0 +1,26 @@ + + + + + + + + account_partner_payment.partner_form + res.partner + + + + + + + + + + + + +