Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/修复质检接口
This commit is contained in:
@@ -22,10 +22,19 @@ class ResMrpRoutingWorkcenter(models.Model):
|
||||
bom_id = fields.Many2one('mrp.bom', required=False)
|
||||
surface_technics_id = fields.Many2one('sf.production.process', string="表面工艺")
|
||||
|
||||
def generate_code(self):
|
||||
return self.env['ir.sequence'].next_by_code('mrp.routing.workcenter')
|
||||
def get_no(self):
|
||||
international_standards = self.search(
|
||||
[('code', '!=', ''), ('active', 'in', [True, False])],
|
||||
limit=1,
|
||||
order="id desc")
|
||||
if not international_standards:
|
||||
num = "%03d" % 1
|
||||
else:
|
||||
m = int(international_standards.code) + 1
|
||||
num = "%03d" % m
|
||||
return num
|
||||
|
||||
code = fields.Char('编码', default=generate_code)
|
||||
code = fields.Char('编码', default=get_no)
|
||||
|
||||
# 获得当前登陆者公司
|
||||
def get_company_id(self):
|
||||
|
||||
@@ -859,7 +859,7 @@ class SfMaintenanceEquipmentAndProductTemplate(models.Model):
|
||||
for i in range(1, number + 1):
|
||||
self.env['maintenance.equipment.tool'].create({
|
||||
'equipment_id': res.id,
|
||||
'code': 'T' + str(i)
|
||||
'code': "T%02d" % i
|
||||
})
|
||||
vals.append(res)
|
||||
return vals[0]
|
||||
|
||||
@@ -14,6 +14,7 @@ from odoo.addons.stock.models.stock_rule import ProcurementException
|
||||
from odoo.addons.sf_base.commons.common import Common
|
||||
from odoo.exceptions import UserError
|
||||
from io import BytesIO
|
||||
from odoo.exceptions import ValidationError
|
||||
|
||||
|
||||
class StockRule(models.Model):
|
||||
@@ -250,6 +251,22 @@ class ProductionLot(models.Model):
|
||||
))
|
||||
return lot_names
|
||||
|
||||
def get_tool_generate_lot_names1(self, company, product):
|
||||
"""
|
||||
采购时生成刀具物料序列号
|
||||
"""
|
||||
now = datetime.now().strftime("%Y%m%d")
|
||||
last_serial = self.env['stock.lot'].search(
|
||||
[('company_id', '=', company.id), ('product_id', '=', product.id), ('name', 'like', now)],
|
||||
limit=1, order='id DESC')
|
||||
if product.cutting_tool_model_id:
|
||||
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:]) + 1)
|
||||
else:
|
||||
raise ValidationError('该刀具物料产品的型号字段为空,请补充完整!!!')
|
||||
|
||||
@api.model
|
||||
def _get_next_serial(self, company, product):
|
||||
"""Return the next serial number to be attributed to the product."""
|
||||
@@ -258,12 +275,13 @@ class ProductionLot(models.Model):
|
||||
[('company_id', '=', company.id), ('product_id', '=', product.id)],
|
||||
limit=1, order='id DESC')
|
||||
if last_serial:
|
||||
return self.env['stock.lot'].generate_lot_names1(product.name, last_serial.name, 2)[
|
||||
1]
|
||||
now = datetime.now().strftime("%Y-%m-%d")
|
||||
# formatted_date = now.strftime("%Y-%m-%d")
|
||||
if product.categ_id.name == '刀具':
|
||||
return self.env['stock.lot'].get_tool_generate_lot_names1(company, product)
|
||||
else:
|
||||
return self.env['stock.lot'].generate_lot_names1(product.name, last_serial.name, 2)[1]
|
||||
now = datetime.now().strftime("%Y%m%d")
|
||||
if product.cutting_tool_model_id:
|
||||
return "%s-%s-%03d" % (product.cutting_tool_model_id.code, now, 1)
|
||||
return "%s-%s%03d" % (product.cutting_tool_model_id.code[:-12], now, 1)
|
||||
return "%s-%03d" % (product.name, 1)
|
||||
|
||||
qr_code_image = fields.Binary(string='二维码', compute='_generate_qr_code')
|
||||
|
||||
Reference in New Issue
Block a user