diff --git a/account_payment_sale/README.rst b/account_payment_sale/README.rst index 456a589ee..383837d56 100644 --- a/account_payment_sale/README.rst +++ b/account_payment_sale/README.rst @@ -1,13 +1,12 @@ .. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg :alt: License: AGPL-3 +==================== Account Payment Sale ==================== -This module should be used when the invoice is based on the sale order. - This modules adds one field on sale orders: *Payment Mode*. -This field is copied from partner to sale order and then from sale order to +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 @@ -19,7 +18,8 @@ Installation ============ This module depends on : -* purchase + +* sale * account_payment_partner This module is part of the OCA/bank-payment suite. @@ -35,25 +35,23 @@ 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 could be change in a draft sale order or draft invoice. -When you create an direct debit order, only invoices related to chosen payment mode are displayed. -Invoices without any payment mode are displayed to. -For further information, please visit: - - * https://www.odoo.com/forum/help-1 +.. 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/9.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 -`here `_. +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 ======= @@ -62,7 +60,7 @@ Contributors ------------ * Pedro M. Baeza -* Alexis de Lattre +* Alexis de Lattre * Alexandre Fayolle * Danimar Ribeiro * Raphaël Valyi diff --git a/account_payment_sale/__init__.py b/account_payment_sale/__init__.py index 11323c6e9..35e7c9600 100644 --- a/account_payment_sale/__init__.py +++ b/account_payment_sale/__init__.py @@ -1,23 +1,4 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# -# Account Payment Sale module for OpenERP -# Copyright (C) 2014 Akretion (http://www.akretion.com) -# @author Alexis de Lattre -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## +# -*- coding: utf-8 -*- from . import models +from . import wizard diff --git a/account_payment_sale/__openerp__.py b/account_payment_sale/__openerp__.py index 99f2f3e90..09a9f10d9 100644 --- a/account_payment_sale/__openerp__.py +++ b/account_payment_sale/__openerp__.py @@ -1,28 +1,11 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# -# Account Payment Sale module for OpenERP -# Copyright (C) 2014 Akretion (http://www.akretion.com). -# @author Alexis de Lattre -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## +# -*- coding: utf-8 -*- +# © 2014-2016 Akretion (http://www.akretion.com) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +# @author Alexis de Lattre { 'name': 'Account Payment Sale', - 'version': '8.0.1.0.0', + 'version': '9.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 deleted file mode 100644 index c2d05ec68..000000000 --- a/account_payment_sale/i18n/account_payment_sale.pot +++ /dev/null @@ -1,27 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# * account_payment_sale -# -msgid "" -msgstr "" -"Project-Id-Version: Odoo Server 8.0\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-10-31 23:00+0000\n" -"PO-Revision-Date: 2014-10-31 23:00+0000\n" -"Last-Translator: <>\n" -"Language-Team: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: \n" -"Plural-Forms: \n" - -#. module: account_payment_sale -#: field:sale.order,payment_mode_id:0 -msgid "Payment Mode" -msgstr "" - -#. module: account_payment_sale -#: model:ir.model,name:account_payment_sale.model_sale_order -msgid "Sales Order" -msgstr "" - diff --git a/account_payment_sale/i18n/de.po b/account_payment_sale/i18n/de.po new file mode 100644 index 000000000..3dd3a06e1 --- /dev/null +++ b/account_payment_sale/i18n/de.po @@ -0,0 +1,38 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_payment_sale +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: bank-payment (10.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-12-08 01:38+0000\n" +"PO-Revision-Date: 2017-12-07 19:29+0000\n" +"Last-Translator: OCA Transbot \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_sale +#: model:ir.ui.view,arch_db:account_payment_sale.report_sale_payment_mode +msgid "Payment Mode:" +msgstr "Zahlungsmethode:" + +#. module: account_payment_sale +#: model:ir.model.fields,field_description:account_payment_sale.field_sale_order_payment_mode_id +msgid "Payment Mode" +msgstr "Zahlungsmodus" + +#. module: account_payment_sale +#: model:ir.model,name:account_payment_sale.model_sale_advance_payment_inv +msgid "Sales Advance Payment Invoice" +msgstr "Verkaufsanzahlungsrechnung" + +#. module: account_payment_sale +#: model:ir.model,name:account_payment_sale.model_sale_order +msgid "Sales Order" +msgstr "Kundenauftrag" diff --git a/account_payment_sale/i18n/es.po b/account_payment_sale/i18n/es.po index 436919b1e..9204f514a 100644 --- a/account_payment_sale/i18n/es.po +++ b/account_payment_sale/i18n/es.po @@ -1,27 +1,34 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * account_payment_sale -# +# * account_payment_sale +# +# Translators: +# OCA Transbot , 2016 msgid "" msgstr "" -"Project-Id-Version: Odoo Server 8.0\n" +"Project-Id-Version: Odoo Server 9.0c\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-10-31 23:00+0000\n" -"PO-Revision-Date: 2014-10-31 23:00+0000\n" -"Last-Translator: <>\n" -"Language-Team: \n" +"POT-Creation-Date: 2016-07-01 19:28+0000\n" +"PO-Revision-Date: 2016-07-01 19:28+0000\n" +"Last-Translator: OCA Transbot , 2016\n" +"Language-Team: Spanish (https://www.transifex.com/oca/teams/23907/es/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" -"Plural-Forms: \n" +"Language: es\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" #. module: account_payment_sale -#: field:sale.order,payment_mode_id:0 +#: model:ir.model.fields,field_description:account_payment_sale.field_sale_order_payment_mode_id msgid "Payment Mode" msgstr "Modo de pago" +#. module: account_payment_sale +#: model:ir.model,name:account_payment_sale.model_sale_advance_payment_inv +msgid "Sales Advance Payment Invoice" +msgstr "" + #. module: account_payment_sale #: model:ir.model,name:account_payment_sale.model_sale_order msgid "Sales Order" msgstr "Pedido de venta" - diff --git a/account_payment_sale/i18n/fr.po b/account_payment_sale/i18n/fr.po new file mode 100644 index 000000000..f5115596a --- /dev/null +++ b/account_payment_sale/i18n/fr.po @@ -0,0 +1,34 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_payment_sale +# +# Translators: +# OCA Transbot , 2016 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-07-01 19:28+0000\n" +"PO-Revision-Date: 2016-07-01 19:28+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_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 "" + +#. module: account_payment_sale +#: model:ir.model,name:account_payment_sale.model_sale_order +msgid "Sales Order" +msgstr "" diff --git a/account_payment_sale/i18n/nl.po b/account_payment_sale/i18n/nl.po index c5d7923f3..7dc82d0e3 100644 --- a/account_payment_sale/i18n/nl.po +++ b/account_payment_sale/i18n/nl.po @@ -1,27 +1,39 @@ -# Dutch translation for banking-addons -# Copyright (c) 2014 Rosetta Contributors and Canonical Ltd 2014 -# This file is distributed under the same license as the banking-addons package. -# FIRST AUTHOR , 2014. +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_payment_sale # +# Translators: +# Erwin van der Ploeg , 2016 +# OCA Transbot , 2016 msgid "" msgstr "" -"Project-Id-Version: banking-addons\n" -"Report-Msgid-Bugs-To: FULL NAME \n" -"POT-Creation-Date: 2014-06-09 23:24+0000\n" -"PO-Revision-Date: 2014-06-26 14:13+0000\n" -"Last-Translator: Erwin van der Ploeg (BAS Solutions) \n" -"Language-Team: Dutch \n" +"Project-Id-Version: bank-payment (10.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-12-08 01:38+0000\n" +"PO-Revision-Date: 2017-12-19 18:17+0200\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: 8bit\n" -"X-Launchpad-Export-Date: 2014-06-27 07:13+0000\n" -"X-Generator: Launchpad (build 17077)\n" +"Content-Transfer-Encoding: \n" +"Language: nl\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" #. module: account_payment_sale -#: field:sale.order,payment_mode_id:0 +#: model:ir.ui.view,arch_db:account_payment_sale.report_sale_payment_mode +msgid "Payment Mode:" +msgstr "Betaalmode:" + +#. module: account_payment_sale +#: model:ir.model.fields,field_description:account_payment_sale.field_sale_order_payment_mode_id msgid "Payment Mode" msgstr "Betaalwijze" +#. module: account_payment_sale +#: model:ir.model,name:account_payment_sale.model_sale_advance_payment_inv +msgid "Sales Advance Payment Invoice" +msgstr "Verkoop Incassofactuur" + #. module: account_payment_sale #: model:ir.model,name:account_payment_sale.model_sale_order msgid "Sales Order" diff --git a/account_payment_sale/i18n/pt_BR.po b/account_payment_sale/i18n/pt_BR.po index 9695a2b3c..81af53d0e 100644 --- a/account_payment_sale/i18n/pt_BR.po +++ b/account_payment_sale/i18n/pt_BR.po @@ -1,27 +1,34 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * account_payment_sale -# +# * account_payment_sale +# +# Translators: +# OCA Transbot , 2016 msgid "" msgstr "" -"Project-Id-Version: Odoo Server 8.0\n" +"Project-Id-Version: Odoo Server 9.0c\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-10-31 23:00+0000\n" -"PO-Revision-Date: 2014-10-31 23:00+0000\n" -"Last-Translator: Danimar Ribeiro \n" -"Language-Team: \n" +"POT-Creation-Date: 2016-07-01 19:28+0000\n" +"PO-Revision-Date: 2016-07-01 19:28+0000\n" +"Last-Translator: OCA Transbot , 2016\n" +"Language-Team: Portuguese (Brazil) (https://www.transifex.com/oca/teams/23907/pt_BR/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" -"Plural-Forms: \n" +"Language: pt_BR\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" #. module: account_payment_sale -#: field:sale.order,payment_mode_id:0 +#: model:ir.model.fields,field_description:account_payment_sale.field_sale_order_payment_mode_id msgid "Payment Mode" msgstr "Modo de Pagamento" +#. module: account_payment_sale +#: model:ir.model,name:account_payment_sale.model_sale_advance_payment_inv +msgid "Sales Advance Payment Invoice" +msgstr "" + #. module: account_payment_sale #: model:ir.model,name:account_payment_sale.model_sale_order msgid "Sales Order" msgstr "Pedido de Venda" - diff --git a/account_payment_sale/i18n/sl.po b/account_payment_sale/i18n/sl.po new file mode 100644 index 000000000..41885fb3f --- /dev/null +++ b/account_payment_sale/i18n/sl.po @@ -0,0 +1,34 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_payment_sale +# +# Translators: +# OCA Transbot , 2016 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-07-01 19:28+0000\n" +"PO-Revision-Date: 2016-07-01 19:28+0000\n" +"Last-Translator: OCA Transbot , 2016\n" +"Language-Team: Slovenian (https://www.transifex.com/oca/teams/23907/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_sale +#: model:ir.model.fields,field_description:account_payment_sale.field_sale_order_payment_mode_id +msgid "Payment Mode" +msgstr "Metoda plačila" + +#. module: account_payment_sale +#: model:ir.model,name:account_payment_sale.model_sale_advance_payment_inv +msgid "Sales Advance Payment Invoice" +msgstr "" + +#. module: account_payment_sale +#: model:ir.model,name:account_payment_sale.model_sale_order +msgid "Sales Order" +msgstr "Plačilni nalog" diff --git a/account_payment_sale/models/__init__.py b/account_payment_sale/models/__init__.py index 814479106..6064afee1 100644 --- a/account_payment_sale/models/__init__.py +++ b/account_payment_sale/models/__init__.py @@ -1,19 +1,3 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## +# -*- coding: utf-8 -*- from . import sale_order diff --git a/account_payment_sale/models/sale_order.py b/account_payment_sale/models/sale_order.py index d8ed2722f..5581ea850 100644 --- a/account_payment_sale/models/sale_order.py +++ b/account_payment_sale/models/sale_order.py @@ -1,24 +1,6 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# -# Account Payment Sale module for OpenERP -# Copyright (C) 2014 Akretion (http://www.akretion.com) -# @author Alexis de Lattre -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## +# -*- coding: utf-8 -*- +# © 2014-2016 Akretion (Alexis de Lattre ) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from openerp import models, fields, api @@ -27,24 +9,25 @@ class SaleOrder(models.Model): _inherit = "sale.order" payment_mode_id = fields.Many2one( - 'payment.mode', string='Payment Mode', - domain="[('sale_ok', '=', True)]") + 'account.payment.mode', string='Payment Mode', + domain=[('payment_type', '=', 'inbound')]) - @api.multi - def onchange_partner_id(self, partner_id): - res = super(SaleOrder, self).onchange_partner_id(partner_id) - if partner_id: - partner = self.env['res.partner'].browse(partner_id) - res['value']['payment_mode_id'] = partner.customer_payment_mode.id + @api.onchange('partner_id') + def onchange_partner_id(self): + res = super(SaleOrder, self).onchange_partner_id() + if self.partner_id: + self.payment_mode_id = self.partner_id.customer_payment_mode_id else: - res['value']['payment_mode_id'] = False + self.payment_mode_id = False return res - @api.model - def _prepare_invoice(self, order, lines): + @api.multi + def _prepare_invoice(self): """Copy bank partner from sale order to invoice""" - vals = super(SaleOrder, self)._prepare_invoice(order, lines) - if order.payment_mode_id: - vals['payment_mode_id'] = order.payment_mode_id.id - vals['partner_bank_id'] = order.payment_mode_id.bank_id.id + vals = super(SaleOrder, self)._prepare_invoice() + if self.payment_mode_id: + vals['payment_mode_id'] = self.payment_mode_id.id + if self.payment_mode_id.bank_account_link == 'fixed': + vals['partner_bank_id'] =\ + self.payment_mode_id.fixed_journal_id.bank_account_id.id return vals diff --git a/account_payment_sale/views/sale_order_view.xml b/account_payment_sale/views/sale_order_view.xml index c5f5c65d8..c002971d1 100644 --- a/account_payment_sale/views/sale_order_view.xml +++ b/account_payment_sale/views/sale_order_view.xml @@ -1,7 +1,7 @@ @@ -14,9 +14,9 @@ sale.order - + diff --git a/account_payment_sale/wizard/__init__.py b/account_payment_sale/wizard/__init__.py new file mode 100644 index 000000000..1eb17ffa1 --- /dev/null +++ b/account_payment_sale/wizard/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +from . import sale_make_invoice_advance diff --git a/account_payment_sale/wizard/sale_make_invoice_advance.py b/account_payment_sale/wizard/sale_make_invoice_advance.py new file mode 100644 index 000000000..a962e49c5 --- /dev/null +++ b/account_payment_sale/wizard/sale_make_invoice_advance.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +# © 2016 Akretion (Alexis de Lattre ) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from openerp import models, api + + +class SaleAdvancePaymentInv(models.TransientModel): + _inherit = 'sale.advance.payment.inv' + + @api.multi + def _create_invoice(self, order, so_line, amount): + """Copy payment mode from sale order to invoice""" + inv = super(SaleAdvancePaymentInv, self)._create_invoice( + order, so_line, amount) + vals = {} + if order.payment_mode_id: + vals['payment_mode_id'] = order.payment_mode_id.id + if order.payment_mode_id.bank_account_link == 'fixed': + vals['partner_bank_id'] =\ + order.payment_mode_id.fixed_journal_id.bank_account_id.id + if vals: + inv.write(vals) + return inv