diff --git a/addons/account/__openerp__.py b/addons/account/__openerp__.py
index ee9430a7334..3365a3d551e 100644
--- a/addons/account/__openerp__.py
+++ b/addons/account/__openerp__.py
@@ -80,6 +80,7 @@ module named account_voucherss
'wizard/account_aged_trial_balance_view.xml',
'wizard/account_compare_account_balance_report_view.xml',
'wizard/account_third_party_ledger.xml',
+ 'wizard/account_reconcile_view.xml',
'wizard/account_automatic_reconcile_view.xml',
'project/wizard/project_account_analytic_line_view.xml',
'account_end_fy.xml',
@@ -93,6 +94,9 @@ module named account_voucherss
'project/wizard/account_analytic_check_view.xml',
'project/wizard/account_analytic_balance_report_view.xml',
'project/wizard/account_analytic_cost_ledger_view.xml',
+ 'project/wizard/account_analytic_inverted_balance_report.xml',
+ 'project/wizard/account_analytic_journal_report_view.xml',
+ 'project/wizard/account_analytic_cost_ledger_for_journal_report_view.xml',
'product_view.xml',
'account_assert_test.xml',
'process/statement_process.xml',
@@ -117,4 +121,4 @@ module named account_voucherss
'active': False,
'certificate': '0080331923549',
}
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py
index 89268d68148..b9aa089942e 100644
--- a/addons/account/account_move_line.py
+++ b/addons/account/account_move_line.py
@@ -925,7 +925,7 @@ class account_move_line(osv.osv):
'account_id': vals.get('analytic_account_id', False),
'unit_amount': vals.get('quantity', 1.0),
'amount': vals.get('debit', 0.0) or vals.get('credit', 0.0),
- 'general_account_id': vals['account_id'],
+ 'general_account_id': vals.get('account_id', False),
'journal_id': journal.analytic_journal_id.id,
'ref': vals.get('ref', False),
})]
diff --git a/addons/account/account_wizard.xml b/addons/account/account_wizard.xml
index b80269ab6f1..8b093fb2310 100644
--- a/addons/account/account_wizard.xml
+++ b/addons/account/account_wizard.xml
@@ -47,7 +47,7 @@
-
+
diff --git a/addons/account/project/project_report.xml b/addons/account/project/project_report.xml
index 71353ba282f..ae6aedeaab1 100644
--- a/addons/account/project/project_report.xml
+++ b/addons/account/project/project_report.xml
@@ -3,7 +3,7 @@
-
+
@@ -13,7 +13,7 @@
-
+
@@ -23,7 +23,7 @@
-
+
diff --git a/addons/account/project/report/quantity_cost_ledger.py b/addons/account/project/report/quantity_cost_ledger.py
index c841c2131ab..12bea390eba 100644
--- a/addons/account/project/report/quantity_cost_ledger.py
+++ b/addons/account/project/report/quantity_cost_ledger.py
@@ -18,9 +18,9 @@
# along with this program. If not, see .
#
##############################################################################
+import time
import pooler
-import time
from report import report_sxw
class account_analytic_quantity_cost_ledger(report_sxw.rml_parse):
@@ -35,7 +35,7 @@ class account_analytic_quantity_cost_ledger(report_sxw.rml_parse):
})
def _lines_g(self, account_id, date1, date2, journals):
- if not journals or not journals[0][2]:
+ if not journals:
self.cr.execute("SELECT sum(aal.unit_amount) AS quantity, \
aa.code AS code, aa.name AS name, aa.id AS id \
FROM account_account AS aa, account_analytic_line AS aal \
@@ -45,7 +45,7 @@ class account_analytic_quantity_cost_ledger(report_sxw.rml_parse):
GROUP BY aa.code, aa.name, aa.id ORDER BY aa.code",
(account_id, date1, date2))
else:
- journal_ids = journals[0][2]
+ journal_ids = journals
self.cr.execute("SELECT sum(aal.unit_amount) AS quantity, \
aa.code AS code, aa.name AS name, aa.id AS id \
FROM account_account AS aa, account_analytic_line AS aal \
@@ -59,7 +59,7 @@ class account_analytic_quantity_cost_ledger(report_sxw.rml_parse):
return res
def _lines_a(self, general_account_id, account_id, date1, date2, journals):
- if not journals or not journals[0][2]:
+ if not journals:
self.cr.execute("SELECT aal.name AS name, aal.code AS code, \
aal.unit_amount AS quantity, aal.date AS date, \
aaj.code AS cj \
@@ -71,7 +71,7 @@ class account_analytic_quantity_cost_ledger(report_sxw.rml_parse):
ORDER BY aal.date, aaj.code, aal.code",
(general_account_id, account_id, date1, date2))
else:
- journal_ids = journals[0][2]
+ journal_ids = journals
self.cr.execute("SELECT aal.name AS name, aal.code AS code, \
aal.unit_amount AS quantity, aal.date AS date, \
aaj.code AS cj \
@@ -86,13 +86,13 @@ class account_analytic_quantity_cost_ledger(report_sxw.rml_parse):
return res
def _account_sum_quantity(self, account_id, date1, date2, journals):
- if not journals or not journals[0][2]:
+ if not journals:
self.cr.execute("SELECT sum(unit_amount) \
FROM account_analytic_line \
WHERE account_id=%s AND date>=%s AND date<=%s",
(account_id, date1, date2))
else:
- journal_ids = journals[0][2]
+ journal_ids = journals
self.cr.execute("SELECT sum(unit_amount) \
FROM account_analytic_line \
WHERE account_id = %s AND date >= %s AND date <= %s \
@@ -104,17 +104,17 @@ class account_analytic_quantity_cost_ledger(report_sxw.rml_parse):
ids = map(lambda x: x.id, accounts)
if not len(ids):
return 0.0
- if not journals or not journals[0][2]:
+ if not journals:
self.cr.execute("SELECT sum(unit_amount) \
FROM account_analytic_line \
WHERE account_id =ANY(%s) AND date>=%s AND date<=%s",
- (date1, date2,ids,))
+ (ids, date1, date2,))
else:
- journal_ids = journals[0][2]
+ journal_ids = journals
self.cr.execute("SELECT sum(unit_amount) \
FROM account_analytic_line \
WHERE account_id =ANY(%s) AND date >= %s AND date <= %s \
- AND journal_id =ANY(%s)",(ids,date1, date2,journal_ids))
+ AND journal_id =ANY(%s)",(ids, date1, date2, journal_ids))
return self.cr.fetchone()[0] or 0.0
report_sxw.report_sxw('report.account.analytic.account.quantity_cost_ledger',
@@ -122,6 +122,4 @@ report_sxw.report_sxw('report.account.analytic.account.quantity_cost_ledger',
'addons/account/project/report/quantity_cost_ledger.rml',
parser=account_analytic_quantity_cost_ledger, header=False)
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/account/project/wizard/__init__.py b/addons/account/project/wizard/__init__.py
index 242350daf14..3e087c9daaf 100644
--- a/addons/account/project/wizard/__init__.py
+++ b/addons/account/project/wizard/__init__.py
@@ -19,14 +19,13 @@
#
##############################################################################
-import wizard_account_analytic_journal_report
+import account_analytic_journal_report
import account_analytic_balance_report
-import wizard_account_analytic_inverted_balance_report
+import account_analytic_inverted_balance_report
import account_analytic_cost_ledger_report
-import wizard_account_analytic_cost_ledger_for_journal_report
+import account_analytic_cost_ledger_for_journal_report
import account_analytic_check
import project_account_analytic_line
import wizard_analytic_account_chart
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/account/project/wizard/account_analytic_cost_ledger_for_journal_report.py b/addons/account/project/wizard/account_analytic_cost_ledger_for_journal_report.py
new file mode 100644
index 00000000000..73dd38533c4
--- /dev/null
+++ b/addons/account/project/wizard/account_analytic_cost_ledger_for_journal_report.py
@@ -0,0 +1,105 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+import time
+
+from osv import osv, fields
+
+class account_analytic_cost_ledger_journal_report(osv.osv_memory):
+ _name = 'account.analytic.cost.ledger.journal.report'
+ _description = 'Account Analytic Cost Ledger For Journal Report'
+
+ _columns = {
+ 'date1': fields.date('Start of period', required=True),
+ 'date2': fields.date('End of period', required=True),
+ 'journal': fields.many2many('account.analytic.journal', 'ledger_journal_rel','ledger_id', 'Journal_id','Journals'),
+ }
+
+ _defaults = {
+ 'date1':time.strftime('%Y-01-01'),
+ 'date2':time.strftime('%Y-%m-%d')
+ }
+
+ def check_report(self, cr, uid, ids, context=None):
+ datas = {}
+ if context is None:
+ context = {}
+ data = self.read(cr, uid, ids)[0]
+ datas = {
+ 'ids': context.get('active_ids',[]),
+ 'model': 'account.analytic.account',
+ 'form': data
+ }
+ return {
+ 'type': 'ir.actions.report.xml',
+ 'report_name': 'account.analytic.account.quantity_cost_ledger',
+ 'datas': datas,
+ }
+
+account_analytic_cost_ledger_journal_report()
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
+#import time
+#import wizard
+#
+#_form = '''
+#'''
+#
+#_fields = {
+# 'date1': {'string':'Start of period', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-01-01')},
+# 'date2': {'string':'End of period', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-%m-%d')},
+# 'journal': {'string':'Journals','type':'many2many', 'relation':'account.analytic.journal'},
+#}
+#
+#
+#class wizard_report(wizard.interface):
+# states = {
+# 'init': {
+# 'actions': [],
+# 'result': {
+# 'type': 'form',
+# 'arch': _form,
+# 'fields': _fields,
+# 'state': [
+# ('end','Cancel'),
+# ('report','Print')
+# ]
+# }
+# },
+# 'report': {
+# 'actions': [],
+# 'result': {
+# 'type': 'print',
+# 'report': 'account.analytic.account.quantity_cost_ledger',
+# 'state': 'end'
+# }
+# },
+# }
+#
+#wizard_report('account.analytic.account.quantity_cost_ledger.report')
+#
+## vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
diff --git a/addons/account/project/wizard/account_analytic_cost_ledger_for_journal_report_view.xml b/addons/account/project/wizard/account_analytic_cost_ledger_for_journal_report_view.xml
new file mode 100644
index 00000000000..1ad974e8650
--- /dev/null
+++ b/addons/account/project/wizard/account_analytic_cost_ledger_for_journal_report_view.xml
@@ -0,0 +1,46 @@
+
+
+
+
+
+ Account Analytic Cost Ledger Journal
+ account.analytic.cost.ledger.journal.report
+ form
+
+
+
+
+
+
+ Cost Ledger (Only quantities)
+ ir.actions.act_window
+ account.analytic.cost.ledger.journal.report
+ form
+ form
+
+ new
+
+
+
+
+
+ Account Analytic Cost Ledger Journal
+ client_print_multi
+
+ action
+ account.analytic.account
+
+
+
+
\ No newline at end of file
diff --git a/addons/account/project/wizard/wizard_account_analytic_journal_report.py b/addons/account/project/wizard/account_analytic_inverted_balance_report.py
similarity index 51%
rename from addons/account/project/wizard/wizard_account_analytic_journal_report.py
rename to addons/account/project/wizard/account_analytic_inverted_balance_report.py
index 03be104469d..52f7da936fe 100644
--- a/addons/account/project/wizard/wizard_account_analytic_journal_report.py
+++ b/addons/account/project/wizard/account_analytic_inverted_balance_report.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
-#
+#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL ().
#
@@ -15,37 +15,42 @@
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
+# along with this program. If not, see .
#
##############################################################################
-
import time
-import wizard
-dates_form = '''
-'''
+from osv import osv, fields
-dates_fields = {
- 'date1': {'string':'Start of period', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-01-01')},
- 'date2': {'string':'End of period', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-%m-%d')},
-}
+class account_analytic_inverted_balance(osv.osv_memory):
+ _name = 'account.analytic.inverted.balance'
+ _description = 'Account Analytic Inverted Balance'
-class wizard_report(wizard.interface):
- states = {
- 'init': {
- 'actions': [],
- 'result': {'type':'form', 'arch':dates_form, 'fields':dates_fields, 'state':[('end','Cancel'), ('report','Print')]}
- },
- 'report': {
- 'actions': [],
- 'result': {'type':'print', 'report':'account.analytic.journal', 'state':'end'}
+ _columns = {
+ 'date1': fields.date('Start of period', required=True),
+ 'date2': fields.date('End of period', required=True),
}
- }
-wizard_report('account.analytic.account.journal.report')
+ _defaults = {
+ 'date1':time.strftime('%Y-01-01'),
+ 'date2':time.strftime('%Y-%m-%d')
+ }
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+ def check_report(self, cr, uid, ids, context=None):
+ datas = {}
+ if context is None:
+ context = {}
+ data = self.read(cr, uid, ids)[0]
+ datas = {
+ 'ids': context.get('active_ids',[]),
+ 'model': 'account.analytic.account',
+ 'form': data
+ }
+ return {
+ 'type': 'ir.actions.report.xml',
+ 'report_name': 'account.analytic.account.inverted.balance',
+ 'datas': datas,
+ }
+account_analytic_inverted_balance()
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/account/project/wizard/account_analytic_inverted_balance_report.xml b/addons/account/project/wizard/account_analytic_inverted_balance_report.xml
new file mode 100644
index 00000000000..e989f766d7b
--- /dev/null
+++ b/addons/account/project/wizard/account_analytic_inverted_balance_report.xml
@@ -0,0 +1,45 @@
+
+
+
+
+
+ Account Analytic Inverted Balance
+ account.analytic.inverted.balance
+ form
+
+
+
+
+
+
+ Inverted Analytic Balance
+ ir.actions.act_window
+ account.analytic.inverted.balance
+ form
+ form
+
+ new
+
+
+
+
+
+ Account Analytic Inverted Balance
+ client_print_multi
+
+ action
+ account.analytic.account
+
+
+
+
\ No newline at end of file
diff --git a/addons/account/project/wizard/wizard_account_analytic_inverted_balance_report.py b/addons/account/project/wizard/account_analytic_journal_report.py
similarity index 52%
rename from addons/account/project/wizard/wizard_account_analytic_inverted_balance_report.py
rename to addons/account/project/wizard/account_analytic_journal_report.py
index 9219a8ea9ae..aef6a85149d 100644
--- a/addons/account/project/wizard/wizard_account_analytic_inverted_balance_report.py
+++ b/addons/account/project/wizard/account_analytic_journal_report.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
-#
+#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL ().
#
@@ -15,38 +15,42 @@
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
+# along with this program. If not, see .
#
##############################################################################
-
import time
-import wizard
-dates_form = '''
-'''
+from osv import osv, fields
-dates_fields = {
- 'date1': {'string':'Start of period', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-01-01')},
- 'date2': {'string':'End of period', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-%m-%d')},
-}
+class account_analytic_Journal_report(osv.osv_memory):
+ _name = 'account.analytic.Journal.report'
+ _description = 'Account Analytic Journal'
-class wizard_report(wizard.interface):
- states = {
- 'init': {
- 'actions': [],
- 'result': {'type':'form', 'arch':dates_form, 'fields':dates_fields, 'state':[('end','Cancel'), ('report','Print')]}
- },
- 'report': {
- 'actions': [],
- 'result': {'type':'print', 'report':'account.analytic.account.inverted.balance', 'state':'end'}
+ _columns = {
+ 'date1': fields.date('Start of period', required=True),
+ 'date2': fields.date('End of period', required=True),
}
- }
-wizard_report('account.analytic.account.inverted.balance.report')
+ _defaults = {
+ 'date1':time.strftime('%Y-01-01'),
+ 'date2':time.strftime('%Y-%m-%d')
+ }
+ def check_report(self, cr, uid, ids, context=None):
+ datas = {}
+ if context is None:
+ context = {}
+ data = self.read(cr, uid, ids)[0]
+ datas = {
+ 'ids': context.get('active_ids',[]),
+ 'model': 'account.analytic.journal',
+ 'form': data
+ }
+ return {
+ 'type': 'ir.actions.report.xml',
+ 'report_name': 'account.analytic.journal',
+ 'datas': datas,
+ }
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
+account_analytic_Journal_report()
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/account/project/wizard/account_analytic_journal_report_view.xml b/addons/account/project/wizard/account_analytic_journal_report_view.xml
new file mode 100644
index 00000000000..137920ee056
--- /dev/null
+++ b/addons/account/project/wizard/account_analytic_journal_report_view.xml
@@ -0,0 +1,45 @@
+
+
+
+
+
+ Account Analytic Journal
+ account.analytic.Journal.report
+ form
+
+
+
+
+
+
+ Analytic Journal
+ ir.actions.act_window
+ account.analytic.Journal.report
+ form
+ form
+
+ new
+
+
+
+
+
+ Account Analytic Journal
+ client_print_multi
+
+ action
+ account.analytic.journal
+
+
+
+
\ No newline at end of file
diff --git a/addons/account/project/wizard/wizard_account_analytic_cost_ledger_for_journal_report.py b/addons/account/project/wizard/wizard_account_analytic_cost_ledger_for_journal_report.py
deleted file mode 100644
index feafab05a47..00000000000
--- a/addons/account/project/wizard/wizard_account_analytic_cost_ledger_for_journal_report.py
+++ /dev/null
@@ -1,68 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
-
-import time
-import wizard
-
-_form = '''
-'''
-
-_fields = {
- 'date1': {'string':'Start of period', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-01-01')},
- 'date2': {'string':'End of period', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-%m-%d')},
- 'journal': {'string':'Journals','type':'many2many', 'relation':'account.analytic.journal'},
-}
-
-
-class wizard_report(wizard.interface):
- states = {
- 'init': {
- 'actions': [],
- 'result': {
- 'type': 'form',
- 'arch': _form,
- 'fields': _fields,
- 'state': [
- ('end','Cancel'),
- ('report','Print')
- ]
- }
- },
- 'report': {
- 'actions': [],
- 'result': {
- 'type': 'print',
- 'report': 'account.analytic.account.quantity_cost_ledger',
- 'state': 'end'
- }
- },
- }
-
-wizard_report('account.analytic.account.quantity_cost_ledger.report')
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/account/wizard/__init__.py b/addons/account/wizard/__init__.py
index f42750f685d..39971f5c11a 100644
--- a/addons/account/wizard/__init__.py
+++ b/addons/account/wizard/__init__.py
@@ -22,7 +22,7 @@
import account_automatic_reconcile
import account_move_line_reconcile_select
import account_move_line_unreconcile_select
-import wizard_reconcile
+import account_reconcile
import account_unreconcile
import account_invoice_refund
import account_pay_invoice
diff --git a/addons/account/wizard/account_reconcile.py b/addons/account/wizard/account_reconcile.py
new file mode 100644
index 00000000000..1f745419c5a
--- /dev/null
+++ b/addons/account/wizard/account_reconcile.py
@@ -0,0 +1,207 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+import time
+import datetime
+
+from osv import fields, osv
+from tools.translate import _
+
+class account_move_line_reconcile_prompt(osv.osv_memory):
+ """
+ Asks user he wants to reconcile entries or not.
+ """
+ _name = 'account.move.line.reconcile.prompt'
+ _description = 'Account move line reconcile'
+ _columns = {
+ }
+
+ def ask_reconcilation(self, cr, uid, ids, context):
+ return self.pool.get('account.move.line.reconcile').partial_check(cr, uid, ids, context)
+
+account_move_line_reconcile_prompt()
+
+class account_move_line_reconcile(osv.osv_memory):
+ """
+ Account move line reconcile wizard, it checks for the write off the reconcile entry or directly reconcile.
+ """
+ _name = 'account.move.line.reconcile'
+ _description = 'Account move line reconcile'
+ _columns = {
+ 'trans_nbr': fields.integer('# of Transaction', readonly=True),
+ 'credit': fields.float('Credit amount',readonly=True),
+ 'debit': fields.float('Debit amount',readonly=True),
+ 'writeoff': fields.float('Write-Off amount',readonly=True),
+ }
+
+ def default_get(self, cr, uid, fields, context=None):
+ res = super(account_move_line_reconcile, self).default_get(cr, uid, fields, context=context)
+ data = self.trans_rec_get(cr, uid, context['active_ids'], context)
+ if 'trans_nbr' in fields:
+ res.update({'trans_nbr':data['trans_nbr']})
+ if 'credit' in fields:
+ res.update({'trans_nbr':data['credit']})
+ if 'debit' in fields:
+ res.update({'trans_nbr':data['debit']})
+ if 'writeoff' in fields:
+ res.update({'trans_nbr':data['writeoff']})
+ return res
+
+ def partial_check(self, cr, uid, ids, context=None):
+ mod_obj = self.pool.get('ir.model.data')
+ data = self.trans_rec_get(cr, uid, ids, context)
+ if context is None:
+ context = {}
+ if data['writeoff'] == 0:
+ model_data_ids = mod_obj.search(cr, uid,[('model','=','ir.ui.view'),('name','=','view_account_move_line_reconcile_full')], context=context)
+ resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
+ return {
+ 'name': _('Reconcile'),
+ 'context': context,
+ 'view_type': 'form',
+ 'view_mode': 'form',
+ 'res_model': 'account.move.line.reconcile',
+ 'views': [(resource_id,'form')],
+ 'type': 'ir.actions.act_window',
+ 'target': 'new',
+ }
+ else :
+ model_data_ids = mod_obj.search(cr, uid,[('model','=','ir.ui.view'),('name','=','view_account_move_line_reconcile_partial')], context=context)
+ resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
+ return {
+ 'name': _('Reconcile'),
+ 'context': context,
+ 'view_type': 'form',
+ 'view_mode': 'form',
+ 'res_model': 'account.move.line.reconcile',
+ 'views': [(resource_id,'form')],
+ 'type': 'ir.actions.act_window',
+ 'target': 'new',
+ }
+
+ def trans_rec_get(self, cr, uid, ids, context=None):
+ account_move_line_obj = self.pool.get('account.move.line')
+ if context is None:
+ context = {}
+ credit = debit = 0
+ account_id = False
+ count = 0
+ for line in account_move_line_obj.browse(cr, uid, context['active_ids'], context=context):
+ if not line.reconcile_id and not line.reconcile_id.id:
+ count += 1
+ credit += line.credit
+ debit += line.debit
+ account_id = line.account_id.id
+ return {'trans_nbr': count, 'account_id': account_id, 'credit': credit, 'debit': debit, 'writeoff': debit - credit}
+
+ def trans_rec_addendum_writeoff(self, cr, uid, ids, context=None):
+ return self.pool.get('account.move.line.reconcile.writeoff').trans_rec_addendum(cr, uid, ids, context)
+
+ def trans_rec_reconcile_partial_reconcile(self, cr, uid, ids, context=None):
+ return self.pool.get('account.move.line.reconcile.writeoff').trans_rec_reconcile_partial(cr, uid, ids, context)
+
+ def trans_rec_reconcile_full(self, cr, uid, ids, context=None):
+ account_move_line_obj = self.pool.get('account.move.line')
+ date = False
+ period_id = False
+ journal_id= False
+ account_id = False
+
+ if context is None:
+ context = {}
+
+ data = self.read(cr, uid, ids, context=context)
+ date = time.strftime('%Y-%m-%d')
+ ids = self.pool.get('account.period').find(cr, uid, dt=date, context=context)
+ if len(ids):
+ period_id = ids[0]
+ account_move_line_obj.reconcile(cr, uid, context['active_ids'], 'manual', account_id,
+ period_id, journal_id, context=context)
+ return {}
+
+account_move_line_reconcile()
+
+class account_move_line_reconcile_writeoff(osv.osv_memory):
+ """
+ It opens the write off wizard form, in that user can define the journal, account, analytic account for reconcile
+ """
+ _name = 'account.move.line.reconcile.writeoff'
+ _description = 'Account move line reconcile'
+ _columns = {
+ 'journal_id': fields.many2one('account.journal','Write-Off Journal', required=True),
+ 'writeoff_acc_id': fields.many2one('account.account','Write-Off account', required=True),
+ 'date_p': fields.date('Date'),
+ 'comment': fields.char('Comment', size= 64, required=True),
+ 'analytic_id': fields.many2one('account.analytic.account', 'Analytic Account'),
+ }
+ _defaults = {
+ 'date_p': time.strftime('%Y-%m-%d'),
+ 'comment': 'Write-off',
+ }
+
+ def trans_rec_addendum(self, cr, uid, ids, context=None):
+ mod_obj = self.pool.get('ir.model.data')
+ if context is None:
+ context = {}
+ model_data_ids = mod_obj.search(cr, uid,[('model','=','ir.ui.view'),('name','=','account_move_line_reconcile_writeoff')], context=context)
+ resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
+ return {
+ 'name': _('Reconcile Writeoff'),
+ 'context': context,
+ 'view_type': 'form',
+ 'view_mode': 'form',
+ 'res_model': 'account.move.line.reconcile.writeoff',
+ 'views': [(resource_id,'form')],
+ 'type': 'ir.actions.act_window',
+ 'target': 'new',
+ }
+
+ def trans_rec_reconcile_partial(self, cr, uid, ids, context=None):
+ account_move_line_obj = self.pool.get('account.move.line')
+ if context is None:
+ context = {}
+ account_move_line_obj.reconcile_partial(cr, uid, context['active_ids'], 'manual', context=context)
+ return {}
+
+ def trans_rec_reconcile(self, cr, uid, ids, context=None):
+ account_move_line_obj = self.pool.get('account.move.line')
+ if context is None:
+ context = {}
+ data = self.read(cr, uid, ids,context=context)[0]
+ account_id = data['writeoff_acc_id']
+ context['date_p'] = data['date_p']
+ journal_id = data['journal_id']
+ context['comment'] = data['comment']
+ if data['analytic_id']:
+ context['analytic_id'] = data['analytic_id']
+ if context['date_p']:
+ date = context['date_p']
+
+ ids = self.pool.get('account.period').find(cr, uid, dt=date, context=context)
+ if len(ids):
+ period_id = ids[0]
+
+ account_move_line_obj.reconcile(cr, uid, context['active_ids'], 'manual', account_id,
+ period_id, journal_id, context=context)
+ return {}
+
+account_move_line_reconcile_writeoff()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/account/wizard/account_reconcile_view.xml b/addons/account/wizard/account_reconcile_view.xml
new file mode 100644
index 00000000000..0f92376e045
--- /dev/null
+++ b/addons/account/wizard/account_reconcile_view.xml
@@ -0,0 +1,108 @@
+
+
+
+
+
+ account.move.line.reconcile.prompt.form
+ account.move.line.reconcile.prompt
+ form
+
+
+
+
+
+
+ Reconcile Entries
+ account.move.line.reconcile.prompt
+ form
+ tree,form
+
+ new
+
+
+
+
+
+ Reconcile Entries
+ client_action_multi
+
+ action
+ account.move.line
+
+
+
+ account.move.line.reconcile.full.form
+ account.move.line.reconcile
+ form
+
+
+
+
+
+
+ account.move.line.reconcile.partial.form
+ account.move.line.reconcile
+ form
+
+
+
+
+
+
+ account.move.line.reconcile.writeoff.form
+ account.move.line.reconcile.writeoff
+ form
+
+
+
+
+
+
diff --git a/addons/account/wizard/wizard_reconcile.py b/addons/account/wizard/wizard_reconcile.py
deleted file mode 100644
index ba7cf7eaef0..00000000000
--- a/addons/account/wizard/wizard_reconcile.py
+++ /dev/null
@@ -1,150 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
-
-import wizard
-import netsvc
-import time
-import osv
-import pooler
-from datetime import datetime
-from tools.translate import _
-
-_transaction_form = '''
-'''
-
-_transaction_fields = {
- 'trans_nbr': {'string':'# of Transaction', 'type':'integer', 'readonly':True},
- 'credit': {'string':'Credit amount', 'type':'float', 'readonly':True},
- 'debit': {'string':'Debit amount', 'type':'float', 'readonly':True},
- 'writeoff': {'string':'Write-Off amount', 'type':'float', 'readonly':True},
-}
-
-def _trans_rec_get(self, cr, uid, data, context=None):
- pool = pooler.get_pool(cr.dbname)
- account_move_line_obj = pool.get('account.move.line')
- credit = debit = 0
- account_id = False
- count = 0
- for line in account_move_line_obj.browse(cr, uid, data['ids'], context=context):
- if not line.reconcile_id and not line.reconcile_id.id:
- count += 1
- credit += line.credit
- debit += line.debit
- account_id = line.account_id.id
- return {'trans_nbr': count, 'account_id': account_id, 'credit': credit, 'debit': debit, 'writeoff': debit - credit}
-
-def _trans_rec_reconcile_partial(self, cr, uid, data, context=None):
- pool = pooler.get_pool(cr.dbname)
- account_move_line_obj = pool.get('account.move.line')
- account_move_line_obj.reconcile_partial(cr, uid, data['ids'], 'manual', context=context)
- return {}
-
-def _trans_rec_reconcile(self, cr, uid, data, context=None):
- pool = pooler.get_pool(cr.dbname)
- account_move_line_obj = pool.get('account.move.line')
-
- form = data['form']
- account_id = form.get('writeoff_acc_id', False)
- context['date_p'] = form.get('date_p', False)
- date = False
- if context['date_p']:
- date = datetime.strptime(context['date_p'], '%Y-%m-%d')
- ids = pool.get('account.period').find(cr, uid, dt=date, context=context)
- period_id = False
- if len(ids):
- period_id = ids[0]
-
- journal_id = form.get('journal_id', False)
- context['comment'] = form.get('comment', False)
- context['analytic_id'] = form.get('analytic_id', False)
- account_move_line_obj.reconcile(cr, uid, data['ids'], 'manual', account_id,
- period_id, journal_id, context=context)
- return {}
-
-def _partial_check(self, cr, uid, data, context):
- if _trans_rec_get(self,cr,uid, data, context)['writeoff'] == 0:
- return 'init_full'
- return 'init_partial'
-
-_transaction_add_form = '''
-'''
-
-_transaction_add_fields = {
- 'journal_id': {'string': 'Write-Off Journal', 'type': 'many2one', 'relation':'account.journal', 'required':True},
- 'writeoff_acc_id': {'string':'Write-Off account', 'type':'many2one', 'relation':'account.account', 'required':True},
- 'date_p': {'string':'Date','type':'date'},
- 'comment': {'string':'Comment','type':'char', 'size': 64, 'required':True},
- 'analytic_id': {'string':'Analytic Account', 'type': 'many2one', 'relation':'account.analytic.account'},
-}
-
-def _trans_rec_addendum(self, cr, uid, data, context={}):
- date_p = time.strftime('%Y-%m-%d')
- return {'date_p':date_p, 'comment': _('Write-Off')}
-
-
-class wiz_reconcile(wizard.interface):
- states = {
- 'init': {
- 'actions': [],
- 'result': {'type': 'choice', 'next_state': _partial_check}
- },
- 'init_full': {
- 'actions': [_trans_rec_get],
- 'result': {'type': 'form', 'arch':_transaction_form, 'fields':_transaction_fields, 'state':[('end','Cancel', 'gtk-cancel'),('reconcile','Reconcile', 'gtk-ok')]}
- },
- 'init_partial': {
- 'actions': [_trans_rec_get],
- 'result': {'type': 'form', 'arch':_transaction_form, 'fields':_transaction_fields, 'state':[('end','Cancel', 'gtk-cancel'),('addendum','Reconcile With Write-Off', 'gtk-ok'),('partial','Partial Reconcile', 'gtk-ok')]}
- },
- 'addendum': {
- 'actions': [_trans_rec_addendum],
- 'result': {'type': 'form', 'arch':_transaction_add_form, 'fields':_transaction_add_fields, 'state':[('end','Cancel', 'gtk-cancel'),('reconcile','Reconcile', 'gtk-ok')]}
- },
- 'reconcile': {
- 'actions': [_trans_rec_reconcile],
- 'result': {'type': 'state', 'state':'end'}
- },
- 'partial': {
- 'actions': [_trans_rec_reconcile_partial],
- 'result': {'type': 'state', 'state':'end'}
- }
- }
-wiz_reconcile('account.move.line.reconcile')
-
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-