[ADD] mrp: Added Docstrings for methods used in wizard files.

bzr revid: uco@tinyerp.co.in-20100310065959-u1uaajtouzj3wyok
This commit is contained in:
uco (OpenERP)
2010-03-10 12:29:59 +05:30
parent 077e6dd333
commit 13fd1480b4
4 changed files with 92 additions and 4 deletions
+25 -1
View File
@@ -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])
+38 -3
View File
@@ -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)
@@ -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 {}
+14
View File
@@ -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 {}