From 69f26ddb0c8c13643a7550f0842384a14049cea1 Mon Sep 17 00:00:00 2001 From: Carlos Dauden Date: Fri, 4 Aug 2017 09:26:15 +0200 Subject: [PATCH] [9.0][IMP] contract_payment_mode: Onchange payment mode vals --- contract_payment_mode/README.rst | 1 + contract_payment_mode/__openerp__.py | 3 ++- contract_payment_mode/models/contract.py | 4 +++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/contract_payment_mode/README.rst b/contract_payment_mode/README.rst index c28b1c27..5e4ddefa 100644 --- a/contract_payment_mode/README.rst +++ b/contract_payment_mode/README.rst @@ -49,6 +49,7 @@ Contributors * Ángel Moya * Antonio Espinosa * Vicent Cubells +* Carlos Dauden Maintainer diff --git a/contract_payment_mode/__openerp__.py b/contract_payment_mode/__openerp__.py index 8b0c2a5b..af8cfe7d 100644 --- a/contract_payment_mode/__openerp__.py +++ b/contract_payment_mode/__openerp__.py @@ -2,12 +2,13 @@ # Copyright 2015 Domatix () # Copyright 2016 Antiun Ingenieria S.L. - Antonio Espinosa # Copyright 2017 Tecnativa - Vicent Cubells +# Copyright 2017 Tecnativa - Carlos Dauden # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). { 'name': 'Contract Payment Mode', 'summary': 'Payment mode in contracts and their invoices', - 'version': '9.0.1.0.0', + 'version': '9.0.1.0.1', 'author': 'Domatix, ' 'Tecnativa, ' 'Odoo Community Association (OCA)', diff --git a/contract_payment_mode/models/contract.py b/contract_payment_mode/models/contract.py index e7936e63..fb334a21 100644 --- a/contract_payment_mode/models/contract.py +++ b/contract_payment_mode/models/contract.py @@ -21,5 +21,7 @@ class AccountAnalyticAccount(models.Model): invoice_vals = super(AccountAnalyticAccount, self)._prepare_invoice() if self.payment_mode_id: invoice_vals['payment_mode_id'] = self.payment_mode_id.id - invoice_vals['partner_bank_id'] = self.partner_id.bank_ids[:1].id + invoice = self.env['account.invoice'].new(invoice_vals) + invoice.payment_mode_id_change() + invoice_vals = invoice._convert_to_write(invoice._cache) return invoice_vals