Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/销售订单和工单逾期消息推送
# Conflicts: # sf_message/__manifest__.py # sf_message/data/bussiness_node.xml # sf_message/models/sf_message_sale.py
This commit is contained in:
@@ -163,6 +163,19 @@ class ResWorkcenter(models.Model):
|
||||
else:
|
||||
record.effective_working_hours_day = 0
|
||||
|
||||
# 计算传入时间日有效工作时长
|
||||
def _compute_effective_working_hours_day1(self, date):
|
||||
effective_working_hours_day = 0
|
||||
for record in self:
|
||||
attendance_ids = [p for p in record.resource_calendar_id.attendance_ids if
|
||||
p.dayofweek == self.get_current_day_of_week(date)]
|
||||
if attendance_ids:
|
||||
for attendance_id in attendance_ids:
|
||||
if attendance_id.hour_from and attendance_id.hour_to:
|
||||
effective_working_hours_day += attendance_id.hour_to - attendance_id.hour_from
|
||||
|
||||
return effective_working_hours_day
|
||||
|
||||
# 获取传入时间是星期几
|
||||
def get_current_day_of_week(self, datetime):
|
||||
day_num = datetime.weekday()
|
||||
@@ -211,7 +224,8 @@ class ResWorkcenter(models.Model):
|
||||
('state', 'not in', ['draft', 'cancel'])])
|
||||
if plan_ids:
|
||||
sum_qty = sum([p.product_qty for p in plan_ids])
|
||||
if sum_qty >= self.default_capacity:
|
||||
date_planned_working_hours = self._compute_effective_working_hours_day1(date_planned)
|
||||
if sum_qty >= date_planned_working_hours:
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
@@ -42,10 +42,10 @@ class ResProductMo(models.Model):
|
||||
product_model_type_id = fields.Many2one('sf.model.type', string='产品模型类型')
|
||||
embryo_model_type_id = fields.Many2one('sf.model.type', string='坯料模型类型')
|
||||
materials_id = fields.Many2one('sf.production.materials', string='材料')
|
||||
# materials_type_id = fields.Many2one('sf.materials.model', string='材料型号',
|
||||
# domain="[('materials_id', '=', materials_id)]")
|
||||
materials_type_id = fields.Many2one(related='cutting_tool_model_id.material_model_id', string='材料型号',
|
||||
materials_type_id = fields.Many2one('sf.materials.model', string='材料型号',
|
||||
domain="[('materials_id', '=', materials_id)]")
|
||||
# materials_type_id = fields.Many2one(related='cutting_tool_model_id.material_model_id', string='材料型号',
|
||||
# domain="[('materials_id', '=', materials_id)]")
|
||||
# cutting_tool_model_id.material_model_id
|
||||
server_product_process_parameters_id = fields.Many2one('sf.production.process.parameter',
|
||||
string='表面工艺参数(服务产品)')
|
||||
@@ -58,10 +58,10 @@ class ResProductMo(models.Model):
|
||||
cutting_tool_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='型号名称')
|
||||
specification_id = fields.Many2one('sf.tool.materials.basic.parameters', string='物料号')
|
||||
|
||||
# cutting_tool_type_id = fields.Many2one('sf.cutting.tool.type', string='类型',
|
||||
# domain="[('cutting_tool_material_id.name', '=', cutting_tool_type)]")
|
||||
cutting_tool_type_id = fields.Many2one(related='cutting_tool_model_id.cutting_tool_type_id', string='类型',
|
||||
cutting_tool_type_id = fields.Many2one('sf.cutting.tool.type', string='类型',
|
||||
domain="[('cutting_tool_material_id.name', '=', cutting_tool_type)]")
|
||||
# cutting_tool_type_id = fields.Many2one(related='cutting_tool_model_id.cutting_tool_type_id', string='类型',
|
||||
# domain="[('cutting_tool_material_id.name', '=', cutting_tool_type)]")
|
||||
# brand_id = fields.Many2one('sf.machine.brand', '品牌')
|
||||
brand_id = fields.Many2one(related='cutting_tool_model_id.brand_id', string='品牌')
|
||||
# cutting_tool_model_id.brand_id
|
||||
@@ -630,14 +630,14 @@ class ResProductMo(models.Model):
|
||||
cutting_tool_installing_structure = fields.Char(related='specification_id.installing_structure',
|
||||
string='安装结构')
|
||||
# specification_id.installing_structure
|
||||
# cutting_tool_blade_id = fields.Many2one(
|
||||
# 'sf.cutting_tool.standard.library',
|
||||
# domain="[('cutting_tool_type', '=', '刀片')]",
|
||||
# string='适用刀片型号' # 使用空列表作为默认值
|
||||
# )
|
||||
cutting_tool_blade_id = fields.Many2one(related='specification_id.blade_id',
|
||||
domain="[('cutting_tool_type', '=', '刀片')]",
|
||||
string='适用刀片型号')
|
||||
cutting_tool_blade_id = fields.Many2one(
|
||||
'sf.cutting_tool.standard.library',
|
||||
domain="[('cutting_tool_type', '=', '刀片')]",
|
||||
string='适用刀片型号' # 使用空列表作为默认值
|
||||
)
|
||||
# cutting_tool_blade_id = fields.Many2one(related='specification_id.blade_id',
|
||||
# domain="[('cutting_tool_type', '=', '刀片')]",
|
||||
# string='适用刀片型号')
|
||||
# specification_id.blade_id
|
||||
# cutting_tool_tool_shim = fields.Char('适配刀垫型号', size=50)
|
||||
cutting_tool_tool_shim = fields.Char(related='specification_id.tool_shim',
|
||||
@@ -756,14 +756,14 @@ class ResProductMo(models.Model):
|
||||
# string='适用刀柄型号'
|
||||
# )
|
||||
|
||||
# cutting_tool_handle_id = fields.Many2one(
|
||||
# 'sf.cutting_tool.standard.library',
|
||||
# domain="[('cutting_tool_type', '=', '刀柄')]",
|
||||
# string='适用刀柄型号'
|
||||
# )
|
||||
cutting_tool_handle_id = fields.Many2one(related='cutting_tool_model_id.handle_id',
|
||||
domain="[('cutting_tool_type', '=', '刀柄')]",
|
||||
string='适用刀柄型号')
|
||||
cutting_tool_handle_id = fields.Many2one(
|
||||
'sf.cutting_tool.standard.library',
|
||||
domain="[('cutting_tool_type', '=', '刀柄')]",
|
||||
string='适用刀柄型号'
|
||||
)
|
||||
# cutting_tool_handle_id = fields.Many2one(related='cutting_tool_model_id.handle_id',
|
||||
# domain="[('cutting_tool_type', '=', '刀柄')]",
|
||||
# string='适用刀柄型号')
|
||||
# cutting_tool_model_id.handle_id
|
||||
|
||||
# 注册状态
|
||||
|
||||
Reference in New Issue
Block a user