account_payment_*: Ensure work with dropshipping dual invoice

When invoicing from dropshipping, the same picking serves for both
invoicing sale and purchase orders. The OCA module
stock_dropshipping_dual_invoice makes that this happens, but
as the picking is the same, it contains both the sale and the
purchase reference, making that the resulting invoices don't have
the correct payment mode. This is harmless for the rest of
operations, as the dictionary query is provided with the proper
default value. On v9, dropshipping dual invoice has been merged
into core, so this patch for sure will be welcome in that version
(if the used method is the same).
This commit is contained in:
Pedro M. Baeza
2016-01-25 05:58:43 +01:00
committed by David Ramia
parent 6939b277fd
commit f5bcc2c4e2
4 changed files with 99 additions and 32 deletions

View File

@@ -1,31 +1,37 @@
# Translation of OpenERP Server.
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_payment_purchase
#
# * account_payment_purchase
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 7.0\n"
"Project-Id-Version: bank-payment (8.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"
"POT-Creation-Date: 2016-04-08 00:46+0000\n"
"PO-Revision-Date: 2016-04-06 00:16+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>\n"
"Language-Team: French (http://www.transifex.com/oca/OCA-bank-payment-8-0/language/fr/)\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"
"Content-Transfer-Encoding: \n"
"Language: fr\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#. module: account_payment_purchase
#: field:purchase.order,payment_mode_id:0
msgid "Payment Mode"
msgstr ""
msgstr "Mode de paiement"
#. 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_procurement_order
msgid "Procurement"
msgstr ""
#. module: account_payment_purchase
#: model:ir.model,name:account_payment_purchase.model_purchase_order
msgid "Purchase Order"
@@ -35,12 +41,9 @@ msgstr "Bon de commande"
#: 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."
"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

View File

@@ -1,19 +1,22 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_payment_purchase
#
# * account_payment_purchase
#
# Translators:
# danimaribeiro <danimaribeiro@gmail.com>, 2016
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Project-Id-Version: bank-payment (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-10-31 22:55+0000\n"
"PO-Revision-Date: 2014-10-31 22:55+0000\n"
"Last-Translator: Danimar Ribeiro <danimaribeiro@gmail.com>\n"
"Language-Team: \n"
"POT-Creation-Date: 2016-04-08 00:46+0000\n"
"PO-Revision-Date: 2016-04-06 01:03+0000\n"
"Last-Translator: danimaribeiro <danimaribeiro@gmail.com>\n"
"Language-Team: Portuguese (Brazil) (http://www.transifex.com/oca/OCA-bank-payment-8-0/language/pt_BR/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
"Language: pt_BR\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#. module: account_payment_purchase
#: field:purchase.order,payment_mode_id:0
@@ -25,6 +28,11 @@ msgstr "Modo de Pagamento"
msgid "Picking List"
msgstr "Lista de Separação"
#. module: account_payment_purchase
#: model:ir.model,name:account_payment_purchase.model_procurement_order
msgid "Procurement"
msgstr "Aquisição"
#. module: account_payment_purchase
#: model:ir.model,name:account_payment_purchase.model_purchase_order
msgid "Purchase Order"
@@ -32,11 +40,13 @@ msgstr "Pedido de Compra"
#. 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."
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 "Selecione a conta bancária do seu fornecedor para a qual sua empresa deve mandar o pagamento. Este campo é copiado do parceiro e será copiado para a fatura do fornecedor."
#. module: account_payment_purchase
#: field:purchase.order,supplier_partner_bank_id:0
msgid "Supplier Bank Account"
msgstr "Conta Bancária do Fornecedor"

View File

@@ -0,0 +1,52 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_payment_purchase
#
# Translators:
# Matjaž Mozetič <m.mozetic@matmoz.si>, 2016
msgid ""
msgstr ""
"Project-Id-Version: bank-payment (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-04-08 00:46+0000\n"
"PO-Revision-Date: 2016-04-08 05:50+0000\n"
"Last-Translator: Matjaž Mozetič <m.mozetic@matmoz.si>\n"
"Language-Team: Slovenian (http://www.transifex.com/oca/OCA-bank-payment-8-0/language/sl/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: sl\n"
"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);\n"
#. module: account_payment_purchase
#: field:purchase.order,payment_mode_id:0
msgid "Payment Mode"
msgstr "Metoda plačila"
#. module: account_payment_purchase
#: model:ir.model,name:account_payment_purchase.model_stock_picking
msgid "Picking List"
msgstr "Zbirni seznam"
#. module: account_payment_purchase
#: model:ir.model,name:account_payment_purchase.model_procurement_order
msgid "Procurement"
msgstr "Oskrba"
#. module: account_payment_purchase
#: model:ir.model,name:account_payment_purchase.model_purchase_order
msgid "Purchase Order"
msgstr "Nabavni nalog"
#. 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 "Izberite bančni račun dobavitelja, na katerega bo vaša družba izvedla nakazilo. To polje se kopira iz partnerja in bo kopirano na prejeti račun."
#. module: account_payment_purchase
#: field:purchase.order,supplier_partner_bank_id:0
msgid "Supplier Bank Account"
msgstr "Bančni račun dobavitelja"

View File

@@ -1,4 +1,4 @@
# -*- encoding: utf-8 -*-
# -*- coding: utf-8 -*-
##############################################################################
#
# Account Payment Purchase module for OpenERP
@@ -28,11 +28,13 @@ class StockPicking(models.Model):
@api.model
def _create_invoice_from_picking(self, picking, vals):
if picking and picking.move_lines:
# This will assure that stock_dropshipping_dual_invoice will work
inv_type = self.env.context.get('inv_type', 'in_invoice')
if picking and picking.move_lines and inv_type == 'in_invoice':
# 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)
return super(StockPicking, self)._create_invoice_from_picking(
picking, vals)