diff --git a/account_banking_payment_export/model/__init__.py b/account_banking_payment_export/model/__init__.py
index ea50d43a4..74ab85c8d 100644
--- a/account_banking_payment_export/model/__init__.py
+++ b/account_banking_payment_export/model/__init__.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
from . import account_move_line
from . import account_payment
from . import bank_payment_manual
diff --git a/account_banking_payment_export/model/account_payment.py b/account_banking_payment_export/model/account_payment.py
index 045b3d867..fe69c290f 100644
--- a/account_banking_payment_export/model/account_payment.py
+++ b/account_banking_payment_export/model/account_payment.py
@@ -37,6 +37,9 @@ class payment_order(orm.Model):
'Payment order type', required=True,
readonly=True, states={'draft': [('readonly', False)]},
),
+ 'mode_type': fields.related(
+ 'mode', 'type', type='many2one', relation='payment.mode.type',
+ string='Payment Type'),
}
_defaults = {
diff --git a/account_banking_payment_export/model/payment_mode.py b/account_banking_payment_export/model/payment_mode.py
index 798c8ed20..cac103402 100644
--- a/account_banking_payment_export/model/payment_mode.py
+++ b/account_banking_payment_export/model/payment_mode.py
@@ -53,4 +53,9 @@ class payment_mode(orm.Model):
'type', 'payment_order_type', readonly=True, type='selection',
selection=[('payment', 'Payment'), ('debit', 'Direct debit')],
string="Payment Order Type"),
+ 'active': fields.boolean('Active'),
+ }
+
+ _defaults = {
+ 'active': True,
}
diff --git a/account_banking_payment_export/model/payment_mode_type.py b/account_banking_payment_export/model/payment_mode_type.py
index a50e56a85..e65727715 100644
--- a/account_banking_payment_export/model/payment_mode_type.py
+++ b/account_banking_payment_export/model/payment_mode_type.py
@@ -53,10 +53,12 @@ class payment_mode_type(orm.Model):
[('payment', 'Payment'), ('debit', 'Direct debit')],
'Payment order type', required=True,
),
+ 'active': fields.boolean('Active'),
}
_defaults = {
'payment_order_type': 'payment',
+ 'active': True,
}
def _auto_init(self, cr, context=None):
diff --git a/account_banking_payment_export/view/account_payment.xml b/account_banking_payment_export/view/account_payment.xml
index a8e7ed547..3e9d35882 100644
--- a/account_banking_payment_export/view/account_payment.xml
+++ b/account_banking_payment_export/view/account_payment.xml
@@ -9,12 +9,13 @@
payment.order
-
-
- launch_wizard
-
-
+
+ launch_wizard
+
+
+
+
diff --git a/account_banking_payment_export/view/payment_mode.xml b/account_banking_payment_export/view/payment_mode.xml
index 98fa44475..611b233e8 100644
--- a/account_banking_payment_export/view/payment_mode.xml
+++ b/account_banking_payment_export/view/payment_mode.xml
@@ -11,6 +11,7 @@
+
diff --git a/account_banking_payment_export/view/payment_mode_type.xml b/account_banking_payment_export/view/payment_mode_type.xml
index 682265a2d..45e99656c 100644
--- a/account_banking_payment_export/view/payment_mode_type.xml
+++ b/account_banking_payment_export/view/payment_mode_type.xml
@@ -18,14 +18,40 @@
view.payment.mode.type.form
payment.mode.type
-
+
+ view.payment.mode.type.tree
+ payment.mode.type
+
+
+
+
+
+
+
+
+
+
+ Payment Type
+ payment.mode.type
+ form
+ tree,form
+
+
+
+
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
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/account_payment_purchase/__init__.py b/account_payment_purchase/__init__.py
new file mode 100644
index 000000000..59199014f
--- /dev/null
+++ b/account_payment_purchase/__init__.py
@@ -0,0 +1,23 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# Account Payment Purchase 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_purchase/__openerp__.py b/account_payment_purchase/__openerp__.py
new file mode 100644
index 000000000..e2fc219eb
--- /dev/null
+++ b/account_payment_purchase/__openerp__.py
@@ -0,0 +1,48 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# Account Payment Purchase 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 Purchase',
+ 'version': '1.0',
+ 'category': 'Banking addons',
+ 'license': 'AGPL-3',
+ 'summary': "Adds Bank Account and Payment Type on Purchase Orders",
+ 'description': """
+Account Payment Purchase
+========================
+
+This modules adds 2 fields on purchase orders : *Bank Account* and *Payment Type*. These fields are copied from partner to purchase order and then from purchase order to supplier invoice.
+
+This module is similar to the *purchase_payment* module ; the main difference is that it doesn't depend on the *account_payment_extension* module (it's not the only module to conflict with *account_payment_extension* ; all the SEPA modules in the banking addons conflict with *account_payment_extension*, cf banking-addons-70/account_banking_payment_export/__openerp__.py).
+
+Please contact Alexis de Lattre from Akretion for any help or question about this module.
+ """,
+ 'author': 'Akretion',
+ 'website': 'http://www.akretion.com',
+ 'depends': ['purchase', 'account_payment_partner'],
+ 'conflicts': ['purchase_payment'],
+ 'data': [
+ 'view/purchase.xml',
+ ],
+ 'installable': True,
+ 'active': False,
+}
diff --git a/account_payment_purchase/i18n/account_payment_purchase.pot b/account_payment_purchase/i18n/account_payment_purchase.pot
new file mode 100644
index 000000000..49f775a6e
--- /dev/null
+++ b/account_payment_purchase/i18n/account_payment_purchase.pot
@@ -0,0 +1,42 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+# * account_payment_purchase
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 7.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-02-24 23:07+0000\n"
+"PO-Revision-Date: 2014-02-24 23:07+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_purchase
+#: field:purchase.order,payment_mode_type:0
+msgid "Payment Type"
+msgstr ""
+
+#. module: account_payment_purchase
+#: model:ir.model,name:account_payment_purchase.model_purchase_order
+msgid "Purchase Order"
+msgstr ""
+
+#. module: account_payment_purchase
+#: help:purchase.order,supplier_partner_bank:0
+msgid "Select the bank account of your supplier on which your company should send the payment. This field is copied from the partner and will be copied to the supplier invoice."
+msgstr ""
+
+#. module: account_payment_purchase
+#: field:purchase.order,supplier_partner_bank:0
+msgid "Supplier Bank Account"
+msgstr ""
+
+#. module: account_payment_purchase
+#: model:ir.model,name:account_payment_purchase.model_stock_picking
+msgid "Picking List"
+msgstr ""
+
diff --git a/account_payment_purchase/i18n/fr.po b/account_payment_purchase/i18n/fr.po
new file mode 100644
index 000000000..54d2b3b2a
--- /dev/null
+++ b/account_payment_purchase/i18n/fr.po
@@ -0,0 +1,42 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+# * account_payment_purchase
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 7.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-02-24 23:09+0000\n"
+"PO-Revision-Date: 2014-02-24 23:09+0000\n"
+"Last-Translator: Alexis de Lattre \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_purchase
+#: field:purchase.order,payment_mode_type:0
+msgid "Payment Type"
+msgstr "Type de Paiement"
+
+#. module: account_payment_purchase
+#: model:ir.model,name:account_payment_purchase.model_purchase_order
+msgid "Purchase Order"
+msgstr "Bon de commande"
+
+#. module: account_payment_purchase
+#: help:purchase.order,supplier_partner_bank:0
+msgid "Select the bank account of your supplier on which your company should send the payment. This field is copied from the partner and will be copied to the supplier invoice."
+msgstr "Selectionnez le compte bancaire du fournisseur sur lequel votre société devra effectuer le règlement. Ce champ est copié depuis le partenaire et sera recopié sur la facture fournisseur."
+
+#. module: account_payment_purchase
+#: field:purchase.order,supplier_partner_bank:0
+msgid "Supplier Bank Account"
+msgstr "Compte bancaire du fournisseur"
+
+#. module: account_payment_purchase
+#: model:ir.model,name:account_payment_purchase.model_stock_picking
+msgid "Picking List"
+msgstr "Bon de livraison"
+
diff --git a/account_payment_purchase/model/__init__.py b/account_payment_purchase/model/__init__.py
new file mode 100644
index 000000000..fe39c6366
--- /dev/null
+++ b/account_payment_purchase/model/__init__.py
@@ -0,0 +1,24 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# Account Payment Purchase 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 purchase
+from . import stock
diff --git a/account_payment_purchase/model/purchase.py b/account_payment_purchase/model/purchase.py
new file mode 100644
index 000000000..639fdce6d
--- /dev/null
+++ b/account_payment_purchase/model/purchase.py
@@ -0,0 +1,82 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# Account Payment Purchase 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 purchase_order(orm.Model):
+ _inherit = "purchase.order"
+
+ _columns = {
+ 'supplier_partner_bank': fields.many2one(
+ 'res.partner.bank', 'Supplier Bank Account',
+ help="Select the bank account of your supplier on which "
+ "your company should send the payment. This field is copied "
+ "from the partner and will be copied to the supplier invoice."),
+ 'payment_mode_type': fields.many2one(
+ 'payment.mode.type', 'Payment Type'),
+ }
+
+ def _get_default_supplier_partner_bank(
+ self, cr, uid, partner, context=None):
+ '''This function is designed to be inherited'''
+ if partner.bank_ids:
+ return partner.bank_ids[0].id
+ else:
+ return False
+
+ def onchange_partner_id(self, cr, uid, ids, partner_id):
+ res = super(purchase_order, self).onchange_partner_id(
+ cr, uid, ids, partner_id)
+ if partner_id:
+ partner = self.pool['res.partner'].browse(
+ cr, uid, partner_id)
+ res['value'].update({
+ 'supplier_partner_bank':
+ self._get_default_supplier_partner_bank(
+ cr, uid, partner),
+ 'payment_mode_type':
+ partner.supplier_payment_mode_type.id or False,
+ })
+ else:
+ res['value'].update({
+ 'supplier_partner_bank': False,
+ 'payment_mode_type': False,
+ })
+ return res
+
+ def action_invoice_create(self, cr, uid, ids, context=None):
+ """Copy bank partner + payment type from PO to invoice"""
+ # as of OpenERP 7.0, there is no _prepare function for
+ # the invoice (the _prepare function only exists for invoice lines)
+ res = super(purchase_order, self).action_invoice_create(
+ cr, uid, ids, context=context)
+ for order in self.browse(cr, uid, ids, context=context):
+ for invoice in order.invoice_ids:
+ if invoice.state == 'draft':
+ invoice.write({
+ 'partner_bank_id':
+ order.supplier_partner_bank.id or False,
+ 'payment_mode_type':
+ order.payment_mode_type.id or False,
+ }, context=context)
+ return res
diff --git a/account_payment_purchase/model/stock.py b/account_payment_purchase/model/stock.py
new file mode 100644
index 000000000..e2f83663b
--- /dev/null
+++ b/account_payment_purchase/model/stock.py
@@ -0,0 +1,42 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# Account Payment Purchase 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 stock_picking(orm.Model):
+ _inherit = "stock.picking"
+
+ def _prepare_invoice(
+ self, cr, uid, picking, partner, inv_type, journal_id,
+ context=None):
+ """Copy bank partner and payment type from PO to invoice"""
+ invoice_vals = super(stock_picking, self)._prepare_invoice(
+ cr, uid, picking, partner, inv_type, journal_id, context=context)
+ if picking.purchase_id:
+ invoice_vals.update({
+ 'partner_bank_id':
+ picking.purchase_id.supplier_partner_bank.id or False,
+ 'payment_mode_type':
+ picking.purchase_id.payment_mode_type.id or False,
+ })
+ return invoice_vals
diff --git a/account_payment_purchase/view/purchase.xml b/account_payment_purchase/view/purchase.xml
new file mode 100644
index 000000000..3875fefda
--- /dev/null
+++ b/account_payment_purchase/view/purchase.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+ account_payment_purchase.purchase_order.form
+ purchase.order
+
+
+
+
+
+
+
+
+
+
+
diff --git a/account_payment_sale/__init__.py b/account_payment_sale/__init__.py
new file mode 100644
index 000000000..83c0dcfe2
--- /dev/null
+++ b/account_payment_sale/__init__.py
@@ -0,0 +1,23 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# Account Payment Sale module for OpenERP
+# Copyright (C) 2014 Akretion (http://www.akretion.com)
+# @author Alexis de Lattre
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+
+from . import model
diff --git a/account_payment_sale/__openerp__.py b/account_payment_sale/__openerp__.py
new file mode 100644
index 000000000..b6cf3b2cb
--- /dev/null
+++ b/account_payment_sale/__openerp__.py
@@ -0,0 +1,48 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# Account Payment Sale module for OpenERP
+# Copyright (C) 2014 Akretion (http://www.akretion.com).
+# @author Alexis de Lattre
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+
+{
+ 'name': 'Account Payment Sale',
+ 'version': '1.0',
+ 'category': 'Banking addons',
+ 'license': 'AGPL-3',
+ 'summary': "Adds Bank Account and Payment Type on Sale Orders",
+ 'description': """
+Account Payment Sale
+====================
+
+This modules adds 2 fields on sale orders : *Bank Account* and *Payment Type*. These fields are copied from partner to sale order and then from sale order to customer invoice.
+
+This module is similar to the *sale_payment* module ; the main difference is that it doesn't depend on the *account_payment_extension* module (it's not the only module to conflict with *account_payment_extension* ; all the SEPA modules in the banking addons conflict with *account_payment_extension*, cf banking-addons-70/account_banking_payment_export/__openerp__.py).
+
+Please contact Alexis de Lattre from Akretion for any help or question about this module.
+ """,
+ 'author': 'Akretion',
+ 'website': 'http://www.akretion.com',
+ 'depends': ['sale', 'account_payment_partner'],
+ 'conflicts': ['sale_payment'],
+ 'data': [
+ 'view/sale.xml',
+ ],
+ 'installable': True,
+ 'active': False,
+}
diff --git a/account_payment_sale/i18n/account_payment_sale.pot b/account_payment_sale/i18n/account_payment_sale.pot
new file mode 100644
index 000000000..3bb6dd99d
--- /dev/null
+++ b/account_payment_sale/i18n/account_payment_sale.pot
@@ -0,0 +1,37 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+# * account_payment_sale
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 7.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-02-24 23:07+0000\n"
+"PO-Revision-Date: 2014-02-24 23:07+0000\n"
+"Last-Translator: <>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Plural-Forms: \n"
+
+#. module: account_payment_sale
+#: field:sale.order,payment_mode_type:0
+msgid "Payment Type"
+msgstr ""
+
+#. module: account_payment_sale
+#: model:ir.model,name:account_payment_sale.model_sale_order
+msgid "Sales Order"
+msgstr ""
+
+#. module: account_payment_sale
+#: help:sale.order,partner_bank_receivable:0
+msgid "Select the bank account of your company on which the customer should pay. This field is copied from the partner and will be copied to the customer invoice."
+msgstr ""
+
+#. module: account_payment_sale
+#: field:sale.order,partner_bank_receivable:0
+msgid "Receivable Bank Account"
+msgstr ""
+
diff --git a/account_payment_sale/model/__init__.py b/account_payment_sale/model/__init__.py
new file mode 100644
index 000000000..079ae1b71
--- /dev/null
+++ b/account_payment_sale/model/__init__.py
@@ -0,0 +1,23 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# Account Payment Sale module for OpenERP
+# Copyright (C) 2014 Akretion (http://www.akretion.com)
+# @author Alexis de Lattre
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+
+from . import sale
diff --git a/account_payment_sale/model/sale.py b/account_payment_sale/model/sale.py
new file mode 100644
index 000000000..3dc8a5e3c
--- /dev/null
+++ b/account_payment_sale/model/sale.py
@@ -0,0 +1,66 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# Account Payment Sale module for OpenERP
+# Copyright (C) 2014 Akretion (http://www.akretion.com)
+# @author Alexis de Lattre
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+
+from openerp.osv import orm, fields
+
+
+class sale_order(orm.Model):
+ _inherit = "sale.order"
+
+ _columns = {
+ 'partner_bank_receivable': fields.many2one(
+ 'res.partner.bank', 'Receivable Bank Account',
+ help="Select the bank account of your company on which the "
+ "customer should pay. This field is copied from the partner "
+ "and will be copied to the customer invoice."),
+ 'payment_mode_type': fields.many2one(
+ 'payment.mode.type', 'Payment Type'),
+ }
+
+ def onchange_partner_id(self, cr, uid, ids, part, context=None):
+ res = super(sale_order, self).onchange_partner_id(
+ cr, uid, ids, part, context=context)
+ if part:
+ partner = self.pool['res.partner'].browse(
+ cr, uid, part, context=context)
+ res['value'].update({
+ 'partner_bank_receivable':
+ partner.partner_bank_receivable.id or False,
+ 'payment_mode_type':
+ partner.customer_payment_mode_type.id or False,
+ })
+ else:
+ res['value'].update({
+ 'partner_bank_receivable': False,
+ 'payment_mode_type': False,
+ })
+ return res
+
+ def _prepare_invoice(self, cr, uid, order, lines, context=None):
+ """Copy bank partner from sale order to invoice"""
+ invoice_vals = super(sale_order, self)._prepare_invoice(
+ cr, uid, order, lines, context=context)
+ invoice_vals.update({
+ 'partner_bank_id': order.partner_bank_receivable.id or False,
+ 'payment_mode_type': order.payment_mode_type.id or False,
+ })
+ return invoice_vals
diff --git a/account_payment_sale/view/sale.xml b/account_payment_sale/view/sale.xml
new file mode 100644
index 000000000..f54cf8c95
--- /dev/null
+++ b/account_payment_sale/view/sale.xml
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
+ account_payment_sale.sale_order.form
+ sale.order
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/account_payment_sale_stock/__init__.py b/account_payment_sale_stock/__init__.py
new file mode 100644
index 000000000..c98702b99
--- /dev/null
+++ b/account_payment_sale_stock/__init__.py
@@ -0,0 +1,23 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# Account Payment Sale Stock 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_sale_stock/__openerp__.py b/account_payment_sale_stock/__openerp__.py
new file mode 100644
index 000000000..1b45fbf1c
--- /dev/null
+++ b/account_payment_sale_stock/__openerp__.py
@@ -0,0 +1,43 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# Account Payment Sale Stock 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 Sale Stock',
+ 'version': '1.0',
+ 'category': 'Banking addons',
+ 'license': 'AGPL-3',
+ 'summary': "Manage Payment Type and Bank Account when invoicing from picking",
+ 'description': """
+Account Payment Sale Stock
+==========================
+
+This modules copies *Bank Account* and *Payment Type* from Sale Order to Invoice when the Invoice is generated from the Picking.
+
+Please contact Alexis de Lattre from Akretion for any help or question about this module.
+ """,
+ 'author': 'Akretion',
+ 'website': 'http://www.akretion.com',
+ 'depends': ['sale_stock', 'account_payment_sale'],
+ 'conflicts': ['account_payment_extension'],
+ 'data': [],
+ 'active': False,
+}
diff --git a/account_payment_sale_stock/model/__init__.py b/account_payment_sale_stock/model/__init__.py
new file mode 100644
index 000000000..251e4ac06
--- /dev/null
+++ b/account_payment_sale_stock/model/__init__.py
@@ -0,0 +1,23 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# Account Payment Sale Stock 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 stock
diff --git a/account_payment_sale_stock/model/stock.py b/account_payment_sale_stock/model/stock.py
new file mode 100644
index 000000000..f307d0d5c
--- /dev/null
+++ b/account_payment_sale_stock/model/stock.py
@@ -0,0 +1,42 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# Account Payment Sale Stock 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 stock_picking(orm.Model):
+ _inherit = "stock.picking"
+
+ def _prepare_invoice(
+ self, cr, uid, picking, partner, inv_type, journal_id,
+ context=None):
+ """Copy bank partner and payment type from sale order to invoice"""
+ invoice_vals = super(stock_picking, self)._prepare_invoice(
+ cr, uid, picking, partner, inv_type, journal_id, context=context)
+ if picking.sale_id:
+ invoice_vals.update({
+ 'partner_bank_id':
+ picking.sale_id.partner_bank_receivable.id or False,
+ 'payment_mode_type':
+ picking.sale_id.payment_mode_type.id or False,
+ })
+ return invoice_vals