[MERGE]: Merge with lp:openobject-addons
bzr revid: rpa@tinyerp.com-20100503050112-sb0upykpzk6w3ujp
This commit is contained in:
commit
22acecc457
|
@ -80,6 +80,8 @@ 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',
|
||||
'account_invoice_view.xml',
|
||||
|
@ -89,6 +91,13 @@ module named account_voucherss
|
|||
'account_invoice_workflow.xml',
|
||||
'project/project_view.xml',
|
||||
'project/project_report.xml',
|
||||
'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',
|
||||
'project/wizard/account_analytic_chart_view.xml',
|
||||
'product_view.xml',
|
||||
'account_assert_test.xml',
|
||||
'process/statement_process.xml',
|
||||
|
@ -113,4 +122,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:
|
|
@ -922,10 +922,10 @@ class account_move_line(osv.osv):
|
|||
vals['analytic_lines'] = [(0,0, {
|
||||
'name': vals['name'],
|
||||
'date': vals.get('date', time.strftime('%Y-%m-%d')),
|
||||
'account_id': vals['analytic_account_id'],
|
||||
'unit_amount':'quantity' in vals and vals['quantity'] or 1.0,
|
||||
'amount': vals['debit'] or vals['credit'],
|
||||
'general_account_id': vals['account_id'],
|
||||
'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.get('account_id', False),
|
||||
'journal_id': journal.analytic_journal_id.id,
|
||||
'ref': vals.get('ref', False),
|
||||
})]
|
||||
|
|
|
@ -33,9 +33,9 @@
|
|||
-->
|
||||
|
||||
<!-- automatic reconcile -->
|
||||
<wizard id="wizard_automatic_reconcile" menu="False" model="account.account" name="account.automatic.reconcile" string="Automatic reconciliation"/>
|
||||
<menuitem id="next_id_20" name="Reconciliation" parent="menu_finance_periodical_processing"/>
|
||||
<menuitem action="wizard_automatic_reconcile" id="menu_automatic_reconcile" parent="next_id_20" type="wizard"/>
|
||||
<!-- <wizard id="wizard_automatic_reconcile" menu="False" model="account.account" name="account.automatic.reconcile" string="Automatic reconciliation"/>
|
||||
<menuitem action="wizard_automatic_reconcile" id="menu_automatic_reconcile" parent="next_id_20" type="wizard"/>-->
|
||||
|
||||
<!-- Import entry in statement -->
|
||||
|
||||
|
@ -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"/>-->
|
||||
|
||||
|
|
|
@ -7,13 +7,13 @@ msgstr ""
|
|||
"Project-Id-Version: OpenERP Server 5.0.0\n"
|
||||
"Report-Msgid-Bugs-To: support@openerp.com\n"
|
||||
"POT-Creation-Date: 2009-08-28 16:01+0000\n"
|
||||
"PO-Revision-Date: 2010-04-27 19:28+0000\n"
|
||||
"PO-Revision-Date: 2010-05-02 10:11+0000\n"
|
||||
"Last-Translator: Grzegorz Grzelak (Cirrus.pl) <Unknown>\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2010-04-28 03:44+0000\n"
|
||||
"X-Launchpad-Export-Date: 2010-05-03 04:03+0000\n"
|
||||
"X-Generator: Launchpad (build Unknown)\n"
|
||||
|
||||
#. module: account
|
||||
|
@ -2212,7 +2212,7 @@ msgstr "(pozostaw puste, aby stosować bieżący okres)"
|
|||
#: model:ir.actions.act_window,name:account.action_invoice_tree8
|
||||
#: model:ir.ui.menu,name:account.menu_action_invoice_tree8
|
||||
msgid "Draft Supplier Invoices"
|
||||
msgstr "Projekt faktury dla klienta"
|
||||
msgstr "Projekty faktur od dostawcy"
|
||||
|
||||
#. module: account
|
||||
#: wizard_field:account.invoice.refund,init,period:0
|
||||
|
@ -2952,7 +2952,7 @@ msgstr ""
|
|||
#: model:ir.actions.act_window,name:account.action_invoice_tree12
|
||||
#: model:ir.ui.menu,name:account.menu_action_invoice_tree12
|
||||
msgid "Draft Supplier Refunds"
|
||||
msgstr "Projekt korekty od dostawcy"
|
||||
msgstr "Projekty korekt od dostawcy"
|
||||
|
||||
#. module: account
|
||||
#: model:process.node,name:account.process_node_accountingstatemententries0
|
||||
|
@ -3039,7 +3039,7 @@ msgstr "Kurs dla op. wychodzacych"
|
|||
#: model:ir.actions.act_window,name:account.action_invoice_tree10
|
||||
#: model:ir.ui.menu,name:account.menu_action_invoice_tree10
|
||||
msgid "Draft Customer Refunds"
|
||||
msgstr "Projekt korekty dla klienta"
|
||||
msgstr "Projekty korekt dla klienta"
|
||||
|
||||
#. module: account
|
||||
#: field:account.journal.column,readonly:0
|
||||
|
@ -5481,7 +5481,7 @@ msgstr "Zapisy subskrypcji"
|
|||
#: model:ir.actions.act_window,name:account.action_invoice_tree6
|
||||
#: model:ir.ui.menu,name:account.menu_action_invoice_tree6
|
||||
msgid "PRO-FORMA Customer Invoices"
|
||||
msgstr "Faktura PRO-FORMA dla klienta"
|
||||
msgstr "Fakturay PRO-FORMA dla klienta"
|
||||
|
||||
#. module: account
|
||||
#: field:account.subscription,period_total:0
|
||||
|
|
|
@ -3,32 +3,32 @@
|
|||
<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"/>
|
||||
|
||||
<wizard id="account_analytic_account_balance_report" keyword="client_print_multi" model="account.analytic.account" name="account.analytic.account.balance.report" string="Analytic Balance"/>
|
||||
<!--<wizard id="account_analytic_account_balance_report" keyword="client_print_multi" model="account.analytic.account" name="account.analytic.account.balance.report" string="Analytic Balance"/> -->
|
||||
|
||||
|
||||
<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"/>
|
||||
|
||||
<wizard id="account_analytic_account_cost_ledger_report" keyword="client_print_multi" model="account.analytic.account" name="account.analytic.account.cost_ledger.report" string="Cost Ledger"/>
|
||||
<!-- <wizard id="account_analytic_account_cost_ledger_report" keyword="client_print_multi" model="account.analytic.account" name="account.analytic.account.cost_ledger.report" string="Cost Ledger"/>-->
|
||||
|
||||
|
||||
<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"/>
|
||||
|
||||
<wizard id="account_analytic_account_analytic_check_report" keyword="client_print_multi" model="account.account" name="account.analytic.account.analytic.check.report" string="Analytic Check"/>
|
||||
<!-- <wizard id="account_analytic_account_analytic_check_report" keyword="client_print_multi" model="account.account" name="account.analytic.account.analytic.check.report" string="Analytic Check"/>-->
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
|
@ -127,8 +127,8 @@
|
|||
parent="account_analytic_def_account"/>
|
||||
<!-- <menuitem action="action_account_analytic_account_tree2" id="account_analytic_chart" parent="account.menu_finance_charts"/>-->
|
||||
|
||||
<wizard id="wizard_analytic_account_chart" menu="False" model="account.analytic.account" name="account.analytic.account.chart" string="Analytic Chart of Accounts"/>
|
||||
<menuitem icon="STOCK_INDENT" action="wizard_analytic_account_chart" id="menu_action_analytic_account_tree2" parent="account.menu_finance_charts" type="wizard"/>
|
||||
<!-- <wizard id="wizard_analytic_account_chart" menu="False" model="account.analytic.account" name="account.analytic.account.chart" string="Analytic Chart of Accounts"/>
|
||||
<menuitem icon="STOCK_INDENT" action="wizard_analytic_account_chart" id="menu_action_analytic_account_tree2" parent="account.menu_finance_charts" type="wizard"/>-->
|
||||
|
||||
<menuitem id="next_id_40" name="Analytic" parent="account.menu_finance_generic_reporting" sequence="4"/>
|
||||
<menuitem action="action_account_analytic_account_tree2" id="account_analytic_chart_balance" parent="next_id_40"/>
|
||||
|
|
|
@ -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_analytic_check(report_sxw.rml_parse):
|
||||
|
@ -132,5 +132,4 @@ class account_analytic_analytic_check(report_sxw.rml_parse):
|
|||
|
||||
report_sxw.report_sxw('report.account.analytic.account.analytic.check', 'account.analytic.account', 'addons/account/project/report/analytic_check.rml',parser=account_analytic_analytic_check, header=False)
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -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:
|
|
@ -19,14 +19,13 @@
|
|||
#
|
||||
##############################################################################
|
||||
|
||||
import wizard_account_analytic_journal_report
|
||||
import wizard_account_analytic_balance_report
|
||||
import wizard_account_analytic_inverted_balance_report
|
||||
import wizard_account_analytic_cost_ledger_report
|
||||
import wizard_account_analytic_cost_ledger_for_journal_report
|
||||
import wizard_account_analytic_analytic_check
|
||||
import account_analytic_journal_report
|
||||
import account_analytic_balance_report
|
||||
import account_analytic_inverted_balance_report
|
||||
import account_analytic_cost_ledger_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:
|
||||
import account_analytic_chart
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -18,37 +18,42 @@
|
|||
# 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 Options">
|
||||
<field name="date_from"/>
|
||||
<field name="date_to"/>
|
||||
</form>'''
|
||||
from osv import osv, fields
|
||||
|
||||
dates_fields = {
|
||||
'date_from': {'string':'Start of period', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-01-01')},
|
||||
'date_to': {'string':'End of period', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-%m-%d')},
|
||||
}
|
||||
class account_analytic_balance(osv.osv_memory):
|
||||
_name = 'account.analytic.balance'
|
||||
_description = 'Account Analytic Balance'
|
||||
|
||||
class wizard_report_summary(wizard.interface):
|
||||
|
||||
def _default(self, cr, uid, data, context):
|
||||
data['form']['report']='analytic-one'
|
||||
return data['form']
|
||||
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [_default],
|
||||
'result': {'type':'form', 'arch':dates_form, 'fields':dates_fields, 'state':[('end','Cancel', 'gtk-cancel'),('report','Print', 'gtk-print', True)]}
|
||||
},
|
||||
'report': {
|
||||
'actions': [],
|
||||
'result': {'type':'print', 'report':'crossovered.budget.report', 'state':'end'}
|
||||
_columns = {
|
||||
'date1': fields.date('Start of period', required=True),
|
||||
'date2': fields.date('End of period', required=True),
|
||||
'empty_acc': fields.boolean('Empty Accounts ? ', help='Check if you want to display Accounts with 0 balance too.'),
|
||||
}
|
||||
}
|
||||
wizard_report_summary('wizard.crossovered.budget.summary')
|
||||
|
||||
_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.balance',
|
||||
'datas': datas,
|
||||
}
|
||||
|
||||
account_analytic_balance()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="account_analytic_balance_view" model="ir.ui.view">
|
||||
<field name="name">Account Analytic Balance</field>
|
||||
<field name="model">account.analytic.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"/>
|
||||
<newline/>
|
||||
<field name="empty_acc"/>
|
||||
</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_balance" model="ir.actions.act_window">
|
||||
<field name="name">Analytic Balance</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">account.analytic.balance</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="account_analytic_balance_view"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.values" id="account_analytic_balance_values">
|
||||
<field name="model_id" ref="analytic.model_account_analytic_account" />
|
||||
<field name="object" eval="1" />
|
||||
<field name="name">Account Analytic Balance</field>
|
||||
<field name="key2">client_print_multi</field>
|
||||
<field name="value" eval="'ir.actions.act_window,' + str(ref('action_account_analytic_balance'))" />
|
||||
<field name="key">action</field>
|
||||
<field name="model">account.analytic.account</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
# -*- 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
from osv import osv, fields
|
||||
|
||||
class account_analytic_chart(osv.osv_memory):
|
||||
_name = 'account.analytic.chart'
|
||||
_description = 'Account Analytic Chart'
|
||||
|
||||
_columns = {
|
||||
'from_date': fields.date('From'),
|
||||
'to_date': fields.date('To'),
|
||||
}
|
||||
|
||||
def analytic_account_chart_open_window(self, cr, uid, ids, context=None):
|
||||
mod_obj = self.pool.get('ir.model.data')
|
||||
act_obj = self.pool.get('ir.actions.act_window')
|
||||
result_context = {}
|
||||
if context is None:
|
||||
context = {}
|
||||
result = mod_obj._get_id(cr, uid, 'account', 'action_account_analytic_account_tree2')
|
||||
id = mod_obj.read(cr, uid, [result], ['res_id'])[0]['res_id']
|
||||
result = act_obj.read(cr, uid, [id], context=context)[0]
|
||||
data = self.read(cr, uid, ids, [])[0]
|
||||
if data['from_date']:
|
||||
result_context.update({'from_date' : data['from_date']})
|
||||
if data['to_date']:
|
||||
result_context.update({'to_date' : data['to_date']})
|
||||
result['context'] = str(result_context)
|
||||
return result
|
||||
|
||||
account_analytic_chart()
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -0,0 +1,44 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="account_analytic_chart_view" model="ir.ui.view">
|
||||
<field name="name">Account Analytic Chart</field>
|
||||
<field name="model">account.analytic.chart</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Analytic Account Charts">
|
||||
<separator string="Select the Period for Analysis" colspan="4"/>
|
||||
<field name="from_date"/>
|
||||
<newline/>
|
||||
<field name="to_date"/>
|
||||
<newline/>
|
||||
<label string="(Keep empty to open the current situation)" align="0.0" colspan="3"/>
|
||||
<separator colspan="4"/>
|
||||
<group colspan="4" col="6">
|
||||
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
|
||||
<button name="analytic_account_chart_open_window" string="Open Charts" type="object" icon="gtk-ok"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_account_analytic_chart" model="ir.actions.act_window">
|
||||
<field name="name">Analytic Chart of Accounts</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">account.analytic.chart</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="account_analytic_chart_view"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<menuitem
|
||||
name="Analytic Chart of Accounts"
|
||||
parent="account.menu_finance_charts"
|
||||
action="action_account_analytic_chart"
|
||||
id="menu_action_analytic_account_tree2"
|
||||
icon="STOCK_INDENT"/>
|
||||
|
||||
</data>
|
||||
</openerp>
|
|
@ -18,33 +18,40 @@
|
|||
# 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 Dates Period">
|
||||
<field name="date_from"/>
|
||||
<field name="date_to"/>
|
||||
</form>'''
|
||||
from osv import osv, fields
|
||||
|
||||
dates_fields = {
|
||||
'date_from': {'string':'Start of period', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-01-01')},
|
||||
'date_to': {'string':'End of period', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-%m-%d')}
|
||||
}
|
||||
class account_analytic_check(osv.osv_memory):
|
||||
_name = 'account.analytic.check'
|
||||
_description = 'Account Analytic Check'
|
||||
|
||||
class wizard_report(wizard.interface):
|
||||
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [],
|
||||
'result': {'type':'form', 'arch':dates_form, 'fields':dates_fields, 'state':[('end','Cancel', 'gtk-cancel'),('report','Print', 'gtk-print', True)]}
|
||||
},
|
||||
'report': {
|
||||
'actions': [],
|
||||
'result': {'type':'print', 'report':'account.analytic.account.budget', 'state':'end'}
|
||||
_columns = {
|
||||
'date1': fields.date('Start of period', required=True),
|
||||
'date2': fields.date('End of period', required=True),
|
||||
}
|
||||
}
|
||||
wizard_report('wizard.analytic.account.budget.report')
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
_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.account',
|
||||
'form': data
|
||||
}
|
||||
return {
|
||||
'type': 'ir.actions.report.xml',
|
||||
'report_name': 'account.analytic.account.analytic.check',
|
||||
'datas': datas,
|
||||
}
|
||||
|
||||
account_analytic_check()
|
||||
|
||||
# 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_check_view" model="ir.ui.view">
|
||||
<field name="name">Account Analytic Check</field>
|
||||
<field name="model">account.analytic.check</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_check" model="ir.actions.act_window">
|
||||
<field name="name">Analytic Check</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">account.analytic.check</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="account_analytic_check_view"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.values" id="account_analytic_check_values">
|
||||
<field name="model_id" ref="account.model_account_account" />
|
||||
<field name="object" eval="1" />
|
||||
<field name="name">Account Analytic Check</field>
|
||||
<field name="key2">client_print_multi</field>
|
||||
<field name="value" eval="'ir.actions.act_window,' + str(ref('action_account_analytic_check'))" />
|
||||
<field name="key">action</field>
|
||||
<field name="model">account.account</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
@ -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,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_cost_ledger(osv.osv_memory):
|
||||
_name = 'account.analytic.cost.ledger'
|
||||
_description = 'Account Analytic Cost Ledger'
|
||||
|
||||
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.account',
|
||||
'form': data
|
||||
}
|
||||
return {
|
||||
'type': 'ir.actions.report.xml',
|
||||
'report_name': 'account.analytic.account.cost_ledger',
|
||||
'datas': datas,
|
||||
}
|
||||
|
||||
account_analytic_cost_ledger()
|
||||
# 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_cost_view" model="ir.ui.view">
|
||||
<field name="name">Account Analytic Check</field>
|
||||
<field name="model">account.analytic.cost.ledger</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_cost" model="ir.actions.act_window">
|
||||
<field name="name">Cost Ledger</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">account.analytic.cost.ledger</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="account_analytic_cost_view"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.values" id="account_analytic_cost_values">
|
||||
<field name="model_id" ref="analytic.model_account_analytic_account" />
|
||||
<field name="object" eval="1" />
|
||||
<field name="name">Account Analytic Cost</field>
|
||||
<field name="key2">client_print_multi</field>
|
||||
<field name="value" eval="'ir.actions.act_window,' + str(ref('action_account_analytic_cost'))" />
|
||||
<field name="key">action</field>
|
||||
<field name="model">account.analytic.account</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
|
@ -0,0 +1,56 @@
|
|||
# -*- 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_inverted_balance(osv.osv_memory):
|
||||
_name = 'account.analytic.inverted.balance'
|
||||
_description = 'Account Analytic Inverted Balance'
|
||||
|
||||
_columns = {
|
||||
'date1': fields.date('Start of period', required=True),
|
||||
'date2': fields.date('End of period', required=True),
|
||||
}
|
||||
|
||||
_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.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,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_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.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.journal',
|
||||
'form': data
|
||||
}
|
||||
return {
|
||||
'type': 'ir.actions.report.xml',
|
||||
'report_name': 'account.analytic.journal',
|
||||
'datas': datas,
|
||||
}
|
||||
|
||||
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,52 +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
|
||||
|
||||
dates_form = '''<?xml version="1.0"?>
|
||||
<form string="Select period">
|
||||
<field name="date1"/>
|
||||
<field name="date2"/>
|
||||
</form>'''
|
||||
|
||||
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 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.analytic.check', 'state':'end'}
|
||||
}
|
||||
}
|
||||
wizard_report('account.analytic.account.analytic.check.report')
|
||||
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -1,55 +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
|
||||
|
||||
dates_form = '''<?xml version="1.0"?>
|
||||
<form string="Select Period">
|
||||
<field name="date1"/>
|
||||
<field name="date2"/>
|
||||
<field name="empty_acc"/>
|
||||
</form>'''
|
||||
|
||||
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')},
|
||||
'empty_acc': {'string':'Empty Accounts ? ', 'type':'boolean', 'help':'Check if you want to display Accounts with 0 balance too.'},
|
||||
}
|
||||
|
||||
|
||||
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.balance', 'state':'end'}
|
||||
}
|
||||
}
|
||||
wizard_report('account.analytic.account.balance.report')
|
||||
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -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,78 +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 pooler
|
||||
|
||||
class wizard_analytic_account_chart(wizard.interface):
|
||||
_account_chart_arch = '''<?xml version="1.0"?>
|
||||
<form string="Analytic Account Charts">
|
||||
<separator string="Select the Period for Analysis" colspan="4"/>
|
||||
<field name="from_date"/>
|
||||
<newline/>
|
||||
<field name="to_date"/>
|
||||
<newline/>
|
||||
<label string="(Keep empty to open the current situation)" align="0.0" colspan="3"/>
|
||||
</form>'''
|
||||
|
||||
_account_chart_fields = {
|
||||
'from_date': {
|
||||
'string': 'From',
|
||||
'type': 'date',
|
||||
},
|
||||
'to_date': {
|
||||
'string': 'To',
|
||||
'type': 'date',
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
def _analytic_account_chart_open_window(self, cr, uid, data, context):
|
||||
mod_obj = pooler.get_pool(cr.dbname).get('ir.model.data')
|
||||
act_obj = pooler.get_pool(cr.dbname).get('ir.actions.act_window')
|
||||
|
||||
result = mod_obj._get_id(cr, uid, 'account', 'action_account_analytic_account_tree2')
|
||||
id = mod_obj.read(cr, uid, [result], ['res_id'])[0]['res_id']
|
||||
result = act_obj.read(cr, uid, [id], context=context)[0]
|
||||
|
||||
result_context = {}
|
||||
if data['form']['from_date']:
|
||||
result_context.update({'from_date' : data['form']['from_date']})
|
||||
if data['form']['to_date']:
|
||||
result_context.update({'to_date' : data['form']['to_date']})
|
||||
|
||||
result['context'] = str(result_context)
|
||||
return result
|
||||
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [],
|
||||
'result': {'type': 'form', 'arch':_account_chart_arch, 'fields':_account_chart_fields, 'state': [('end', 'Cancel', 'gtk-cancel'), ('open', 'Open Charts', 'gtk-ok')]}
|
||||
},
|
||||
'open': {
|
||||
'actions': [],
|
||||
'result': {'type': 'action', 'action':_analytic_account_chart_open_window, 'state':'end'}
|
||||
}
|
||||
}
|
||||
wizard_analytic_account_chart('account.analytic.account.chart')
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -29,7 +29,6 @@ from report import report_sxw
|
|||
class account_balance(report_sxw.rml_parse):
|
||||
_name = 'report.account.account.balance'
|
||||
def __init__(self, cr, uid, name, context):
|
||||
print " KKKKKKKKKKKKKKKKKKKKKKKK"
|
||||
super(account_balance, self).__init__(cr, uid, name, context=context)
|
||||
self.sum_debit = 0.00
|
||||
self.sum_credit = 0.00
|
||||
|
|
|
@ -19,10 +19,10 @@
|
|||
#
|
||||
##############################################################################
|
||||
|
||||
import wizard_automatic_reconcile
|
||||
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
|
||||
|
|
|
@ -43,7 +43,7 @@ class account_aged_trial_balance(osv.osv_memory):
|
|||
'Analysis Direction', required=True),
|
||||
}
|
||||
|
||||
def _get_company(self, cr, uid, ids, context=None):
|
||||
def _get_company(self, cr, uid, context=None):
|
||||
user_obj = self.pool.get('res.users')
|
||||
company_obj = self.pool.get('res.company')
|
||||
if context is None:
|
||||
|
@ -55,11 +55,11 @@ class account_aged_trial_balance(osv.osv_memory):
|
|||
return company_obj.search(cr, uid, [('parent_id', '=', False)])[0]
|
||||
|
||||
_defaults = {
|
||||
'company_id' : _get_company,
|
||||
'period_length' : 30,
|
||||
'company_id': _get_company,
|
||||
'period_length': 30,
|
||||
'date1' : time.strftime('%Y-%m-%d'),
|
||||
'result_selection' : 'all',
|
||||
'direction_selection' : 'past',
|
||||
'result_selection': 'all',
|
||||
'direction_selection': 'past',
|
||||
}
|
||||
|
||||
def calc_dates(self, cr, uid, ids, context=None):
|
||||
|
@ -103,4 +103,5 @@ class account_aged_trial_balance(osv.osv_memory):
|
|||
}
|
||||
|
||||
account_aged_trial_balance()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -0,0 +1,243 @@
|
|||
# -*- 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 netsvc
|
||||
from osv import osv, fields
|
||||
from tools.translate import _
|
||||
|
||||
class account_automatic_reconcile(osv.osv_memory):
|
||||
_name = 'account.automatic.reconcile'
|
||||
_description = 'Automatic Reconcile'
|
||||
|
||||
_columns = {
|
||||
'account_ids': fields.many2many('account.account', 'reconcile_account_rel', 'reconcile_id', 'account_id', 'Account to reconcile', domain = [('reconcile','=',1)], \
|
||||
help = 'If no account is specified, the reconciliation will be made using every accounts that can be reconcilied'),
|
||||
'writeoff_acc_id': fields.many2one('account.account', 'Account', required=True),
|
||||
'journal_id': fields.many2one('account.journal', 'Journal', required=True),
|
||||
'period_id': fields.many2one('account.period', 'Period', required=True),
|
||||
'max_amount': fields.float('Maximum write-off amount'),
|
||||
'power': fields.selection([(p, str(p)) for p in range(2, 10)], 'Power', required=True),
|
||||
'date1': fields.date('Start of period', required=True),
|
||||
'date2': fields.date('End of period', required=True),
|
||||
'reconciled': fields.integer('Reconciled transactions', readonly=True),
|
||||
'unreconciled': fields.integer('Not reconciled transactions', readonly=True),
|
||||
}
|
||||
|
||||
def _get_reconciled(self, cr, uid, context={}):
|
||||
return context.get('reconciled', 0)
|
||||
|
||||
def _get_unreconciled(self, cr, uid, context={}):
|
||||
return context.get('unreconciled', 0)
|
||||
|
||||
_defaults = {
|
||||
'date1': time.strftime('%Y-01-01'),
|
||||
'date2': time.strftime('%Y-%m-%d'),
|
||||
'reconciled': _get_reconciled,
|
||||
'unreconciled': _get_unreconciled,
|
||||
}
|
||||
|
||||
#TODO: cleanup and comment this code... For now, it is awfulllll
|
||||
# (way too complex, and really slow)...
|
||||
def do_reconcile(self, cr, uid, credits, debits, max_amount, power, writeoff_acc_id, period_id, journal_id, context=None):
|
||||
# for one value of a credit, check all debits, and combination of them
|
||||
# depending on the power. It starts with a power of one and goes up
|
||||
# to the max power allowed
|
||||
move_line_obj = self.pool.get('account.move.line')
|
||||
if context is None:
|
||||
context = {}
|
||||
def check2(value, move_list, power):
|
||||
def check(value, move_list, power):
|
||||
for i in range(len(move_list)):
|
||||
move = move_list[i]
|
||||
if power == 1:
|
||||
if abs(value - move[1]) <= max_amount + 0.00001:
|
||||
return [move[0]]
|
||||
else:
|
||||
del move_list[i]
|
||||
res = check(value - move[1], move_list, power-1)
|
||||
move_list[i:i] = [move]
|
||||
if res:
|
||||
res.append(move[0])
|
||||
return res
|
||||
return False
|
||||
|
||||
for p in range(1, power+1):
|
||||
res = check(value, move_list, p)
|
||||
if res:
|
||||
return res
|
||||
return False
|
||||
|
||||
# for a list of credit and debit and a given power, check if there
|
||||
# are matching tuples of credit and debits, check all debits, and combination of them
|
||||
# depending on the power. It starts with a power of one and goes up
|
||||
# to the max power allowed
|
||||
def check4(list1, list2, power):
|
||||
def check3(value, list1, list2, list1power, power):
|
||||
for i in range(len(list1)):
|
||||
move = list1[i]
|
||||
if list1power == 1:
|
||||
res = check2(value + move[1], list2, power - 1)
|
||||
if res:
|
||||
return ([move[0]], res)
|
||||
else:
|
||||
del list1[i]
|
||||
res = check3(value + move[1], list1, list2, list1power-1, power-1)
|
||||
list1[i:i] = [move]
|
||||
if res:
|
||||
x, y = res
|
||||
x.append(move[0])
|
||||
return (x, y)
|
||||
return False
|
||||
|
||||
for p in range(1, power):
|
||||
res = check3(0, list1, list2, p, power)
|
||||
if res:
|
||||
return res
|
||||
return False
|
||||
|
||||
def check5(list1, list2, max_power):
|
||||
for p in range(2, max_power+1):
|
||||
res = check4(list1, list2, p)
|
||||
if res:
|
||||
return res
|
||||
|
||||
ok = True
|
||||
reconciled = 0
|
||||
while credits and debits and ok:
|
||||
res = check5(credits, debits, power)
|
||||
if res:
|
||||
move_line_obj.reconcile(cr, uid, res[0] + res[1], 'auto', writeoff_acc_id, period_id, journal_id, context)
|
||||
reconciled += len(res[0]) + len(res[1])
|
||||
credits = [(id, credit) for (id, credit) in credits if id not in res[0]]
|
||||
debits = [(id, debit) for (id, debit) in debits if id not in res[1]]
|
||||
else:
|
||||
ok = False
|
||||
return (reconciled, len(credits)+len(debits))
|
||||
|
||||
def reconcile(self, cr, uid, ids, context=None):
|
||||
service = netsvc.LocalService("object_proxy")
|
||||
move_line_obj = self.pool.get('account.move.line')
|
||||
obj_model = self.pool.get('ir.model.data')
|
||||
if context is None:
|
||||
context = {}
|
||||
form = self.read(cr, uid, ids, [])[0]
|
||||
max_amount = form.get('max_amount', 0.0)
|
||||
power = form['power']
|
||||
reconciled = unreconciled = 0
|
||||
if not form['account_ids']:
|
||||
raise osv.except_osv(_('UserError'), _('You must select accounts to reconcile'))
|
||||
for account_id in form['account_ids']:
|
||||
# reconcile automatically all transactions from partners whose balance is 0
|
||||
cr.execute(
|
||||
"SELECT partner_id " \
|
||||
"FROM account_move_line " \
|
||||
"WHERE account_id=%s " \
|
||||
"AND reconcile_id IS NULL " \
|
||||
"AND state <> 'draft' " \
|
||||
"GROUP BY partner_id " \
|
||||
"HAVING ABS(SUM(debit-credit)) < %s AND count(*)>0",
|
||||
(account_id, max_amount or 0.0))
|
||||
partner_ids = [id for (id,) in cr.fetchall()]
|
||||
for partner_id in partner_ids:
|
||||
cr.execute(
|
||||
"SELECT id " \
|
||||
"FROM account_move_line " \
|
||||
"WHERE account_id=%s " \
|
||||
"AND partner_id=%s " \
|
||||
"AND state <> 'draft' " \
|
||||
"AND reconcile_id IS NULL",
|
||||
(account_id, partner_id))
|
||||
line_ids = [id for (id,) in cr.fetchall()]
|
||||
if len(line_ids):
|
||||
move_line_obj.reconcile(cr, uid, line_ids, 'auto', form['writeoff_acc_id'], form['period_id'], form['journal_id'], context)
|
||||
reconciled += len(line_ids)
|
||||
|
||||
# get the list of partners who have more than one unreconciled transaction
|
||||
cr.execute(
|
||||
"SELECT partner_id " \
|
||||
"FROM account_move_line " \
|
||||
"WHERE account_id=%s " \
|
||||
"AND reconcile_id IS NULL " \
|
||||
"AND state <> 'draft' " \
|
||||
"AND partner_id IS NOT NULL " \
|
||||
"GROUP BY partner_id " \
|
||||
"HAVING count(*)>1",
|
||||
(account_id,))
|
||||
partner_ids = [id for (id,) in cr.fetchall()]
|
||||
#filter?
|
||||
for partner_id in partner_ids:
|
||||
# get the list of unreconciled 'debit transactions' for this partner
|
||||
cr.execute(
|
||||
"SELECT id, debit " \
|
||||
"FROM account_move_line " \
|
||||
"WHERE account_id=%s " \
|
||||
"AND partner_id=%s " \
|
||||
"AND reconcile_id IS NULL " \
|
||||
"AND state <> 'draft' " \
|
||||
"AND debit > 0",
|
||||
(account_id, partner_id))
|
||||
debits = cr.fetchall()
|
||||
|
||||
# get the list of unreconciled 'credit transactions' for this partner
|
||||
cr.execute(
|
||||
"SELECT id, credit " \
|
||||
"FROM account_move_line " \
|
||||
"WHERE account_id=%s " \
|
||||
"AND partner_id=%s " \
|
||||
"AND reconcile_id IS NULL " \
|
||||
"AND state <> 'draft' " \
|
||||
"AND credit > 0",
|
||||
(account_id, partner_id))
|
||||
credits = cr.fetchall()
|
||||
|
||||
(rec, unrec) = self.do_reconcile(cr, uid, credits, debits, max_amount, power, form['writeoff_acc_id'], form['period_id'], form['journal_id'], context)
|
||||
reconciled += rec
|
||||
unreconciled += unrec
|
||||
|
||||
# add the number of transactions for partners who have only one
|
||||
# unreconciled transactions to the unreconciled count
|
||||
partner_filter = partner_ids and 'AND partner_id not in (%s)' % ','.join(map(str, filter(None, partner_ids))) or ''
|
||||
cr.execute(
|
||||
"SELECT count(*) " \
|
||||
"FROM account_move_line " \
|
||||
"WHERE account_id=%s " \
|
||||
"AND reconcile_id IS NULL " \
|
||||
"AND state <> 'draft' " + partner_filter,
|
||||
(account_id,))
|
||||
additional_unrec = cr.fetchone()[0]
|
||||
context.update({'reconciled': reconciled, 'unreconciled': unreconciled + additional_unrec})
|
||||
model_data_ids = obj_model.search(cr,uid,[('model','=','ir.ui.view'),('name','=','account_automatic_reconcile_view1')])
|
||||
resource_id = obj_model.read(cr, uid, model_data_ids, fields=['res_id'])[0]['res_id']
|
||||
return {
|
||||
'view_type': 'form',
|
||||
'view_mode': 'form',
|
||||
'res_model': 'account.automatic.reconcile',
|
||||
'views': [(resource_id,'form')],
|
||||
'type': 'ir.actions.act_window',
|
||||
'target': 'new',
|
||||
'context': context,
|
||||
'nodestroy':True,
|
||||
}
|
||||
|
||||
account_automatic_reconcile()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -0,0 +1,67 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="account_automatic_reconcile_view" model="ir.ui.view">
|
||||
<field name="name">Account Automatic Reconcile</field>
|
||||
<field name="model">account.automatic.reconcile</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Reconciliation">
|
||||
<separator string="Options" colspan="4"/>
|
||||
<field name="account_ids" colspan="4" domain="[('reconcile','=',1)]"/>
|
||||
<field name="date1"/>
|
||||
<field name="date2"/>
|
||||
<field name="power"/>
|
||||
<separator string="Write-Off Move" colspan="4"/>
|
||||
<field name="max_amount"/>
|
||||
<field name="writeoff_acc_id"/>
|
||||
<field name="journal_id"/>
|
||||
<field name="period_id"/>
|
||||
<separator string ="" colspan="4"/>
|
||||
<group colspan="2" col="4">
|
||||
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
|
||||
<button name="reconcile" string="Reconcile" type="object" icon="gtk-ok"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_account_automatic_reconcile" model="ir.actions.act_window">
|
||||
<field name="name">Account Automatic Reconcile</field>
|
||||
<field name="res_model">account.automatic.reconcile</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="account_automatic_reconcile_view"/>
|
||||
<field name="context">{'record_id':active_id}</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<menuitem
|
||||
icon="STOCK_EXECUTE"
|
||||
name="Automatic reconciliation"
|
||||
action="action_account_automatic_reconcile"
|
||||
id="menu_automatic_reconcile"
|
||||
parent="next_id_20"/>
|
||||
|
||||
<record id="account_automatic_reconcile_view1" model="ir.ui.view">
|
||||
<field name="name">Automatic reconcile unreconcile</field>
|
||||
<field name="model">account.automatic.reconcile</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Reconciliation result">
|
||||
<field name="reconciled"/>
|
||||
<newline/>
|
||||
<field name="unreconciled"/>
|
||||
<group colspan="4" col="6">
|
||||
<separator colspan="6"/>
|
||||
<button special="cancel" string="Ok" icon="gtk-ok" default_focus="1"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
@ -50,7 +50,7 @@ class account_balance_report(osv.osv_memory):
|
|||
'date_to': fields.date('End date', required=True),
|
||||
}
|
||||
|
||||
def _get_company(self, cr, uid, ids, context=None):
|
||||
def _get_company(self, cr, uid, context=None):
|
||||
user_obj = self.pool.get('res.users')
|
||||
company_obj = self.pool.get('res.company')
|
||||
user = user_obj.browse(cr, uid, uid, context=context)
|
||||
|
@ -109,6 +109,7 @@ class account_balance_report(osv.osv_memory):
|
|||
'type': 'ir.actions.report.xml',
|
||||
'report_name': 'account.account.balance',
|
||||
'datas': data,
|
||||
'nodestroy':True,
|
||||
}
|
||||
|
||||
def _check_date(self, cr, uid, data, context=None):
|
||||
|
@ -127,6 +128,7 @@ class account_balance_report(osv.osv_memory):
|
|||
'type': 'ir.actions.report.xml',
|
||||
'report_name': 'account.account.balance',
|
||||
'datas': data,
|
||||
'nodestroy':True,
|
||||
}
|
||||
else:
|
||||
raise osv.except_osv(_('UserError'),_('Date not in a defined fiscal year'))
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import osv, fields
|
||||
from tools.translate import _
|
||||
|
||||
|
@ -40,7 +39,7 @@ class account_central_journal(osv.osv_memory):
|
|||
period_id = datas['form']['period_id']
|
||||
journal_id = datas['form']['journal_id']
|
||||
|
||||
if type(period_id)==type([]):
|
||||
if isinstance(period_id, list):
|
||||
ids_final = []
|
||||
for journal in journal_id:
|
||||
for period in period_id:
|
||||
|
@ -53,10 +52,9 @@ class account_central_journal(osv.osv_memory):
|
|||
'type': 'ir.actions.report.xml',
|
||||
'report_name': 'account.central.journal',
|
||||
'datas': datas,
|
||||
'nodestroy':True,
|
||||
}
|
||||
|
||||
account_central_journal()
|
||||
|
||||
#vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
||||
#vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -71,4 +71,4 @@ class account_change_currency(osv.osv_memory):
|
|||
|
||||
account_change_currency()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -18,7 +18,6 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import fields, osv
|
||||
from tools.translate import _
|
||||
|
||||
|
@ -30,44 +29,42 @@ class account_chart(osv.osv_memory):
|
|||
_description = "chart"
|
||||
_columns = {
|
||||
'fiscalyear': fields.many2one('account.fiscalyear', \
|
||||
'Fiscal year', \
|
||||
help = 'Keep empty for all open fiscal years'),
|
||||
'target_move': fields.selection([
|
||||
('all', 'All Entries'),
|
||||
('posted', 'All Posted Entries'),
|
||||
], 'Target Moves', required = True),
|
||||
|
||||
'Fiscal year', \
|
||||
help = 'Keep empty for all open fiscal years'),
|
||||
'target_move': fields.selection([('all', 'All Entries'),
|
||||
('posted', 'All Posted Entries')], 'Target Moves', required = True),
|
||||
}
|
||||
def _get_defaults(self, cr, uid, context={}):
|
||||
"""Return default Fiscalyear value"""
|
||||
fiscalyear_obj = self.pool.get('account.fiscalyear')
|
||||
fiscalyear = fiscalyear_obj.find(cr, uid)
|
||||
return fiscalyear
|
||||
|
||||
def _get_fiscalyear(self, cr, uid, context=None):
|
||||
"""Return default Fiscalyear value"""
|
||||
fiscalyear_obj = self.pool.get('account.fiscalyear')
|
||||
fiscalyear = fiscalyear_obj.find(cr, uid)
|
||||
return fiscalyear
|
||||
|
||||
def account_chart_open_window(self, cr, uid, ids, context={}):
|
||||
"""
|
||||
Opens chart of Accounts
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param ids: List of account chart’s IDs
|
||||
@return: dictionary of Open account chart window on given fiscalyear and all Entries or posted entries
|
||||
"""
|
||||
mod_obj = self.pool.get('ir.model.data')
|
||||
act_obj = self.pool.get('ir.actions.act_window')
|
||||
for data in self.read(cr, uid, ids,context=context):
|
||||
result = mod_obj._get_id(cr, uid, 'account', 'action_account_tree')
|
||||
id = mod_obj.read(cr, uid, [result], ['res_id'],context=context)[0]['res_id']
|
||||
result = act_obj.read(cr, uid, [id], context=context)[0]
|
||||
result['context'] = str({'fiscalyear': data['fiscalyear'], \
|
||||
'state': data['target_move']})
|
||||
if data['fiscalyear']:
|
||||
result['name'] += ':' + self.pool.get('account.fiscalyear').read(cr, uid, [data['fiscalyear']],context=context)[0]['code']
|
||||
return result
|
||||
|
||||
"""
|
||||
Opens chart of Accounts
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param ids: List of account chart’s IDs
|
||||
@return: dictionary of Open account chart window on given fiscalyear and all Entries or posted entries
|
||||
"""
|
||||
mod_obj = self.pool.get('ir.model.data')
|
||||
act_obj = self.pool.get('ir.actions.act_window')
|
||||
data = self.read(cr, uid, ids, [], context=context)[0]
|
||||
result = mod_obj._get_id(cr, uid, 'account', 'action_account_tree')
|
||||
id = mod_obj.read(cr, uid, [result], ['res_id'],context=context)[0]['res_id']
|
||||
result = act_obj.read(cr, uid, [id], context=context)[0]
|
||||
result['context'] = str({'fiscalyear': data['fiscalyear'], \
|
||||
'state': data['target_move']})
|
||||
if data['fiscalyear']:
|
||||
result['name'] += ':' + self.pool.get('account.fiscalyear').read(cr, uid, [data['fiscalyear']],context=context)[0]['code']
|
||||
return result
|
||||
|
||||
_defaults = {
|
||||
'fiscalyear': _get_defaults,
|
||||
'target_move': lambda * a: 'all'
|
||||
'fiscalyear': _get_fiscalyear,
|
||||
'target_move': 'all'
|
||||
}
|
||||
account_chart()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -74,12 +74,14 @@ class account_compare_account_balance_report(osv.osv_memory):
|
|||
'type': 'ir.actions.report.xml',
|
||||
'report_name': 'account.account.balance.landscape',
|
||||
'datas': data,
|
||||
'nodestroy':True,
|
||||
}
|
||||
else:
|
||||
return {
|
||||
'type': 'ir.actions.report.xml',
|
||||
'report_name': 'account.balance.account.balance',
|
||||
'datas': data,
|
||||
'nodestroy':True,
|
||||
}
|
||||
if data['form']['format_perc']==1:
|
||||
if len(data['form']['fiscalyear'])<=2:
|
||||
|
@ -88,12 +90,14 @@ class account_compare_account_balance_report(osv.osv_memory):
|
|||
'type': 'ir.actions.report.xml',
|
||||
'report_name': 'account.account.balance.landscape',
|
||||
'datas': data,
|
||||
'nodestroy':True,
|
||||
}
|
||||
else:
|
||||
return {
|
||||
'type': 'ir.actions.report.xml',
|
||||
'report_name': 'account.balance.account.balance',
|
||||
'datas': data,
|
||||
'nodestroy':True,
|
||||
}
|
||||
else:
|
||||
if len(data['form']['fiscalyear'])==3:
|
||||
|
@ -102,6 +106,7 @@ class account_compare_account_balance_report(osv.osv_memory):
|
|||
'type': 'ir.actions.report.xml',
|
||||
'report_name': 'account.account.balance.landscape',
|
||||
'datas': data,
|
||||
'nodestroy':True,
|
||||
}
|
||||
else:
|
||||
raise osv.except_osv(_('Warning !'), _('You might have done following mistakes. Please correct them and try again. \n 1. You have selected more than 3 years in any case. \n 2. You have not selected Percentage option, but you have selected more than 2 years. \n You can select maximum 3 years. Please check again. \n 3. You have selected Percentage option with more than 2 years, but you have not selected landscape format. You have to select Landscape option. Please Check it.'))
|
||||
|
@ -114,6 +119,7 @@ class account_compare_account_balance_report(osv.osv_memory):
|
|||
'type': 'ir.actions.report.xml',
|
||||
'report_name': 'account.account.balance.landscape',
|
||||
'datas': data,
|
||||
'nodestroy':True,
|
||||
}
|
||||
else:
|
||||
raise osv.except_osv(_('Warning !'), _('You might have done following mistakes. Please correct them and try again. \n 1. You have selected more than 3 years in any case. \n 2. You have not selected Percentage option, but you have selected more than 2 years. \n You can select maximum 3 years. Please check again. \n 3. You have selected Percentage option with more than 2 years, but you have not selected landscape format. You have to select Landscape option. Please Check it.'))
|
||||
|
@ -123,14 +129,15 @@ class account_compare_account_balance_report(osv.osv_memory):
|
|||
'type': 'ir.actions.report.xml',
|
||||
'report_name': 'account.account.balance.landscape',
|
||||
'datas': data,
|
||||
'nodestroy':True,
|
||||
}
|
||||
else:
|
||||
return {
|
||||
'type': 'ir.actions.report.xml',
|
||||
'report_name': 'account.balance.account.balance',
|
||||
'datas': data,
|
||||
'nodestroy':True,
|
||||
}
|
||||
account_compare_account_balance_report()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -44,7 +44,7 @@
|
|||
src_model="account.account"
|
||||
view_mode="form"
|
||||
target="new"
|
||||
key2="client_action_multi"
|
||||
key2="client_print_multi"
|
||||
id="action_view_account_compare_account_balance_report"/>
|
||||
|
||||
</data>
|
||||
|
|
|
@ -35,7 +35,7 @@ class account_fiscalyear_close_state(osv.osv_memory):
|
|||
'sure': fields.boolean('Check this box', required=False)
|
||||
}
|
||||
|
||||
def data_save(self, cr, uid, ids, context={}):
|
||||
def data_save(self, cr, uid, ids, context=None):
|
||||
"""
|
||||
This function close account fiscalyear
|
||||
@param cr: the current row, from the database cursor,
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import osv, fields
|
||||
from tools.translate import _
|
||||
|
||||
|
@ -31,7 +30,7 @@ class account_general_journal(osv.osv_memory):
|
|||
'period_id': fields.many2many('account.period', 'account_period_rel', 'account_id', 'period_id', 'Periods', required=True),
|
||||
}
|
||||
|
||||
def check_data(self, cr, uid, ids, context={}):
|
||||
def check_data(self, cr, uid, ids, context=None):
|
||||
obj_jperiod = self.pool.get('account.journal.period')
|
||||
datas = {}
|
||||
datas['ids'] = []
|
||||
|
@ -53,8 +52,8 @@ class account_general_journal(osv.osv_memory):
|
|||
'type': 'ir.actions.report.xml',
|
||||
'report_name': 'account.general.journal',
|
||||
'datas': datas,
|
||||
'nodestroy':True,
|
||||
}
|
||||
|
||||
account_general_journal()
|
||||
|
||||
#vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
#vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -50,7 +50,7 @@ class account_general_ledger_report(osv.osv_memory):
|
|||
'date_to': fields.date("End date", required=True)
|
||||
}
|
||||
|
||||
def _get_company(self, cr, uid, ids, context=None):
|
||||
def _get_company(self, cr, uid, context=None):
|
||||
user_obj = self.pool.get('res.users')
|
||||
company_obj = self.pool.get('res.company')
|
||||
if context is None:
|
||||
|
@ -63,8 +63,8 @@ class account_general_ledger_report(osv.osv_memory):
|
|||
|
||||
_defaults = {
|
||||
'state' : 'none',
|
||||
'date_from' : lambda *a: time.strftime('%Y-01-01'),
|
||||
'date_to' : lambda *a: time.strftime('%Y-%m-%d'),
|
||||
'date_from' : time.strftime('%Y-01-01'),
|
||||
'date_to' : time.strftime('%Y-%m-%d'),
|
||||
'company_id' : _get_company,
|
||||
'display_account' : 'bal_all',
|
||||
'sortbydate' : 'sort_date',
|
||||
|
@ -107,12 +107,14 @@ class account_general_ledger_report(osv.osv_memory):
|
|||
'type': 'ir.actions.report.xml',
|
||||
'report_name': 'account.general.ledger_landscape',
|
||||
'datas': data,
|
||||
'nodestroy':True,
|
||||
}
|
||||
else:
|
||||
return {
|
||||
'type': 'ir.actions.report.xml',
|
||||
'report_name': 'account.general.ledger',
|
||||
'datas': data,
|
||||
'nodestroy':True,
|
||||
}
|
||||
else:
|
||||
raise osv.except_osv(_('UserError'),_('Date not in a defined fiscal year'))
|
||||
|
@ -139,12 +141,14 @@ class account_general_ledger_report(osv.osv_memory):
|
|||
'type': 'ir.actions.report.xml',
|
||||
'report_name': 'account.general.ledger_landscape',
|
||||
'datas': data,
|
||||
'nodestroy':True,
|
||||
}
|
||||
else:
|
||||
return {
|
||||
'type': 'ir.actions.report.xml',
|
||||
'report_name': 'account.general.ledger',
|
||||
'datas': data,
|
||||
'nodestroy':True,
|
||||
}
|
||||
account_general_ledger_report()
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ class account_invoice_refund(osv.osv_memory):
|
|||
'description': fields.char('Description', size=150, required=True),
|
||||
}
|
||||
|
||||
def compute_refund(self, cr, uid, ids, mode, context={}):
|
||||
def compute_refund(self, cr, uid, ids, mode, context=None):
|
||||
"""
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
|
@ -46,7 +46,11 @@ class account_invoice_refund(osv.osv_memory):
|
|||
account_m_line_obj = self.pool.get('account.move.line')
|
||||
mod_obj = self.pool.get('ir.model.data')
|
||||
act_obj = self.pool.get('ir.actions.act_window')
|
||||
for form in self.read(cr, uid, ids,context=context):
|
||||
|
||||
if context is None:
|
||||
context = {}
|
||||
|
||||
for form in self.read(cr, uid, ids, context=context):
|
||||
created_inv = []
|
||||
date = False
|
||||
period = False
|
||||
|
@ -171,7 +175,6 @@ class account_invoice_refund(osv.osv_memory):
|
|||
id = mod_obj.read(cr, uid, result, ['res_id'],context=context)['res_id']
|
||||
result = act_obj.read(cr, uid, id,context=context)
|
||||
result['res_id'] = created_inv
|
||||
|
||||
return result
|
||||
|
||||
def invoice_refund(self, cr, uid, ids, context={}):
|
||||
|
|
|
@ -34,29 +34,29 @@ class account_move_bank_reconcile(osv.osv_memory):
|
|||
}
|
||||
|
||||
def action_open_window(self, cr, uid, ids, context={}):
|
||||
"""
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param ids: account move bank reconcile’s ID or list of IDs
|
||||
@return: dictionary of Open account move line on given journal_id.
|
||||
"""
|
||||
for data in self.read(cr, uid, ids,context=context):
|
||||
cr.execute('select default_credit_account_id \
|
||||
from account_journal where id=%s', (data['journal_id'],))
|
||||
account_id = cr.fetchone()[0]
|
||||
if not account_id:
|
||||
raise osv.except_osv(_('Error'), _('You have to define \
|
||||
"""
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param ids: account move bank reconcile’s ID or list of IDs
|
||||
@return: dictionary of Open account move line on given journal_id.
|
||||
"""
|
||||
data = self.read(cr, uid, ids,context=context)[0]
|
||||
cr.execute('select default_credit_account_id \
|
||||
from account_journal where id=%s', (data['journal_id'],))
|
||||
account_id = cr.fetchone()[0]
|
||||
if not account_id:
|
||||
raise osv.except_osv(_('Error'), _('You have to define \
|
||||
the bank account\nin the journal definition for reconciliation.'))
|
||||
return {
|
||||
'domain': "[('journal_id','=',%d), ('account_id','=',%d), ('state','<>','draft')]" % (data['journal_id'], account_id),
|
||||
'name': _('Standard Encoding'),
|
||||
'view_type': 'form',
|
||||
'view_mode': 'tree,form',
|
||||
'res_model': 'account.move.line',
|
||||
'view_id': False,
|
||||
'context': "{'journal_id': %d}" % (data['journal_id'],),
|
||||
'type': 'ir.actions.act_window'
|
||||
}
|
||||
return {
|
||||
'domain': "[('journal_id','=',%d), ('account_id','=',%d), ('state','<>','draft')]" % (data['journal_id'], account_id),
|
||||
'name': _('Standard Encoding'),
|
||||
'view_type': 'form',
|
||||
'view_mode': 'tree,form',
|
||||
'res_model': 'account.move.line',
|
||||
'view_id': False,
|
||||
'context': "{'journal_id': %d}" % (data['journal_id'],),
|
||||
'type': 'ir.actions.act_window'
|
||||
}
|
||||
|
||||
account_move_bank_reconcile()
|
||||
|
||||
|
|
|
@ -26,13 +26,11 @@ import tools
|
|||
class account_move_journal(osv.osv_memory):
|
||||
_name = "account.move.journal"
|
||||
_description = "Move journal"
|
||||
|
||||
_columns = {
|
||||
'journal_id': fields.many2one('account.journal', 'Journal', required=True),
|
||||
'period_id': fields.many2one('account.period', 'Period', required=True),
|
||||
}
|
||||
|
||||
|
||||
def _get_period(self, cr, uid, context={}):
|
||||
"""Return default account period value"""
|
||||
ids = self.pool.get('account.period').find(cr, uid, context=context)
|
||||
|
@ -41,7 +39,11 @@ class account_move_journal(osv.osv_memory):
|
|||
period_id = ids[0]
|
||||
return period_id
|
||||
|
||||
def action_open_window(self, cr, uid, ids, context={}):
|
||||
_defaults = {
|
||||
'period_id': _get_period
|
||||
}
|
||||
|
||||
def action_open_window(self, cr, uid, ids, context=None):
|
||||
"""
|
||||
This function Open action move line window on given period and Journal/Payment Mode
|
||||
@param cr: the current row, from the database cursor,
|
||||
|
@ -52,46 +54,43 @@ class account_move_journal(osv.osv_memory):
|
|||
"""
|
||||
jp = self.pool.get('account.journal.period')
|
||||
mod_obj = self.pool.get('ir.model.data')
|
||||
for data in self.read(cr, uid, ids, ['journal_id', 'period_id'],context=context):
|
||||
cr.execute('select id,name from ir_ui_view where model=%s and type=%s', ('account.move.line', 'form'))
|
||||
view_res = cr.fetchone()
|
||||
journal_id = data['journal_id']
|
||||
period_id = data['period_id']
|
||||
if context is None:
|
||||
context = {}
|
||||
data = self.read(cr, uid, ids, ['journal_id', 'period_id'], context=context)[0]
|
||||
cr.execute('select id,name from ir_ui_view where model=%s and type=%s', ('account.move.line', 'form'))
|
||||
view_res = cr.fetchone()
|
||||
journal_id = data['journal_id']
|
||||
period_id = data['period_id']
|
||||
|
||||
ids = jp.search(cr, uid, [('journal_id', '=', journal_id), \
|
||||
('period_id', '=', period_id)],context=context)
|
||||
ids = jp.search(cr, uid, [('journal_id', '=', journal_id), \
|
||||
('period_id', '=', period_id)],context=context)
|
||||
|
||||
if not len(ids):
|
||||
name = self.pool.get('account.journal').read(cr, uid, [journal_id])[0]['name']
|
||||
state = self.pool.get('account.period').read(cr, uid, [period_id])[0]['state']
|
||||
if state == 'done':
|
||||
raise osv.except_osv(_('UserError'), _('This period is already closed !'))
|
||||
company = self.pool.get('account.period').read(cr, uid, [period_id])[0]['company_id'][0]
|
||||
jp.create(cr, uid, {'name': name, 'period_id': period_id, 'journal_id': journal_id, 'company_id': company},context=context)
|
||||
if not len(ids):
|
||||
name = self.pool.get('account.journal').read(cr, uid, [journal_id])[0]['name']
|
||||
state = self.pool.get('account.period').read(cr, uid, [period_id])[0]['state']
|
||||
if state == 'done':
|
||||
raise osv.except_osv(_('UserError'), _('This period is already closed !'))
|
||||
company = self.pool.get('account.period').read(cr, uid, [period_id])[0]['company_id'][0]
|
||||
jp.create(cr, uid, {'name': name, 'period_id': period_id, 'journal_id': journal_id, 'company_id': company},context=context)
|
||||
|
||||
ids = jp.search(cr, uid, [('journal_id', '=', journal_id), ('period_id', '=', period_id)],context=context)
|
||||
jp = jp.browse(cr, uid, ids, context=context)[0]
|
||||
name = (jp.journal_id.code or '') + ':' + (jp.period_id.code or '')
|
||||
ids = jp.search(cr, uid, [('journal_id', '=', journal_id), ('period_id', '=', period_id)],context=context)
|
||||
jp = jp.browse(cr, uid, ids, context=context)[0]
|
||||
name = (jp.journal_id.code or '') + ':' + (jp.period_id.code or '')
|
||||
|
||||
result = mod_obj._get_id(cr, uid, 'account', 'view_account_move_line_filter')
|
||||
res = mod_obj.read(cr, uid, result, ['res_id'],context=context)
|
||||
result = mod_obj._get_id(cr, uid, 'account', 'view_account_move_line_filter')
|
||||
res = mod_obj.read(cr, uid, result, ['res_id'],context=context)
|
||||
|
||||
return {
|
||||
'domain': "[('journal_id','=',%d), ('period_id','=',%d)]" % (journal_id, period_id),
|
||||
'name': name,
|
||||
'view_type': 'form',
|
||||
'view_mode': 'tree,form',
|
||||
'res_model': 'account.move.line',
|
||||
'view_id': view_res,
|
||||
'context': "{'journal_id': %d, 'period_id': %d}" % (journal_id, period_id),
|
||||
'type': 'ir.actions.act_window',
|
||||
'search_view_id': res['res_id']
|
||||
}
|
||||
|
||||
|
||||
_defaults = {
|
||||
'period_id': _get_period
|
||||
}
|
||||
return {
|
||||
'domain': "[('journal_id','=',%d), ('period_id','=',%d)]" % (journal_id, period_id),
|
||||
'name': name,
|
||||
'view_type': 'form',
|
||||
'view_mode': 'tree,form',
|
||||
'res_model': 'account.move.line',
|
||||
'view_id': view_res,
|
||||
'context': "{'journal_id': %d, 'period_id': %d}" % (journal_id, period_id),
|
||||
'type': 'ir.actions.act_window',
|
||||
'search_view_id': res['res_id']
|
||||
}
|
||||
|
||||
account_move_journal()
|
||||
|
||||
|
|
|
@ -71,5 +71,4 @@ class account_move_line_select(osv.osv_memory):
|
|||
|
||||
account_move_line_select()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -23,15 +23,12 @@ from osv import fields, osv
|
|||
from tools.translate import _
|
||||
import tools
|
||||
|
||||
|
||||
class account_move_line_unreconcile_select(osv.osv_memory):
|
||||
|
||||
_name = "account.move.line.unreconcile.select"
|
||||
_description = "Unreconciliation"
|
||||
_columns ={
|
||||
'account_id': fields.many2one('account.account','Account',required=True),
|
||||
}
|
||||
|
||||
def action_open_window(self, cr, uid, ids, context={}):
|
||||
data = self.read(cr, uid, ids, context=context)[0]
|
||||
return {
|
||||
|
@ -46,6 +43,4 @@ class account_move_line_unreconcile_select(osv.osv_memory):
|
|||
|
||||
account_move_line_unreconcile_select()
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -18,12 +18,10 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import fields, osv
|
||||
from tools.translate import _
|
||||
|
||||
class account_open_closed_fiscalyear(osv.osv_memory):
|
||||
|
||||
_name = "account.open.closed.fiscalyear"
|
||||
_description = "Choose Fiscal Year"
|
||||
_columns = {
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import time
|
||||
|
||||
from tools.translate import _
|
||||
|
@ -48,7 +47,7 @@ class account_partner_balance(osv.osv_memory):
|
|||
'date2': fields.date('End date', required=True),
|
||||
}
|
||||
|
||||
def _get_company(self, cr, uid, ids, context=None):
|
||||
def _get_company(self, cr, uid, context=None):
|
||||
user_obj = self.pool.get('res.users')
|
||||
company_obj = self.pool.get('res.company')
|
||||
user = user_obj.browse(cr, uid, uid, context=context)
|
||||
|
@ -58,13 +57,13 @@ class account_partner_balance(osv.osv_memory):
|
|||
return company_obj.search(cr, uid, [('parent_id', '=', False)])[0]
|
||||
|
||||
_defaults={
|
||||
'state' : 'none',
|
||||
'date1' : lambda *a: time.strftime('%Y-01-01'),
|
||||
'date2' : lambda *a: time.strftime('%Y-%m-%d'),
|
||||
'result_selection' : lambda *a: 'all',
|
||||
'soldeinit' : True,
|
||||
'company_id' : _get_company,
|
||||
'fiscalyear' : False,
|
||||
'state' : 'none',
|
||||
'date1' : time.strftime('%Y-01-01'),
|
||||
'date2' : time.strftime('%Y-%m-%d'),
|
||||
'result_selection' : 'all',
|
||||
'soldeinit' : True,
|
||||
'company_id' : _get_company,
|
||||
'fiscalyear' : False,
|
||||
}
|
||||
|
||||
def check_state(self, cr, uid, ids, context=None):
|
||||
|
@ -84,6 +83,7 @@ class account_partner_balance(osv.osv_memory):
|
|||
'type': 'ir.actions.report.xml',
|
||||
'report_name': 'account.partner.balance',
|
||||
'datas': data,
|
||||
'nodestroy':True,
|
||||
}
|
||||
|
||||
def _check_date(self, cr, uid, data, context):
|
||||
|
@ -99,6 +99,7 @@ class account_partner_balance(osv.osv_memory):
|
|||
'type': 'ir.actions.report.xml',
|
||||
'report_name': 'account.partner.balance',
|
||||
'datas': data,
|
||||
'nodestroy':True,
|
||||
}
|
||||
else:
|
||||
raise osv.except_osv(_('UserError'),_('Date not in a defined fiscal year'))
|
||||
|
|
|
@ -32,7 +32,7 @@ class account_period_close(osv.osv_memory):
|
|||
'sure': fields.boolean('Check this box'),
|
||||
}
|
||||
|
||||
def data_save(self, cr, uid, ids, context={}):
|
||||
def data_save(self, cr, uid, ids, context=None):
|
||||
"""
|
||||
This function close period
|
||||
@param cr: the current row, from the database cursor,
|
||||
|
@ -41,7 +41,7 @@ class account_period_close(osv.osv_memory):
|
|||
"""
|
||||
|
||||
mode = 'done'
|
||||
for form in self.read(cr, uid, ids,context=context):
|
||||
for form in self.read(cr, uid, ids, context=context):
|
||||
if form['sure']:
|
||||
for id in context['active_ids']:
|
||||
cr.execute('update account_journal_period set state=%s where period_id=%s', (mode, id))
|
||||
|
|
|
@ -34,10 +34,10 @@ class account_print_journal(osv.osv_memory):
|
|||
}
|
||||
|
||||
_defaults = {
|
||||
'sort_selection': lambda *a: 'date',
|
||||
}
|
||||
'sort_selection': lambda *a: 'date',
|
||||
}
|
||||
|
||||
def check_data(self, cr, uid, ids, context={}):
|
||||
def check_data(self, cr, uid, ids, context=None):
|
||||
obj_jperiod = self.pool.get('account.journal.period')
|
||||
datas = {}
|
||||
datas['ids'] = []
|
||||
|
@ -59,8 +59,9 @@ class account_print_journal(osv.osv_memory):
|
|||
'type': 'ir.actions.report.xml',
|
||||
'report_name': 'account.journal.period.print',
|
||||
'datas': datas,
|
||||
'nodestroy':True,
|
||||
}
|
||||
|
||||
account_print_journal()
|
||||
|
||||
#vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
#vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -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', '<>', '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>
|
|
@ -49,7 +49,7 @@ class account_partner_ledger(osv.osv_memory):
|
|||
'date2': fields.date('End date', required=True),
|
||||
}
|
||||
|
||||
def _get_company(self, cr, uid, ids, context=None):
|
||||
def _get_company(self, cr, uid, context=None):
|
||||
user_obj = self.pool.get('res.users')
|
||||
company_obj = self.pool.get('res.company')
|
||||
if context is None:
|
||||
|
@ -97,12 +97,14 @@ class account_partner_ledger(osv.osv_memory):
|
|||
'type': 'ir.actions.report.xml',
|
||||
'report_name': 'account.third_party_ledger',
|
||||
'datas': data,
|
||||
'nodestroy':True,
|
||||
}
|
||||
else:
|
||||
return {
|
||||
'type': 'ir.actions.report.xml',
|
||||
'report_name': 'account.third_party_ledger_other',
|
||||
'datas': data,
|
||||
'nodestroy':True,
|
||||
}
|
||||
|
||||
def _check_date(self, cr, uid, data, context=None):
|
||||
|
@ -120,6 +122,7 @@ class account_partner_ledger(osv.osv_memory):
|
|||
'type': 'ir.actions.report.xml',
|
||||
'report_name': 'account.third_party_ledger',
|
||||
'datas': data,
|
||||
'nodestroy':True,
|
||||
}
|
||||
else:
|
||||
raise osv.except_osv(_('UserError'),_('Date not in a defined fiscal year'))
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
<field name="model"/>
|
||||
</group>
|
||||
<group colspan="4" col="6">
|
||||
<label string ="" colspan="2"/>
|
||||
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
|
||||
<button icon="gtk-execute" string="Create Entries" name="create_entries" type="object"/>
|
||||
</group>
|
||||
|
@ -53,7 +52,7 @@
|
|||
<label string = "Entry Lines Created." colspan="2"/>
|
||||
<newline/>
|
||||
<button icon="gtk-ok" special="cancel" string="Ok"/>
|
||||
<button icon="gtk-execute" string="Open" name="open_moves" type="object"/>
|
||||
<button icon="gtk-execute" string="Open" name="open_moves" type="object" default_focus='1'/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
|
@ -69,7 +68,7 @@
|
|||
<label string = "Are you sure you want to create entries?" colspan="2"/>
|
||||
<newline/>
|
||||
<button icon="gtk-ok" special="cancel" string="Cancel"/>
|
||||
<button icon="gtk-execute" string="Ok" name="create_entries" type="object"/>
|
||||
<button icon="gtk-execute" string="Ok" name="create_entries" type="object" default_focus='1'/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
|
|
|
@ -33,7 +33,7 @@ class account_vat_declaration(osv.osv_memory):
|
|||
'periods': fields.many2many('account.period', 'vat_period_rel', 'vat_id', 'period_id', 'Periods', help="All periods if empty"),
|
||||
}
|
||||
|
||||
def _get_company(self, cr, uid, ids, context={}):
|
||||
def _get_company(self, cr, uid, context={}):
|
||||
user_obj = self.pool.get('res.users')
|
||||
company_obj = self.pool.get('res.company')
|
||||
user = user_obj.browse(cr, uid, uid, context=context)
|
||||
|
@ -43,7 +43,7 @@ class account_vat_declaration(osv.osv_memory):
|
|||
return company_obj.search(cr, uid, [('parent_id', '=', False)])[0]
|
||||
|
||||
_defaults = {
|
||||
'based_on': lambda *a: 'invoices',
|
||||
'based_on': 'invoices',
|
||||
'company_id': _get_company
|
||||
}
|
||||
|
||||
|
@ -57,6 +57,7 @@ class account_vat_declaration(osv.osv_memory):
|
|||
'type': 'ir.actions.report.xml',
|
||||
'report_name': 'account.vat.declaration',
|
||||
'datas': datas,
|
||||
'nodestroy':True,
|
||||
}
|
||||
|
||||
account_vat_declaration()
|
||||
|
|
|
@ -1,322 +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 pooler
|
||||
import time
|
||||
from tools.translate import _
|
||||
|
||||
#TODO:
|
||||
|
||||
# a rajouter comme questions ds le wizard:
|
||||
# - account_id (et mettre wizard ds le menu et pas sur client_action_multi)
|
||||
# - journal
|
||||
# - compte d'ajustement
|
||||
# - montant max (0,03)
|
||||
# <field name="max_amount"/>
|
||||
# - libelle write-off
|
||||
# - devise principale ou secondaire
|
||||
# devise secondaire = amount_currency
|
||||
# si devise: pas prendre ceux avec montant_devise = 0
|
||||
|
||||
# a demander à fabien:
|
||||
# - checkbox (comme ds sage) "lettrage rapide des comptes soldés"?
|
||||
|
||||
# pr creer ecriture: creer move.line avec period et journal dans le contexte
|
||||
# faire methode sur period: get_current_period
|
||||
|
||||
_reconcile_form = '''<?xml version="1.0"?>
|
||||
<form string="Reconciliation">
|
||||
<separator string="Options" colspan="4"/>
|
||||
<field name="account_ids" colspan="4" domain="[('reconcile','=',1)]" views="account.view_account_list">
|
||||
</field>
|
||||
<field name="date1"/>
|
||||
<field name="date2"/>
|
||||
<field name="power"/>
|
||||
<separator string="Write-Off Move" colspan="4"/>
|
||||
<field name="max_amount"/>
|
||||
<field name="writeoff_acc_id"/>
|
||||
<field name="journal_id"/>
|
||||
<field name="period_id"/>
|
||||
</form>'''
|
||||
|
||||
_reconcile_fields = {
|
||||
'account_ids': {
|
||||
'string': 'Account to reconcile',
|
||||
'type': 'many2many',
|
||||
'relation': 'account.account',
|
||||
'domain': [('reconcile','=',1)],
|
||||
'help': 'If no account is specified, the reconciliation will be made using every accounts that can be reconcilied',
|
||||
},
|
||||
'writeoff_acc_id': {
|
||||
'string': 'Account',
|
||||
'type': 'many2one',
|
||||
'relation': 'account.account',
|
||||
'required': True
|
||||
},
|
||||
'journal_id': {
|
||||
'string': 'Journal',
|
||||
'type': 'many2one',
|
||||
'relation': 'account.journal',
|
||||
'required': True
|
||||
},
|
||||
'period_id': {
|
||||
'string': 'Period',
|
||||
'type': 'many2one',
|
||||
'relation': 'account.period',
|
||||
'required': True
|
||||
},
|
||||
'max_amount': {
|
||||
'string': 'Maximum write-off amount',
|
||||
'type': 'float',
|
||||
},
|
||||
#'currency': {
|
||||
# 'string': 'Reconcile in',
|
||||
# 'type': 'selection',
|
||||
# 'selection': [('current','current currency'), ('secondary','secondary currency')],
|
||||
# 'required': True
|
||||
#},
|
||||
'power': {
|
||||
'string': 'Power',
|
||||
'type': 'selection',
|
||||
'selection': [(p,str(p)) for p in range(2, 10)],
|
||||
'required': True
|
||||
},
|
||||
'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')
|
||||
},
|
||||
}
|
||||
|
||||
_result_form = '''<?xml version="1.0"?>
|
||||
<form string="Reconciliation result">
|
||||
<field name="reconciled"/>
|
||||
<newline/>
|
||||
<field name="unreconciled"/>
|
||||
</form>'''
|
||||
|
||||
_result_fields = {
|
||||
'reconciled': {
|
||||
'string': 'Reconciled transactions',
|
||||
'type': 'integer',
|
||||
'readonly': True
|
||||
},
|
||||
'unreconciled': {
|
||||
'string': 'Not reconciled transactions',
|
||||
'type': 'integer',
|
||||
'readonly': True
|
||||
},
|
||||
}
|
||||
|
||||
#TODO: cleanup and comment this code... For now, it is awfulllll
|
||||
# (way too complex, and really slow)...
|
||||
def do_reconcile(cr, uid, credits, debits, max_amount, power, writeoff_acc_id, period_id, journal_id, context={}):
|
||||
# for one value of a credit, check all debits, and combination of them
|
||||
# depending on the power. It starts with a power of one and goes up
|
||||
# to the max power allowed
|
||||
def check2(value, move_list, power):
|
||||
def check(value, move_list, power):
|
||||
for i in range(len(move_list)):
|
||||
move = move_list[i]
|
||||
if power == 1:
|
||||
if abs(value - move[1]) <= max_amount + 0.00001:
|
||||
return [move[0]]
|
||||
else:
|
||||
del move_list[i]
|
||||
res = check(value - move[1], move_list, power-1)
|
||||
move_list[i:i] = [move]
|
||||
if res:
|
||||
res.append(move[0])
|
||||
return res
|
||||
return False
|
||||
|
||||
for p in range(1, power+1):
|
||||
res = check(value, move_list, p)
|
||||
if res:
|
||||
return res
|
||||
return False
|
||||
|
||||
# for a list of credit and debit and a given power, check if there
|
||||
# are matching tuples of credit and debits, check all debits, and combination of them
|
||||
# depending on the power. It starts with a power of one and goes up
|
||||
# to the max power allowed
|
||||
def check4(list1, list2, power):
|
||||
def check3(value, list1, list2, list1power, power):
|
||||
for i in range(len(list1)):
|
||||
move = list1[i]
|
||||
if list1power == 1:
|
||||
res = check2(value + move[1], list2, power - 1)
|
||||
if res:
|
||||
return ([move[0]], res)
|
||||
else:
|
||||
del list1[i]
|
||||
res = check3(value + move[1], list1, list2, list1power-1, power-1)
|
||||
list1[i:i] = [move]
|
||||
if res:
|
||||
x, y = res
|
||||
x.append(move[0])
|
||||
return (x, y)
|
||||
return False
|
||||
|
||||
for p in range(1, power):
|
||||
res = check3(0, list1, list2, p, power)
|
||||
if res:
|
||||
return res
|
||||
return False
|
||||
|
||||
def check5(list1, list2, max_power):
|
||||
for p in range(2, max_power+1):
|
||||
res = check4(list1, list2, p)
|
||||
if res:
|
||||
return res
|
||||
|
||||
ok = True
|
||||
reconciled = 0
|
||||
move_line_obj = pooler.get_pool(cr.dbname).get('account.move.line')
|
||||
while credits and debits and ok:
|
||||
res = check5(credits, debits, power)
|
||||
if res:
|
||||
move_line_obj.reconcile(cr, uid, res[0] + res[1], 'auto', writeoff_acc_id, period_id, journal_id, context)
|
||||
reconciled += len(res[0]) + len(res[1])
|
||||
credits = [(id, credit) for (id, credit) in credits if id not in res[0]]
|
||||
debits = [(id, debit) for (id, debit) in debits if id not in res[1]]
|
||||
else:
|
||||
ok = False
|
||||
return (reconciled, len(credits)+len(debits))
|
||||
|
||||
def _reconcile(self, cr, uid, data, context):
|
||||
service = netsvc.LocalService("object_proxy")
|
||||
move_line_obj = pooler.get_pool(cr.dbname).get('account.move.line')
|
||||
form = data['form']
|
||||
max_amount = form.get('max_amount', 0.0)
|
||||
power = form['power']
|
||||
reconciled = unreconciled = 0
|
||||
if not form['account_ids'][0][2]:
|
||||
raise wizard.except_wizard(_('UserError'), _('You must select accounts to reconcile'))
|
||||
for account_id in form['account_ids'][0][2]:
|
||||
|
||||
# reconcile automatically all transactions from partners whose balance is 0
|
||||
cr.execute(
|
||||
"SELECT partner_id " \
|
||||
"FROM account_move_line " \
|
||||
"WHERE account_id=%s " \
|
||||
"AND reconcile_id IS NULL " \
|
||||
"AND state <> 'draft' " \
|
||||
"GROUP BY partner_id " \
|
||||
"HAVING ABS(SUM(debit-credit)) < %s AND count(*)>0",
|
||||
(account_id, max_amount or 0.0))
|
||||
partner_ids = [id for (id,) in cr.fetchall()]
|
||||
|
||||
for partner_id in partner_ids:
|
||||
cr.execute(
|
||||
"SELECT id " \
|
||||
"FROM account_move_line " \
|
||||
"WHERE account_id=%s " \
|
||||
"AND partner_id=%s " \
|
||||
"AND state <> 'draft' " \
|
||||
"AND reconcile_id IS NULL",
|
||||
(account_id, partner_id))
|
||||
line_ids = [id for (id,) in cr.fetchall()]
|
||||
|
||||
if len(line_ids):
|
||||
move_line_obj.reconcile(cr, uid, line_ids, 'auto', form['writeoff_acc_id'], form['period_id'], form['journal_id'], context)
|
||||
reconciled += len(line_ids)
|
||||
|
||||
# get the list of partners who have more than one unreconciled transaction
|
||||
cr.execute(
|
||||
"SELECT partner_id " \
|
||||
"FROM account_move_line " \
|
||||
"WHERE account_id=%s " \
|
||||
"AND reconcile_id IS NULL " \
|
||||
"AND state <> 'draft' " \
|
||||
"AND partner_id IS NOT NULL " \
|
||||
"GROUP BY partner_id " \
|
||||
"HAVING count(*)>1",
|
||||
(account_id,))
|
||||
partner_ids = [id for (id,) in cr.fetchall()]
|
||||
#filter?
|
||||
for partner_id in partner_ids:
|
||||
# get the list of unreconciled 'debit transactions' for this partner
|
||||
cr.execute(
|
||||
"SELECT id, debit " \
|
||||
"FROM account_move_line " \
|
||||
"WHERE account_id=%s " \
|
||||
"AND partner_id=%s " \
|
||||
"AND reconcile_id IS NULL " \
|
||||
"AND state <> 'draft' " \
|
||||
"AND debit > 0",
|
||||
(account_id, partner_id))
|
||||
debits = cr.fetchall()
|
||||
|
||||
# get the list of unreconciled 'credit transactions' for this partner
|
||||
cr.execute(
|
||||
"SELECT id, credit " \
|
||||
"FROM account_move_line " \
|
||||
"WHERE account_id=%s " \
|
||||
"AND partner_id=%s " \
|
||||
"AND reconcile_id IS NULL " \
|
||||
"AND state <> 'draft' " \
|
||||
"AND credit > 0",
|
||||
(account_id, partner_id))
|
||||
credits = cr.fetchall()
|
||||
|
||||
(rec, unrec) = do_reconcile(cr, uid, credits, debits, max_amount, power, form['writeoff_acc_id'], form['period_id'], form['journal_id'], context)
|
||||
reconciled += rec
|
||||
unreconciled += unrec
|
||||
|
||||
# add the number of transactions for partners who have only one
|
||||
# unreconciled transactions to the unreconciled count
|
||||
partner_filter = partner_ids and 'AND partner_id not in (%s)' % ','.join(map(str, filter(None, partner_ids))) or ''
|
||||
cr.execute(
|
||||
"SELECT count(*) " \
|
||||
"FROM account_move_line " \
|
||||
"WHERE account_id=%s " \
|
||||
"AND reconcile_id IS NULL " \
|
||||
"AND state <> 'draft' " + partner_filter,
|
||||
(account_id,))
|
||||
additional_unrec = cr.fetchone()[0]
|
||||
return {'reconciled':reconciled, 'unreconciled':unreconciled+additional_unrec}
|
||||
|
||||
class wiz_reconcile(wizard.interface):
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [],
|
||||
'result': {'type':'form', 'arch':_reconcile_form, 'fields':_reconcile_fields, 'state':[('end','Cancel', 'gtk-cancel'),('reconcile','Reconcile', 'gtk-ok')]}
|
||||
},
|
||||
'reconcile': {
|
||||
'actions': [_reconcile],
|
||||
'result': {'type':'form', 'arch':_result_form, 'fields':_result_fields, 'state':[('end','OK', 'gtk-cancel')]}
|
||||
}
|
||||
}
|
||||
wiz_reconcile('account.automatic.reconcile')
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -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', '<>', '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:
|
||||
|
|
@ -60,9 +60,10 @@ of distribution models.
|
|||
'init_xml': [],
|
||||
'update_xml': [
|
||||
'security/ir.model.access.csv',
|
||||
'model_wizard.xml',
|
||||
'account_analytic_plans_view.xml',
|
||||
'account_analytic_plans_report.xml'
|
||||
'account_analytic_plans_report.xml',
|
||||
'wizard/analytic_plan_create_model_view.xml',
|
||||
'wizard/account_crossovered_analytic_view.xml'
|
||||
],
|
||||
'demo_xml': [],
|
||||
'installable': True,
|
||||
|
|
|
@ -145,7 +145,7 @@ class account_analytic_plan_instance(osv.osv):
|
|||
return self.name_get(cr, uid, ids, context or {})
|
||||
|
||||
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
|
||||
wiz_id = self.pool.get('ir.actions.wizard').search(cr, uid, [("wiz_name","=","create.model")])
|
||||
wiz_id = self.pool.get('ir.actions.act_window').search(cr, uid, [("name","=","analytic.plan.create.model.action")])
|
||||
res = super(account_analytic_plan_instance,self).fields_view_get(cr, uid, view_id, view_type, context, toolbar=toolbar, submenu=submenu)
|
||||
|
||||
if (res['type']=='form'):
|
||||
|
|
|
@ -11,12 +11,12 @@
|
|||
auto="False"
|
||||
menu="False"/>
|
||||
|
||||
<wizard
|
||||
<!--<wizard
|
||||
id="account_analytic_account_inverted_balance_report"
|
||||
string="Crossovered Analytic"
|
||||
model="account.analytic.account"
|
||||
name="wizard.crossovered.analytic"
|
||||
keyword="client_print_multi"/>
|
||||
keyword="client_print_multi"/>-->
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<wizard
|
||||
string="Create Model"
|
||||
model="account.analytic.plan.instance"
|
||||
name="create.model" id="create_model"
|
||||
menu="False"/>
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
|
@ -15,11 +15,11 @@
|
|||
# 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 create_model
|
||||
import wizard_crossovered_analytic
|
||||
import analytic_plan_create_model
|
||||
import account_crossovered_analytic
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
|
|
@ -0,0 +1,75 @@
|
|||
# -*- 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
|
||||
from tools.translate import _
|
||||
|
||||
class account_crossovered_analytic(osv.osv_memory):
|
||||
_name = 'account.crossovered.analytic'
|
||||
_description = 'Print Crossovered Analytic'
|
||||
_columns = {
|
||||
'date1': fields.date('Start Date', required=True),
|
||||
'date2': fields.date('End Date', required=True),
|
||||
'journal_ids': fields.many2many('account.analytic.journal', 'crossovered_journal_rel', 'crossover_id', 'journal_id', 'Analytic Journal'),
|
||||
'ref': fields.many2one('account.analytic.account', 'Analytic Account Reference', required=True),
|
||||
'empty_line': fields.boolean('Dont show empty lines'),
|
||||
}
|
||||
_defaults = {
|
||||
'date1': lambda *a: time.strftime('%Y-01-01'),
|
||||
'date2': lambda *a: time.strftime('%Y-%m-%d'),
|
||||
}
|
||||
|
||||
def print_report(self, cr, uid, ids, context=None):
|
||||
cr.execute('select account_id from account_analytic_line')
|
||||
res = cr.fetchall()
|
||||
acc_ids = [x[0] for x in res]
|
||||
|
||||
data = self.read(cr, uid, ids, [], context=context)[0]
|
||||
|
||||
obj_acc = self.pool.get('account.analytic.account').browse(cr, uid, data['ref'])
|
||||
name = obj_acc.name
|
||||
|
||||
account_ids = self.pool.get('account.analytic.account').search(cr, uid, [('parent_id', 'child_of', [data['ref']])])
|
||||
|
||||
flag = True
|
||||
for acc in account_ids:
|
||||
if acc in acc_ids:
|
||||
flag = False
|
||||
break
|
||||
if flag:
|
||||
raise osv.except_osv(_('User Error'),_('There are no Analytic lines related to Account %s' % name))
|
||||
|
||||
datas = {
|
||||
'ids': [],
|
||||
'model': 'account.analytic.account',
|
||||
'form': data
|
||||
}
|
||||
return {
|
||||
'type': 'ir.actions.report.xml',
|
||||
'report_name': 'account.analytic.account.crossovered.analytic',
|
||||
'datas': datas,
|
||||
'nodestroy': True
|
||||
}
|
||||
|
||||
account_crossovered_analytic()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -0,0 +1,47 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="view_account_crossovered_analytic" model="ir.ui.view">
|
||||
<field name="name">account.crossovered.analytic.form</field>
|
||||
<field name="model">account.crossovered.analytic</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Crossovered Analytic">
|
||||
<group col="4" colspan="6">
|
||||
<field name="date1"/>
|
||||
<field name="date2"/>
|
||||
<field name="ref" colspan="4"/>
|
||||
<field name="journal_ids" colspan="4"/>
|
||||
<field name="empty_line"/>
|
||||
</group>
|
||||
<separator colspan="4"/>
|
||||
<group col="2" colspan="4">
|
||||
<button special="cancel" string="Cancel" icon='gtk-cancel'/>
|
||||
<button name="print_report" string="Print" colspan="1" type="object" icon="gtk-print"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_account_crossovered_analytic" model="ir.actions.act_window">
|
||||
<field name="name">Crossovered Analytic</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">account.crossovered.analytic</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.values" id="account_crossovered_analytic_values">
|
||||
<field name="model_id" ref="analytic.model_account_analytic_account" />
|
||||
<field name="object" eval="1" />
|
||||
<field name="name">Crossovered Analytic</field>
|
||||
<field name="key2">client_print_multi</field>
|
||||
<field name="value" eval="'ir.actions.act_window,' + str(ref('action_account_crossovered_analytic'))" />
|
||||
<field name="key">action</field>
|
||||
<field name="model">account.analytic.account</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
|
@ -0,0 +1,56 @@
|
|||
# -*- 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
from osv import osv
|
||||
from tools.translate import _
|
||||
|
||||
class analytic_plan_create_model(osv.osv_memory):
|
||||
_name = 'analytic.plan.create.model'
|
||||
_description = 'analytic.plan.create.model'
|
||||
|
||||
def activate(self, cr, uid, ids, context=None):
|
||||
plan_obj = self.pool.get('account.analytic.plan.instance')
|
||||
mod_obj = self.pool.get('ir.model.data')
|
||||
if 'active_id' in context and context['active_id']:
|
||||
plan = plan_obj.browse(cr, uid, context['active_id'], context=context)
|
||||
if (not plan.name) or (not plan.code):
|
||||
raise osv.except_osv(_('Error'), _('Please put a name and a code before saving the model !'))
|
||||
pids = self.pool.get('account.analytic.plan').search(cr, uid, [], context=context)
|
||||
if (not pids):
|
||||
raise osv.except_osv(_('Error'), _('No analytic plan defined !'))
|
||||
plan_obj.write(cr, uid, [context['active_id']], {'plan_id':pids[0]})
|
||||
|
||||
model_data_ids = mod_obj.search(cr,uid,[('model', '=', 'ir.ui.view'),('name', '=', 'view_analytic_plan_create_model')], context=context)
|
||||
resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
|
||||
return {
|
||||
'name': _('Distribution Model Saved'),
|
||||
'view_type': 'form',
|
||||
'view_mode': 'tree,form',
|
||||
'res_model': 'analytic.plan.create.model',
|
||||
'views': [(resource_id,'form')],
|
||||
'type': 'ir.actions.act_window',
|
||||
'target': 'new',
|
||||
}
|
||||
else:
|
||||
return {}
|
||||
|
||||
analytic_plan_create_model()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -0,0 +1,53 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record id="view_analytic_plan_create_model_msg" model="ir.ui.view">
|
||||
<field name="name">analytic.plan.create.model.msg.form</field>
|
||||
<field name="model">analytic.plan.create.model</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Distribution Model Saved">
|
||||
<group col="4" colspan="6">
|
||||
<label string="Save This Distribution as a Model"/>
|
||||
<newline/>
|
||||
</group>
|
||||
<separator colspan="4"/>
|
||||
<group col="2" colspan="4">
|
||||
<button special="cancel" string="Cancel" icon='gtk-ok' />
|
||||
<button string="Ok" icon='gtk-execute' type="object" name="activate" default_focus="1"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_analytic_plan_create_model" model="ir.ui.view">
|
||||
<field name="name">analytic.plan.create.model.form</field>
|
||||
<field name="model">analytic.plan.create.model</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Distribution Model Saved">
|
||||
<group col="4" colspan="6">
|
||||
<label string="This distribution model has been saved.You will be able to reuse it later."/>
|
||||
<newline/>
|
||||
</group>
|
||||
<separator colspan="4"/>
|
||||
<group col="2" colspan="4">
|
||||
<button special="cancel" string="Ok" icon='gtk-ok'/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="action_analytic_plan_create_model" model="ir.actions.act_window">
|
||||
<field name="name">analytic.plan.create.model.action</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">analytic.plan.create.model</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
<field name="view_id" ref="view_analytic_plan_create_model_msg"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
|
@ -1,71 +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 time
|
||||
import netsvc
|
||||
import pooler
|
||||
from tools.translate import _
|
||||
|
||||
info = '''<?xml version="1.0"?>
|
||||
<form string="Distribution Model Saved">
|
||||
<label string="This distribution model has been saved.\nYou will be able to reuse it later."/>
|
||||
</form>'''
|
||||
|
||||
|
||||
def activate(self, cr, uid, data, context):
|
||||
plan_obj = pooler.get_pool(cr.dbname).get('account.analytic.plan.instance')
|
||||
if data['id']:
|
||||
plan = plan_obj.browse(cr, uid, data['id'], context)
|
||||
if (not plan.name) or (not plan.code):
|
||||
raise wizard.except_wizard(_('Error'), _('Please put a name and a code before saving the model !'))
|
||||
pids = pooler.get_pool(cr.dbname).get('account.analytic.plan').search(cr, uid, [], context=context)
|
||||
if (not pids):
|
||||
raise wizard.except_wizard(_('Error'), _('No analytic plan defined !'))
|
||||
plan_obj.write(cr,uid,[data['id']],{'plan_id':pids[0]})
|
||||
return 'info'
|
||||
else:
|
||||
return 'endit'
|
||||
|
||||
def _do_nothing(self, cr, uid, data, context):
|
||||
return 1
|
||||
|
||||
class create_model(wizard.interface):
|
||||
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [],
|
||||
'result': {'type':'choice','next_state':activate}
|
||||
},
|
||||
'info': {
|
||||
'actions': [],
|
||||
'result': {'type':'form', 'arch':info, 'fields':{}, 'state':[('end','OK')]}
|
||||
},
|
||||
'endit': {
|
||||
'actions': [],
|
||||
'result': {'type':'action','action':_do_nothing , 'state':'end'} #FIXME: check
|
||||
},
|
||||
}
|
||||
create_model('create.model')
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -1,80 +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 time
|
||||
import datetime
|
||||
import pooler
|
||||
from tools.translate import _
|
||||
|
||||
form = """<?xml version="1.0"?>
|
||||
<form string="Select Information">
|
||||
<field name="date1"/>
|
||||
<field name="date2"/>
|
||||
<field name="ref" colspan="4"/>
|
||||
<field name="journal_ids" colspan="4"/>
|
||||
<field name="empty_line"/>
|
||||
</form>"""
|
||||
|
||||
fields = {
|
||||
'date1': {'string':'Start Date', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-01-01')},
|
||||
'date2': {'string':'End Date', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-%m-%d')},
|
||||
'journal_ids': {'string':'Analytic Journal', 'type':'many2many', 'relation':'account.analytic.journal'},
|
||||
'ref' :{'string':'Analytic Account Reference', 'type':'many2one', 'relation':'account.analytic.account','required':True},
|
||||
'empty_line': {'string':'Dont show empty lines', 'type':'boolean', 'default': lambda *a:False},
|
||||
}
|
||||
|
||||
class wizard_crossovered_analytic(wizard.interface):
|
||||
def _checklines(self, cr, uid, data, context):
|
||||
cr.execute('select account_id from account_analytic_line')
|
||||
res=cr.fetchall()
|
||||
acc_ids=[x[0] for x in res]
|
||||
|
||||
obj_acc = pooler.get_pool(cr.dbname).get('account.analytic.account').browse(cr,uid,data['form']['ref'])
|
||||
name=obj_acc.name
|
||||
|
||||
account_ids = pooler.get_pool(cr.dbname).get('account.analytic.account').search(cr, uid, [('parent_id', 'child_of', [data['form']['ref']])])
|
||||
|
||||
flag = True
|
||||
for acc in account_ids:
|
||||
if acc in acc_ids:
|
||||
flag = False
|
||||
break
|
||||
|
||||
if flag:
|
||||
raise wizard.except_wizard(_('User Error'),_('There are no Analytic lines related to Account %s' % name))
|
||||
return {}
|
||||
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [],
|
||||
'result': {'type':'form', 'arch':form, 'fields':fields, 'state':[('end','Cancel'),('print','Print')]},
|
||||
},
|
||||
'print': {
|
||||
'actions': [_checklines],
|
||||
'result': {'type':'print', 'report':'account.analytic.account.crossovered.analytic', 'state':'end'},
|
||||
},
|
||||
}
|
||||
|
||||
wizard_crossovered_analytic('wizard.crossovered.analytic')
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
|
@ -15,7 +15,7 @@
|
|||
# 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
|
@ -51,9 +51,15 @@ Three reports are available:
|
|||
'security/ir.model.access.csv',
|
||||
'security/account_budget_security.xml',
|
||||
'account_budget_wizard.xml',
|
||||
'wizard/account_budget_spread_view.xml',
|
||||
'crossovered_budget_view.xml',
|
||||
'crossovered_budget_report.xml',
|
||||
'crossovered_budget_workflow.xml'
|
||||
'crossovered_budget_workflow.xml',
|
||||
'wizard/account_budget_analytic_view.xml',
|
||||
'wizard/account_budget_report_view.xml',
|
||||
'wizard/account_budget_spread_view.xml',
|
||||
'wizard/account_budget_crossovered_summary_report_view.xml',
|
||||
'wizard/account_budget_crossovered_report_view.xml',
|
||||
],
|
||||
'demo_xml': ['crossovered_budget_demo.xml'],
|
||||
'installable': True,
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<wizard id="wizard_budget_spread" menu="False" model="account.budget.post" name="account.budget.spread" string="Spread amount"/>
|
||||
<!-- <wizard id="wizard_budget_spread" menu="False" model="account.budget.post" name="account.budget.spread" string="Spread amount"/>-->
|
||||
|
||||
<wizard id="wizard_budget_report" keyword="client_print_multi" model="account.budget.post" name="account.budget.report" string="Budget"/>
|
||||
<!-- <wizard id="wizard_budget_report" keyword="client_print_multi" model="account.budget.post" name="account.budget.report" string="Budget"/>-->
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
|
@ -11,35 +11,35 @@
|
|||
auto="False"
|
||||
menu="False" />
|
||||
|
||||
<wizard
|
||||
string="Print Budgets"
|
||||
model="crossovered.budget"
|
||||
name="wizard.crossovered.budget"
|
||||
id="wizard_crossovered_budget_menu"
|
||||
keyword="client_print_multi" />
|
||||
<!-- <wizard-->
|
||||
<!-- string="Print Budgets"-->
|
||||
<!-- model="crossovered.budget"-->
|
||||
<!-- name="wizard.crossovered.budget"-->
|
||||
<!-- id="wizard_crossovered_budget_menu"-->
|
||||
<!-- keyword="client_print_multi" />-->
|
||||
|
||||
<wizard
|
||||
string="Print Summary of Budgets"
|
||||
model="crossovered.budget"
|
||||
name="wizard.crossovered.budget.summary"
|
||||
id="wizard_crossovered_budget_menu_1"
|
||||
keyword="client_print_multi" />
|
||||
<!-- <wizard-->
|
||||
<!-- string="Print Summary of Budgets"-->
|
||||
<!-- model="crossovered.budget"-->
|
||||
<!-- name="wizard.crossovered.budget.summary"-->
|
||||
<!-- id="wizard_crossovered_budget_menu_1"-->
|
||||
<!-- keyword="client_print_multi" />-->
|
||||
|
||||
<!-- Reports on account.analytic.account -->
|
||||
<wizard
|
||||
id="account_analytic_account_budget_report"
|
||||
string="Print Budgets"
|
||||
model="account.analytic.account"
|
||||
name="wizard.analytic.account.budget.report"
|
||||
keyword="client_print_multi"/>
|
||||
|
||||
<report id="account_analytic_account_budget"
|
||||
string="Print Budgets"
|
||||
model="account.analytic.account"
|
||||
name="account.analytic.account.budget"
|
||||
rml="account_budget/report/analytic_account_budget_report.rml"
|
||||
auto="False"
|
||||
menu="False"/>
|
||||
<!-- <wizard-->
|
||||
<!-- id="account_analytic_account_budget_report"-->
|
||||
<!-- string="Print Budgets"-->
|
||||
<!-- model="account.analytic.account"-->
|
||||
<!-- name="wizard.analytic.account.budget.report"-->
|
||||
<!-- keyword="client_print_multi"/>-->
|
||||
<!---->
|
||||
<!-- <report id="account_analytic_account_budget"-->
|
||||
<!-- string="Print Budgets"-->
|
||||
<!-- model="account.analytic.account"-->
|
||||
<!-- name="account.analytic.account.budget"-->
|
||||
<!-- rml="account_budget/report/analytic_account_budget_report.rml"-->
|
||||
<!-- auto="False"-->
|
||||
<!-- menu="False"/>-->
|
||||
|
||||
<!-- moved from account module -->
|
||||
<report auto="False"
|
||||
|
|
|
@ -76,7 +76,7 @@
|
|||
<field name="account_ids" colspan="4" nolabel="1"/>
|
||||
</page>
|
||||
<page string="Dotations">
|
||||
<button string="Spread" name="%(wizard_budget_spread)d" type="action" icon="gtk-fullscreen"/>
|
||||
<button string="Spread" name="%(action_account_budget_spread)d" type="action" icon="gtk-fullscreen"/>
|
||||
<field name="dotation_ids" colspan="4" nolabel="1"/>
|
||||
</page>
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
|
@ -15,15 +15,15 @@
|
|||
# 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 wizard_crossovered_budget_report
|
||||
import wizard_analytic_account_budget
|
||||
import wizard_crossovered_budget_summary_report
|
||||
import account_budget_crossovered_report
|
||||
import account_budget_analytic
|
||||
import account_budget_crossovered_summary_report
|
||||
|
||||
import wizard_budget_spread
|
||||
import wizard_budget_report
|
||||
import account_budget_spread
|
||||
import account_budget_report
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
|
@ -15,38 +15,43 @@
|
|||
# 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 fields, osv
|
||||
|
||||
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_budget_analytic(osv.osv_memory):
|
||||
|
||||
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.cost_ledger', 'state':'end'}
|
||||
_name = 'account.budget.analytic'
|
||||
_description = 'Account Budget report for analytic account'
|
||||
_columns = {
|
||||
'date_from': fields.date('Start of period', required=True),
|
||||
'date_to': fields.date('End of period', required=True),
|
||||
}
|
||||
_defaults= {
|
||||
'date_from': time.strftime('%Y-01-01'),
|
||||
'date_to': time.strftime('%Y-%m-%d'),
|
||||
}
|
||||
}
|
||||
wizard_report('account.analytic.account.cost_ledger.report')
|
||||
|
||||
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.budget',
|
||||
'datas': datas,
|
||||
}
|
||||
|
||||
account_budget_analytic()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="account_budget_analytic_view" model="ir.ui.view">
|
||||
<field name="name">account.budget.analytic.form</field>
|
||||
<field name="model">account.budget.analytic</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Select Dates Period">
|
||||
<field name="date_from"/>
|
||||
<field name="date_to"/>
|
||||
<group colspan="4" col="6">
|
||||
<label string ="" colspan="2"/>
|
||||
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
|
||||
<button name="check_report" string="Print" type="object" icon="gtk-print" default_focus="1"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_account_budget_analytic" model="ir.actions.act_window">
|
||||
<field name="name">Print Budgets</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">account.budget.analytic</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="account_budget_analytic_view"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.values" id="account_budget_analytic_values">
|
||||
<field name="model_id" ref="analytic.model_account_analytic_account" />
|
||||
<field name="object" eval="1" />
|
||||
<field name="name">Print Budgets</field>
|
||||
<field name="key2">client_print_multi</field>
|
||||
<field name="value" eval="'ir.actions.act_window,' + str(ref('action_account_budget_analytic'))" />
|
||||
<field name="key">action</field>
|
||||
<field name="model">account.analytic.account</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
|
@ -18,38 +18,41 @@
|
|||
# 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 Options">
|
||||
<field name="date_from"/>
|
||||
<field name="date_to"/>
|
||||
</form>'''
|
||||
from osv import fields, osv
|
||||
|
||||
dates_fields = {
|
||||
'date_from': {'string':'Start of period', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-01-01')},
|
||||
'date_to': {'string':'End of period', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-%m-%d')},
|
||||
class account_budget_crossvered_report(osv.osv_memory):
|
||||
|
||||
}
|
||||
|
||||
class wizard_report(wizard.interface):
|
||||
|
||||
def _default(self, cr, uid, data, context):
|
||||
data['form']['report']='analytic-full'
|
||||
return data['form']
|
||||
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [_default],
|
||||
'result': {'type':'form', 'arch':dates_form, 'fields':dates_fields, 'state':[('end','Cancel', 'gtk-cancel'),('report','Print', 'gtk-print', True)]}
|
||||
},
|
||||
'report': {
|
||||
'actions': [],
|
||||
'result': {'type':'print', 'report':'crossovered.budget.report', 'state':'end'}
|
||||
_name = 'account.budget.crossvered.report'
|
||||
_description = 'Account Budget crossvered report'
|
||||
_columns = {
|
||||
'date_from': fields.date('Start of period', required=True),
|
||||
'date_to': fields.date('End of period', required=True),
|
||||
}
|
||||
}
|
||||
wizard_report('wizard.crossovered.budget')
|
||||
_defaults= {
|
||||
'date_from': time.strftime('%Y-01-01'),
|
||||
'date_to': 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': 'crossovered.budge',
|
||||
'form': data
|
||||
}
|
||||
datas['form']['report']='analytic-full'
|
||||
return {
|
||||
'type': 'ir.actions.report.xml',
|
||||
'report_name': 'crossovered.budget.report',
|
||||
'datas': datas,
|
||||
}
|
||||
|
||||
account_budget_crossvered_report()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="account_budget_crossvered_report_view" model="ir.ui.view">
|
||||
<field name="name">account.budget.crossvered.report.form</field>
|
||||
<field name="model">account.budget.crossvered.report</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Select Dates Period">
|
||||
<field name="date_from"/>
|
||||
<field name="date_to"/>
|
||||
<group colspan="4" col="6">
|
||||
<label string ="" colspan="2"/>
|
||||
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
|
||||
<button name="check_report" string="Print" type="object" icon="gtk-print" default_focus="1"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_account_budget_crossvered_report" model="ir.actions.act_window">
|
||||
<field name="name">Print Budgets</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">account.budget.crossvered.report</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="account_budget_crossvered_report_view"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
<record model="ir.values" id="account_budget_crossvered_report_values">
|
||||
<field name="model_id" ref="account_budget.model_crossovered_budget" />
|
||||
<field name="object" eval="1" />
|
||||
<field name="name">Print Budgets</field>
|
||||
<field name="key2">client_print_multi</field>
|
||||
<field name="value" eval="'ir.actions.act_window,' + str(ref('action_account_budget_crossvered_report'))" />
|
||||
<field name="key">action</field>
|
||||
<field name="model">crossovered.budget</field>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
|
@ -0,0 +1,61 @@
|
|||
# -*- 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 fields, osv
|
||||
|
||||
class account_budget_crossvered_summary_report(osv.osv_memory):
|
||||
"""
|
||||
This wizard provides the crossovered budget summary report'
|
||||
"""
|
||||
_name = 'account.budget.crossvered.summary.report'
|
||||
_description = 'Account Budget crossvered summary report'
|
||||
_columns = {
|
||||
'date_from': fields.date('Start of period', required=True),
|
||||
'date_to': fields.date('End of period', required=True),
|
||||
}
|
||||
_defaults= {
|
||||
'date_from': time.strftime('%Y-01-01'),
|
||||
'date_to': 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': 'crossovered.budge',
|
||||
'form': data
|
||||
}
|
||||
datas['form']['report']='analytic-one'
|
||||
return {
|
||||
'type': 'ir.actions.report.xml',
|
||||
'report_name': 'crossovered.budget.report',
|
||||
'datas': datas,
|
||||
}
|
||||
return {}
|
||||
|
||||
account_budget_crossvered_summary_report()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="account_budget_crossvered_summary_report_view" model="ir.ui.view">
|
||||
<field name="name">account.budget.crossvered.summary.report.form</field>
|
||||
<field name="model">account.budget.crossvered.summary.report</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Select Dates Period">
|
||||
<field name="date_from"/>
|
||||
<field name="date_to"/>
|
||||
<group colspan="4" col="6">
|
||||
<label string ="" colspan="2"/>
|
||||
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
|
||||
<button name="check_report" string="Print" type="object" icon="gtk-print" default_focus="1"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_account_budget_crossvered_summary_report" model="ir.actions.act_window">
|
||||
<field name="name">Print Summary of Budgets</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">account.budget.crossvered.summary.report</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="account_budget_crossvered_summary_report_view"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
<record model="ir.values" id="account_budget_crossvered_summary_report_values">
|
||||
<field name="model_id" ref="account_budget.model_crossovered_budget" />
|
||||
<field name="object" eval="1" />
|
||||
<field name="name">Print Summary of Budgets</field>
|
||||
<field name="key2">client_print_multi</field>
|
||||
<field name="value" eval="'ir.actions.act_window,' + str(ref('action_account_budget_crossvered_summary_report'))" />
|
||||
<field name="key">action</field>
|
||||
<field name="model">crossovered.budget</field>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
|
@ -0,0 +1,62 @@
|
|||
# -*- 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 fields, osv
|
||||
from tools.translate import _
|
||||
|
||||
class account_budget_report(osv.osv_memory):
|
||||
|
||||
_name = 'account.budget.report'
|
||||
_description = 'Account Budget report for analytic account'
|
||||
_columns = {
|
||||
'date1': fields.date('Start of period', required=True),
|
||||
'date2': fields.date('End of period', required=True),
|
||||
}
|
||||
_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.budget.post',
|
||||
'form': data
|
||||
}
|
||||
|
||||
data_model = self.pool.get(datas['model']).browse(cr,uid,context['active_id'])
|
||||
if not data_model.dotation_ids:
|
||||
raise osv.except_osv(_('Insufficient Data!'),_('No Depreciation or Master Budget Expenses Found on Budget %s!') % data_model.name)
|
||||
|
||||
return {
|
||||
'type': 'ir.actions.report.xml',
|
||||
'report_name': 'account.budget',
|
||||
'datas': datas,
|
||||
}
|
||||
account_budget_report()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="account_budget_report_view" model="ir.ui.view">
|
||||
<field name="name">account.budget.report.form</field>
|
||||
<field name="model">account.budget.report</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Select Dates Period">
|
||||
<field name="date1"/>
|
||||
<field name="date2"/>
|
||||
<group colspan="4" col="6">
|
||||
<label string ="" colspan="2"/>
|
||||
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
|
||||
<button name="check_report" string="Print" type="object" icon="gtk-print" default_focus="1"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_account_budget_report" model="ir.actions.act_window">
|
||||
<field name="name">Budgets</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">account.budget.report</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="account_budget_report_view"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.values" id="account_budget_report_values">
|
||||
<field name="model_id" ref="account_budget.model_account_budget_post" />
|
||||
<field name="object" eval="1" />
|
||||
<field name="name">Budgets</field>
|
||||
<field name="key2">client_print_multi</field>
|
||||
<field name="value" eval="'ir.actions.act_window,' + str(ref('action_account_budget_report'))" />
|
||||
<field name="key">action</field>
|
||||
<field name="model">account.budget.post</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
|
@ -18,40 +18,27 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import wizard
|
||||
import netsvc
|
||||
from osv import fields, osv
|
||||
import decimal_precision as dp
|
||||
|
||||
_spread_form = '''<?xml version="1.0"?>
|
||||
<form string="Spread">
|
||||
<field name="fiscalyear"/>
|
||||
<field name="amount"/>
|
||||
</form>'''
|
||||
class account_budget_spread(osv.osv_memory):
|
||||
|
||||
_spread_fields = {
|
||||
'fiscalyear': {'string':'Fiscal Year', 'type':'many2one', 'relation':'account.fiscalyear', 'required':True},
|
||||
'amount': {'string':'Amount', 'type':'float', 'digits':(16,2)},
|
||||
}
|
||||
_name = 'account.budget.spread'
|
||||
_description = 'Account Budget spread '
|
||||
_columns = {
|
||||
'fiscalyear': fields.many2one('account.fiscalyear','Fiscal Year', required=True),
|
||||
'amount': fields.float('Amount', digits_compute=dp.get_precision('Account')),
|
||||
}
|
||||
|
||||
class wizard_budget_spread(wizard.interface):
|
||||
def _spread(self, cr, uid, data, context):
|
||||
def check_spread(self, cr, uid, ids, context=None):
|
||||
service = netsvc.LocalService("object_proxy")
|
||||
form = data['form']
|
||||
res = service.execute(cr.dbname, uid, 'account.budget.post', 'spread', data['ids'], form['fiscalyear'], form['amount'])
|
||||
if context is None:
|
||||
context = {}
|
||||
data = self.read(cr, uid, ids, [])[0]
|
||||
res = service.execute(cr.dbname, uid, 'account.budget.post', 'spread', context['active_ids'], data['fiscalyear'], data['amount'])
|
||||
return {}
|
||||
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [],
|
||||
'result': {'type':'form', 'arch':_spread_form, 'fields':_spread_fields, 'state':[('end','Cancel'),('spread','Spread','',True)]}
|
||||
},
|
||||
'spread': {
|
||||
'actions': [_spread],
|
||||
'result': {'type':'state', 'state':'end'}
|
||||
}
|
||||
}
|
||||
wizard_budget_spread('account.budget.spread')
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
account_budget_spread()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -0,0 +1,33 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="account_budget_spread_view" model="ir.ui.view">
|
||||
<field name="name">account.budget.spread.form</field>
|
||||
<field name="model">account.budget.spread</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Select Dates Period">
|
||||
<field name="fiscalyear"/>
|
||||
<field name="amount"/>
|
||||
<group colspan="4" col="6">
|
||||
<label string ="" colspan="2"/>
|
||||
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
|
||||
<button name="check_spread" string="Ok" type="object" icon="gtk-ok" default_focus="1"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_account_budget_spread" model="ir.actions.act_window">
|
||||
<field name="name">Spread</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">account.budget.spread</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="account_budget_spread_view"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
|
@ -1,62 +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
|
||||
import datetime
|
||||
import pooler
|
||||
from tools.translate import _
|
||||
|
||||
dates_form = '''<?xml version="1.0"?>
|
||||
<form string="Select period">
|
||||
<field name="date1"/>
|
||||
<field name="date2"/>
|
||||
</form>'''
|
||||
|
||||
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 wizard_report(wizard.interface):
|
||||
def _default(self, cr, uid, data, context):
|
||||
pool_obj = pooler.get_pool(cr.dbname)
|
||||
data_model = pool_obj.get(data['model']).browse(cr,uid,data['id'])
|
||||
if not data_model.dotation_ids:
|
||||
raise wizard.except_wizard(_('Insufficient Data!'),_('No Depreciation or Master Budget Expenses Found on Budget %s!') % data_model.name)
|
||||
return data['form']
|
||||
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [_default],
|
||||
'result': {'type':'form', 'arch':dates_form, 'fields':dates_fields, 'state':[('end','Cancel', 'gtk-cancel'),('report','Print', 'gtk-print', True)]}
|
||||
},
|
||||
'report': {
|
||||
'actions': [],
|
||||
'result': {'type':'print', 'report':'account.budget', 'state':'end'}
|
||||
}
|
||||
}
|
||||
wizard_report('account.budget.report')
|
||||
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
|
@ -15,7 +15,7 @@
|
|||
# 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
|
@ -49,7 +49,7 @@
|
|||
'init_xml': [],
|
||||
'update_xml': [
|
||||
'security/ir.model.access.csv',
|
||||
'wizard/wizard_view.xml',
|
||||
'wizard/account_followup_print_view.xml',
|
||||
'followup_report_view.xml',
|
||||
'followup_view.xml',
|
||||
'followup_data.xml'
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
|
@ -15,7 +15,7 @@
|
|||
# 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
|
@ -41,7 +41,7 @@ class report_rappel(report_sxw.rml_parse):
|
|||
pool = pooler.get_pool(self.cr.dbname)
|
||||
all_partners = []
|
||||
for partner in partners_ids:
|
||||
partners = pool.get('account_followup.stat').browse(self.cr, self.uid, partner[2])
|
||||
partners = pool.get('account_followup.stat').browse(self.cr, self.uid, [partner])
|
||||
for par in partners:
|
||||
all_partners.append(par.name)
|
||||
return all_partners
|
||||
|
@ -88,6 +88,7 @@ class report_rappel(report_sxw.rml_parse):
|
|||
'company_name': fp_obj.browse(self.cr, self.uid, followup_id).company_id.name,
|
||||
'user_signature': pooler.get_pool(self.cr.dbname).get('res.users').browse(self.cr, self.uid, self.uid, context).signature,
|
||||
}
|
||||
|
||||
return text
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
|
@ -15,11 +15,10 @@
|
|||
# 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 wizard_followup_print
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
import account_followup_print
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -18,209 +18,99 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import wizard
|
||||
import datetime
|
||||
import pooler
|
||||
import time
|
||||
|
||||
import tools
|
||||
from osv import fields, osv
|
||||
from tools.translate import _
|
||||
|
||||
_email_summary_form = """<?xml version="1.0"?>
|
||||
<form string="Summary">
|
||||
<field name="summary" height="300" width="800"/>
|
||||
</form>"""
|
||||
|
||||
_email_summary_fields = {
|
||||
'summary': {'string': 'Summary', 'type': 'text', 'required': False, 'readonly': True},
|
||||
}
|
||||
|
||||
_followup_wizard_screen1_form = """<?xml version="1.0"?>
|
||||
<form string="Follow-up and Date Selection">
|
||||
<field name="followup_id"/>
|
||||
<field name="date"/>
|
||||
</form>"""
|
||||
|
||||
_followup_wizard_screen1_fields = {
|
||||
'date': {'string': 'Follow-up Sending Date', 'type': 'date', 'required': True, 'help':"This field allow you to select a forecast date to plan your follow-ups"},
|
||||
'followup_id': {'string': 'Follow-up', 'type':'many2one', 'relation':'account_followup.followup', 'required': True,},
|
||||
}
|
||||
|
||||
|
||||
|
||||
_followup_wizard_all_form = """<?xml version="1.0"?>
|
||||
<form string="Select partners" colspan="4">
|
||||
<notebook>
|
||||
<page string="Partner Selection">
|
||||
<separator string="Select partners to remind" colspan="4"/>
|
||||
<field name="partner_ids" colspan="4" nolabel="1"/>
|
||||
</page>
|
||||
<page string="Email Settings">
|
||||
<field name="email_conf" colspan="4"/>
|
||||
<field name="partner_lang" colspan="4"/>
|
||||
<field name="email_subject" colspan="4"/>
|
||||
<separator string="Email body" colspan="4" attrs="{'readonly':[('partner_lang','=',True)]}"/>
|
||||
<field name="email_body" colspan="4" nolabel="1"/>
|
||||
<separator string="Legend" colspan="4"/>
|
||||
|
||||
<label string="%(partner_name)s: Partner name" colspan="2"/>
|
||||
<label string="%(user_signature)s: User name" colspan="2"/>
|
||||
<label string="%(followup_amount)s: Total Amount Due" colspan="2"/>
|
||||
<label string="%(date)s: Current Date" colspan="2"/>
|
||||
<label string="%(company_name)s: User's Company name" colspan="2"/>
|
||||
<label string="%(company_currency)s: User's Company Currency" colspan="2"/>
|
||||
<label string="%(heading)s: Move line header" colspan="2"/>
|
||||
<label string="%(line)s: Ledger Posting lines" colspan="2"/>
|
||||
</page>
|
||||
</notebook>
|
||||
</form>"""
|
||||
|
||||
_followup_wizard_all_fields = {
|
||||
'partner_ids': {
|
||||
'string': "Partners",
|
||||
'type': 'many2many',
|
||||
'required': True,
|
||||
'relation': 'account_followup.stat',
|
||||
},
|
||||
'email_conf': {
|
||||
'string': "Send email confirmation",
|
||||
'type': 'boolean',
|
||||
},
|
||||
'email_subject' : {
|
||||
'string' : "Email Subject",
|
||||
'type' : "char",
|
||||
'size': 64,
|
||||
'default': 'Invoices Reminder'
|
||||
},
|
||||
'partner_lang':{
|
||||
'string': "Send Email in Partner Language",
|
||||
'type': 'boolean',
|
||||
'default':True,
|
||||
'help':'Do not change message text, if you want to send email in partner language, or configre from company'
|
||||
},
|
||||
'email_body': {
|
||||
'string': "Email body",
|
||||
'type': 'text',
|
||||
'default': '''
|
||||
Date : %(date)s
|
||||
|
||||
Dear %(partner_name)s,
|
||||
|
||||
Please find in attachment a reminder of all your unpaid invoices, for a total amount due of:
|
||||
|
||||
%(followup_amount).2f %(company_currency)s
|
||||
|
||||
|
||||
Thanks,
|
||||
--
|
||||
%(user_signature)s
|
||||
%(company_name)s
|
||||
'''
|
||||
}
|
||||
}
|
||||
|
||||
class followup_all_print(wizard.interface):
|
||||
def _update_partners(self, cr, uid, data, context):
|
||||
to_update = data['form']['to_update']
|
||||
for id in to_update.keys():
|
||||
if to_update[id]['partner_id'] in data['form']['partner_ids'][0][2]:
|
||||
cr.execute(
|
||||
"UPDATE account_move_line "\
|
||||
"SET followup_line_id=%s, followup_date=%s "\
|
||||
"WHERE id=%s",
|
||||
(to_update[id]['level'],
|
||||
data['form']['date'], int(id),))
|
||||
return {}
|
||||
|
||||
def _sendmail(self ,cr, uid, data, context):
|
||||
if data['form']['email_conf']:
|
||||
mail_notsent = ''
|
||||
msg_sent = ''
|
||||
msg_unsent = ''
|
||||
count = 0
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
data_user = pool.get('res.users').browse(cr,uid,uid)
|
||||
line_obj = pool.get('account_followup.stat')
|
||||
move_lines = line_obj.browse(cr,uid,data['form']['partner_ids'][0][2])
|
||||
partners = []
|
||||
dict_lines = {}
|
||||
for line in move_lines:
|
||||
partners.append(line.name)
|
||||
dict_lines[line.name.id] =line
|
||||
for partner in partners:
|
||||
ids_lines = pool.get('account.move.line').search(cr,uid,[('partner_id','=',partner.id),('reconcile_id','=',False),('account_id.type','in',['receivable'])])
|
||||
data_lines = pool.get('account.move.line').browse(cr,uid,ids_lines)
|
||||
followup_data = dict_lines[partner.id]
|
||||
dest = False
|
||||
if partner.address:
|
||||
for adr in partner.address:
|
||||
if adr.type=='contact':
|
||||
if adr.email:
|
||||
dest = [adr.email]
|
||||
if (not dest) and adr.type=='default':
|
||||
if adr.email:
|
||||
dest = [adr.email]
|
||||
src = tools.config.options['email_from']
|
||||
if not data['form']['partner_lang']:
|
||||
body = data['form']['email_body']
|
||||
else:
|
||||
cxt = context.copy()
|
||||
cxt['lang'] = partner.lang
|
||||
body = pool.get('res.users').browse(cr, uid, uid, context=cxt).company_id.follow_up_msg
|
||||
|
||||
total_amt = followup_data.debit - followup_data.credit
|
||||
move_line = ''
|
||||
subtotal_due = 0.0
|
||||
subtotal_paid = 0.0
|
||||
subtotal_maturity = 0.0
|
||||
balance = 0.0
|
||||
l = '--------------------------------------------------------------------------------------------------------------------------'
|
||||
head = l+ '\n' + 'Date'.rjust(10) + '\t' + 'Description'.rjust(10) + '\t' + 'Ref'.rjust(10) + '\t' + 'Maturity date'.rjust(10) + '\t' + 'Due'.rjust(10) + '\t' + 'Paid'.rjust(10) + '\t' + 'Maturity'.rjust(10) + '\t' + 'Litigation'.rjust(10) + '\n' + l
|
||||
for i in data_lines:
|
||||
maturity = 0.00
|
||||
if i.date_maturity < time.strftime('%Y-%m-%d') and (i.debit - i.credit):
|
||||
maturity = i.debit - i.credit
|
||||
subtotal_due = subtotal_due + i.debit
|
||||
subtotal_paid = subtotal_paid + i.credit
|
||||
subtotal_maturity = subtotal_maturity + int(maturity)
|
||||
balance = balance + (i.debit - i.credit)
|
||||
move_line = move_line + (i.date).rjust(10) + '\t'+ (i.name).rjust(10) + '\t'+ (i.ref or '').rjust(10) + '\t' + (i.date_maturity or '').rjust(10) + '\t' + str(i.debit).rjust(10) + '\t' + str(i.credit).rjust(10) + '\t' + str(maturity).rjust(10) + '\t' + str(i.blocked).rjust(10) + '\n'
|
||||
move_line = move_line + l + '\n'+ '\t\t\t' + 'Sub total'.rjust(35) + '\t' + (str(subtotal_due) or '').rjust(10) + '\t' + (str(subtotal_paid) or '').rjust(10) + '\t' + (str(subtotal_maturity) or '').rjust(10)+ '\n'
|
||||
move_line = move_line + '\t\t\t' + 'Balance'.rjust(33) + '\t' + str(balance).rjust(10) + '\n' + l
|
||||
val = {
|
||||
'partner_name':partner.name,
|
||||
'followup_amount':total_amt,
|
||||
'user_signature':data_user.name,
|
||||
'company_name':data_user.company_id.name,
|
||||
'company_currency':data_user.company_id.currency_id.name,
|
||||
'line':move_line,
|
||||
'heading': head,
|
||||
'date':time.strftime('%Y-%m-%d'),
|
||||
class account_followup_print(osv.osv_memory):
|
||||
_name = 'account.followup.print'
|
||||
_description = 'Print Followup & Send Mail to Customers'
|
||||
_columns = {
|
||||
'date': fields.date('Follow-up Sending Date', required=True, help="This field allow you to select a forecast date to plan your follow-ups"),
|
||||
'followup_id': fields.many2one('account_followup.followup', 'Follow-up', required=True)
|
||||
}
|
||||
body = body%val
|
||||
sub = tools.ustr(data['form']['email_subject'])
|
||||
msg = ''
|
||||
if dest:
|
||||
tools.email_send(src,dest,sub,body)
|
||||
msg_sent += partner.name + '\n'
|
||||
else:
|
||||
msg += partner.name + '\n'
|
||||
msg_unsent += msg
|
||||
if not msg_unsent:
|
||||
summary = _("All E-mails have been successfully sent to Partners:.\n\n") + msg_sent
|
||||
else:
|
||||
msg_unsent = _("E-Mail not sent to following Partners, Email not available !\n\n") + msg_unsent
|
||||
msg_sent = msg_sent and _("\n\nE-Mail sent to following Partners successfully. !\n\n") + msg_sent
|
||||
line = '=========================================================================='
|
||||
summary = msg_unsent + line + msg_sent
|
||||
return {'summary' : summary}
|
||||
else:
|
||||
return {'summary' : '\n\n\nE-Mail has not been sent to any partner. If you want to send it, please tick send email confirmation on wizard.'}
|
||||
|
||||
def _get_partners(self, cr, uid, data, context):
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
def _get_followup(self, cr, uid, context=None):
|
||||
company_id = self.pool.get('res.users').browse(cr, uid, uid).company_id.id
|
||||
tmp = self.pool.get('account_followup.followup').search(cr, uid, [('company_id', '=', company_id)])
|
||||
return tmp and tmp[0] or False
|
||||
|
||||
def do_continue(self, cr, uid, ids, context=None):
|
||||
mod_obj = self.pool.get('ir.model.data')
|
||||
data = self.read(cr, uid, ids, [])[0]
|
||||
model_data_ids = mod_obj.search(cr, uid, [('model','=','ir.ui.view'),('name','=','view_account_followup_print_all')], context=context)
|
||||
resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
|
||||
context.update({'followup_id': data['followup_id'], 'date':data['date']})
|
||||
return {
|
||||
'name': _('Select partners'),
|
||||
'view_type': 'form',
|
||||
'context': context,
|
||||
'view_mode': 'tree,form',
|
||||
'res_model': 'account.followup.print.all',
|
||||
'views': [(resource_id,'form')],
|
||||
'type': 'ir.actions.act_window',
|
||||
'target': 'new',
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'date': time.strftime('%Y-%m-%d'),
|
||||
'followup_id': _get_followup,
|
||||
}
|
||||
|
||||
account_followup_print()
|
||||
|
||||
class account_followup_print_all(osv.osv_memory):
|
||||
_name = 'account.followup.print.all'
|
||||
_description = 'Print Followup & Send Mail to Customers'
|
||||
_columns = {
|
||||
'partner_ids': fields.many2many('account_followup.stat', 'partner_stat_rel', 'followup_id', 'stat_id', 'Partners', required=True),
|
||||
'email_conf': fields.boolean('Send email confirmation'),
|
||||
'email_subject': fields.char('Email Subject', size=64),
|
||||
'partner_lang': fields.boolean('Send Email in Partner Language', help='Do not change message text, if you want to send email in partner language, or configre from company'),
|
||||
'email_body': fields.text('Email body'),
|
||||
'summary': fields.text('Summary', required=True, readonly=True)
|
||||
}
|
||||
def _get_summary(self, cr, uid, context=None):
|
||||
return context.get('summary', '')
|
||||
|
||||
def _get_partners(self, cr, uid, context=None):
|
||||
return self._get_partners_followp(cr, uid, [], context)['partner_ids']
|
||||
|
||||
def _get_msg(self, cr, uid, context=None):
|
||||
return self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.follow_up_msg
|
||||
|
||||
_defaults = {
|
||||
'email_body': _get_msg,
|
||||
'email_subject': 'Invoices Reminder',
|
||||
'partner_lang': True,
|
||||
'partner_ids': _get_partners,
|
||||
'summary': _get_summary,
|
||||
# 'email_body':'''
|
||||
#Date : %(date)s
|
||||
#
|
||||
#Dear %(partner_name)s,
|
||||
#
|
||||
#Please find in attachment a reminder of all your unpaid invoices, for a total amount due of:
|
||||
#
|
||||
#%(followup_amount).2f %(company_currency)s
|
||||
#
|
||||
#
|
||||
#Thanks,
|
||||
#--
|
||||
#%(user_signature)s
|
||||
#%(company_name)s
|
||||
# '''
|
||||
}
|
||||
|
||||
def _get_partners_followp(self, cr, uid, ids, context=None):
|
||||
data = {}
|
||||
if context is None:
|
||||
context = {}
|
||||
if ids:
|
||||
data = self.read(cr, uid, ids, [])[0]
|
||||
cr.execute(
|
||||
"SELECT l.partner_id, l.followup_line_id,l.date_maturity, l.date, l.id "\
|
||||
"FROM account_move_line AS l "\
|
||||
|
@ -235,9 +125,10 @@ class followup_all_print(wizard.interface):
|
|||
move_lines = cr.fetchall()
|
||||
old = None
|
||||
fups = {}
|
||||
fup_id = data['form']['followup_id']
|
||||
fup_id = 'followup_id' in context and context['followup_id'] or data['followup_id']
|
||||
date = 'date' in context and context['date'] or data['date']
|
||||
|
||||
current_date = datetime.date(*time.strptime(data['form']['date'],
|
||||
current_date = datetime.date(*time.strptime(date,
|
||||
'%Y-%m-%d')[:3])
|
||||
cr.execute(
|
||||
"SELECT * "\
|
||||
|
@ -269,59 +160,138 @@ class followup_all_print(wizard.interface):
|
|||
if partner_id not in partner_list:
|
||||
partner_list.append(partner_id)
|
||||
to_update[str(id)]= {'level': fups[followup_line_id][1], 'partner_id': partner_id}
|
||||
|
||||
message = pool.get('res.users').browse(cr, uid, uid, context=context).company_id.follow_up_msg
|
||||
|
||||
return {'partner_ids': partner_list, 'to_update': to_update, 'email_body':message}
|
||||
return {'partner_ids': partner_list, 'to_update': to_update}
|
||||
|
||||
def _get_screen1_values(self, cr, uid, data, context):
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
company_id = pool.get('res.users').browse(cr, uid, uid).company_id.id
|
||||
tmp = pool.get('account_followup.followup').search(cr, uid, [('company_id', '=', company_id)])
|
||||
followup = tmp and tmp[0] or False
|
||||
return {'date': time.strftime('%Y-%m-%d'), 'followup_id': followup}
|
||||
def do_mail(self ,cr, uid, ids, context=None):
|
||||
mod_obj = self.pool.get('ir.model.data')
|
||||
move_obj = self.pool.get('account.move.line')
|
||||
user_obj = self.pool.get('res.users')
|
||||
line_obj = self.pool.get('account_followup.stat')
|
||||
data = self.read(cr, uid, ids, [])[0]
|
||||
model_data_ids = mod_obj.search(cr, uid, [('model','=','ir.ui.view'),('name','=','view_account_followup_print_all_msg')], context=context)
|
||||
resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
|
||||
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [_get_screen1_values],
|
||||
'result': {'type': 'form',
|
||||
'arch': _followup_wizard_screen1_form,
|
||||
'fields': _followup_wizard_screen1_fields,
|
||||
'state': [
|
||||
('end', 'Cancel'),
|
||||
('next', 'Continue'),
|
||||
]
|
||||
},
|
||||
},
|
||||
'next': {
|
||||
'actions': [_get_partners],
|
||||
'result': {'type': 'form',
|
||||
'arch': _followup_wizard_all_form,
|
||||
'fields': _followup_wizard_all_fields,
|
||||
'state': [
|
||||
('end','Cancel'),
|
||||
('print','Print Follow Ups & Send Mails'),
|
||||
]
|
||||
},
|
||||
},
|
||||
'print': {
|
||||
'actions': [_update_partners],
|
||||
'result': {'type': 'print',
|
||||
'report':'account_followup.followup.print',
|
||||
'state':'summary'},
|
||||
},
|
||||
'summary': {
|
||||
'actions': [_sendmail],
|
||||
'result': {'type': 'form',
|
||||
'arch': _email_summary_form,
|
||||
'fields': _email_summary_fields,
|
||||
'state':[('end','Ok')]
|
||||
},
|
||||
},
|
||||
}
|
||||
if data['email_conf']:
|
||||
mail_notsent = ''
|
||||
msg_sent = ''
|
||||
msg_unsent = ''
|
||||
count = 0
|
||||
data_user = user_obj.browse(cr, uid, uid)
|
||||
move_lines = line_obj.browse(cr,uid,data['partner_ids'][0][2])
|
||||
partners = []
|
||||
dict_lines = {}
|
||||
for line in move_lines:
|
||||
partners.append(line.name)
|
||||
dict_lines[line.name.id] =line
|
||||
for partner in partners:
|
||||
ids_lines = move_obj.search(cr,uid,[('partner_id','=',partner.id),('reconcile_id','=',False),('account_id.type','in',['receivable'])])
|
||||
data_lines = move_obj.browse(cr,uid,ids_lines)
|
||||
followup_data = dict_lines[partner.id]
|
||||
dest = False
|
||||
if partner.address:
|
||||
for adr in partner.address:
|
||||
if adr.type=='contact':
|
||||
if adr.email:
|
||||
dest = [adr.email]
|
||||
if (not dest) and adr.type=='default':
|
||||
if adr.email:
|
||||
dest = [adr.email]
|
||||
src = tools.config.options['email_from']
|
||||
if not data['partner_lang']:
|
||||
body = data['email_body']
|
||||
else:
|
||||
cxt = context.copy()
|
||||
cxt['lang'] = partner.lang
|
||||
body = user_obj.browse(cr, uid, uid, context=cxt).company_id.follow_up_msg
|
||||
|
||||
followup_all_print('account_followup.followup.print.all')
|
||||
total_amt = followup_data.debit - followup_data.credit
|
||||
move_line = ''
|
||||
subtotal_due = 0.0
|
||||
subtotal_paid = 0.0
|
||||
subtotal_maturity = 0.0
|
||||
balance = 0.0
|
||||
l = '--------------------------------------------------------------------------------------------------------------------------'
|
||||
head = l+ '\n' + 'Date'.rjust(10) + '\t' + 'Description'.rjust(10) + '\t' + 'Ref'.rjust(10) + '\t' + 'Maturity date'.rjust(10) + '\t' + 'Due'.rjust(10) + '\t' + 'Paid'.rjust(10) + '\t' + 'Maturity'.rjust(10) + '\t' + 'Litigation'.rjust(10) + '\n' + l
|
||||
for i in data_lines:
|
||||
maturity = 0.00
|
||||
if i.date_maturity < time.strftime('%Y-%m-%d') and (i.debit - i.credit):
|
||||
maturity = i.debit - i.credit
|
||||
subtotal_due = subtotal_due + i.debit
|
||||
subtotal_paid = subtotal_paid + i.credit
|
||||
subtotal_maturity = subtotal_maturity + int(maturity)
|
||||
balance = balance + (i.debit - i.credit)
|
||||
move_line = move_line + (i.date).rjust(10) + '\t'+ (i.name).rjust(10) + '\t'+ (i.ref or '').rjust(10) + '\t' + (i.date_maturity or '').rjust(10) + '\t' + str(i.debit).rjust(10) + '\t' + str(i.credit).rjust(10) + '\t' + str(maturity).rjust(10) + '\t' + str(i.blocked).rjust(10) + '\n'
|
||||
move_line = move_line + l + '\n'+ '\t\t\t' + 'Sub total'.rjust(35) + '\t' + (str(subtotal_due) or '').rjust(10) + '\t' + (str(subtotal_paid) or '').rjust(10) + '\t' + (str(subtotal_maturity) or '').rjust(10)+ '\n'
|
||||
move_line = move_line + '\t\t\t' + 'Balance'.rjust(33) + '\t' + str(balance).rjust(10) + '\n' + l
|
||||
val = {
|
||||
'partner_name':partner.name,
|
||||
'followup_amount':total_amt,
|
||||
'user_signature':data_user.name,
|
||||
'company_name':data_user.company_id.name,
|
||||
'company_currency':data_user.company_id.currency_id.name,
|
||||
'line':move_line,
|
||||
'heading': head,
|
||||
'date':time.strftime('%Y-%m-%d'),
|
||||
}
|
||||
body = body%val
|
||||
sub = tools.ustr(data['email_subject'])
|
||||
msg = ''
|
||||
if dest:
|
||||
tools.email_send(src,dest,sub,body)
|
||||
msg_sent += partner.name + '\n'
|
||||
else:
|
||||
msg += partner.name + '\n'
|
||||
msg_unsent += msg
|
||||
if not msg_unsent:
|
||||
summary = _("All E-mails have been successfully sent to Partners:.\n\n") + msg_sent
|
||||
else:
|
||||
msg_unsent = _("E-Mail not sent to following Partners, Email not available !\n\n") + msg_unsent
|
||||
msg_sent = msg_sent and _("\n\nE-Mail sent to following Partners successfully. !\n\n") + msg_sent
|
||||
line = '=========================================================================='
|
||||
summary = msg_unsent + line + msg_sent
|
||||
context.update({'summary': summary})
|
||||
else:
|
||||
context.update({'summary': '\n\n\nE-Mail has not been sent to any partner. If you want to send it, please tick send email confirmation on wizard.'})
|
||||
return {
|
||||
'name': _('Summary'),
|
||||
'view_type': 'form',
|
||||
'context': context,
|
||||
'view_mode': 'tree,form',
|
||||
'res_model': 'account.followup.print.all',
|
||||
'views': [(resource_id,'form')],
|
||||
'type': 'ir.actions.act_window',
|
||||
'target': 'new',
|
||||
'nodestroy': True
|
||||
}
|
||||
|
||||
def do_print(self, cr, uid, ids, context=None):
|
||||
data = self.read(cr, uid, ids, [])[0]
|
||||
res = self._get_partners_followp(cr, uid, ids, context)['to_update']
|
||||
to_update = res
|
||||
data['followup_id'] = 'followup_id' in context and context['followup_id'] or False
|
||||
date = 'date' in context and context['date'] or data['date']
|
||||
for id in to_update.keys():
|
||||
if to_update[id]['partner_id'] in data['partner_ids'][0][2]:
|
||||
cr.execute(
|
||||
"UPDATE account_move_line "\
|
||||
"SET followup_line_id=%s, followup_date=%s "\
|
||||
"WHERE id=%s",
|
||||
(to_update[id]['level'],
|
||||
date, int(id),))
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
datas = {
|
||||
'ids': [],
|
||||
'model': 'account_followup.followup',
|
||||
'form': data
|
||||
}
|
||||
return {
|
||||
'type': 'ir.actions.report.xml',
|
||||
'report_name': 'account_followup.followup.print',
|
||||
'datas': datas,
|
||||
'nodestroy': True
|
||||
}
|
||||
|
||||
account_followup_print_all()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -0,0 +1,132 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data noupdate="0">
|
||||
|
||||
<!--<wizard string="Send followups"
|
||||
name="account_followup.followup.print.all"
|
||||
id="action_account_followup_all_wizard"
|
||||
model="account_followup.followup" />
|
||||
|
||||
<menuitem action="action_account_followup_all_wizard"
|
||||
id="account_followup_wizard_menu"
|
||||
parent="account.menu_finance_periodical_processing"
|
||||
type="wizard" />-->
|
||||
|
||||
|
||||
<record id="view_account_followup_print" model="ir.ui.view">
|
||||
<field name="name">account.followup.print.form</field>
|
||||
<field name="model">account.followup.print</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Send followups">
|
||||
<group col="4" colspan="6">
|
||||
<field name="followup_id"/>
|
||||
<field name="date"/>
|
||||
<newline/>
|
||||
</group>
|
||||
<separator colspan="4"/>
|
||||
<group col="2" colspan="4">
|
||||
<button special="cancel" string="Cancel" icon='gtk-cancel'/>
|
||||
<button name="do_continue" string="Continue" colspan="1" type="object" icon="gtk-ok"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_account_followup_print" model="ir.actions.act_window">
|
||||
<field name="name">Send followups</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">account.followup.print</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.values" id="account_followup_print_values">
|
||||
<field name="model_id" ref="model_account_followup_followup" />
|
||||
<field name="object" eval="1" />
|
||||
<field name="name">Send followups</field>
|
||||
<field name="key2">client_action_multi</field>
|
||||
<field name="value" eval="'ir.actions.act_window,' + str(ref('action_account_followup_print'))" />
|
||||
<field name="key">action</field>
|
||||
<field name="model">account_followup.followup</field>
|
||||
</record>
|
||||
|
||||
<menuitem action="action_account_followup_print"
|
||||
id="account_followup_print_menu"
|
||||
parent="account.menu_finance_periodical_processing"
|
||||
/>
|
||||
|
||||
|
||||
<!-- Screen2 -->
|
||||
|
||||
<record id="view_account_followup_print_all" model="ir.ui.view">
|
||||
<field name="name">account.followup.print.all.form</field>
|
||||
<field name="model">account.followup.print.all</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Send followups">
|
||||
<group col="4" colspan="6">
|
||||
<notebook>
|
||||
<page string="Partner Selection">
|
||||
<separator string="Select partners to remind" colspan="4"/>
|
||||
<field name="partner_ids" colspan="4" nolabel="1"/>
|
||||
</page>
|
||||
<page string="Email Settings">
|
||||
<field name="email_conf" colspan="4"/>
|
||||
<field name="partner_lang" colspan="4"/>
|
||||
<field name="email_subject" colspan="4"/>
|
||||
<!--<separator string="Email body" colspan="4" attrs="{'readonly':[('partner_lang','=',True)]}"/>-->
|
||||
<separator string="Email body" colspan="4" />
|
||||
<field name="email_body" colspan="4" nolabel="1"/>
|
||||
<separator string="Legend" colspan="4"/>
|
||||
<label string="%%(partner_name)s: Partner name" colspan="2"/>
|
||||
<label string="%%(user_signature)s: User name" colspan="2"/>
|
||||
<label string="%%(followup_amount)s: Total Amount Due" colspan="2"/>
|
||||
<label string="%%(date)s: Current Date" colspan="2"/>
|
||||
<label string="%%(company_name)s: User's Company name" colspan="2"/>
|
||||
<label string="%%(company_currency)s: User's Company Currency" colspan="2"/>
|
||||
<label string="%%(heading)s: Move line header" colspan="2"/>
|
||||
<label string="%%(line)s: Ledger Posting lines" colspan="2"/>
|
||||
</page>
|
||||
</notebook>
|
||||
</group>
|
||||
<separator colspan="4"/>
|
||||
<group>
|
||||
<button special="cancel" string="Cancel" icon='gtk-cancel'/>
|
||||
<button name="do_print" string="Print Follow Ups" colspan="1" type="object" icon="gtk-print"/>
|
||||
<button name="do_mail" string="Send Mails" colspan="1" type="object" icon="gtk-execute"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_account_followup_print_all_msg" model="ir.ui.view">
|
||||
<field name="name">account.followup.print.all.msg.form</field>
|
||||
<field name="model">account.followup.print.all</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Summary">
|
||||
<group col="4" colspan="6">
|
||||
<field name="summary" height="300" width="800"/>
|
||||
</group>
|
||||
<separator colspan="4"/>
|
||||
<group>
|
||||
<button special="cancel" string="Ok" icon='gtk-cancel'/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_account_followup_print_all" model="ir.actions.act_window">
|
||||
<field name="name">Send followups</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">account.followup.print.all</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
|
||||
</data>
|
||||
</openerp>
|
|
@ -1,12 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?><openerp><data noupdate="0">
|
||||
<wizard string="Send followups"
|
||||
name="account_followup.followup.print.all"
|
||||
id="action_account_followup_all_wizard"
|
||||
model="account_followup.followup" />
|
||||
|
||||
<menuitem action="action_account_followup_all_wizard"
|
||||
id="account_followup_wizard_menu"
|
||||
parent="account.menu_finance_periodical_processing"
|
||||
type="wizard" />
|
||||
</data></openerp>
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
|
@ -15,7 +15,7 @@
|
|||
# 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
|
@ -42,7 +42,8 @@
|
|||
'update_xml': [
|
||||
'security/ir.model.access.csv',
|
||||
'account_invoice_layout_view.xml',
|
||||
'account_invoice_layout_report.xml'
|
||||
'account_invoice_layout_report.xml',
|
||||
'wizard/account_invoice_special_message.xml',
|
||||
],
|
||||
'demo_xml': [],
|
||||
'installable': True,
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<wizard string="Invoices with Layout and Message"
|
||||
<!-- <wizard string="Invoices with Layout and Message"
|
||||
model="account.invoice"
|
||||
name="wizard.notify_message"
|
||||
id="wizard_notify_message"
|
||||
keyword="client_print_multi"
|
||||
/>
|
||||
/> -->
|
||||
|
||||
<report id="account_invoices_1"
|
||||
string="Invoices with Layout"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
|
@ -15,10 +15,10 @@
|
|||
# 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 invoice_special_message
|
||||
import account_invoice_special_message
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
|
@ -15,38 +15,34 @@
|
|||
# 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
from osv import osv, fields
|
||||
|
||||
import wizard
|
||||
import time
|
||||
import datetime
|
||||
import pooler
|
||||
class account_invoice_special_msg(osv.osv_memory):
|
||||
_name = 'account.invoice.special.msg'
|
||||
_description = 'Account Invoice Special Message'
|
||||
|
||||
invoice_form = """<?xml version="1.0"?>
|
||||
<form string="Select Message">
|
||||
<field name="message"/>
|
||||
</form>"""
|
||||
_columns = {
|
||||
'message': fields.many2one('notify.message', 'Message', required = True, help="Message to Print at the bottom of report"),
|
||||
}
|
||||
|
||||
invoice_fields = {
|
||||
'message': {'string': 'Message', 'type': 'many2one', 'relation': 'notify.message', 'required': True},
|
||||
}
|
||||
|
||||
class wizard_report(wizard.interface):
|
||||
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [],
|
||||
'result': {'type':'form', 'arch':invoice_form, 'fields':invoice_fields, 'state':[('end','Cancel'),('print','Print')]},
|
||||
},
|
||||
'print': {
|
||||
'actions': [],
|
||||
'result': {'type':'print', 'report':'notify_account.invoice', 'state':'end'},
|
||||
},
|
||||
}
|
||||
|
||||
wizard_report('wizard.notify_message')
|
||||
|
||||
# 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.invoice',
|
||||
'form': data
|
||||
}
|
||||
return {
|
||||
'type': 'ir.actions.report.xml',
|
||||
'report_name': 'notify_account.invoice',
|
||||
'datas': datas,
|
||||
}
|
||||
|
||||
account_invoice_special_msg()
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -0,0 +1,44 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="account_invoice_special_msg_view" model="ir.ui.view">
|
||||
<field name="name">Account Invioce Special Message</field>
|
||||
<field name="model">account.invoice.special.msg</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Select Message">
|
||||
<group colspan="4" col="6">
|
||||
<field name="message"/>
|
||||
</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_invoice_special_msg" model="ir.actions.act_window">
|
||||
<field name="name">Invoices with Layout and Message</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">account.invoice.special.msg</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="account_invoice_special_msg_view"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.values" id="account_invoice_special_msg_values">
|
||||
<field name="model_id" ref="account.model_account_invoice" />
|
||||
<field name="object" eval="1" />
|
||||
<field name="name">Account Invioce Special Message</field>
|
||||
<field name="key2">client_print_multi</field>
|
||||
<field name="value" eval="'ir.actions.act_window,' + str(ref('action_account_invoice_special_msg'))" />
|
||||
<field name="key">action</field>
|
||||
<field name="model">account.invoice</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,7 +15,7 @@
|
|||
# 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
|
@ -38,12 +38,14 @@
|
|||
'update_xml': [
|
||||
'security/account_payment_security.xml',
|
||||
'security/ir.model.access.csv',
|
||||
'payment_wizard.xml',
|
||||
'wizard/account_payment_pay_view.xml',
|
||||
'wizard/account_payment_create_order_view.xml',
|
||||
'payment_view.xml',
|
||||
'payment_workflow.xml',
|
||||
'payment_sequence.xml',
|
||||
'account_invoice_view.xml',
|
||||
'payment_report.xml'
|
||||
'payment_report.xml',
|
||||
|
||||
],
|
||||
'demo_xml': [],
|
||||
'installable': True,
|
||||
|
|
|
@ -107,7 +107,7 @@
|
|||
<field name="date_prefered"/>
|
||||
<field name="date_planned" select="1"/>
|
||||
<field name="user_id"/>
|
||||
<button colspan="2" name="%(wizard_populate_payment)d" string="Select Invoices to Pay" type="action" attrs="{'invisible':[('state','=','done')]}" icon="gtk-find"/>
|
||||
<button colspan="2" name="%(action_create_payment_order)d" string="Select Invoices to Pay" type="action" attrs="{'invisible':[('state','=','done')]}" icon="gtk-find"/>
|
||||
<field name="line_ids" colspan="4" widget="one2many_list" nolabel="1">
|
||||
<form string="Payment Line">
|
||||
<notebook>
|
||||
|
@ -162,7 +162,7 @@
|
|||
<group col="4" colspan="2">
|
||||
<button name="cancel" states="draft,open" string="Cancel" icon="gtk-cancel"/>
|
||||
<button name="open" states="draft" string="Confirm Payments" icon="gtk-apply"/>
|
||||
<button name="%(wizard_pay_payment)d" states="open" string="Make Payments" type="action" icon="gtk-execute"/>
|
||||
<button name="%(action_account_payment_make_payment)d" states="open" string="Make Payments" type="action" icon="gtk-execute"/>
|
||||
<button name="set_to_draft" states="cancel" string="Set to draft" type="object" icon="gtk-convert"/>
|
||||
</group>
|
||||
</form>
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<wizard id="wizard_populate_payment" menu="False" model="payment.order" name="populate_payment" string="Populate payment"/>
|
||||
|
||||
<wizard id="wizard_pay_payment" menu="False" model="payment.order" name="pay_payment" string="Pay"/>
|
||||
|
||||
<wizard id="wizard_populate_statement" menu="False" model="account.bank.statement" name="populate_statement" string="Populate Statement with Payment lines"/>
|
||||
|
||||
</data>
|
||||
</openerp>
|
|
@ -1,6 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
|
@ -15,12 +15,12 @@
|
|||
# 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 wizard_payment_order
|
||||
import wizard_pay
|
||||
import account_payment_order
|
||||
import account_payment_pay
|
||||
import wizard_populate_statement
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="view_create_payment_order" model="ir.ui.view">
|
||||
<field name="name">payment.order.create.form</field>
|
||||
<field name="model">payment.order.create</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Search Payment lines">
|
||||
<group col="4" colspan="6">
|
||||
<field name="duedate" />
|
||||
</group>
|
||||
<separator colspan="4"/>
|
||||
<group col="2" colspan="4">
|
||||
<button special="cancel" string="Cancel" icon='gtk-cancel'/>
|
||||
<button name="search_entries" string="Search" colspan="1" type="object" icon="gtk-execute"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_create_payment_order_lines" model="ir.ui.view">
|
||||
<field name="name">payment.order.create.form</field>
|
||||
<field name="model">payment.order.create</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Search Payment lines">
|
||||
<group col="4" colspan="6">
|
||||
</group>
|
||||
<separator colspan="4"/>
|
||||
<group col="2" colspan="4">
|
||||
<button special="cancel" string="Cancel" icon='gtk-cancel'/>
|
||||
<button name="create_payment" string="_Add to payment order" colspan="1" type="object" icon="gtk-execute"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_create_payment_order" model="ir.actions.act_window">
|
||||
<field name="name">Populate Payment</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">payment.order.create</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue