[IMP] stock: Only display related pickings on "Package Transfer" button
Purpose ======= On a stock stock.quant.package form view, the "Package Transfer" button does not have any filter, it opens all the pickings Clicking on "Package Transfer" button should display its related pickings
This commit is contained in:
committed by
Yannick Tivisse
parent
58171177d3
commit
cac170de23
@@ -656,6 +656,12 @@ class QuantPackage(models.Model):
|
||||
self.unlink()
|
||||
return self.env['ir.actions.act_window'].for_xml_id('stock', 'action_package_view')
|
||||
|
||||
def action_view_picking(self):
|
||||
action = self.env.ref('stock.action_picking_tree_all').read()[0]
|
||||
pickings = self.env['stock.pack.operation'].search([('result_package_id', 'in', self.ids)]).mapped('picking_id')
|
||||
action['domain'] = [('id', 'in', pickings.ids)]
|
||||
return action
|
||||
|
||||
@api.multi
|
||||
def view_content_package(self):
|
||||
action = self.env['ir.actions.act_window'].for_xml_id('stock', 'quantsact')
|
||||
|
||||
@@ -176,8 +176,8 @@
|
||||
</header>
|
||||
<sheet>
|
||||
<div class="oe_button_box" name="button_box">
|
||||
<button class="oe_stat_button" name="%(action_picking_tree_all)d"
|
||||
string="Package Transfers" type="action"
|
||||
<button class="oe_stat_button" name="action_view_picking"
|
||||
string="Package Transfers" type="object"
|
||||
widget="statinfo" icon="fa-dropbox"/>
|
||||
<button name="get_content_package" type="object" string="View Contained Packages content" icon="fa-cogs" attrs="{'invisible': [('children_ids','=',[])]}"/>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user