'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'procurement.order', context=c)
}
+ def message_track(self, cr, uid, ids, tracked_fields, initial_values, context=None):
+ """ Overwrite message_track to avoid tracking more than once the confirm-exception loop
+ Add '_first_pass_done_' to the note field only the first time stuck in exception state
+ Will avoid getting furthur confirmed and exception change of state messages
+
+ TODO: this hack is necessary for a stable version but should be avoided for the next release.
+ Instead find a more elegant way to prevent redundant messages or entirely stop tracking states on procurement orders
+ """
+ for proc in self.browse(cr, uid, ids, context=context):
+ if not proc.note or '_first_pass_done_' not in proc.note or proc.state not in ('confirmed', 'exception'):
+ super(procurement_order, self).message_track(cr, uid, [proc.id], tracked_fields, initial_values, context=context)
+ if proc.state == 'exception':
+ cr.execute("""UPDATE procurement_order set note = CONCAT(note, %s) WHERE id = %s""", ('_first_pass_done_',proc.id))
+
+ return True
+
def unlink(self, cr, uid, ids, context=None):
procurements = self.read(cr, uid, ids, ['state'], context=context)
unlink_ids = []