summaryrefslogtreecommitdiff
path: root/addons/mrp
diff options
context:
space:
mode:
authoratp (Open ERP) <atp@tinyerp.co.in>2010-06-22 10:45:44 +0530
committeratp (Open ERP) <atp@tinyerp.co.in>2010-06-22 10:45:44 +0530
commitb0efd26edd9f4e2aa75424b787ea46d2be15cd04 (patch)
treee78cdb693e62a5c9a17f77a395eec51fb34becbf /addons/mrp
parent46bb1ea51be702758d68a5f69db32c82dbccf9bd (diff)
parent2319190c5a20cb8095f85cacca89a33164ba93d7 (diff)
[MERGE]: merge with lp:~openerp-dev/openobject-addons/trunk-dev-addons2
bzr revid: atp@tinyerp.co.in-20100622051544-c7hig73zk2at66cy
Diffstat (limited to 'addons/mrp')
-rw-r--r--addons/mrp/__openerp__.py10
-rw-r--r--addons/mrp/board_manufacturing_demo.xml16
-rw-r--r--addons/mrp/board_manufacturing_view.xml51
-rw-r--r--addons/mrp/mrp.py4
-rw-r--r--addons/mrp/mrp_demo.xml13
-rw-r--r--addons/mrp/mrp_view.xml64
-rw-r--r--addons/mrp/report/mrp_production_order_view.xml2
-rw-r--r--addons/mrp/report/workcenter_load.py6
-rw-r--r--addons/mrp/security/ir.model.access.csv4
-rw-r--r--addons/mrp/test/mrp_phantom_bom.yml6
10 files changed, 99 insertions, 77 deletions
diff --git a/addons/mrp/__openerp__.py b/addons/mrp/__openerp__.py
index 58320ebfdf7..676e38d2e78 100644
--- a/addons/mrp/__openerp__.py
+++ b/addons/mrp/__openerp__.py
@@ -53,6 +53,11 @@
* Load forecast on workcenters
* Print a production order
* Stock forecasts
+ Dashboard provided by this module::
+ * List of next production orders
+ * List of deliveries (out picking)
+ * Graph of work center load
+ * List of procurement in exception
""",
'init_xml': [],
'update_xml': [
@@ -75,8 +80,11 @@
'mrp_installer.xml',
'report/mrp_report_view.xml',
'report/mrp_production_order_view.xml',
+ 'board_manufacturing_view.xml',
+
+
],
- 'demo_xml': ['mrp_demo.xml'],
+ 'demo_xml': ['mrp_demo.xml', 'board_manufacturing_demo.xml'],
'test': [
'test/mrp_phantom_bom.yml',
'test/mrp_production_order.yml',
diff --git a/addons/mrp/board_manufacturing_demo.xml b/addons/mrp/board_manufacturing_demo.xml
new file mode 100644
index 00000000000..080467eb8b7
--- /dev/null
+++ b/addons/mrp/board_manufacturing_demo.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+ <data noupdate="1">
+ <record id="sc_manufacturing_dash" model="ir.ui.view_sc">
+ <field name="name">Production dashboard</field>
+ <field name="user_id" ref="base.user_root"/>
+ <field name="resource">ir.ui.menu</field>
+ <field name="sequence">4</field>
+ <field name="res_id" ref="menu_board_manufacturing"/>
+ </record>
+ <record id="base.user_root" model="res.users">
+ <field name="action_id" ref="open_board_manufacturing"/>
+ </record>
+
+ </data>
+</openerp>
diff --git a/addons/mrp/board_manufacturing_view.xml b/addons/mrp/board_manufacturing_view.xml
new file mode 100644
index 00000000000..25d124206fe
--- /dev/null
+++ b/addons/mrp/board_manufacturing_view.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+ <data>
+ <record id="note_sale_type" model="board.note.type">
+ <field name="name">Production</field>
+ </record>
+
+ <record id="board_mrp_manager_form" model="ir.ui.view">
+ <field name="name">board.mrp.manager.form</field>
+ <field name="model">board.board</field>
+ <field name="type">form</field>
+ <field name="arch" type="xml">
+ <form string="Manufacturing board">
+ <hpaned position="100">
+ <child1>
+ <action colspan="4" height="200" name="%(mrp.mrp_production_action2)d" string="Next production orders" width="510"/>
+ <action colspan="4" name="%(stock.action_picking_tree)d" string="Deliveries (Out picking)" domain="[('state','=','assigned'),('type','=','out')]"/>
+ <action colspan="4" name="%(procurement.procurement_action4)d" string="Procurements in Exception"/>
+ </child1>
+ <child2>
+ <action colspan="4" name="%(mrp.action_report_workcenter_load_tree)d" string="Work Center future load"/>
+
+ <action colspan="4" name="%(mrp.action_report_in_out_picking_tree)d" string="Stock value variation"/>
+ </child2>
+ </hpaned>
+ </form>
+ </field>
+ </record>
+
+ <record id="open_board_manufacturing" model="ir.actions.act_window">
+ <field name="name">Production Dashboard</field>
+ <field name="res_model">board.board</field>
+ <field name="view_type">form</field>
+ <field name="view_mode">form</field>
+ <field name="view_id" ref="board_mrp_manager_form"/>
+ </record>
+
+ <menuitem icon="terp-graph" id="base.dashboard" name="Dashboards" sequence="2" parent="base.reporting_menu"/>
+ <menuitem
+ id="next_id_87"
+ name="Production"
+ parent="base.dashboard"
+ groups="mrp.group_mrp_manager"/>
+ <menuitem
+ action="open_board_manufacturing"
+ icon="terp-graph"
+ id="menu_board_manufacturing"
+ parent="next_id_87"
+ sequence="1"/>
+ </data>
+</openerp>
diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py
index 4404db89ec9..b7eb44c1837 100644
--- a/addons/mrp/mrp.py
+++ b/addons/mrp/mrp.py
@@ -202,7 +202,7 @@ class mrp_bom(osv.osv):
'property_ids': fields.many2many('mrp.property', 'mrp_bom_property_rel', 'bom_id','property_id', 'Properties'),
'revision_ids': fields.one2many('mrp.bom.revision', 'bom_id', 'BoM Revisions'),
'revision_type': fields.selection([('numeric','numeric indices'),('alpha','alphabetical indices')], 'Index type'),
- 'child_complete_ids': fields.function(_child_compute,relation='mrp.bom', method=True, string="BoM Hierarchy", type='many2many'),
+ 'child_complete_ids': fields.function(_child_compute, relation='mrp.bom', method=True, string="BoM Hierarchy", type='many2many'),
'company_id': fields.many2one('res.company','Company',required=True),
}
_defaults = {
@@ -222,7 +222,7 @@ class mrp_bom(osv.osv):
def _check_recursion(self, cr, uid, ids):
level = 100
while len(ids):
- cr.execute('select distinct bom_id from mrp_bom where id =ANY(%s)',(ids,))
+ cr.execute('select distinct bom_id from mrp_bom where id IN %s',(tuple(ids),))
ids = filter(None, map(lambda x:x[0], cr.fetchall()))
if not level:
return False
diff --git a/addons/mrp/mrp_demo.xml b/addons/mrp/mrp_demo.xml
index 21415ad56f9..581cc04c05e 100644
--- a/addons/mrp/mrp_demo.xml
+++ b/addons/mrp/mrp_demo.xml
@@ -171,7 +171,6 @@
<field name="routing_id" ref="mrp_routing_2"/>
<field name="type">normal</field>
<field model="product.product" name="product_id" ref="product.product_product_cpu_gen"/>
- <field name="multi_level_bom">True</field>
</record>
<record id="mrp_bom_1" model="mrp.bom">
@@ -181,7 +180,6 @@
<field name="product_qty">1.0</field>
<field name="routing_id" ref="mrp_routing_0"/>
<field model="product.product" name="product_id" ref="product.product_product_pc2" />
- <field name="multi_level_bom">True</field>
</record>
<record id="mrp_bom_2" model="mrp.bom">
<field name="name">Assembly Medium PC</field>
@@ -189,7 +187,6 @@
<field name="product_uom" ref="product.product_uom_unit"/>
<field name="product_qty">1.0</field>
<field model="product.product" name="product_id" ref="product.product_product_pc3"/>
- <field name="multi_level_bom">True</field>
</record>
<record id="mrp_bom_3" model="mrp.bom">
<field name="name">Assembly Customizable PC</field>
@@ -197,7 +194,6 @@
<field name="product_uom" ref="product.product_uom_unit"/>
<field name="product_qty">1.0</field>
<field model="product.product" name="product_id" ref="product.product_product_pc4"/>
- <field name="multi_level_bom">True</field>
</record>
<record id="mrp_bom_4" model="mrp.bom">
<field name="name">HDD on demand</field>
@@ -206,7 +202,6 @@
<field name="product_qty">1.0</field>
<field name="type">phantom</field>
<field model="product.product" name="product_id" ref="product.product_product_20"/>
- <field name="multi_level_bom">True</field>
</record>
<record id="mrp_bom_5" model="mrp.bom">
<field name="name">RAM on demand</field>
@@ -215,7 +210,6 @@
<field name="product_qty">1.0</field>
<field name="type">phantom</field>
<field model="product.product" name="product_id" ref="product.product_product_21"/>
- <field name="multi_level_bom">True</field>
</record>
<record id="mrp_bom_6" model="mrp.bom">
<field name="name">HDD on demand</field>
@@ -224,7 +218,6 @@
<field name="product_qty">1.0</field>
<field name="type">phantom</field>
<field model="product.product" name="product_id" ref="product.product_product_20"/>
- <field name="multi_level_bom">True</field>
</record>
<record id="mrp_bom_7" model="mrp.bom">
<field name="name">HDD on demand</field>
@@ -233,7 +226,6 @@
<field name="product_qty">1.0</field>
<field name="type">phantom</field>
<field model="product.product" name="product_id" ref="product.product_product_20"/>
- <field name="multi_level_bom">True</field>
</record>
<record id="mrp_bom_8" model="mrp.bom">
<field name="name">HDD Seagate</field>
@@ -242,7 +234,6 @@
<field name="product_qty">1.0</field>
<field name="type">normal</field>
<field model="product.product" name="product_id" ref="product.product_product_hdd1"/>
- <field name="multi_level_bom">True</field>
</record>
<record id="mrp_bom_9" model="mrp.bom">
<field name="name">Assembly Basic PC</field>
@@ -252,7 +243,6 @@
<field name="routing_id" ref="mrp_routing_0"/>
<field name="type">normal</field>
<field model="product.product" name="product_id" ref="product.product_product_pc1"/>
- <field name="multi_level_bom">True</field>
</record>
<record id="mrp_bom_10" model="mrp.bom">
<field name="name">Complete PC with peripherals</field>
@@ -260,7 +250,6 @@
<field name="product_uom" ref="product.product_uom_unit"/>
<field name="product_qty">1.0</field>
<field model="product.product" name="product_id" ref="product.product_product_23"/>
- <field name="multi_level_bom">True</field>
</record>
<record id="mrp_bom_11" model="mrp.bom">
<field name="name">RAM on demand</field>
@@ -269,7 +258,6 @@
<field name="product_qty">1.0</field>
<field name="type">phantom</field>
<field model="product.product" name="product_id" ref="product.product_product_23"/>
- <field name="multi_level_bom">True</field>
</record>
<record id="mrp_bom_13" model="mrp.bom">
@@ -278,7 +266,6 @@
<field name="product_uom" ref="product.product_uom_unit"/>
<field name="product_qty">1.0</field>
<field model="product.product" name="product_id" ref="product.product_product_cpu3"/>
- <field name="multi_level_bom">True</field>
</record>
<record id="mrp_bom_kit" model="mrp.bom">
diff --git a/addons/mrp/mrp_view.xml b/addons/mrp/mrp_view.xml
index 8b14158637f..5eb86e77c49 100644
--- a/addons/mrp/mrp_view.xml
+++ b/addons/mrp/mrp_view.xml
@@ -3,8 +3,8 @@
<data>
<menuitem icon="terp-mrp" id="base.menu_mrp_root" name="Manufacturing"
- groups="group_mrp_user,group_mrp_manager" sequence="3"/>
- <menuitem id="menu_mrp_reordering" name="Automatic Procurements" parent="stock.menu_stock_root" sequence="4"/>
+ groups="group_mrp_user,group_mrp_manager" sequence="8"/>
+ <menuitem id="menu_mrp_reordering" name="Automatic Procurements" parent="stock.menu_stock_root" sequence="5"/>
<menuitem id="menu_mrp_manufacturing" name="Manufacturing" parent="base.menu_mrp_root" sequence="1"/>
<!-- <menuitem name="Control" id="menu_mrp_control" parent="base.menu_mrp_root" sequence="3" />-->
@@ -78,7 +78,7 @@
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
</record>
- <menuitem name="Properties"
+ <menuitem name="Master Bill of Materials"
id="menu_mrp_property"
parent="menu_mrp_configuration"
groups="base.group_extended"
@@ -230,8 +230,8 @@
</record>
<!-- <menuitem name="Routings" id="menu_mrp_routing_and_workcenters" parent="mrp.menu_mrp_bom" groups="base.group_extended"
sequence="100" />-->
- <menuitem action="mrp_workcenter_action" id="menu_mrp_workcenter_action" parent="mrp.menu_mrp_bom" groups="base.group_extended" sequence="40" />
- <menuitem action="mrp_routing_action" id="menu_mrp_routing_action" parent="mrp.menu_mrp_bom" groups="base.group_extended" sequence="30"/>
+ <menuitem action="mrp_workcenter_action" id="menu_mrp_workcenter_action" parent="mrp.menu_mrp_property" groups="base.group_extended" sequence="40" />
+ <menuitem action="mrp_routing_action" id="menu_mrp_routing_action" parent="mrp.menu_mrp_property" groups="base.group_extended" sequence="30"/>
<!--
Bill of Materials
@@ -337,7 +337,7 @@
<field name="type">ir.actions.act_window</field>
<field name="res_model">mrp.bom</field>
<field name="view_type">form</field>
- <field name="domain">[('bom_id','=',False),('multi_level_bom','=',True)]</field>
+ <field name="domain">[('bom_id','=',False)]</field>
<field name="search_view_id" ref="view_mrp_bom_filter"/>
</record>
<record id="mrp_bom_form_action2" model="ir.actions.act_window">
@@ -415,11 +415,11 @@
-->
<menuitem action="procurement.procurement_action" id="menu_mrp_procurement_action"
- parent="mrp.menu_mrp_manufacturing" sequence="2" />
+ parent="mrp.menu_mrp_manufacturing" sequence="3" />
<!-- <menuitem action="procurement.procurement_action5" id="menu_mrp_procurement_exception_action"-->
<!-- parent="mrp.menu_mrp_control" sequence="1" />-->
- <menuitem id="menu_mrp_scheduler" name="Schedulers" parent="base.menu_mrp_root" sequence="4"/>
+ <menuitem id="menu_mrp_scheduler" name="Schedulers" parent="base.menu_mrp_root" sequence="3"/>
<menuitem action="procurement.action_compute_schedulers" id="mrp_Sched_all" parent="mrp.menu_mrp_scheduler" sequence="90"/>
<!--
@@ -851,51 +851,11 @@
<menuitem id="menu_pm_resources_mrp" name="Resources" parent="base.menu_mrp_root"
groups="base.group_extended"
- sequence="2"/>
+ sequence="4"/>
+ <menuitem id="menu_pm_resources_config" name="Resources" parent="menu_mrp_configuration"/>
<menuitem action="resource.action_resource_resource_tree" id="menu_view_resource_search_mrp" parent="menu_pm_resources_mrp" sequence="1"/>
- <menuitem action="resource.action_resource_calendar_form" id="menu_view_resource_calendar_search_mrp" parent="menu_mrp_configuration" sequence="1"/>
- <menuitem action="resource.action_resource_calendar_leave_tree" id="menu_view_resource_calendar_leaves_search_mrp" parent="menu_pm_resources_mrp" sequence="1"/>
+ <menuitem action="resource.action_resource_calendar_form" id="menu_view_resource_calendar_search_mrp" parent="menu_pm_resources_config" sequence="1"/>
+ <menuitem action="resource.action_resource_calendar_leave_tree" id="menu_view_resource_calendar_leaves_search_mrp" parent="menu_pm_resources_config" sequence="1"/>
- <!-- Display the BoMs in the product form -->
-
- <record model="ir.ui.view" id="view_product_form_expiry">
- <field name="name">product.normal.form</field>
- <field name="model">product.product</field>
- <field name="inherit_id" ref="product.product_normal_form_view" />
- <field name="type">form</field>
- <field name="arch" type="xml">
- <notebook position="inside">
- <page string="Bill of Materials">
- <field name="bom_ids" colspan="4" nolabel="1" widget="one2many_form">
- <group colspan="4" col="6">
- <field name="name" select="1" colspan="4"/>
- <field name="code" select="1" string="BoM Reference" groups="base.group_extended"/>
- <newline/>
- <field name="product_uom"/>
- <field name="product_qty"/>
- <field name="routing_id" groups="base.group_extended"/>
- <newline/>
- <field name="product_uos" groups="product.group_uos"/>
- <field name="product_uos_qty" groups="product.group_uos" />
- <newline/>
- <field name="type" groups="base.group_extended"/>
- <field name="company_id" select="1" groups="base.group_multi_company" widget="selection"/>
- </group>
- <field colspan="4" name="bom_lines" nolabel="1" widget="one2many_list">
- <tree string="Components" editable="bottom">
- <field name="product_id" on_change="onchange_product_id(product_id, name)" select="1"/>
- <field name="product_uom"/>
- <field name="product_qty"/>
- <field name="name" invisible="1"/>
- <field name="date_start"/>
- <field name="date_stop"/>
- </tree>
- </field>
- </field>
- </page>
- </notebook>
- </field>
- </record>
-
</data>
</openerp>
diff --git a/addons/mrp/report/mrp_production_order_view.xml b/addons/mrp/report/mrp_production_order_view.xml
index 61aff34bf91..9c4d4924924 100644
--- a/addons/mrp/report/mrp_production_order_view.xml
+++ b/addons/mrp/report/mrp_production_order_view.xml
@@ -81,7 +81,7 @@
<separator orientation="vertical"/>
<filter string="Company" icon="terp-go-home" context="{'group_by':'company_id'}"/>
<separator orientation="vertical"/>
- <filter string="Day" icon="terp-go-month" context="{'group_by':'day'}"/>
+ <filter string="Day" icon="terp-go-today" context="{'group_by':'day'}"/>
<filter string="Month" name="terp-go-month" icon="terp-go-month" context="{'group_by':'month'}"/>
<filter string="Year" icon="terp-go-year" context="{'group_by':'year'}"/>
</group>
diff --git a/addons/mrp/report/workcenter_load.py b/addons/mrp/report/workcenter_load.py
index 248e9e5707e..8e5b9bff7ba 100644
--- a/addons/mrp/report/workcenter_load.py
+++ b/addons/mrp/report/workcenter_load.py
@@ -104,7 +104,7 @@ class report_custom(report_int):
"WHERE mrp_production_workcenter_line.production_id=mrp_production.id "\
"AND mrp_production_workcenter_line.workcenter_id=mrp_workcenter.id "\
"AND mrp_production.state NOT IN ('cancel','done') "\
- "AND mrp_workcenter.id =ANY(%s)",(ids,))
+ "AND mrp_workcenter.id IN %s",(tuple(ids),))
res = cr.dictfetchone()
if not res['stop']:
res['stop'] = time.strftime('%Y-%m-%d %H:%M:%S')
@@ -135,8 +135,8 @@ class report_custom(report_int):
# select workcenters
cr.execute(
"SELECT mw.id, rs.name FROM mrp_workcenter mw, resource_resource rs " \
- "WHERE mw.id=ANY(%s) and mw.resource_id=rs.id " \
- "ORDER BY mw.id" ,(ids,))
+ "WHERE mw.id IN %s and mw.resource_id=rs.id " \
+ "ORDER BY mw.id" ,(tuple(ids),))
workcenters = cr.dictfetchall()
data = []
diff --git a/addons/mrp/security/ir.model.access.csv b/addons/mrp/security/ir.model.access.csv
index 8089be4a431..736203b307d 100644
--- a/addons/mrp/security/ir.model.access.csv
+++ b/addons/mrp/security/ir.model.access.csv
@@ -2,8 +2,8 @@
"access_mrp_workcenter","mrp.workcenter","model_mrp_workcenter","mrp.group_mrp_user",1,0,0,0
"access_mrp_routing","mrp.routing","model_mrp_routing","mrp.group_mrp_user",1,0,0,0
"access_mrp_routing_workcenter","mrp.routing.workcenter","model_mrp_routing_workcenter","mrp.group_mrp_user",1,0,0,0
-"access_mrp_bom","mrp.bom","model_mrp_bom","mrp.group_mrp_user",1,0,0,0
-"access_mrp_bom_revision","mrp.bom.revision","model_mrp_bom_revision","mrp.group_mrp_user",1,0,0,0
+"access_mrp_bom","mrp.bom","model_mrp_bom","group_mrp_user",1,0,0,0
+"access_mrp_bom_revision","mrp.bom.revision","model_mrp_bom_revision","group_mrp_user",1,0,0,0
"access_mrp_production","mrp.production","model_mrp_production","mrp.group_mrp_user",1,1,1,1
"access_mrp_production_workcenter_line","mrp.production.workcenter.line","model_mrp_production_workcenter_line","mrp.group_mrp_user",1,1,1,1
"access_mrp_production_product_line","mrp.production.product.line","model_mrp_production_product_line","mrp.group_mrp_user",1,1,1,1
diff --git a/addons/mrp/test/mrp_phantom_bom.yml b/addons/mrp/test/mrp_phantom_bom.yml
index 4a3e2e3e1da..885607d9539 100644
--- a/addons/mrp/test/mrp_phantom_bom.yml
+++ b/addons/mrp/test/mrp_phantom_bom.yml
@@ -182,14 +182,14 @@
-
!python {model: procurement.order}: |
from tools.translate import _
- proc_ids = self.search(cr, uid, [('state','!=','cofirmed')])
+ proc_ids = self.search(cr, uid, [('state','!=','confirmed')])
assert proc_ids, _('No Procurements!')
-
The scheduler runs.
-
!function {model: procurement.order, name: run_scheduler}:
- model: procurement.order
- search: "[('state','!=','cofirmed')]"
+ search: "[('state','!=','confirmed')]"
-
I am checking Internal picking. I see one picking for Orange juice and its
stock moves for Oranges, Sugar and Water made correctly.
@@ -247,4 +247,4 @@
picking_ids = pick_obj.search(cr, uid, [('type','=','in')])
self.view_init(cr, uid, ['date','partner_id','address_id'],context={'active_ids': picking_ids})
self.do_partial(cr, uid, [1], context={'active_ids': picking_ids})
- \ No newline at end of file
+