<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.mrp_procurement_action4)d" string="Procurements in Exception"/>
+ <action colspan="4" name="%(procurement.procurement_action4)d" string="Procurements in Exception"/>
</child1>
<form string="Warehouse board">
<hpaned position="100">
<child1>
- <action colspan="4" name="%(procurement.mrp_procurement_action5)d" string="Procurement Exceptions" width="510" />
+ <action colspan="4" name="%(procurement.procurement_action5)d" string="Procurement Exceptions" width="510" />
<action colspan="4" name="%(action_reception_picking_move_board)d" string="Products To Receive" />
</child1>
seq_obj = self.pool.get('ir.sequence')
pick_obj = self.pool.get('stock.picking')
move_obj = self.pool.get('stock.move')
- proc_obj = self.pool.get('mrp.procurement')
+ proc_obj = self.pool.get('procurement.order')
wf_service = netsvc.LocalService("workflow")
for production in self.browse(cr, uid, ids):
if not production.product_lines:
'move_id': move_id,
'company_id': production.company_id.id,
})
- wf_service.trg_validate(uid, 'mrp.procurement', proc_id, 'button_confirm', cr)
+ wf_service.trg_validate(uid, 'procurement.order', proc_id, 'button_confirm', cr)
proc_ids.append(proc_id)
wf_service.trg_validate(uid, 'stock.picking', picking_id, 'button_confirm', cr)
self.write(cr, uid, [production.id], {'picking_id': picking_id, 'move_lines': [(6,0,moves)], 'state':'confirmed'})
Procurement
-->
- <menuitem action="procurement.mrp_procurement_action" id="menu_mrp_procurement_action"
+ <menuitem action="procurement.procurement_action" id="menu_mrp_procurement_action"
parent="mrp.menu_mrp_manufacturing" sequence="2" />
-<!-- <menuitem action="procurement.mrp_procurement_action5" id="menu_mrp_procurement_exception_action"-->
+<!-- <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"/>
-->
<record id="view_procurement_form_inherit" model="ir.ui.view">
- <field name="name">mrp.procurement.form.inherit</field>
- <field name="model">mrp.procurement</field>
- <field name="inherit_id" ref="procurement.mrp_procurement_form_view"/>
+ <field name="name">procurement.order.form.inherit</field>
+ <field name="model">procurement.order</field>
+ <field name="inherit_id" ref="procurement.procurement_form_view"/>
<field name="type">form</field>
<field name="arch" type="xml">
<xpath expr="/form/notebook/page/field[@name='move_id']" position="before">
<record id="process_node_procureproducts0" model="process.node">
<field name="menu_id" ref="mrp.menu_mrp_procurement_action"/>
- <field name="model_id" ref="procurement.model_mrp_procurement"/>
+ <field name="model_id" ref="procurement.model_procurement_order"/>
<field eval=""""state"""" name="kind"/>
<field eval=""""The way to procurement depends on the product type."""" name="note"/>
<field eval=""""Procure Products"""" name="name"/>
<record id="process_node_procureproducts0" model="process.node">
<field name="menu_id" ref="mrp.menu_mrp_procurement_action"/>
- <field name="model_id" ref="mrp.model_mrp_procurement"/>
+ <field name="model_id" ref="mrp.model_procurement_order"/>
<field eval=""""state"""" name="kind"/>
<field eval=""""The way to procurement depends on the product type."""" name="note"/>
<field eval=""""Procure Products"""" name="name"/>
<record id="process_node_stockproduct0" model="process.node">
<field name="menu_id" ref="mrp.menu_mrp_procurement_action"/>
- <field name="model_id" ref="mrp.model_mrp_procurement"/>
+ <field name="model_id" ref="mrp.model_procurement_order"/>
<field eval=""""subflow"""" name="kind"/>
<field eval=""""Product type is Stockable or Consumable."""" name="note"/>
<field eval=""""Stockable Product"""" name="name"/>
<record id="process_node_stockproduct1" model="process.node">
<field name="menu_id" ref="mrp.menu_mrp_procurement_action"/>
- <field name="model_id" ref="mrp.model_mrp_procurement"/>
+ <field name="model_id" ref="mrp.model_procurement_order"/>
<field eval=""""subflow"""" name="kind"/>
<field eval=""""For stockable products and consumables"""" name="note"/>
<field eval=""""Stockable Product"""" name="name"/>
<record id="process_node_serviceproduct0" model="process.node">
<field name="menu_id" ref="mrp.menu_mrp_procurement_action"/>
- <field name="model_id" ref="mrp.model_mrp_procurement"/>
+ <field name="model_id" ref="mrp.model_procurement_order"/>
<field eval=""""subflow"""" name="kind"/>
<field eval=""""Product type is service"""" name="note"/>
<field eval=""""Service"""" name="name"/>
<record id="process_node_serviceproduct1" model="process.node">
<field name="menu_id" ref="mrp.menu_mrp_procurement_action"/>
- <field name="model_id" ref="mrp.model_mrp_procurement"/>
+ <field name="model_id" ref="mrp.model_procurement_order"/>
<field eval=""""subflow"""" name="kind"/>
<field eval=""""For Services."""" name="note"/>
<field eval=""""Service"""" name="name"/>
<record id="process_node_purchaseprocure0" model="process.node">
<field name="menu_id" ref="mrp.menu_mrp_procurement_action"/>
- <field name="model_id" ref="mrp.model_mrp_procurement"/>
+ <field name="model_id" ref="mrp.model_procurement_order"/>
<field eval=""""subflow"""" name="kind"/>
<field eval=""""Procurement Orders"""" name="name"/>
<field eval=""""For purchased material"""" name="note"/>
<record id="process_process_serviceproductprocess0" model="process.process">
<field eval=""""Service"""" name="name"/>
- <field name="model_id" ref="mrp.model_mrp_procurement"/>
+ <field name="model_id" ref="mrp.model_procurement_order"/>
<field eval="1" name="active"/>
</record>
<record id="process_node_serviceonorder0" model="process.node">
<field name="menu_id" ref="mrp.menu_mrp_procurement_action"/>
- <field name="model_id" ref="mrp.model_mrp_procurement"/>
+ <field name="model_id" ref="mrp.model_procurement_order"/>
<field eval=""""state"""" name="kind"/>
<field eval=""""Assignment from Production or Purchase Order."""" name="note"/>
<field eval=""""Make to Order"""" name="name"/>
<record id="process_node_servicemts0" model="process.node">
<field name="menu_id" ref="mrp.menu_mrp_procurement_action"/>
- <field name="model_id" ref="mrp.model_mrp_procurement"/>
+ <field name="model_id" ref="mrp.model_procurement_order"/>
<field eval=""""state"""" name="kind"/>
<field eval=""""Assignment from stock."""" name="note"/>
<field eval=""""Make to stock"""" name="name"/>
<record id="process_process_stockableproductprocess0" model="process.process">
<field eval=""""Stockable Product"""" name="name"/>
- <field name="model_id" ref="mrp.model_mrp_procurement"/>
+ <field name="model_id" ref="mrp.model_procurement_order"/>
<field eval="1" name="active"/>
</record>
<record id="process_node_mts0" model="process.node">
<field name="menu_id" ref="mrp.menu_mrp_procurement_action"/>
- <field name="model_id" ref="mrp.model_mrp_procurement"/>
+ <field name="model_id" ref="mrp.model_procurement_order"/>
<field eval=""""state"""" name="kind"/>
<field eval=""""Assignment from stock."""" name="note"/>
<field eval=""""Make to Stock"""" name="name"/>
<record id="process_node_stock0" model="process.node">
<field name="menu_id" ref="mrp.menu_mrp_procurement_action"/>
- <field name="model_id" ref="mrp.model_mrp_procurement"/>
+ <field name="model_id" ref="mrp.model_procurement_order"/>
<field eval=""""state"""" name="kind"/>
<field eval=""""Assignment from Production or Purchase Order."""" name="note"/>
<field eval=""""Make to Order"""" name="name"/>
import netsvc
import time
-class mrp_procurement(osv.osv):
- _inherit = 'mrp.procurement'
+class procurement_order(osv.osv):
+ _inherit = 'procurement.order'
_columns = {
'bom_id': fields.many2one('mrp.bom', 'BoM', ondelete='cascade', select=True),
}
properties = [x.id for x in procurement.property_ids]
bom_id = self.pool.get('mrp.bom')._bom_find(cr, uid, procurement.product_id.id, procurement.product_uom.id, properties)
if not bom_id:
- cr.execute('update mrp_procurement set message=%s where id=%s', (_('No BoM defined for this product !'), procurement.id))
+ cr.execute('update procurement_order set message=%s where id=%s', (_('No BoM defined for this product !'), procurement.id))
return False
return True
""" This is action which call from workflow to assign production order to procurements
@return: True
"""
- procurement_obj = self.pool.get('mrp.procurement')
+ procurement_obj = self.pool.get('procurement.order')
res = procurement_obj.make_mo(cr, uid, ids, context=context)
res = res.values()
return len(res) and res[0] or 0 #TO CHECK: why workflow is generated error if return not integer value
production_obj = self.pool.get('mrp.production')
move_obj = self.pool.get('stock.move')
wf_service = netsvc.LocalService("workflow")
- procurement_obj = self.pool.get('mrp.procurement')
+ procurement_obj = self.pool.get('procurement.order')
for procurement in procurement_obj.browse(cr, uid, ids):
res_id = procurement.move_id.id
loc_id = procurement.location_id.id
{'location_id': procurement.location_id.id})
return res
-mrp_procurement()
+procurement_order()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
"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
-"access_mrp_procurement","mrp.procurement","model_mrp_procurement","mrp.group_mrp_user",1,1,1,1
+"access_procurement","procurement.order","model_procurement_order","mrp.group_mrp_user",1,1,1,1
"access_mrp_workcenter_manager","mrp.workcenter.manager","model_mrp_workcenter","mrp.group_mrp_user",1,1,1,1
"access_mrp_routing_manager","mrp.routing.manager","model_mrp_routing","mrp.group_mrp_manager",1,1,1,1
"access_mrp_routing_workcenter_manager","mrp.routing.workcenter.manager","model_mrp_routing_workcenter","mrp.group_mrp_manager",1,1,1,1
"access_purchase_order_mrp_worker","purchase.order mrp_worker","purchase.model_purchase_order","mrp.group_mrp_user",1,0,0,0
"access_purchase_order_line_mrp_worker","purchase.order.line mrp_worker","purchase.model_purchase_order_line","mrp.group_mrp_user",1,0,0,0
"access_hr_timesheet_group_mrp_worker","resource.calendar mrp_worker","resource.model_resource_calendar","mrp.group_mrp_user",1,0,0,0
-"access_mrp_procurement_stock_worker","mrp.procurement stock_worker","model_mrp_procurement","stock.group_stock_user",1,1,1,1
+"access_procurement_stock_worker","procurement.order stock_worker","model_procurement_order","stock.group_stock_user",1,1,1,1
"access_mrp_production_stock_worker","mrp.production stock_worker","model_mrp_production","stock.group_stock_user",1,0,0,0
"access_mrp_installer","mrp.installer","model_mrp_installer","mrp.group_mrp_user",1,0,0,0
"access_mrp_product_produce","mrp.product.produce","model_mrp_product_produce","mrp.group_mrp_user",1,0,0,0
"a procurement to bring the virtual stock to the Max Quantity."),
'qty_multiple': fields.integer('Qty Multiple', required=True,
help="The procurement quantity will by rounded up to this multiple."),
- 'procurement_id': fields.many2one('mrp.procurement', 'Latest procurement', ondelete="set null"),
+ 'procurement_id': fields.many2one('procurement.order', 'Latest procurement', ondelete="set null"),
'company_id': fields.many2one('res.company','Company',required=True),
}
_defaults = {
_columns = {
'production_id': fields.many2one('mrp.production', 'Production', select=True),
- 'procurements': fields.one2many('mrp.procurement', 'move_id', 'Procurements'),
+ 'procurements': fields.one2many('procurement.order', 'move_id', 'Procurements'),
}
def copy(self, cr, uid, id, default=None, context=None):
"""
bom_obj = self.pool.get('mrp.bom')
move_obj = self.pool.get('stock.move')
- procurement_obj = self.pool.get('mrp.procurement')
+ procurement_obj = self.pool.get('procurement.order')
product_obj = self.pool.get('product.product')
wf_service = netsvc.LocalService("workflow")
if move.product_id.supply_method == 'produce' and move.product_id.procure_method == 'make_to_order':
'move_id': mid,
'company_id': line['company_id'],
})
- wf_service.trg_validate(uid, 'mrp.procurement', proc_id, 'button_confirm', cr)
+ wf_service.trg_validate(uid, 'procurement.order', proc_id, 'button_confirm', cr)
move_obj.write(cr, uid, [move.id], {
'location_id': move.location_dest_id.id,
'auto_validate': True,
'state': 'waiting'
})
for m in procurement_obj.search(cr, uid, [('move_id','=',move.id)], context):
- wf_service.trg_validate(uid, 'mrp.procurement', m, 'button_wait_done', cr)
+ wf_service.trg_validate(uid, 'procurement.order', m, 'button_wait_done', cr)
return True
def action_consume(self, cr, uid, ids, product_qty, location_id=False, context=None):
for move in picking.move_lines:
if move.state == 'done' and move.procurements:
for procurement in move.procurements:
- wf_service.trg_validate(user, 'mrp.procurement',
+ wf_service.trg_validate(user, 'procurement.order',
procurement.id, 'button_check', cursor)
return res
-
I am checking Procurement orders. There are 3 orders generated for Oranges, Sugar and Water.
-
- !python {model: mrp.procurement}: |
+ !python {model: procurement.order}: |
from tools.translate import _
proc_ids = self.search(cr, uid, [('state','!=','cofirmed')])
assert proc_ids, _('No Procurements!')
-
The scheduler runs.
-
- !function {model: mrp.procurement, name: run_scheduler}:
- - model: mrp.procurement
+ !function {model: procurement.order, name: run_scheduler}:
+ - model: procurement.order
search: "[('state','!=','cofirmed')]"
-
I am checking Internal picking. I see one picking for Orange juice and its
-
I create a procurement order for product Shirt.
-
- !record {model: mrp.procurement, id: mrp_procurement_shirt0}:
+ !record {model: procurement.order, id: procurement_order_shirt0}:
name: 'PROC: Shirt'
product_id: product_product_shirt0
product_qty: 5.00
-
I confirm the procurement order.
-
- !workflow {model: mrp.procurement, action: button_confirm, ref: mrp_procurement_shirt0}
+ !workflow {model: procurement.order, action: button_confirm, ref: procurement_order_shirt0}
-
I run the procurement.
-
- !workflow {model: mrp.procurement, action: button_check, ref: mrp_procurement_shirt0}
+ !workflow {model: procurement.order, action: button_check, ref: procurement_order_shirt0}
-
I see that there is a manufacturing order for Shirt.
-
-
I also check that there are two more procurement orders for sub products Cloth and Buttons.
-
- !python {model: mrp.procurement}: |
+ !python {model: procurement.order}: |
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
+ !function {model: procurement.order, name: run_scheduler}:
+ - model: procurement.order
search: "[]"
-
I check that there is one purchase order for Cloth.
-
Run scheduler again.
-
- !function {model: mrp.procurement, name: run_scheduler}:
- - model: mrp.procurement
+ !function {model: procurement.order, name: run_scheduler}:
+ - model: procurement.order
search: "[]"
-
Check state of manufacturing order for Shirt.
-
I am checking Procurement orders.
-
- !python {model: mrp.procurement}: |
+ !python {model: procurement.order}: |
from tools.translate import _
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
+ !function {model: procurement.order, name: run_scheduler}:
+ - model: procurement.order
search: "[('state','=','confirmed')]"
-
I am checking Internal picking.
-
I am checking Procurement orders.
-
- !python {model: mrp.procurement}: |
+ !python {model: procurement.order}: |
from tools.translate import _
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
+ !function {model: procurement.order, name: run_scheduler}:
+ - model: procurement.order
search: "[('state','=','confirmed')]"
-
I am checking Internal picking.
</record>
<record id="ir_modelsmrp_pdt0" model="ir.model.access">
- <field name="model_id" ref="procurement.model_mrp_procurement"/>
+ <field name="model_id" ref="procurement.model_procurement_order"/>
<field eval="1" name="perm_read"/>
<field eval=""""MRP - Procurement"""" name="name"/>
<field eval="0" name="perm_unlink"/>
<field name="group_id" ref="res_groups_posuser0"/>
</record>
<record id="ir_model_access_procurement0" model="ir.model.access">
- <field name="model_id" ref="procurement.model_mrp_procurement" />
+ <field name="model_id" ref="procurement.model_procurement_order" />
<field eval="1" name="perm_read" />
<field eval="1" name="perm_write" />
<field eval="1" name="perm_create" />
<field eval="0" name="perm_unlink" />
- <field name="name" eval=""""mrp.procurement"""" />
+ <field name="name" eval=""""procurement.order"""" />
<field name="group_id" ref="res_groups_posuser0"/>
</record>
<record id="ir_model_access_tax0" model="ir.model.access">
</record>
<record id="ir_modelsmrp_pdt0" model="ir.model.access">
- <field name="model_id" ref="procurement.model_mrp_procurement"/>
+ <field name="model_id" ref="procurement.model_procurement_order"/>
<field eval="1" name="perm_read"/>
<field eval=""""MRP - Procurement"""" name="name"/>
<field eval="0" name="perm_unlink"/>
<field name="group_id" ref="res_groups_posuser0"/>
</record>
<record id="ir_model_access_procurement0" model="ir.model.access">
- <field name="model_id" ref="mrp_procurement.model_mrp_procurement" />
+ <field name="model_id" ref="procurement.model_procurement_order" />
<field eval="1" name="perm_read" />
<field eval="1" name="perm_write" />
<field eval="1" name="perm_create" />
<field eval="0" name="perm_unlink" />
- <field name="name" eval=""""mrp.procurement"""" />
+ <field name="name" eval=""""procurement.order"""" />
<field name="group_id" ref="res_groups_posuser0"/>
</record>
<record id="ir_model_access_tax0" model="ir.model.access">
<record id="process_process_procurementprocess0" model="process.process">
<field eval=""""Procurement"""" name="name"/>
- <field name="model_id" ref="procurement.model_mrp_procurement"/>
+ <field name="model_id" ref="procurement.model_procurement_order"/>
<field eval="1" name="active"/>
</record>
# Produce, Buy or Find products and place a move
# then wizard for picking lists & move
#
-class mrp_procurement(osv.osv):
+class procurement_order(osv.osv):
"""
Procurement Orders
"""
- _name = "mrp.procurement"
+ _name = "procurement.order"
_description = "Procurement"
_order = 'priority,date_planned desc'
_log_create = False
'note': fields.text('Note'),
- 'property_ids': fields.many2many('mrp.property', 'mrp_procurement_property_rel', 'procurement_id','property_id', 'Properties'),
+ 'property_ids': fields.many2many('mrp.property', 'procurement_property_rel', 'procurement_id','property_id', 'Properties'),
'message': fields.char('Latest error', size=64, help="Exception occurred while computing procurement orders."),
'state': fields.selection([
'date_planned': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
'close_move': lambda *a: 0,
'procure_method': lambda *a: 'make_to_order',
- 'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'mrp.procurement', context=c)
+ 'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'procurement.order', context=c)
}
def unlink(self, cr, uid, ids, context=None):
return res
#
- # This method may be overrided by objects that override mrp.procurment
+ # This method may be overrided by objects that override procurement.order
# for computing their own purpose
#
def _quantity_compute_get(self, cr, uid, proc, context={}):
if procurement.product_id.product_tmpl_id.supply_method <> 'buy':
return False
if not procurement.product_id.seller_ids:
- cr.execute('update mrp_procurement set message=%s where id=%s', (_('No supplier defined for this product !'), procurement.id))
+ cr.execute('update procurement_order set message=%s where id=%s', (_('No supplier defined for this product !'), procurement.id))
return False
partner = procurement.product_id.seller_ids[0].name
if user.company_id and user.company_id.partner_id:
return False
address_id = partner_obj.address_get(cr, uid, [partner.id], ['delivery'])['delivery']
if not address_id:
- cr.execute('update mrp_procurement set message=%s where id=%s', (_('No address defined for the supplier'), procurement.id))
+ cr.execute('update procurement_order set message=%s where id=%s', (_('No address defined for the supplier'), procurement.id))
return False
return True
ok = ok and self.pool.get('stock.move').action_assign(cr, uid, [id])
cr.execute('select count(id) from stock_warehouse_orderpoint where product_id=%s', (procurement.product_id.id,))
if not cr.fetchone()[0]:
- cr.execute('update mrp_procurement set message=%s where id=%s', (_('Stock is not enough and No minimum orderpoint rule defined'), procurement.id))
+ cr.execute('update procurement_order set message=%s where id=%s', (_('Stock is not enough and No minimum orderpoint rule defined'), procurement.id))
return ok
def action_produce_assign_service(self, cr, uid, ids, context={}):
self.write(cr, uid, ids, {'state': 'cancel'})
wf_service = netsvc.LocalService("workflow")
for id in ids:
- wf_service.trg_trigger(uid, 'mrp.procurement', id, cr)
+ wf_service.trg_trigger(uid, 'procurement.order', id, cr)
return True
def action_check_finnished(self, cr, uid, ids):
res = self.write(cr, uid, ids, {'state': 'done', 'date_close': time.strftime('%Y-%m-%d')})
wf_service = netsvc.LocalService("workflow")
for id in ids:
- wf_service.trg_trigger(uid, 'mrp.procurement', id, cr)
+ wf_service.trg_trigger(uid, 'procurement.order', id, cr)
return res
def run_scheduler(self, cr, uid, automatic=False, use_new_cursor=False, context=None):
self._procure_orderpoint_confirm(cr, uid, automatic=automatic,\
use_new_cursor=use_new_cursor, context=context)
-mrp_procurement()
+procurement_order()
class stock_warehouse_orderpoint(osv.osv):
Defines Minimum stock rules.
"""
_name = "stock.warehouse.orderpoint"
- _description = "Orderpoint minimum rule"
-
+ _description = "Minimum Inventory Rule"
+
_columns = {
'name': fields.char('Name', size=32, required=True),
'active': fields.boolean('Active', help="If the active field is set to true, it will allow you to hide the orderpoint without removing it."),
'logic': fields.selection([('max','Order to Max'),('price','Best price (not yet active!)')], 'Reordering Mode', required=True),
- 'warehouse_id': fields.many2one('stock.warehouse', 'Warehouse', required=True),
- 'location_id': fields.many2one('stock.location', 'Location', required=True),
+ 'warehouse_id': fields.many2one('stock.warehouse', 'Warehouse', required=True, ondelete="cascade"),
+ 'location_id': fields.many2one('stock.location', 'Location', required=True, ondelete="cascade"),
'product_id': fields.many2one('product.product', 'Product', required=True, ondelete='cascade', domain=[('type','=','product')]),
- 'product_uom': fields.many2one('product.uom', 'Product UOM', required=True ),
+ 'product_uom': fields.many2one('product.uom', 'Product UOM', required=True),
'product_min_qty': fields.float('Min Quantity', required=True,
help="When the virtual stock goes belong the Min Quantity, Open ERP generates "\
"a procurement to bring the virtual stock to the Max Quantity."),
"a procurement to bring the virtual stock to the Max Quantity."),
'qty_multiple': fields.integer('Qty Multiple', required=True,
help="The procurement quantity will by rounded up to this multiple."),
- 'procurement_id': fields.many2one('mrp.procurement', 'Latest procurement'),
+ 'procurement_id': fields.many2one('procurement.order', 'Latest procurement', ondelete="set null"),
'company_id': fields.many2one('res.company','Company',required=True),
}
_defaults = {
'product_uom': lambda sel, cr, uid, context: context.get('product_uom', False),
'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'stock.warehouse.orderpoint', context=c)
}
-
+ _sql_constraints = [
+ ('qty_multiple_check', 'CHECK( qty_multiple > 0 )', _('Qty Multiple must be greater than zero.')),
+ ]
+
def onchange_warehouse_id(self, cr, uid, ids, warehouse_id, context={}):
""" Finds location id for changed warehouse.
@param warehouse_id: Changed id of warehouse.
v = {'location_id': w.lot_stock_id.id}
return {'value': v}
return {}
-
+
def onchange_product_id(self, cr, uid, ids, product_id, context={}):
""" Finds UoM for changed product.
@param product_id: Changed id of product.
v = {'product_uom': prod.uom_id.id}
return {'value': v}
return {}
-
+
def copy(self, cr, uid, id, default=None,context={}):
if not default:
default = {}
'name': self.pool.get('ir.sequence').get(cr, uid, 'mrp.warehouse.orderpoint') or '',
})
return super(stock_warehouse_orderpoint, self).copy(cr, uid, id, default, context)
-
+
stock_warehouse_orderpoint()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
<field eval="False" name="doall"/>
- <field eval="'mrp.procurement'" name="model"/>
+ <field eval="'procurement.order'" name="model"/>
<field eval="'run_scheduler'" name="function"/>
<field eval="'(False,)'" name="args"/>
</record>
Procurement
-->
- <record id="mrp_procurement_tree_view" model="ir.ui.view">
- <field name="name">mrp.procurement.tree</field>
- <field name="model">mrp.procurement</field>
+ <record id="procurement_tree_view" model="ir.ui.view">
+ <field name="name">procurement.order.tree</field>
+ <field name="model">procurement.order</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Procurement Lines" colors="red:date_planned<current_date and state in ('exception');black:state=='running';green:state=='confirmed';gray:state in ['done','cancel'];blue:state in ('ready')">
</tree>
</field>
</record>
- <record id="mrp_procurement_form_view" model="ir.ui.view">
- <field name="name">mrp.procurement.form</field>
- <field name="model">mrp.procurement</field>
+ <record id="procurement_form_view" model="ir.ui.view">
+ <field name="name">procurement.order.form</field>
+ <field name="model">procurement.order</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Procurement">
</form>
</field>
</record>
- <record id="view_mrp_procurement_filter" model="ir.ui.view">
- <field name="name">mrp.procurement.select</field>
- <field name="model">mrp.procurement</field>
+ <record id="view_procurement_filter" model="ir.ui.view">
+ <field name="name">procurement.order.select</field>
+ <field name="model">procurement.order</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Search Procurement">
</search>
</field>
</record>
- <record id="mrp_procurement_action" model="ir.actions.act_window">
+ <record id="procurement_action" model="ir.actions.act_window">
<field name="name">Procurement Orders</field>
<field name="type">ir.actions.act_window</field>
- <field name="res_model">mrp.procurement</field>
+ <field name="res_model">procurement.order</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"/>
+ <field name="search_view_id" ref="view_procurement_filter"/>
<field name="context">{'search_default_Current':1}</field>
</record>
- <record id="mrp_procurement_action3" model="ir.actions.act_window">
+ <record id="procurement_action3" model="ir.actions.act_window">
<field name="name">Procurements</field>
<field name="type">ir.actions.act_window</field>
- <field name="res_model">mrp.procurement</field>
+ <field name="res_model">procurement.order</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
- <field name="search_view_id" ref="view_mrp_procurement_filter"/>
+ <field name="search_view_id" ref="view_procurement_filter"/>
<field name="domain">[]</field>
<field name="context">{}</field>
</record>
- <record id="mrp_procurement_action5" model="ir.actions.act_window">
+ <record id="procurement_action5" model="ir.actions.act_window">
<field name="name">Procurement Exceptions</field>
<field name="type">ir.actions.act_window</field>
- <field name="res_model">mrp.procurement</field>
+ <field name="res_model">procurement.order</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('state','=','exception')]</field>
</record>
- <record id="mrp_procurement_action4" model="ir.actions.act_window">
+ <record id="procurement_action4" model="ir.actions.act_window">
<field name="name">Procurement Exceptions to Fix</field>
<field name="type">ir.actions.act_window</field>
- <field name="res_model">mrp.procurement</field>
+ <field name="res_model">procurement.order</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('state','=','exception'), ('message', '<>', '')]</field>
<field name="filter" eval="True"/>
</record>
- <record id="mrp_procurement_action11" model="ir.actions.act_window">
+ <record id="procurement_action11" model="ir.actions.act_window">
<field name="name">Temporary Procurement Exceptions</field>
<field name="type">ir.actions.act_window</field>
- <field name="res_model">mrp.procurement</field>
+ <field name="res_model">procurement.order</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('state','=','exception'), ('message', '=', '')]</field>
<act_window
context="{'product_uom': locals().has_key('uom_id') and uom_id}"
domain="[('product_id', '=', active_id)]"
- id="act_mrp_procurement_2_stock_warehouse_orderpoint"
+ id="act_procurement_2_stock_warehouse_orderpoint"
name="Minimum Stock Rules"
res_model="stock.warehouse.orderpoint"
- src_model="mrp.procurement"/>
+ src_model="procurement.order"/>
<act_window
domain="[('id', '=', product_id)]"
id="act_product_product_2_stock_warehouse_orderpoint"
name="Product"
res_model="product.product"
- src_model="mrp.procurement"/>
+ src_model="procurement.order"/>
</data>
</openerp>
<data>
<record id="wkf_procurement" model="workflow">
- <field name="name">mrp.procurement.basic</field>
- <field name="osv">mrp.procurement</field>
+ <field name="name">procurement.order.basic</field>
+ <field name="osv">procurement.order</field>
<field name="on_create">True</field>
</record>
import time
-class mrp_procurement(osv.osv):
- _inherit = 'mrp.procurement'
+class procurement_order(osv.osv):
+ _inherit = 'procurement.order'
def _procure_confirm(self, cr, uid, ids=None, use_new_cursor=False, context=None):
'''
cr = pooler.get_db(use_new_cursor).cursor()
wf_service = netsvc.LocalService("workflow")
- procurement_obj = self.pool.get('mrp.procurement')
+ procurement_obj = self.pool.get('procurement.order')
if not ids:
ids = procurement_obj.search(cr, uid, [], order="date_planned")
for id in ids:
- wf_service.trg_validate(uid, 'mrp.procurement', id, 'button_restart', cr)
+ wf_service.trg_validate(uid, 'procurement.order', id, 'button_restart', cr)
if use_new_cursor:
cr.commit()
report_except = 0
report_later = 0
while True:
- cr.execute('select id from mrp_procurement where state=%s and procure_method=%s order by priority,date_planned limit 500 offset %s', ('confirmed', 'make_to_order', offset))
+ cr.execute('select id from procurement_order where state=%s and procure_method=%s order by priority,date_planned limit 500 offset %s', ('confirmed', 'make_to_order', offset))
ids = map(lambda x: x[0], cr.fetchall())
for proc in procurement_obj.browse(cr, uid, ids):
if (maxdate.strftime('%Y-%m-%d') >= proc.date_planned):
- wf_service.trg_validate(uid, 'mrp.procurement', proc.id, 'button_check', cr)
+ wf_service.trg_validate(uid, 'procurement.order', proc.id, 'button_check', cr)
else:
offset += 1
report_later += 1
ids = procurement_obj.search(cr, uid, [('state', '=', 'confirmed'), ('procure_method', '=', 'make_to_stock')], offset=offset)
for proc in procurement_obj.browse(cr, uid, ids):
if ((maxdate).strftime('%Y-%m-%d') >= proc.date_planned) :
- wf_service.trg_validate(uid, 'mrp.procurement', proc.id, 'button_check', cr)
+ wf_service.trg_validate(uid, 'procurement.order', proc.id, 'button_check', cr)
report_ids.append(proc.id)
else:
report_later += 1
if not context:
context = {}
product_obj = self.pool.get('product.product')
- proc_obj = self.pool.get('mrp.procurement')
+ proc_obj = self.pool.get('procurement.order')
warehouse_obj = self.pool.get('stock.warehouse')
wf_service = netsvc.LocalService("workflow")
'location_id': location_id,
'procure_method': 'make_to_order',
})
- wf_service.trg_validate(uid, 'mrp.procurement', proc_id, 'button_confirm', cr)
- wf_service.trg_validate(uid, 'mrp.procurement', proc_id, 'button_check', cr)
+ wf_service.trg_validate(uid, 'procurement.order', proc_id, 'button_confirm', cr)
+ wf_service.trg_validate(uid, 'procurement.order', proc_id, 'button_check', cr)
def _procure_orderpoint_confirm(self, cr, uid, automatic=False,\
use_new_cursor=False, context=None, user_id=False):
cr = pooler.get_db(use_new_cursor).cursor()
orderpoint_obj = self.pool.get('stock.warehouse.orderpoint')
location_obj = self.pool.get('stock.location')
- procurement_obj = self.pool.get('mrp.procurement')
+ procurement_obj = self.pool.get('procurement.order')
request_obj = self.pool.get('res.request')
wf_service = netsvc.LocalService("workflow")
report = []
'procure_method': 'make_to_order',
'origin': op.name
})
- wf_service.trg_validate(uid, 'mrp.procurement', proc_id,
+ wf_service.trg_validate(uid, 'procurement.order', proc_id,
'button_confirm', cr)
- wf_service.trg_validate(uid, 'mrp.procurement', proc_id,
+ wf_service.trg_validate(uid, 'procurement.order', proc_id,
'button_check', cr)
orderpoint_obj.write(cr, uid, [op.id],
{'procurement_id': proc_id})
cr.commit()
cr.close()
return {}
-mrp_procurement()
+procurement_order()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
import xmlrpclib
sock = xmlrpclib.ServerProxy('http://localhost:8069/xmlrpc/wizard')
-wiz_id = sock.create('trunk', 1, 'admin', 'mrp.procurement.compute.all')
+wiz_id = sock.create('trunk', 1, 'admin', 'procurement.order.compute.all')
sock.execute('trunk', 1, 'admin', wiz_id, {'form': {'po_cycle': 1.0, 'po_lead': 1.0, 'user_id': 3, 'schedule_cycle': 1.0, 'picking_lead': 1.0, 'security_lead': 50.0, 'automatic': False}, 'ids': [], 'report_type': 'pdf', 'model': 'ir.ui.menu', 'id': False}, 'compute', {})
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
"access_mrp_property_group","mrp.property.group","model_mrp_property_group",,1,0,0,0
"access_mrp_property","mrp.property","model_mrp_property",,1,0,0,0
-"access_mrp_procurement","mrp.procurement","model_mrp_procurement",,1,0,0,0
+"access_procurement","procurement.order","model_procurement_order",,1,0,0,0
"access_stock_warehouse_orderpoint","stock.warehouse.orderpoint","model_stock_warehouse_orderpoint",,1,0,0,0
-"access_mrp_procurement_compute_all","mrp.procurement.compute.all","model_mrp_procurement_compute_all",,1,0,0,0
-"access_mrp_procurement_orderpoint_compute","mrp.procurement.orderpoint.compute","model_mrp_procurement_orderpoint_compute",,1,0,0,0
+"access_procurement_compute_all","procurement.order.compute.all","model_procurement_order_compute_all",,1,0,0,0
+"access_procurement_orderpoint_compute","procurement.orderpoint.compute","model_procurement_orderpoint_compute",,1,0,0,0
"access_mrp_make_procurement","make.procurement","model_make_procurement",,1,0,0,0
-"access_mrp_make_procurement","mrp.procurement.compute","model_mrp_procurement_compute",,1,0,0,0
+"access_mrp_make_procurement","procurement.order.compute","model_procurement_order_compute",,1,0,0,0
<openerp>
<data noupdate="0">
- <record model="ir.rule" id="mrp_procurement_rule">
- <field name="name">mrp_procurement multi-company</field>
- <field name="model_id" search="[('model','=','mrp.procurement')]" model="ir.model"/>
+ <record model="ir.rule" id="procurement_rule">
+ <field name="name">procurement multi-company</field>
+ <field name="model_id" search="[('model','=','procurement.order')]" model="ir.model"/>
<field name="global" eval="True"/>
<field name="domain_force">['|',('company_id','child_of',[user.company_id.id]),('company_id','=',False)]</field>
</record>
"""
user = self.pool.get('res.users').browse(cr, uid, uid, context).login
wh_obj = self.pool.get('stock.warehouse')
- procurement_obj = self.pool.get('mrp.procurement')
+ procurement_obj = self.pool.get('procurement.order')
wf_service = netsvc.LocalService("workflow")
data_obj = self.pool.get('ir.model.data')
'procure_method':'make_to_order',
})
- wf_service.trg_validate(uid, 'mrp.procurement', procure_id, 'button_confirm', cr)
+ wf_service.trg_validate(uid, 'procurement.order', procure_id, 'button_confirm', cr)
- id2 = data_obj._get_id(cr, uid, 'procurement', 'mrp_procurement_tree_view')
- id3 = data_obj._get_id(cr, uid, 'procurement', 'mrp_procurement_form_view')
+ id2 = data_obj._get_id(cr, uid, 'procurement', 'procurement_tree_view')
+ id3 = data_obj._get_id(cr, uid, 'procurement', 'procurement_form_view')
if id2:
id2 = data_obj.browse(cr, uid, id2, context=context).res_id
return {
'view_type': 'form',
'view_mode': 'tree,form',
- 'res_model': 'mrp.procurement',
+ 'res_model': 'procurement.order',
'res_id' : procure_id,
'views': [(id3,'form'),(id2,'tree')],
'type': 'ir.actions.act_window',
from osv import osv, fields
class procurement_compute(osv.osv_memory):
- _name = 'mrp.procurement.compute'
+ _name = 'procurement.order.compute'
_description = 'Compute Procurement'
def _procure_calculation_procure(self, cr, uid, ids, context):
try:
- proc_obj = self.pool.get('mrp.procurement')
+ proc_obj = self.pool.get('procurement.order')
proc_obj._procure_confirm(cr, uid, use_new_cursor=cr.dbname, context=context)
finally:
cr.close()
<record id="view_compute_procurment_wizard" model="ir.ui.view">
<field name="name">Compute Procurements</field>
- <field name="model">mrp.procurement.compute</field>
+ <field name="model">procurement.order.compute</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Parameters">
</record>
<!-- <act_window name="Compute Procurements" -->
-<!-- res_model="mrp.procurement.compute"-->
-<!-- src_model="mrp.procurement"-->
+<!-- res_model="procurement.order.compute"-->
+<!-- src_model="procurement.order"-->
<!-- view_mode="form"-->
<!-- target="new" -->
<!-- key2="client_action_multi" -->
from osv import fields,osv
class procurement_compute(osv.osv_memory):
- _name = 'mrp.procurement.orderpoint.compute'
+ _name = 'procurement.orderpoint.compute'
_description = 'Automatic Order Point'
_columns = {
@param ids: List of IDs selected
@param context: A standard dictionary
"""
- proc_obj = self.pool.get('mrp.procurement')
+ proc_obj = self.pool.get('procurement.order')
for proc in self.browse(cr, uid, ids):
proc_obj._procure_orderpoint_confirm(cr, uid, automatic=proc.automatic, use_new_cursor=cr.dbname, context=context)
<record id="view_procurement_compute_wizard" model="ir.ui.view">
<field name="name">Compute Stock Minimum Rules Only</field>
- <field name="model">mrp.procurement.orderpoint.compute</field>
+ <field name="model">procurement.orderpoint.compute</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Parameters">
</record>
<act_window name="Compute Stock Minimum Rules Only"
- res_model="mrp.procurement.orderpoint.compute"
- src_model="mrp.procurement"
+ res_model="procurement.orderpoint.compute"
+ src_model="procurement.order"
view_mode="form"
target="new"
key2="client_action_multi"
from osv import osv, fields
class procurement_compute_all(osv.osv_memory):
- _name = 'mrp.procurement.compute.all'
+ _name = 'procurement.order.compute.all'
_description = 'Compute all schedulers'
_columns = {
@param ids: List of IDs selected
@param context: A standard dictionary
"""
- proc_obj = self.pool.get('mrp.procurement')
+ proc_obj = self.pool.get('procurement.order')
for proc in self.browse(cr, uid, ids):
proc_obj.run_scheduler(cr, uid, automatic=proc.automatic, use_new_cursor=cr.dbname,\
context=context)
<record id="view_compute_schedulers_wizard" model="ir.ui.view">
<field name="name">Compute Schedulers</field>
- <field name="model">mrp.procurement.compute.all</field>
+ <field name="model">procurement.order.compute.all</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Scheduler Parameters">
</record>
<act_window name="Compute Schedulers"
- res_model="mrp.procurement.compute.all"
- src_model="mrp.procurement"
+ res_model="procurement.order.compute.all"
+ src_model="procurement.order"
view_mode="form"
target="new"
key2="client_action_multi"
from osv import fields, osv, orm
import tools
-class mrp_procurement(osv.osv):
- _name = "mrp.procurement"
- _inherit = "mrp.procurement"
+class procurement_order(osv.osv):
+ _name = "procurement.order"
+ _inherit = "procurement.order"
def action_produce_assign_service(self, cr, uid, ids, context={}):
for procurement in self.browse(cr, uid, ids):
'project_id': project_id,
},context=context)
return task_id
-mrp_procurement()
+procurement_order()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
_name = "project.task"
_inherit = "project.task"
_columns = {
- 'procurement_id': fields.many2one('mrp.procurement', 'Procurement', ondelete='set null')
+ 'procurement_id': fields.many2one('procurement.order', 'Procurement', ondelete='set null')
}
def do_close(self, cr, uid, ids, *args):
for task in tasks:
if task.procurement_id:
wf_service = netsvc.LocalService("workflow")
- wf_service.trg_validate(uid, 'mrp.procurement', task.procurement_id.id, 'subflow.done', cr)
+ wf_service.trg_validate(uid, 'procurement.order', task.procurement_id.id, 'subflow.done', cr)
return res
def do_cancel(self, cr, uid, ids, *args):
for task in tasks:
if task.procurement_id:
wf_service = netsvc.LocalService("workflow")
- wf_service.trg_validate(uid, 'mrp.procurement', task.procurement_id.id, 'subflow.cancel', cr)
+ wf_service.trg_validate(uid, 'procurement.order', task.procurement_id.id, 'subflow.cancel', cr)
return True
project_task()
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
-"access_mrp_procurement_project_user","mrp.procurement project_user","model_mrp_procurement","project.group_project_user",1,1,1,1
-"access_mrp_procurement_project_manager","mrp.procurement project_manager","model_mrp_procurement","project.group_project_manager",1,1,1,1
+"access_procurement_project_user","procurement.order project_user","model_procurement_order","project.group_project_user",1,1,1,1
+"access_procurement_project_manager","procurement.order project_manager","model_procurement_order","project.group_project_manager",1,1,1,1
-
I check the procurements.
-
- !python {model: mrp.procurement}: |
+ !python {model: procurement.order}: |
from tools.translate import _
orderline_obj = self.pool.get('sale.order.line')
line_ids = orderline_obj.search(cr, uid, [('order_id','=', ref('sale_order_so0'))])
-
The scheduler runs.
-
- !function {model: mrp.procurement, name: run_scheduler}:
- - model: mrp.procurement
+ !function {model: procurement.order, name: run_scheduler}:
+ - model: procurement.order
search: "[('state','=','confirmed')]"
-
Now I check the tasks.
return True
purchase_order_line()
-class mrp_procurement(osv.osv):
- _inherit = 'mrp.procurement'
+class procurement_order(osv.osv):
+ _inherit = 'procurement.order'
_columns = {
'purchase_id': fields.many2one('purchase.order', 'Latest Requisition'),
}
res[procurement.id] = purchase_id
self.write(cr, uid, [procurement.id], {'state': 'running', 'purchase_id': purchase_id})
return res
-mrp_procurement()
+procurement_order()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-->
<record id="view_procurement_form_inherit" model="ir.ui.view">
- <field name="name">mrp.procurement.form.inherit</field>
- <field name="model">mrp.procurement</field>
- <field name="inherit_id" ref="procurement.mrp_procurement_form_view"/>
+ <field name="name">procurement.order.form.inherit</field>
+ <field name="model">procurement.order</field>
+ <field name="inherit_id" ref="procurement.procurement_form_view"/>
<field name="type">form</field>
<field name="arch" type="xml">
<xpath expr="/form/notebook/page/field[@name='close_move']" position="before">
product_product()
-class mrp_procurement(osv.osv):
- _inherit = 'mrp.procurement'
+class procurement_order(osv.osv):
+ _inherit = 'procurement.order'
def make_po(self, cr, uid, ids, context={}):
sequence_obj=self.pool.get('ir.sequence')
- res = super(mrp_procurement, self).make_po(cr, uid, ids, context)
+ res = super(procurement_order, self).make_po(cr, uid, ids, context)
for proc_id,po_id in res.items():
procurement = self.browse(cr, uid, proc_id)
if procurement.product_id.purchase_requisition:
'purchase_ids': [(6,0,[po_id])]
})
return res
-mrp_procurement()
+procurement_order()
-
I launch he scheduler to compute all procurements, and specify all requisitions orders.
-
- !python {model: mrp.procurement.compute.all}: |
- proc_obj = self.pool.get('mrp.procurement')
+ !python {model: procurement.order.compute.all}: |
+ proc_obj = self.pool.get('procurement.order')
proc_obj._procure_confirm(cr,uid)
-
On the purchase tender, I create a new purchase order for the supplier 'DistriPC' by clicking on
-
I launch he scheduler to compute all procurements, and planify all requisitions orders.
-
- !python {model: mrp.procurement.compute.all}: |
- proc_obj = self.pool.get('mrp.procurement')
+ !python {model: procurement.order.compute.all}: |
+ proc_obj = self.pool.get('procurement.order')
proc_obj._procure_confirm(cr,uid)
-
I should find a purchase requisition with the origin 'TEST/TENDER/0002', that includes a request for
<record id="process_node_saleprocurement0" model="process.node">
<field name="menu_id" ref="procurement.menu_mrp_procurement_action"/>
- <field name="model_id" ref="procurement.model_mrp_procurement"/>
+ <field name="model_id" ref="procurement.model_procurement_order"/>
<field eval=""""subflow"""" name="kind"/>
<field eval=""""Procurement Order"""" name="name"/>
<field eval=""""One Procurement order for each sale order line and for each of the components."""" name="note"/>
- <field name="subflow_id" ref="mrp_procurement.process_process_procurementprocess0"/>
+ <field name="subflow_id" ref="procurement.process_process_procurementprocess0"/>
<field name="process_id" ref="process_process_salesprocess0"/>
<field eval=""""object.state=='confirmed'"""" name="model_states"/>
<field eval="1" name="flow_start"/>
LEFT JOIN
stock_picking p on (p.id=m.picking_id)
LEFT JOIN
- mrp_procurement mp on (mp.move_id=m.id)
+ procurement_order mp on (mp.move_id=m.id)
WHERE
p.sale_id = ANY(%s) GROUP BY mp.state, p.sale_id''',(ids,))
for oid, nbr, mp_state in cr.fetchall():
'note': line.notes,
'company_id': order.company_id.id,
})
- proc_id = self.pool.get('mrp.procurement').create(cr, uid, {
+ proc_id = self.pool.get('procurement.order').create(cr, uid, {
'name': order.name,
'origin': order.name,
'date_planned': date_planned,
'company_id': order.company_id.id,
})
wf_service = netsvc.LocalService("workflow")
- wf_service.trg_validate(uid, 'mrp.procurement', proc_id, 'button_confirm', cr)
+ wf_service.trg_validate(uid, 'procurement.order', proc_id, 'button_confirm', cr)
self.pool.get('sale.order.line').write(cr, uid, [line.id], {'procurement_id': proc_id})
elif line.product_id and line.product_id.product_tmpl_id.type == 'service':
- proc_id = self.pool.get('mrp.procurement').create(cr, uid, {
+ proc_id = self.pool.get('procurement.order').create(cr, uid, {
'name': line.name,
'origin': order.name,
'date_planned': date_planned,
})
self.pool.get('sale.order.line').write(cr, uid, [line.id], {'procurement_id': proc_id})
wf_service = netsvc.LocalService("workflow")
- wf_service.trg_validate(uid, 'mrp.procurement', proc_id, 'button_confirm', cr)
+ wf_service.trg_validate(uid, 'procurement.order', proc_id, 'button_confirm', cr)
else:
#
# No procurement because no product in the sale.order.line.
'product_id': fields.many2one('product.product', 'Product', domain=[('sale_ok', '=', True)], change_default=True),
'invoice_lines': fields.many2many('account.invoice.line', 'sale_order_line_invoice_rel', 'order_line_id', 'invoice_id', 'Invoice Lines', readonly=True),
'invoiced': fields.boolean('Invoiced', readonly=True),
- 'procurement_id': fields.many2one('mrp.procurement', 'Procurement'),
+ 'procurement_id': fields.many2one('procurement.order', 'Procurement'),
'price_unit': fields.float('Unit Price', required=True, digits_compute= dp.get_precision('Sale Price'), readonly=True, states={'draft':[('readonly',False)]}),
'price_net': fields.function(_amount_line_net, method=True, string='Net Price', digits_compute= dp.get_precision('Sale Price')),
'price_subtotal': fields.function(_amount_line, method=True, string='Subtotal', digits_compute= dp.get_precision('Sale Price')),
return line.product_uos_qty or 0.0
return line.product_uom_qty
else:
- return self.pool.get('mrp.procurement').quantity_get(cr, uid,
+ return self.pool.get('procurement.order').quantity_get(cr, uid,
line.procurement_id.id, context=context)
def _get_line_uom(line):
return line.product_uos.id
return line.product_uom.id
else:
- return self.pool.get('mrp.procurement').uom_get(cr, uid,
+ return self.pool.get('procurement.order').uom_get(cr, uid,
line.procurement_id.id, context=context)
create_ids = []
<workflow action="order_confirm" model="sale.order" ref="order5"/>
<!-- Run all schedulers -->
- <function model="mrp.procurement" name="run_scheduler"/>
+ <function model="procurement.order" name="run_scheduler"/>
<!-- sale advance demo.. -->
</assert>
<!-- Run all schedulers -->
- <function model="mrp.procurement" name="run_scheduler"/>
+ <function model="procurement.order" name="run_scheduler"/>
<assert id="test_order_1" model="sale.order" string="the sale order is now done">
<test expr="state">done</test>
<record id="trans_ship_ship_end" model="workflow.transition">
<field name="act_from" ref="act_ship"/>
<field name="act_to" ref="act_ship_end"/>
- <field name="trigger_model">mrp.procurement</field>
+ <field name="trigger_model">procurement.order</field>
<field name="trigger_expr_id">procurement_lines_get()</field>
<field name="condition">test_state('finished')</field>
</record>
<field name="act_from" ref="act_ship"/>
<field name="act_to" ref="act_ship_except"/>
<!--
- <field name="trigger_model">mrp.procurement</field>
+ <field name="trigger_model">procurement.order</field>
<field name="trigger_expr_id">procurement_lines_get()</field>
-->
<field name="condition">test_state('canceled')</field>
"access_account_analytic_account_salesman","account_analytic_account salesman","analytic.model_account_analytic_account","group_sale_user",1,1,1,1
"access_stock_picking_salesman","stock_picking salesman","stock.model_stock_picking","group_sale_user",1,1,1,1
"access_stock_move_salesman","stock_move salesman","stock.model_stock_move","group_sale_user",1,1,1,0
-"access_mrp_procurement_salesman","mrp.procurement salesman","procurement.model_mrp_procurement","group_sale_user",1,1,1,1
+"access_procurement_salesman","procurement.order salesman","procurement.model_procurement_order","group_sale_user",1,1,1,1
"access_sale_order_stock_worker","sale.order stock worker","model_sale_order","stock.group_stock_user",1,1,0,0
"access_sale_order_line_stock_worker","sale.order.line stock worker","model_sale_order_line","stock.group_stock_user",1,1,0,0
"access_sale_order_manager","sale.order.manager","model_sale_order","group_sale_manager",1,1,1,1
-
I check that one procurement is generated.
-
- !python {model: mrp.procurement}: |
+ !python {model: procurement.order}: |
from tools.translate import _
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
+ !function {model: procurement.order, name: run_scheduler}:
+ - model: procurement.order
search: "[('state','=','confirmed')]"
-
I check that the procurement for the product table is in exception state.
As my product's supply method is produce and mrp module is yet not installed.
-
- !python {model: mrp.procurement}: |
+ !python {model: procurement.order}: |
from tools.translate import _
proc_ids = self.search(cr, uid, [('state','=','exception')])
assert proc_ids, _('No Procurements are in exception state!')
raise osv.except_osv(_('Error !'), _('Incoming Left must be greater than 0 !'))
uom_qty, uom, uos_qty, uos = self._qty_to_standard(cr, uid, obj, context)
user = self.pool.get('res.users').browse(cr, uid, uid, context)
- proc_id = self.pool.get('mrp.procurement').create(cr, uid, {
+ proc_id = self.pool.get('procurement.order').create(cr, uid, {
'company_id' : obj.company_id.id,
'name': _('Manual planning for ') + obj.period_id.name,
'origin': _('MPS(') + str(user.login) +') '+ obj.period_id.name,
}, context=context)
wf_service = netsvc.LocalService("workflow")
- wf_service.trg_validate(uid, 'mrp.procurement', proc_id, 'button_confirm', cr)
+ wf_service.trg_validate(uid, 'procurement.order', proc_id, 'button_confirm', cr)
self.calculate_planning(cr, uid, ids, context)
prev_text = obj.history or ""
self.write(cr, uid, ids, {