Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/优化制造功能

This commit is contained in:
mgw
2024-09-10 16:13:17 +08:00
5 changed files with 65 additions and 55 deletions

View File

@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details. # Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import fields, models from odoo import fields, models, api
class MrpProduction(models.Model): class MrpProduction(models.Model):
@@ -12,7 +12,8 @@ class MrpProduction(models.Model):
check_ids = fields.One2many('quality.check', 'production_id', string="Checks") check_ids = fields.One2many('quality.check', 'production_id', string="Checks")
def _split_productions(self, amounts=False, cancel_remaining_qty=False, set_consumed_qty=False): def _split_productions(self, amounts=False, cancel_remaining_qty=False, set_consumed_qty=False):
productions = super()._split_productions(amounts=amounts, cancel_remaining_qty=cancel_remaining_qty, set_consumed_qty=set_consumed_qty) productions = super()._split_productions(amounts=amounts, cancel_remaining_qty=cancel_remaining_qty,
set_consumed_qty=set_consumed_qty)
backorders = productions[1:] backorders = productions[1:]
if not backorders: if not backorders:
return productions return productions
@@ -20,3 +21,4 @@ class MrpProduction(models.Model):
if wo.current_quality_check_id.component_id: if wo.current_quality_check_id.component_id:
wo.current_quality_check_id._update_component_quantity() wo.current_quality_check_id._update_component_quantity()
return productions return productions

View File

