Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into develop
# Conflicts: # sf_base/security/ir.model.access.csv # sf_base/views/mrs_common_view.xml # sf_route_workcenter/models/workcenter.py
This commit is contained in:
@@ -23,6 +23,22 @@ class ResMrpRoutingWorkcenter(models.Model):
|
||||
|
||||
company_id = fields.Many2one('res.company', compute="get_company_id", related=False)
|
||||
|
||||
# 工单对应的工作中心,根据工序中的工作中心去匹配,
|
||||
# 如果只配置了一个工作中心,则默认采用该工作中心;
|
||||
# 如果有多个工作中心,
|
||||
# 则根据该工作中心的工单个数进行分配(优先分配给工单个数最少的);
|
||||
def get_workcenter(self, workcenter_ids):
|
||||
if workcenter_ids:
|
||||
if len(workcenter_ids) == 1:
|
||||
return workcenter_ids[0]
|
||||
elif len(workcenter_ids) >= 2:
|
||||
# workcenter_ids_str = ','.join([str(s) for s in workcenter_ids])
|
||||
self.env.cr.execute("""
|
||||
SELECT workcenter_id FROM mrp_workorder where workcenter_id
|
||||
in %s group by workcenter_id
|
||||
order by count(*),workcenter_id asc limit 1 """, [tuple(workcenter_ids)])
|
||||
return self.env.cr.dictfetchall()[0].get('workcenter_id')
|
||||
|
||||
|
||||
class ModelTypeRoutingSort(models.Model):
|
||||
_name = 'sf.model.type.routing.sort'
|
||||
|
||||
Reference in New Issue
Block a user