[FIX] difference POS / Cash
authorFabien Pinckaers <fp@openerp.com>
Thu, 21 Aug 2014 08:54:38 +0000 (10:54 +0200)
committerFabien Pinckaers <fp@openerp.com>
Thu, 21 Aug 2014 08:54:38 +0000 (10:54 +0200)
addons/account/account_bank_statement.py
addons/account/account_cash_statement.py

index 4d9c3f3..cbbcd49 100644 (file)
@@ -24,6 +24,8 @@ from openerp.tools.translate import _
 import openerp.addons.decimal_precision as dp
 from openerp.report import report_sxw
 
+import time
+
 class account_bank_statement(osv.osv):
     def create(self, cr, uid, vals, context=None):
         if vals.get('name', '/') == '/':
@@ -348,7 +350,7 @@ class account_bank_statement(osv.osv):
                 self.pool.get('account.move').post(cr, uid, move_ids, context=context)
             self.message_post(cr, uid, [st.id], body=_('Statement %s confirmed, journal items were created.') % (st.name,), context=context)
         self.link_bank_to_partner(cr, uid, ids, context=context)
-        return self.write(cr, uid, ids, {'state': 'confirm'}, context=context)
+        return self.write(cr, uid, ids, {'state': 'confirm', 'closing_date': time.strftime("%Y-%m-%d %H:%M:%S")}, context=context)
 
     def button_cancel(self, cr, uid, ids, context=None):
         bnk_st_line_ids = []
index 0540d57..f30ce89 100644 (file)
@@ -299,7 +299,6 @@ class account_cash_statement(osv.osv):
         return state=='open'
 
     def button_confirm_cash(self, cr, uid, ids, context=None):
-        super(account_cash_statement, self).button_confirm_bank(cr, uid, ids, context=context)
         absl_proxy = self.pool.get('account.bank.statement.line')
 
         TABLES = ((_('Profit'), 'profit_account_id'), (_('Loss'), 'loss_account_id'),)
@@ -309,7 +308,7 @@ class account_cash_statement(osv.osv):
                 continue
 
             for item_label, item_account in TABLES:
-                if getattr(obj.journal_id, item_account):
+                if not getattr(obj.journal_id, item_account):
                     raise osv.except_osv(_('Error!'),
                                          _('There is no %s Account on the journal %s.') % (item_label, obj.journal_id.name,))
 
@@ -327,7 +326,7 @@ class account_cash_statement(osv.osv):
 
             absl_proxy.create(cr, uid, values, context=context)
 
-        return self.write(cr, uid, ids, {'closing_date': time.strftime("%Y-%m-%d %H:%M:%S")}, context=context)
+        return super(account_cash_statement, self).button_confirm_bank(cr, uid, ids, context=context)
 
 
 class account_journal(osv.osv):