Accept Merge Request #1028: (feature/解决刀具组装时搜不到功能刀具产品问题 -> develop)

Merge Request: 解决刀具组装时,搜不到功能刀具产品问题;

Created By: @禹翔辉
Reviewed By: @马广威
Approved By: @马广威 
Accepted By: @马广威
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/1028#mr-1028-review-151363
This commit is contained in:
马广威
2024-05-18 17:11:30 +08:00
committed by Coding
3 changed files with 6 additions and 5 deletions

View File

@@ -351,7 +351,7 @@ class CAMWorkOrderProgramKnifePlan(models.Model):
class FunctionalToolAssembly(models.Model):
_name = 'sf.functional.tool.assembly'
_description = '功能刀具组装'
_order = 'use_tool_time asc'
_order = 'assemble_status, use_tool_time asc'
@api.depends('functional_tool_name')
def _compute_name(self):

View File

@@ -47,7 +47,7 @@
<sheet>
<div class="oe_button_box" name="button_box">
<button name="button_safe_inventory_id" string="更新功能刀具关联的安全库存记录"
type="object" class="btn-primary"/>
type="object" class="btn-primary"/>
<button class="oe_stat_button" groups="sf_base.group_sf_mrp_user"
name="open_functional_tool_warning"
icon="fa-list-ul"
@@ -406,7 +406,7 @@
</field>
</page>
<page string="组装单">
<field name="sf_functional_tool_assembly_ids" domain="[('assemble_status', '=', 0)]"/>
<field name="sf_functional_tool_assembly_ids"/>
</page>
</notebook>
</sheet>

View File

@@ -802,12 +802,13 @@ class ProductProduct(models.Model):
"""
创建功能刀具批次/序列号记录
"""
product_id = self.env['product.product'].search([('name', '=', '功能刀具')])
product_id = self.env['product.product'].search([('categ_type', '=', '功能刀具'), ('tracking', '=', 'serial')])
if not product_id:
logging.info('没有搜索到功能刀具产品:%s' % product_id)
raise ValidationError('没有找到按唯一序列号追溯的功能刀具产品信息!')
stock_lot = self.env['stock.lot'].create({
'name': self.get_stock_lot_name(tool_assembly_order_id),
'product_id': product_id.id,
'product_id': product_id[0].id,
'company_id': self.env.company.id
})
# 获取位置对象