You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the solution you'd like
We been testing stock_orderpoint_origin for adding forecast sale orders to production sale orders smart button.
We did a small, maybe little bit dirty fix to stock_orderpoint_origin for calculating sales orders linked to mrp.production.
Here is the code what we used. Wondering does someone have better solution?
Inherited mrp.production and added these:
`
def _try_to_get_saleorders(self, origin):
result = []
try:
groups = re.sub('\(.*\)', '', origin)
groups = groups.replace(" ", "")
groups = groups.split(',')
sale_orders = self.env['sale.order'].search([("name", "in", groups)])
result = sale_orders
except Exception as e:
_logger.info('Parsing origin fails %s',e)
return result
def _compute_sale_order_count(self):
super()._compute_sale_order_count()
for production in self:
if production.sale_order_count == 0:
production.sale_order_count = len(self._try_to_get_saleorders(production.origin))
def action_view_sale_orders(self):
action = super().action_view_sale_orders()
if len(self.procurement_group_id.mrp_production_ids.move_dest_ids.group_id.sale_id.ids) == 0:
sale_order_ids = self._try_to_get_saleorders(self.origin).ids
if len(sale_order_ids) == 1:
action.update({
'view_mode': 'form',
'res_id': sale_order_ids[0],
})
else:
action.update({
'name': _("Sources Sale Orders of %s", self.name),
'domain': [('id', 'in', sale_order_ids)],
'view_mode': 'tree,form',
})
return action`
The text was updated successfully, but these errors were encountered:
There hasn't been any activity on this issue in the past 6 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this issue to never become stale, please ask a PSC member to apply the "no stale" label.
Is your feature request related to a problem?
No
Describe the solution you'd like
We been testing stock_orderpoint_origin for adding forecast sale orders to production sale orders smart button.
We did a small, maybe little bit dirty fix to stock_orderpoint_origin for calculating sales orders linked to mrp.production.
Here is the code what we used. Wondering does someone have better solution?
Inherited mrp.production and added these:
`
The text was updated successfully, but these errors were encountered: