[IMP] config wizards: add buttons Cancel and Apply on forms
[odoo/odoo.git] / addons / hr_timesheet / hr_timesheet.py
old mode 100755 (executable)
new mode 100644 (file)
index 65310cd..1e15e5b
@@ -30,7 +30,8 @@ class hr_employee(osv.osv):
     _inherit = "hr.employee"
     _columns = {
         'product_id': fields.many2one('product.product', 'Product', help="Specifies employee's designation as a product with type 'service'."),
-        'journal_id': fields.many2one('account.analytic.journal', 'Analytic Journal')
+        'journal_id': fields.many2one('account.analytic.journal', 'Analytic Journal'),
+        'uom_id': fields.related('product_id', 'uom_id', type='many2one', relation='product.uom', string='UoM', store=True, readonly=True)
     }
 
     def _getAnalyticJournal(self, cr, uid, context=None):
@@ -45,7 +46,7 @@ class hr_employee(osv.osv):
     def _getEmployeeProduct(self, cr, uid, context=None):
         md = self.pool.get('ir.model.data')
         try:
-            result = md.get_object_reference(cr, uid, 'hr_timesheet', 'product_consultant')
+            result = md.get_object_reference(cr, uid, 'product', 'product_consultant')
             return result[1]
         except ValueError:
             pass
@@ -65,8 +66,8 @@ class hr_analytic_timesheet(osv.osv):
     _inherits = {'account.analytic.line': 'line_id'}
     _order = "id desc"
     _columns = {
-        'line_id': fields.many2one('account.analytic.line', 'Analytic line', ondelete='cascade', required=True),
-        'partner_id': fields.related('account_id', 'partner_id', type='many2one', string='Partner Id', relation='res.partner', store=True),
+        'line_id': fields.many2one('account.analytic.line', 'Analytic Line', ondelete='cascade', required=True),
+        'partner_id': fields.related('account_id', 'partner_id', type='many2one', string='Partner', relation='res.partner', store=True),
     }
 
     def unlink(self, cr, uid, ids, context=None):
@@ -148,7 +149,7 @@ class hr_analytic_timesheet(osv.osv):
         'product_id': _getEmployeeProduct,
         'general_account_id': _getGeneralAccount,
         'journal_id': _getAnalyticJournal,
-        'date': lambda self, cr, uid, ctx: ctx.get('date', time.strftime('%Y-%m-%d')),
+        'date': lambda self, cr, uid, ctx: ctx.get('date', fields.date.context_today(self,cr,uid,context=ctx)),
         'user_id': lambda obj, cr, uid, ctx: ctx.get('user_id', uid),
     }
     def on_change_account_id(self, cr, uid, ids, account_id):