This question has been flagged
1 Reply
5243 Views

I've been requested to active the 'Skip "Draft" state ...' option for several journals, at the same time I've been asked to allow cancelation of entries in those journal, and activate the audit trail for the account entries (object account.move). I thought activating the audit trail module would give the option of keeping a trail if someone deletes an entry, but after I installed the module, pressing the delete button raises an error:

Traceback (most recent call last):
  File "/.../openerp/openerp/netsvc.py", line 292, in dispatch_rpc
    result = ExportService.getService(service_name).dispatch(method, params)
  File "/.../openerp/openerp/service/web_services.py", line 626, in dispatch
    res = fn(db, uid, *params)
  File "/.../openerp/openerp/osv/osv.py", line 190, in execute_kw
    return self.execute(db, uid, obj, method, *args, **kw or {})
  File "/.../openerp/openerp/osv/osv.py", line 132, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/.../openerp/openerp/osv/osv.py", line 199, in execute
    res = self.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/.../openerp/openerp/addons/audittrail/audittrail.py", line 513, in execute_cr
    return self.log_fct(cr, uid, model, method, fct_src, *args, **kw)
  File "/.../openerp/openerp/addons/audittrail/audittrail.py", line 303, in log_fct
    self.process_data(cr, uid_orig, pool, res_ids, model, method, old_values, new_values, field_list)
  File "/.../openerp/openerp/addons/audittrail/audittrail.py", line 462, in process_data
    name = pool.get(model.model).name_get(cr, uid, [resource_id])[0][1]
  File "/.../openerp/openerp/addons/account/account.py", line 1236, in name_get
    if move.state=='draft':
  File "/.../openerp/openerp/osv/orm.py", line 499, in __getattr__
    raise AttributeError(e)
AttributeError: 'Field state not found in browse_record(account.move, 33)'
> /.../openerp/openerp/osv/orm.py(499)__getattr__()
-> raise AttributeError(e)

Is this a bug? Probably since without the audittrail module installed, it is possible to delete an entry.

Avatar
Discard
Author

Probably related bug https://bugs.launchpad.net/openobject-addons/+bug/1093467 -- However the bug has been around for quite a long time.

Best Answer

Hello,

This was an issue in the selected model. It was fixed at the revision 9808 in addons 7.0.

-pool.get(model.model).name_get(cr, uid, [resource_id])[0][1]
+line_model = pool.get('ir.model').browse(cr, SUPERUSER_ID, model_id).model
+name = pool.get(line_model).name_get(cr, uid, [resource_id])[0][1]

If you got this error 14th of Februray, it means you are probably not up to date (fixed 4/2/2014).

Regards

Avatar
Discard