mirror of
https://github.com/OCA/bank-payment.git
synced 2025-02-02 10:37:31 +02:00
Migration and enhancement of all modules involved in SEPA
This commit is contained in:
committed by
David Ramia
parent
9f1c8d3722
commit
6b1d85a90f
23
account_payment_purchase/__init__.py
Normal file
23
account_payment_purchase/__init__.py
Normal file
@@ -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 <alexis.delattre@akretion.com>
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from . import models
|
||||
56
account_payment_purchase/__openerp__.py
Normal file
56
account_payment_purchase/__openerp__.py
Normal file
@@ -0,0 +1,56 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Account Payment Purchase module for OpenERP
|
||||
# Copyright (C) 2014 Akretion (http://www.akretion.com).
|
||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
{
|
||||
'name': 'Account Payment Purchase',
|
||||
'version': '1.0',
|
||||
'category': 'Banking addons',
|
||||
'license': 'AGPL-3',
|
||||
'summary': "Adds Bank Account and Payment Mode on Purchase Orders",
|
||||
'description': """
|
||||
Account Payment Purchase
|
||||
========================
|
||||
|
||||
This module adds 2 fields on purchase orders : *Bank Account* and *Payment
|
||||
Mode*. 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*).
|
||||
""",
|
||||
'author': 'Akretion',
|
||||
'website': 'http://www.akretion.com',
|
||||
'contributors': ['Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>'],
|
||||
'depends': [
|
||||
'purchase',
|
||||
'stock_account',
|
||||
'account_payment_partner'
|
||||
],
|
||||
'conflicts': ['purchase_payment'],
|
||||
'data': [
|
||||
'views/purchase_order_view.xml',
|
||||
],
|
||||
'installable': True,
|
||||
'active': False,
|
||||
}
|
||||
42
account_payment_purchase/i18n/account_payment_purchase.pot
Normal file
42
account_payment_purchase/i18n/account_payment_purchase.pot
Normal file
@@ -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-06-09 23:23+0000\n"
|
||||
"PO-Revision-Date: 2014-06-09 23:23+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_id:0
|
||||
msgid "Payment Mode"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_payment_purchase
|
||||
#: model:ir.model,name:account_payment_purchase.model_stock_picking
|
||||
msgid "Picking List"
|
||||
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_id: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_id:0
|
||||
msgid "Supplier Bank Account"
|
||||
msgstr ""
|
||||
|
||||
48
account_payment_purchase/i18n/fr.po
Normal file
48
account_payment_purchase/i18n/fr.po
Normal file
@@ -0,0 +1,48 @@
|
||||
# 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-06-09 23:23+0000\n"
|
||||
"PO-Revision-Date: 2014-06-25 22:31+0000\n"
|
||||
"Last-Translator: Alexis de Lattre <alexis@via.ecp.fr>\n"
|
||||
"Language-Team: \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-26 07:12+0000\n"
|
||||
"X-Generator: Launchpad (build 17065)\n"
|
||||
|
||||
#. module: account_payment_purchase
|
||||
#: field:purchase.order,payment_mode_id:0
|
||||
msgid "Payment Mode"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_payment_purchase
|
||||
#: model:ir.model,name:account_payment_purchase.model_stock_picking
|
||||
msgid "Picking List"
|
||||
msgstr "Bon de livraison"
|
||||
|
||||
#. 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_id: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_id:0
|
||||
msgid "Supplier Bank Account"
|
||||
msgstr "Compte bancaire du fournisseur"
|
||||
49
account_payment_purchase/i18n/nl.po
Normal file
49
account_payment_purchase/i18n/nl.po
Normal file
@@ -0,0 +1,49 @@
|
||||
# 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 <EMAIL@ADDRESS>, 2014.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: banking-addons\n"
|
||||
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"POT-Creation-Date: 2014-06-09 23:23+0000\n"
|
||||
"PO-Revision-Date: 2014-06-26 14:15+0000\n"
|
||||
"Last-Translator: Erwin van der Ploeg (BAS Solutions) <Unknown>\n"
|
||||
"Language-Team: Dutch <nl@li.org>\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_purchase
|
||||
#: field:purchase.order,payment_mode_id:0
|
||||
msgid "Payment Mode"
|
||||
msgstr "Betaalwijze"
|
||||
|
||||
#. module: account_payment_purchase
|
||||
#: model:ir.model,name:account_payment_purchase.model_stock_picking
|
||||
msgid "Picking List"
|
||||
msgstr "Verzamellijst"
|
||||
|
||||
#. module: account_payment_purchase
|
||||
#: model:ir.model,name:account_payment_purchase.model_purchase_order
|
||||
msgid "Purchase Order"
|
||||
msgstr "Inkooporder"
|
||||
|
||||
#. module: account_payment_purchase
|
||||
#: help:purchase.order,supplier_partner_bank_id: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 ""
|
||||
"Selecteer de bankrekening van de leverancier waarop uw bedrijf de betaling "
|
||||
"moet sturen. Dit veld wordt gekopieerd van de leverancier en wordt "
|
||||
"gekopieerd naar de inkoopfactuur."
|
||||
|
||||
#. module: account_payment_purchase
|
||||
#: field:purchase.order,supplier_partner_bank_id:0
|
||||
msgid "Supplier Bank Account"
|
||||
msgstr "Bankrekening leverancier"
|
||||
24
account_payment_purchase/model/__init__.py
Normal file
24
account_payment_purchase/model/__init__.py
Normal file
@@ -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 <alexis.delattre@akretion.com>
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from . import purchase
|
||||
from . import stock
|
||||
82
account_payment_purchase/model/purchase.py
Normal file
82
account_payment_purchase/model/purchase.py
Normal file
@@ -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 <alexis.delattre@akretion.com>
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from openerp.osv import orm, fields
|
||||
|
||||
|
||||
class purchase_order(orm.Model):
|
||||
_inherit = "purchase.order"
|
||||
|
||||
_columns = {
|
||||
'supplier_partner_bank_id': 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_id': fields.many2one(
|
||||
'payment.mode', 'Payment Mode'),
|
||||
}
|
||||
|
||||
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_id':
|
||||
self._get_default_supplier_partner_bank(
|
||||
cr, uid, partner),
|
||||
'payment_mode_id':
|
||||
partner.supplier_payment_mode.id or False,
|
||||
})
|
||||
else:
|
||||
res['value'].update({
|
||||
'supplier_partner_bank_id': False,
|
||||
'payment_mode_id': 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.id or False,
|
||||
'payment_mode_id':
|
||||
order.payment_mode_id.id or False,
|
||||
}, context=context)
|
||||
return res
|
||||
42
account_payment_purchase/model/stock.py
Normal file
42
account_payment_purchase/model/stock.py
Normal file
@@ -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 <alexis.delattre@akretion.com>
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
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
|
||||
24
account_payment_purchase/models/__init__.py
Normal file
24
account_payment_purchase/models/__init__.py
Normal file
@@ -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 <alexis.delattre@akretion.com>
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from . import purchase_order
|
||||
from . import stock_picking
|
||||
63
account_payment_purchase/models/purchase_order.py
Normal file
63
account_payment_purchase/models/purchase_order.py
Normal file
@@ -0,0 +1,63 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Account Payment Purchase module for OpenERP
|
||||
# Copyright (C) 2014 Akretion (http://www.akretion.com)
|
||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from openerp import models, fields, api
|
||||
|
||||
|
||||
class PurchaseOrder(models.Model):
|
||||
_inherit = "purchase.order"
|
||||
|
||||
supplier_partner_bank_id = fields.Many2one(
|
||||
'res.partner.bank', string='Supplier Bank Account',
|
||||
domain="[('partner_id', '=', partner_id)]",
|
||||
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_id = fields.Many2one(
|
||||
'payment.mode', string='Payment Mode',
|
||||
domain="[('payment_order_type', '=', 'payment')]")
|
||||
|
||||
@api.model
|
||||
def _get_default_supplier_partner_bank(self, partner):
|
||||
"""This function is designed to be inherited"""
|
||||
return partner.bank_ids and partner.bank_ids[0].id or False
|
||||
|
||||
@api.multi
|
||||
def onchange_partner_id(self, partner_id):
|
||||
res = super(PurchaseOrder, self).onchange_partner_id(partner_id)
|
||||
if partner_id:
|
||||
partner = self.env['res.partner'].browse(partner_id)
|
||||
res['value']['supplier_partner_bank_id'] = \
|
||||
self._get_default_supplier_partner_bank(partner)
|
||||
res['value']['payment_mode_id'] = partner.supplier_payment_mode.id
|
||||
else:
|
||||
res['value']['supplier_partner_bank_id'] = False
|
||||
res['value']['payment_mode_id'] = False
|
||||
return res
|
||||
|
||||
@api.model
|
||||
def _prepare_invoice(self, order, line_ids):
|
||||
res = super(PurchaseOrder, self)._prepare_invoice(order, line_ids)
|
||||
if order:
|
||||
res['partner_bank_id'] = order.supplier_partner_bank_id.id
|
||||
res['payment_mode_id'] = order.payment_mode_id.id
|
||||
return res
|
||||
38
account_payment_purchase/models/stock_picking.py
Normal file
38
account_payment_purchase/models/stock_picking.py
Normal file
@@ -0,0 +1,38 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Account Payment Purchase module for OpenERP
|
||||
# Copyright (C) 2014 Akretion (http://www.akretion.com)
|
||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from openerp import models, api
|
||||
|
||||
|
||||
class StockPicking(models.Model):
|
||||
_inherit = "stock.picking"
|
||||
|
||||
@api.model
|
||||
def _create_invoice_from_picking(self, picking, vals):
|
||||
if picking and picking.move_lines:
|
||||
# Get purchase order from first move line
|
||||
if picking.move_lines[0].purchase_line_id:
|
||||
purchase = picking.move_lines[0].purchase_line_id.order_id
|
||||
vals['partner_bank_id'] = purchase.supplier_partner_bank_id.id
|
||||
vals['payment_mode_id'] = purchase.payment_mode_id.id
|
||||
return super(StockPicking, self)._create_invoice_from_picking(picking,
|
||||
vals)
|
||||
26
account_payment_purchase/view/purchase.xml
Normal file
26
account_payment_purchase/view/purchase.xml
Normal file
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
Copyright (C) 2014 Akretion (http://www.akretion.com/)
|
||||
@author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
The licence is in the file __openerp__.py
|
||||
-->
|
||||
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="purchase_order_form" model="ir.ui.view">
|
||||
<field name="name">account_payment_purchase.purchase_order.form</field>
|
||||
<field name="model">purchase.order</field>
|
||||
<field name="inherit_id" ref="purchase.purchase_order_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="payment_term_id" position="after">
|
||||
<field name="payment_mode_id"/>
|
||||
<field name="supplier_partner_bank_id"
|
||||
domain="[('partner_id', '=', partner_id)]" />
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
25
account_payment_purchase/views/purchase_order_view.xml
Normal file
25
account_payment_purchase/views/purchase_order_view.xml
Normal file
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
Copyright (C) 2014 Akretion (http://www.akretion.com/)
|
||||
@author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
The licence is in the file __openerp__.py
|
||||
-->
|
||||
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="purchase_order_form" model="ir.ui.view">
|
||||
<field name="name">account_payment_purchase.purchase_order.form</field>
|
||||
<field name="model">purchase.order</field>
|
||||
<field name="inherit_id" ref="purchase.purchase_order_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="payment_term_id" position="after">
|
||||
<field name="payment_mode_id"/>
|
||||
<field name="supplier_partner_bank_id"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
Reference in New Issue
Block a user