[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 Atchuthan Ubendran
parent c2f1a1377a
commit bb45ede128
8 changed files with 70 additions and 114 deletions

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