Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Audit Trail impedes deleting journal entries (account.move)

By
Manuel Vázquez Acosta
on 2/11/14, 1:16 PM 1,494 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.

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

Manuel Vázquez Acosta
on 2/11/14, 1:34 PM
0

Martin Trigaux (mat)

--Martin Trigaux (mat)--
1775
| 6 4 7
Grand Rosiere, Belgium
--Martin Trigaux (mat)--

Community manager: help with the code and translations contributions from the community on GitHub and Transifex.

Developed the gamification module and is also now responsible of the documentation and Point of Sale.

Martin Trigaux (mat)
On 3/12/14, 7:27 AM

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

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 2/11/14, 1:16 PM
Seen: 1494 times
Last updated: 3/16/15, 8:10 AM