Accept Merge Request #747: (feature/制造代码优化 -> develop)
Merge Request: 一些优化事宜,包括批量排程,修复坯料单展示问题等 Created By: @马广威 Accepted By: @马广威 URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/747
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
'views/tool_basic_param.xml',
|
||||
'views/tool_menu.xml',
|
||||
'views/menu_fixture_view.xml',
|
||||
'views/change_base_view.xml',
|
||||
|
||||
],
|
||||
'demo': [
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
<record id="group_plan_director" model="res.groups">
|
||||
<field name="name">计划总监</field>
|
||||
<field name="category_id" ref="module_category_plan"/>
|
||||
<!-- <field name="implied_ids" eval="[(4, ref('sf_base.group_plan_dispatch'))]"/>-->
|
||||
<field name="implied_ids" eval="[(4, ref('sf_base.group_plan_dispatch'))]"/>
|
||||
</record>
|
||||
|
||||
<record id="group_purchase" model="res.groups">
|
||||
|
||||
15
sf_base/views/change_base_view.xml
Normal file
15
sf_base/views/change_base_view.xml
Normal file
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<odoo>
|
||||
<data>
|
||||
<record model="ir.ui.view" id="sf_base_res_partner_kanban_view">
|
||||
<field name="name">sf.base.res.partner.kanban</field>
|
||||
<field name="model">res.partner</field>
|
||||
<field name="inherit_id" ref="base.res_partner_kanban_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//kanban//templates//t//div//div//div//ul//li[last()]" position="after">
|
||||
<li t-if="record.vat.raw_value" class="o_text_overflow"><field name="vat"/></li>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
||||
@@ -29,44 +29,44 @@
|
||||
<field name="spindle_speed"/>
|
||||
</group>
|
||||
</group>
|
||||
<group string='刀位统计'>
|
||||
<group>
|
||||
<group>
|
||||
<field name="tool_num_process_time1"/>
|
||||
<field name="tool_num_process_time5"/>
|
||||
<field name="tool_num_process_time9"/>
|
||||
<field name="tool_num_process_time13"/>
|
||||
<field name="tool_num_process_time17"/>
|
||||
<field name="tool_num_process_time21"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="tool_num_process_time2"/>
|
||||
<field name="tool_num_process_time6"/>
|
||||
<field name="tool_num_process_time10"/>
|
||||
<field name="tool_num_process_time14"/>
|
||||
<field name="tool_num_process_time18"/>
|
||||
<field name="tool_num_process_time22"/>
|
||||
</group>
|
||||
</group>
|
||||
<group>
|
||||
<group>
|
||||
<field name="tool_num_process_time3"/>
|
||||
<field name="tool_num_process_time7"/>
|
||||
<field name="tool_num_process_time11"/>
|
||||
<field name="tool_num_process_time15"/>
|
||||
<field name="tool_num_process_time19"/>
|
||||
<field name="tool_num_process_time23"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="tool_num_process_time4"/>
|
||||
<field name="tool_num_process_time8"/>
|
||||
<field name="tool_num_process_time12"/>
|
||||
<field name="tool_num_process_time16"/>
|
||||
<field name="tool_num_process_time20"/>
|
||||
<field name="tool_num_process_time24"/>
|
||||
</group>
|
||||
</group>
|
||||
</group>
|
||||
<!-- <group string='刀位统计'> -->
|
||||
<!-- <group> -->
|
||||
<!-- <group> -->
|
||||
<!-- <field name="tool_num_process_time1"/> -->
|
||||
<!-- <field name="tool_num_process_time5"/> -->
|
||||
<!-- <field name="tool_num_process_time9"/> -->
|
||||
<!-- <field name="tool_num_process_time13"/> -->
|
||||
<!-- <field name="tool_num_process_time17"/> -->
|
||||
<!-- <field name="tool_num_process_time21"/> -->
|
||||
<!-- </group> -->
|
||||
<!-- <group> -->
|
||||
<!-- <field name="tool_num_process_time2"/> -->
|
||||
<!-- <field name="tool_num_process_time6"/> -->
|
||||
<!-- <field name="tool_num_process_time10"/> -->
|
||||
<!-- <field name="tool_num_process_time14"/> -->
|
||||
<!-- <field name="tool_num_process_time18"/> -->
|
||||
<!-- <field name="tool_num_process_time22"/> -->
|
||||
<!-- </group> -->
|
||||
<!-- </group> -->
|
||||
<!-- <group> -->
|
||||
<!-- <group> -->
|
||||
<!-- <field name="tool_num_process_time3"/> -->
|
||||
<!-- <field name="tool_num_process_time7"/> -->
|
||||
<!-- <field name="tool_num_process_time11"/> -->
|
||||
<!-- <field name="tool_num_process_time15"/> -->
|
||||
<!-- <field name="tool_num_process_time19"/> -->
|
||||
<!-- <field name="tool_num_process_time23"/> -->
|
||||
<!-- </group> -->
|
||||
<!-- <group> -->
|
||||
<!-- <field name="tool_num_process_time4"/> -->
|
||||
<!-- <field name="tool_num_process_time8"/> -->
|
||||
<!-- <field name="tool_num_process_time12"/> -->
|
||||
<!-- <field name="tool_num_process_time16"/> -->
|
||||
<!-- <field name="tool_num_process_time20"/> -->
|
||||
<!-- <field name="tool_num_process_time24"/> -->
|
||||
<!-- </group> -->
|
||||
<!-- </group> -->
|
||||
<!-- </group> -->
|
||||
|
||||
<!-- <div class="o_address_format"> -->
|
||||
<!-- <label for="tool_num_process_time1" string="刀位1"/> -->
|
||||
@@ -216,46 +216,46 @@
|
||||
</group>
|
||||
<!-- </group> -->
|
||||
</page>
|
||||
<page string="刀位配置">
|
||||
<group string="刀位配置">
|
||||
<group>
|
||||
<group>
|
||||
<field name="tool_num1"/>
|
||||
<field name="tool_num5"/>
|
||||
<field name="tool_num9"/>
|
||||
<field name="tool_num13"/>
|
||||
<field name="tool_num17"/>
|
||||
<field name="tool_num21"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="tool_num2"/>
|
||||
<field name="tool_num6"/>
|
||||
<field name="tool_num10"/>
|
||||
<field name="tool_num14"/>
|
||||
<field name="tool_num18"/>
|
||||
<field name="tool_num22"/>
|
||||
</group>
|
||||
</group>
|
||||
<group>
|
||||
<group>
|
||||
<field name="tool_num3"/>
|
||||
<field name="tool_num7"/>
|
||||
<field name="tool_num11"/>
|
||||
<field name="tool_num15"/>
|
||||
<field name="tool_num19"/>
|
||||
<field name="tool_num23"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="tool_num4"/>
|
||||
<field name="tool_num8"/>
|
||||
<field name="tool_num12"/>
|
||||
<field name="tool_num16"/>
|
||||
<field name="tool_num20"/>
|
||||
<field name="tool_num24"/>
|
||||
</group>
|
||||
</group>
|
||||
</group>
|
||||
</page>
|
||||
<!-- <page string="刀位配置"> -->
|
||||
<!-- <group string="刀位配置"> -->
|
||||
<!-- <group> -->
|
||||
<!-- <group> -->
|
||||
<!-- <field name="tool_num1"/> -->
|
||||
<!-- <field name="tool_num5"/> -->
|
||||
<!-- <field name="tool_num9"/> -->
|
||||
<!-- <field name="tool_num13"/> -->
|
||||
<!-- <field name="tool_num17"/> -->
|
||||
<!-- <field name="tool_num21"/> -->
|
||||
<!-- </group> -->
|
||||
<!-- <group> -->
|
||||
<!-- <field name="tool_num2"/> -->
|
||||
<!-- <field name="tool_num6"/> -->
|
||||
<!-- <field name="tool_num10"/> -->
|
||||
<!-- <field name="tool_num14"/> -->
|
||||
<!-- <field name="tool_num18"/> -->
|
||||
<!-- <field name="tool_num22"/> -->
|
||||
<!-- </group> -->
|
||||
<!-- </group> -->
|
||||
<!-- <group> -->
|
||||
<!-- <group> -->
|
||||
<!-- <field name="tool_num3"/> -->
|
||||
<!-- <field name="tool_num7"/> -->
|
||||
<!-- <field name="tool_num11"/> -->
|
||||
<!-- <field name="tool_num15"/> -->
|
||||
<!-- <field name="tool_num19"/> -->
|
||||
<!-- <field name="tool_num23"/> -->
|
||||
<!-- </group> -->
|
||||
<!-- <group> -->
|
||||
<!-- <field name="tool_num4"/> -->
|
||||
<!-- <field name="tool_num8"/> -->
|
||||
<!-- <field name="tool_num12"/> -->
|
||||
<!-- <field name="tool_num16"/> -->
|
||||
<!-- <field name="tool_num20"/> -->
|
||||
<!-- <field name="tool_num24"/> -->
|
||||
<!-- </group> -->
|
||||
<!-- </group> -->
|
||||
<!-- </group> -->
|
||||
<!-- </page> -->
|
||||
<!-- </notebook> -->
|
||||
</xpath>
|
||||
</field>
|
||||
|
||||
@@ -137,7 +137,10 @@ class ResMrpWorkOrder(models.Model):
|
||||
"""
|
||||
检测is_ok(是否合格)被修改的话,就将当前用户赋值给inspection_user_id
|
||||
"""
|
||||
self.inspection_user_id = self.env.user.id
|
||||
if not self.inspection_user_id:
|
||||
self.inspection_user_id = self.env.user.id
|
||||
else:
|
||||
self.inspection_user_id = False
|
||||
|
||||
@api.onchange('functional_fixture_id')
|
||||
def _onchange_functional_fixture_id(self):
|
||||
|
||||
@@ -202,8 +202,7 @@ class StockRule(models.Model):
|
||||
sale_order = self.env['sale.order'].sudo().search([('name', '=', production.origin)])
|
||||
if sale_order:
|
||||
sale_order.write({'schedule_status': 'to schedule'})
|
||||
self.env['sf.production.plan'].sudo().with_company(company_id). \
|
||||
create({
|
||||
self.env['sf.production.plan'].sudo().with_company(company_id).create({
|
||||
'name': production.name,
|
||||
'order_deadline': sale_order.deadline_of_delivery,
|
||||
'production_id': production.id,
|
||||
|
||||
@@ -153,40 +153,45 @@ class sf_production_plan(models.Model):
|
||||
"""
|
||||
排程方法
|
||||
"""
|
||||
if not self.production_line_id:
|
||||
raise ValidationError("未选择生产线")
|
||||
else:
|
||||
workorder_id_list = self.production_id.workorder_ids.ids
|
||||
if self.production_id.workorder_ids:
|
||||
for item in self.production_id.workorder_ids:
|
||||
if item.name == 'CNC加工':
|
||||
item.date_planned_finished = datetime.now() + timedelta(days=100)
|
||||
item.date_planned_start = self.date_planned_start
|
||||
item.date_planned_finished = item.date_planned_start + timedelta(
|
||||
minutes=self.env['mrp.routing.workcenter'].sudo().search(
|
||||
[('name', '=', 'CNC加工')]).time_cycle)
|
||||
item.duration_expected = self.env['mrp.routing.workcenter'].sudo().search(
|
||||
[('name', '=', 'CNC加工')]).time_cycle
|
||||
self.calculate_plan_time_before(item, workorder_id_list)
|
||||
self.calculate_plan_time_after(item, workorder_id_list)
|
||||
self.date_planned_start, self.date_planned_finished = \
|
||||
item.date_planned_start, item.date_planned_finished
|
||||
self.state = 'done'
|
||||
self.production_id.schedule_state = '已排'
|
||||
# self.production_id.date_planned_start = self.date_planned_start
|
||||
# self.production_id.date_planned_finished = self.date_planned_finished
|
||||
for record in self:
|
||||
if not record.production_line_id:
|
||||
raise ValidationError("未选择生产线")
|
||||
else:
|
||||
raise ValidationError("未找到工单")
|
||||
# self.date_planned_finished = self.date_planned_start + timedelta(days=3)
|
||||
# self.state = 'done'
|
||||
return {
|
||||
'name': '排程甘特图',
|
||||
'type': 'ir.actions.act_window',
|
||||
'res_model': 'sf.production.plan', # 要跳转的模型名称
|
||||
# 要显示的视图类型,可以是'form', 'tree', 'kanban', 'graph', 'calendar', 'pivot'等
|
||||
'view_mode': 'gantt,tree,form',
|
||||
'target': 'current', # 跳转的目标窗口,可以是'current'或'new'
|
||||
}
|
||||
workorder_id_list = record.production_id.workorder_ids.ids
|
||||
if record.production_id.workorder_ids:
|
||||
for item in record.production_id.workorder_ids:
|
||||
if item.name == 'CNC加工':
|
||||
item.date_planned_finished = datetime.now() + timedelta(days=100)
|
||||
item.date_planned_start = record.date_planned_start
|
||||
item.date_planned_finished = item.date_planned_start + timedelta(
|
||||
minutes=record.env['mrp.routing.workcenter'].sudo().search(
|
||||
[('name', '=', 'CNC加工')]).time_cycle)
|
||||
item.duration_expected = record.env['mrp.routing.workcenter'].sudo().search(
|
||||
[('name', '=', 'CNC加工')]).time_cycle
|
||||
record.calculate_plan_time_before(item, workorder_id_list)
|
||||
record.calculate_plan_time_after(item, workorder_id_list)
|
||||
record.date_planned_start, record.date_planned_finished = \
|
||||
item.date_planned_start, item.date_planned_finished
|
||||
record.state = 'done'
|
||||
record.production_id.schedule_state = '已排'
|
||||
mrp_production_ids = record.production_id._get_children().ids
|
||||
print('mrp_production_ids', mrp_production_ids)
|
||||
for i in mrp_production_ids:
|
||||
record.env['mrp.production'].browse(i).schedule_state = '已排'
|
||||
# record.production_id.date_planned_start = record.date_planned_start
|
||||
# record.production_id.date_planned_finished = record.date_planned_finished
|
||||
else:
|
||||
raise ValidationError("未找到工单")
|
||||
# record.date_planned_finished = record.date_planned_start + timedelta(days=3)
|
||||
# record.state = 'done'
|
||||
return {
|
||||
'name': '排程甘特图',
|
||||
'type': 'ir.actions.act_window',
|
||||
'res_model': 'sf.production.plan', # 要跳转的模型名称
|
||||
# 要显示的视图类型,可以是'form', 'tree', 'kanban', 'graph', 'calendar', 'pivot'等
|
||||
'view_mode': 'gantt,tree,form',
|
||||
'target': 'current', # 跳转的目标窗口,可以是'current'或'new'
|
||||
}
|
||||
|
||||
def calculate_plan_time_before(self, item, workorder_id_list):
|
||||
"""
|
||||
|
||||
@@ -5,7 +5,10 @@
|
||||
<field name="name">sf.production.plan.tree</field>
|
||||
<field name="model">sf.production.plan</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="订单计划">
|
||||
<tree string="订单计划" editable="bottom">
|
||||
<header>
|
||||
<button name="do_production_schedule" type="object" string="批量排程"/>
|
||||
</header>
|
||||
<field name="state" widget="badge" decoration-warning="state == 'draft'" decoration-success="state == 'done'"/>
|
||||
<field name="name"/>
|
||||
<field name="origin"/>
|
||||
|
||||
@@ -62,7 +62,6 @@ access_quality_tag_group_quality_director,quality_tag_group_quality_director,qua
|
||||
access_quality_reason_type_group_quality,quality_reason_group_quality,quality.model_quality_reason,sf_base.group_quality,1,0,0,0
|
||||
access_quality_reason_type_group_quality_director,quality_reason_group_quality_director,quality.model_quality_reason,sf_base.group_quality_director,1,0,0,0
|
||||
|
||||
|
||||
|
||||
access_quality_alert_stage,quality.alert.stage,quality.model_quality_alert_stage,sf_base.group_plan_dispatch,1,0,0,0
|
||||
|
||||
|
||||
|
||||
|
@@ -69,8 +69,11 @@ access_purchase_order_wizard_group_purchase,purchase_order_wizard_group_purchase
|
||||
access_purchase_order_wizard_group_purchase_director,purchase_order_wizard_group_purchase_director,model_purchase_order_wizard,sf_base.group_purchase_director,1,1,1,0
|
||||
access_crm_tag_group_sale_salemanager,crm_tag_group_sale_salemanager,sales_team.model_crm_tag,sf_base.group_sale_salemanager,1,0,0,0
|
||||
access_crm_tag_group_sale_director,crm_tag_group_sale_director,sales_team.model_crm_tag,sf_base.group_sale_director,1,1,1,0
|
||||
|
||||
access_sale_order,sale.order,sale.model_sale_order,sf_base.group_plan_dispatch,1,0,0,0
|
||||
access_res_partner_group_purchase,res_partner_group_purchase,base.model_res_partner,sf_base.group_purchase,1,1,1,0
|
||||
access_res_partner_group_purchase_director,res_partner_group_purchase_director,base.model_res_partner,sf_base.group_purchase_director,1,1,1,0
|
||||
access_sale_advance_payment_inv_group_sale_salemanager,sale_advance_payment_inv_group_sale_salemanager,sale.model_sale_advance_payment_inv,sf_base.group_sale_salemanager,1,1,1,0
|
||||
access_sale_advance_payment_inv_group_sale_director,sale_advance_payment_inv_group_sale_director,sale.model_sale_advance_payment_inv,sf_base.group_sale_director,1,1,1,0
|
||||
|
||||
|
||||
|
||||
|
@@ -96,7 +96,7 @@ access_stock_replenish_option,stock.replenishment.option,stock.model_stock_reple
|
||||
access_mrp_production,mrp.production,mrp.model_mrp_production,sf_warehouse.group_sf_stock_user,1,1,1,0
|
||||
|
||||
access_sf_shelf_location,sf.shelf.location,model_sf_shelf_location,sf_base.group_plan_dispatch,1,0,0,0
|
||||
access_stock_move,stock.move,stock.model_stock_move,sf_base.group_plan_dispatch,1,0,0,0
|
||||
access_stock_move,stock.move,stock.model_stock_move,sf_base.group_plan_dispatch,1,1,1,0
|
||||
access_stock_scrap_user,stock.scrap.user,stock.model_stock_scrap,sf_base.group_plan_dispatch,1,0,0,0
|
||||
access_stock_scrap_manager,stock.scrap.manager,stock.model_stock_scrap,sf_base.group_plan_dispatch,1,0,0,0
|
||||
access_stock_picking,stock.picking,stock.model_stock_picking,sf_base.group_plan_dispatch,1,0,0,0
|
||||
@@ -104,8 +104,10 @@ access_stock_lot,stock.lot,stock.model_stock_lot,sf_base.group_plan_dispatch,1,1
|
||||
access_stock_warehouse_orderpoint,stock.warehouse.orderpoint,stock.model_stock_warehouse_orderpoint,sf_base.group_plan_dispatch,1,0,0,0
|
||||
access_stock_quant,stock.quant,stock.model_stock_quant,sf_base.group_plan_dispatch,1,0,0,0
|
||||
|
||||
access_product_product,product.product,product.model_product_product,sf_base.group_plan_dispatch,1,1,1,0
|
||||
access_product_template,product.template,product.model_product_template,sf_base.group_plan_dispatch,1,1,1,0
|
||||
access_product_product,product.product,product.model_product_product,sf_base.group_plan_dispatch,1,0,0,0
|
||||
access_product_template,product.template,product.model_product_template,sf_base.group_plan_dispatch,1,0,0,0
|
||||
access_product_product,product.product,product.model_product_product,sf_base.group_plan_director,1,1,1,0
|
||||
access_product_template,product.template,product.model_product_template,sf_base.group_plan_director,1,1,1,0
|
||||
|
||||
access_stock_inventory_conflict,stock.inventory.conflict,stock.model_stock_inventory_conflict,sf_base.group_plan_dispatch,1,0,0,0
|
||||
access_stock_inventory_warning,stock.inventory.warning,stock.model_stock_inventory_warning,sf_base.group_plan_dispatch,1,0,0,0
|
||||
|
||||
|
Reference in New Issue
Block a user