Hardik Ansodariya (OpenERP) has proposed merging
lp:~openerp-dev/openobject-addons/6.0-opw-574885-han into
lp:openobject-addons/6.0.
Requested reviews:
Naresh(OpenERP) (nch-openerp)
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-574885-han/+merge/109094
Hello,
I have replaced state field from related to function in order to avoid error
when write access is not given on relational table.
with reference to Maintenance case: 574885
Thanks
--
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-574885-han/+merge/109094
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/6.0-opw-574885-han.
=== modified file 'hr_timesheet/wizard/hr_timesheet_sign_in_out.py'
--- hr_timesheet/wizard/hr_timesheet_sign_in_out.py 2012-01-18 08:50:14 +0000
+++ hr_timesheet/wizard/hr_timesheet_sign_in_out.py 2012-06-07 09:45:26 +0000
@@ -26,6 +26,16 @@
class hr_so_project(osv.osv_memory):
_name = 'hr.sign.out.project'
_description = 'Sign Out By Project'
+
+ def _state(self, cr, uid, ids, name, context, *a):
+ vals = {}
+ for emp in self.browse(cr, uid, ids, context):
+ vals[emp.id] = emp.emp_id.state
+ return vals
+
+ #State field is replaced from related to function because when it called from default it was trying to update on
+ #relational object and when write access is not given on that object it was generating Access Error
+ #TODO
_columns = {
'account_id': fields.many2one('account.analytic.account', 'Analytic Account', domain=[('type','=','normal')]),
'info': fields.char('Work Description', size=256, required=True),
@@ -33,7 +43,7 @@
'date': fields.datetime('Closing Date'),
'analytic_amount': fields.float('Minimum Time Interval', help='This field rounds to the minimum interval specified.\n Example: specify 0.25 and work less than 15 minutes, the working time will be rounded to 15 minutes. If you work 25 minutes, time will be rounded to 30 minutes.'),
'name': fields.char('Employees name', size=32, required=True, readonly=True),
- 'state': fields.related('emp_id', 'state', string='Current state', type='char', required=True, readonly=True),
+ 'state': fields.function(_state, method=True, string='State', type='char', select=1, size=32),
'server_date': fields.datetime('Current Date', required=True, readonly=True),
'emp_id': fields.many2one('hr.employee', 'Employee ID')
}
@@ -109,9 +119,19 @@
_name = 'hr.sign.in.project'
_description = 'Sign In By Project'
+
+ def _state(self, cr, uid, ids, context, *a):
+ vals = {}
+ for emp in self.browse(cr, uid, ids, context):
+ vals[emp.id] = emp.emp_id.state
+ return vals
+
+ #State field is replaced from related to function because when it called from default it was trying to update on
+ #relational object and when write access is not given on that object it was generating Access Error
+ #TODO
_columns = {
'name': fields.char('Employees name', size=32, readonly=True),
- 'state': fields.related('emp_id', 'state', string='Current state', type='char', required=True, readonly=True),
+ 'state': fields.function(_state, method=True, string='State', type='char', select=1, size=32),
'date': fields.datetime('Starting Date'),
'server_date': fields.datetime('Current Date', readonly=True),
'emp_id': fields.many2one('hr.employee', 'Employee 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