[FIX] sale: add bank information on down payment

On a Sale order having customer with bank information available create
an invoice (down payment).

Bank information will not be available.

This append because the company_id is not provided to the create and
bank information will not be available
https://github.com/odoo/odoo/blob/12.0/addons/account/models/account_invoice.py#L549

opw-2153810

closes odoo/odoo#41902

X-original-commit: 097db42b0302c769a6584004d7a9cbbc03856de7
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
Andrea Grazioso (agr-odoo)
2019-12-13 11:43:43 +00:00
parent da9f3512e7
commit c30fb23f7b
2 changed files with 8 additions and 0 deletions
+7
View File
@@ -651,6 +651,13 @@ class SaleOrder(models.Model):
else:
out_invoice_vals_list = invoice_vals_list
if invoice_vals['type'] in self.env['account.move'].get_outbound_types():
invoice_bank_id = self.partner_id.bank_ids[:1]
else:
invoice_bank_id = self.company_id.partner_id.bank_ids[:1]
invoice_vals['invoice_partner_bank_id'] = invoice_bank_id
# Create invoices.
moves = self.env['account.move'].with_context(default_type='out_invoice').create(out_invoice_vals_list)
moves += self.env['account.move'].with_context(default_type='out_refund').create(refund_invoice_vals_list)
@@ -90,6 +90,7 @@ class SaleAdvancePaymentInv(models.TransientModel):
'currency_id': order.pricelist_id.currency_id.id,
'invoice_payment_ref': order.client_order_ref,
'invoice_payment_term_id': order.payment_term_id.id,
'invoice_partner_bank_id': order.company_id.partner_id.bank_ids[:1],
'team_id': order.team_id.id,
'campaign_id': order.campaign_id.id,
'medium_id': order.medium_id.id,