Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/优化Rfid绑定工单
# Conflicts: # sf_manufacturing/models/mrp_workorder.py # sf_manufacturing/models/product_template.py # sf_manufacturing/views/mrp_workorder_view.xml
This commit is contained in:
@@ -266,6 +266,21 @@ class ProductionLot(models.Model):
|
||||
_name = 'stock.lot'
|
||||
_inherit = ['stock.lot', 'printing.utils']
|
||||
|
||||
rfid = fields.Char('Rfid', readonly=True)
|
||||
product_specification = fields.Char('规格', compute='_compute_product_specification', store=True)
|
||||
|
||||
@api.depends('product_id')
|
||||
def _compute_product_specification(self):
|
||||
for stock in self:
|
||||
if stock:
|
||||
if stock.product_id:
|
||||
if stock.product_id.categ_id.name in '刀具':
|
||||
stock.product_specification = stock.product_id.specification_id.name
|
||||
elif stock.product_id.categ_id.name in '夹具':
|
||||
stock.product_specification = stock.product_id.specification_fixture_id.name
|
||||
else:
|
||||
stock.product_specification = stock.product_id.default_code
|
||||
|
||||
@api.model
|
||||
def generate_lot_names1(self, display_name, first_lot, count):
|
||||
"""Generate `lot_names` from a string."""
|
||||
@@ -308,7 +323,7 @@ class ProductionLot(models.Model):
|
||||
if not last_serial:
|
||||
return "%s-%s%03d" % (product.cutting_tool_model_id.code[:-12], now, 1)
|
||||
else:
|
||||
return "%s-%s%03d" % (product.cutting_tool_model_id.code[:-12], now, int(last_serial.name[-3:]) + 2)
|
||||
return "%s-%s%03d" % (product.cutting_tool_model_id.code[:-12], now, int(last_serial.name[-3:]) + 1)
|
||||
else:
|
||||
raise ValidationError('该刀具物料产品的型号字段为空,请补充完整!!!')
|
||||
|
||||
@@ -363,7 +378,7 @@ class ProductionLot(models.Model):
|
||||
# port = 9100 # 可以根据实际情况修改
|
||||
|
||||
# 获取默认打印机配置
|
||||
printer_config = self.env['printer.configuration'].search([('model', '=', self._name)], limit=1)
|
||||
printer_config = self.env['printer.configuration'].sudo().search([('model', '=', self._name)], limit=1)
|
||||
if not printer_config:
|
||||
raise UserError('请先配置打印机')
|
||||
host = printer_config.printer_id.ip_address
|
||||
|
||||
Reference in New Issue
Block a user