From 72fce1441b4f8af5d0bfe5172a9094b636b316db Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Tue, 25 Feb 2014 00:19:57 +0100 Subject: [PATCH 01/66] Add 4 new modules to handle payment type and bank accounts: - account_payment_partner - account_payment_sale - account_payment_sale_stock - account_payment_purchase Filter the selection of invoices per payment type. Add active field on payment.mode and payment.mode.type. Add menu entry for Payment Types. --- account_payment_partner/__init__.py | 23 +++++++ account_payment_partner/__openerp__.py | 55 +++++++++++++++ .../i18n/account_payment_partner.pot | 67 +++++++++++++++++++ account_payment_partner/model/__init__.py | 25 +++++++ .../model/account_invoice.py | 53 +++++++++++++++ account_payment_partner/model/partner.py | 53 +++++++++++++++ .../model/payment_order_create.py | 38 +++++++++++ .../view/account_invoice.xml | 38 +++++++++++ account_payment_partner/view/partner.xml | 34 ++++++++++ 9 files changed, 386 insertions(+) create mode 100644 account_payment_partner/__init__.py create mode 100644 account_payment_partner/__openerp__.py create mode 100644 account_payment_partner/i18n/account_payment_partner.pot create mode 100644 account_payment_partner/model/__init__.py create mode 100644 account_payment_partner/model/account_invoice.py create mode 100644 account_payment_partner/model/partner.py create mode 100644 account_payment_partner/model/payment_order_create.py create mode 100644 account_payment_partner/view/account_invoice.xml create mode 100644 account_payment_partner/view/partner.xml diff --git a/account_payment_partner/__init__.py b/account_payment_partner/__init__.py new file mode 100644 index 000000000..da25c5761 --- /dev/null +++ b/account_payment_partner/__init__.py @@ -0,0 +1,23 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Account Partner Payment 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 . +# +############################################################################## + +from . import model diff --git a/account_payment_partner/__openerp__.py b/account_payment_partner/__openerp__.py new file mode 100644 index 000000000..e67a7fc2b --- /dev/null +++ b/account_payment_partner/__openerp__.py @@ -0,0 +1,55 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Account Partner Payment 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 . +# +############################################################################## + + +{ + 'name': 'Account Partner Payment', + 'version': '0.1', + 'category': 'Banking addons', + 'license': 'AGPL-3', + 'summary': 'Adds payment type and receivable bank account on partners', + 'description': """ +Account Partner Payment +======================= + +This module adds severals fields : + +* the *Supplier Payment Type* and *Customer Payment Type* on Partners, + +* the *Receivable Bank Account* on Partners, + +* the *Payment Type* on Invoices. + +On a Payment Order, in the wizard *Select Invoices to Pay*, the invoices will be filtered per Payment Type. + +Please contact Alexis de Lattre from Akretion for any help or question about this module. + """, + 'author': 'Akretion', + 'website': 'http://www.akretion.com', + 'depends': ['account_banking_payment_export'], + 'data': [ + 'view/partner.xml', + 'view/account_invoice.xml', + ], + 'demo': [], + 'active': False, +} diff --git a/account_payment_partner/i18n/account_payment_partner.pot b/account_payment_partner/i18n/account_payment_partner.pot new file mode 100644 index 000000000..0e83b63de --- /dev/null +++ b/account_payment_partner/i18n/account_payment_partner.pot @@ -0,0 +1,67 @@ +# Translation of OpenERP Server. +# This file contains the translation of the following modules: +# * account_payment_partner +# +msgid "" +msgstr "" +"Project-Id-Version: OpenERP Server 7.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-02-24 23:06+0000\n" +"PO-Revision-Date: 2014-02-24 23:06+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_partner +#: field:account.invoice,payment_mode_type:0 +msgid "Payment Type" +msgstr "" + +#. module: account_payment_partner +#: model:ir.model,name:account_payment_partner.model_payment_order_create +msgid "payment.order.create" +msgstr "" + +#. module: account_payment_partner +#: field:res.partner,supplier_payment_mode_type:0 +msgid "Supplier Payment Type" +msgstr "" + +#. module: account_payment_partner +#: help:res.partner,partner_bank_receivable:0 +msgid "Select the bank account of your company on which the customer should pay." +msgstr "" + +#. module: account_payment_partner +#: field:res.partner,partner_bank_receivable:0 +msgid "Receivable Bank Account" +msgstr "" + +#. module: account_payment_partner +#: help:res.partner,supplier_payment_mode_type:0 +msgid "Select the default payment type for this supplier." +msgstr "" + +#. module: account_payment_partner +#: field:res.partner,customer_payment_mode_type:0 +msgid "Customer Payment Type" +msgstr "" + +#. module: account_payment_partner +#: model:ir.model,name:account_payment_partner.model_account_invoice +msgid "Invoice" +msgstr "" + +#. module: account_payment_partner +#: help:res.partner,customer_payment_mode_type:0 +msgid "Select the default payment type for this customer." +msgstr "" + +#. module: account_payment_partner +#: model:ir.model,name:account_payment_partner.model_res_partner +msgid "Partner" +msgstr "" + diff --git a/account_payment_partner/model/__init__.py b/account_payment_partner/model/__init__.py new file mode 100644 index 000000000..3fae22c2a --- /dev/null +++ b/account_payment_partner/model/__init__.py @@ -0,0 +1,25 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Account Partner Payment 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 . +# +############################################################################## + +from . import partner +from . import account_invoice +from . import payment_order_create diff --git a/account_payment_partner/model/account_invoice.py b/account_payment_partner/model/account_invoice.py new file mode 100644 index 000000000..1e34729df --- /dev/null +++ b/account_payment_partner/model/account_invoice.py @@ -0,0 +1,53 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Account Partner Payment 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 . +# +############################################################################## + +from openerp.osv import orm, fields + + +class account_invoice(orm.Model): + _inherit = 'account.invoice' + + _columns = { + 'payment_mode_type': fields.many2one( + 'payment.mode.type', 'Payment Type'), + } + + def onchange_partner_id( + self, cr, uid, ids, type, partner_id, date_invoice=False, + payment_term=False, partner_bank_id=False, company_id=False): + res = super(account_invoice, self).onchange_partner_id( + cr, uid, ids, type, partner_id, date_invoice=date_invoice, + payment_term=payment_term, partner_bank_id=partner_bank_id, + company_id=company_id) + if partner_id: + partner = self.pool['res.partner'].browse(cr, uid, partner_id) + # TODO what about refunds ? Should be really copy + # the payment type for refunds ? + if type and type in ('in_invoice', 'in_refund'): + res['value']['payment_mode_type'] = \ + partner.supplier_payment_mode_type.id or False + elif type and type in ('out_invoice', 'out_refund'): + res['value']['payment_mode_type'] = \ + partner.customer_payment_mode_type.id or False + else: + res['value']['payment_mode_type'] = False + return res diff --git a/account_payment_partner/model/partner.py b/account_payment_partner/model/partner.py new file mode 100644 index 000000000..caef3c0a5 --- /dev/null +++ b/account_payment_partner/model/partner.py @@ -0,0 +1,53 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Account Partner Payment 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 . +# +############################################################################## + +from openerp.osv import orm, fields + + +class res_partner(orm.Model): + _inherit = 'res.partner' + + _columns = { + 'supplier_payment_mode_type': fields.property( + 'payment.mode.type', type='many2one', relation='payment.mode.type', + string='Supplier Payment Type', view_load=True, + help="Select the default payment type for this supplier."), + 'customer_payment_mode_type': fields.property( + 'payment.mode.type', type='many2one', relation='payment.mode.type', + string='Customer Payment Type', view_load=True, + help="Select the default payment type for this customer."), + 'partner_bank_receivable': fields.property( + 'res.partner.bank', type='many2one', relation='res.partner.bank', + string='Receivable Bank Account', view_load=True, + help="Select the bank account of your company on which the " + "customer should pay."), + } + + def _commercial_fields(self, cr, uid, context=None): + res = super(res_partner, self)._commercial_fields( + cr, uid, context=context) + res += [ + 'supplier_payment_mode_type', + 'customer_payment_mode_type', + 'partner_bank_receivable', + ] + return res diff --git a/account_payment_partner/model/payment_order_create.py b/account_payment_partner/model/payment_order_create.py new file mode 100644 index 000000000..0168f1ae4 --- /dev/null +++ b/account_payment_partner/model/payment_order_create.py @@ -0,0 +1,38 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Account Partner Payment 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 . +# +############################################################################## + +from openerp.osv import orm + + +class payment_order_create(orm.Model): + _inherit = 'payment.order.create' + + def extend_payment_order_domain( + self, cr, uid, payment_order, domain, context=None): + super(payment_order_create, self).extend_payment_order_domain( + cr, uid, payment_order, domain, context=context) + domain += [ + '|', + ('invoice', '=', False), + ('invoice.payment_mode_type', '=', payment_order.mode_type.id) + ] + return True diff --git a/account_payment_partner/view/account_invoice.xml b/account_payment_partner/view/account_invoice.xml new file mode 100644 index 000000000..85e0e9bf1 --- /dev/null +++ b/account_payment_partner/view/account_invoice.xml @@ -0,0 +1,38 @@ + + + + + + + + + + account_partner_payment.invoice_form + account.invoice + + + + + + + + + + + account_partner_payment.invoice_supplier_form + account.invoice + + + + + + + + + + + diff --git a/account_payment_partner/view/partner.xml b/account_payment_partner/view/partner.xml new file mode 100644 index 000000000..2273ef07a --- /dev/null +++ b/account_payment_partner/view/partner.xml @@ -0,0 +1,34 @@ + + + + + + + + + + account_partner_payment.partner_form + res.partner + + + + + + + + + + + + + + + From 05317345750358b2e4fef4b6c350adf2bfedd08c Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Fri, 21 Mar 2014 15:40:35 +0100 Subject: [PATCH 02/66] [FIX] wrong model type in inherit. --- account_payment_partner/model/payment_order_create.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/account_payment_partner/model/payment_order_create.py b/account_payment_partner/model/payment_order_create.py index 0168f1ae4..777c4480a 100644 --- a/account_payment_partner/model/payment_order_create.py +++ b/account_payment_partner/model/payment_order_create.py @@ -23,7 +23,7 @@ from openerp.osv import orm -class payment_order_create(orm.Model): +class payment_order_create(orm.TransientModel): _inherit = 'payment.order.create' def extend_payment_order_domain( From 7a13e7132be49d0065a562aa6e45a65e79299093 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Valyi?= Date: Fri, 21 Mar 2014 16:50:25 -0300 Subject: [PATCH 03/66] [REF] wrapping module description lines to keep cool with the PEP-8 extremists --- account_payment_partner/__openerp__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/account_payment_partner/__openerp__.py b/account_payment_partner/__openerp__.py index e67a7fc2b..25e312638 100644 --- a/account_payment_partner/__openerp__.py +++ b/account_payment_partner/__openerp__.py @@ -39,9 +39,11 @@ This module adds severals fields : * the *Payment Type* on Invoices. -On a Payment Order, in the wizard *Select Invoices to Pay*, the invoices will be filtered per Payment Type. +On a Payment Order, in the wizard *Select Invoices to Pay*, the invoices will +be filtered per Payment Type. -Please contact Alexis de Lattre from Akretion for any help or question about this module. +Please contact Alexis de Lattre from Akretion +for any help or question about this module. """, 'author': 'Akretion', 'website': 'http://www.akretion.com', From 235ef687def3c6094e3418587e74a05906b92523 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Sat, 12 Apr 2014 00:48:45 +0200 Subject: [PATCH 04/66] As suggested by Stefan: also select invoices with empty payment.mode.type. --- account_payment_partner/model/payment_order_create.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/account_payment_partner/model/payment_order_create.py b/account_payment_partner/model/payment_order_create.py index 777c4480a..e6d4f8f17 100644 --- a/account_payment_partner/model/payment_order_create.py +++ b/account_payment_partner/model/payment_order_create.py @@ -31,8 +31,9 @@ class payment_order_create(orm.TransientModel): super(payment_order_create, self).extend_payment_order_domain( cr, uid, payment_order, domain, context=context) domain += [ - '|', + '|', '|', ('invoice', '=', False), + ('invoice.payment_mode_type', '=', False), ('invoice.payment_mode_type', '=', payment_order.mode_type.id) ] return True From d7861c439db033b2e3b6ab666da699c92bbac043 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Tue, 10 Jun 2014 01:25:34 +0200 Subject: [PATCH 05/66] Update to the new data-model decided during the Open Days 2014. Add demo data. --- account_payment_partner/__init__.py | 2 +- account_payment_partner/__openerp__.py | 18 +++-- account_payment_partner/demo/partner_demo.xml | 51 ++++++++++++++ .../i18n/account_payment_partner.pot | 68 ++++++++----------- account_payment_partner/model/__init__.py | 2 +- .../model/account_invoice.py | 26 +++---- account_payment_partner/model/partner.py | 29 +++----- .../model/payment_order_create.py | 6 +- .../view/account_invoice.xml | 8 +-- account_payment_partner/view/partner.xml | 7 +- 10 files changed, 123 insertions(+), 94 deletions(-) create mode 100644 account_payment_partner/demo/partner_demo.xml diff --git a/account_payment_partner/__init__.py b/account_payment_partner/__init__.py index da25c5761..161123944 100644 --- a/account_payment_partner/__init__.py +++ b/account_payment_partner/__init__.py @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- ############################################################################## # -# Account Partner Payment module for OpenERP +# Account Payment Partner module for OpenERP # Copyright (C) 2014 Akretion (http://www.akretion.com) # @author Alexis de Lattre # diff --git a/account_payment_partner/__openerp__.py b/account_payment_partner/__openerp__.py index 25e312638..4e0217c98 100644 --- a/account_payment_partner/__openerp__.py +++ b/account_payment_partner/__openerp__.py @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- ############################################################################## # -# Account Partner Payment module for OpenERP +# Account Payment Partner module for OpenERP # Copyright (C) 2014 Akretion (http://www.akretion.com) # @author Alexis de Lattre # @@ -22,25 +22,23 @@ { - 'name': 'Account Partner Payment', + 'name': 'Account Payment Partner', 'version': '0.1', 'category': 'Banking addons', 'license': 'AGPL-3', - 'summary': 'Adds payment type and receivable bank account on partners', + 'summary': 'Adds payment mode on partners and invoices', 'description': """ -Account Partner Payment +Account Payment Partner ======================= This module adds severals fields : -* the *Supplier Payment Type* and *Customer Payment Type* on Partners, +* the *Supplier Payment Mode* and *Customer Payment Mode* on Partners, -* the *Receivable Bank Account* on Partners, - -* the *Payment Type* on Invoices. +* the *Payment Mode* on Invoices. On a Payment Order, in the wizard *Select Invoices to Pay*, the invoices will -be filtered per Payment Type. +be filtered per Payment Mode. Please contact Alexis de Lattre from Akretion for any help or question about this module. @@ -52,6 +50,6 @@ for any help or question about this module. 'view/partner.xml', 'view/account_invoice.xml', ], - 'demo': [], + 'demo': ['demo/partner_demo.xml'], 'active': False, } diff --git a/account_payment_partner/demo/partner_demo.xml b/account_payment_partner/demo/partner_demo.xml new file mode 100644 index 000000000..776058d44 --- /dev/null +++ b/account_payment_partner/demo/partner_demo.xml @@ -0,0 +1,51 @@ + + + + + + + + supplier_payment_mode_12 + + + + + + + + customer_payment_mode_12 + + + + + + + + + customer_payment_mode_2 + + + + + + + + + supplier_payment_mode_1 + + + + + + + + + diff --git a/account_payment_partner/i18n/account_payment_partner.pot b/account_payment_partner/i18n/account_payment_partner.pot index 0e83b63de..ca26e532d 100644 --- a/account_payment_partner/i18n/account_payment_partner.pot +++ b/account_payment_partner/i18n/account_payment_partner.pot @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: OpenERP Server 7.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-02-24 23:06+0000\n" -"PO-Revision-Date: 2014-02-24 23:06+0000\n" +"POT-Creation-Date: 2014-06-09 23:22+0000\n" +"PO-Revision-Date: 2014-06-09 23:22+0000\n" "Last-Translator: <>\n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -16,38 +16,8 @@ msgstr "" "Plural-Forms: \n" #. module: account_payment_partner -#: field:account.invoice,payment_mode_type:0 -msgid "Payment Type" -msgstr "" - -#. module: account_payment_partner -#: model:ir.model,name:account_payment_partner.model_payment_order_create -msgid "payment.order.create" -msgstr "" - -#. module: account_payment_partner -#: field:res.partner,supplier_payment_mode_type:0 -msgid "Supplier Payment Type" -msgstr "" - -#. module: account_payment_partner -#: help:res.partner,partner_bank_receivable:0 -msgid "Select the bank account of your company on which the customer should pay." -msgstr "" - -#. module: account_payment_partner -#: field:res.partner,partner_bank_receivable:0 -msgid "Receivable Bank Account" -msgstr "" - -#. module: account_payment_partner -#: help:res.partner,supplier_payment_mode_type:0 -msgid "Select the default payment type for this supplier." -msgstr "" - -#. module: account_payment_partner -#: field:res.partner,customer_payment_mode_type:0 -msgid "Customer Payment Type" +#: field:res.partner,customer_payment_mode:0 +msgid "Customer Payment Mode" msgstr "" #. module: account_payment_partner @@ -55,13 +25,33 @@ msgstr "" msgid "Invoice" msgstr "" -#. module: account_payment_partner -#: help:res.partner,customer_payment_mode_type:0 -msgid "Select the default payment type for this customer." -msgstr "" - #. module: account_payment_partner #: model:ir.model,name:account_payment_partner.model_res_partner msgid "Partner" msgstr "" +#. module: account_payment_partner +#: field:account.invoice,payment_mode_id:0 +msgid "Payment Mode" +msgstr "" + +#. module: account_payment_partner +#: help:res.partner,customer_payment_mode:0 +msgid "Select the default payment mode for this customer." +msgstr "" + +#. module: account_payment_partner +#: help:res.partner,supplier_payment_mode:0 +msgid "Select the default payment mode for this supplier." +msgstr "" + +#. module: account_payment_partner +#: field:res.partner,supplier_payment_mode:0 +msgid "Supplier Payment Mode" +msgstr "" + +#. module: account_payment_partner +#: model:ir.model,name:account_payment_partner.model_payment_order_create +msgid "payment.order.create" +msgstr "" + diff --git a/account_payment_partner/model/__init__.py b/account_payment_partner/model/__init__.py index 3fae22c2a..16ab8bc9e 100644 --- a/account_payment_partner/model/__init__.py +++ b/account_payment_partner/model/__init__.py @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- ############################################################################## # -# Account Partner Payment module for OpenERP +# Account Payment Partner module for OpenERP # Copyright (C) 2014 Akretion (http://www.akretion.com) # @author Alexis de Lattre # diff --git a/account_payment_partner/model/account_invoice.py b/account_payment_partner/model/account_invoice.py index 1e34729df..9e02ea476 100644 --- a/account_payment_partner/model/account_invoice.py +++ b/account_payment_partner/model/account_invoice.py @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- ############################################################################## # -# Account Partner Payment module for OpenERP +# Account Payment Partner module for OpenERP # Copyright (C) 2014 Akretion (http://www.akretion.com) # @author Alexis de Lattre # @@ -27,8 +27,8 @@ class account_invoice(orm.Model): _inherit = 'account.invoice' _columns = { - 'payment_mode_type': fields.many2one( - 'payment.mode.type', 'Payment Type'), + 'payment_mode_id': fields.many2one( + 'payment.mode', 'Payment Mode'), } def onchange_partner_id( @@ -40,14 +40,16 @@ class account_invoice(orm.Model): company_id=company_id) if partner_id: partner = self.pool['res.partner'].browse(cr, uid, partner_id) - # TODO what about refunds ? Should be really copy - # the payment type for refunds ? - if type and type in ('in_invoice', 'in_refund'): - res['value']['payment_mode_type'] = \ - partner.supplier_payment_mode_type.id or False - elif type and type in ('out_invoice', 'out_refund'): - res['value']['payment_mode_type'] = \ - partner.customer_payment_mode_type.id or False + if type == 'in_invoice': + res['value']['payment_mode_id'] = \ + partner.supplier_payment_mode.id or False + elif type == 'out_invoice': + res['value'].update({ + 'payment_mode_id': + partner.customer_payment_mode.id or False, + 'partner_bank_id': + partner.customer_payment_mode.bank_id.id or False, + }) else: - res['value']['payment_mode_type'] = False + res['value']['payment_mode_id'] = False return res diff --git a/account_payment_partner/model/partner.py b/account_payment_partner/model/partner.py index caef3c0a5..4bfe4c787 100644 --- a/account_payment_partner/model/partner.py +++ b/account_payment_partner/model/partner.py @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- ############################################################################## # -# Account Partner Payment module for OpenERP +# Account Payment Partner module for OpenERP # Copyright (C) 2014 Akretion (http://www.akretion.com) # @author Alexis de Lattre # @@ -27,27 +27,18 @@ class res_partner(orm.Model): _inherit = 'res.partner' _columns = { - 'supplier_payment_mode_type': fields.property( - 'payment.mode.type', type='many2one', relation='payment.mode.type', - string='Supplier Payment Type', view_load=True, - help="Select the default payment type for this supplier."), - 'customer_payment_mode_type': fields.property( - 'payment.mode.type', type='many2one', relation='payment.mode.type', - string='Customer Payment Type', view_load=True, - help="Select the default payment type for this customer."), - 'partner_bank_receivable': fields.property( - 'res.partner.bank', type='many2one', relation='res.partner.bank', - string='Receivable Bank Account', view_load=True, - help="Select the bank account of your company on which the " - "customer should pay."), + 'supplier_payment_mode': fields.property( + 'payment.mode', type='many2one', relation='payment.mode', + string='Supplier Payment Mode', view_load=True, + help="Select the default payment mode for this supplier."), + 'customer_payment_mode': fields.property( + 'payment.mode', type='many2one', relation='payment.mode', + string='Customer Payment Mode', view_load=True, + help="Select the default payment mode for this customer."), } def _commercial_fields(self, cr, uid, context=None): res = super(res_partner, self)._commercial_fields( cr, uid, context=context) - res += [ - 'supplier_payment_mode_type', - 'customer_payment_mode_type', - 'partner_bank_receivable', - ] + res += ['supplier_payment_mode', 'customer_payment_mode'] return res diff --git a/account_payment_partner/model/payment_order_create.py b/account_payment_partner/model/payment_order_create.py index e6d4f8f17..ea8b1ccb3 100644 --- a/account_payment_partner/model/payment_order_create.py +++ b/account_payment_partner/model/payment_order_create.py @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- ############################################################################## # -# Account Partner Payment module for OpenERP +# Account Payment Partner module for OpenERP # Copyright (C) 2014 Akretion (http://www.akretion.com) # @author Alexis de Lattre # @@ -33,7 +33,7 @@ class payment_order_create(orm.TransientModel): domain += [ '|', '|', ('invoice', '=', False), - ('invoice.payment_mode_type', '=', False), - ('invoice.payment_mode_type', '=', payment_order.mode_type.id) + ('invoice.payment_mode_id', '=', False), + ('invoice.payment_mode_id', '=', payment_order.mode.id) ] return True diff --git a/account_payment_partner/view/account_invoice.xml b/account_payment_partner/view/account_invoice.xml index 85e0e9bf1..0bfd2d1f5 100644 --- a/account_payment_partner/view/account_invoice.xml +++ b/account_payment_partner/view/account_invoice.xml @@ -11,24 +11,24 @@ - account_partner_payment.invoice_form + account_payment_partner.invoice_form account.invoice - + - account_partner_payment.invoice_supplier_form + account_payment_partner.invoice_supplier_form account.invoice - + diff --git a/account_payment_partner/view/partner.xml b/account_payment_partner/view/partner.xml index 2273ef07a..02eb8cc0f 100644 --- a/account_payment_partner/view/partner.xml +++ b/account_payment_partner/view/partner.xml @@ -16,14 +16,11 @@ - - - From f610f5b592aaa19d743e96ea06fefe649c0ec215 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Mon, 23 Jun 2014 11:45:26 +0200 Subject: [PATCH 06/66] Suggested by Stefan Rijnhart : check for the payment_mode_id before asking its bank_id.id --- account_payment_partner/model/account_invoice.py | 1 + 1 file changed, 1 insertion(+) diff --git a/account_payment_partner/model/account_invoice.py b/account_payment_partner/model/account_invoice.py index 9e02ea476..607cda29a 100644 --- a/account_payment_partner/model/account_invoice.py +++ b/account_payment_partner/model/account_invoice.py @@ -48,6 +48,7 @@ class account_invoice(orm.Model): 'payment_mode_id': partner.customer_payment_mode.id or False, 'partner_bank_id': + partner.customer_payment_mode and partner.customer_payment_mode.bank_id.id or False, }) else: From e2e4b7f4b21c1f780565825c56943220cb94aa65 Mon Sep 17 00:00:00 2001 From: Launchpad Translations on behalf of banking-addons-team Date: Fri, 27 Jun 2014 07:13:31 +0000 Subject: [PATCH 07/66] Launchpad automatic translations update. --- account_payment_partner/i18n/nl.po | 58 ++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 account_payment_partner/i18n/nl.po diff --git a/account_payment_partner/i18n/nl.po b/account_payment_partner/i18n/nl.po new file mode 100644 index 000000000..4c90fe776 --- /dev/null +++ b/account_payment_partner/i18n/nl.po @@ -0,0 +1,58 @@ +# 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. +# +msgid "" +msgstr "" +"Project-Id-Version: banking-addons\n" +"Report-Msgid-Bugs-To: FULL NAME \n" +"POT-Creation-Date: 2014-06-09 23:22+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" +"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" + +#. module: account_payment_partner +#: field:res.partner,customer_payment_mode:0 +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_res_partner +msgid "Partner" +msgstr "Relatie" + +#. module: account_payment_partner +#: field:account.invoice,payment_mode_id:0 +msgid "Payment Mode" +msgstr "Betaalwijze" + +#. module: account_payment_partner +#: help:res.partner,customer_payment_mode:0 +msgid "Select the default payment mode for this customer." +msgstr "Selecteer de standaard betaalwijze voor deze klant." + +#. module: account_payment_partner +#: help:res.partner,supplier_payment_mode:0 +msgid "Select the default payment mode for this supplier." +msgstr "Selecteer de standaard betaalwijze voor deze leverancier." + +#. module: account_payment_partner +#: field:res.partner,supplier_payment_mode:0 +msgid "Supplier Payment Mode" +msgstr "Betaalwijze leverancier" + +#. module: account_payment_partner +#: model:ir.model,name:account_payment_partner.model_payment_order_create +msgid "payment.order.create" +msgstr "payment.order.create" From 66f95a64d8a6c11e786902efd51ede0fcd4086fb Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Wed, 10 Sep 2014 12:19:20 +0200 Subject: [PATCH 08/66] Initial adjustments for 8.0 repository --- account_payment_partner/__init__.py | 23 -------- account_payment_partner/__openerp__.py | 55 ------------------ account_payment_partner/demo/partner_demo.xml | 51 ---------------- .../i18n/account_payment_partner.pot | 57 ------------------ account_payment_partner/i18n/nl.po | 58 ------------------- account_payment_partner/model/__init__.py | 25 -------- .../model/account_invoice.py | 56 ------------------ account_payment_partner/model/partner.py | 44 -------------- .../model/payment_order_create.py | 39 ------------- .../view/account_invoice.xml | 38 ------------ account_payment_partner/view/partner.xml | 31 ---------- 11 files changed, 477 deletions(-) delete mode 100644 account_payment_partner/__init__.py delete mode 100644 account_payment_partner/__openerp__.py delete mode 100644 account_payment_partner/demo/partner_demo.xml delete mode 100644 account_payment_partner/i18n/account_payment_partner.pot delete mode 100644 account_payment_partner/i18n/nl.po delete mode 100644 account_payment_partner/model/__init__.py delete mode 100644 account_payment_partner/model/account_invoice.py delete mode 100644 account_payment_partner/model/partner.py delete mode 100644 account_payment_partner/model/payment_order_create.py delete mode 100644 account_payment_partner/view/account_invoice.xml delete mode 100644 account_payment_partner/view/partner.xml diff --git a/account_payment_partner/__init__.py b/account_payment_partner/__init__.py deleted file mode 100644 index 161123944..000000000 --- a/account_payment_partner/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# -# Account Payment Partner 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 . -# -############################################################################## - -from . import model diff --git a/account_payment_partner/__openerp__.py b/account_payment_partner/__openerp__.py deleted file mode 100644 index 4e0217c98..000000000 --- a/account_payment_partner/__openerp__.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# -# Account Payment Partner 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 . -# -############################################################################## - - -{ - 'name': 'Account Payment Partner', - 'version': '0.1', - 'category': 'Banking addons', - 'license': 'AGPL-3', - 'summary': 'Adds payment mode on partners and invoices', - 'description': """ -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. - -Please contact Alexis de Lattre from Akretion -for any help or question about this module. - """, - 'author': 'Akretion', - 'website': 'http://www.akretion.com', - 'depends': ['account_banking_payment_export'], - 'data': [ - 'view/partner.xml', - 'view/account_invoice.xml', - ], - 'demo': ['demo/partner_demo.xml'], - 'active': False, -} diff --git a/account_payment_partner/demo/partner_demo.xml b/account_payment_partner/demo/partner_demo.xml deleted file mode 100644 index 776058d44..000000000 --- a/account_payment_partner/demo/partner_demo.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - supplier_payment_mode_12 - - - - - - - - customer_payment_mode_12 - - - - - - - - - customer_payment_mode_2 - - - - - - - - - supplier_payment_mode_1 - - - - - - - - - diff --git a/account_payment_partner/i18n/account_payment_partner.pot b/account_payment_partner/i18n/account_payment_partner.pot deleted file mode 100644 index ca26e532d..000000000 --- a/account_payment_partner/i18n/account_payment_partner.pot +++ /dev/null @@ -1,57 +0,0 @@ -# Translation of OpenERP Server. -# This file contains the translation of the following modules: -# * account_payment_partner -# -msgid "" -msgstr "" -"Project-Id-Version: OpenERP Server 7.0\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-06-09 23:22+0000\n" -"PO-Revision-Date: 2014-06-09 23:22+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_partner -#: field:res.partner,customer_payment_mode:0 -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_res_partner -msgid "Partner" -msgstr "" - -#. module: account_payment_partner -#: field:account.invoice,payment_mode_id:0 -msgid "Payment Mode" -msgstr "" - -#. module: account_payment_partner -#: help:res.partner,customer_payment_mode:0 -msgid "Select the default payment mode for this customer." -msgstr "" - -#. module: account_payment_partner -#: help:res.partner,supplier_payment_mode:0 -msgid "Select the default payment mode for this supplier." -msgstr "" - -#. module: account_payment_partner -#: field:res.partner,supplier_payment_mode:0 -msgid "Supplier Payment Mode" -msgstr "" - -#. module: account_payment_partner -#: model:ir.model,name:account_payment_partner.model_payment_order_create -msgid "payment.order.create" -msgstr "" - diff --git a/account_payment_partner/i18n/nl.po b/account_payment_partner/i18n/nl.po deleted file mode 100644 index 4c90fe776..000000000 --- a/account_payment_partner/i18n/nl.po +++ /dev/null @@ -1,58 +0,0 @@ -# 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. -# -msgid "" -msgstr "" -"Project-Id-Version: banking-addons\n" -"Report-Msgid-Bugs-To: FULL NAME \n" -"POT-Creation-Date: 2014-06-09 23:22+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" -"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" - -#. module: account_payment_partner -#: field:res.partner,customer_payment_mode:0 -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_res_partner -msgid "Partner" -msgstr "Relatie" - -#. module: account_payment_partner -#: field:account.invoice,payment_mode_id:0 -msgid "Payment Mode" -msgstr "Betaalwijze" - -#. module: account_payment_partner -#: help:res.partner,customer_payment_mode:0 -msgid "Select the default payment mode for this customer." -msgstr "Selecteer de standaard betaalwijze voor deze klant." - -#. module: account_payment_partner -#: help:res.partner,supplier_payment_mode:0 -msgid "Select the default payment mode for this supplier." -msgstr "Selecteer de standaard betaalwijze voor deze leverancier." - -#. module: account_payment_partner -#: field:res.partner,supplier_payment_mode:0 -msgid "Supplier Payment Mode" -msgstr "Betaalwijze leverancier" - -#. module: account_payment_partner -#: model:ir.model,name:account_payment_partner.model_payment_order_create -msgid "payment.order.create" -msgstr "payment.order.create" diff --git a/account_payment_partner/model/__init__.py b/account_payment_partner/model/__init__.py deleted file mode 100644 index 16ab8bc9e..000000000 --- a/account_payment_partner/model/__init__.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# -# Account Payment Partner 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 . -# -############################################################################## - -from . import partner -from . import account_invoice -from . import payment_order_create diff --git a/account_payment_partner/model/account_invoice.py b/account_payment_partner/model/account_invoice.py deleted file mode 100644 index 607cda29a..000000000 --- a/account_payment_partner/model/account_invoice.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# -# Account Payment Partner 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 . -# -############################################################################## - -from openerp.osv import orm, fields - - -class account_invoice(orm.Model): - _inherit = 'account.invoice' - - _columns = { - 'payment_mode_id': fields.many2one( - 'payment.mode', 'Payment Mode'), - } - - def onchange_partner_id( - self, cr, uid, ids, type, partner_id, date_invoice=False, - payment_term=False, partner_bank_id=False, company_id=False): - res = super(account_invoice, self).onchange_partner_id( - cr, uid, ids, type, partner_id, date_invoice=date_invoice, - payment_term=payment_term, partner_bank_id=partner_bank_id, - company_id=company_id) - if partner_id: - partner = self.pool['res.partner'].browse(cr, uid, partner_id) - if type == 'in_invoice': - res['value']['payment_mode_id'] = \ - partner.supplier_payment_mode.id or False - elif type == 'out_invoice': - res['value'].update({ - 'payment_mode_id': - partner.customer_payment_mode.id or False, - 'partner_bank_id': - partner.customer_payment_mode and - partner.customer_payment_mode.bank_id.id or False, - }) - else: - res['value']['payment_mode_id'] = False - return res diff --git a/account_payment_partner/model/partner.py b/account_payment_partner/model/partner.py deleted file mode 100644 index 4bfe4c787..000000000 --- a/account_payment_partner/model/partner.py +++ /dev/null @@ -1,44 +0,0 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# -# Account Payment Partner 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 . -# -############################################################################## - -from openerp.osv import orm, fields - - -class res_partner(orm.Model): - _inherit = 'res.partner' - - _columns = { - 'supplier_payment_mode': fields.property( - 'payment.mode', type='many2one', relation='payment.mode', - string='Supplier Payment Mode', view_load=True, - help="Select the default payment mode for this supplier."), - 'customer_payment_mode': fields.property( - 'payment.mode', type='many2one', relation='payment.mode', - string='Customer Payment Mode', view_load=True, - help="Select the default payment mode for this customer."), - } - - def _commercial_fields(self, cr, uid, context=None): - res = super(res_partner, self)._commercial_fields( - cr, uid, context=context) - res += ['supplier_payment_mode', 'customer_payment_mode'] - return res diff --git a/account_payment_partner/model/payment_order_create.py b/account_payment_partner/model/payment_order_create.py deleted file mode 100644 index ea8b1ccb3..000000000 --- a/account_payment_partner/model/payment_order_create.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# -# Account Payment Partner 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 . -# -############################################################################## - -from openerp.osv import orm - - -class payment_order_create(orm.TransientModel): - _inherit = 'payment.order.create' - - def extend_payment_order_domain( - self, cr, uid, payment_order, domain, context=None): - super(payment_order_create, self).extend_payment_order_domain( - cr, uid, payment_order, domain, context=context) - domain += [ - '|', '|', - ('invoice', '=', False), - ('invoice.payment_mode_id', '=', False), - ('invoice.payment_mode_id', '=', payment_order.mode.id) - ] - return True diff --git a/account_payment_partner/view/account_invoice.xml b/account_payment_partner/view/account_invoice.xml deleted file mode 100644 index 0bfd2d1f5..000000000 --- a/account_payment_partner/view/account_invoice.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - account_payment_partner.invoice_form - account.invoice - - - - - - - - - - - account_payment_partner.invoice_supplier_form - account.invoice - - - - - - - - - - - diff --git a/account_payment_partner/view/partner.xml b/account_payment_partner/view/partner.xml deleted file mode 100644 index 02eb8cc0f..000000000 --- a/account_payment_partner/view/partner.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - account_partner_payment.partner_form - res.partner - - - - - - - - - - - - - - From 348371ae7a9531065c7c03dc6c7d3f526d530318 Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Wed, 10 Sep 2014 12:48:09 +0200 Subject: [PATCH 09/66] [MIG] Migration and enhancement of all modules involved in SEPA --- account_payment_partner/__init__.py | 24 ++++++++ account_payment_partner/__openerp__.py | 53 +++++++++++++++++ account_payment_partner/demo/partner_demo.xml | 51 ++++++++++++++++ .../i18n/account_payment_partner.pot | 57 ++++++++++++++++++ account_payment_partner/i18n/nl.po | 58 +++++++++++++++++++ account_payment_partner/models/__init__.py | 24 ++++++++ .../models/account_invoice.py | 51 ++++++++++++++++ account_payment_partner/models/partner.py | 44 ++++++++++++++ .../models/payment_order_create.py | 39 +++++++++++++ account_payment_partner/models/res_partner.py | 42 ++++++++++++++ .../views/account_invoice.xml | 38 ++++++++++++ .../views/account_invoice_view.xml | 40 +++++++++++++ account_payment_partner/views/partner.xml | 31 ++++++++++ .../views/res_partner_view.xml | 27 +++++++++ account_payment_partner/wizard/__init__.py | 23 ++++++++ .../wizard/payment_order_create.py | 37 ++++++++++++ 16 files changed, 639 insertions(+) create mode 100644 account_payment_partner/__init__.py create mode 100644 account_payment_partner/__openerp__.py create mode 100644 account_payment_partner/demo/partner_demo.xml create mode 100644 account_payment_partner/i18n/account_payment_partner.pot create mode 100644 account_payment_partner/i18n/nl.po create mode 100644 account_payment_partner/models/__init__.py create mode 100644 account_payment_partner/models/account_invoice.py create mode 100644 account_payment_partner/models/partner.py create mode 100644 account_payment_partner/models/payment_order_create.py create mode 100644 account_payment_partner/models/res_partner.py create mode 100644 account_payment_partner/views/account_invoice.xml create mode 100644 account_payment_partner/views/account_invoice_view.xml create mode 100644 account_payment_partner/views/partner.xml create mode 100644 account_payment_partner/views/res_partner_view.xml create mode 100644 account_payment_partner/wizard/__init__.py create mode 100644 account_payment_partner/wizard/payment_order_create.py diff --git a/account_payment_partner/__init__.py b/account_payment_partner/__init__.py new file mode 100644 index 000000000..fe47437f2 --- /dev/null +++ b/account_payment_partner/__init__.py @@ -0,0 +1,24 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Account Payment Partner 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 . +# +############################################################################## + +from . import models +from . import wizard diff --git a/account_payment_partner/__openerp__.py b/account_payment_partner/__openerp__.py new file mode 100644 index 000000000..3f3a51f3f --- /dev/null +++ b/account_payment_partner/__openerp__.py @@ -0,0 +1,53 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Account Payment Partner 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 . +# +############################################################################## + + +{ + 'name': 'Account Payment Partner', + 'version': '0.1', + 'category': 'Banking addons', + 'license': 'AGPL-3', + 'summary': 'Adds payment mode on partners and invoices', + 'description': """ +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. + """, + 'author': 'Akretion', + 'website': 'http://www.akretion.com', + 'contributors': ['Pedro M. Baeza '], + 'depends': ['account_banking_payment_export'], + 'data': [ + 'views/res_partner_view.xml', + 'views/account_invoice_view.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..776058d44 --- /dev/null +++ b/account_payment_partner/demo/partner_demo.xml @@ -0,0 +1,51 @@ + + + + + + + + supplier_payment_mode_12 + + + + + + + + customer_payment_mode_12 + + + + + + + + + customer_payment_mode_2 + + + + + + + + + supplier_payment_mode_1 + + + + + + + + + diff --git a/account_payment_partner/i18n/account_payment_partner.pot b/account_payment_partner/i18n/account_payment_partner.pot new file mode 100644 index 000000000..ca26e532d --- /dev/null +++ b/account_payment_partner/i18n/account_payment_partner.pot @@ -0,0 +1,57 @@ +# Translation of OpenERP Server. +# This file contains the translation of the following modules: +# * account_payment_partner +# +msgid "" +msgstr "" +"Project-Id-Version: OpenERP Server 7.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-06-09 23:22+0000\n" +"PO-Revision-Date: 2014-06-09 23:22+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_partner +#: field:res.partner,customer_payment_mode:0 +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_res_partner +msgid "Partner" +msgstr "" + +#. module: account_payment_partner +#: field:account.invoice,payment_mode_id:0 +msgid "Payment Mode" +msgstr "" + +#. module: account_payment_partner +#: help:res.partner,customer_payment_mode:0 +msgid "Select the default payment mode for this customer." +msgstr "" + +#. module: account_payment_partner +#: help:res.partner,supplier_payment_mode:0 +msgid "Select the default payment mode for this supplier." +msgstr "" + +#. module: account_payment_partner +#: field:res.partner,supplier_payment_mode:0 +msgid "Supplier Payment Mode" +msgstr "" + +#. module: account_payment_partner +#: model:ir.model,name:account_payment_partner.model_payment_order_create +msgid "payment.order.create" +msgstr "" + diff --git a/account_payment_partner/i18n/nl.po b/account_payment_partner/i18n/nl.po new file mode 100644 index 000000000..4c90fe776 --- /dev/null +++ b/account_payment_partner/i18n/nl.po @@ -0,0 +1,58 @@ +# 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. +# +msgid "" +msgstr "" +"Project-Id-Version: banking-addons\n" +"Report-Msgid-Bugs-To: FULL NAME \n" +"POT-Creation-Date: 2014-06-09 23:22+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" +"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" + +#. module: account_payment_partner +#: field:res.partner,customer_payment_mode:0 +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_res_partner +msgid "Partner" +msgstr "Relatie" + +#. module: account_payment_partner +#: field:account.invoice,payment_mode_id:0 +msgid "Payment Mode" +msgstr "Betaalwijze" + +#. module: account_payment_partner +#: help:res.partner,customer_payment_mode:0 +msgid "Select the default payment mode for this customer." +msgstr "Selecteer de standaard betaalwijze voor deze klant." + +#. module: account_payment_partner +#: help:res.partner,supplier_payment_mode:0 +msgid "Select the default payment mode for this supplier." +msgstr "Selecteer de standaard betaalwijze voor deze leverancier." + +#. module: account_payment_partner +#: field:res.partner,supplier_payment_mode:0 +msgid "Supplier Payment Mode" +msgstr "Betaalwijze leverancier" + +#. module: account_payment_partner +#: model:ir.model,name:account_payment_partner.model_payment_order_create +msgid "payment.order.create" +msgstr "payment.order.create" diff --git a/account_payment_partner/models/__init__.py b/account_payment_partner/models/__init__.py new file mode 100644 index 000000000..c2c7b405d --- /dev/null +++ b/account_payment_partner/models/__init__.py @@ -0,0 +1,24 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Account Payment Partner 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 . +# +############################################################################## + +from . import res_partner +from . import account_invoice diff --git a/account_payment_partner/models/account_invoice.py b/account_payment_partner/models/account_invoice.py new file mode 100644 index 000000000..cbbd4b5b9 --- /dev/null +++ b/account_payment_partner/models/account_invoice.py @@ -0,0 +1,51 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Account Payment Partner 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 . +# +############################################################################## + +from openerp import models, fields, api + + +class AccountInvoice(models.Model): + _inherit = 'account.invoice' + + payment_mode_id = fields.Many2one('payment.mode', string="Payment Mode") + + @api.multi + def onchange_partner_id( + self, type, partner_id, date_invoice=False, + payment_term=False, partner_bank_id=False, company_id=False): + res = super(AccountInvoice, self).onchange_partner_id( + type, partner_id, date_invoice=date_invoice, + payment_term=payment_term, partner_bank_id=partner_bank_id, + company_id=company_id) + if partner_id: + partner = self.env['res.partner'].browse(partner_id) + if type == 'in_invoice': + res['value']['payment_mode_id'] = \ + partner.supplier_payment_mode.id + elif type == 'out_invoice': + res['value'].update({ + 'payment_mode_id': partner.customer_payment_mode.id, + 'partner_bank_id': partner.customer_payment_mode.bank_id.id + }) + else: + res['value']['payment_mode_id'] = False + return res diff --git a/account_payment_partner/models/partner.py b/account_payment_partner/models/partner.py new file mode 100644 index 000000000..4bfe4c787 --- /dev/null +++ b/account_payment_partner/models/partner.py @@ -0,0 +1,44 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Account Payment Partner 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 . +# +############################################################################## + +from openerp.osv import orm, fields + + +class res_partner(orm.Model): + _inherit = 'res.partner' + + _columns = { + 'supplier_payment_mode': fields.property( + 'payment.mode', type='many2one', relation='payment.mode', + string='Supplier Payment Mode', view_load=True, + help="Select the default payment mode for this supplier."), + 'customer_payment_mode': fields.property( + 'payment.mode', type='many2one', relation='payment.mode', + string='Customer Payment Mode', view_load=True, + help="Select the default payment mode for this customer."), + } + + def _commercial_fields(self, cr, uid, context=None): + res = super(res_partner, self)._commercial_fields( + cr, uid, context=context) + res += ['supplier_payment_mode', 'customer_payment_mode'] + return res diff --git a/account_payment_partner/models/payment_order_create.py b/account_payment_partner/models/payment_order_create.py new file mode 100644 index 000000000..ea8b1ccb3 --- /dev/null +++ b/account_payment_partner/models/payment_order_create.py @@ -0,0 +1,39 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Account Payment Partner 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 . +# +############################################################################## + +from openerp.osv import orm + + +class payment_order_create(orm.TransientModel): + _inherit = 'payment.order.create' + + def extend_payment_order_domain( + self, cr, uid, payment_order, domain, context=None): + super(payment_order_create, self).extend_payment_order_domain( + cr, uid, payment_order, domain, context=context) + domain += [ + '|', '|', + ('invoice', '=', False), + ('invoice.payment_mode_id', '=', False), + ('invoice.payment_mode_id', '=', payment_order.mode.id) + ] + return True diff --git a/account_payment_partner/models/res_partner.py b/account_payment_partner/models/res_partner.py new file mode 100644 index 000000000..c8762f7d5 --- /dev/null +++ b/account_payment_partner/models/res_partner.py @@ -0,0 +1,42 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Account Payment Partner 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 . +# +############################################################################## + +from openerp import models, fields, api + + +class ResPartner(models.Model): + _inherit = 'res.partner' + + supplier_payment_mode = fields.Many2one( + 'payment.mode', string='Supplier Payment Mode', company_dependent=True, + domain="[('payment_order_type', '=', 'payment')]", + help="Select the default payment mode for this supplier.") + customer_payment_mode = fields.Many2one( + 'payment.mode', string='Customer Payment Mode', company_dependent=True, + domain="[('payment_order_type', '=', 'debit')]", + 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', 'customer_payment_mode'] + return res diff --git a/account_payment_partner/views/account_invoice.xml b/account_payment_partner/views/account_invoice.xml new file mode 100644 index 000000000..0bfd2d1f5 --- /dev/null +++ b/account_payment_partner/views/account_invoice.xml @@ -0,0 +1,38 @@ + + + + + + + + + + account_payment_partner.invoice_form + account.invoice + + + + + + + + + + + account_payment_partner.invoice_supplier_form + account.invoice + + + + + + + + + + + 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..f4805fa89 --- /dev/null +++ b/account_payment_partner/views/account_invoice_view.xml @@ -0,0 +1,40 @@ + + + + + + + + + + account_payment_partner.invoice_form + account.invoice + + + + + + + + + + + account_payment_partner.invoice_supplier_form + account.invoice + + + + + + + + + + + diff --git a/account_payment_partner/views/partner.xml b/account_payment_partner/views/partner.xml new file mode 100644 index 000000000..02eb8cc0f --- /dev/null +++ b/account_payment_partner/views/partner.xml @@ -0,0 +1,31 @@ + + + + + + + + + + account_partner_payment.partner_form + res.partner + + + + + + + + + + + + + + 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..3c6d670aa --- /dev/null +++ b/account_payment_partner/views/res_partner_view.xml @@ -0,0 +1,27 @@ + + + + + + + + + account_partner_payment.partner_form + res.partner + + + + + + + + + + + + + diff --git a/account_payment_partner/wizard/__init__.py b/account_payment_partner/wizard/__init__.py new file mode 100644 index 000000000..f7107a63f --- /dev/null +++ b/account_payment_partner/wizard/__init__.py @@ -0,0 +1,23 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Account Payment Partner 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 . +# +############################################################################## + +from . import payment_order_create diff --git a/account_payment_partner/wizard/payment_order_create.py b/account_payment_partner/wizard/payment_order_create.py new file mode 100644 index 000000000..c26b7f9d9 --- /dev/null +++ b/account_payment_partner/wizard/payment_order_create.py @@ -0,0 +1,37 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Account Payment Partner 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 . +# +############################################################################## + +from openerp import models, api + + +class PaymentOrderCreate(models.TransientModel): + _inherit = 'payment.order.create' + + @api.model + def extend_payment_order_domain(self, payment_order, domain): + res = super(PaymentOrderCreate, self).extend_payment_order_domain( + payment_order, domain) + domain += ['|', '|', + ('invoice', '=', False), + ('invoice.payment_mode_id', '=', False), + ('invoice.payment_mode_id', '=', payment_order.mode.id)] + return res From db8f504ea8028907013c337e87289ba63cb49ee1 Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Tue, 7 Oct 2014 00:09:26 +0200 Subject: [PATCH 10/66] Clean files --- account_payment_partner/__openerp__.py | 59 +++++++++++++++++++ .../models/account_invoice.py | 5 +- 2 files changed, 63 insertions(+), 1 deletion(-) diff --git a/account_payment_partner/__openerp__.py b/account_payment_partner/__openerp__.py index 3f3a51f3f..b499d6028 100644 --- a/account_payment_partner/__openerp__.py +++ b/account_payment_partner/__openerp__.py @@ -51,3 +51,62 @@ be filtered per Payment Mode. 'demo': ['demo/partner_demo.xml'], 'installable': True, } + +from openerp import models, fields, api, exceptions +from datetime import datetime + + +class CrmLead(models.Model): + _inherit = 'crm.lead' + + @api.one + @api.constrains('state', 'code') + def _check_code(self): + if self.state == 'won': + if not self.code: + raise exceptions.Warning('Debe poner un código cuando la etapa se pasa a ganado.') + + @api.constrains('state', 'code') + def _check_code(self): + for record in self: + if record.state == 'won': + if not record.code: + raise exceptions.Warning('Debe poner un código cuando la etapa se pasa a ganado.') + + def do_something(self, vals): + pass + + def create(self, vals): + # Complementar valores del create + rec_id = super(CrmLead, self).create(vals) + # Crear registros accesorios + analytic_acc_obj = self.env['account.analytic.account'] + analytic_acc_obj.create({'name': vals['name'], + 'type': 'project', + 'date': datetime.now(), + 'project_id': rec_id}) + analytic_accs = analytic_acc_obj.search([('type', '=', 'project')], + order='partner_id', limit=1) + analytic_accs.write({'partner_id': 1}) + return rec_id + + def copy(self, default): + default['name'] = self.name + " (copia)" + return super(CrmLead, self).copy(default) + + def search(self, domain): + return {1: {''}, 2: {} } + + @api.one + def unlink(self): + if self.state in ('to_invoice', 'done'): + raise exceptions.Warning('No se puede borrar un pedido confirmado.') + super(CrmLead, self).unlink() + return True + + def write(self, vals): + if vals.get('state') == 'won': + for record in self: + if not record.code and not vals.get('code'): + raise exceptions.Warning('Debe poner un código cuando la etapa se pasa a ganado.') + return super(CrmLead, self).write(vals) diff --git a/account_payment_partner/models/account_invoice.py b/account_payment_partner/models/account_invoice.py index cbbd4b5b9..1c2428eb6 100644 --- a/account_payment_partner/models/account_invoice.py +++ b/account_payment_partner/models/account_invoice.py @@ -26,7 +26,10 @@ from openerp import models, fields, api class AccountInvoice(models.Model): _inherit = 'account.invoice' - payment_mode_id = fields.Many2one('payment.mode', string="Payment Mode") + type = fields.Selection('out', 'in') + + payment_mode_id = fields.Many2one('payment.mode', string="Payment Mode", + domain="[('type', '=', type)]") @api.multi def onchange_partner_id( From 2f38eb692fdf78cb9a80a524052f307dbf18db89 Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Tue, 7 Oct 2014 11:51:19 +0200 Subject: [PATCH 11/66] [IMP] Replace deprecated workflow calls --- account_payment_partner/__openerp__.py | 59 ------------------- .../models/account_invoice.py | 2 - .../views/account_invoice.xml | 38 ------------ account_payment_partner/views/partner.xml | 31 ---------- 4 files changed, 130 deletions(-) delete mode 100644 account_payment_partner/views/account_invoice.xml delete mode 100644 account_payment_partner/views/partner.xml diff --git a/account_payment_partner/__openerp__.py b/account_payment_partner/__openerp__.py index b499d6028..3f3a51f3f 100644 --- a/account_payment_partner/__openerp__.py +++ b/account_payment_partner/__openerp__.py @@ -51,62 +51,3 @@ be filtered per Payment Mode. 'demo': ['demo/partner_demo.xml'], 'installable': True, } - -from openerp import models, fields, api, exceptions -from datetime import datetime - - -class CrmLead(models.Model): - _inherit = 'crm.lead' - - @api.one - @api.constrains('state', 'code') - def _check_code(self): - if self.state == 'won': - if not self.code: - raise exceptions.Warning('Debe poner un código cuando la etapa se pasa a ganado.') - - @api.constrains('state', 'code') - def _check_code(self): - for record in self: - if record.state == 'won': - if not record.code: - raise exceptions.Warning('Debe poner un código cuando la etapa se pasa a ganado.') - - def do_something(self, vals): - pass - - def create(self, vals): - # Complementar valores del create - rec_id = super(CrmLead, self).create(vals) - # Crear registros accesorios - analytic_acc_obj = self.env['account.analytic.account'] - analytic_acc_obj.create({'name': vals['name'], - 'type': 'project', - 'date': datetime.now(), - 'project_id': rec_id}) - analytic_accs = analytic_acc_obj.search([('type', '=', 'project')], - order='partner_id', limit=1) - analytic_accs.write({'partner_id': 1}) - return rec_id - - def copy(self, default): - default['name'] = self.name + " (copia)" - return super(CrmLead, self).copy(default) - - def search(self, domain): - return {1: {''}, 2: {} } - - @api.one - def unlink(self): - if self.state in ('to_invoice', 'done'): - raise exceptions.Warning('No se puede borrar un pedido confirmado.') - super(CrmLead, self).unlink() - return True - - def write(self, vals): - if vals.get('state') == 'won': - for record in self: - if not record.code and not vals.get('code'): - raise exceptions.Warning('Debe poner un código cuando la etapa se pasa a ganado.') - return super(CrmLead, self).write(vals) diff --git a/account_payment_partner/models/account_invoice.py b/account_payment_partner/models/account_invoice.py index 1c2428eb6..9c95f4cda 100644 --- a/account_payment_partner/models/account_invoice.py +++ b/account_payment_partner/models/account_invoice.py @@ -26,8 +26,6 @@ from openerp import models, fields, api class AccountInvoice(models.Model): _inherit = 'account.invoice' - type = fields.Selection('out', 'in') - payment_mode_id = fields.Many2one('payment.mode', string="Payment Mode", domain="[('type', '=', type)]") diff --git a/account_payment_partner/views/account_invoice.xml b/account_payment_partner/views/account_invoice.xml deleted file mode 100644 index 0bfd2d1f5..000000000 --- a/account_payment_partner/views/account_invoice.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - account_payment_partner.invoice_form - account.invoice - - - - - - - - - - - account_payment_partner.invoice_supplier_form - account.invoice - - - - - - - - - - - diff --git a/account_payment_partner/views/partner.xml b/account_payment_partner/views/partner.xml deleted file mode 100644 index 02eb8cc0f..000000000 --- a/account_payment_partner/views/partner.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - account_partner_payment.partner_form - res.partner - - - - - - - - - - - - - - From 5daf7f6b57cb97d1b9bb5fa61304e93c831baa35 Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Wed, 8 Oct 2014 03:34:21 +0200 Subject: [PATCH 12/66] [ADD] account_banking_mandate, spliting functionality in two modules --- account_payment_partner/i18n/fr.po | 57 ++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 account_payment_partner/i18n/fr.po diff --git a/account_payment_partner/i18n/fr.po b/account_payment_partner/i18n/fr.po new file mode 100644 index 000000000..ca26e532d --- /dev/null +++ b/account_payment_partner/i18n/fr.po @@ -0,0 +1,57 @@ +# Translation of OpenERP Server. +# This file contains the translation of the following modules: +# * account_payment_partner +# +msgid "" +msgstr "" +"Project-Id-Version: OpenERP Server 7.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-06-09 23:22+0000\n" +"PO-Revision-Date: 2014-06-09 23:22+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_partner +#: field:res.partner,customer_payment_mode:0 +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_res_partner +msgid "Partner" +msgstr "" + +#. module: account_payment_partner +#: field:account.invoice,payment_mode_id:0 +msgid "Payment Mode" +msgstr "" + +#. module: account_payment_partner +#: help:res.partner,customer_payment_mode:0 +msgid "Select the default payment mode for this customer." +msgstr "" + +#. module: account_payment_partner +#: help:res.partner,supplier_payment_mode:0 +msgid "Select the default payment mode for this supplier." +msgstr "" + +#. module: account_payment_partner +#: field:res.partner,supplier_payment_mode:0 +msgid "Supplier Payment Mode" +msgstr "" + +#. module: account_payment_partner +#: model:ir.model,name:account_payment_partner.model_payment_order_create +msgid "payment.order.create" +msgstr "" + From 6e9df4c33df57610d70e180d70ee2534019e308f Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Wed, 15 Oct 2014 01:24:09 +0200 Subject: [PATCH 13/66] [DEL] Remove unused files --- account_payment_partner/models/partner.py | 44 ----------------------- 1 file changed, 44 deletions(-) delete mode 100644 account_payment_partner/models/partner.py diff --git a/account_payment_partner/models/partner.py b/account_payment_partner/models/partner.py deleted file mode 100644 index 4bfe4c787..000000000 --- a/account_payment_partner/models/partner.py +++ /dev/null @@ -1,44 +0,0 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# -# Account Payment Partner 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 . -# -############################################################################## - -from openerp.osv import orm, fields - - -class res_partner(orm.Model): - _inherit = 'res.partner' - - _columns = { - 'supplier_payment_mode': fields.property( - 'payment.mode', type='many2one', relation='payment.mode', - string='Supplier Payment Mode', view_load=True, - help="Select the default payment mode for this supplier."), - 'customer_payment_mode': fields.property( - 'payment.mode', type='many2one', relation='payment.mode', - string='Customer Payment Mode', view_load=True, - help="Select the default payment mode for this customer."), - } - - def _commercial_fields(self, cr, uid, context=None): - res = super(res_partner, self)._commercial_fields( - cr, uid, context=context) - res += ['supplier_payment_mode', 'customer_payment_mode'] - return res From 4d39ed58201834648bc5d3405f6283194da4d022 Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Tue, 21 Oct 2014 09:51:40 +0200 Subject: [PATCH 14/66] [FIX] Uncaught flake8 errors --- account_payment_partner/models/payment_order_create.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/account_payment_partner/models/payment_order_create.py b/account_payment_partner/models/payment_order_create.py index ea8b1ccb3..3b9b536a7 100644 --- a/account_payment_partner/models/payment_order_create.py +++ b/account_payment_partner/models/payment_order_create.py @@ -23,17 +23,16 @@ from openerp.osv import orm -class payment_order_create(orm.TransientModel): +class PaymentOrderCreate(orm.TransientModel): _inherit = 'payment.order.create' def extend_payment_order_domain( self, cr, uid, payment_order, domain, context=None): - super(payment_order_create, self).extend_payment_order_domain( + super(PaymentOrderCreate, self).extend_payment_order_domain( cr, uid, payment_order, domain, context=context) domain += [ '|', '|', ('invoice', '=', False), ('invoice.payment_mode_id', '=', False), - ('invoice.payment_mode_id', '=', payment_order.mode.id) - ] + ('invoice.payment_mode_id', '=', payment_order.mode.id)] return True From 1019d61282c0311c7f04c9bf42548c8d6e31ae39 Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Fri, 31 Oct 2014 23:54:24 +0100 Subject: [PATCH 15/66] [FIX] account_payment_sale_stock: Split for removing stock dependency on sale [DEL] Remove old translations templates [IMP] More reorder on folder structure --- .../i18n/account_payment_partner.pot | 57 ------------------- .../models/account_invoice.py | 5 +- account_payment_partner/models/res_partner.py | 6 +- .../views/account_invoice_view.xml | 4 +- 4 files changed, 9 insertions(+), 63 deletions(-) delete mode 100644 account_payment_partner/i18n/account_payment_partner.pot diff --git a/account_payment_partner/i18n/account_payment_partner.pot b/account_payment_partner/i18n/account_payment_partner.pot deleted file mode 100644 index ca26e532d..000000000 --- a/account_payment_partner/i18n/account_payment_partner.pot +++ /dev/null @@ -1,57 +0,0 @@ -# Translation of OpenERP Server. -# This file contains the translation of the following modules: -# * account_payment_partner -# -msgid "" -msgstr "" -"Project-Id-Version: OpenERP Server 7.0\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-06-09 23:22+0000\n" -"PO-Revision-Date: 2014-06-09 23:22+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_partner -#: field:res.partner,customer_payment_mode:0 -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_res_partner -msgid "Partner" -msgstr "" - -#. module: account_payment_partner -#: field:account.invoice,payment_mode_id:0 -msgid "Payment Mode" -msgstr "" - -#. module: account_payment_partner -#: help:res.partner,customer_payment_mode:0 -msgid "Select the default payment mode for this customer." -msgstr "" - -#. module: account_payment_partner -#: help:res.partner,supplier_payment_mode:0 -msgid "Select the default payment mode for this supplier." -msgstr "" - -#. module: account_payment_partner -#: field:res.partner,supplier_payment_mode:0 -msgid "Supplier Payment Mode" -msgstr "" - -#. module: account_payment_partner -#: model:ir.model,name:account_payment_partner.model_payment_order_create -msgid "payment.order.create" -msgstr "" - diff --git a/account_payment_partner/models/account_invoice.py b/account_payment_partner/models/account_invoice.py index 9c95f4cda..e14c0d956 100644 --- a/account_payment_partner/models/account_invoice.py +++ b/account_payment_partner/models/account_invoice.py @@ -26,8 +26,9 @@ from openerp import models, fields, api class AccountInvoice(models.Model): _inherit = 'account.invoice' - payment_mode_id = fields.Many2one('payment.mode', string="Payment Mode", - domain="[('type', '=', type)]") + payment_mode_id = fields.Many2one( + comodel_name='payment.mode', string="Payment Mode", + domain="[('type', '=', type)]") @api.multi def onchange_partner_id( diff --git a/account_payment_partner/models/res_partner.py b/account_payment_partner/models/res_partner.py index c8762f7d5..d5dded203 100644 --- a/account_payment_partner/models/res_partner.py +++ b/account_payment_partner/models/res_partner.py @@ -28,11 +28,13 @@ class ResPartner(models.Model): supplier_payment_mode = fields.Many2one( 'payment.mode', string='Supplier Payment Mode', company_dependent=True, - domain="[('payment_order_type', '=', 'payment')]", + domain="['|', ('payment_order_type', '=', 'payment'), " + "('payment_order_type', '=', 'both')]", help="Select the default payment mode for this supplier.") customer_payment_mode = fields.Many2one( 'payment.mode', string='Customer Payment Mode', company_dependent=True, - domain="[('payment_order_type', '=', 'debit')]", + domain="['|', ('payment_order_type', '=', 'debit'), " + "('payment_order_type', '=', 'both')]", help="Select the default payment mode for this customer.") @api.model diff --git a/account_payment_partner/views/account_invoice_view.xml b/account_payment_partner/views/account_invoice_view.xml index f4805fa89..aabddcd49 100644 --- a/account_payment_partner/views/account_invoice_view.xml +++ b/account_payment_partner/views/account_invoice_view.xml @@ -17,7 +17,7 @@ + domain="['|', ('payment_order_type', '=', 'debit'), ('payment_order_type', '=', 'both')]"/> @@ -30,7 +30,7 @@ + domain="['|', ('payment_order_type', '=', 'payment'), ('payment_order_type', '=', 'both')]"/> From 6ac57a9473d5a690d6f5b792409d962ddf4e5fa7 Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Sat, 1 Nov 2014 01:48:26 +0100 Subject: [PATCH 16/66] [IMP] Translation template files [IMP] Translations to spanish --- .../i18n/account_payment_partner.pot | 52 +++++++++++++++++++ account_payment_partner/i18n/es.po | 52 +++++++++++++++++++ 2 files changed, 104 insertions(+) create mode 100644 account_payment_partner/i18n/account_payment_partner.pot create mode 100644 account_payment_partner/i18n/es.po diff --git a/account_payment_partner/i18n/account_payment_partner.pot b/account_payment_partner/i18n/account_payment_partner.pot new file mode 100644 index 000000000..3c5a39686 --- /dev/null +++ b/account_payment_partner/i18n/account_payment_partner.pot @@ -0,0 +1,52 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_payment_partner +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 8.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-10-31 22:53+0000\n" +"PO-Revision-Date: 2014-10-31 22:53+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_partner +#: field:res.partner,customer_payment_mode:0 +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_res_partner +msgid "Partner" +msgstr "" + +#. module: account_payment_partner +#: field:account.invoice,payment_mode_id:0 +msgid "Payment Mode" +msgstr "" + +#. module: account_payment_partner +#: help:res.partner,customer_payment_mode:0 +msgid "Select the default payment mode for this customer." +msgstr "" + +#. module: account_payment_partner +#: help:res.partner,supplier_payment_mode:0 +msgid "Select the default payment mode for this supplier." +msgstr "" + +#. module: account_payment_partner +#: field:res.partner,supplier_payment_mode:0 +msgid "Supplier Payment Mode" +msgstr "" + diff --git a/account_payment_partner/i18n/es.po b/account_payment_partner/i18n/es.po new file mode 100644 index 000000000..63748b988 --- /dev/null +++ b/account_payment_partner/i18n/es.po @@ -0,0 +1,52 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_payment_partner +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 8.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-10-31 22:53+0000\n" +"PO-Revision-Date: 2014-10-31 22:53+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_partner +#: field:res.partner,customer_payment_mode:0 +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_res_partner +msgid "Partner" +msgstr "Empresa" + +#. module: account_payment_partner +#: field:account.invoice,payment_mode_id:0 +msgid "Payment Mode" +msgstr "Modo de pago" + +#. module: account_payment_partner +#: help:res.partner,customer_payment_mode:0 +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 +#: help:res.partner,supplier_payment_mode:0 +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 +#: field:res.partner,supplier_payment_mode:0 +msgid "Supplier Payment Mode" +msgstr "Modo de pago de proveedor" + From 32315dd39c7dc7ad9444a5dc5e01a3f7407657b4 Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Fri, 7 Nov 2014 23:00:34 +0100 Subject: [PATCH 17/66] Use sale_ok and purchase_ok instead of tweaking payment type --- account_payment_partner/models/res_partner.py | 6 ++---- account_payment_partner/views/account_invoice_view.xml | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/account_payment_partner/models/res_partner.py b/account_payment_partner/models/res_partner.py index d5dded203..5726da446 100644 --- a/account_payment_partner/models/res_partner.py +++ b/account_payment_partner/models/res_partner.py @@ -28,13 +28,11 @@ class ResPartner(models.Model): supplier_payment_mode = fields.Many2one( 'payment.mode', string='Supplier Payment Mode', company_dependent=True, - domain="['|', ('payment_order_type', '=', 'payment'), " - "('payment_order_type', '=', 'both')]", + domain="[('purchase_ok', '=', True)]", help="Select the default payment mode for this supplier.") customer_payment_mode = fields.Many2one( 'payment.mode', string='Customer Payment Mode', company_dependent=True, - domain="['|', ('payment_order_type', '=', 'debit'), " - "('payment_order_type', '=', 'both')]", + domain="[('sale_ok', '=', True)]", help="Select the default payment mode for this customer.") @api.model diff --git a/account_payment_partner/views/account_invoice_view.xml b/account_payment_partner/views/account_invoice_view.xml index aabddcd49..534822ea9 100644 --- a/account_payment_partner/views/account_invoice_view.xml +++ b/account_payment_partner/views/account_invoice_view.xml @@ -17,7 +17,7 @@ + domain="[('sale_ok', '=', True)]"/> @@ -30,7 +30,7 @@ + domain="[('purchase_ok', '=', True)]"/> From 5171cc16128c27202fd8fb773950f0aab532aacb Mon Sep 17 00:00:00 2001 From: Roberto Lizana Date: Thu, 27 Nov 2014 12:55:21 +0100 Subject: [PATCH 18/66] [IMP] Add filter group by payment mode in account invoices --- .../views/account_invoice_view.xml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/account_payment_partner/views/account_invoice_view.xml b/account_payment_partner/views/account_invoice_view.xml index 534822ea9..46b3437fd 100644 --- a/account_payment_partner/views/account_invoice_view.xml +++ b/account_payment_partner/views/account_invoice_view.xml @@ -9,6 +9,18 @@ + + account_payment_partner.invoice_filter + account.invoice + search + + + + + + + + account_payment_partner.invoice_form From 471632af81bc9680f80bd8cd7074f3d2397d20f6 Mon Sep 17 00:00:00 2001 From: Roberto Lizana Date: Thu, 8 Jan 2015 18:25:36 +0100 Subject: [PATCH 19/66] [FIX] Remove deprecated tag type --- account_payment_partner/views/account_invoice_view.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/account_payment_partner/views/account_invoice_view.xml b/account_payment_partner/views/account_invoice_view.xml index 46b3437fd..5655e3d25 100644 --- a/account_payment_partner/views/account_invoice_view.xml +++ b/account_payment_partner/views/account_invoice_view.xml @@ -12,7 +12,6 @@ account_payment_partner.invoice_filter account.invoice - search From 19529293bdb62cc6cae9ce50ee22238106d7de45 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Wed, 14 Jan 2015 15:25:50 +0100 Subject: [PATCH 20/66] account_payment_partner : move unused file + cleanup code --- .../models/payment_order_create.py | 38 ------------------- .../wizard/payment_order_create.py | 4 +- 2 files changed, 2 insertions(+), 40 deletions(-) delete mode 100644 account_payment_partner/models/payment_order_create.py diff --git a/account_payment_partner/models/payment_order_create.py b/account_payment_partner/models/payment_order_create.py deleted file mode 100644 index 3b9b536a7..000000000 --- a/account_payment_partner/models/payment_order_create.py +++ /dev/null @@ -1,38 +0,0 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# -# Account Payment Partner 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 . -# -############################################################################## - -from openerp.osv import orm - - -class PaymentOrderCreate(orm.TransientModel): - _inherit = 'payment.order.create' - - def extend_payment_order_domain( - self, cr, uid, payment_order, domain, context=None): - super(PaymentOrderCreate, self).extend_payment_order_domain( - cr, uid, payment_order, domain, context=context) - domain += [ - '|', '|', - ('invoice', '=', False), - ('invoice.payment_mode_id', '=', False), - ('invoice.payment_mode_id', '=', payment_order.mode.id)] - return True diff --git a/account_payment_partner/wizard/payment_order_create.py b/account_payment_partner/wizard/payment_order_create.py index c26b7f9d9..fdc7bdb49 100644 --- a/account_payment_partner/wizard/payment_order_create.py +++ b/account_payment_partner/wizard/payment_order_create.py @@ -28,10 +28,10 @@ class PaymentOrderCreate(models.TransientModel): @api.model def extend_payment_order_domain(self, payment_order, domain): - res = super(PaymentOrderCreate, self).extend_payment_order_domain( + super(PaymentOrderCreate, self).extend_payment_order_domain( payment_order, domain) domain += ['|', '|', ('invoice', '=', False), ('invoice.payment_mode_id', '=', False), ('invoice.payment_mode_id', '=', payment_order.mode.id)] - return res + return True From b404d02595d2d97b49b32ad21045254f163276db Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Mon, 19 Jan 2015 22:52:38 +0100 Subject: [PATCH 21/66] Add sale_ok and purchase_ok filters in partner/sale/purchase form views Use widget=selection for payment_mode_id fields Update demo data --- account_payment_partner/views/account_invoice_view.xml | 6 ++++-- account_payment_partner/views/res_partner_view.xml | 8 ++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/account_payment_partner/views/account_invoice_view.xml b/account_payment_partner/views/account_invoice_view.xml index 5655e3d25..72afbb2a5 100644 --- a/account_payment_partner/views/account_invoice_view.xml +++ b/account_payment_partner/views/account_invoice_view.xml @@ -28,7 +28,8 @@ + domain="[('sale_ok', '=', True)]" + widget="selection"/> @@ -41,7 +42,8 @@ + domain="[('purchase_ok', '=', True)]" + widget="selection"/> diff --git a/account_payment_partner/views/res_partner_view.xml b/account_payment_partner/views/res_partner_view.xml index 3c6d670aa..f52579b2c 100644 --- a/account_payment_partner/views/res_partner_view.xml +++ b/account_payment_partner/views/res_partner_view.xml @@ -15,10 +15,14 @@ - + - + From c5bdb0c682ab17d54c1a57790c13504f5d6393c7 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Mon, 19 Jan 2015 22:58:36 +0100 Subject: [PATCH 22/66] Return res in inherit (even if res is empty in this case) --- account_payment_partner/wizard/payment_order_create.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/account_payment_partner/wizard/payment_order_create.py b/account_payment_partner/wizard/payment_order_create.py index fdc7bdb49..c26b7f9d9 100644 --- a/account_payment_partner/wizard/payment_order_create.py +++ b/account_payment_partner/wizard/payment_order_create.py @@ -28,10 +28,10 @@ class PaymentOrderCreate(models.TransientModel): @api.model def extend_payment_order_domain(self, payment_order, domain): - super(PaymentOrderCreate, self).extend_payment_order_domain( + res = super(PaymentOrderCreate, self).extend_payment_order_domain( payment_order, domain) domain += ['|', '|', ('invoice', '=', False), ('invoice.payment_mode_id', '=', False), ('invoice.payment_mode_id', '=', payment_order.mode.id)] - return True + return res From a1e4bc46632b9d686b5e6be40d305237b3f8c4bb Mon Sep 17 00:00:00 2001 From: Danimar Ribeiro Date: Fri, 13 Feb 2015 19:18:41 -0200 Subject: [PATCH 23/66] Portuguese translations --- account_payment_partner/i18n/pt_BR.po | 52 +++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 account_payment_partner/i18n/pt_BR.po diff --git a/account_payment_partner/i18n/pt_BR.po b/account_payment_partner/i18n/pt_BR.po new file mode 100644 index 000000000..63cd2737f --- /dev/null +++ b/account_payment_partner/i18n/pt_BR.po @@ -0,0 +1,52 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_payment_partner +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 8.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-10-31 22:53+0000\n" +"PO-Revision-Date: 2014-10-31 22:53+0000\n" +"Last-Translator: Danimar Ribeiro \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_partner +#: field:res.partner,customer_payment_mode:0 +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_res_partner +msgid "Partner" +msgstr "Parceiro" + +#. module: account_payment_partner +#: field:account.invoice,payment_mode_id:0 +msgid "Payment Mode" +msgstr "Modo de Pagamento" + +#. module: account_payment_partner +#: help:res.partner,customer_payment_mode:0 +msgid "Select the default payment mode for this customer." +msgstr "Selecione o modo de pagamento padrão para este cliente." + +#. module: account_payment_partner +#: help:res.partner,supplier_payment_mode:0 +msgid "Select the default payment mode for this supplier." +msgstr "Selecione o modo de pagamento padrão para este fornecedor." + +#. module: account_payment_partner +#: field:res.partner,supplier_payment_mode:0 +msgid "Supplier Payment Mode" +msgstr "Modo de Pagamento do Fornecedor" + From fdb64de300de00590c4afd87a02ea2e9442af831 Mon Sep 17 00:00:00 2001 From: Alexandre Fayolle Date: Mon, 2 Mar 2015 17:23:15 +0100 Subject: [PATCH 24/66] Add OCA as author of OCA addons In order to get visibility on https://www.odoo.com/apps the OCA board has decided to add the OCA as author of all the addons maintained as part of the association. --- account_payment_partner/__openerp__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/account_payment_partner/__openerp__.py b/account_payment_partner/__openerp__.py index 3f3a51f3f..b29da03c6 100644 --- a/account_payment_partner/__openerp__.py +++ b/account_payment_partner/__openerp__.py @@ -40,7 +40,7 @@ This module adds severals fields : On a Payment Order, in the wizard *Select Invoices to Pay*, the invoices will be filtered per Payment Mode. """, - 'author': 'Akretion', + 'author': "Akretion,Odoo Community Association (OCA)", 'website': 'http://www.akretion.com', 'contributors': ['Pedro M. Baeza '], 'depends': ['account_banking_payment_export'], From 6bca4a2093c63153f155b0c4e578bcfa63c4a0f1 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Mon, 16 Mar 2015 11:07:21 +0100 Subject: [PATCH 25/66] Add read access on payment.mode to employees --- account_payment_partner/__openerp__.py | 1 + account_payment_partner/security/ir.model.access.csv | 2 ++ 2 files changed, 3 insertions(+) create mode 100644 account_payment_partner/security/ir.model.access.csv diff --git a/account_payment_partner/__openerp__.py b/account_payment_partner/__openerp__.py index b29da03c6..e8f71a2de 100644 --- a/account_payment_partner/__openerp__.py +++ b/account_payment_partner/__openerp__.py @@ -47,6 +47,7 @@ be filtered per Payment Mode. 'data': [ 'views/res_partner_view.xml', 'views/account_invoice_view.xml', + 'security/ir.model.access.csv', ], 'demo': ['demo/partner_demo.xml'], 'installable': True, diff --git a/account_payment_partner/security/ir.model.access.csv b/account_payment_partner/security/ir.model.access.csv new file mode 100644 index 000000000..b277f0229 --- /dev/null +++ b/account_payment_partner/security/ir.model.access.csv @@ -0,0 +1,2 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_payment_mode_read,Read access on payment.mode to Employees,account_payment.model_payment_mode,base.group_user,1,0,0,0 From f3f3fa79df4051416001d84906147fc88c45fceb Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Mon, 9 Mar 2015 09:15:19 +0100 Subject: [PATCH 26/66] [FIX] account_payment_partner: Fix for finding account move lines without invoice (manual entries in receivables/payables) --- .../wizard/payment_order_create.py | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/account_payment_partner/wizard/payment_order_create.py b/account_payment_partner/wizard/payment_order_create.py index c26b7f9d9..a07ed280e 100644 --- a/account_payment_partner/wizard/payment_order_create.py +++ b/account_payment_partner/wizard/payment_order_create.py @@ -30,8 +30,29 @@ class PaymentOrderCreate(models.TransientModel): def extend_payment_order_domain(self, payment_order, domain): res = super(PaymentOrderCreate, self).extend_payment_order_domain( payment_order, domain) - domain += ['|', '|', - ('invoice', '=', False), + # Monkey patch for fixing problem with the core search function + # when args has ('invoice', '=', False), referred in the issue #4857 + # (https://github.com/odoo/odoo/issues/4857) + # + # Original domain: + # domain += ['|', '|', + # ('invoice', '=', False), + # ('invoice.payment_mode_id', '=', False), + # ('invoice.payment_mode_id', '=', payment_order.mode.id)] + self.env.cr.execute( + "SELECT l.id " + "FROM account_move_line l " + "LEFT OUTER JOIN account_invoice i " + "ON l.move_id = i.move_id " + "INNER JOIN account_account a " + "ON a.id = l.account_id " + "WHERE i.id IS NULL" + " AND l.reconcile_id IS NULL" + " AND a.type in ('receivable', 'payable')") + ids = [x[0] for x in self.env.cr.fetchall()] + domain += ['|', + ('id', 'in', ids), + '|', ('invoice.payment_mode_id', '=', False), ('invoice.payment_mode_id', '=', payment_order.mode.id)] return res From 4a1974e34d8ab8c3325cbacfc79a79f907d5a388 Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Mon, 25 May 2015 17:14:05 +0200 Subject: [PATCH 27/66] [IMP] Expand authors + manifest cleaning --- account_payment_partner/__openerp__.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/account_payment_partner/__openerp__.py b/account_payment_partner/__openerp__.py index e8f71a2de..4c334eb65 100644 --- a/account_payment_partner/__openerp__.py +++ b/account_payment_partner/__openerp__.py @@ -40,9 +40,10 @@ This module adds severals fields : On a Payment Order, in the wizard *Select Invoices to Pay*, the invoices will be filtered per Payment Mode. """, - 'author': "Akretion,Odoo Community Association (OCA)", - 'website': 'http://www.akretion.com', - 'contributors': ['Pedro M. Baeza '], + 'author': "Akretion, " + "Serv. Tecnol. Avanzados - Pedro M. Baeza, " + "Odoo Community Association (OCA)", + 'website': 'https://github.com/OCA/bank-payment', 'depends': ['account_banking_payment_export'], 'data': [ 'views/res_partner_view.xml', From 2edd9c2bcaa3594d6ca202f5ea66a0a67a6444c7 Mon Sep 17 00:00:00 2001 From: Philippe Schmidt Date: Mon, 1 Jun 2015 17:10:58 +0200 Subject: [PATCH 28/66] Add requested descriptions in an OCA README.rst file --- account_payment_partner/README.rst | 79 ++++++++++++++++++++++++++ account_payment_partner/__openerp__.py | 13 ----- 2 files changed, 79 insertions(+), 13 deletions(-) create mode 100644 account_payment_partner/README.rst diff --git a/account_payment_partner/README.rst b/account_payment_partner/README.rst new file mode 100644 index 000000000..278777864 --- /dev/null +++ b/account_payment_partner/README.rst @@ -0,0 +1,79 @@ +.. 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_banking_payment_export + +This modules are parts 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. + +For further information, please visit: + + * https://www.odoo.com/forum/help-1 + +Known issues / Roadmap +====================== + + * ... + +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 `_. + +Credits +======= + +Contributors +------------ + +* Pedro M. Baeza +* Alexis de Lattre +* Raphaël Valyi +* Stefan Rijnhart (Therp) +* Alexandre Fayolle +* Stéphane Bidoul +* Danimar Ribeiro + +Maintainer +---------- + +.. image:: http://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: http://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 http://odoo-community.org. diff --git a/account_payment_partner/__openerp__.py b/account_payment_partner/__openerp__.py index 4c334eb65..f62c4cca6 100644 --- a/account_payment_partner/__openerp__.py +++ b/account_payment_partner/__openerp__.py @@ -27,19 +27,6 @@ 'category': 'Banking addons', 'license': 'AGPL-3', 'summary': 'Adds payment mode on partners and invoices', - 'description': """ -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. - """, 'author': "Akretion, " "Serv. Tecnol. Avanzados - Pedro M. Baeza, " "Odoo Community Association (OCA)", From 4e2c4e6baf55d06694e97981e1224f0e13b3a8ac Mon Sep 17 00:00:00 2001 From: Philippe Schmidt Date: Fri, 5 Jun 2015 12:31:00 +0200 Subject: [PATCH 29/66] some typo corrections --- account_payment_partner/README.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/account_payment_partner/README.rst b/account_payment_partner/README.rst index 278777864..e4e4d0a52 100644 --- a/account_payment_partner/README.rst +++ b/account_payment_partner/README.rst @@ -19,7 +19,7 @@ Installation This module depends on : * account_banking_payment_export -This modules are parts of the OCA/bank-payment suite. +This module is part of the OCA/bank-payment suite. Configuration ============= @@ -41,7 +41,7 @@ For further information, please visit: Known issues / Roadmap ====================== - * ... + * No known issues. Bug Tracker =========== From b8728058c964b9418b3cbdf4a2da7ac1f3e87b84 Mon Sep 17 00:00:00 2001 From: AngelMoya-Domatix Date: Thu, 2 Jul 2015 12:58:05 +0200 Subject: [PATCH 30/66] ADD description on payment mode and show it on invoice report FIX tabs FIX translate --- account_payment_partner/README.rst | 1 + account_payment_partner/__openerp__.py | 1 + .../i18n/account_payment_partner.pot | 14 ++++++++++++-- account_payment_partner/i18n/es.po | 14 ++++++++++++-- .../views/report_invoice.xml | 17 +++++++++++++++++ 5 files changed, 43 insertions(+), 4 deletions(-) create mode 100644 account_payment_partner/views/report_invoice.xml diff --git a/account_payment_partner/README.rst b/account_payment_partner/README.rst index e4e4d0a52..2837e36a1 100644 --- a/account_payment_partner/README.rst +++ b/account_payment_partner/README.rst @@ -64,6 +64,7 @@ Contributors * Alexandre Fayolle * Stéphane Bidoul * Danimar Ribeiro +* Angel Moya Maintainer ---------- diff --git a/account_payment_partner/__openerp__.py b/account_payment_partner/__openerp__.py index f62c4cca6..949c9791e 100644 --- a/account_payment_partner/__openerp__.py +++ b/account_payment_partner/__openerp__.py @@ -35,6 +35,7 @@ 'data': [ 'views/res_partner_view.xml', 'views/account_invoice_view.xml', + 'views/report_invoice.xml', 'security/ir.model.access.csv', ], 'demo': ['demo/partner_demo.xml'], diff --git a/account_payment_partner/i18n/account_payment_partner.pot b/account_payment_partner/i18n/account_payment_partner.pot index 3c5a39686..82c70d780 100644 --- a/account_payment_partner/i18n/account_payment_partner.pot +++ b/account_payment_partner/i18n/account_payment_partner.pot @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 8.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-10-31 22:53+0000\n" -"PO-Revision-Date: 2014-10-31 22:53+0000\n" +"POT-Creation-Date: 2015-07-02 10:53+0000\n" +"PO-Revision-Date: 2015-07-02 10:53+0000\n" "Last-Translator: <>\n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -15,6 +15,11 @@ msgstr "" "Content-Transfer-Encoding: \n" "Plural-Forms: \n" +#. module: account_payment_partner +#: view:website:account.report_invoice_document +msgid "Bank Account:" +msgstr "" + #. module: account_payment_partner #: field:res.partner,customer_payment_mode:0 msgid "Customer Payment Mode" @@ -35,6 +40,11 @@ msgstr "" msgid "Payment Mode" msgstr "" +#. module: account_payment_partner +#: view:website:account.report_invoice_document +msgid "Payment Mode:" +msgstr "" + #. module: account_payment_partner #: help:res.partner,customer_payment_mode:0 msgid "Select the default payment mode for this customer." diff --git a/account_payment_partner/i18n/es.po b/account_payment_partner/i18n/es.po index 63748b988..8d9b6b91a 100644 --- a/account_payment_partner/i18n/es.po +++ b/account_payment_partner/i18n/es.po @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 8.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-10-31 22:53+0000\n" -"PO-Revision-Date: 2014-10-31 22:53+0000\n" +"POT-Creation-Date: 2015-07-02 10:55+0000\n" +"PO-Revision-Date: 2015-07-02 10:55+0000\n" "Last-Translator: <>\n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -15,6 +15,11 @@ msgstr "" "Content-Transfer-Encoding: \n" "Plural-Forms: \n" +#. module: account_payment_partner +#: view:website:account.report_invoice_document +msgid "Bank Account:" +msgstr "Cuenta bancaria:" + #. module: account_payment_partner #: field:res.partner,customer_payment_mode:0 msgid "Customer Payment Mode" @@ -35,6 +40,11 @@ msgstr "Empresa" msgid "Payment Mode" msgstr "Modo de pago" +#. module: account_payment_partner +#: view:website:account.report_invoice_document +msgid "Payment Mode:" +msgstr "Modo de pago:" + #. module: account_payment_partner #: help:res.partner,customer_payment_mode:0 msgid "Select the default payment mode for this customer." diff --git a/account_payment_partner/views/report_invoice.xml b/account_payment_partner/views/report_invoice.xml new file mode 100644 index 000000000..356ec1d4d --- /dev/null +++ b/account_payment_partner/views/report_invoice.xml @@ -0,0 +1,17 @@ + + + + + + From 662cd4be6995dbbc44d74193a72f440df26fbc94 Mon Sep 17 00:00:00 2001 From: Holger Brunn Date: Wed, 8 Jul 2015 14:55:31 +0200 Subject: [PATCH 31/66] [RFR] decorate overridable methods in wizard as api.multi --- account_payment_partner/wizard/payment_order_create.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/account_payment_partner/wizard/payment_order_create.py b/account_payment_partner/wizard/payment_order_create.py index a07ed280e..442047610 100644 --- a/account_payment_partner/wizard/payment_order_create.py +++ b/account_payment_partner/wizard/payment_order_create.py @@ -26,7 +26,7 @@ from openerp import models, api class PaymentOrderCreate(models.TransientModel): _inherit = 'payment.order.create' - @api.model + @api.multi def extend_payment_order_domain(self, payment_order, domain): res = super(PaymentOrderCreate, self).extend_payment_order_domain( payment_order, domain) From 52ac4c89b91ff5e7e4b6cf069c45c9a6dc16e0a2 Mon Sep 17 00:00:00 2001 From: Yannick Vaucher Date: Tue, 18 Aug 2015 11:10:50 +0200 Subject: [PATCH 32/66] Add missing default oca icons --- .../static/description/icon.png | Bin 0 -> 9455 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 account_payment_partner/static/description/icon.png diff --git a/account_payment_partner/static/description/icon.png b/account_payment_partner/static/description/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..3a0328b516c4980e8e44cdb63fd945757ddd132d GIT binary patch literal 9455 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 z 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 Xviia!U7SGha1wx#SCgwmn*{w2TRX*I literal 0 HcmV?d00001 From 6507db9aed8639fc5313550110b9cfa98c9a5597 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul?= Date: Fri, 9 Oct 2015 09:59:34 +0200 Subject: [PATCH 33/66] [UPD] prefix versions with 8.0 --- account_payment_partner/__openerp__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/account_payment_partner/__openerp__.py b/account_payment_partner/__openerp__.py index 949c9791e..ef8b028ce 100644 --- a/account_payment_partner/__openerp__.py +++ b/account_payment_partner/__openerp__.py @@ -23,7 +23,7 @@ { 'name': 'Account Payment Partner', - 'version': '0.1', + 'version': '8.0.0.1.0', 'category': 'Banking addons', 'license': 'AGPL-3', 'summary': 'Adds payment mode on partners and invoices', From 434f843785b18ae7091d01d848f6d996d6246909 Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Wed, 14 Oct 2015 03:03:12 +0200 Subject: [PATCH 34/66] [MIG] Make modules uninstallable --- account_payment_partner/__openerp__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/account_payment_partner/__openerp__.py b/account_payment_partner/__openerp__.py index ef8b028ce..a22c1b479 100644 --- a/account_payment_partner/__openerp__.py +++ b/account_payment_partner/__openerp__.py @@ -39,5 +39,5 @@ 'security/ir.model.access.csv', ], 'demo': ['demo/partner_demo.xml'], - 'installable': True, + 'installable': False, } From 40a114d71f27c402b3f80e461eabb4a340c6ecb2 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Mon, 19 Oct 2015 17:50:53 +0200 Subject: [PATCH 35/66] Forgot to remove a usecase of debit_denied Add ACL --- account_payment_partner/security/ir.model.access.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/account_payment_partner/security/ir.model.access.csv b/account_payment_partner/security/ir.model.access.csv index b277f0229..ac6d96dfd 100644 --- a/account_payment_partner/security/ir.model.access.csv +++ b/account_payment_partner/security/ir.model.access.csv @@ -1,2 +1,3 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink access_payment_mode_read,Read access on payment.mode to Employees,account_payment.model_payment_mode,base.group_user,1,0,0,0 +access_payment_mode_type_read,Read access on payment.mode.type to Employees,account_banking_payment_export.model_payment_mode_type,base.group_user,1,0,0,0 From b0f413a1b7cfdfabd88a56cda7f6172a251ea013 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Tue, 1 Dec 2015 16:39:58 +0100 Subject: [PATCH 36/66] Better filters on payment.order.create wizard Add default values for those filters on payment.mode --- account_payment_partner/__openerp__.py | 2 + account_payment_partner/models/__init__.py | 23 +------ .../models/payment_mode.py | 32 ++++++++++ .../views/payment_mode.xml | 20 +++++++ .../wizard/payment_order_create.py | 60 ++++++++++--------- .../wizard/payment_order_create_view.xml | 25 ++++++++ 6 files changed, 112 insertions(+), 50 deletions(-) create mode 100644 account_payment_partner/models/payment_mode.py create mode 100644 account_payment_partner/views/payment_mode.xml create mode 100644 account_payment_partner/wizard/payment_order_create_view.xml diff --git a/account_payment_partner/__openerp__.py b/account_payment_partner/__openerp__.py index a22c1b479..7344c9908 100644 --- a/account_payment_partner/__openerp__.py +++ b/account_payment_partner/__openerp__.py @@ -36,7 +36,9 @@ 'views/res_partner_view.xml', 'views/account_invoice_view.xml', 'views/report_invoice.xml', + 'views/payment_mode.xml', 'security/ir.model.access.csv', + 'wizard/payment_order_create_view.xml', ], 'demo': ['demo/partner_demo.xml'], 'installable': False, diff --git a/account_payment_partner/models/__init__.py b/account_payment_partner/models/__init__.py index c2c7b405d..be3f531bb 100644 --- a/account_payment_partner/models/__init__.py +++ b/account_payment_partner/models/__init__.py @@ -1,24 +1,5 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# -# Account Payment Partner 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 res_partner from . import account_invoice +from . import payment_mode diff --git a/account_payment_partner/models/payment_mode.py b/account_payment_partner/models/payment_mode.py new file mode 100644 index 000000000..a4cd31616 --- /dev/null +++ b/account_payment_partner/models/payment_mode.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Copyright (C) 2015 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 . +# +############################################################################## + +from openerp import models, fields + + +class PaymentMode(models.Model): + _inherit = "payment.mode" + + default_payment_mode = fields.Selection([ + ('same', 'Same'), + ('same_or_null', 'Same or empty'), + ('any', 'Any'), + ], string='Payment Mode on Invoice', default='same') diff --git a/account_payment_partner/views/payment_mode.xml b/account_payment_partner/views/payment_mode.xml new file mode 100644 index 000000000..120ca6970 --- /dev/null +++ b/account_payment_partner/views/payment_mode.xml @@ -0,0 +1,20 @@ + + + + + + + account_payment_partner.payment.mode.form + payment.mode + + + + + + + + + + + diff --git a/account_payment_partner/wizard/payment_order_create.py b/account_payment_partner/wizard/payment_order_create.py index 442047610..656ef9878 100644 --- a/account_payment_partner/wizard/payment_order_create.py +++ b/account_payment_partner/wizard/payment_order_create.py @@ -1,8 +1,8 @@ -# -*- encoding: utf-8 -*- +# -*- coding: utf-8 -*- ############################################################################## # -# Account Payment Partner module for OpenERP -# Copyright (C) 2014 Akretion (http://www.akretion.com) +# Account Payment Partner module for Odoo +# Copyright (C) 2014-2015 Akretion (http://www.akretion.com) # @author Alexis de Lattre # # This program is free software: you can redistribute it and/or modify @@ -20,39 +20,41 @@ # ############################################################################## -from openerp import models, api +from openerp import models, fields, api class PaymentOrderCreate(models.TransientModel): _inherit = 'payment.order.create' + payment_mode = fields.Selection([ + ('same', 'Same'), + ('same_or_null', 'Same or empty'), + ('any', 'Any'), + ], string='Payment Mode on Invoice', default='same') + + @api.model + def default_get(self, field_list): + res = super(PaymentOrderCreate, self).default_get(field_list) + context = self.env.context + assert context.get('active_model') == 'payment.order',\ + 'active_model should be payment.order' + assert context.get('active_id'), 'Missing active_id in context !' + pay_order = self.env['payment.order'].browse(context['active_id']) + res['payment_mode'] = pay_order.mode.default_payment_mode, + return res + @api.multi def extend_payment_order_domain(self, payment_order, domain): res = super(PaymentOrderCreate, self).extend_payment_order_domain( payment_order, domain) - # Monkey patch for fixing problem with the core search function - # when args has ('invoice', '=', False), referred in the issue #4857 - # (https://github.com/odoo/odoo/issues/4857) - # - # Original domain: - # domain += ['|', '|', - # ('invoice', '=', False), - # ('invoice.payment_mode_id', '=', False), - # ('invoice.payment_mode_id', '=', payment_order.mode.id)] - self.env.cr.execute( - "SELECT l.id " - "FROM account_move_line l " - "LEFT OUTER JOIN account_invoice i " - "ON l.move_id = i.move_id " - "INNER JOIN account_account a " - "ON a.id = l.account_id " - "WHERE i.id IS NULL" - " AND l.reconcile_id IS NULL" - " AND a.type in ('receivable', 'payable')") - ids = [x[0] for x in self.env.cr.fetchall()] - domain += ['|', - ('id', 'in', ids), - '|', - ('invoice.payment_mode_id', '=', False), - ('invoice.payment_mode_id', '=', payment_order.mode.id)] + if self.invoice and self.payment_mode: + if self.payment_mode == 'same': + domain.append( + ('invoice.payment_mode_id', '=', payment_order.mode.id)) + elif self.payment_mode == 'same_or_null': + domain += [ + '|', + ('invoice.payment_mode_id', '=', False), + ('invoice.payment_mode_id', '=', payment_order.mode.id)] + # if payment_mode == 'any', don't modify domain return res diff --git a/account_payment_partner/wizard/payment_order_create_view.xml b/account_payment_partner/wizard/payment_order_create_view.xml new file mode 100644 index 000000000..f163b8cd6 --- /dev/null +++ b/account_payment_partner/wizard/payment_order_create_view.xml @@ -0,0 +1,25 @@ + + + + + + + + account_payment_partner.payment.order.create.form + payment.order.create + + + + + + + + + + + From 3885b8e574f64934e9ee03afe8f10c126a1e3238 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Tue, 1 Dec 2015 17:05:15 +0100 Subject: [PATCH 37/66] FIX remove coma at end of line --- account_payment_partner/wizard/payment_order_create.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/account_payment_partner/wizard/payment_order_create.py b/account_payment_partner/wizard/payment_order_create.py index 656ef9878..fbf4939fb 100644 --- a/account_payment_partner/wizard/payment_order_create.py +++ b/account_payment_partner/wizard/payment_order_create.py @@ -30,7 +30,7 @@ class PaymentOrderCreate(models.TransientModel): ('same', 'Same'), ('same_or_null', 'Same or empty'), ('any', 'Any'), - ], string='Payment Mode on Invoice', default='same') + ], string='Payment Mode on Invoice') @api.model def default_get(self, field_list): @@ -40,7 +40,7 @@ class PaymentOrderCreate(models.TransientModel): 'active_model should be payment.order' assert context.get('active_id'), 'Missing active_id in context !' pay_order = self.env['payment.order'].browse(context['active_id']) - res['payment_mode'] = pay_order.mode.default_payment_mode, + res['payment_mode'] = pay_order.mode.default_payment_mode return res @api.multi From d0464ac6a5f51cdc34a9c29854b9850bfed894f7 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Wed, 27 Jan 2016 12:06:41 +0100 Subject: [PATCH 38/66] Add translatable 'label' field on payment.mode, designed to be used in invoice report --- account_payment_partner/models/payment_mode.py | 3 +++ account_payment_partner/views/payment_mode.xml | 3 +++ 2 files changed, 6 insertions(+) diff --git a/account_payment_partner/models/payment_mode.py b/account_payment_partner/models/payment_mode.py index a4cd31616..62b8767e6 100644 --- a/account_payment_partner/models/payment_mode.py +++ b/account_payment_partner/models/payment_mode.py @@ -25,6 +25,9 @@ from openerp import models, fields class PaymentMode(models.Model): _inherit = "payment.mode" + label = fields.Char( + string='Label', translate=True, + help="This field is designed to be used in the invoice report") default_payment_mode = fields.Selection([ ('same', 'Same'), ('same_or_null', 'Same or empty'), diff --git a/account_payment_partner/views/payment_mode.xml b/account_payment_partner/views/payment_mode.xml index 120ca6970..b32d52b01 100644 --- a/account_payment_partner/views/payment_mode.xml +++ b/account_payment_partner/views/payment_mode.xml @@ -12,6 +12,9 @@ + + + From 79f0dead55355a456532d92ef7ff02e56069e2cc Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Mon, 15 Feb 2016 23:10:18 +0100 Subject: [PATCH 39/66] [IMP] *: Short headers --- account_payment_partner/__init__.py | 24 +++-------------- account_payment_partner/__openerp__.py | 26 +++---------------- .../models/account_invoice.py | 25 +++--------------- .../models/payment_mode.py | 22 +++------------- account_payment_partner/models/res_partner.py | 25 +++--------------- 5 files changed, 18 insertions(+), 104 deletions(-) diff --git a/account_payment_partner/__init__.py b/account_payment_partner/__init__.py index fe47437f2..794e1a243 100644 --- a/account_payment_partner/__init__.py +++ b/account_payment_partner/__init__.py @@ -1,24 +1,6 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# -# Account Payment Partner 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 Akretion - Alexis de Lattre +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from . import models from . import wizard diff --git a/account_payment_partner/__openerp__.py b/account_payment_partner/__openerp__.py index 7344c9908..d50c7844a 100644 --- a/account_payment_partner/__openerp__.py +++ b/account_payment_partner/__openerp__.py @@ -1,25 +1,7 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# -# Account Payment Partner 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 Akretion - Alexis de Lattre +# © 2014 Serv. Tecnol. Avanzados - Pedro M. Baeza +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). { 'name': 'Account Payment Partner', diff --git a/account_payment_partner/models/account_invoice.py b/account_payment_partner/models/account_invoice.py index e14c0d956..4c5b971c6 100644 --- a/account_payment_partner/models/account_invoice.py +++ b/account_payment_partner/models/account_invoice.py @@ -1,24 +1,7 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# -# Account Payment Partner 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 Akretion - Alexis de Lattre +# © 2014 Serv. Tecnol. Avanzados - Pedro M. Baeza +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from openerp import models, fields, api diff --git a/account_payment_partner/models/payment_mode.py b/account_payment_partner/models/payment_mode.py index 62b8767e6..cc03dd323 100644 --- a/account_payment_partner/models/payment_mode.py +++ b/account_payment_partner/models/payment_mode.py @@ -1,23 +1,7 @@ # -*- coding: utf-8 -*- -############################################################################## -# -# Copyright (C) 2015 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 . -# -############################################################################## +# © 2014 Akretion - Alexis de Lattre +# © 2014 Serv. Tecnol. Avanzados - Pedro M. Baeza +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from openerp import models, fields diff --git a/account_payment_partner/models/res_partner.py b/account_payment_partner/models/res_partner.py index 5726da446..7b6c850aa 100644 --- a/account_payment_partner/models/res_partner.py +++ b/account_payment_partner/models/res_partner.py @@ -1,24 +1,7 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# -# Account Payment Partner 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 Akretion - Alexis de Lattre +# © 2014 Serv. Tecnol. Avanzados - Pedro M. Baeza +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from openerp import models, fields, api From b153654c8fc86f4e034c5086d8c80c4816fbf94d Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Mon, 15 Feb 2016 23:12:49 +0100 Subject: [PATCH 40/66] [IMP] account_payment_partner: Remove label field There's already a field in the payment mode called 'note' that is printed on the invoices, so there's no need of another field for that purpose. This field is added by account_banking_payment_export --- account_payment_partner/models/payment_mode.py | 3 --- account_payment_partner/views/payment_mode.xml | 3 --- 2 files changed, 6 deletions(-) diff --git a/account_payment_partner/models/payment_mode.py b/account_payment_partner/models/payment_mode.py index cc03dd323..6d2fa946b 100644 --- a/account_payment_partner/models/payment_mode.py +++ b/account_payment_partner/models/payment_mode.py @@ -9,9 +9,6 @@ from openerp import models, fields class PaymentMode(models.Model): _inherit = "payment.mode" - label = fields.Char( - string='Label', translate=True, - help="This field is designed to be used in the invoice report") default_payment_mode = fields.Selection([ ('same', 'Same'), ('same_or_null', 'Same or empty'), diff --git a/account_payment_partner/views/payment_mode.xml b/account_payment_partner/views/payment_mode.xml index b32d52b01..120ca6970 100644 --- a/account_payment_partner/views/payment_mode.xml +++ b/account_payment_partner/views/payment_mode.xml @@ -12,9 +12,6 @@ - - - From 8fe28fe3cf6c939754d1091ca30305b85d087469 Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Mon, 15 Feb 2016 23:17:37 +0100 Subject: [PATCH 41/66] [IMP] *: Bump version numbers --- account_payment_partner/__openerp__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/account_payment_partner/__openerp__.py b/account_payment_partner/__openerp__.py index d50c7844a..3683b8a33 100644 --- a/account_payment_partner/__openerp__.py +++ b/account_payment_partner/__openerp__.py @@ -5,7 +5,7 @@ { 'name': 'Account Payment Partner', - 'version': '8.0.0.1.0', + 'version': '8.0.0.2.0', 'category': 'Banking addons', 'license': 'AGPL-3', 'summary': 'Adds payment mode on partners and invoices', From c3c4efad9dc15a1371dfc85be64b46ce6df99324 Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Tue, 16 Feb 2016 09:02:09 +0100 Subject: [PATCH 42/66] [IMP] *: es translations --- account_payment_partner/i18n/es.po | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/account_payment_partner/i18n/es.po b/account_payment_partner/i18n/es.po index 8d9b6b91a..c78c3e344 100644 --- a/account_payment_partner/i18n/es.po +++ b/account_payment_partner/i18n/es.po @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 8.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-07-02 10:55+0000\n" -"PO-Revision-Date: 2015-07-02 10:55+0000\n" +"POT-Creation-Date: 2016-02-16 08:01+0000\n" +"PO-Revision-Date: 2016-02-16 08:01+0000\n" "Last-Translator: <>\n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -15,6 +15,12 @@ msgstr "" "Content-Transfer-Encoding: \n" "Plural-Forms: \n" +#. module: account_payment_partner +#: selection:payment.mode,default_payment_mode:0 +#: selection:payment.order.create,payment_mode:0 +msgid "Any" +msgstr "Cualquiera" + #. module: account_payment_partner #: view:website:account.report_invoice_document msgid "Bank Account:" @@ -37,14 +43,33 @@ msgstr "Empresa" #. module: account_payment_partner #: field:account.invoice,payment_mode_id:0 +#: model:ir.model,name:account_payment_partner.model_payment_mode msgid "Payment Mode" msgstr "Modo de pago" +#. module: account_payment_partner +#: field:payment.mode,default_payment_mode:0 +#: field:payment.order.create,payment_mode:0 +msgid "Payment Mode on Invoice" +msgstr "Modo de pago en la factura" + #. module: account_payment_partner #: view:website:account.report_invoice_document msgid "Payment Mode:" msgstr "Modo de pago:" +#. module: account_payment_partner +#: selection:payment.mode,default_payment_mode:0 +#: selection:payment.order.create,payment_mode:0 +msgid "Same" +msgstr "Igual" + +#. module: account_payment_partner +#: selection:payment.mode,default_payment_mode:0 +#: selection:payment.order.create,payment_mode:0 +msgid "Same or empty" +msgstr "Igual o vacío" + #. module: account_payment_partner #: help:res.partner,customer_payment_mode:0 msgid "Select the default payment mode for this customer." From 9c20c0d9153523525597ec8e06a12f78b25c1818 Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Wed, 2 Mar 2016 10:48:55 +0100 Subject: [PATCH 43/66] [IMP] account_payment_partner: Name to filter for better inheratiblity --- account_payment_partner/views/account_invoice_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/account_payment_partner/views/account_invoice_view.xml b/account_payment_partner/views/account_invoice_view.xml index 72afbb2a5..895e03bf5 100644 --- a/account_payment_partner/views/account_invoice_view.xml +++ b/account_payment_partner/views/account_invoice_view.xml @@ -15,7 +15,7 @@ - + From 2a4390625be8382f17dcdd98476975b7e673512c Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Sat, 30 Apr 2016 01:46:34 +0200 Subject: [PATCH 44/66] Start to port bank-payment to v9 (with a lot of improvements) during the Sorrento Code sprint 2016 Improvements include: - full re-organisation of modules and big re-organisation of the code - simplification of the code related to the fact that support for direct debit is now in t he base module, not added by an optional module account_direct_debit (module was removed) - new design of the wizard to select move lines to pay - support for non-SEPA file transfer- - support for German direct debit SEPA files (fixes bug #129) - remove workflow of payment.order This port to v9 is not finished... there is still a lot of work: - finish the code of account_payment_order/wizard/account_payment_line_create.py - port account_banking_payment_transfer and integrate it inside account_payment_order - fix bugs - clean-up code, remove dead code - test in several complex scenarios --- account_payment_partner/__init__.py | 1 - account_payment_partner/__openerp__.py | 12 ++-- account_payment_partner/models/__init__.py | 2 +- .../models/account_invoice.py | 47 ++++++++------- .../models/account_move_line.py | 13 ++++ .../models/payment_mode.py | 16 ----- account_payment_partner/models/res_partner.py | 10 ++-- .../security/ir.model.access.csv | 3 - .../views/account_invoice_view.xml | 27 ++++++--- .../views/account_move_line.xml | 28 +++++++++ .../views/payment_mode.xml | 20 ------- .../views/report_invoice.xml | 2 +- .../views/res_partner_view.xml | 12 ++-- account_payment_partner/wizard/__init__.py | 23 ------- .../wizard/payment_order_create.py | 60 ------------------- .../wizard/payment_order_create_view.xml | 25 -------- 16 files changed, 103 insertions(+), 198 deletions(-) create mode 100644 account_payment_partner/models/account_move_line.py delete mode 100644 account_payment_partner/models/payment_mode.py delete mode 100644 account_payment_partner/security/ir.model.access.csv create mode 100644 account_payment_partner/views/account_move_line.xml delete mode 100644 account_payment_partner/views/payment_mode.xml delete mode 100644 account_payment_partner/wizard/__init__.py delete mode 100644 account_payment_partner/wizard/payment_order_create.py delete mode 100644 account_payment_partner/wizard/payment_order_create_view.xml diff --git a/account_payment_partner/__init__.py b/account_payment_partner/__init__.py index 794e1a243..3845dd2da 100644 --- a/account_payment_partner/__init__.py +++ b/account_payment_partner/__init__.py @@ -3,4 +3,3 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from . import models -from . import wizard diff --git a/account_payment_partner/__openerp__.py b/account_payment_partner/__openerp__.py index 3683b8a33..6a5696f44 100644 --- a/account_payment_partner/__openerp__.py +++ b/account_payment_partner/__openerp__.py @@ -5,7 +5,7 @@ { 'name': 'Account Payment Partner', - 'version': '8.0.0.2.0', + 'version': '9.0.1.0.0', 'category': 'Banking addons', 'license': 'AGPL-3', 'summary': 'Adds payment mode on partners and invoices', @@ -13,15 +13,13 @@ "Serv. Tecnol. Avanzados - Pedro M. Baeza, " "Odoo Community Association (OCA)", 'website': 'https://github.com/OCA/bank-payment', - 'depends': ['account_banking_payment_export'], + 'depends': ['account_payment_mode'], 'data': [ 'views/res_partner_view.xml', 'views/account_invoice_view.xml', + 'views/account_move_line.xml', 'views/report_invoice.xml', - 'views/payment_mode.xml', - 'security/ir.model.access.csv', - 'wizard/payment_order_create_view.xml', ], - 'demo': ['demo/partner_demo.xml'], - 'installable': False, +# 'demo': ['demo/partner_demo.xml'], + 'installable': True, } diff --git a/account_payment_partner/models/__init__.py b/account_payment_partner/models/__init__.py index be3f531bb..152bb919c 100644 --- a/account_payment_partner/models/__init__.py +++ b/account_payment_partner/models/__init__.py @@ -2,4 +2,4 @@ from . import res_partner from . import account_invoice -from . import payment_mode +from . import account_move_line diff --git a/account_payment_partner/models/account_invoice.py b/account_payment_partner/models/account_invoice.py index 4c5b971c6..d67770198 100644 --- a/account_payment_partner/models/account_invoice.py +++ b/account_payment_partner/models/account_invoice.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# © 2014 Akretion - Alexis de Lattre +# © 2014-2016 Akretion - Alexis de Lattre # © 2014 Serv. Tecnol. Avanzados - Pedro M. Baeza # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). @@ -10,27 +10,30 @@ class AccountInvoice(models.Model): _inherit = 'account.invoice' payment_mode_id = fields.Many2one( - comodel_name='payment.mode', string="Payment Mode", - domain="[('type', '=', type)]") + comodel_name='account.payment.mode', string="Payment Mode", + readonly=True, states={'draft': [('readonly', False)]}) - @api.multi - def onchange_partner_id( - self, type, partner_id, date_invoice=False, - payment_term=False, partner_bank_id=False, company_id=False): - res = super(AccountInvoice, self).onchange_partner_id( - type, partner_id, date_invoice=date_invoice, - payment_term=payment_term, partner_bank_id=partner_bank_id, - company_id=company_id) - if partner_id: - partner = self.env['res.partner'].browse(partner_id) - if type == 'in_invoice': - res['value']['payment_mode_id'] = \ - partner.supplier_payment_mode.id - elif type == 'out_invoice': - res['value'].update({ - 'payment_mode_id': partner.customer_payment_mode.id, - 'partner_bank_id': partner.customer_payment_mode.bank_id.id - }) + @api.onchange('partner_id', 'company_id', 'type') + def _onchange_partner_id(self): + super(AccountInvoice, self)._onchange_partner_id() + if self.partner_id and self.type: + if self.type == 'in_invoice': + self.payment_mode_id =\ + self.partner_id.supplier_payment_mode + elif self.type == 'out_invoice': + payment_mode = self.partner_id.customer_payment_mode + self.payment_mode_id = payment_mode + if payment_mode and payment_mode.bank_account_link == 'fixed': + self.partner_bank_id = payment_mode.fixed_journal_id.\ + bank_account_id else: - res['value']['payment_mode_id'] = False + self.payment_mode_id = False + + @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 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..5c51fa88e --- /dev/null +++ b/account_payment_partner/models/account_move_line.py @@ -0,0 +1,13 @@ +# -*- coding: utf-8 -*- +# © 2016 Akretion (http://www.akretion.com/) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from openerp import models, fields + + +class AccountMoveLine(models.Model): + _inherit = 'account.move.line' + + payment_mode_id = fields.Many2one( + 'account.payment.mode', string='Payment Mode', + ondelete='restrict') diff --git a/account_payment_partner/models/payment_mode.py b/account_payment_partner/models/payment_mode.py deleted file mode 100644 index 6d2fa946b..000000000 --- a/account_payment_partner/models/payment_mode.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- -# © 2014 Akretion - Alexis de Lattre -# © 2014 Serv. Tecnol. Avanzados - Pedro M. Baeza -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). - -from openerp import models, fields - - -class PaymentMode(models.Model): - _inherit = "payment.mode" - - default_payment_mode = fields.Selection([ - ('same', 'Same'), - ('same_or_null', 'Same or empty'), - ('any', 'Any'), - ], string='Payment Mode on Invoice', default='same') diff --git a/account_payment_partner/models/res_partner.py b/account_payment_partner/models/res_partner.py index 7b6c850aa..a3b6f8302 100644 --- a/account_payment_partner/models/res_partner.py +++ b/account_payment_partner/models/res_partner.py @@ -10,12 +10,14 @@ class ResPartner(models.Model): _inherit = 'res.partner' supplier_payment_mode = fields.Many2one( - 'payment.mode', string='Supplier Payment Mode', company_dependent=True, - domain="[('purchase_ok', '=', True)]", + 'account.payment.mode', string='Supplier Payment Mode', + company_dependent=True, + domain=[('payment_type', '=', 'outbound')], help="Select the default payment mode for this supplier.") customer_payment_mode = fields.Many2one( - 'payment.mode', string='Customer Payment Mode', company_dependent=True, - domain="[('sale_ok', '=', True)]", + 'account.payment.mode', string='Customer Payment Mode', + company_dependent=True, + domain=[('payment_type', '=', 'inbound')], help="Select the default payment mode for this customer.") @api.model diff --git a/account_payment_partner/security/ir.model.access.csv b/account_payment_partner/security/ir.model.access.csv deleted file mode 100644 index ac6d96dfd..000000000 --- a/account_payment_partner/security/ir.model.access.csv +++ /dev/null @@ -1,3 +0,0 @@ -id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink -access_payment_mode_read,Read access on payment.mode to Employees,account_payment.model_payment_mode,base.group_user,1,0,0,0 -access_payment_mode_type_read,Read access on payment.mode.type to Employees,account_banking_payment_export.model_payment_mode_type,base.group_user,1,0,0,0 diff --git a/account_payment_partner/views/account_invoice_view.xml b/account_payment_partner/views/account_invoice_view.xml index 895e03bf5..f0a87a704 100644 --- a/account_payment_partner/views/account_invoice_view.xml +++ b/account_payment_partner/views/account_invoice_view.xml @@ -1,7 +1,7 @@ @@ -9,13 +9,14 @@ - - account_payment_partner.invoice_filter + + account_payment_partner.account_invoice_search account.invoice - - + + @@ -28,8 +29,13 @@ + + + + + 0 @@ -42,8 +48,15 @@ + + + + 0 + + + [('partner_id', '=', commercial_partner_id)] 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..b0d0ca102 --- /dev/null +++ b/account_payment_partner/views/account_move_line.xml @@ -0,0 +1,28 @@ + + + + + + + + + + account_payment_partner.move_line_form + account.move.line + + + + + + + + + + + + + diff --git a/account_payment_partner/views/payment_mode.xml b/account_payment_partner/views/payment_mode.xml deleted file mode 100644 index 120ca6970..000000000 --- a/account_payment_partner/views/payment_mode.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - account_payment_partner.payment.mode.form - payment.mode - - - - - - - - - - - diff --git a/account_payment_partner/views/report_invoice.xml b/account_payment_partner/views/report_invoice.xml index 356ec1d4d..9368238f1 100644 --- a/account_payment_partner/views/report_invoice.xml +++ b/account_payment_partner/views/report_invoice.xml @@ -2,7 +2,7 @@