[MIG] account_payment_partner: Migration to v8

* Migration and enhancement of all modules involved in SEPA
* Clean files
* Replace deprecated workflow calls
* Translation template files
* Translations to spanish
* Use sale_ok and purchase_ok instead of tweaking payment type
This commit is contained in:
Pedro M. Baeza
2014-09-10 12:19:20 +02:00
committed by Marçal Isern
parent 7824be8af3
commit 451a7dda0a
15 changed files with 254 additions and 100 deletions

View File

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

View File

@@ -23,7 +23,7 @@
{
'name': 'Account Payment Partner',
'version': '0.1',
'version': '8.0.0.1.0',
'category': 'Banking addons',
'license': 'AGPL-3',
'summary': 'Adds payment mode on partners and invoices',
@@ -39,17 +39,15 @@ This module adds severals fields :
On a Payment Order, in the wizard *Select Invoices to Pay*, the invoices will
be filtered per Payment Mode.
Please contact Alexis de Lattre from Akretion <alexis.delattre@akretion.com>
for any help or question about this module.
""",
'author': 'Akretion',
'author': "Akretion,Odoo Community Association (OCA)",
'website': 'http://www.akretion.com',
'contributors': ['Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>'],
'depends': ['account_banking_payment_export'],
'data': [
'view/partner.xml',
'view/account_invoice.xml',
'views/res_partner_view.xml',
'views/account_invoice_view.xml',
],
'demo': ['demo/partner_demo.xml'],
'active': False,
'installable': 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_partner
#
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:22+0000\n"
"PO-Revision-Date: 2014-06-09 23:22+0000\n"
"POT-Creation-Date: 2014-10-31 22:53+0000\n"
"PO-Revision-Date: 2014-10-31 22:53+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@@ -50,8 +50,3 @@ msgstr ""
msgid "Supplier Payment Mode"
msgstr ""
#. module: account_payment_partner
#: model:ir.model,name:account_payment_partner.model_payment_order_create
msgid "payment.order.create"
msgstr ""

View File

@@ -0,0 +1,52 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_payment_partner
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-10-31 22:53+0000\n"
"PO-Revision-Date: 2014-10-31 22:53+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_partner
#: field:res.partner,customer_payment_mode:0
msgid "Customer Payment Mode"
msgstr "Modo de pago de cliente"
#. module: account_payment_partner
#: model:ir.model,name:account_payment_partner.model_account_invoice
msgid "Invoice"
msgstr "Factura"
#. module: account_payment_partner
#: model:ir.model,name:account_payment_partner.model_res_partner
msgid "Partner"
msgstr "Empresa"
#. module: account_payment_partner
#: field:account.invoice,payment_mode_id:0
msgid "Payment Mode"
msgstr "Modo de pago"
#. module: account_payment_partner
#: help:res.partner,customer_payment_mode:0
msgid "Select the default payment mode for this customer."
msgstr "Seleccione el modo de pago por defecto cuando esta empresa actúa como cliente."
#. module: account_payment_partner
#: help:res.partner,supplier_payment_mode:0
msgid "Select the default payment mode for this supplier."
msgstr "Seleccione el modo de pago por defecto cuando esta empresa actúa como proveedor."
#. module: account_payment_partner
#: field:res.partner,supplier_payment_mode:0
msgid "Supplier Payment Mode"
msgstr "Modo de pago de proveedor"

View File

@@ -0,0 +1,57 @@
# Translation of OpenERP Server.
# This file contains the translation of the following modules:
# * account_payment_partner
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 7.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-06-09 23:22+0000\n"
"PO-Revision-Date: 2014-06-09 23:22+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_partner
#: field:res.partner,customer_payment_mode:0
msgid "Customer Payment Mode"
msgstr ""
#. module: account_payment_partner
#: model:ir.model,name:account_payment_partner.model_account_invoice
msgid "Invoice"
msgstr ""
#. module: account_payment_partner
#: model:ir.model,name:account_payment_partner.model_res_partner
msgid "Partner"
msgstr ""
#. module: account_payment_partner
#: field:account.invoice,payment_mode_id:0
msgid "Payment Mode"
msgstr ""
#. module: account_payment_partner
#: help:res.partner,customer_payment_mode:0
msgid "Select the default payment mode for this customer."
msgstr ""
#. module: account_payment_partner
#: help:res.partner,supplier_payment_mode:0
msgid "Select the default payment mode for this supplier."
msgstr ""
#. module: account_payment_partner
#: field:res.partner,supplier_payment_mode:0
msgid "Supplier Payment Mode"
msgstr ""
#. module: account_payment_partner
#: model:ir.model,name:account_payment_partner.model_payment_order_create
msgid "payment.order.create"
msgstr ""

View File

@@ -0,0 +1,24 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Account Payment Partner 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 res_partner
from . import account_invoice

View File

@@ -20,36 +20,33 @@
#
##############################################################################
from openerp.osv import orm, fields
from openerp import models, fields, api
class account_invoice(orm.Model):
class AccountInvoice(models.Model):
_inherit = 'account.invoice'
_columns = {
'payment_mode_id': fields.many2one(
'payment.mode', 'Payment Mode'),
}
payment_mode_id = fields.Many2one(
comodel_name='payment.mode', string="Payment Mode",
domain="[('type', '=', type)]")
@api.multi
def onchange_partner_id(
self, cr, uid, ids, type, partner_id, date_invoice=False,
self, type, partner_id, date_invoice=False,
payment_term=False, partner_bank_id=False, company_id=False):
res = super(account_invoice, self).onchange_partner_id(
cr, uid, ids, type, partner_id, date_invoice=date_invoice,
res = super(AccountInvoice, self).onchange_partner_id(
type, partner_id, date_invoice=date_invoice,
payment_term=payment_term, partner_bank_id=partner_bank_id,
company_id=company_id)
if partner_id:
partner = self.pool['res.partner'].browse(cr, uid, partner_id)
partner = self.env['res.partner'].browse(partner_id)
if type == 'in_invoice':
res['value']['payment_mode_id'] = \
partner.supplier_payment_mode.id or False
partner.supplier_payment_mode.id
elif type == 'out_invoice':
res['value'].update({
'payment_mode_id':
partner.customer_payment_mode.id or False,
'partner_bank_id':
partner.customer_payment_mode and
partner.customer_payment_mode.bank_id.id or False,
'payment_mode_id': partner.customer_payment_mode.id,
'partner_bank_id': partner.customer_payment_mode.bank_id.id
})
else:
res['value']['payment_mode_id'] = False

View File

@@ -23,17 +23,16 @@
from openerp.osv import orm
class payment_order_create(orm.TransientModel):
class PaymentOrderCreate(orm.TransientModel):
_inherit = 'payment.order.create'
def extend_payment_order_domain(
self, cr, uid, payment_order, domain, context=None):
super(payment_order_create, self).extend_payment_order_domain(
super(PaymentOrderCreate, self).extend_payment_order_domain(
cr, uid, payment_order, domain, context=context)
domain += [
'|', '|',
('invoice', '=', False),
('invoice.payment_mode_id', '=', False),
('invoice.payment_mode_id', '=', payment_order.mode.id)
]
('invoice.payment_mode_id', '=', payment_order.mode.id)]
return True

View File

@@ -20,25 +20,23 @@
#
##############################################################################
from openerp.osv import orm, fields
from openerp import models, fields, api
class res_partner(orm.Model):
class ResPartner(models.Model):
_inherit = 'res.partner'
_columns = {
'supplier_payment_mode': fields.property(
'payment.mode', type='many2one', relation='payment.mode',
string='Supplier Payment Mode', view_load=True,
help="Select the default payment mode for this supplier."),
'customer_payment_mode': fields.property(
'payment.mode', type='many2one', relation='payment.mode',
string='Customer Payment Mode', view_load=True,
help="Select the default payment mode for this customer."),
}
supplier_payment_mode = fields.Many2one(
'payment.mode', string='Supplier Payment Mode', company_dependent=True,
domain="[('purchase_ok', '=', True)]",
help="Select the default payment mode for this supplier.")
customer_payment_mode = fields.Many2one(
'payment.mode', string='Customer Payment Mode', company_dependent=True,
domain="[('sale_ok', '=', True)]",
help="Select the default payment mode for this customer.")
def _commercial_fields(self, cr, uid, context=None):
res = super(res_partner, self)._commercial_fields(
cr, uid, context=context)
@api.model
def _commercial_fields(self):
res = super(ResPartner, self)._commercial_fields()
res += ['supplier_payment_mode', 'customer_payment_mode']
return res

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

View File

@@ -1,38 +0,0 @@
<?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="invoice_form" model="ir.ui.view">
<field name="name">account_payment_partner.invoice_form</field>
<field name="model">account.invoice</field>
<field name="inherit_id" ref="account.invoice_form" />
<field name="arch" type="xml">
<field name="partner_bank_id" position="after">
<field name="payment_mode_id"/>
</field>
</field>
</record>
<record id="invoice_supplier_form" model="ir.ui.view">
<field name="name">account_payment_partner.invoice_supplier_form</field>
<field name="model">account.invoice</field>
<field name="inherit_id" ref="account.invoice_supplier_form" />
<field name="arch" type="xml">
<field name="partner_bank_id" position="after">
<field name="payment_mode_id"/>
</field>
</field>
</record>
</data>
</openerp>

View File

@@ -0,0 +1,40 @@
<?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="invoice_form" model="ir.ui.view">
<field name="name">account_payment_partner.invoice_form</field>
<field name="model">account.invoice</field>
<field name="inherit_id" ref="account.invoice_form" />
<field name="arch" type="xml">
<field name="partner_bank_id" position="after">
<field name="payment_mode_id"
domain="[('sale_ok', '=', True)]"/>
</field>
</field>
</record>
<record id="invoice_supplier_form" model="ir.ui.view">
<field name="name">account_payment_partner.invoice_supplier_form</field>
<field name="model">account.invoice</field>
<field name="inherit_id" ref="account.invoice_supplier_form" />
<field name="arch" type="xml">
<field name="partner_bank_id" position="after">
<field name="payment_mode_id"
domain="[('purchase_ok', '=', True)]"/>
</field>
</field>
</record>
</data>
</openerp>

View File

@@ -9,23 +9,19 @@
<openerp>
<data>
<record id="view_partner_property_form" model="ir.ui.view">
<field name="name">account_partner_payment.partner_form</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="account.view_partner_property_form" />
<field name="arch" type="xml">
<field name="property_payment_term" position="after">
<field name="customer_payment_mode"
attrs="{'invisible': [('customer', '=', False)]}"/>
<field name="customer_payment_mode"/>
</field>
<field name="property_supplier_payment_term" position="after">
<field name="supplier_payment_mode"
attrs="{'invisible': [('supplier', '=', False)]}"/>
<field name="supplier_payment_mode"/>
</field>
</field>
</record>
</data>
</openerp>

View File

@@ -20,6 +20,4 @@
#
##############################################################################
from . import partner
from . import account_invoice
from . import payment_order_create

View File

@@ -0,0 +1,37 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Account Payment Partner 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 PaymentOrderCreate(models.TransientModel):
_inherit = 'payment.order.create'
@api.model
def extend_payment_order_domain(self, payment_order, domain):
res = super(PaymentOrderCreate, self).extend_payment_order_domain(
payment_order, domain)
domain += ['|', '|',
('invoice', '=', False),
('invoice.payment_mode_id', '=', False),
('invoice.payment_mode_id', '=', payment_order.mode.id)]
return res