mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
@@ -24,6 +24,10 @@ class MrpProduction(models.Model):
|
||||
for rec in self:
|
||||
rec.stock_request_count = len(rec.stock_request_ids)
|
||||
|
||||
def _get_stock_requests(self):
|
||||
"""Get all stock requests from action (allows inheritance by other modules)."""
|
||||
return self.mapped("stock_request_ids")
|
||||
|
||||
def action_view_stock_request(self):
|
||||
"""
|
||||
:return dict: dictionary value for created view
|
||||
@@ -31,7 +35,7 @@ class MrpProduction(models.Model):
|
||||
action = self.env["ir.actions.act_window"]._for_xml_id(
|
||||
"stock_request.action_stock_request_form"
|
||||
)
|
||||
requests = self.mapped("stock_request_ids")
|
||||
requests = self._get_stock_requests()
|
||||
if len(requests) > 1:
|
||||
action["domain"] = [("id", "in", requests.ids)]
|
||||
elif requests:
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
name="action_view_stock_request"
|
||||
class="oe_stat_button"
|
||||
icon="fa-chain"
|
||||
attrs="{'invisible':[('stock_request_ids', '=', [])]}"
|
||||
attrs="{'invisible':[('stock_request_count', '=', 0)]}"
|
||||
>
|
||||
<field
|
||||
name="stock_request_count"
|
||||
|
||||
Reference in New Issue
Block a user