Files
odoo_source/addons/mrp_subcontracting_dropshipping/models/stock_picking.py
T
Arnold Moyaux 4c4a7879e9 [ADD] mrp_subcontracting_dropshipping
Allow to do a dropshipping with a subcontractor.
If the product uses the routes drophipping and have
a subcontracting BoM. Then a PO for the subcontractors
will genrate a need in the subcontracting location for
the required components.

A module is needed because the picking_type_id for dropshipping
do not have a warehouse_id. The warehouse_id is needed in order to
know from which warehouse the subcontracting components should be
deliver.
2019-08-19 15:03:59 +00:00

14 lines
427 B
Python

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models
class StockPicking(models.Model):
_inherit = 'stock.picking'
def _get_warehouse(self, subcontract_move):
if subcontract_move.sale_line_id:
return subcontract_move.sale_line_id.order_id.warehouse_id
return super(StockPicking, self)._get_warehouse(subcontract_move)