mirror of
https://github.com/OCA/bank-payment.git
synced 2025-02-02 10:37:31 +02:00
Merge pull request #238 from pedrobaeza/8.0-account_payment-fix_dropshipping
[FIX] account_payment_*: Ensure work with dropshipping dual invoice
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Account Payment Purchase module for OpenERP
|
||||
@@ -28,11 +28,13 @@ class StockPicking(models.Model):
|
||||
|
||||
@api.model
|
||||
def _create_invoice_from_picking(self, picking, vals):
|
||||
if picking and picking.move_lines:
|
||||
# This will assure that stock_dropshipping_dual_invoice will work
|
||||
inv_type = self.env.context.get('inv_type', 'in_invoice')
|
||||
if picking and picking.move_lines and inv_type == 'in_invoice':
|
||||
# Get purchase order from first move line
|
||||
if picking.move_lines[0].purchase_line_id:
|
||||
purchase = picking.move_lines[0].purchase_line_id.order_id
|
||||
vals['partner_bank_id'] = purchase.supplier_partner_bank_id.id
|
||||
vals['payment_mode_id'] = purchase.payment_mode_id.id
|
||||
return super(StockPicking, self)._create_invoice_from_picking(picking,
|
||||
vals)
|
||||
return super(StockPicking, self)._create_invoice_from_picking(
|
||||
picking, vals)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
@@ -24,10 +24,12 @@ class StockPicking(models.Model):
|
||||
|
||||
@api.model
|
||||
def _create_invoice_from_picking(self, picking, vals):
|
||||
if picking and picking.sale_id:
|
||||
# This will assure that stock_dropshipping_dual_invoice will work
|
||||
inv_type = self.env.context.get('inv_type', 'out_invoice')
|
||||
if picking and picking.sale_id and inv_type == 'out_invoice':
|
||||
sale_order = picking.sale_id
|
||||
if sale_order.payment_mode_id:
|
||||
vals['partner_bank_id'] = sale_order.payment_mode_id.bank_id.id
|
||||
vals['payment_mode_id'] = sale_order.payment_mode_id.id
|
||||
return super(StockPicking, self)._create_invoice_from_picking(picking,
|
||||
vals)
|
||||
return super(StockPicking, self)._create_invoice_from_picking(
|
||||
picking, vals)
|
||||
|
||||
Reference in New Issue
Block a user