Khushboo Bhatt(openerp) has proposed merging
lp:~openerp-dev/openobject-addons/trunk-project-apa-project-timesheet-kbh into
lp:~openerp-dev/openobject-addons/trunk-project-apa.
Requested reviews:
Amit Patel (OpenERP) (apa-tiny)
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-project-apa-project-timesheet-kbh/+merge/129621
Hello,
Project_timesheet:
I have added method for setting default values for account and product when
creating invoice task work.
Thanks,
KBH.
--
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-project-apa-project-timesheet-kbh/+merge/129621
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/trunk-project-apa.
=== modified file 'project_timesheet/project_timesheet.py'
--- project_timesheet/project_timesheet.py 2012-10-03 14:38:09 +0000
+++ project_timesheet/project_timesheet.py 2012-10-15 09:00:39 +0000
@@ -272,6 +272,27 @@
class account_analytic_line(osv.osv):
_inherit = "account.analytic.line"
+ def _default_account_id(self, cr, uid, context=None):
+ proxy = self.pool.get('account.analytic.account')
+ record_ids = proxy.search(cr, uid, [('user_id', '=', uid)], context=context)
+ employee = proxy.browse(cr, uid, record_ids[0], context=context)
+ if employee:
+ return employee.id
+ return False
+
+ def _default_product(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:
+ return employee.product_id.id
+ return False
+
+ _defaults = {
+ 'product_id': _default_product,
+ 'account_id': _default_account_id
+ }
+
def on_change_account_id(self, cr, uid, ids, account_id):
res = {}
if not account_id:
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp