From e55c51fe4028defad63dc576c1115240cb286108 Mon Sep 17 00:00:00 2001 From: "Dharti Ratani (Open ERP)" Date: Thu, 24 Apr 2014 15:24:29 +0530 Subject: [PATCH 1/3] [FIX]Fixed the issue of no audit logs for an object for which audittrail rule is created with Log Read as true --- addons/audittrail/audittrail.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/addons/audittrail/audittrail.py b/addons/audittrail/audittrail.py index b68a8e201c6..3dcc72679a8 100644 --- a/addons/audittrail/audittrail.py +++ b/addons/audittrail/audittrail.py @@ -425,6 +425,11 @@ class audittrail_objects_proxy(object_proxy): res_ids.remove(resource_id) for res_id in res_ids: lines.update(self.prepare_audittrail_log_line(cr, SUPERUSER_ID, pool, x2m_model, res_id, method, old_values, new_values, field_list)) + data={ + 'name': field_name, + 'old_value': key in old_values and old_values[key]['value'].get(field_name), + 'old_value_text': key in old_values and old_values[key]['text'].get(field_name) + } # if the value value is different than the old value: record the change if key not in old_values or key not in new_values or old_values[key]['value'][field_name] != new_values[key]['value'][field_name]: data = { @@ -434,7 +439,7 @@ class audittrail_objects_proxy(object_proxy): 'new_value_text': key in new_values and new_values[key]['text'].get(field_name), 'old_value_text': key in old_values and old_values[key]['text'].get(field_name) } - lines[key].append(data) + lines[key].append(data) return lines def process_data(self, cr, uid, pool, res_ids, model, method, old_values=None, new_values=None, field_list=None): From 428e292300b9f1929182d5a5414fb54aecc9a8d7 Mon Sep 17 00:00:00 2001 From: "Dharti Ratani (Open ERP)" Date: Mon, 19 May 2014 17:39:24 +0530 Subject: [PATCH 2/3] [IMP]Improved as per the comment --- addons/audittrail/audittrail.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/addons/audittrail/audittrail.py b/addons/audittrail/audittrail.py index 3dcc72679a8..64e6b5b58dd 100644 --- a/addons/audittrail/audittrail.py +++ b/addons/audittrail/audittrail.py @@ -425,11 +425,6 @@ class audittrail_objects_proxy(object_proxy): res_ids.remove(resource_id) for res_id in res_ids: lines.update(self.prepare_audittrail_log_line(cr, SUPERUSER_ID, pool, x2m_model, res_id, method, old_values, new_values, field_list)) - data={ - 'name': field_name, - 'old_value': key in old_values and old_values[key]['value'].get(field_name), - 'old_value_text': key in old_values and old_values[key]['text'].get(field_name) - } # if the value value is different than the old value: record the change if key not in old_values or key not in new_values or old_values[key]['value'][field_name] != new_values[key]['value'][field_name]: data = { @@ -439,7 +434,15 @@ class audittrail_objects_proxy(object_proxy): 'new_value_text': key in new_values and new_values[key]['text'].get(field_name), 'old_value_text': key in old_values and old_values[key]['text'].get(field_name) } - lines[key].append(data) + lines[key].append(data) + # On read log add current values for fields. + if method == 'read': + data={ + 'name': field_name, + 'old_value': key in old_values and old_values[key]['value'].get(field_name), + 'old_value_text': key in old_values and old_values[key]['text'].get(field_name) + } + lines[key].append(data) return lines def process_data(self, cr, uid, pool, res_ids, model, method, old_values=None, new_values=None, field_list=None): From a8a085eabbc477989676f7262da59e2f30952e4e Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Mon, 19 May 2014 15:33:39 +0200 Subject: [PATCH 3/3] [FIX] point_of_sale: opw-607551, mark the pos order as paid before trying to create the picking, so in case the picking could not be created for one reason or another, the pos order workflow process continue. This commit partially reverts rev. 6036 revid:fp@tinyerp.com-20111219220053-tn5gc1lmc13fjpyf, the second part of this commit already has been revert in a previous revision. --- addons/point_of_sale/point_of_sale.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/addons/point_of_sale/point_of_sale.py b/addons/point_of_sale/point_of_sale.py index 76c48d24f80..2768cf8aa44 100644 --- a/addons/point_of_sale/point_of_sale.py +++ b/addons/point_of_sale/point_of_sale.py @@ -537,7 +537,7 @@ class pos_order(osv.osv): try: wf_service.trg_validate(uid, 'pos.order', order_id, 'paid', cr) except Exception: - _logger.error('ERROR: Could not mark POS Order as Paid.', exc_info=True) + _logger.error('ERROR: Could not fully process the POS Order', exc_info=True) return order_ids def write(self, cr, uid, ids, vals, context=None): @@ -692,8 +692,6 @@ class pos_order(osv.osv): move_obj = self.pool.get('stock.move') for order in self.browse(cr, uid, ids, context=context): - if not order.state=='draft': - continue addr = order.partner_id and partner_obj.address_get(cr, uid, [order.partner_id.id], ['delivery']) or {} picking_id = picking_obj.create(cr, uid, { 'origin': order.name, @@ -1136,8 +1134,8 @@ class pos_order(osv.osv): return self.write(cr, uid, ids, {'state': 'payment'}, context=context) def action_paid(self, cr, uid, ids, context=None): - self.create_picking(cr, uid, ids, context=context) self.write(cr, uid, ids, {'state': 'paid'}, context=context) + self.create_picking(cr, uid, ids, context=context) return True def action_cancel(self, cr, uid, ids, context=None):