Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/优化制造订单和编程
This commit is contained in:
@@ -4,7 +4,8 @@ csv_internal_sep = ,
|
|||||||
data_dir = /var/lib/odoo
|
data_dir = /var/lib/odoo
|
||||||
db_host = 172.17.0.2
|
db_host = 172.17.0.2
|
||||||
db_maxconn = 64
|
db_maxconn = 64
|
||||||
db_name = sf_t_0430
|
# db_name = sf_t_0430
|
||||||
|
db_name = t_240509
|
||||||
db_password = sf
|
db_password = sf
|
||||||
db_port = 5432
|
db_port = 5432
|
||||||
db_sslmode = prefer
|
db_sslmode = prefer
|
||||||
|
|||||||
27
sf_base/commons/Email.py
Normal file
27
sf_base/commons/Email.py
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
from odoo import api, models
|
||||||
|
|
||||||
|
|
||||||
|
class MailSender(models.Model):
|
||||||
|
_name = 'mail.sender'
|
||||||
|
_description = 'Mail Sender'
|
||||||
|
|
||||||
|
def mail_sender(self, mail_server_name, subject_name, email_to, error_message):
|
||||||
|
mail_server = self.env['ir.mail_server'].sudo().search([('name', '=', mail_server_name)], limit=1)
|
||||||
|
if not mail_server:
|
||||||
|
_logger.info('管理员还未配置名称为 %s 的smtp服务器信息,请联系管理员配置!' % mail_server_name)
|
||||||
|
return
|
||||||
|
if not mail_server.smtp_user or not mail_server.smtp_pass:
|
||||||
|
_logger.info("邮件发送账号未正确设置,请联系管理员!")
|
||||||
|
return
|
||||||
|
mail_values = {
|
||||||
|
'message_type': 'email', 'subject': subject_name,
|
||||||
|
'mail_server_id': mail_server.id, 'email_from': mail_server.smtp_user,
|
||||||
|
'email_to': email_to
|
||||||
|
}
|
||||||
|
temp_mail_html = """
|
||||||
|
Hi, <p> 这里是异常提醒通知: </p>
|
||||||
|
"""
|
||||||
|
|
||||||
|
temp_mail_html += """ %s """ % error_message
|
||||||
|
mail_values['body_html'] = temp_mail_html
|
||||||
|
self.env['mail.mail'].sudo().create(mail_values).send(auto_commit=True)
|
||||||
@@ -1,2 +1,3 @@
|
|||||||
from . import common
|
from . import common
|
||||||
from . import Printer
|
from . import Printer
|
||||||
|
from . import Email
|
||||||
|
|||||||
@@ -820,54 +820,56 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
raise UserError(_('请先完成上一步工单'))
|
raise UserError(_('请先完成上一步工单'))
|
||||||
|
|
||||||
def button_finish(self):
|
def button_finish(self):
|
||||||
if self.routing_type == '装夹预调':
|
for record in self:
|
||||||
if not self.material_center_point and self.X_deviation_angle > 0:
|
if record.routing_type == '装夹预调':
|
||||||
raise UserError("请对前置三元检测定位参数进行计算定位")
|
if not record.material_center_point and record.X_deviation_angle > 0:
|
||||||
if not self.rfid_code:
|
raise UserError("请对前置三元检测定位参数进行计算定位")
|
||||||
raise UserError("请扫RFID码进行绑定")
|
if not record.rfid_code:
|
||||||
if self.routing_type == '解除装夹':
|
raise UserError("请扫RFID码进行绑定")
|
||||||
'''
|
record.workpiece_delivery_ids[0].write({'status': '待下发'})
|
||||||
记录结束时间
|
|
||||||
'''
|
if record.routing_type == '解除装夹':
|
||||||
self.date_finished = datetime.now()
|
'''
|
||||||
if self.picking_out_id:
|
记录结束时间
|
||||||
picking_out = self.env['stock.picking'].search([('id', '=', self.picking_out_id.id)])
|
'''
|
||||||
if picking_out.workorder_out_id:
|
record.date_finished = datetime.now()
|
||||||
order_line_ids = []
|
|
||||||
for item in picking_out.workorder_out_id:
|
if record.picking_out_id:
|
||||||
server_product = self.env['product.template'].search(
|
picking_out = record.env['stock.picking'].search([('id', '=', record.picking_out_id.id)])
|
||||||
[('server_product_process_parameters_id', '=', item.surface_technics_parameters_id.id),
|
if picking_out.workorder_out_id:
|
||||||
('detailed_type', '=', 'service')])
|
order_line_ids = []
|
||||||
if server_product:
|
for item in picking_out.workorder_out_id:
|
||||||
order_line_ids.append((0, 0, {
|
server_product = record.env['product.template'].search(
|
||||||
'product_id': server_product.product_variant_id.id,
|
[('server_product_process_parameters_id', '=', item.surface_technics_parameters_id.id),
|
||||||
'product_qty': 1,
|
('detailed_type', '=', 'service')])
|
||||||
'product_uom': server_product.uom_id.id
|
if server_product:
|
||||||
}))
|
order_line_ids.append((0, 0, {
|
||||||
else:
|
'product_id': server_product.product_variant_id.id,
|
||||||
raise UserError(
|
'product_qty': 1,
|
||||||
'请先在产品中配置表面工艺为%s相关的外协服务产品' % item.surface_technics_parameters_id.name)
|
'product_uom': server_product.uom_id.id
|
||||||
self.env['purchase.order'].create({
|
}))
|
||||||
'partner_id': server_product.seller_ids.partner_id.id,
|
else:
|
||||||
'state': 'draft',
|
raise UserError(
|
||||||
'order_line': order_line_ids,
|
'请先在产品中配置表面工艺为%s相关的外协服务产品' % item.surface_technics_parameters_id.name)
|
||||||
})
|
record.env['purchase.order'].create({
|
||||||
super().button_finish()
|
'partner_id': server_product.seller_ids.partner_id.id,
|
||||||
is_production_id = True
|
'state': 'draft',
|
||||||
for workorder in self.production_id.workorder_ids:
|
'order_line': order_line_ids,
|
||||||
if workorder.state != 'done':
|
})
|
||||||
is_production_id = False
|
super().button_finish()
|
||||||
if is_production_id == True and self.name == '解除装夹':
|
is_production_id = True
|
||||||
for workorder in self.production_id.workorder_ids:
|
for workorder in record.production_id.workorder_ids:
|
||||||
workorder.rfid_code_old = workorder.rfid_code
|
if workorder.state != 'done':
|
||||||
workorder.rfid_code = None
|
is_production_id = False
|
||||||
for move_raw_id in self.production_id.move_raw_ids:
|
if is_production_id == True and record.name == '解除装夹':
|
||||||
move_raw_id.quantity_done = move_raw_id.product_uom_qty
|
for workorder in record.production_id.workorder_ids:
|
||||||
self.process_state = '已完工'
|
workorder.rfid_code_old = workorder.rfid_code
|
||||||
self.production_id.button_mark_done1()
|
workorder.rfid_code = None
|
||||||
# self.production_id.state = 'done'
|
for move_raw_id in record.production_id.move_raw_ids:
|
||||||
# if self.routing_type == '装夹预调':
|
move_raw_id.quantity_done = move_raw_id.product_uom_qty
|
||||||
# self.workpiece_delivery_ids.write({''})
|
record.process_state = '已完工'
|
||||||
|
record.production_id.button_mark_done1()
|
||||||
|
# self.production_id.state = 'done'
|
||||||
|
|
||||||
# 将FTP的检测报告文件下载到临时目录
|
# 将FTP的检测报告文件下载到临时目录
|
||||||
def download_reportfile_tmp(self, workorder, reportpath):
|
def download_reportfile_tmp(self, workorder, reportpath):
|
||||||
@@ -1056,10 +1058,11 @@ class SfWorkOrderBarcodes(models.Model):
|
|||||||
workorder = self.env['mrp.workorder'].browse(self.ids)
|
workorder = self.env['mrp.workorder'].browse(self.ids)
|
||||||
# workorder_preset = self.env['mrp.workorder'].search(
|
# workorder_preset = self.env['mrp.workorder'].search(
|
||||||
# [('routing_type', '=', '装夹预调'), ('rfid_code', '=', barcode)])
|
# [('routing_type', '=', '装夹预调'), ('rfid_code', '=', barcode)])
|
||||||
workorder_old = self.env['mrp.workorder'].search([('rfid_code', '=', barcode)])
|
workorder_olds = self.env['mrp.workorder'].search(
|
||||||
if workorder_old:
|
[('routing_type', '=', '装夹预调'), ('rfid_code', '=', barcode)])
|
||||||
|
if workorder_olds:
|
||||||
name = ''
|
name = ''
|
||||||
for workorder in workorder_old:
|
for workorder in workorder_olds:
|
||||||
name = '%s %s' % (name, workorder.production_id.name)
|
name = '%s %s' % (name, workorder.production_id.name)
|
||||||
raise UserError('该托盘已绑定【%s】制造订单,请先解除绑定!!!' % name)
|
raise UserError('该托盘已绑定【%s】制造订单,请先解除绑定!!!' % name)
|
||||||
if workorder:
|
if workorder:
|
||||||
@@ -1089,6 +1092,8 @@ class SfWorkOrderBarcodes(models.Model):
|
|||||||
for item in workorder_rfid:
|
for item in workorder_rfid:
|
||||||
item.write({'rfid_code': barcode})
|
item.write({'rfid_code': barcode})
|
||||||
logging.info("Rfid绑定成功!!!")
|
logging.info("Rfid绑定成功!!!")
|
||||||
|
else:
|
||||||
|
raise UserError('该Rfid【%s】绑定的是【%s】, 不是托盘!!!' % (barcode, lot.product_id.name))
|
||||||
self.process_state = '待检测'
|
self.process_state = '待检测'
|
||||||
self.date_start = datetime.now()
|
self.date_start = datetime.now()
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ class sf_production_plan(models.Model):
|
|||||||
item.sudo().production_id.workorder_ids.filtered(
|
item.sudo().production_id.workorder_ids.filtered(
|
||||||
lambda b: b.routing_type == "装夹预调").workpiece_delivery_ids.write(
|
lambda b: b.routing_type == "装夹预调").workpiece_delivery_ids.write(
|
||||||
{'production_line_id': item.production_line_id.id,
|
{'production_line_id': item.production_line_id.id,
|
||||||
'plan_start_processing_time': item.plan_start_processing_time})
|
'plan_start_processing_time': item.date_planned_start})
|
||||||
# item.sudo().production_id.plan_start_processing_time = item.date_planned_start
|
# item.sudo().production_id.plan_start_processing_time = item.date_planned_start
|
||||||
|
|
||||||
# @api.onchange('state')
|
# @api.onchange('state')
|
||||||
|
|||||||
@@ -19,9 +19,9 @@
|
|||||||
'views/functional_tool_views.xml',
|
'views/functional_tool_views.xml',
|
||||||
'views/mrp_workcenter_views.xml',
|
'views/mrp_workcenter_views.xml',
|
||||||
'views/sf_maintenance_equipment.xml',
|
'views/sf_maintenance_equipment.xml',
|
||||||
'views/menu_view.xml',
|
|
||||||
'views/tool_material_search.xml',
|
'views/tool_material_search.xml',
|
||||||
'views/fixture_material_search_views.xml',
|
'views/fixture_material_search_views.xml',
|
||||||
|
'views/menu_view.xml',
|
||||||
'data/tool_data.xml',
|
'data/tool_data.xml',
|
||||||
],
|
],
|
||||||
'demo': [
|
'demo': [
|
||||||
|
|||||||
@@ -95,12 +95,4 @@
|
|||||||
<field name="res_model">sf.fixture.material.search</field>
|
<field name="res_model">sf.fixture.material.search</field>
|
||||||
<field name="view_mode">tree,form</field>
|
<field name="view_mode">tree,form</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<menuitem
|
|
||||||
sequence="25"
|
|
||||||
name="夹具物料查询"
|
|
||||||
id="menu_sf_fixture_material_search"
|
|
||||||
action="action_sf_fixture_material_search"
|
|
||||||
parent="menu_sf_fixture"
|
|
||||||
/>
|
|
||||||
</odoo>
|
</odoo>
|
||||||
@@ -120,5 +120,13 @@
|
|||||||
parent="menu_sf_tool_material"
|
parent="menu_sf_tool_material"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<menuitem
|
||||||
|
sequence="25"
|
||||||
|
name="夹具物料查询"
|
||||||
|
id="menu_sf_fixture_material_search"
|
||||||
|
action="action_sf_fixture_material_search"
|
||||||
|
parent="menu_sf_fixture"
|
||||||
|
/>
|
||||||
|
|
||||||
</data>
|
</data>
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|||||||
@@ -137,6 +137,7 @@ access_sf_shelf_location_wizard_group_sf_stock_user_group_sf_stock_user,sf_shelf
|
|||||||
access_sf_shelf_location_wizard_group_sf_stock_manager,sf_shelf_location_wizard_group_sf_stock_manager,model_sf_shelf_location_wizard,sf_warehouse.group_sf_stock_manager,1,1,1,0
|
access_sf_shelf_location_wizard_group_sf_stock_manager,sf_shelf_location_wizard_group_sf_stock_manager,model_sf_shelf_location_wizard,sf_warehouse.group_sf_stock_manager,1,1,1,0
|
||||||
|
|
||||||
access_sf_shelf_location_group_sf_tool_user,sf.shelf.location.group_sf_tool_user,model_sf_shelf_location,sf_base.group_sf_tool_user,1,1,0,0
|
access_sf_shelf_location_group_sf_tool_user,sf.shelf.location.group_sf_tool_user,model_sf_shelf_location,sf_base.group_sf_tool_user,1,1,0,0
|
||||||
|
access_sf_shelf_group_user,sf.shelf.location.group_user,model_sf_shelf_location,base.group_user,1,1,0,0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
|
Reference in New Issue
Block a user