[6.0/6.1/trunk] Audittrail : read_group should be skipped just like others!

Bug #1013229 reported by [SISB] Edgar Rivero
24
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Status tracked in Trunk
6.0
Won't Fix
Undecided
Unassigned
6.1
Fix Committed
Medium
OpenERP Publisher's Warranty Team
Trunk
Fix Released
Medium
OpenERP R&D Addons Team 1

Bug Description

Having installed Audittrail:

1.- I'll Administration > Configuration > Audit Rules
2.- I think a new rule on Journal Items, scoring: Log Writes, Log Deletes, Log Creates and Action Log.
3.- I'll Accounting > Journal Entries > Journal Items
4.- I select Group by...

And anyone who select generate the following error.

Traceback (most recent call last):
  File "/home/xxxx/oerp/6.0/server/bin/netsvc.py", line 489, in dispatch
    result = ExportService.getService(service_name).dispatch(method, auth, params)
  File "/home/xxxx/oerp/6.0/server/bin/service/web_services.py", line 599, in dispatch
    res = fn(db, uid, *params)
  File "/home/xxxx/oerp/6.0/modules/audittrail/audittrail.py", line 522, in execute
    res = my_fct(db, uid, model, method, *args)
  File "/home/xxxx/oerp/6.0/modules/audittrail/audittrail.py", line 518, in my_fct
    return self.log_fct(db, uid_orig, model, method, fct_src, *args)
  File "/home/xxxx/oerp/6.0/modules/audittrail/audittrail.py", line 423, in log_fct
    for resource in resource_pool.read(cr, uid, res_ids):
  File "/home/xxxx/oerp/6.0/server/bin/osv/orm.py", line 2944, in read
    result = self._read_flat(cr, user, select, fields, context, load)
  File "/home/xxxx/oerp/6.0/server/bin/osv/orm.py", line 3003, in _read_flat
    cr.execute(query, (tuple(sub_ids),))
  File "/home/xxxx/oerp/6.0/server/bin/sql_db.py", line 78, in wrapper
    return f(self, *args, **kwargs)
  File "/home/xxxx/oerp/6.0/server/bin/sql_db.py", line 131, in execute
    res = self._obj.execute(query, params)
ProgrammingError: arguments IN must be expressions of records registration
LÍNEA 1: ...OM "account_move_line" WHERE account_move_line.id IN ((E'mov...

Related branches

Revision history for this message
Ravish(OpenERP) (rmu-openerp) wrote :

Hello Edgar,

I have checked your issue in both stable_6 as well in stable_6_1 .But for me it's working fine .

My testing revision are as follows

Server: 3624
Client: 1952
Addons: 5260

Please provide video or screen shot of your scenario .!!

Waiting for your reply

Thanks..!!

Changed in openobject-addons:
status: New → Incomplete
Revision history for this message
[SISB] Edgar Rivero (erivero) wrote :

Hello Ravish,

We add a video to the error.

My versions are:

Server: 5265
Client-Web: 4833
Addons: 5265

Greeting

Revision history for this message
Ravish(OpenERP) (rmu-openerp) wrote :

Hello Edgar,

Thanks for valuable information

But This issue is only effecting in stable_6. working fine with stable 6_1 as well with trunk .
As per our bug policy for stable_6 . It's not blocking point . So we can't validated it.

If you have our support and maintenance contracts then you can contact them at <email address hidden>

Thanks for reporting..!!

Changed in openobject-addons:
status: Incomplete → Opinion
status: Opinion → Invalid
status: Invalid → Won't Fix
Changed in openobject-addons:
status: Won't Fix → Confirmed
assignee: nobody → OpenERP R&D Addons Team 1 (openerp-dev-addons1)
importance: Undecided → Medium
summary: - Audittrail y groub_by cause error
+ [6.0/6.1/trunk] Audittrail : read_group should be skipped just like
+ others!
Revision history for this message
Serpent Consulting Services (serpent-consulting-services) wrote :

Hello Reader,

On a very first note, thanks to Edgar Rivero who noticed this out and brought into attention.

This is a real bug when audittrail is supposed to audit the model on which have set 'action' (log action) to be audited.

As a rule of thumb, system is supposed to skip some methods which are not going to alter any data such as name_get, name_search, default_get, etc.

Among such methods, read_group has been forgotten by audittrail.

You won't face any error if you do a group by on audited model( consider any example like partner). But if you do a group by on a model with some domains(any filter is pressed or a custom search applied like name ilike 'ax' any comfortable search), system is supposed to pass domain as the very first argument and at the end of audittrail,it always expects a set of ids to be read(read as red), causing into a traceback as shown by Edgar.

EXAMPLE : Subscribe rule for Partner, log action. Do a simple groupby after clicking clear--> No error. Click any filter or do any search --> You will face an error which would say the DOMAIN is supposedly set as IDS for read() call.

Hence, in future if any method is added/edited in ORM, we have to make sure that the first argument if not IDS, should either be skipped for audittrail or managed as a special case(just like create).

This should surely help.

Regards,
Serpent Consulting Services.
http://www.serpentcs.com

Revision history for this message
Serpent Consulting Services (serpent-consulting-services) wrote :

Luckily, I have an example called 'import_data' . Just to face such an issue with this, do a simple import from GUI for the model which has been subscribed by you for audit.

EXAMPLE : Thanks for doing the first example. Carrying that forward, create a simple CSV with id,name as first line and 'test','OpenERP' as second line which means you are going to enter a partner called OpenERP. Load the CSV for import, press Import button and there you are! System tried to read assuming ids as first argument but first argument is a list of fields to be set for import.

And yes, this is a bug for 6.0, 6.1 and trunk till the correction is made.

Hope to get this resolved in all versions.

Merge proposals have been attached.

Thanks.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.