summaryrefslogtreecommitdiff
path: root/addons/procurement/procurement.py
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 /addons/procurement/procurement.py
parent2ead39022e5742f5939be2cbf36d06494eb7e570 (diff)
[IMP]:Task-1847 Add many2many function field
bzr revid: ksa@tinyerp.co.in-20101124123332-6fet5o4g12yopr1z
Diffstat (limited to 'addons/procurement/procurement.py')
-rw-r--r--addons/procurement/procurement.py15
1 files changed, 15 insertions, 0 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,