bzr revid: fp@tinyerp.com-20090115162445-x1pt9jt51d3llw5q
This commit is contained in:
Fabien Pinckaers 2009-01-15 17:24:45 +01:00
parent 45feff81ca
commit d99ec45e4e
3 changed files with 12 additions and 3 deletions

View File

@ -257,9 +257,9 @@ class product_template(osv.osv):
'warranty': fields.float('Warranty (months)'),
'sale_ok': fields.boolean('Can be sold', help="Determine if the product can be visible in the list of product within a selection from a sale order line."),
'purchase_ok': fields.boolean('Can be Purchased', help="Determine if the product is visible in the list of products within a selection from a purchase order line."),
'state': fields.selection([('',''),('draft', 'In Development'),('sellable','In Production'),('end','End of Lifecycle'),('obsolete','Obsolete')], 'Status', help="Tells the user if he can use the product or not."),
'uom_id': fields.many2one('product.uom', 'Default UoM', required=True, help="Default Unit of Measure used for all stock operation."),
'uom_po_id': fields.many2one('product.uom', 'Purchase UoM', required=True, help="Default Unit of Measure used for purchase orders. It must in the same category than the default unit of measure."),
'state': fields.selection([('',''),('draft', 'In Development'),('sellable','In Production'),('end','End of Lifecycle'),('obsolete','Obsolete')], 'Status', help="Tells the user if he can use the product or not."),
'uos_id' : fields.many2one('product.uom', 'Unit of Sale',
help='Used by companies that manages two unit of measure: invoicing and stock management. For example, in food industries, you will manage a stock of ham but invoice in Kg. Keep empty to use the default UOM.'),
'uos_coeff': fields.float('UOM -> UOS Coeff', digits=(16,4),
@ -284,6 +284,15 @@ class product_template(osv.osv):
return context['categ_id']
return False
def onchange_uom(self, cursor, user, ids, uom_id,uom_po_id):
if uom_id and uom_po_id:
uom_obj=self.pool.get('product.uom')
uom=uom_obj.browse(cursor,user,[uom_id])[0]
uom_po=uom_obj.browse(cursor,user,[uom_po_id])[0]
if uom.category_id.id != uom_po.category_id.id:
return {'value': {'uom_po_id': uom_id}}
return False
_defaults = {
'company_id': lambda self, cr, uid, context: \
self.pool.get('res.users').browse(cr, uid, uid,

View File

@ -61,7 +61,7 @@ def _compute_tasks(cr, uid, task_list, date_begin):
tasks[task.id] = []
res = pooler.get_pool(cr.dbname).get('hr.timesheet.group').interval_get(cr, uid, task.project_id.timesheet_id.id, date_start, task.planned_hours)
for (d1,d2) in res:
tasks[task.id].append((d1, d2, task.name.decode('utf8'), task.user_id.login))
tasks[task.id].append((d1, d2, task.name, task.user_id.login))
date_close = tasks[task.id][-1][1]
# Store result

View File

@ -375,4 +375,4 @@
<font color="white"> </font>
</para>
</story>
</document>
</document>