> For that, you need to do a small change:
> => replace the function
> self.create_log_line(cr, uid, log_id, model, lines)
> by
> self.create_log(cr, uid, model, lines)
>
> def create_log(self, cr, uid, model, lines=[]):
> if not lines:
> return True
> vals = { ... }
> vals['lines] = [(0, 0, { ... }), ...]
> return self.pool.get('audittrail.log').create(cr, uid, vals, context)
>
hmm...cannot do that because lines will always be there just the difference is
whether the new values is equal to the old value or not if its equal don't
create log line ignore it else create it. but of-cause there is a scope of
improvement here by checking the condition before appending the lines. and also
create the log entry only if there is atleast 1 line.
>
> > - one write on res.partner.address with the data you just created
> > (incorrect, the method logged should be 'create' instead of 'write',
> otherwise
> > it's ok)
> i know, but it's not a argument. You can force the method to use. For example,
> try to add those 2 lines (it seems doing the trick but i didn't test
> completly):
> === modified file 'audittrail/audittrail.py'
> --- audittrail/audittrail.py 2011-11-08 16:55:34 +0000
> +++ audittrail/audittrail.py 2011-11-09 09:43:22 +0000
> @@ -354,6 +357,8 @@
> vals = {'method': method,'object_id': model.id,'user_id':
> uid_orig }
> for resource in resource_data:
> resource_id = resource['id']
> + if resource_id not in dict_to_use.keys():
> + vals.update({'method': 'create'})
> vals.update({'res_id': resource_id})
> log_id = log_pool.create(cr, uid, vals)
> lines = []
yup, didn't think of this hack !
Regards,
Naresh
--
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-832635-nch/+merge/77861
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/trunk-bug-832635-nch.
_______________________________________________
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