From 13fd1480b472183d7c8791433d7b482da0ad7435 Mon Sep 17 00:00:00 2001 From: "uco (OpenERP)" Date: Wed, 10 Mar 2010 12:29:59 +0530 Subject: [PATCH] [ADD] mrp: Added Docstrings for methods used in wizard files. bzr revid: uco@tinyerp.co.in-20100310065959-u1uaajtouzj3wyok --- addons/mrp/wizard/change_production_qty.py | 26 +++++++++++- addons/mrp/wizard/make_procurement_product.py | 41 +++++++++++++++++-- addons/mrp/wizard/orderpoint_procurement.py | 15 +++++++ addons/mrp/wizard/schedulers_all.py | 14 +++++++ 4 files changed, 92 insertions(+), 4 deletions(-) diff --git a/addons/mrp/wizard/change_production_qty.py b/addons/mrp/wizard/change_production_qty.py index 56fd5fc2b53..292e8a323a6 100644 --- a/addons/mrp/wizard/change_production_qty.py +++ b/addons/mrp/wizard/change_production_qty.py @@ -34,7 +34,19 @@ class change_production_qty(osv.osv_memory): 'product_qty': fields.float('Product Qty', required=True), } - def default_get(self, cr, uid, ids, context): + def default_get(self, cr, uid, fields, context): + """ + @summary: To get default values for the object. + + @param self: The object pointer. + @param cr: A database cursor + @param uid: ID of the user currently logged in + @param fields: List of fields for which we want default values + @param context: A standard dictionary + + @return: A dictionary which of fields with values. + + """ record_id = context and context.get('record_id',False) res = {} prod_obj = self.pool.get('mrp.production') @@ -48,6 +60,18 @@ class change_production_qty(osv.osv_memory): return res def change_prod_qty(self, cr, uid, ids, context): + """ + @summary: Changes the Quantity of Product. + + @param self: The object pointer. + @param cr: A database cursor + @param uid: ID of the user currently logged in + @param ids: List of IDs selected + @param context: A standard dictionary + + @return: + + """ record_id = context and context.get('record_id',False) prod_obj = self.pool.get('mrp.production') wiz_qty = self.browse(cr, uid, ids[0]) diff --git a/addons/mrp/wizard/make_procurement_product.py b/addons/mrp/wizard/make_procurement_product.py index 8a1306f1c8f..77c4959cdd3 100644 --- a/addons/mrp/wizard/make_procurement_product.py +++ b/addons/mrp/wizard/make_procurement_product.py @@ -29,6 +29,18 @@ class make_procurement(osv.osv_memory): _description = 'Make Procurements' def onchange_product_id(self, cr, uid, ids, prod_id): + """ + @summary: On Change of Product ID getting the value of related UoM. + + @param self: The object pointer. + @param cr: A database cursor + @param uid: ID of the user currently logged in + @param ids: List of IDs selected + @param prod_id: Changed ID of Product + + @return: A dictionary which gives the UoM of the changed Product + + """ product = self.pool.get('product.product').browse(cr, uid, prod_id) return {'value': {'uom_id': product.uom_id.id}} @@ -46,12 +58,23 @@ class make_procurement(osv.osv_memory): } def make_procurement(self, cr, uid, ids, context=None): - '''Create procurement''' + """ + @summary: Creates procurement order for selected product. + + @param self: The object pointer. + @param cr: A database cursor + @param uid: ID of the user currently logged in + @param ids: List of IDs selected + @param context: A standard dictionary + + @return: A dictionary which loads Procurement form view. + + """ + user = self.pool.get('res.users').browse(cr, uid, uid, context).login for proc in self.browse(cr, uid, ids): wh = self.pool.get('stock.warehouse').browse(cr, uid, proc.warehouse_id.id, context) - user = self.pool.get('res.users').browse(cr, uid, uid, context) procure_id = self.pool.get('mrp.procurement').create(cr, uid, { - 'name':'INT:'+str(user.login), + 'name':'INT: '+str(user), 'date_planned': proc.date_planned, 'product_id': proc.product_id.id, 'product_qty': proc.qty, @@ -80,6 +103,18 @@ class make_procurement(osv.osv_memory): } def default_get(self, cr, uid, fields, context=None): + """ + @summary: To get default values for the object. + + @param self: The object pointer. + @param cr: A database cursor + @param uid: ID of the user currently logged in + @param fields: List of fields for which we want default values + @param context: A standard dictionary + + @return: A dictionary which of fields with values. + + """ record_id = context and context.get('record_id', False) or False res = super(make_procurement, self).default_get(cr, uid, fields, context=context) diff --git a/addons/mrp/wizard/orderpoint_procurement.py b/addons/mrp/wizard/orderpoint_procurement.py index 623e8080e9c..86b4b3c8aa6 100644 --- a/addons/mrp/wizard/orderpoint_procurement.py +++ b/addons/mrp/wizard/orderpoint_procurement.py @@ -40,6 +40,13 @@ class procurement_compute(osv.osv_memory): } def _procure_calculation_orderpoint(self, cr, uid, ids, context): + """ + @param self: The object pointer. + @param cr: A database cursor + @param uid: ID of the user currently logged in + @param ids: List of IDs selected + @param context: A standard dictionary + """ try: proc_obj = self.pool.get('mrp.procurement') for proc in self.browse(cr, uid, ids): @@ -49,6 +56,14 @@ class procurement_compute(osv.osv_memory): return {} def procure_calculation(self, cr, uid, ids, context): + """ + @param self: The object pointer. + @param cr: A database cursor + @param uid: ID of the user currently logged in + @param ids: List of IDs selected + @param context: A standard dictionary + + """ threaded_calculation = threading.Thread(target=self._procure_calculation_orderpoint, args=(cr, uid, ids, context)) threaded_calculation.start() return {} diff --git a/addons/mrp/wizard/schedulers_all.py b/addons/mrp/wizard/schedulers_all.py index f1ef2501add..62497564905 100644 --- a/addons/mrp/wizard/schedulers_all.py +++ b/addons/mrp/wizard/schedulers_all.py @@ -36,6 +36,13 @@ class procurement_compute(osv.osv_memory): } def _procure_calculation_all(self, cr, uid, ids, context): + """ + @param self: The object pointer. + @param cr: A database cursor + @param uid: ID of the user currently logged in + @param ids: List of IDs selected + @param context: A standard dictionary + """ proc_obj = self.pool.get('mrp.procurement') for proc in self.browse(cr, uid, ids): proc_obj.run_scheduler(cr, uid, automatic=proc.automatic, use_new_cursor=cr.dbname,\ @@ -43,6 +50,13 @@ class procurement_compute(osv.osv_memory): return {} def procure_calculation(self, cr, uid, ids, context): + """ + @param self: The object pointer. + @param cr: A database cursor + @param uid: ID of the user currently logged in + @param ids: List of IDs selected + @param context: A standard dictionary + """ threaded_calculation = threading.Thread(target=self._procure_calculation_all, args=(cr, uid, ids, context)) threaded_calculation.start() return {}