Accept Merge Request #1521: (feature/sale_order_route_pick -> develop)
Merge Request: 修改坯料冗余 Created By: @胡尧 Accepted By: @胡尧 URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/1521?initial=true
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
{
|
||||
'name': '机企猫智能工厂 制造管理',
|
||||
'version': '1.1',
|
||||
'version': '1.0',
|
||||
'summary': '智能工厂制造模块',
|
||||
'sequence': 1,
|
||||
'description': """
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
def migrate(cr, version):
|
||||
cr.execute("""
|
||||
UPDATE sf_model_type
|
||||
SET embryo_tolerance = (SELECT id FROM sf_embryo_redundancy LIMIT 1)
|
||||
WHERE embryo_tolerance = 0;
|
||||
""")
|
||||
@@ -6,7 +6,8 @@ class ModelType(models.Model):
|
||||
_description = '模型类型'
|
||||
|
||||
name = fields.Char('名称')
|
||||
embryo_tolerance = fields.Many2one('sf.embryo.redundancy', string='坯料容余', required=True)
|
||||
# embryo_tolerance = fields.Char('坯料容余')
|
||||
embryo_tolerance_id = fields.Many2one('sf.embryo.redundancy', string='坯料容余')
|
||||
product_routing_tmpl_ids = fields.One2many('sf.product.model.type.routing.sort', 'product_model_type_id',
|
||||
'成品工序模板(自动化产线加工')
|
||||
embryo_routing_tmpl_ids = fields.One2many('sf.embryo.model.type.routing.sort', 'embryo_model_type_id',
|
||||
|
||||
@@ -852,9 +852,11 @@ class ResProductMo(models.Model):
|
||||
attachment = self.attachment_create(item['model_name'], item['model_data'])
|
||||
# 获取坯料冗余配置
|
||||
if not item.get('embryo_redundancy'):
|
||||
embryo_redundancy_id = model_type.embryo_tolerance
|
||||
embryo_redundancy_id = model_type.embryo_tolerance_id
|
||||
else:
|
||||
embryo_redundancy_id = item.get('embryo_redundancy')
|
||||
if not embryo_redundancy_id:
|
||||
raise UserError('请先配置模型类型内的坯料冗余')
|
||||
vals = {
|
||||
'name': '%s-%s-%s' % ('P', order_id.name, i),
|
||||
'model_long': item['model_long'] + embryo_redundancy_id.long,
|
||||
@@ -948,9 +950,11 @@ class ResProductMo(models.Model):
|
||||
supplier = self.env['mrp.bom'].get_supplier(materials_type_id)
|
||||
# 获取坯料冗余配置
|
||||
if not item.get('embryo_redundancy_id'):
|
||||
embryo_redundancy_id = model_type.embryo_tolerance
|
||||
embryo_redundancy_id = model_type.embryo_tolerance_id
|
||||
else:
|
||||
embryo_redundancy_id = item.get('embryo_redundancy_id')
|
||||
if not embryo_redundancy_id:
|
||||
raise UserError('请先配置模型类型内的坯料冗余')
|
||||
logging.info('no_bom_copy_product_supplier-vals:%s' % supplier)
|
||||
vals = {
|
||||
'name': '%s-%s-%s [%s %s-%s * %s * %s]' % ('R',
|
||||
|
||||
@@ -309,9 +309,10 @@ class StockRule(models.Model):
|
||||
production_item.write({'programming_no': production_programming.programming_no,
|
||||
'programming_state': '编程中'})
|
||||
if not technology_design_values:
|
||||
i = 0
|
||||
if production_item.product_id.categ_id.type == '成品':
|
||||
# 根据加工面板的面数及成品工序模板生成工序设计
|
||||
i = 0
|
||||
|
||||
for k in (production_item.product_id.model_processing_panel.split(',')):
|
||||
if production_item.production_type == '自动化产线加工':
|
||||
product_routing_workcenter = self.env['sf.product.model.type.routing.sort'].search(
|
||||
@@ -939,6 +940,11 @@ class ReStockMove(models.Model):
|
||||
move_lines_commands.append((0, 0, move_line_cmd))
|
||||
qty_by_location[loc.id] += 1
|
||||
return move_lines_commands
|
||||
|
||||
# def _prepare_procurement_origin(self):
|
||||
# """修改采购来源"""
|
||||
# self.ensure_one()
|
||||
# return self.group_id and self.group_id.name or (self.origin or self.picking_id.name or "/")
|
||||
|
||||
|
||||
class ReStockQuant(models.Model):
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
<form string="模型类型">
|
||||
<group>
|
||||
<field name="name" required="1"/>
|
||||
<field name="embryo_tolerance" required="1" string="坯料容余(mm)"/>
|
||||
<field name="embryo_tolerance_id" required="1" string="坯料容余(mm)"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name='product_routing_tmpl_ids'>
|
||||
|
||||
@@ -93,7 +93,11 @@ class sf_production_plan(models.Model):
|
||||
|
||||
@api.model
|
||||
def search_read(self, domain=None, fields=None, offset=0, limit=None, order=None):
|
||||
|
||||
"""
|
||||
修改搜索方法,只有制造订单状态为待排程时才显示
|
||||
"""
|
||||
domain = domain or []
|
||||
domain.append(('production_id.state', '!=', 'confirmed'))
|
||||
info = super(sf_production_plan, self).search_read(domain, fields, offset, limit, order)
|
||||
return info
|
||||
|
||||
@@ -446,8 +450,12 @@ class MrpProductionInheritForPlan(models.Model):
|
||||
def toggle_active(self):
|
||||
# 调用父类方法切换 active 状态
|
||||
res = super(MrpProductionInheritForPlan, self).toggle_active()
|
||||
stage_active = self.filtered('active')
|
||||
stage_inactive = self - stage_active
|
||||
self.env['sf.production.plan'].search(
|
||||
[('production_id', '=', self.id), '|', ('active', '=', False), ('active', '=', True)]).write(
|
||||
{'active': self.active})
|
||||
|
||||
[('production_id', 'in', stage_active.ids)]).write(
|
||||
{'active': True})
|
||||
self.env['sf.production.plan'].search(
|
||||
[('production_id', 'in', stage_inactive.ids)]).write(
|
||||
{'active': False})
|
||||
return res
|
||||
|
||||
Reference in New Issue
Block a user