20 lines
791 B
Python
20 lines
791 B
Python
# -*- coding: utf-8 -*-
|
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
from odoo import models
|
|
from odoo.osv.expression import OR
|
|
|
|
|
|
class StockPicking(models.Model):
|
|
_inherit = 'stock.picking'
|
|
|
|
def action_view_stock_valuation_layers(self):
|
|
action = super(StockPicking, self).action_view_stock_valuation_layers()
|
|
subcontracted_productions = self._get_subcontract_production()
|
|
if not subcontracted_productions:
|
|
return action
|
|
domain = action['domain']
|
|
domain_subcontracting = [('id', 'in', (subcontracted_productions.move_raw_ids | subcontracted_productions.move_finished_ids).stock_valuation_layer_ids.ids)]
|
|
domain = OR([domain, domain_subcontracting])
|
|
return dict(action, domain=domain)
|