[MIG] account_payment_sale: Migration to v9

This commit is contained in:
Alexis de Lattre
2016-05-02 11:43:11 +02:00
committed by David Ramia
parent 9d08371f66
commit 165ef1b9bf
15 changed files with 236 additions and 175 deletions

View File

@@ -1,13 +1,12 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:alt: License: AGPL-3
====================
Account Payment Sale
====================
This module should be used when the invoice is based on the sale order.
This modules adds one field on sale orders: *Payment Mode*.
This field is copied from partner to sale order and then from sale order to
This field is copied from customer to sale order and then from sale order to
customer invoice.
This module is similar to the *sale_payment* module; the main difference is
@@ -19,7 +18,8 @@ Installation
============
This module depends on :
* purchase
* sale
* account_payment_partner
This module is part of the OCA/bank-payment suite.
@@ -35,25 +35,23 @@ Usage
You are able to add a payment mode directly on a partner.
This payment mode is automatically associated to the sale order, then on related invoice.
This default value could be change in a draft sale order or draft invoice.
When you create an direct debit 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
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/173/9.0
Known issues / Roadmap
======================
* No known issues.
Bug Tracker
===========
Bugs are tracked on `GitHub Issues <https://github.com/OCA/bank-payment/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 <https://github.com/OCA/bank-payment/issues/new?body=module:%20account_payment_sale%0Aversion:%208.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Bugs are tracked on `GitHub Issues
<https://github.com/OCA/bank-payment/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.
Credits
=======
@@ -62,7 +60,7 @@ Contributors
------------
* Pedro M. Baeza
* Alexis de Lattre
* Alexis de Lattre <alexis.delattre@akretion.com>
* Alexandre Fayolle
* Danimar Ribeiro
* Raphaël Valyi

View File

@@ -1,23 +1,4 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Account Payment Sale 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/>.
#
##############################################################################
# -*- coding: utf-8 -*-
from . import models
from . import wizard

View File