@@ -1,41 +1,44 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<odoo> <odoo>
<!-- Manufacturing Order for Planing view --> <!-- Manufacturing Order for Planing view -->
<record id="mrp_production_tree_view_planning" model="ir.ui.view"> <record id="mrp_production_tree_view_planning" model="ir.ui.view">
<field name="name">mrp.production.tree.inherit.planning</field> <field name="name">mrp.production.tree.inherit.planning</field>
<field name="model">mrp.production</field> <field name="model">mrp.production</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<tree default_order="date_planned_start asc" decoration-info="state=='confirmed'" decoration-danger="date_planned_start&lt;current_date and state not in ('done','cancel')" decoration-muted="state in ('done','cancel')" string="Manufacturing Orders" name="Production"> <tree default_order="date_planned_start asc" decoration-info="state=='confirmed'"
<field name="message_needaction" invisible="1"/> decoration-danger="date_planned_start&lt;current_date and state not in ('done','cancel')"
<field name="name"/> decoration-muted="state in ('done','cancel')" string="Manufacturing Orders" name="Production">
<field name="date_planned_start"/> <field name="message_needaction" invisible="1"/>
<field name="product_id"/> <field name="name"/>
<field name="product_qty" sum="Total Qty" string="Quantity"/> <field name="date_planned_start"/>
<field name="product_uom_id" string="Unit of Measure" options="{'no_open':True,'no_create':True}" groups="uom.group_uom"/> <field name="product_id"/>
<field name="reservation_state" string="Availability"/> <field name="product_qty" sum="Total Qty" string="Quantity"/>
<field name="origin"/> <field name="product_uom_id" string="Unit of Measure" options="{'no_open':True,'no_create':True}"
<field name="state"/> groups="uom.group_uom"/>
</tree> <field name="reservation_state" string="Availability"/>
</field> <field name="origin"/>
</record> <field name="state"/>
</tree>
</field>
</record>
<!-- <record id="mrp_production_form_inherit_planning" model="ir.ui.view">--> <!-- <record id="mrp_production_form_inherit_planning" model="ir.ui.view">-->
<!-- <field name="name">mrp.production.form_inherit_planning</field>--> <!-- <field name="name">mrp.production.form_inherit_planning</field>-->
<!-- <field name="model">mrp.production</field>--> <!-- <field name="model">mrp.production</field>-->
<!-- <field name="inherit_id" ref="mrp.mrp_production_form_view"/>--> <!-- <field name="inherit_id" ref="mrp.mrp_production_form_view"/>-->
<!-- <field name="arch" type="xml">--> <!-- <field name="arch" type="xml">-->
<!-- <xpath expr="div[hasclass('oe_chatter')]" position="replace">--> <!-- <xpath expr="div[hasclass('oe_chatter')]" position="replace">-->
<!-- &lt;!&ndash; 这里放置替换后的内容 &ndash;&gt;--> <!-- &lt;!&ndash; 这里放置替换后的内容 &ndash;&gt;-->
<!-- </xpath>--> <!-- </xpath>-->
<!-- <xpath expr="//notebook" position="after">--> <!-- <xpath expr="//notebook" position="after">-->
<!-- <div class="oe_chatter">--> <!-- <div class="oe_chatter">-->
<!-- <field name="message_follower_ids"/>--> <!-- <field name="message_follower_ids"/>-->
<!-- <field name="activity_ids"/>--> <!-- <field name="activity_ids"/>-->
<!-- <field name="message_ids"/>--> <!-- <field name="message_ids"/>-->
<!-- </div>--> <!-- </div>-->
<!-- </xpath>--> <!-- </xpath>-->
<!-- </field>--> <!-- </field>-->
<!-- </record>--> <!-- </record>-->
<record id="mrp_production_view_search_inherit_planning" model="ir.ui.view"> <record id="mrp_production_view_search_inherit_planning" model="ir.ui.view">
<field name="name">mrp.production.search.view.inherit.planning</field> <field name="name">mrp.production.search.view.inherit.planning</field>
@@ -43,7 +46,9 @@
<field name="inherit_id" ref="mrp.view_mrp_production_filter"/> <field name="inherit_id" ref="mrp.view_mrp_production_filter"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<filter name="filter_planned" position="attributes"> <filter name="filter_planned" position="attributes">
<attribute name="domain">[('is_planned', '=', True), ('date_planned_start', '!=', False), ('date_planned_finished', '!=', False)]</attribute> <attribute name="domain">[('is_planned', '=', True), ('date_planned_start', '!=', False),
('date_planned_finished', '!=', False)]
</attribute>
</filter> </filter>
</field> </field>
</record> </record>
@@ -51,30 +56,33 @@
<record id="production_order_unplan_server_action" model="ir.actions.server"> <record id="production_order_unplan_server_action" model="ir.actions.server">
<field name="name">Unplan orders</field> <field name="name">Unplan orders</field>
<field name="model_id" ref="mrp.model_mrp_production"/> <field name="model_id" ref="mrp.model_mrp_production"/>
<field name="binding_model_id" ref="mrp.model_mrp_production" /> <field name="binding_model_id" ref="mrp.model_mrp_production"/>
<field name="binding_view_types">list</field> <field name="binding_view_types">list</field>
<field name="state">code</field> <field name="state">code</field>
<field name="code">records.button_unplan()</field> <field name="code">records.button_unplan()</field>
</record> </record>
<record id="mrp.act_product_mrp_production_workcenter" model="ir.actions.act_window"> <record id="mrp.act_product_mrp_production_workcenter" model="ir.actions.act_window">
<field name="domain">[('bom_id', '!=', False), ('bom_id.operation_ids.workcenter_id', '=', active_id), ('date_planned_start', '!=', False), ('date_planned_finished', '!=', False)]</field> <field name="domain">[('bom_id', '!=', False), ('bom_id.operation_ids.workcenter_id', '=', active_id),
('date_planned_start', '!=', False), ('date_planned_finished', '!=', False)]
</field>
<field name="view_id" ref="mrp_production_tree_view_planning"/> <field name="view_id" ref="mrp_production_tree_view_planning"/>
</record> </record>
<menuitem id="mrp_workorder_menu_planning" <menuitem id="mrp_workorder_menu_planning"
name="Work Orders" name="Work Orders"
sequence="2" sequence="2"
parent="mrp.mrp_planning_menu_root" parent="mrp.mrp_planning_menu_root"
groups="mrp.group_mrp_routings"/> groups="mrp.group_mrp_routings"/>
<menuitem id="menu_mrp_workorder_production" <menuitem id="menu_mrp_workorder_production"
name="Planning by Production" name="Planning by Production"
sequence="1" sequence="1"
action="mrp.action_mrp_workorder_production" action="mrp.action_mrp_workorder_production"
parent="mrp_workorder_menu_planning"/> parent="mrp_workorder_menu_planning"/>
<menuitem id="menu_mrp_workorder_workcenter" <menuitem id="menu_mrp_workorder_workcenter"
name="Planning by Workcenter" name="Planning by Workcenter"
sequence="2" sequence="2"
action="mrp_workorder.action_mrp_workorder_dependencies_workcenter" action="mrp_workorder.action_mrp_workorder_dependencies_workcenter"
parent="mrp_workorder_menu_planning"/> parent="mrp_workorder_menu_planning"/>
</odoo> </odoo>

View File

@@ -223,7 +223,7 @@ class ResWorkcenter(models.Model):
if plan_ids: if plan_ids:
sum_qty = sum([p.product_qty for p in plan_ids]) sum_qty = sum([p.product_qty for p in plan_ids])
if sum_qty >= self.single_machine_capacity: if sum_qty >= self.production_line_hour_capacity:
return False return False
return True return True

View File

@@ -291,6 +291,7 @@
<field name="type">ir.actions.act_window</field> <field name="type">ir.actions.act_window</field>
<field name="res_model">mrp.production</field> <field name="res_model">mrp.production</field>
<field name="view_mode">tree,form</field> <field name="view_mode">tree,form</field>
<field name="domain">[('picking_type_id.active', '=', True)]</field>
</record> </record>
<record model="ir.actions.act_window" id="sale_custom_action"> <record model="ir.actions.act_window" id="sale_custom_action">
<!-- 自定义额外的动作 --> <!-- 自定义额外的动作 -->

View File

@@ -3,8 +3,7 @@
'name': "sf_stock", 'name': "sf_stock",
'summary': """ 'summary': """
Short (1 phrase/line) summary of the module's purpose, used as 处理代发货业务""",
subtitle on modules listing or apps.openerp.com""",
'description': """ 'description': """
Long description of module's purpose Long description of module's purpose