[FIX] better responsibilities on objects POS
authorFabien Pinckaers <fp@openerp.com>
Thu, 21 Aug 2014 08:38:21 +0000 (10:38 +0200)
committerFabien Pinckaers <fp@openerp.com>
Thu, 21 Aug 2014 08:38:21 +0000 (10:38 +0200)
addons/account/account_cash_statement.py
addons/point_of_sale/point_of_sale.py

index 5c6e4ef..f01e95c 100644 (file)
@@ -77,7 +77,10 @@ class account_cash_statement(osv.osv):
         """
         res = {}
         for statement in self.browse(cr, uid, ids, context=context):
-            if (statement.journal_id.type not in ('cash',)) or (not statement.journal_id.cash_control):
+            if (statement.journal_id.type not in ('cash',)):
+                continue
+            if not statement.journal_id.cash_control:
+                statement.write({'balance_end_real' : statement.balance_end})
                 continue
             start = end = 0
             for line in statement.details_ids:
index 4cdf7be..bdfdf4f 100644 (file)
@@ -461,20 +461,6 @@ class pos_session(osv.osv):
                 if (st.journal_id.type not in ['bank', 'cash']):
                     raise osv.except_osv(_('Error!'), 
                         _("The type of the journal for your payment method should be bank or cash "))
-                if st.difference and st.journal_id.cash_control == True:
-                    if st.difference > 0.0:
-                        name= _('Point of Sale Profit')
-                    else:
-                        name= _('Point of Sale Loss')
-                    bsl.create(cr, uid, {
-                        'statement_id': st.id,
-                        'amount': st.difference,
-                        'ref': record.name,
-                        'name': name,
-                        'journal_id': st.journal_id.id,
-                    }, context=context)
-
-                st.write({'balance_end_real': st.balance_end}) # will update balances for cash statements
                 getattr(st, 'button_confirm_%s' % st.journal_id.type)(context=context)
         self._confirm_orders(cr, uid, ids, context=context)
         self.write(cr, uid, ids, {'state' : 'closed'}, context=context)