mirror of
https://github.com/bringout/oca-ocb-mrp.git
synced 2026-04-22 17:12:00 +02:00
20 lines
1,011 B
Python
20 lines
1,011 B
Python
# -*- coding: utf-8 -*-
|
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
from odoo import models
|
|
|
|
|
|
class StockRule(models.Model):
|
|
_inherit = "stock.rule"
|
|
|
|
def _push_prepare_move_copy_values(self, move_to_copy, new_date):
|
|
new_move_vals = super(StockRule, self)._push_prepare_move_copy_values(move_to_copy, new_date)
|
|
new_move_vals["is_subcontract"] = False
|
|
return new_move_vals
|
|
|
|
def _get_stock_move_values(self, product_id, product_qty, product_uom, location_dest_id, name, origin, company_id, values):
|
|
move_values = super()._get_stock_move_values(product_id, product_qty, product_uom, location_dest_id, name, origin, company_id, values)
|
|
if not move_values.get('partner_id'):
|
|
if values.get('move_dest_ids') and values['move_dest_ids'].raw_material_production_id.subcontractor_id:
|
|
move_values['partner_id'] = values['move_dest_ids'].raw_material_production_id.subcontractor_id.id
|
|
return move_values
|