Ejemplo n.º 1
0
 def add(customer, obj, event, note=None, user=None):
     stat = Status()
     stat.event = event
     if customer:
         stat.customer_id = customer.customer_id
     stat.fk_type = type(obj).__name__
     stat.fk_id = getattr(obj, obj.__pk__)
     stat.note = note
     stat.user = Session.merge(user) if user else None #pylint: disable-msg=E1101
     stat.save()
     if event.change_status:
         obj.status = stat
     obj.save()
     stat.flush()
     return stat