summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephane Wirtel <stw@openerp.com>2012-07-31 12:54:02 +0200
committerStephane Wirtel <stw@openerp.com>2012-07-31 12:54:02 +0200
commitc82a87bbd85f3cedde4e058c90f39ea3d634aab4 (patch)
tree695cf201151e5121c9b2e86a341a75b39a3a5a7b
parent84ea8f59d703c4b5e8dfb0fdde4468ac0a7b410c (diff)
[FIX] hr_timesheet_invoice: Add the default values for the account journal and the account in the account.analytic.line (Invoice Tasks Work)
bzr revid: stw@openerp.com-20120731105402-wqq9qv5db1si6na9
-rw-r--r--addons/hr_timesheet_invoice/hr_timesheet_invoice.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py
index 54257f5efba..a4f08a854ec 100644
--- a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py
+++ b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py
@@ -126,6 +126,25 @@ class account_analytic_line(osv.osv):
'to_invoice': fields.many2one('hr_timesheet_invoice.factor', 'Type of Invoicing', help="It allows to set the discount while making invoice"),
}
+ def _default_journal(self, cr, uid, context=None):
+ proxy = self.pool.get('hr.employee')
+ record_ids = proxy.search(cr, uid, [('user_id', '=', uid)], context=context)
+ employee = proxy.browse(cr, uid, record_ids[0], context=context)
+ return employee.journal_id and employee.journal_id.id or False
+
+ def _default_general_account(self, cr, uid, context=None):
+ proxy = self.pool.get('hr.employee')
+ record_ids = proxy.search(cr, uid, [('user_id', '=', uid)], context=context)
+ employee = proxy.browse(cr, uid, record_ids[0], context=context)
+ if employee.product_id and employee.product_id.property_account_income:
+ return employee.product_id.property_account_income.id
+ return False
+
+ _defaults = {
+ 'journal_id' : _default_journal,
+ 'general_account_id' : _default_general_account,
+ }
+
def write(self, cr, uid, ids, vals, context=None):
self._check_inv(cr, uid, ids, vals)
return super(account_analytic_line,self).write(cr, uid, ids, vals,