[MIG] account_payment_sale: Migration to 8.0

* Migration and enhancement of all modules involved in SEPA
* Remove duplicated files
* Check if payment mode is set in the propagation
* Clean files
* account_payment_sale_stock: Split for removing stock dependency on sale
* Remove old translations templates
* Reorder on folder structure
* Translation template files
* Translations to spanish
* Use sale_ok and purchase_ok instead of tweaking payment type
* Add sale_ok and purchase_ok filters in partner/sale/purchase form views
* Use widget=selection for payment_mode_id fields
* Update demo data
This commit is contained in:
Pedro M. Baeza
2014-09-10 12:19:20 +02:00
committed by David Ramia
parent bf2b6b1112
commit 9d08371f66
10 changed files with 174 additions and 58 deletions

View File

@@ -0,0 +1,81 @@
.. 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
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*.
Installation
============
This module depends on :
* purchase
* account_payment_partner
This module is part of the OCA/bank-payment suite.
Configuration
=============
There is nothing to configure.
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
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**>`_.
Credits
=======
Contributors
------------
* Pedro M. Baeza
* Alexis de Lattre
* Alexandre Fayolle
* Danimar Ribeiro
* Raphaël Valyi
Maintainer
----------
.. image:: http://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: http://odoo-community.org
This module is maintained by the OCA.
OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.
To contribute to this module, please visit http://odoo-community.org.

View File

@@ -20,4 +20,4 @@
#
##############################################################################
from . import model
from . import models

View File

@@ -22,34 +22,22 @@
{
'name': 'Account Payment Sale',
'version': '1.0',
'version': '8.0.1.0.0',
'category': 'Banking addons',
'license': 'AGPL-3',
'summary': "Adds Payment Mode on Sale Orders",
'description': """
Account Payment Sale
====================
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
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 <alexis.delattre@akretion.com>
for any help or question about this module.
""",
'author': 'Akretion',
'website': 'http://www.akretion.com',
'depends': ['sale', 'account_payment_partner'],
'summary': "Adds payment mode on sale orders",
'author': "Akretion, "
"Serv. Tecnol. Avanzados - Pedro M. Baeza, "
"Odoo Community Association (OCA)",
'website': 'https://github.com/OCA/bank-payment',
'depends': [
'sale',
'account_payment_partner'
],
'conflicts': ['sale_payment'],
'data': [
'view/sale.xml',
'views/sale_order_view.xml',
],
'installable': True,
'active': False,
'auto_install': True,
}

View File

@@ -1,13 +1,13 @@
# Translation of OpenERP Server.
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_payment_sale
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 7.0\n"
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-06-09 23:24+0000\n"
"PO-Revision-Date: 2014-06-09 23:24+0000\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"

View File

@@ -0,0 +1,27 @@
# 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 "Modo de pago"
#. 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,27 @@
# 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: Danimar Ribeiro <danimaribeiro@gmail.com>\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 "Modo de Pagamento"
#. module: account_payment_sale
#: model:ir.model,name:account_payment_sale.model_sale_order
msgid "Sales Order"
msgstr "Pedido de Venda"

View File

@@ -1,10 +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
@@ -20,4 +16,4 @@
#
##############################################################################
from . import sale
from . import sale_order

View File

@@ -20,36 +20,31 @@
#
##############################################################################
from openerp.osv import orm, fields
from openerp import models, fields, api
class sale_order(orm.Model):
class SaleOrder(models.Model):
_inherit = "sale.order"
_columns = {
'payment_mode_id': fields.many2one(
'payment.mode', 'Payment Mode'),
}
payment_mode_id = fields.Many2one(
'payment.mode', string='Payment Mode',
domain="[('sale_ok', '=', True)]")
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']['payment_mode_id'] = \
partner.customer_payment_mode.id or False,
@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
else:
res['value']['payment_mode_id'] = False
return res
def _prepare_invoice(self, cr, uid, order, lines, context=None):
@api.model
def _prepare_invoice(self, order, lines):
"""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({
'payment_mode_id': order.payment_mode_id.id or False,
'partner_bank_id': order.payment_mode_id and
order.payment_mode_id.bank_id.id or False,
})
return invoice_vals
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
return vals

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

View File

@@ -15,7 +15,9 @@
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<field name="payment_term" position="after">
<field name="payment_mode_id"/>
<field name="payment_mode_id"
domain="[('sale_ok', '=', True)]"
widget="selection"/>
</field>
</field>
</record>