@@ -1,28 +1,11 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Account Payment Sale 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/>.
#
##############################################################################
# -*- coding: utf-8 -*-
# © 2014-2016 Akretion (http://www.akretion.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
# @author Alexis de Lattre <alexis.delattre@akretion.com>
{
'name': 'Account Payment Sale',
'version': '8.0.1.0.0',
'version': '9.0.1.0.0',
'category': 'Banking addons',
'license': 'AGPL-3',
'summary': "Adds payment mode on sale orders",

View File

@@ -1,27 +0,0 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_payment_sale
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-10-31 23:00+0000\n"
"PO-Revision-Date: 2014-10-31 23:00+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_id:0
msgid "Payment Mode"
msgstr ""
#. module: account_payment_sale
#: model:ir.model,name:account_payment_sale.model_sale_order
msgid "Sales Order"
msgstr ""

View File

@@ -0,0 +1,38 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_payment_sale
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: bank-payment (10.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-12-08 01:38+0000\n"
"PO-Revision-Date: 2017-12-07 19:29+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>\n"
"Language-Team: German (http://www.transifex.com/oca/OCA-bank-payment-10-0/language/de/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: de\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: account_payment_sale
#: model:ir.ui.view,arch_db:account_payment_sale.report_sale_payment_mode
msgid "<strong>Payment Mode:</strong>"
msgstr "<strong>Zahlungsmethode:</strong>"
#. module: account_payment_sale
#: model:ir.model.fields,field_description:account_payment_sale.field_sale_order_payment_mode_id
msgid "Payment Mode"
msgstr "Zahlungsmodus"
#. module: account_payment_sale
#: model:ir.model,name:account_payment_sale.model_sale_advance_payment_inv
msgid "Sales Advance Payment Invoice"
msgstr "Verkaufsanzahlungsrechnung"
#. module: account_payment_sale
#: model:ir.model,name:account_payment_sale.model_sale_order
msgid "Sales Order"
msgstr "Kundenauftrag"

View File

@@ -1,27 +1,34 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_payment_sale
#
# * account_payment_sale
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2016
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Project-Id-Version: Odoo Server 9.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-10-31 23:00+0000\n"
"PO-Revision-Date: 2014-10-31 23:00+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"POT-Creation-Date: 2016-07-01 19:28+0000\n"
"PO-Revision-Date: 2016-07-01 19:28+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2016\n"
"Language-Team: Spanish (https://www.transifex.com/oca/teams/23907/es/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
"Language: es\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: account_payment_sale
#: field:sale.order,payment_mode_id:0
#: model:ir.model.fields,field_description:account_payment_sale.field_sale_order_payment_mode_id
msgid "Payment Mode"
msgstr "Modo de pago"
#. module: account_payment_sale
#: model:ir.model,name:account_payment_sale.model_sale_advance_payment_inv
msgid "Sales Advance Payment Invoice"
msgstr ""
#. module: account_payment_sale
#: model:ir.model,name:account_payment_sale.model_sale_order
msgid "Sales Order"
msgstr "Pedido de venta"

View File

@@ -0,0 +1,34 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_payment_sale
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2016
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-07-01 19:28+0000\n"
"PO-Revision-Date: 2016-07-01 19:28+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2016\n"
"Language-Team: French (https://www.transifex.com/oca/teams/23907/fr/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: fr\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#. module: account_payment_sale
#: model:ir.model.fields,field_description:account_payment_sale.field_sale_order_payment_mode_id
msgid "Payment Mode"
msgstr "Mode de paiement"
#. module: account_payment_sale
#: model:ir.model,name:account_payment_sale.model_sale_advance_payment_inv
msgid "Sales Advance Payment Invoice"
msgstr ""
#. module: account_payment_sale
#: model:ir.model,name:account_payment_sale.model_sale_order
msgid "Sales Order"
msgstr ""

View File

@@ -1,27 +1,39 @@
# 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.
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_payment_sale
#
# Translators:
# Erwin van der Ploeg <erwin@odooexperts.nl>, 2016
# OCA Transbot <transbot@odoo-community.org>, 2016
msgid ""
msgstr ""
"Project-Id-Version: banking-addons\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
"POT-Creation-Date: 2014-06-09 23:24+0000\n"
"PO-Revision-Date: 2014-06-26 14:13+0000\n"
"Last-Translator: Erwin van der Ploeg (BAS Solutions) <Unknown>\n"
"Language-Team: Dutch <nl@li.org>\n"
"Project-Id-Version: bank-payment (10.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-12-08 01:38+0000\n"
"PO-Revision-Date: 2017-12-19 18:17+0200\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>\n"
"Language-Team: Dutch (http://www.transifex.com/oca/OCA-bank-payment-10-0/language/nl/)\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"
"Content-Transfer-Encoding: \n"
"Language: nl\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: account_payment_sale
#: field:sale.order,payment_mode_id:0
#: model:ir.ui.view,arch_db:account_payment_sale.report_sale_payment_mode
msgid "<strong>Payment Mode:</strong>"
msgstr "<strong>Betaalmode:</strong>"
#. module: account_payment_sale
#: model:ir.model.fields,field_description:account_payment_sale.field_sale_order_payment_mode_id
msgid "Payment Mode"
msgstr "Betaalwijze"
#. module: account_payment_sale
#: model:ir.model,name:account_payment_sale.model_sale_advance_payment_inv
msgid "Sales Advance Payment Invoice"
msgstr "Verkoop Incassofactuur"
#. module: account_payment_sale
#: model:ir.model,name:account_payment_sale.model_sale_order
msgid "Sales Order"

View File

@@ -1,27 +1,34 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_payment_sale
#
# * account_payment_sale
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2016
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Project-Id-Version: Odoo Server 9.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-10-31 23:00+0000\n"
"PO-Revision-Date: 2014-10-31 23:00+0000\n"
"Last-Translator: Danimar Ribeiro <danimaribeiro@gmail.com>\n"
"Language-Team: \n"
"POT-Creation-Date: 2016-07-01 19:28+0000\n"
"PO-Revision-Date: 2016-07-01 19:28+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2016\n"
"Language-Team: Portuguese (Brazil) (https://www.transifex.com/oca/teams/23907/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_sale
#: field:sale.order,payment_mode_id:0
#: model:ir.model.fields,field_description:account_payment_sale.field_sale_order_payment_mode_id
msgid "Payment Mode"
msgstr "Modo de Pagamento"
#. module: account_payment_sale
#: model:ir.model,name:account_payment_sale.model_sale_advance_payment_inv
msgid "Sales Advance Payment Invoice"
msgstr ""
#. module: account_payment_sale
#: model:ir.model,name:account_payment_sale.model_sale_order
msgid "Sales Order"
msgstr "Pedido de Venda"

View File

@@ -0,0 +1,34 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_payment_sale
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2016
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-07-01 19:28+0000\n"
"PO-Revision-Date: 2016-07-01 19:28+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2016\n"
"Language-Team: Slovenian (https://www.transifex.com/oca/teams/23907/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_sale
#: model:ir.model.fields,field_description:account_payment_sale.field_sale_order_payment_mode_id
msgid "Payment Mode"
msgstr "Metoda plačila"
#. module: account_payment_sale
#: model:ir.model,name:account_payment_sale.model_sale_advance_payment_inv
msgid "Sales Advance Payment Invoice"
msgstr ""
#. module: account_payment_sale
#: model:ir.model,name:account_payment_sale.model_sale_order
msgid "Sales Order"
msgstr "Plačilni nalog"

View File

@@ -1,19 +1,3 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# 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/>.
#
##############################################################################
# -*- coding: utf-8 -*-
from . import sale_order

View File

@@ -1,24 +1,6 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Account Payment Sale 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/>.
#
##############################################################################
# -*- coding: utf-8 -*-
# © 2014-2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import models, fields, api
@@ -27,24 +9,25 @@ class SaleOrder(models.Model):
_inherit = "sale.order"
payment_mode_id = fields.Many2one(
'payment.mode', string='Payment Mode',
domain="[('sale_ok', '=', True)]")
'account.payment.mode', string='Payment Mode',
domain=[('payment_type', '=', 'inbound')])
@api.multi
def onchange_partner_id(self, partner_id):
res = super(SaleOrder, self).onchange_partner_id(partner_id)
if partner_id:
partner = self.env['res.partner'].browse(partner_id)
res['value']['payment_mode_id'] = partner.customer_payment_mode.id
@api.onchange('partner_id')
def onchange_partner_id(self):
res = super(SaleOrder, self).onchange_partner_id()
if self.partner_id:
self.payment_mode_id = self.partner_id.customer_payment_mode_id
else:
res['value']['payment_mode_id'] = False
self.payment_mode_id = False
return res
@api.model
def _prepare_invoice(self, order, lines):
@api.multi
def _prepare_invoice(self):
"""Copy bank partner from sale order to invoice"""
vals = super(SaleOrder, self)._prepare_invoice(order, lines)
if order.payment_mode_id:
vals['payment_mode_id'] = order.payment_mode_id.id
vals['partner_bank_id'] = order.payment_mode_id.bank_id.id
vals = super(SaleOrder, self)._prepare_invoice()
if self.payment_mode_id:
vals['payment_mode_id'] = self.payment_mode_id.id
if self.payment_mode_id.bank_account_link == 'fixed':
vals['partner_bank_id'] =\
self.payment_mode_id.fixed_journal_id.bank_account_id.id
return vals

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2014 Akretion (http://www.akretion.com/)
Copyright (C) 2014-2016 Akretion (http://www.akretion.com/)
@author Alexis de Lattre <alexis.delattre@akretion.com>
The licence is in the file __openerp__.py
-->
@@ -14,9 +14,9 @@
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<field name="payment_term" position="after">
<field name="payment_term_id" position="after">
<field name="payment_mode_id"
domain="[('sale_ok', '=', True)]"
domain="[('payment_type', '=', 'inbound')]"
widget="selection"/>
</field>
</field>

View File

@@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-
from . import sale_make_invoice_advance

View File

@@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
# © 2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import models, api
class SaleAdvancePaymentInv(models.TransientModel):
_inherit = 'sale.advance.payment.inv'
@api.multi
def _create_invoice(self, order, so_line, amount):
"""Copy payment mode from sale order to invoice"""
inv = super(SaleAdvancePaymentInv, self)._create_invoice(
order, so_line, amount)
vals = {}
if order.payment_mode_id:
vals['payment_mode_id'] = order.payment_mode_id.id
if order.payment_mode_id.bank_account_link == 'fixed':
vals['partner_bank_id'] =\
order.payment_mode_id.fixed_journal_id.bank_account_id.id
if vals:
inv.write(vals)
return inv