Order Builders objects may be created in portal_orders tool. They provide
ability to build new orders - purchase, production or sale orders (lets say you
have spies at your clients facility and you know, if they consumed your products,
register it in your ERP5 and viola - send them prepared sale orders ;) ).
Note: /!\ This howto applies to version before revision
r23647. More information is on mailing list!
Table of Contents
Usage¶
Preparation¶
You'll need ERP5 site with installed
Business Templates: erp5_base, erp5_trade and erp5_pdm.
Before we start we need to define few objects in site:
- create Component in Components:
- Title: Screwdriver, Min. Delay (Day): 1.0, Max. Delay (Day): 2.0, Min. Flow: 5000.0
- Title: LCD, Min. Delay (Day): 5.0, Max. Delay (Day): 20.0, Min. Flow: 10.0
- create Organisation in Organisations:
- Title: Acme (it will be our Organisation)
- Title: Acme Entry Warehouse (our warehouse, where we will accept goods)
- Title: Acme Production Warehouse (our warehouse, to which we will move goods, for production)
- Title: Supplier MacroHard (our supplier)
- Title: Client MicroHard (our client)
Look at data¶
Currently there is no action providing Resource_viewInventory on Component portal
type, so to see movements related to Component you have to type Resource_viewInventory
after Component's id in URL.
Right now no movements shall be registered - listbox will be empty.
Change stock¶
Go to Inventories module and add new Inventory, configure it with those data:
- Title: Inventory One
- Inventory Date: 2007/10/25
- Destination: Acme Production Warehouse
Add 2 Inventory Line to that inventory:
- Resource: LCD, Inventory: -100.0
- Resource: Screwdriver, Inventory: -25.0
Validate Inventory. That way stock of components is set to negative quantity on 2007/10/25.
Now check how stock of components look like - there will have some movement
registered: LCD-after-ipl-inventory.png screwdriver-after-ipl-inventory.png
If you click on lines in this listbox system will explain you how those stock
changes were created.
Simple Order Builder¶
As you can see we have negative stock on our components. Treat that as future
forecast.
We have to buy those components - in normal scenario you would navigate to Purchase
Orders module and there fill order with proper dates, to proper destination from
proper suppliers. But this could be done using Order Builder - we only need to
configure it.
So instead navigating to Purchase Orders module go into portal_orders tool and add new Order Builder object, fill its data with:
- ID: example_order_builder
- Title: Our first Order Builder
- Delivery Module Before Building Script: example_order_builder_preBuild
- Delivery After Generation Script: example_order_builder_postBuild
- Delivery Module: Purchase Orders
- Delivery Portal Type: Purchase Order
- Delivery Line Portal Type: Purchase Order Line
- Delivery Cell Portal Type: Purchase Order Cell
- Delivery Collect Order Groups:
- DateMovementGroup
- PathMovementGroup
- SectionPathMovementGroup
- Delivery Line Collect Order Groups:
- ResourceMovementGroup
- BaseVariantMovementGroup
- Delivery Cell Collect Order Groups:
(On Profile view):
- Destination: Acme Entry Warehouse
(On Predicate view):
- Resource Portal Type: Component
We need to create two scripts - one which will set created orders to auto_planned
state and second one which will purge all orders created with this builder.
Put those scripts in custom portal skin:
## Script (Python) "example_order_builder_postBuild"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=
##title=
##
context.portal_workflow.doActionFor(context,'auto_plan')
## Script (Python) "example_order_builder_preBuild"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=
##title=
##
search_kw = {
'portal_type' : 'Purchase Order',
'simulation_state' : 'auto_planned',
}
context.manage_delObjects(ids = [x.getId() for x in context.searchFolder(**search_kw)])
Invoking Order Builder¶
Now after example_order_builder type /build wait a while...and system will show
you list of created orders.
Reference information¶
Resource information¶
max_delay¶
On resource level it is possible to define max_delay parameter. It will be used
to calculate start date - the date, when goods would start their trip - on generated
order. It will create time-frame for goods - so max_delay may be understand as
maximum time, that shall pass for goods to be transfered from source to destination.
min_flow¶
min_flow parameter on resources is MOQ - Minimum Order Quantity. /!\ Right now
its implementation on OrderBuilder is quite cryptic.
Related Articles¶