From f5bcc2c4e21b86b1d6e231219fe5f46683dc30e9 Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Mon, 25 Jan 2016 05:58:43 +0100 Subject: [PATCH] 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). --- account_payment_purchase/i18n/fr.po | 39 +++++++------- account_payment_purchase/i18n/pt_BR.po | 30 +++++++---- account_payment_purchase/i18n/sl.po | 52 +++++++++++++++++++ .../models/stock_picking.py | 10 ++-- 4 files changed, 99 insertions(+), 32 deletions(-) create mode 100644 account_payment_purchase/i18n/sl.po diff --git a/account_payment_purchase/i18n/fr.po b/account_payment_purchase/i18n/fr.po index 48596ceec..ba2ba9f89 100644 --- a/account_payment_purchase/i18n/fr.po +++ b/account_payment_purchase/i18n/fr.po @@ -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 \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 \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 diff --git a/account_payment_purchase/i18n/pt_BR.po b/account_payment_purchase/i18n/pt_BR.po index 2818e149a..1241e9a20 100644 --- a/account_payment_purchase/i18n/pt_BR.po +++ b/account_payment_purchase/i18n/pt_BR.po @@ -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 , 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 \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 \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" - diff --git a/account_payment_purchase/i18n/sl.po b/account_payment_purchase/i18n/sl.po new file mode 100644 index 000000000..f3b0b47dd --- /dev/null +++ b/account_payment_purchase/i18n/sl.po @@ -0,0 +1,52 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_payment_purchase +# +# Translators: +# Matjaž Mozetič , 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č \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" diff --git a/account_payment_purchase/models/stock_picking.py b/account_payment_purchase/models/stock_picking.py index 2ab8c6073..28d30e057 100644 --- a/account_payment_purchase/models/stock_picking.py +++ b/account_payment_purchase/models/stock_picking.py @@ -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)