[FIX] mrp/mrp_procurement: commited work of team1
bzr revid: qdp@cyan-20100520093453-suu4n8d0305gb19j
This commit is contained in:
parent
ca07e840da
commit
edf4289403
|
@ -77,7 +77,11 @@
|
|||
'report/mrp_production_order_view.xml',
|
||||
],
|
||||
'demo_xml': ['mrp_demo.xml', 'mrp_order_point.xml'],
|
||||
# 'test': ['test/mrp_phantom_bom.yml','test/mrp_production_order.yml'],
|
||||
'test': [
|
||||
'test/mrp_phantom_bom.yml',
|
||||
'test/mrp_production_order.yml',
|
||||
'test/mrp_procurement.yml'
|
||||
],
|
||||
'installable': True,
|
||||
'active': False,
|
||||
'certificate': '0032052481373',
|
||||
|
|
|
@ -249,7 +249,7 @@
|
|||
<newline/>
|
||||
<field name="product_uom"/>
|
||||
<field name="product_qty"/>
|
||||
<field name="routing_id" groups="base.group_extended"/>
|
||||
<field name="routing_id" groups="base.group_extended" select="1"/>
|
||||
<newline/>
|
||||
<field name="product_uos" groups="product.group_uos"/>
|
||||
<field name="product_uos_qty" groups="product.group_uos"/>
|
||||
|
@ -471,10 +471,10 @@
|
|||
<field name="arch" type="xml">
|
||||
<form string="Manufacturing Orders">
|
||||
<group colspan="4" col="6">
|
||||
<field name="name" select="1" string="Reference"/>
|
||||
<field name="date_planned" select="1"/>
|
||||
<field name="origin" select="1"/>
|
||||
<field name="product_id" on_change="product_id_change(product_id)" select="1"/>
|
||||
<field name="name" string="Reference"/>
|
||||
<field name="date_planned"/>
|
||||
<field name="origin"/>
|
||||
<field name="product_id" on_change="product_id_change(product_id)"/>
|
||||
<field name="product_qty"/>
|
||||
<group colspan="2" col="3">
|
||||
<field name="product_uom"/>
|
||||
|
@ -493,7 +493,7 @@
|
|||
<notebook colspan="4">
|
||||
<page string="Consumed Products">
|
||||
<field name="bom_id" domain="[('product_id','=',product_id),('bom_id','=',False)]" on_change="bom_id_change(bom_id)"/>
|
||||
<field name="routing_id" groups="base.group_extended" select="1"/>
|
||||
<field name="routing_id" groups="base.group_extended"/>
|
||||
<field name="location_src_id" domain="[('usage','=','internal')]" on_change="location_id_change(location_src_id,location_dest_id)"/>
|
||||
<field name="location_dest_id" domain="[('usage','=','internal')]"/>
|
||||
<separator string="" colspan="4"/>
|
||||
|
@ -592,8 +592,8 @@
|
|||
<page string="Work Orders" groups="base.group_extended">
|
||||
<field colspan="4" name="workcenter_lines" nolabel="1">
|
||||
<form string="Production Work Centers">
|
||||
<field colspan="4" name="name" select="1"/>
|
||||
<field colspan="4" name="workcenter_id" select="1"/>
|
||||
<field colspan="4" name="name"/>
|
||||
<field colspan="4" name="workcenter_id"/>
|
||||
<field name="sequence"/>
|
||||
<field name="cycle"/>
|
||||
<field name="hour"/>
|
||||
|
@ -611,7 +611,7 @@
|
|||
<field colspan="4" name="product_lines" nolabel="1" widget="one2many_list"/>
|
||||
</page>
|
||||
<page string="Extra Information">
|
||||
<field name="company_id" select="1" groups="base.group_multi_company" widget="selection"/>
|
||||
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
|
||||
<field name="priority" groups="base.group_extended"/>
|
||||
<newline/>
|
||||
<field name="date_start"/>
|
||||
|
@ -636,8 +636,7 @@
|
|||
<filter icon="terp-mrp" string="Draft"
|
||||
domain="[('state','=','draft')]"
|
||||
help="Non confirmed manufacturing orders"/>
|
||||
<filter icon="terp-mrp" string="Current"
|
||||
default="1"
|
||||
<filter icon="terp-mrp" name="current" string="Current"
|
||||
domain="[('state','in',('confirmed','ready'))]"
|
||||
help="Manufacturing Orders which are waiting for raw materials"/>
|
||||
<filter icon="terp-mrp" string="Ready"
|
||||
|
@ -674,6 +673,7 @@
|
|||
<field name="res_model">mrp.production</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form,calendar,graph,gantt</field>
|
||||
<field name="context">{'search_default_current':1}</field>
|
||||
<field name="view_id" eval="False"/>
|
||||
<field name="search_view_id" ref="view_mrp_production_filter"/>
|
||||
</record>
|
||||
|
@ -799,6 +799,7 @@
|
|||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<act_window
|
||||
id="action_product_bom_structure"
|
||||
name="Product BoM Structure"
|
||||
|
|
|
@ -122,41 +122,9 @@
|
|||
<field name="subflow_id" search="[('osv','=','mrp.production')]"/>
|
||||
<field name="action">action_produce_assign_product()</field>
|
||||
</record>
|
||||
<record id="act_produce_check" model="workflow.activity">
|
||||
<field name="wkf_id" ref="mrp_procurement.wkf_procurement"/>
|
||||
<field name="name">produce_check</field>
|
||||
</record>
|
||||
<record id="act_produce_service" model="workflow.activity">
|
||||
<field name="wkf_id" ref="mrp_procurement.wkf_procurement"/>
|
||||
<field name="name">produce_service</field>
|
||||
<field name="kind">function</field>
|
||||
<field name="action">action_produce_assign_service()</field>
|
||||
</record>
|
||||
|
||||
<record id="trans_confirm_mto_produce_check" model="workflow.transition">
|
||||
<field name="act_from" ref="mrp_procurement.act_confirm_mto"/>
|
||||
<field name="act_to" ref="act_produce_check"/>
|
||||
<field name="condition">check_produce()</field>
|
||||
</record>
|
||||
<record id="trans_product_check_produce_service" model="workflow.transition">
|
||||
<field name="act_from" ref="act_produce_check"/>
|
||||
<field name="act_to" ref="act_produce_service"/>
|
||||
<field name="condition">not check_product()</field>
|
||||
</record>
|
||||
|
||||
<record id="trans_produce_service_cancel" model="workflow.transition">
|
||||
<field name="act_from" ref="act_produce_service"/>
|
||||
<field name="act_to" ref="mrp_procurement.act_cancel"/>
|
||||
<field name="signal">subflow.cancel</field>
|
||||
</record>
|
||||
|
||||
<record id="trans_produce_service_make_done" model="workflow.transition">
|
||||
<field name="act_from" ref="act_produce_service"/>
|
||||
<field name="act_to" ref="mrp_procurement.act_make_done"/>
|
||||
</record>
|
||||
|
||||
<record id="trans_product_check_produce" model="workflow.transition">
|
||||
<field name="act_from" ref="act_produce_check"/>
|
||||
<field name="act_from" ref="mrp_procurement.act_produce_check"/>
|
||||
<field name="act_to" ref="act_produce"/>
|
||||
<field name="condition">check_product()</field>
|
||||
</record>
|
||||
|
|
|
@ -48,8 +48,8 @@
|
|||
<field name="arch" type="xml">
|
||||
<search string="Search">
|
||||
<group col="16" colspan="6">
|
||||
<filter string="This Year" icon="terp-mrp" domain="[('name','=',time.localtime()[0])]" default="1" />
|
||||
<filter string="This Month" icon="terp-mrp" domain="[('month','=',time.strftime('%%m'))]" default="1"/>
|
||||
<filter string="This Year" name="this_year" icon="terp-mrp" domain="[('name','=',time.localtime()[0])]"/>
|
||||
<filter string="This Month" name="this_month" icon="terp-mrp" domain="[('month','=',time.strftime('%%m'))]"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="Current" icon="terp-mrp" domain="[('state','in',('open','draft'))]"/>
|
||||
<separator orientation="vertical"/>
|
||||
|
@ -101,7 +101,7 @@
|
|||
<field name="view_mode">tree,graph</field>
|
||||
<field name="view_id" ref="view_report_mrp_production_order_tree"/>
|
||||
<field name="search_view_id" ref="view_report_mrp_production_order_filter"/>
|
||||
<field name="context">{'search_default_Product': 1}</field>
|
||||
<field name="context">{'search_default_Product': 1,'search_default_this_year':1,'search_default_this_month':1}</field>
|
||||
|
||||
</record>
|
||||
|
||||
|
|
|
@ -135,19 +135,36 @@
|
|||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="4,-1" stop="4,-1"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table7">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table10">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="4,-1" stop="4,-1"/>
|
||||
</blockTableStyle>
|
||||
<initialize>
|
||||
<paraStyle name="all" alignment="justify"/>
|
||||
</initialize>
|
||||
<paraStyle name="Standard" fontName="Times-Roman"/>
|
||||
<paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Standard" fontName="Helvetica"/>
|
||||
<paraStyle name="Text body" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="List" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Table Contents" fontName="Times-Roman"/>
|
||||
<paraStyle name="Table Heading" fontName="Times-Roman" alignment="CENTER"/>
|
||||
<paraStyle name="Caption" fontName="Times-Roman" fontSize="12.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Index" fontName="Times-Roman"/>
|
||||
<paraStyle name="Footer" fontName="Times-Roman"/>
|
||||
<paraStyle name="Horizontal Line" fontName="Times-Roman" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="14.0"/>
|
||||
<paraStyle name="List" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Table Contents" fontName="Helvetica"/>
|
||||
<paraStyle name="Table Heading" fontName="Helvetica" alignment="CENTER"/>
|
||||
<paraStyle name="Caption" fontName="Helvetica" fontSize="12.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Index" fontName="Helvetica"/>
|
||||
<paraStyle name="Footer" fontName="Helvetica"/>
|
||||
<paraStyle name="Horizontal Line" fontName="Helvetica" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="14.0"/>
|
||||
<paraStyle name="terp_header" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Heading 9" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" spaceBefore="12.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="terp_tblheader_General" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||
|
@ -172,6 +189,7 @@
|
|||
</stylesheet>
|
||||
<images/>
|
||||
<story>
|
||||
<section>
|
||||
<para style="terp_default_8">[[ repeatIn(objects,'o') ]] </para>
|
||||
<para style="terp_default_8">
|
||||
<font color="white"> </font>
|
||||
|
@ -313,7 +331,10 @@
|
|||
<para style="terp_default_8">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<section>
|
||||
<para style="terp_default_Bold_9">Products to Consume</para>
|
||||
<blockTable colWidths="235.0,82.0,107.0,104.0" style="Table8">
|
||||
<para> <font color="white"> [[ o.move_lines ==[] and removeParentNode('section')]]</font></para>
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details">Product </para>
|
||||
|
@ -329,9 +350,10 @@
|
|||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
</section>
|
||||
<section>
|
||||
<para style="terp_default_8">[[ repeatIn(o.move_lines,'line') ]]</para>
|
||||
<blockTable colWidths="235.0,47.0,34.0,108.0,104.0" style="Table9">
|
||||
<para style="terp_default_8">[[ repeatIn(o.move_lines,'line') ]]</para>
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_default_9">[[ line.product_id.code ]] [[ line.product_id.name ]]</para>
|
||||
|
@ -350,9 +372,54 @@
|
|||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="terp_default_2">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</section>
|
||||
<para style="terp_default_space">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<section>
|
||||
<para style="terp_default_Bold_9">Consumed Products</para>
|
||||
|
||||
<blockTable colWidths="235.0,82.0,107.0,104.0" style="Table7">
|
||||
<para> <font color="white"> [[ o.move_lines2 ==[] and removeParentNode('section')]]</font></para>
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details">Product </para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details_Centre">Quantity</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details_Centre">Source Location</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details_Centre">Destination Location</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
</section>
|
||||
<section>
|
||||
<blockTable colWidths="235.0,47.0,34.0,108.0,104.0" style="Table10">
|
||||
<para style="terp_default_8">[[ repeatIn(o.move_lines2,'line2') ]]</para>
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_default_9">[[ line2.product_id.code ]] [[ line2.product_id.name ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Right_9">[[ formatLang( line2.product_qty) ]] </para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_9">[[line2.product_uom.name]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Centre_9">[[ line2.location_id.name ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Centre_9">[[ line2.location_dest_id.name ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
|
||||
</section>
|
||||
</section>
|
||||
</story>
|
||||
</document>
|
||||
</document>
|
|
@ -2,7 +2,7 @@
|
|||
In order to test the mrp phantom bom type in OpenERP, I will create products
|
||||
and then I will create Phantom bom structure for those products.
|
||||
-
|
||||
I create the products required to produce some orange juices: Oranges, Sugar and Water.
|
||||
I create the products required to produce some orange juices with Oranges, Sugar and Water.
|
||||
-
|
||||
!record {model: product.uom, id: product_uom_litre0}:
|
||||
category_id: product.product_uom_categ_kgm
|
||||
|
@ -129,7 +129,6 @@
|
|||
date_planned: '2010-04-16 15:53:36'
|
||||
location_dest_id: stock.stock_location_output
|
||||
location_src_id: stock.stock_location_stock
|
||||
name: MO/00002
|
||||
product_id: product_product_orangejuice0
|
||||
product_qty: 100.0
|
||||
product_uom: product_uom_litre0
|
||||
|
@ -171,7 +170,7 @@
|
|||
-
|
||||
!python {model: mrp.procurement}: |
|
||||
from tools.translate import _
|
||||
proc_ids = self.search(cr, uid, [('origin','=',':MO/00002')])
|
||||
proc_ids = self.search(cr, uid, [('state','!=','cofirmed')])
|
||||
assert proc_ids, _('No Procurements!')
|
||||
-
|
||||
The scheduler runs.
|
||||
|
@ -196,7 +195,7 @@
|
|||
!python {model: purchase.order}: |
|
||||
from tools.translate import _
|
||||
import netsvc
|
||||
purch_ids = self.search(cr, uid, [('origin','in',['SCHEDULER','OP/00002','OP/00003'])])
|
||||
purch_ids = self.search(cr, uid, [('state','=','draft')])
|
||||
assert purch_ids, _('No Purchase Orders were made!')
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
for p_id in purch_ids:
|
||||
|
@ -207,7 +206,7 @@
|
|||
!python {model: purchase.order}: |
|
||||
from tools.translate import _
|
||||
import netsvc
|
||||
purch_ids = self.search(cr, uid, [('origin','in',['SCHEDULER','OP/00002','OP/00003']),('state','=','confirmed')])
|
||||
purch_ids = self.search(cr, uid, [('state','=','confirmed')])
|
||||
assert purch_ids, _('No Confirmed Purchase Orders found!')
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
for p_id in purch_ids:
|
||||
|
@ -217,7 +216,7 @@
|
|||
-
|
||||
!python {model: stock.picking}: |
|
||||
from tools.translate import _
|
||||
pick_ids = self.search(cr, uid, [('origin','in',['PO00001:SCHEDULER','PO00002:SCHEDULER','PO00003:OP/00002','PO00004:OP/00003']),('type','=','in')])
|
||||
pick_ids = self.search(cr, uid, [('type','=','in')])
|
||||
assert pick_ids, _('No Incoming Shipments found!')
|
||||
-
|
||||
I receive both the products. My incoming pickings are done.
|
||||
|
@ -229,6 +228,7 @@
|
|||
-
|
||||
!python {model: stock.partial.picking}: |
|
||||
pick_obj = self.pool.get('stock.picking')
|
||||
picking_ids = pick_obj.search(cr, uid, [('origin','in',['PO00001:SCHEDULER','PO00002:SCHEDULER','PO00003:OP/00002','PO00004:OP/00003']),('type','=','in')])
|
||||
self.do_partial(cr, uid, [1],context={'active_ids': picking_ids})
|
||||
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})
|
||||
|
|
@ -0,0 +1,336 @@
|
|||
-
|
||||
In order to test the flow of procurement orders. I will put some orders with
|
||||
different procurement methods. I have installed sale, mrp and purchase modules.
|
||||
-
|
||||
I am creating products.
|
||||
-
|
||||
Creating a product.product record
|
||||
-
|
||||
!record {model: product.product, id: product_product_shirt0}:
|
||||
categ_id: product.cat1
|
||||
cost_method: standard
|
||||
list_price: 350.0
|
||||
mes_type: fixed
|
||||
name: Shirt
|
||||
procure_method: make_to_stock
|
||||
property_stock_inventory: stock.location_inventory
|
||||
property_stock_procurement: stock.location_procurement
|
||||
property_stock_production: stock.location_production
|
||||
seller_delay: '1'
|
||||
standard_price: 300.0
|
||||
supply_method: produce
|
||||
type: product
|
||||
uom_id: product.product_uom_unit
|
||||
uom_po_id: product.product_uom_unit
|
||||
volume: 0.0
|
||||
warranty: 0.0
|
||||
weight: 0.0
|
||||
weight_net: 0.0
|
||||
-
|
||||
Creating a product.product record
|
||||
-
|
||||
!record {model: product.product, id: product_product_cloth0}:
|
||||
categ_id: product.cat1
|
||||
cost_method: standard
|
||||
mes_type: fixed
|
||||
name: Cloth
|
||||
procure_method: make_to_order
|
||||
property_stock_inventory: stock.location_inventory
|
||||
property_stock_procurement: stock.location_procurement
|
||||
property_stock_production: stock.location_production
|
||||
seller_delay: '1'
|
||||
seller_ids:
|
||||
- delay: 1
|
||||
name: base.res_partner_maxtor
|
||||
qty: 300.0
|
||||
standard_price: 1.0
|
||||
supply_method: buy
|
||||
type: product
|
||||
uom_id: product.product_uom_unit
|
||||
uom_po_id: product.product_uom_unit
|
||||
volume: 0.0
|
||||
warranty: 0.0
|
||||
weight: 0.0
|
||||
weight_net: 0.0
|
||||
-
|
||||
Creating a product.product record
|
||||
-
|
||||
!record {model: product.product, id: product_product_buttons0}:
|
||||
categ_id: product.cat1
|
||||
cost_method: standard
|
||||
mes_type: fixed
|
||||
name: Buttons
|
||||
procure_method: make_to_stock
|
||||
property_stock_inventory: stock.location_inventory
|
||||
property_stock_procurement: stock.location_procurement
|
||||
property_stock_production: stock.location_production
|
||||
seller_delay: '1'
|
||||
seller_ids:
|
||||
- delay: 1
|
||||
name: base.res_partner_asus
|
||||
qty: 100.0
|
||||
standard_price: 1.0
|
||||
supply_method: buy
|
||||
type: product
|
||||
uom_id: product.product_uom_kgm
|
||||
uom_po_id: product.product_uom_kgm
|
||||
volume: 0.0
|
||||
warranty: 0.0
|
||||
weight: 0.0
|
||||
weight_net: 0.0
|
||||
-
|
||||
I am creating bills of material for 'Shirt'.
|
||||
-
|
||||
Creating a mrp.bom record
|
||||
-
|
||||
!record {model: mrp.bom, id: mrp_bom_shirt0}:
|
||||
bom_lines:
|
||||
- company_id: base.main_company
|
||||
name: Cloth
|
||||
product_efficiency: 1.0
|
||||
product_id: product_product_cloth0
|
||||
product_qty: 1.0
|
||||
product_uom: product.product_uom_unit
|
||||
product_uos_qty: 0.0
|
||||
sequence: 0.0
|
||||
type: normal
|
||||
- company_id: base.main_company
|
||||
name: Buttons
|
||||
product_efficiency: 1.0
|
||||
product_id: product_product_buttons0
|
||||
product_qty: 8.0
|
||||
product_uom: product.product_uom_unit
|
||||
product_uos_qty: 0.0
|
||||
sequence: 0.0
|
||||
type: normal
|
||||
company_id: base.main_company
|
||||
name: Shirt
|
||||
product_efficiency: 1.0
|
||||
product_id: product_product_shirt0
|
||||
product_qty: 1.0
|
||||
product_uom: product.product_uom_unit
|
||||
product_uos_qty: 0.0
|
||||
sequence: 0.0
|
||||
type: normal
|
||||
-
|
||||
I create minimum stock rule for product Buttons
|
||||
-
|
||||
!record {model: stock.warehouse.orderpoint, id: stock_warehouse_orderpoint_op0}:
|
||||
company_id: base.main_company
|
||||
location_id: stock.stock_location_stock
|
||||
logic: max
|
||||
name: OP/00007
|
||||
product_id: mrp.product_product_buttons0
|
||||
product_max_qty: 50.0
|
||||
product_min_qty: 10.0
|
||||
product_uom: product.product_uom_unit
|
||||
qty_multiple: 1
|
||||
warehouse_id: stock.warehouse0
|
||||
-
|
||||
I create a procurement order for product Shirt.
|
||||
-
|
||||
!record {model: mrp.procurement, id: mrp_procurement_shirt0}:
|
||||
name: 'PROC: Shirt'
|
||||
product_id: product_product_shirt0
|
||||
product_qty: 5.00
|
||||
location_id: stock.stock_location_stock
|
||||
product_uom: product.product_uom_unit
|
||||
-
|
||||
I confirm the procurement order.
|
||||
-
|
||||
!workflow {model: mrp.procurement, action: button_confirm, ref: mrp_procurement_shirt0}
|
||||
-
|
||||
I run the procurement.
|
||||
-
|
||||
!workflow {model: mrp.procurement, action: button_check, ref: mrp_procurement_shirt0}
|
||||
-
|
||||
I see that there is a manufacturing order for Shirt.
|
||||
-
|
||||
!python {model: mrp.production}: |
|
||||
from tools.translate import _
|
||||
order_ids = self.search(cr, uid, [('product_id','=',ref('product_product_shirt0'))])
|
||||
assert order_ids, 'No Manufacturing Order.'
|
||||
-
|
||||
I also check that there are two more procurement orders for sub products Cloth and Buttons.
|
||||
-
|
||||
!python {model: mrp.procurement}: |
|
||||
from tools.translate import _
|
||||
proc_ids = self.search(cr, uid, [('product_id','in',[ref('product_product_cloth0'),ref('product_product_buttons0')])])
|
||||
assert proc_ids, 'No Procurements.'
|
||||
-
|
||||
The scheduler runs.
|
||||
-
|
||||
!function {model: mrp.procurement, name: run_scheduler}:
|
||||
- model: mrp.procurement
|
||||
search: "[]"
|
||||
-
|
||||
I check that there is one purchase order for Cloth.
|
||||
-
|
||||
!python {model: purchase.order}: |
|
||||
purch_ids = self.search(cr, uid, [('partner_id.name','=','Maxtor')])
|
||||
assert purch_ids, 'No Purchase Orders.'
|
||||
-
|
||||
I confirm purchase order for Cloth.
|
||||
-
|
||||
!python {model: purchase.order}: |
|
||||
import netsvc
|
||||
purch_ids = self.search(cr, uid, [('partner_id.name','=','Maxtor')])
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
for p_id in purch_ids:
|
||||
wf_service.trg_validate(uid, 'purchase.order', p_id, 'purchase_confirm', cr)
|
||||
-
|
||||
I get the approval from the supplier. So I approve my purchase orders.
|
||||
-
|
||||
!python {model: purchase.order}: |
|
||||
from tools.translate import _
|
||||
import netsvc
|
||||
purch_ids = self.search(cr, uid, [('state','=','confirmed')])
|
||||
assert purch_ids, _('No Confirmed Purchase Orders found!')
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
for p_id in purch_ids:
|
||||
wf_service.trg_validate(uid, 'purchase.order', p_id, 'purchase_approve', cr)
|
||||
-
|
||||
I confirm purchase order for Buttons.
|
||||
-
|
||||
!python {model: purchase.order}: |
|
||||
import netsvc
|
||||
purch_ids = self.search(cr, uid, [('partner_id.name','=','ASUStek')])
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
for p_id in purch_ids:
|
||||
wf_service.trg_validate(uid, 'purchase.order', p_id, 'purchase_confirm', cr)
|
||||
-
|
||||
I get the approval from the supplier. So I approve my purchase orders.
|
||||
-
|
||||
!python {model: purchase.order}: |
|
||||
from tools.translate import _
|
||||
import netsvc
|
||||
purch_ids = self.search(cr, uid, [('state','=','confirmed')])
|
||||
assert purch_ids, _('No Confirmed Purchase Orders found!')
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
for p_id in purch_ids:
|
||||
wf_service.trg_validate(uid, 'purchase.order', p_id, 'purchase_approve', cr)
|
||||
-
|
||||
I Check incoming shipments for cloth. And receive products.
|
||||
-
|
||||
!python {model: stock.picking}: |
|
||||
from tools.translate import _
|
||||
pick_ids = self.search(cr, uid, [('address_id.name','=','Wong'),('state','=','assigned')])
|
||||
assert pick_ids, _('No Incoming Shipments found!')
|
||||
-
|
||||
!record {model: stock.partial.picking, id: stock_partial_picking0}:
|
||||
date: '2010-04-30 16:53:36'
|
||||
partner_id: base.res_partner_maxtor
|
||||
address_id: base.res_partner_address_wong
|
||||
-
|
||||
!python {model: stock.partial.picking}: |
|
||||
pick_obj = self.pool.get('stock.picking')
|
||||
picking_ids = pick_obj.search(cr, uid, [('address_id.name','=','Wong'),('state','=','assigned')])
|
||||
partial = self.browse(cr, uid, 1, context)
|
||||
partial_datas = {
|
||||
'partner_id' : partial.partner_id and partial.partner_id.id or False,
|
||||
'address_id' : partial.address_id and partial.address_id.id or False,
|
||||
'delivery_date' : partial.date
|
||||
}
|
||||
for pick in pick_obj.browse(cr, uid, picking_ids):
|
||||
for m in pick.move_lines:
|
||||
partial_datas['move%s'%(m.id)] = {
|
||||
'product_id' : m.product_id.id,
|
||||
'product_qty' : m.product_qty,
|
||||
'product_uom' : m.product_uom.id
|
||||
}
|
||||
if (pick.type == 'in') and (m.product_id.cost_method == 'average'):
|
||||
partial_datas['move%s'%(m.id)].update({
|
||||
'product_price' : m.product_price,
|
||||
'product_currency': m.product_currency
|
||||
})
|
||||
pick_obj.do_partial(cr, uid, picking_ids, partial_datas, context=context)
|
||||
-
|
||||
I Check incoming shipments for buttons. And receive products.
|
||||
-
|
||||
!python {model: stock.picking}: |
|
||||
from tools.translate import _
|
||||
pick_ids = self.search(cr, uid, [('address_id.name','=','Tang'),('state','=','assigned')])
|
||||
assert pick_ids, _('No Incoming Shipments found!')
|
||||
-
|
||||
!record {model: stock.partial.picking, id: stock_partial_picking0}:
|
||||
date: '2010-04-30 16:53:36'
|
||||
partner_id: base.res_partner_maxtor
|
||||
address_id: base.res_partner_address_wong
|
||||
-
|
||||
!python {model: stock.partial.picking}: |
|
||||
pick_obj = self.pool.get('stock.picking')
|
||||
picking_ids = pick_obj.search(cr, uid, [('address_id.name','=','Tang'),('state','=','assigned')])
|
||||
partial = self.browse(cr, uid, 1, context)
|
||||
partial_datas = {
|
||||
'partner_id': partial.partner_id and partial.partner_id.id or False,
|
||||
'address_id': partial.address_id and partial.address_id.id or False,
|
||||
'delivery_date': partial.date
|
||||
}
|
||||
for pick in pick_obj.browse(cr, uid, picking_ids):
|
||||
for m in pick.move_lines:
|
||||
partial_datas['move%s'%(m.id)] = {
|
||||
'product_id': m.product_id.id,
|
||||
'product_qty': m.product_qty,
|
||||
'product_uom': m.product_uom.id
|
||||
}
|
||||
if (pick.type == 'in') and (m.product_id.cost_method == 'average'):
|
||||
partial_datas['move%s'%(m.id)].update({
|
||||
'product_price': m.product_price,
|
||||
'product_currency': m.product_currency
|
||||
})
|
||||
pick_obj.do_partial(cr, uid, picking_ids, partial_datas, context=context)
|
||||
-
|
||||
Run scheduler again.
|
||||
-
|
||||
!function {model: mrp.procurement, name: run_scheduler}:
|
||||
- model: mrp.procurement
|
||||
search: "[]"
|
||||
-
|
||||
Check state of manufacturing order for Shirt.
|
||||
-
|
||||
!python {model: mrp.production}: |
|
||||
from tools.translate import _
|
||||
order_ids = self.search(cr, uid, [('product_id','=',ref('product_product_shirt0')),('state','=','ready')])
|
||||
assert order_ids, 'No Manufacturing Order in Ready state.'
|
||||
-
|
||||
I start production order for Shirt.
|
||||
-
|
||||
!python {model: mrp.production}: |
|
||||
from tools.translate import _
|
||||
import netsvc
|
||||
prod_ids = self.search(cr, uid, [('state','=','ready')])
|
||||
assert prod_ids, _('No Ready Manufacturing Orders found!')
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
for p_id in prod_ids:
|
||||
wf_service.trg_validate(uid, 'mrp.production', p_id, 'button_produce', cr)
|
||||
-
|
||||
!record {model: mrp.product.produce, id: mrp_product_produce0}:
|
||||
product_qty: 5.00
|
||||
mode: 'consume_produce'
|
||||
-
|
||||
!python {model: mrp.product.produce}: |
|
||||
from tools.translate import _
|
||||
prod_obj = self.pool.get('mrp.production')
|
||||
prod_ids = prod_obj.search(cr, uid, [('product_id.name','=','Shirt')])
|
||||
self.do_produce(cr, uid, [1], context={'active_ids': prod_ids})
|
||||
-
|
||||
!record {model: stock.move.consume, id: stock_move_consume0}:
|
||||
product_id: product_product_buttons0
|
||||
product_qty: 35.00
|
||||
product_uom: product.product_uom_unit
|
||||
location_id: stock.stock_location_stock
|
||||
-
|
||||
!python {model: stock.move.consume}: |
|
||||
from tools.translate import _
|
||||
stock_obj = self.pool.get('stock.move')
|
||||
stock_ids = stock_obj.search(cr, uid, [('product_id.name','=','Buttons')])
|
||||
self.do_move_consume(cr, uid, [1], context={'active_ids': stock_ids})
|
||||
-
|
||||
And finally production order is done.
|
||||
-
|
||||
!python {model: mrp.product.produce}: |
|
||||
from tools.translate import _
|
||||
prod_obj = self.pool.get('mrp.production')
|
||||
prod_ids = prod_obj.search(cr, uid, [('product_id.name','=','Shirt')])
|
||||
self.do_produce(cr, uid, [1], context={'active_ids': prod_ids})
|
||||
|
|
@ -86,27 +86,27 @@
|
|||
-
|
||||
!python {model: mrp.procurement}: |
|
||||
from tools.translate import _
|
||||
proc_ids = self.search(cr, uid, [('origin','=',':MO/00004')])
|
||||
proc_ids = self.search(cr, uid, [('state','!=','confirmed')])
|
||||
assert proc_ids, _('No Procurements!')
|
||||
-
|
||||
The scheduler runs.
|
||||
-
|
||||
!function {model: mrp.procurement, name: run_scheduler}:
|
||||
- model: mrp.procurement
|
||||
search: "[('origin','=',':MO/00004')]"
|
||||
search: "[('state','=','confirmed')]"
|
||||
-
|
||||
I am checking Internal picking.
|
||||
-
|
||||
!python {model: stock.picking}: |
|
||||
from tools.translate import _
|
||||
pick_ids = self.search(cr, uid, [('origin','=',':MO/00004'),('type','=','internal')])
|
||||
pick_ids = self.search(cr, uid, [('state','!=','done'),('type','=','internal')])
|
||||
assert pick_ids, _('No Internal Pickings!')
|
||||
-
|
||||
I see that there is a manufacturing order for the subproduct of PC1 with ready state.
|
||||
-
|
||||
!python {model: mrp.production}: |
|
||||
from tools.translate import _
|
||||
order_ids = self.search(cr, uid, [('origin','=',':MO/00004'),('state','=','ready')])
|
||||
order_ids = self.search(cr, uid, [('state','=','confirmed')])
|
||||
assert order_ids, _('No manufacturing order!')
|
||||
-
|
||||
I start producing that product first. So I marked it as started.
|
||||
|
@ -117,7 +117,7 @@
|
|||
-
|
||||
!python {model: mrp.product.produce}: |
|
||||
prod_obj = self.pool.get('mrp.production')
|
||||
prod_ids = prod_obj.search(cr, uid, [('origin','=',':MO/00004')])
|
||||
prod_ids = prod_obj.search(cr, uid, [('state','=','confirmed')])
|
||||
self.do_produce(cr, uid, [1], context={'active_ids': prod_ids})
|
||||
-
|
||||
Now the manufacturing order for subproduct CPU_GEN is done. And manufacturing
|
||||
|
@ -125,7 +125,7 @@
|
|||
-
|
||||
!python {model: mrp.production}: |
|
||||
from tools.translate import _
|
||||
prod_ids = self.search(cr, uid, [('origin','=',':MO/00004'),('state','=','done')])
|
||||
prod_ids = self.search(cr, uid, [('state','!=','done')])
|
||||
assert prod_ids, _('Manufacturing order is yet not done!')
|
||||
-
|
||||
I start producing the product PC1.
|
||||
|
|
|
@ -29,20 +29,20 @@
|
|||
<form string="Procurement">
|
||||
<group col="2" colspan="2">
|
||||
<separator colspan="2" string="References"/>
|
||||
<field name="name" select="1" string="Procurement Reason"/>
|
||||
<field name="name" string="Procurement Reason"/>
|
||||
<field name="origin"/>
|
||||
<field name="company_id" select="1" groups="base.group_multi_company" widget="selection"/>
|
||||
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
|
||||
</group>
|
||||
<group col="2" colspan="2">
|
||||
<separator colspan="2" string="Planification"/>
|
||||
<field name="date_planned" select="1"/>
|
||||
<field name="date_planned"/>
|
||||
<field name="procure_method"/>
|
||||
<field name="priority" groups="base.group_extended"/>
|
||||
</group>
|
||||
<notebook colspan="4">
|
||||
<page string="Procurement Details">
|
||||
<separator colspan="4" string="Product & Location"/>
|
||||
<field name="product_id" select="1" on_change="onchange_product_id(product_id)"/>
|
||||
<field name="product_id" on_change="onchange_product_id(product_id)"/>
|
||||
<field name="location_id" domain="[('usage','=','internal')]"/>
|
||||
<field name="product_qty"/>
|
||||
<field name="product_uom"/>
|
||||
|
@ -85,7 +85,7 @@
|
|||
<field name="arch" type="xml">
|
||||
<search string="Search Procurement">
|
||||
<group col='10' colspan='4'>
|
||||
<filter icon="terp-mrp" string="Current" domain="[('state','in',('draft','confirmed'))]" default="1" help="Procurement Orders in draft or open state."/>
|
||||
<filter icon="terp-mrp" string="Current" domain="[('state','in',('draft','confirmed'))]" name="current" help="Procurement Orders in draft or open state."/>
|
||||
<filter icon="terp-mrp" string="Exceptions" domain="[('state','=','exception')]" help="Procurement Orders with exceptions"/>
|
||||
<filter icon="terp-mrp" string="Late"
|
||||
domain="['&', ('date_planned::date','<', current_date), ('state', 'in', ('draft', 'confirmed'))]"
|
||||
|
@ -112,6 +112,7 @@
|
|||
<field name="res_model">mrp.procurement</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_id" eval="False"/>
|
||||
<field name="context">{'search_default_current':1}</field>
|
||||
<field name="search_view_id" ref="view_mrp_procurement_filter"/>
|
||||
</record>
|
||||
|
||||
|
@ -179,11 +180,11 @@
|
|||
<field name="arch" type="xml">
|
||||
<search string="Minimum Stock Rules Search">
|
||||
<group col="10" colspan="4">
|
||||
<field name="name" select="1" />
|
||||
<field name="warehouse_id" select="1" widget="selection"/>
|
||||
<field name="location_id" select="1" />
|
||||
<field name="company_id" select="1" widget="selection"/>
|
||||
<field name="product_id" select="1"/>
|
||||
<field name="name"/>
|
||||
<field name="warehouse_id" widget="selection"/>
|
||||
<field name="location_id"/>
|
||||
<field name="company_id" widget="selection"/>
|
||||
<field name="product_id"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="1" string="Group By..." colspan="4" col="10">
|
||||
|
|
|
@ -48,16 +48,16 @@
|
|||
<field name="kind">function</field>
|
||||
<field name="action">action_move_assigned()</field>
|
||||
</record>
|
||||
<!-- <record id="act_produce_check" model="workflow.activity">-->
|
||||
<!-- <field name="wkf_id" ref="wkf_procurement"/>-->
|
||||
<!-- <field name="name">produce_check</field>-->
|
||||
<!-- </record>-->
|
||||
<!-- <record id="act_produce_service" model="workflow.activity">-->
|
||||
<!-- <field name="wkf_id" ref="wkf_procurement"/>-->
|
||||
<!-- <field name="name">produce_service</field>-->
|
||||
<!-- <field name="kind">function</field>-->
|
||||
<!-- <field name="action">action_produce_assign_service()</field>-->
|
||||
<!-- </record>-->
|
||||
<record id="act_produce_check" model="workflow.activity">
|
||||
<field name="wkf_id" ref="wkf_procurement"/>
|
||||
<field name="name">produce_check</field>
|
||||
</record>
|
||||
<record id="act_produce_service" model="workflow.activity">
|
||||
<field name="wkf_id" ref="wkf_procurement"/>
|
||||
<field name="name">produce_service</field>
|
||||
<field name="kind">function</field>
|
||||
<field name="action">action_produce_assign_service()</field>
|
||||
</record>
|
||||
<record id="act_make_done" model="workflow.activity">
|
||||
<field name="wkf_id" ref="wkf_procurement"/>
|
||||
<field name="name">ready</field>
|
||||
|
@ -155,16 +155,16 @@
|
|||
<field name="act_to" ref="act_make_to_stock"/>
|
||||
<field name="condition">check_make_to_stock()</field>
|
||||
</record>
|
||||
<!-- <record id="trans_confirm_mto_produce_check" model="workflow.transition">-->
|
||||
<!-- <field name="act_from" ref="act_confirm_mto"/>-->
|
||||
<!-- <field name="act_to" ref="act_produce_check"/>-->
|
||||
<!-- <field name="condition">check_produce()</field>-->
|
||||
<!-- </record>-->
|
||||
<!-- <record id="trans_product_check_produce_service" model="workflow.transition">-->
|
||||
<!-- <field name="act_from" ref="act_produce_check"/>-->
|
||||
<!-- <field name="act_to" ref="act_produce_service"/>-->
|
||||
<!-- <field name="condition">not check_product()</field>-->
|
||||
<!-- </record>-->
|
||||
<record id="trans_confirm_mto_produce_check" model="workflow.transition">
|
||||
<field name="act_from" ref="act_confirm_mto"/>
|
||||
<field name="act_to" ref="act_produce_check"/>
|
||||
<field name="condition">check_produce()</field>
|
||||
</record>
|
||||
<record id="trans_product_check_produce_service" model="workflow.transition">
|
||||
<field name="act_from" ref="act_produce_check"/>
|
||||
<field name="act_to" ref="act_produce_service"/>
|
||||
<field name="condition">not check_product()</field>
|
||||
</record>
|
||||
<record id="trans_make_to_stock_make_done" model="workflow.transition">
|
||||
<field name="act_from" ref="act_make_to_stock"/>
|
||||
<field name="act_to" ref="act_make_done"/>
|
||||
|
@ -172,15 +172,15 @@
|
|||
<field name="trigger_model" eval="False"/>
|
||||
<field name="trigger_expr_id" eval="False"/>
|
||||
</record>
|
||||
<!-- <record id="trans_produce_service_cancel" model="workflow.transition">-->
|
||||
<!-- <field name="act_from" ref="act_produce_service"/>-->
|
||||
<!-- <field name="act_to" ref="act_cancel"/>-->
|
||||
<!-- <field name="signal">subflow.cancel</field>-->
|
||||
<!-- </record>-->
|
||||
<!-- <record id="trans_produce_service_make_done" model="workflow.transition">-->
|
||||
<!-- <field name="act_from" ref="act_produce_service"/>-->
|
||||
<!-- <field name="act_to" ref="act_make_done"/>-->
|
||||
<!-- </record>-->
|
||||
<record id="trans_produce_service_cancel" model="workflow.transition">
|
||||
<field name="act_from" ref="act_produce_service"/>
|
||||
<field name="act_to" ref="act_cancel"/>
|
||||
<field name="signal">subflow.cancel</field>
|
||||
</record>
|
||||
<record id="trans_produce_service_make_done" model="workflow.transition">
|
||||
<field name="act_from" ref="act_produce_service"/>
|
||||
<field name="act_to" ref="act_make_done"/>
|
||||
</record>
|
||||
<record id="trans_make_done_done" model="workflow.transition">
|
||||
<field name="act_from" ref="act_make_done"/>
|
||||
<field name="act_to" ref="act_done"/>
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record model="workflow.transition" id="mrp.trans_produce_service_make_done">
|
||||
<field name="act_from" ref="mrp.act_produce_service"/>
|
||||
<record model="workflow.transition" id="mrp_procurement.trans_produce_service_make_done">
|
||||
<field name="act_from" ref="mrp_procurement.act_produce_service"/>
|
||||
<field name="act_to" ref="mrp_procurement.act_make_done"/>
|
||||
<field name="signal">subflow.done</field>
|
||||
</record>
|
||||
|
|
Loading…
Reference in New Issue