Merge branch 'develop' into feature/commercially_launched

This commit is contained in:
胡尧
2025-03-04 09:32:07 +08:00
26 changed files with 967 additions and 403 deletions

View File

@@ -265,6 +265,23 @@ class MrpProduction(models.Model):
part_name = fields.Char(string='零件名称', related='product_id.part_name', readonly=True)
# 判断制造的产品类型
production_product_type = fields.Selection([
('成品', '成品'),
('坯料', '坯料'),
('其他', '其他')
], string='产品类型', compute='_compute_production_product_type')
@api.depends('product_id')
def _compute_production_product_type(self):
for record in self:
if record.product_id.categ_id.name == '成品':
record.production_product_type = '成品'
elif record.product_id.categ_id.name == '坯料':
record.production_product_type = '坯料'
else:
record.production_product_type = '其他'
@api.depends('product_id.manual_quotation')
def _compute_manual_quotation(self):
for item in self:
@@ -776,11 +793,11 @@ class MrpProduction(models.Model):
self.ensure_one()
iot_code = self.env['stock.lot']._get_next_serial(self.company_id, self.product_id) or self.env[
'ir.sequence'].next_by_code('stock.lot.serial')
iot_code_name = re.sub('[\u4e00-\u9fa5]', "", iot_code)
# iot_code_name = re.sub('[\u4e00-\u9fa5]', "", iot_code)
self.lot_producing_id = self.env['stock.lot'].create({
'product_id': self.product_id.id,
'company_id': self.company_id.id,
'name': iot_code_name,
'name': iot_code,
})
if self.move_finished_ids.filtered(lambda m: m.product_id == self.product_id).move_line_ids:
self.move_finished_ids.filtered(