[PYTHON] +override closing date for bank statements
[burette/nrt_point_of_sale.git] / point_of_sale.py
index 70f7c3f..71b2eb6 100644 (file)
@@ -75,15 +75,12 @@ class pos_session(orm.Model):
 
     def wkf_action_closing_control(self, cr, uid, ids, context=None):
         """
-        Disable default start_at date
-        Piece of this code was copied from
-        addons/point_of_sale/point_of_sale.py:397
+        Put same stop_at date in pos_session as its start_at date
         """
+        res = super(pos_session, self).wkf_action_closing_control(cr, uid, ids, context=context)
         for session in self.browse(cr, uid, ids, context=context):
-            for statement in session.statement_ids:
-                if (statement != session.cash_register_id) and (statement.balance_end != statement.balance_end_real):
-                    self.pool.get('account.bank.statement').write(cr, uid, [statement.id], {'balance_end_real': statement.balance_end})
-        return True
+            self.write(cr, uid, [session.id], {'stop_at': session.start_at}, context=context)
+        return res
 
     def onchange_start_at(self, cr, uid, ids, start_at, context=None):
         """Define same stop_at as start_at"""