序列号去除中文(打印条形码不能带中文否则会报错)

This commit is contained in:
gqh
2023-02-22 17:14:42 +08:00
parent d81cf77bbe
commit 7ddaace1ad
5 changed files with 11 additions and 8 deletions

View File

@@ -13,8 +13,8 @@
'depends': ['sf_base', 'sf_sale', 'sf_dlm'], 'depends': ['sf_base', 'sf_sale', 'sf_dlm'],
'data': [ 'data': [
'views/res_partner_view.xml', 'views/res_partner_view.xml',
'views/view.xml', # 'views/view.xml',
'report/bill_report.xml', # 'report/bill_report.xml',
], ],
'demo': [ 'demo': [
], ],

View File

@@ -1,5 +1,5 @@
from . import http from . import http
from . import models from . import models
from . import process_status from . import process_status
from . import jd_eclp # from . import jd_eclp

View File

@@ -115,7 +115,7 @@ class FinishStatusChange(models.Model):
# default_code = fields.Char(string='内部编码') # default_code = fields.Char(string='内部编码')
def button_validate(self): def button_validate1(self):
# Clean-up the context key at validation to avoid forcing the creation of immediate # Clean-up the context key at validation to avoid forcing the creation of immediate
# transfers. # transfers.
ctx = dict(self.env.context) ctx = dict(self.env.context)

View File

@@ -1,4 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import re
from odoo import api, fields, models, _ from odoo import api, fields, models, _
@@ -57,11 +59,12 @@ class MrpProduction(models.Model):
def action_generate_serial(self): def action_generate_serial(self):
self.ensure_one() 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)
self.lot_producing_id = self.env['stock.lot'].create({ self.lot_producing_id = self.env['stock.lot'].create({
'product_id': self.product_id.id, 'product_id': self.product_id.id,
'company_id': self.company_id.id, 'company_id': self.company_id.id,
'name': self.env['stock.lot']._get_next_serial(self.company_id, self.product_id) or self.env[ 'name': iot_code_name,
'ir.sequence'].next_by_code('stock.lot.serial'),
}) })
if self.move_finished_ids.filtered(lambda m: m.product_id == self.product_id).move_line_ids: if self.move_finished_ids.filtered(lambda m: m.product_id == self.product_id).move_line_ids:
self.move_finished_ids.filtered( self.move_finished_ids.filtered(
@@ -235,6 +238,7 @@ class MrpProduction(models.Model):
current_sequence += 1 current_sequence += 1
if work.name == '获取CNC加工程序': if work.name == '获取CNC加工程序':
work.button_start() work.button_start()
#work.button_finish()
work.fetchCNC() work.fetchCNC()
#创建工单并进行排序 #创建工单并进行排序

View File

@@ -15,8 +15,7 @@
attrs='{"invisible": [("production_id","=",False)]}'/> attrs='{"invisible": [("production_id","=",False)]}'/>
<field name="workorder_id"/> <field name="workorder_id"/>
</group> </group>
<div class="col <div class="col-12 col-lg-6 o_setting_box">
-12 col-lg-6 o_setting_box">
<button type="object" class="oe_highlight" name="unclamp" string="解除装夹" <button type="object" class="oe_highlight" name="unclamp" string="解除装夹"
attrs='{"invisible": [("state","=","空闲")]}'/> attrs='{"invisible": [("state","=","空闲")]}'/>
</div> </div>