summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorksa (Open ERP) <ksa@tinyerp.co.in>2010-11-24 18:03:32 +0530
committerksa (Open ERP) <ksa@tinyerp.co.in>2010-11-24 18:03:32 +0530
commitcbfed7bb039b7be9629903ab8a5d080d3a5657eb (patch)
tree9831cef9c043cd49964f0c5d15baa93bde12bfc0
parent2ead39022e5742f5939be2cbf36d06494eb7e570 (diff)
[IMP]:Task-1847 Add many2many function field
bzr revid: ksa@tinyerp.co.in-20101124123332-6fet5o4g12yopr1z
-rw-r--r--addons/procurement/procurement.py15
-rw-r--r--addons/procurement/procurement_view.xml14
2 files changed, 24 insertions, 5 deletions
diff --git a/addons/procurement/procurement.py b/addons/procurement/procurement.py
index b3fa0bfeb99..f350e79205b 100644
--- a/addons/procurement/procurement.py
+++ b/addons/procurement/procurement.py
@@ -490,6 +490,19 @@ class stock_warehouse_orderpoint(osv.osv):
_name = "stock.warehouse.orderpoint"
_description = "Minimum Inventory Rule"
+ def procurement_draft(self, cr, uid, ids, field_name, arg, context=None):
+ if context is None:
+ context = {}
+ result = {}
+ procurement_obj = self.pool.get('procurement.order')
+ for data in self.browse(cr, uid, ids, context=context):
+ procurement_id = []
+ result[data.id] = procurement_id
+
+ procurement_ids = procurement_obj.search(cr, uid , [('state','=','draft'),('product_id','=',data.product_id.id),('location_id','=',data.location_id.id)])
+ result[data.id] = procurement_ids
+ return result
+
_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."),
@@ -508,6 +521,8 @@ class stock_warehouse_orderpoint(osv.osv):
help="The procurement quantity will by rounded up to this multiple."),
'procurement_id': fields.many2one('procurement.order', 'Latest procurement', ondelete="set null"),
'company_id': fields.many2one('res.company','Company',required=True),
+ 'procurement_data_id': fields.function(procurement_draft, method=True, type='many2many', relation="procurement.order", \
+ string="Related Procurement Orders",help="Draft procurement of the product and location of that orderpoint"),
}
_defaults = {
'active': lambda *a: 1,
diff --git a/addons/procurement/procurement_view.xml b/addons/procurement/procurement_view.xml
index 96b96f3af21..9ef921cc23a 100644
--- a/addons/procurement/procurement_view.xml
+++ b/addons/procurement/procurement_view.xml
@@ -4,7 +4,7 @@
<!--
Procurement
-->
-
+
<record id="procurement_tree_view" model="ir.ui.view">
<field name="name">procurement.order.tree</field>
@@ -145,7 +145,7 @@
<field name="search_view_id" ref="view_procurement_filter"/>
<field name="help">Procurement Orders represent the need for a certain quantity of products, at a given time, in a given location. Sale Orders are one typical source of Procurement Orders (but these are distinct documents). Depending on the procurement parameters and the products configuration, the procurement engine will attempt to satisfy the need by reserving products from stock, or ordering products from a supplier, or passing a manufacturing order, etc. A Procurement Exception occurs when the system cannot find a way to fulfill a procurement. Some exceptions will resolve themselves automatically, but others require manual intervention (those are identified by a specific error message)</field>
</record>
-
+
<record id="procurement_action5" model="ir.actions.act_window">
<field name="name">Procurement Exceptions</field>
<field name="type">ir.actions.act_window</field>
@@ -224,6 +224,10 @@
<field name="procurement_id" readonly="1"/>
<field name="active" />
</group>
+ <group col="4" colspan="4" groups="base.group_extended">
+ <separator string="Related Procurement Orders" colspan="4" />
+ <field name="procurement_data_id" colspan="4" nolabel="1"/>
+ </group>
</form>
</field>
</record>
@@ -238,11 +242,11 @@
<field name="help">You can define your minimum stock rules, so that OpenERP will trigger automatically the propositions of manufacturing or purchase orders according to the stock level. Once the virtual stock of a product (=stock on hand minus all confirmed orders and reservations) is bellow the minimum quantity, OpenERP will generate a procurement request in order to fullfil the stock up to the maximum quantity.</field>
</record>
- <act_window
+ <act_window
context="{'search_default_warehouse_id': active_id}"
id="act_stock_warehouse_2_stock_warehouse_orderpoint"
- name="Minimum Stock Rules"
- res_model="stock.warehouse.orderpoint"
+ name="Minimum Stock Rules"
+ res_model="stock.warehouse.orderpoint"
src_model="stock.warehouse"/>
<!-- add product_uom to context to be the default value when adding new orderpoints -->