|
@ -1,4 +1,3 @@ |
|
|
# -*- coding: utf-8 -*- |
|
|
|
|
|
from odoo import api, fields, models |
|
|
from odoo import api, fields, models |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -13,7 +12,6 @@ class AccountAnalyticAccount(models.Model): |
|
|
|
|
|
|
|
|
@api.onchange('partner_id') |
|
|
@api.onchange('partner_id') |
|
|
def on_change_partner_id(self): |
|
|
def on_change_partner_id(self): |
|
|
if self.partner_id.customer_payment_mode_id: |
|
|
|
|
|
self.payment_mode_id = self.partner_id.customer_payment_mode_id.id |
|
|
self.payment_mode_id = self.partner_id.customer_payment_mode_id.id |
|
|
|
|
|
|
|
|
@api.multi |
|
|
@api.multi |
|
@ -22,6 +20,6 @@ class AccountAnalyticAccount(models.Model): |
|
|
if self.payment_mode_id: |
|
|
if self.payment_mode_id: |
|
|
invoice_vals['payment_mode_id'] = self.payment_mode_id.id |
|
|
invoice_vals['payment_mode_id'] = self.payment_mode_id.id |
|
|
invoice = self.env['account.invoice'].new(invoice_vals) |
|
|
invoice = self.env['account.invoice'].new(invoice_vals) |
|
|
invoice.payment_mode_id_change() |
|
|
|
|
|
|
|
|
invoice._onchange_payment_mode_id() |
|
|
invoice_vals = invoice._convert_to_write(invoice._cache) |
|
|
invoice_vals = invoice._convert_to_write(invoice._cache) |
|
|
return invoice_vals |
|
|
return invoice_vals |