Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/优化制造功能
This commit is contained in:
@@ -38,8 +38,7 @@ class SfMaintenanceEquipment(models.Model):
|
|||||||
|
|
||||||
crea_url = "/api/machine_tool/create"
|
crea_url = "/api/machine_tool/create"
|
||||||
|
|
||||||
|
# AGV运行日志
|
||||||
#AGV运行日志
|
|
||||||
agv_logs = fields.One2many('maintenance.equipment.agv.log', 'equipment_id', string='AGV运行日志')
|
agv_logs = fields.One2many('maintenance.equipment.agv.log', 'equipment_id', string='AGV运行日志')
|
||||||
# 1212修改后的字段
|
# 1212修改后的字段
|
||||||
number_of_axles = fields.Selection(
|
number_of_axles = fields.Selection(
|
||||||
@@ -117,7 +116,6 @@ class SfMaintenanceEquipment(models.Model):
|
|||||||
# num = "%04d" % m
|
# num = "%04d" % m
|
||||||
# return num
|
# return num
|
||||||
|
|
||||||
|
|
||||||
equipment_maintenance_standards_ids = fields.Many2many('equipment.maintenance.standards',
|
equipment_maintenance_standards_ids = fields.Many2many('equipment.maintenance.standards',
|
||||||
'sf_maintenance_equipment_ids', string='设备维保标准')
|
'sf_maintenance_equipment_ids', string='设备维保标准')
|
||||||
eq_maintenance_id = fields.Many2one('equipment.maintenance.standards', string='设备保养标准',
|
eq_maintenance_id = fields.Many2one('equipment.maintenance.standards', string='设备保养标准',
|
||||||
@@ -179,7 +177,8 @@ class SfMaintenanceEquipment(models.Model):
|
|||||||
type_id = fields.Many2one('sf.machine_tool.type', '型号')
|
type_id = fields.Many2one('sf.machine_tool.type', '型号')
|
||||||
|
|
||||||
state = fields.Selection(
|
state = fields.Selection(
|
||||||
[("正常", "正常"), ("故障停机", "故障停机"), ("计划维保", "计划维保"), ("空闲", "空闲"), ("封存(报废)", "封存(报废)")],
|
[("正常", "正常"), ("故障停机", "故障停机"), ("计划维保", "计划维保"), ("空闲", "空闲"),
|
||||||
|
("封存(报废)", "封存(报废)")],
|
||||||
default='正常', string="机床状态")
|
default='正常', string="机床状态")
|
||||||
run_time = fields.Char('总运行时长')
|
run_time = fields.Char('总运行时长')
|
||||||
# 0606新增字段
|
# 0606新增字段
|
||||||
@@ -328,7 +327,7 @@ class SfMaintenanceEquipment(models.Model):
|
|||||||
item.tool_diameter_min = item.type_id.tool_diameter_min
|
item.tool_diameter_min = item.type_id.tool_diameter_min
|
||||||
item.machine_tool_category = item.type_id.machine_tool_category.id
|
item.machine_tool_category = item.type_id.machine_tool_category.id
|
||||||
item.brand_id = item.type_id.brand_id.id
|
item.brand_id = item.type_id.brand_id.id
|
||||||
#新增修改字段
|
# 新增修改字段
|
||||||
item.taper_type_id = item.type_id.taper_type_id.id
|
item.taper_type_id = item.type_id.taper_type_id.id
|
||||||
item.function_type = item.type_id.function_type
|
item.function_type = item.type_id.function_type
|
||||||
item.a_axis = item.type_id.a_axis
|
item.a_axis = item.type_id.a_axis
|
||||||
@@ -370,7 +369,6 @@ class SfMaintenanceEquipment(models.Model):
|
|||||||
item.image_id = item.type_id.jg_image_id.ids
|
item.image_id = item.type_id.jg_image_id.ids
|
||||||
item.image_lq_id = item.type_id.lq_image_id.ids
|
item.image_lq_id = item.type_id.lq_image_id.ids
|
||||||
|
|
||||||
|
|
||||||
# AGV小车设备参数
|
# AGV小车设备参数
|
||||||
AGV_L = fields.Char('AGV尺寸(长)')
|
AGV_L = fields.Char('AGV尺寸(长)')
|
||||||
AGV_W = fields.Char('AGV尺寸(宽)')
|
AGV_W = fields.Char('AGV尺寸(宽)')
|
||||||
@@ -461,18 +459,6 @@ class SfMaintenanceEquipment(models.Model):
|
|||||||
original_value = fields.Char('原值')
|
original_value = fields.Char('原值')
|
||||||
incomplete_value = fields.Char('残值')
|
incomplete_value = fields.Char('残值')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# 注册同步机床
|
# 注册同步机床
|
||||||
def enroll_machine_tool(self):
|
def enroll_machine_tool(self):
|
||||||
sf_sync_config = self.env['res.config.settings'].get_values()
|
sf_sync_config = self.env['res.config.settings'].get_values()
|
||||||
@@ -763,7 +749,7 @@ class SfMaintenanceEquipment(models.Model):
|
|||||||
image_id = fields.Many2many('maintenance.equipment.image', 'equipment_id',
|
image_id = fields.Many2many('maintenance.equipment.image', 'equipment_id',
|
||||||
domain="[('type', '=', '加工能力')]")
|
domain="[('type', '=', '加工能力')]")
|
||||||
image_lq_id = fields.Many2many('maintenance.equipment.image', 'equipment_lq_id', string='冷却方式',
|
image_lq_id = fields.Many2many('maintenance.equipment.image', 'equipment_lq_id', string='冷却方式',
|
||||||
domain="[('type', '=', '冷却方式')]")
|
domain="[('type', '=', '冷却方式')]")
|
||||||
|
|
||||||
|
|
||||||
class SfRobotAxisNum(models.Model):
|
class SfRobotAxisNum(models.Model):
|
||||||
@@ -777,4 +763,5 @@ class SfRobotAxisNum(models.Model):
|
|||||||
weight = fields.Char('最大负载(kg)')
|
weight = fields.Char('最大负载(kg)')
|
||||||
permissible_load_torque = fields.Char('允许负载扭矩(N-m)')
|
permissible_load_torque = fields.Char('允许负载扭矩(N-m)')
|
||||||
permissible_inertial_torque = fields.Char('允许惯性扭矩(kg-m²)')
|
permissible_inertial_torque = fields.Char('允许惯性扭矩(kg-m²)')
|
||||||
equipment_id = fields.Many2one('maintenance.equipment', string='机器人', domain="[('equipment_type', '=', '机器人')]")
|
equipment_id = fields.Many2one('maintenance.equipment', string='机器人',
|
||||||
|
domain="[('equipment_type', '=', '机器人')]")
|
||||||
|
|||||||
@@ -806,6 +806,10 @@ class MrpProduction(models.Model):
|
|||||||
backorders = backorders - productions_to_backorder
|
backorders = backorders - productions_to_backorder
|
||||||
|
|
||||||
productions_not_to_backorder._post_inventory(cancel_backorder=True)
|
productions_not_to_backorder._post_inventory(cancel_backorder=True)
|
||||||
|
# if self.workorder_ids.filtered(lambda w: w.routing_type in ['表面工艺']):
|
||||||
|
# move_finish = self.env['stock.move'].search([('created_production_id', '=', self.id)])
|
||||||
|
# if move_finish:
|
||||||
|
# move_finish._action_assign()
|
||||||
productions_to_backorder._post_inventory(cancel_backorder=True)
|
productions_to_backorder._post_inventory(cancel_backorder=True)
|
||||||
|
|
||||||
# if completed products make other confirmed/partially_available moves available, assign them
|
# if completed products make other confirmed/partially_available moves available, assign them
|
||||||
|
|||||||
@@ -179,18 +179,14 @@ class WorkpieceDeliveryWizard(models.TransientModel):
|
|||||||
self.feeder_station_destination_id = self.route_id.end_site_id.id
|
self.feeder_station_destination_id = self.route_id.end_site_id.id
|
||||||
|
|
||||||
def on_barcode_scanned(self, barcode):
|
def on_barcode_scanned(self, barcode):
|
||||||
|
delivery_type = self.env.context.get('default_delivery_type')
|
||||||
# 判断barcode是否是数字
|
# 判断barcode是否是数字
|
||||||
if not barcode.isdigit():
|
if not barcode.isdigit():
|
||||||
# 判断是否是AGV接驳站名称
|
# 判断是否是AGV接驳站名称
|
||||||
agv_site = self.env['sf.agv.site'].search([('name', '=', barcode)])
|
agv_site = self.env['sf.agv.site'].search([('name', '=', barcode)])
|
||||||
if agv_site:
|
self.feeder_station_start_id = agv_site.id # 修正:移除 .id
|
||||||
if not self.feeder_station_start_id:
|
|
||||||
self.feeder_station_start_id = agv_site.id
|
|
||||||
else:
|
|
||||||
if self.feeder_station_start_id.id != agv_site.id:
|
|
||||||
raise UserError('起点接驳站不匹配!')
|
|
||||||
return
|
return
|
||||||
delivery_type = self.env.context.get('default_delivery_type')
|
|
||||||
if delivery_type == '上产线':
|
if delivery_type == '上产线':
|
||||||
workorder = self.env['mrp.workorder'].search(
|
workorder = self.env['mrp.workorder'].search(
|
||||||
[('production_line_state', '=', '待上产线'), ('rfid_code', '=', barcode),
|
[('production_line_state', '=', '待上产线'), ('rfid_code', '=', barcode),
|
||||||
@@ -214,7 +210,7 @@ class WorkpieceDeliveryWizard(models.TransientModel):
|
|||||||
self.production_ids |= workorder.production_id
|
self.production_ids |= workorder.production_id
|
||||||
self.workorder_ids |= workorder
|
self.workorder_ids |= workorder
|
||||||
|
|
||||||
down_product_agv_scheduling = self.get_down_product_agv_scheduling()
|
down_product_agv_scheduling = workorder.get_down_product_agv_scheduling()
|
||||||
if down_product_agv_scheduling:
|
if down_product_agv_scheduling:
|
||||||
if not self.feeder_station_start_id:
|
if not self.feeder_station_start_id:
|
||||||
self.feeder_station_start_id = down_product_agv_scheduling.end_site_id.id
|
self.feeder_station_start_id = down_product_agv_scheduling.end_site_id.id
|
||||||
@@ -226,4 +222,11 @@ class WorkpieceDeliveryWizard(models.TransientModel):
|
|||||||
raise UserError('该rfid码对应的工单不存在')
|
raise UserError('该rfid码对应的工单不存在')
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@api.onchange('feeder_station_start_id')
|
||||||
|
def on_start_id_change(self):
|
||||||
|
if self.delivery_type == '运送空料架' and len(self.workorder_ids) > 0:
|
||||||
|
down_product_agv_scheduling = self.workorder_ids[0].get_down_product_agv_scheduling()
|
||||||
|
if down_product_agv_scheduling and self.feeder_station_start_id \
|
||||||
|
and down_product_agv_scheduling.end_site_id.id != self.feeder_station_start_id.id:
|
||||||
|
raise UserError('当前接驳站不匹配!')
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
""",
|
""",
|
||||||
'category': 'sf',
|
'category': 'sf',
|
||||||
'website': 'https://www.sf.jikimo.com',
|
'website': 'https://www.sf.jikimo.com',
|
||||||
'depends': ['base', 'sf_base'],
|
'depends': ['base', 'sf_plan', 'sf_sale'],
|
||||||
'data': [
|
'data': [
|
||||||
'security/ir.model.access.csv',
|
'security/ir.model.access.csv',
|
||||||
'views/sf_message_template_view.xml',
|
'views/sf_message_template_view.xml',
|
||||||
|
|||||||
@@ -1 +1,8 @@
|
|||||||
from . import sf_message_template
|
from . import sf_message_template
|
||||||
|
from . import sf_message_sale
|
||||||
|
from . import sf_message_plan
|
||||||
|
from . import sf_message_stock_picking
|
||||||
|
from . import sf_message_cam_program
|
||||||
|
from . import sf_message_functional_tool_assembly
|
||||||
|
from . import sf_message_purchase
|
||||||
|
from . import sf_message_workorder
|
||||||
|
|||||||
6
sf_message/models/sf_message_cam_program.py
Normal file
6
sf_message/models/sf_message_cam_program.py
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
from odoo import models, fields, api, _
|
||||||
|
|
||||||
|
|
||||||
|
class SFMessageCamProgram(models.Model):
|
||||||
|
_name = 'sf.cam.work.order.program.knife.plan'
|
||||||
|
_inherit = ['sf.cam.work.order.program.knife.plan', 'sf.message.template']
|
||||||
6
sf_message/models/sf_message_functional_tool_assembly.py
Normal file
6
sf_message/models/sf_message_functional_tool_assembly.py
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
from odoo import models, fields, api, _
|
||||||
|
|
||||||
|
|
||||||
|
class SFMessagefunctionalToolAssembly(models.Model):
|
||||||
|
_name = 'sf.functional.tool.assembly'
|
||||||
|
_inherit = ['sf.functional.tool.assembly', 'sf.message.template']
|
||||||
6
sf_message/models/sf_message_plan.py
Normal file
6
sf_message/models/sf_message_plan.py
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
from odoo import models, fields, api, _
|
||||||
|
|
||||||
|
|
||||||
|
class SFMessagePlan(models.Model):
|
||||||
|
_name = 'sf.production.plan'
|
||||||
|
_inherit = ['sf.production.plan', 'sf.message.template']
|
||||||
6
sf_message/models/sf_message_purchase.py
Normal file
6
sf_message/models/sf_message_purchase.py
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
from odoo import models, fields, api, _
|
||||||
|
|
||||||
|
|
||||||
|
class SFMessagePurchase(models.Model):
|
||||||
|
_name = 'purchase.order'
|
||||||
|
_inherit = ['purchase.order', 'sf.message.template']
|
||||||
6
sf_message/models/sf_message_sale.py
Normal file
6
sf_message/models/sf_message_sale.py
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
from odoo import models, fields, api, _
|
||||||
|
|
||||||
|
|
||||||
|
class SFMessageSale(models.Model):
|
||||||
|
_name = 'sale.order'
|
||||||
|
_inherit = ['sale.order', 'sf.message.template']
|
||||||
6
sf_message/models/sf_message_stock_picking.py
Normal file
6
sf_message/models/sf_message_stock_picking.py
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
from odoo import models, fields, api, _
|
||||||
|
|
||||||
|
|
||||||
|
class SFMessageStockPicking(models.Model):
|
||||||
|
_name = 'stock.picking'
|
||||||
|
_inherit = ['stock.picking', 'sf.message.template']
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from odoo import models, fields, api
|
from odoo import models, fields, api
|
||||||
|
from abc import ABC, abstractmethod
|
||||||
|
|
||||||
|
|
||||||
class SfMessageTemplate(models.Model):
|
class SfMessageTemplate(models.Model):
|
||||||
@@ -7,30 +8,30 @@ class SfMessageTemplate(models.Model):
|
|||||||
_description = u'消息模板'
|
_description = u'消息模板'
|
||||||
|
|
||||||
name = fields.Char(string=u"名称", required=True)
|
name = fields.Char(string=u"名称", required=True)
|
||||||
type = fields.Selection([
|
# type = fields.Selection([
|
||||||
('待接单', '待接单'),
|
# ('待接单', '待接单'),
|
||||||
('待排程', '待排程'),
|
# ('待排程', '待排程'),
|
||||||
('坯料采购', '坯料采购'),
|
# ('坯料采购', '坯料采购'),
|
||||||
('坯料发料', '坯料发料'),
|
# ('坯料发料', '坯料发料'),
|
||||||
('待编程', '待编程'),
|
# ('待编程', '待编程'),
|
||||||
('调拨入库', '调拨入库'),
|
# ('调拨入库', '调拨入库'),
|
||||||
('功能刀具组装', '功能刀具组装'),
|
# ('功能刀具组装', '功能刀具组装'),
|
||||||
('功能刀具寿命到期', '功能刀具寿命到期'),
|
# ('功能刀具寿命到期', '功能刀具寿命到期'),
|
||||||
('程序用刀计划异常', '程序用刀计划异常'),
|
# ('程序用刀计划异常', '程序用刀计划异常'),
|
||||||
('工单无CNC程序', '工单无CNC程序'),
|
# ('工单无CNC程序', '工单无CNC程序'),
|
||||||
('生产线无功能刀具', '生产线无功能刀具'),
|
# ('生产线无功能刀具', '生产线无功能刀具'),
|
||||||
('工单无定位数据', '工单无定位数据'),
|
# ('工单无定位数据', '工单无定位数据'),
|
||||||
('工单FTP无文件', '工单FTP无文件'),
|
# ('工单FTP无文件', '工单FTP无文件'),
|
||||||
('工单加工失败', '工单加工失败'),
|
# ('工单加工失败', '工单加工失败'),
|
||||||
('设备故障及异常', '设备故障及异常'),
|
# ('设备故障及异常', '设备故障及异常'),
|
||||||
('工单逾期预警', '工单逾期预警'),
|
# ('工单逾期预警', '工单逾期预警'),
|
||||||
('工单已逾期', '工单已逾期'),
|
# ('工单已逾期', '工单已逾期'),
|
||||||
('销售订单逾期', '销售订单逾期'),
|
# ('销售订单逾期', '销售订单逾期'),
|
||||||
('销售订单已逾期', '销售订单已逾期'),
|
# ('销售订单已逾期', '销售订单已逾期'),
|
||||||
('待质量判定', '待质量判定'),
|
# ('待质量判定', '待质量判定'),
|
||||||
('生产完工待入库', '生产完工待入库'),
|
# ('生产完工待入库', '生产完工待入库'),
|
||||||
('订单发货', '订单发货')
|
# ('订单发货', '订单发货')
|
||||||
], string='类型', required=True)
|
# ], string='类型', required=True)
|
||||||
description = fields.Char(string=u"描述")
|
description = fields.Char(string=u"描述")
|
||||||
content = fields.Html(string=u"内容", render_engine='qweb', translate=True, prefetch=True, sanitize=False)
|
content = fields.Html(string=u"内容", render_engine='qweb', translate=True, prefetch=True, sanitize=False)
|
||||||
msgtype = fields.Selection(
|
msgtype = fields.Selection(
|
||||||
@@ -46,3 +47,9 @@ class SfMessageTemplate(models.Model):
|
|||||||
def _clear_employee_ids(self):
|
def _clear_employee_ids(self):
|
||||||
if self.notification_department_id:
|
if self.notification_department_id:
|
||||||
self.notification_employee_ids = False
|
self.notification_employee_ids = False
|
||||||
|
|
||||||
|
@abstractmethod
|
||||||
|
def dispatch(self, args):
|
||||||
|
"""
|
||||||
|
强迫继承该类必走该抽象方法'
|
||||||
|
"""
|
||||||
|
|||||||
6
sf_message/models/sf_message_workorder.py
Normal file
6
sf_message/models/sf_message_workorder.py
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
from odoo import models, fields, api, _
|
||||||
|
|
||||||
|
|
||||||
|
class SFMessageWork(models.Model):
|
||||||
|
_name = 'mrp.workorder'
|
||||||
|
_inherit = ['mrp.workorder', 'sf.message.template']
|
||||||
@@ -18,12 +18,11 @@
|
|||||||
</h1>
|
</h1>
|
||||||
</div>
|
</div>
|
||||||
<group>
|
<group>
|
||||||
<field name="type"/>
|
<!-- <field name="type"/>-->
|
||||||
<field name="content" widget="html" class="oe-bordered-editor"
|
<field name="content" widget="html" class="oe-bordered-editor"
|
||||||
options="{'style-inline': true, 'codeview': true, 'dynamic_placeholder': true}"/>
|
options="{'style-inline': true, 'codeview': true, 'dynamic_placeholder': true}"/>
|
||||||
<field name="description"/>
|
<field name="description"/>
|
||||||
<field name="msgtype"/>
|
<field name="msgtype"/>
|
||||||
<field name="type"/>
|
|
||||||
<field name="notification_department_id"/>
|
<field name="notification_department_id"/>
|
||||||
<field name="notification_employee_ids" widget="many2many_tags"/>
|
<field name="notification_employee_ids" widget="many2many_tags"/>
|
||||||
</group>
|
</group>
|
||||||
@@ -38,10 +37,9 @@
|
|||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<tree string="消息模板">
|
<tree string="消息模板">
|
||||||
<field name="name"/>
|
<field name="name"/>
|
||||||
<field name="type"/>
|
<!-- <field name="type"/>-->
|
||||||
<field name="content"/>
|
<field name="content"/>
|
||||||
<field name="msgtype"/>
|
<field name="msgtype"/>
|
||||||
<field name="type"/>
|
|
||||||
<field name="notification_department_id"/>
|
<field name="notification_department_id"/>
|
||||||
<field name="notification_employee_ids" widget="many2many_tags"/>
|
<field name="notification_employee_ids" widget="many2many_tags"/>
|
||||||
<field name="description"/>
|
<field name="description"/>
|
||||||
@@ -55,7 +53,7 @@
|
|||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<search>
|
<search>
|
||||||
<field name="name" string="模糊搜索"
|
<field name="name" string="模糊搜索"
|
||||||
filter_domain="['|','|',('name','like',self),('type','like',self),('description','like',self)]"/>
|
filter_domain="['|','|',('name','like',self),('description','like',self)]"/>
|
||||||
<field name="name"/>
|
<field name="name"/>
|
||||||
<filter name="filter_active" string="已归档" domain="[('active','=',False)]"/>
|
<filter name="filter_active" string="已归档" domain="[('active','=',False)]"/>
|
||||||
</search>
|
</search>
|
||||||
|
|||||||
@@ -10,11 +10,12 @@
|
|||||||
""",
|
""",
|
||||||
'category': 'sf',
|
'category': 'sf',
|
||||||
'website': 'https://www.sf.cs.jikimo.com',
|
'website': 'https://www.sf.cs.jikimo.com',
|
||||||
'depends': ['sf_base', 'base_setup'],
|
'depends': ['sf_base', 'base_setup','sf_bf_connect'],
|
||||||
'data': [
|
'data': [
|
||||||
'data/ir_cron_data.xml',
|
'data/ir_cron_data.xml',
|
||||||
'security/ir.model.access.csv',
|
'security/ir.model.access.csv',
|
||||||
'views/res_config_settings_views.xml'
|
'views/res_config_settings_views.xml',
|
||||||
|
'views/order_price.xml',
|
||||||
],
|
],
|
||||||
'demo': [
|
'demo': [
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
from . import ftp_operate
|
from . import ftp_operate
|
||||||
from . import res_config_setting
|
from . import res_config_setting
|
||||||
from . import sync_common
|
from . import sync_common
|
||||||
|
from . import order_price
|
||||||
29
sf_mrs_connect/models/order_price.py
Normal file
29
sf_mrs_connect/models/order_price.py
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
from odoo import fields, models, api
|
||||||
|
|
||||||
|
|
||||||
|
class OrderPrice(models.Model):
|
||||||
|
_name = 'order.price'
|
||||||
|
_description = '订单价格对比'
|
||||||
|
sale_order_id = fields.Many2one('sale.order', '销售订单')
|
||||||
|
bfm_order_name = fields.Char(related="sale_order_id.default_code", string='bfm订单号')
|
||||||
|
sale_order_name = fields.Char(related="sale_order_id.name", string='销售订单号')
|
||||||
|
currency_id = fields.Many2one(
|
||||||
|
related='sale_order_id.currency_id', string='货币', store=True)
|
||||||
|
sale_order_amount_total = fields.Monetary(related="sale_order_id.amount_total", tracking=4, string='销售订单金额')
|
||||||
|
bfm_amount_total = fields.Float(string='价格合计', compute='_compute_bfm_amount_total', store=True)
|
||||||
|
|
||||||
|
def is_float(self,value):
|
||||||
|
try:
|
||||||
|
float(value)
|
||||||
|
return True
|
||||||
|
except ValueError:
|
||||||
|
return False
|
||||||
|
@api.depends('sale_order_id.remark')
|
||||||
|
def _compute_bfm_amount_total(self):
|
||||||
|
for record in self:
|
||||||
|
amount_total = 0
|
||||||
|
for line in record.sale_order_id.order_line:
|
||||||
|
# 判断remark是否存在并且是否是数字
|
||||||
|
if line.remark and self.is_float(line.remark):
|
||||||
|
amount_total += float(line.remark)
|
||||||
|
record.bfm_amount_total = amount_total
|
||||||
@@ -184,7 +184,10 @@ class ResConfigSettings(models.TransientModel):
|
|||||||
new_price = res_order_lines_map.get(str(index))
|
new_price = res_order_lines_map.get(str(index))
|
||||||
if order_line:
|
if order_line:
|
||||||
# 修改单价
|
# 修改单价
|
||||||
order_line.write({'remark': new_price})
|
order_line.write({'remark': new_price*order_line.product_uom_qty})
|
||||||
|
order_price = self.env['order.price'].sudo().search([('sale_order_id', '=',need_change_sale_order.id )])
|
||||||
|
if not order_price:
|
||||||
|
self.env['order.price'].sudo().create({'sale_order_id':need_change_sale_order.id})
|
||||||
else:
|
else:
|
||||||
logging.error('同步销售订单价格失败 {}'.format(response.text))
|
logging.error('同步销售订单价格失败 {}'.format(response.text))
|
||||||
raise UserError('同步销售订单价格失败')
|
raise UserError('同步销售订单价格失败')
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
||||||
access_sf_static_resource_datasync,sf_static_resource_datasync,model_sf_static_resource_datasync,base.group_user,1,1,1,1
|
access_sf_static_resource_datasync,sf_static_resource_datasync,model_sf_static_resource_datasync,base.group_user,1,1,1,1
|
||||||
|
|
||||||
|
access_order_price,order.price,model_order_price,base.group_user,1,1,1,1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
|
26
sf_mrs_connect/views/order_price.xml
Normal file
26
sf_mrs_connect/views/order_price.xml
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<odoo>
|
||||||
|
<menuitem sequence="22" name="销售订单bfm对比" id="menu_sale_order_bfm_price"
|
||||||
|
action="order_price_tree_act"
|
||||||
|
parent="sale.sale_order_menu"
|
||||||
|
groups="base.group_user"
|
||||||
|
/>
|
||||||
|
<record model="ir.actions.act_window" id="order_price_tree_act">
|
||||||
|
<field name="name">bfm订单价格对比</field>
|
||||||
|
<field name="res_model">order.price</field>
|
||||||
|
<field name="view_mode">tree,form</field>
|
||||||
|
</record>
|
||||||
|
<record id="view_order_price_tree" model="ir.ui.view">
|
||||||
|
<field name="name">order.price.list</field>
|
||||||
|
<field name="model">order.price</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<tree string="订单计划">
|
||||||
|
<field name="bfm_order_name"/>
|
||||||
|
<field name="sale_order_name"/>
|
||||||
|
<field name="sale_order_amount_total"/>
|
||||||
|
<field name="bfm_amount_total"/>
|
||||||
|
</tree>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
</odoo>
|
||||||
@@ -75,16 +75,21 @@ class sf_production_plan(models.Model):
|
|||||||
if self.date_planned_start:
|
if self.date_planned_start:
|
||||||
self.date_planned_finished = self.date_planned_start + timedelta(hours=1)
|
self.date_planned_finished = self.date_planned_start + timedelta(hours=1)
|
||||||
|
|
||||||
#处理计划状态非代排程,计划结束时间为空的数据处理
|
#处理计划状态非待排程,计划结束时间为空的数据处理
|
||||||
def deal_no_date_planned_finished(self):
|
def deal_no_date_planned_finished(self):
|
||||||
plans = self.env['sf.production.plan'].search(
|
plans = self.env['sf.production.plan'].search(
|
||||||
[('date_planned_finished', '=', False), ('state', 'in', ['processing', 'done', 'finished'])])
|
[('date_planned_finished', '=', False), ('state', 'in', ['processing', 'done', 'finished'])])
|
||||||
for item in plans:
|
for item in plans:
|
||||||
if item.date_planned_start:
|
if item.date_planned_start:
|
||||||
item.date_planned_finished = item.date_planned_start + timedelta(hours=1)
|
item.date_planned_finished = item.date_planned_start + timedelta(hours=1)
|
||||||
if not item.order_deadline and item.date_planned_start:
|
|
||||||
item.order_deadline = item.date_planned_start + timedelta(days=7)
|
|
||||||
|
|
||||||
|
# 处理计划订单截止时间为空的数据
|
||||||
|
def deal_no_order_deadline(self):
|
||||||
|
plans = self.env['sf.production.plan'].sudo().search(
|
||||||
|
[('order_deadline', '=', False)])
|
||||||
|
for item in plans:
|
||||||
|
if item.date_planned_start:
|
||||||
|
item.order_deadline = item.date_planned_start + timedelta(days=7)
|
||||||
@api.model
|
@api.model
|
||||||
def search_read(self, domain=None, fields=None, offset=0, limit=None, order=None):
|
def search_read(self, domain=None, fields=None, offset=0, limit=None, order=None):
|
||||||
|
|
||||||
|
|||||||
@@ -3,4 +3,4 @@ from odoo import models, fields
|
|||||||
|
|
||||||
class SyncFunctionalCuttingToolModel(models.Model):
|
class SyncFunctionalCuttingToolModel(models.Model):
|
||||||
_inherit = 'sf.functional.cutting.tool.model'
|
_inherit = 'sf.functional.cutting.tool.model'
|
||||||
cutting_tool_type_ids = fields.Many2many('sf.cutting.tool.type', string='适用刀具物料类型', required=True)
|
cutting_tool_type_ids = fields.Many2many('sf.cutting.tool.type', string='适用刀具物料类型')
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
<field name="inherit_id" ref="sf_base.view_cutter_function_tree"/>
|
<field name="inherit_id" ref="sf_base.view_cutter_function_tree"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<xpath expr="//field[@name='name']" position="after">
|
<xpath expr="//field[@name='name']" position="after">
|
||||||
<field name="cutting_tool_type_ids" widget="many2many_tags"/>
|
<field name="cutting_tool_type_ids" widget="many2many_tags" options="{'no_create': True}"/>
|
||||||
</xpath>
|
</xpath>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|||||||
Reference in New Issue
Block a user