Browse Source

commit inicial

Rodney Enciso Arias 7 years ago
commit
00c9c40fc9
5 changed files with 63 additions and 0 deletions
  1. 2 0
      __init__.py
  2. BIN
      __init__.pyc
  3. 20 0
      __openerp__.py
  4. 41 0
      account_bank_statement.py
  5. BIN
      account_bank_statement.pyc

+ 2 - 0
__init__.py

@@ -0,0 +1,2 @@
+# -*- encoding: utf-8 -*-
+from . import account_bank_statement

BIN
__init__.pyc


+ 20 - 0
__openerp__.py

@@ -0,0 +1,20 @@
+{
+    "name": "Account Bank Statement Fix",
+    "version": "8.0.1.2.0",
+    'author':  'EIRU',
+    'website': 'www.eiru.com.py',
+    'license': 'AGPL-3',
+    "category": "Accounting",
+    "description": """
+    
+    """,
+    'depends': [
+        'account'
+        ],
+    'data': [
+
+        ],
+    'demo': [],
+    'test': [],
+    'installable': True,
+}

+ 41 - 0
account_bank_statement.py

@@ -0,0 +1,41 @@
+# -*- coding: utf-8 -*-
+import time
+
+from openerp.osv import fields, osv
+from openerp.tools import float_compare
+from openerp.tools.translate import _
+import openerp.addons.decimal_precision as dp
+
+class AccountBankStatement(osv.osv):
+    _inherit = "account.bank.statement"
+
+    def button_confirm_cash(self, cr, uid, ids, context=None):
+        absl_proxy = self.pool.get('account.bank.statement.line')
+
+        TABLES = ((_('Profit'), 'profit_account_id'), (_('Loss'), 'loss_account_id'),)
+
+        for obj in self.browse(cr, uid, ids, context=context):
+            obj.difference = 0.0
+            if obj.difference == 0.0:
+                continue
+            elif obj.difference < 0.0:
+                account = obj.journal_id.loss_account_id
+                name = _('Loss')
+                if not obj.journal_id.loss_account_id:
+                    raise osv.except_osv(_('Error!'), _('There is no Loss Account on the journal %s.') % (obj.journal_id.name,))
+            else: # obj.difference > 0.0
+                account = obj.journal_id.profit_account_id
+                name = _('Profit')
+                if not obj.journal_id.profit_account_id:
+                    raise osv.except_osv(_('Error!'), _('There is no Profit Account on the journal %s.') % (obj.journal_id.name,))
+
+            values = {
+                'statement_id' : obj.id,
+                'journal_id' : obj.journal_id.id,
+                'account_id' : account.id,
+                'amount' : obj.difference,
+                'name' : name,
+            }
+            absl_proxy.create(cr, uid, values, context=context)
+
+        return super(AccountBankStatement, self).button_confirm_bank(cr, uid, ids, context=context)

BIN
account_bank_statement.pyc