[MERGE]: merging from the ssme branch

bzr revid: mga@tinyerp.com-20100428100322-fnwn7ghdye6hk9wt
This commit is contained in:
Mantavya Gajjar
2010-04-28 15:33:22 +05:30
17 changed files with 643 additions and 295 deletions
+5 -1
View File
@@ -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:
+1 -1
View File
@@ -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),
})]
+1 -1
View File
@@ -47,7 +47,7 @@
<!-- id="wizard_populate_statement_from_inv"/>-->
<!-- manual reconcile -->
<wizard id="wizard_reconcile" model="account.move.line" name="account.move.line.reconcile" string="Reconcile Entries"/>
<!-- <wizard id="wizard_reconcile" model="account.move.line" name="account.move.line.reconcile" string="Reconcile Entries"/>-->
<!-- <wizard id="wizard_reconcile_unreconcile" model="account.move.reconcile" name="account.reconcile.unreconcile" string="Unreconcile Entries"/>-->
+3 -3
View File
@@ -3,7 +3,7 @@
<data>
<report auto="False" id="analytic_journal_print" menu="False" model="account.analytic.journal" name="account.analytic.account.journal" rml="account/project/report/analytic_journal.rml" string="Analytic Journal"/>
<wizard id="account_analytic_account_journal_report" keyword="client_print_multi" model="account.analytic.journal" name="account.analytic.account.journal.report" string="Analytic Journal"/>
<!-- <wizard id="account_analytic_account_journal_report" keyword="client_print_multi" model="account.analytic.journal" name="account.analytic.account.journal.report" string="Analytic Journal"/>-->
<report auto="False" id="account_analytic_account_balance" menu="False" model="account.analytic.account" name="account.analytic.account.balance" rml="account/project/report/analytic_balance.rml" string="Analytic Balance"/>
@@ -13,7 +13,7 @@
<report auto="False" id="account_analytic_account_inverted_balance" menu="False" model="account.analytic.account" name="account.analytic.account.inverted.balance" rml="account/project/report/inverted_analytic_balance.rml" string="Inverted Analytic Balance"/>
<wizard id="account_analytic_account_inverted_balance_report" keyword="client_print_multi" model="account.analytic.account" name="account.analytic.account.inverted.balance.report" string="Inverted Analytic Balance"/>
<!-- <wizard id="account_analytic_account_inverted_balance_report" keyword="client_print_multi" model="account.analytic.account" name="account.analytic.account.inverted.balance.report" string="Inverted Analytic Balance"/>-->
<report auto="False" id="account_analytic_account_cost_ledger" menu="False" model="account.analytic.account" name="account.analytic.account.cost_ledger" rml="account/project/report/cost_ledger.rml" string="Cost Ledger"/>
@@ -23,7 +23,7 @@
<report auto="False" id="account_analytic_account_quantity_cost_ledger" menu="False" model="account.analytic.account" name="account.analytic.account.quantity_cost_ledger" rml="account/project/report/quantity_cost_ledger.rml" string="Cost Ledger (Only quantities)"/>
<wizard id="account_analytic_account_quantity_cost_ledger_report" keyword="client_print_multi" model="account.analytic.account" name="account.analytic.account.quantity_cost_ledger.report" string="Cost Ledger (Only quantities)"/>
<!-- <wizard id="account_analytic_account_quantity_cost_ledger_report" keyword="client_print_multi" model="account.analytic.account" name="account.analytic.account.quantity_cost_ledger.report" string="Cost Ledger (Only quantities)"/>-->
<report auto="False" id="account_analytic_account_analytic_check" menu="False" model="account.account" name="account.analytic.account.analytic.check" rml="account/project/report/analytic_check.rml" string="Analytic Check"/>
@@ -18,9 +18,9 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
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:
+4 -5
View File
@@ -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:
@@ -0,0 +1,105 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# 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 <http://www.gnu.org/licenses/>.
#
##############################################################################
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 = '''<?xml version="1.0"?>
#<form string="Select period">
# <separator string="Cost Legder for period" colspan="4"/>
# <field name="date1"/>
# <field name="date2"/>
# <separator string="and Journals" colspan="4"/>
# <field name="journal" colspan="4"/>
#</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:
@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="account_analytic_cost_ledger_journal_view" model="ir.ui.view">
<field name="name">Account Analytic Cost Ledger Journal</field>
<field name="model">account.analytic.cost.ledger.journal.report</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Select period">
<separator string="Cost Legder for period" colspan="4"/>
<field name="date1"/>
<field name="date2"/>
<separator string="and Journals" colspan="4"/>
<field name="journal" colspan="4"/>
<separator colspan="4"/>
<group colspan="4" col="6">
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
<button name="check_report" string="Print" type="object" icon="gtk-print"/>
</group>
</form>
</field>
</record>
<record id="action_account_analytic_cost_ledger_journal" model="ir.actions.act_window">
<field name="name">Cost Ledger (Only quantities)</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">account.analytic.cost.ledger.journal.report</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="account_analytic_cost_ledger_journal_view"/>
<field name="target">new</field>
</record>
<record model="ir.values" id="account_analytic_cost_ledger_journal_values">
<field name="model_id" ref="analytic.model_account_analytic_account" />
<field name="object" eval="1" />
<field name="name">Account Analytic Cost Ledger Journal</field>
<field name="key2">client_print_multi</field>
<field name="value" eval="'ir.actions.act_window,' + str(ref('action_account_analytic_cost_ledger_journal'))" />
<field name="key">action</field>
<field name="model">account.analytic.account</field>
</record>
</data>
</openerp>
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
#
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
@@ -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 <http://www.gnu.org/licenses/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import time
import wizard
dates_form = '''<?xml version="1.0"?>
<form string="Analytic Journal Report">
<field name="date1"/>
<field name="date2"/>
</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:
@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="account_analytic_invert_balance_view" model="ir.ui.view">
<field name="name">Account Analytic Inverted Balance</field>
<field name="model">account.analytic.inverted.balance</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Select Period">
<group colspan="4" col="6">
<field name="date1"/>
<field name="date2"/>
</group>
<separator colspan="4"/>
<group colspan="4" col="6">
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
<button name="check_report" string="Print" type="object" icon="gtk-print"/>
</group>
</form>
</field>
</record>
<record id="action_account_analytic_invert_balance" model="ir.actions.act_window">
<field name="name">Inverted Analytic Balance</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">account.analytic.inverted.balance</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="account_analytic_invert_balance_view"/>
<field name="target">new</field>
</record>
<record model="ir.values" id="account_analytic_invert_balance_values">
<field name="model_id" ref="analytic.model_account_analytic_account" />
<field name="object" eval="1" />
<field name="name">Account Analytic Inverted Balance</field>
<field name="key2">client_print_multi</field>
<field name="value" eval="'ir.actions.act_window,' + str(ref('action_account_analytic_invert_balance'))" />
<field name="key">action</field>
<field name="model">account.analytic.account</field>
</record>
</data>
</openerp>
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
#
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
@@ -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 <http://www.gnu.org/licenses/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import time
import wizard
dates_form = '''<?xml version="1.0"?>
<form string="Select period">
<field name="date1"/>
<field name="date2"/>
</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:
@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="account_analytic_journal_view" model="ir.ui.view">
<field name="name">Account Analytic Journal</field>
<field name="model">account.analytic.Journal.report</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Select Period">
<group colspan="4" col="6">
<field name="date1"/>
<field name="date2"/>
</group>
<separator colspan="4"/>
<group colspan="4" col="6">
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
<button name="check_report" string="Print" type="object" icon="gtk-print"/>
</group>
</form>
</field>
</record>
<record id="action_account_analytic_journal" model="ir.actions.act_window">
<field name="name">Analytic Journal</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">account.analytic.Journal.report</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="account_analytic_journal_view"/>
<field name="target">new</field>
</record>
<record model="ir.values" id="account_analytic_journal_values">
<field name="model_id" ref="account.model_account_analytic_journal" />
<field name="object" eval="1" />
<field name="name">Account Analytic Journal</field>
<field name="key2">client_print_multi</field>
<field name="value" eval="'ir.actions.act_window,' + str(ref('action_account_analytic_journal'))" />
<field name="key">action</field>
<field name="model">account.analytic.journal</field>
</record>
</data>
</openerp>
@@ -1,68 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# 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 <http://www.gnu.org/licenses/>.
#
##############################################################################
import time
import wizard
_form = '''<?xml version="1.0"?>
<form string="Select period">
<separator string="Cost Legder for period" colspan="4"/>
<field name="date1"/>
<field name="date2"/>
<separator string="and Journals" colspan="4"/>
<field name="journal" colspan="4"/>
</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:
+1 -1
View File
@@ -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
+207
View File
@@ -0,0 +1,207 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# 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 <http://www.gnu.org/licenses/>.
#
##############################################################################
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:
@@ -0,0 +1,108 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_account_move_line_reconcile_prompt" model="ir.ui.view">
<field name="name">account.move.line.reconcile.prompt.form</field>
<field name="model">account.move.line.reconcile.prompt</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Reconciliation">
<separator string="Are you sure you want to reconcile entries?" colspan="4"/>
<group colspan="4" col="6">
<label string ="" colspan="2"/>
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
<button icon="gtk-ok" string="Ok" name="ask_reconcilation" type="object" default_focus="1"/>
</group>
</form>
</field>
</record>
<record id="action_view_account_move_line_reconcile_prompt" model="ir.actions.act_window">
<field name="name">Reconcile Entries</field>
<field name="res_model">account.move.line.reconcile.prompt</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_account_move_line_reconcile_prompt"/>
<field name="target">new</field>
</record>
<record model="ir.values" id="action_account_move_line_reconcile_prompt_values">
<field name="model_id" ref="account.model_account_move_line" />
<field name="object" eval="1" />
<field name="name">Reconcile Entries</field>
<field name="key2">client_action_multi</field>
<field name="value" eval="'ir.actions.act_window,' +str(ref('action_view_account_move_line_reconcile_prompt'))" />
<field name="key">action</field>
<field name="model">account.move.line</field>
</record>
<record id="view_account_move_line_reconcile_full" model="ir.ui.view">
<field name="name">account.move.line.reconcile.full.form</field>
<field name="model">account.move.line.reconcile</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Reconciliation">
<separator string="Reconciliation transactions" colspan="4"/>
<field name="trans_nbr"/>
<newline/>
<field name="credit"/>
<field name="debit"/>
<separator string="Write-Off" colspan="4"/>
<field name="writeoff"/>
<group colspan="4" col="6">
<label string ="" colspan="2"/>
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
<button icon="gtk-ok" string="Reconcile" name="trans_rec_reconcile_full" type="object" default_focus="1"/>
</group>
</form>
</field>
</record>
<record id="view_account_move_line_reconcile_partial" model="ir.ui.view">
<field name="name">account.move.line.reconcile.partial.form</field>
<field name="model">account.move.line.reconcile</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Reconciliation">
<separator string="Reconciliation transactions" colspan="4"/>
<field name="trans_nbr"/>
<newline/>
<field name="credit"/>
<field name="debit"/>
<separator string="Write-Off" colspan="4"/>
<field name="writeoff"/>
<group colspan="4" col="6">
<label string ="" colspan="2"/>
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
<button icon="gtk-ok" string="Reconcile With Write-Off" name="trans_rec_addendum_writeoff" type="object" default_focus="1"/>
<button icon="gtk-ok" string="Partial Reconcile" name="trans_rec_reconcile_partial_reconcile" type="object"/>
</group>
</form>
</field>
</record>
<record id="account_move_line_reconcile_writeoff" model="ir.ui.view">
<field name="name">account.move.line.reconcile.writeoff.form</field>
<field name="model">account.move.line.reconcile.writeoff</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Information addendum">
<separator string="Write-Off Move" colspan="4"/>
<field name="journal_id"/>
<field name="writeoff_acc_id" domain="[('type', '&lt;&gt;', 'view')]"/>
<field name="date_p"/>
<field name="comment"/>
<separator string="Analytic" colspan="4"/>
<field name="analytic_id"/>
<group colspan="4" col="6">
<label string ="" colspan="2"/>
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
<button icon="gtk-ok" string="Reconcile" name="trans_rec_reconcile" type="object" default_focus="1"/>
</group>
</form>
</field>
</record>
</data>
</openerp>
-150
View File
@@ -1,150 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# 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 <http://www.gnu.org/licenses/>.
#
##############################################################################
import wizard
import netsvc
import time
import osv
import pooler
from datetime import datetime
from tools.translate import _
_transaction_form = '''<?xml version="1.0"?>
<form string="Reconciliation">
<separator string="Reconciliation transactions" colspan="4"/>
<field name="trans_nbr"/>
<newline/>
<field name="credit"/>
<field name="debit"/>
<separator string="Write-Off" colspan="4"/>
<field name="writeoff"/>
</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 = '''<?xml version="1.0"?>
<form string="Information addendum">
<separator string="Write-Off Move" colspan="4"/>
<field name="journal_id"/>
<field name="writeoff_acc_id" domain="[('type', '&lt;&gt;', 'view')]"/>
<field name="date_p"/>
<field name="comment"/>
<separator string="Analytic" colspan="4"/>
<field name="analytic_id"/>
</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: