Merge with lp:~openerp-dev/openobject-addons/trunk-dev-addons3
bzr revid: sbh@tinyerp.com-20100624123244-w9o0ugpqjh7ugq54
This commit is contained in:
@@ -18,8 +18,6 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
|
||||
{
|
||||
"name" : "Accounting and Financial Management",
|
||||
"version" : "1.1",
|
||||
@@ -57,6 +55,7 @@ module named account_vouchers
|
||||
'wizard/account_use_model_view.xml',
|
||||
'account_view.xml',
|
||||
'account_report.xml',
|
||||
'wizard/account_common_report.xml',
|
||||
'wizard/account_invoice_refund_view.xml',
|
||||
'wizard/account_period_close_view.xml',
|
||||
'wizard/account_fiscalyear_close_state.xml',
|
||||
@@ -77,7 +76,7 @@ module named account_vouchers
|
||||
'wizard/account_validate_move_view.xml',
|
||||
'wizard/account_pay_invoice_view.xml',
|
||||
'wizard/account_unreconcile_view.xml',
|
||||
'wizard/account_general_ledger_report_view.xml',
|
||||
'wizard/account_report_general_ledger_view.xml',
|
||||
'wizard/account_invoice_state_view.xml',
|
||||
'wizard/account_partner_balance_report_view.xml',
|
||||
'wizard/account_balance_report_view.xml',
|
||||
@@ -119,6 +118,8 @@ module named account_vouchers
|
||||
'report/account_account_report_view.xml',
|
||||
'report/account_analytic_entries_report_view.xml',
|
||||
'board_account_view.xml',
|
||||
"wizard/account_pl_report_view.xml",
|
||||
"wizard/account_bs_report_view.xml"
|
||||
],
|
||||
'demo_xml': [
|
||||
#'demo/price_accuracy00.yml',
|
||||
@@ -145,4 +146,4 @@ module named account_vouchers
|
||||
'active': False,
|
||||
'certificate': '0080331923549',
|
||||
}
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -586,7 +586,7 @@ class account_journal_column(osv.osv):
|
||||
for col in cols:
|
||||
if col in ('period_id', 'journal_id'):
|
||||
continue
|
||||
|
||||
|
||||
result.append( (col, cols[col].string) )
|
||||
result.sort()
|
||||
return result
|
||||
@@ -687,8 +687,7 @@ class account_fiscalyear(osv.osv):
|
||||
_columns = {
|
||||
'name': fields.char('Fiscal Year', size=64, required=True),
|
||||
'code': fields.char('Code', size=6, required=True),
|
||||
'company_id': fields.many2one('res.company', 'Company',
|
||||
help="Keep empty if the fiscal year belongs to several companies.", required=True),
|
||||
'company_id': fields.many2one('res.company', 'Company', required=True),
|
||||
'date_start': fields.date('Start Date', required=True),
|
||||
'date_stop': fields.date('End Date', required=True),
|
||||
'period_ids': fields.one2many('account.period', 'fiscalyear_id', 'Periods'),
|
||||
@@ -772,7 +771,7 @@ class account_period(osv.osv):
|
||||
'fiscalyear_id': fields.many2one('account.fiscalyear', 'Fiscal Year', required=True, states={'done':[('readonly',True)]}, select=True),
|
||||
'state': fields.selection([('draft','Draft'), ('done','Done')], 'State', readonly=True,
|
||||
help='When monthly periods are created. The state is \'Draft\'. At the end of monthly period it is in \'Done\' state.'),
|
||||
'company_id': fields.related('fiscalyear_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True)
|
||||
'company_id': fields.related('fiscalyear_id', 'company_id', type='many2one', relation='res.company', string='Company'),
|
||||
}
|
||||
_defaults = {
|
||||
'state': lambda *a: 'draft',
|
||||
|
||||
@@ -2,30 +2,30 @@
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<menuitem icon="terp-account" id="menu_finance" name="Accounting" sequence="13"/>
|
||||
<menuitem icon="terp-account" id="menu_finance" name="Accounting" sequence="13"/>
|
||||
<menuitem id="menu_finance_receivables" name="Receivables" parent="menu_finance" sequence="1"/>
|
||||
<menuitem id="menu_finance_payables" name="Payables" parent="menu_finance" sequence="2"/>
|
||||
<menuitem id="menu_finance_bank_and_cash" name="Bank and Cash" parent="menu_finance" sequence="3"/>
|
||||
<!-- <menuitem id="menu_accounting" name="Accounting" parent="menu_finance" sequence="5"/>-->
|
||||
<menuitem id="menu_finance_periodical_processing" name="Periodical Processing" parent="menu_finance" sequence="8" groups="group_account_user"/>
|
||||
<menuitem id="periodical_processing_journal_entries_validation" name="Journal Entries Validation" parent="menu_finance_periodical_processing"/>
|
||||
<menuitem id="periodical_processing_reconciliation" name="Reconciliation" parent="menu_finance_periodical_processing"/>
|
||||
<!-- <menuitem id="periodical_processing_recurrent_entries" name="Recurrent Entries" parent="menu_finance_periodical_processing"/>-->
|
||||
<!-- <menuitem id="periodical_processing_invoicing" name="Invoicing" parent="menu_finance_periodical_processing"/>-->
|
||||
<!-- <menuitem id="periodical_processing_end_of_period" name="End of Period" parent="menu_finance_periodical_processing"/>-->
|
||||
<menuitem id="periodical_processing_journal_entries_validation" name="Journal Entries Validation" parent="menu_finance_periodical_processing"/>
|
||||
<menuitem id="periodical_processing_reconciliation" name="Reconciliation" parent="menu_finance_periodical_processing"/>
|
||||
<!-- <menuitem id="periodical_processing_recurrent_entries" name="Recurrent Entries" parent="menu_finance_periodical_processing"/>-->
|
||||
<menuitem id="periodical_processing_invoicing" name="Invoicing" parent="menu_finance_periodical_processing"/>
|
||||
<!-- <menuitem id="periodical_processing_end_of_period" name="End of Period" parent="menu_finance_periodical_processing"/>-->
|
||||
<menuitem id="menu_finance_charts" name="Charts" parent="menu_finance" sequence="5"/>
|
||||
<menuitem id="menu_finance_reporting" name="Reporting" parent="account.menu_finance" sequence="12"/>
|
||||
<menuitem id="menu_finance_reporting_budgets" name="Budgets" parent="menu_finance_reporting"/>
|
||||
<menuitem id="menu_generic_report" name="Management Reports" parent="menu_finance_reporting"/>
|
||||
<menuitem id="menu_finance_legal_statement" name="Legal Reports" parent="menu_finance_reporting"/>
|
||||
<menuitem id="menu_finance_management_belgian_reports" name="Belgian Reports" parent="menu_finance_reporting"/>
|
||||
<menuitem id="menu_finance_reporting_budgets" name="Budgets" parent="menu_finance_reporting"/>
|
||||
<menuitem id="menu_generic_report" name="Management Reports" parent="menu_finance_reporting"/>
|
||||
<menuitem id="menu_finance_legal_statement" name="Legal Reports" parent="menu_finance_reporting"/>
|
||||
<menuitem id="menu_finance_management_belgian_reports" name="Belgian Reports" parent="menu_finance_reporting"/>
|
||||
<menuitem id="menu_finance_configuration" name="Configuration" parent="menu_finance" sequence="13"/>
|
||||
<menuitem id="menu_finance_accounting" name="Financial Accounting" parent="menu_finance_configuration"/>
|
||||
<menuitem id="menu_analytic_accounting" name="Analytic Accounting" parent="menu_finance_configuration"/>
|
||||
<menuitem id="menu_analytic" parent="menu_analytic_accounting" name="Accounts"/>
|
||||
<menuitem id="menu_low_level" name="Low Level" parent="menu_finance_accounting"/>
|
||||
<menuitem id="menu_configuration_misc" name="Miscelleanous" parent="menu_finance_configuration"/>
|
||||
<menuitem id="base.menu_action_currency_form" parent="menu_configuration_misc" sequence="20"/>
|
||||
<menuitem id="menu_finance_accounting" name="Financial Accounting" parent="menu_finance_configuration"/>
|
||||
<menuitem id="menu_analytic_accounting" name="Analytic Accounting" parent="menu_finance_configuration"/>
|
||||
<menuitem id="menu_analytic" parent="menu_analytic_accounting" name="Accounts"/>
|
||||
<menuitem id="menu_low_level" name="Low Level" parent="menu_finance_accounting"/>
|
||||
<menuitem id="menu_configuration_misc" name="Miscelleanous" parent="menu_finance_configuration"/>
|
||||
<menuitem id="base.menu_action_currency_form" parent="menu_configuration_misc" sequence="20"/>
|
||||
<!-- <menuitem id="menu_finance_configuration1" name="Configuration" parent="menu_finance" sequence="80"/>-->
|
||||
<!-- <menuitem id="base.menu_action_currency_form" parent="menu_finance_configuration" sequence="20"/>-->
|
||||
<!-- <menuitem id="menu_finance_accounting1" name="Financial Accounting" parent="menu_finance_configuration" sequence="80"/>-->
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
<menuitem id="menu_finance_entries" name="Accounting" parent="menu_finance" sequence="4"
|
||||
groups="group_account_user"/>
|
||||
<menuitem id="account.menu_finance_recurrent_entries" name="Recurrent Entries" parent="menu_finance_periodical_processing" sequence="15"/>
|
||||
<menuitem id="account.menu_finance_recurrent_entries" name="Recurring Entries" parent="menu_finance_periodical_processing" sequence="15"/>
|
||||
|
||||
<!-- <menuitem id="menu_finance_periodical_processing11" name="Periodical Processing" parent="account.menu_finance"-->
|
||||
<!-- sequence="3"-->
|
||||
|
||||
@@ -61,21 +61,6 @@
|
||||
parent="menu_tax_report"
|
||||
type="wizard"/> -->
|
||||
|
||||
|
||||
<record id="action_tax_code_tree" model="ir.actions.act_window">
|
||||
<field name="name">Chart of Taxes</field>
|
||||
<field name="res_model">account.tax.code</field>
|
||||
<field name="domain">[('parent_id','=',False)]</field>
|
||||
<field name="view_type">tree</field>
|
||||
<field name="view_id" ref="view_tax_code_tree"/>
|
||||
</record>
|
||||
<menuitem
|
||||
action="action_tax_code_tree"
|
||||
id="menu_action_tax_code_tree"
|
||||
parent="menu_tax_report"
|
||||
sequence="12"/>
|
||||
|
||||
|
||||
<report id="account_account_balance_compare"
|
||||
string="Account balance"
|
||||
model="account.account"
|
||||
|
||||
@@ -714,7 +714,7 @@
|
||||
<field name="view_id" ref="view_tax_code_tree"/>
|
||||
</record>
|
||||
<menuitem id="next_id_27" name="Taxes" parent="account.menu_finance_accounting"/>
|
||||
<menuitem action="action_tax_code_list" id="menu_action_tax_code_list" parent="menu_low_level" sequence="12"/>
|
||||
<menuitem action="action_tax_code_list" id="menu_action_tax_code_list" parent="menu_low_level" sequence="12"/>
|
||||
|
||||
|
||||
<!--
|
||||
@@ -818,6 +818,18 @@
|
||||
</record>
|
||||
<menuitem action="action_tax_form" id="menu_action_tax_form" parent="next_id_27"/>
|
||||
|
||||
<record id="action_tax_code_tree" model="ir.actions.act_window">
|
||||
<field name="name">Chart of Taxes</field>
|
||||
<field name="res_model">account.tax.code</field>
|
||||
<field name="domain">[('parent_id','=',False)]</field>
|
||||
<field name="view_type">tree</field>
|
||||
<field name="view_id" ref="view_tax_code_tree"/>
|
||||
</record>
|
||||
<menuitem
|
||||
action="action_tax_code_tree"
|
||||
id="menu_action_tax_code_tree"
|
||||
parent="menu_finance_charts"
|
||||
sequence="12"/>
|
||||
<!-- <wizard id="action_move_journal_line_form" menu="False" model="account.move.line" name="account.move.journal" string="Entries by Line"/-->
|
||||
|
||||
<!--
|
||||
@@ -1161,7 +1173,15 @@
|
||||
<field name="view_id" ref="view_move_tree"/>
|
||||
<field name="search_view_id" ref="view_account_move_filter"/>
|
||||
</record>
|
||||
|
||||
|
||||
<act_window
|
||||
domain="[('move_id','=',active_id)]"
|
||||
id="act_account_move_to_account_move_line_open"
|
||||
name="Journal Items"
|
||||
context="{'move_id':active_id}"
|
||||
res_model="account.move.line"
|
||||
src_model="account.move"/>
|
||||
|
||||
<record id="action_move_to_review" model="ir.actions.act_window">
|
||||
<field name="name">Journal Entries to Review</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
@@ -1338,17 +1358,17 @@
|
||||
id="menu_action_account_bank_reconcile_check_tree"
|
||||
parent="periodical_processing_reconciliation" groups="group_account_user" />
|
||||
|
||||
<act_window
|
||||
context="{'search_default_next_partner':1}"
|
||||
<act_window
|
||||
context="{'search_default_next_partner':1}"
|
||||
id="action_account_manual_reconcile" name="Entry Lines"
|
||||
res_model="account.move.line"
|
||||
/>
|
||||
|
||||
<menuitem
|
||||
name="Manual Reconcilication" icon="STOCK_EXECUTE"
|
||||
action="action_account_manual_reconcile"
|
||||
id="menu_manual_reconcile"
|
||||
parent="account.periodical_processing_reconciliation"/>
|
||||
<menuitem
|
||||
name="Manual Reconcilication" icon="STOCK_EXECUTE"
|
||||
action="action_account_manual_reconcile"
|
||||
id="menu_manual_reconcile"
|
||||
parent="account.periodical_processing_reconciliation"/>
|
||||
|
||||
|
||||
<act_window
|
||||
@@ -1407,7 +1427,7 @@
|
||||
<field name="model">account.model.line</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Entry Model Line">
|
||||
<tree string="Entry Model Line" editable="bottom">
|
||||
<field name="sequence"/>
|
||||
<field name="ref"/>
|
||||
<field name="name"/>
|
||||
@@ -1415,6 +1435,8 @@
|
||||
<field name="partner_id"/>
|
||||
<field name="debit"/>
|
||||
<field name="credit"/>
|
||||
<field name="date"/>
|
||||
<field name="date_maturity"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
@@ -1450,7 +1472,7 @@
|
||||
<field name="name" select="1"/>
|
||||
<field name="ref" select="1"/>
|
||||
<field name="journal_id" select="1"/>
|
||||
<field colspan="4" name="lines_id" widget="one2many_list" nolabel="1"/>
|
||||
<field colspan="4" nolabel="1" name="lines_id" height="250" widget="one2many_list"/>
|
||||
<separator string="Legend" colspan="4"/>
|
||||
<field name="legend" colspan="4" nolabel="1"/>
|
||||
<group col="1" colspan="4">
|
||||
@@ -1471,17 +1493,16 @@
|
||||
</field>
|
||||
</record>
|
||||
<record id="action_model_form" model="ir.actions.act_window">
|
||||
<field name="name">Define Models</field>
|
||||
<field name="name">Define Recurring</field>
|
||||
<field name="res_model">account.model</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
<menuitem action="action_model_form" id="menu_action_model_form" parent="account.menu_finance_recurrent_entries"/>
|
||||
|
||||
<menuitem action="action_model_form" id="menu_action_model_form" parent="account.menu_configuration_misc"/>
|
||||
|
||||
<!--
|
||||
# Payment Terms
|
||||
-->
|
||||
# Payment Terms
|
||||
-->
|
||||
|
||||
<record id="view_payment_term_line_tree" model="ir.ui.view">
|
||||
<field name="name">account.payment.term.line.tree</field>
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<!-- <wizard-->
|
||||
<!-- string="Account balance-Compare Years"-->
|
||||
<!-- model="account.account"-->
|
||||
<!-- name="account.balance.account.balance.report"-->
|
||||
<!-- keyword="client_print_multi"-->
|
||||
<!-- id="wizard_account_balance_compare_report"/>-->
|
||||
<!-- <wizard-->
|
||||
<!-- string="Account balance-Compare Years"-->
|
||||
<!-- model="account.account"-->
|
||||
<!-- name="account.balance.account.balance.report"-->
|
||||
<!-- keyword="client_print_multi"-->
|
||||
<!-- id="wizard_account_balance_compare_report"/>-->
|
||||
|
||||
<!-- <wizard id="wizard_invoice_refund" model="account.invoice" name="account.invoice.refund" string="Credit Note" groups="base.group_user"/> -->
|
||||
|
||||
@@ -75,7 +75,7 @@
|
||||
<!-- report-related wizards -->
|
||||
<!-- <wizard id="wizard_partner_balance_report" menu="False" model="res.partner" name="account.partner.balance.report" string="Partner Balance"/>
|
||||
<menuitem icon="STOCK_PRINT" action="wizard_partner_balance_report" id="menu_partner_balance" parent="account.next_id_22" type="wizard"/> -->
|
||||
<menuitem id="next_id_22" name="Partner Accounts" parent="menu_finance_generic_reporting" sequence="1"/>
|
||||
<menuitem id="next_id_22" name="Partner Accounts" parent="menu_finance_generic_reporting" sequence="1"/>
|
||||
<!--<wizard id="wizard_third_party_ledger" menu="False" model="res.partner" name="account.third_party_ledger.report" string="Partner Ledger"/>
|
||||
<menuitem icon="STOCK_PRINT" action="wizard_third_party_ledger" id="menu_third_party_ledger" parent="account.next_id_22" type="wizard"/> -->
|
||||
|
||||
@@ -94,30 +94,30 @@
|
||||
|
||||
<wizard id="wizard_validate_account_moves_line" menu="True" model="account.move.line" name="account.move_line.validate" string="Validate Ledger Postings"/>-->
|
||||
|
||||
<!-- Use Models -->
|
||||
<!-- Use Models -->
|
||||
<!-- <wizard string="Create Entries From Models" model="account.model" name="account_use_models" menu="False" id="wizard_account_use_model"/>-->
|
||||
<!-- <menuitem action="wizard_account_use_model" type="wizard" parent="account.menu_finance_recurrent_entries" id="menu_account_use_model"/>-->
|
||||
|
||||
<!-- <wizard string="Create Entries From Models" model="account.move.line" name="account_use_models" menu="True" id="wizard_line_account_use_model"/>-->
|
||||
|
||||
<!-- account.invoice -->
|
||||
<!-- account.invoice -->
|
||||
<!-- <wizard string="Open State" model="account.invoice" name="account.wizard_paid_open" menu="False" id="wizard_paid_open" groups="base.group_user"/> -->
|
||||
|
||||
<!-- generic report wizard -->
|
||||
<!-- <wizard id="wizard_account_balance_report" menu="False" model="account.account" name="account.account.balance.report" string="Account Balance"/>-->
|
||||
<!-- generic report wizard -->
|
||||
<!-- <wizard id="wizard_account_balance_report" menu="False" model="account.account" name="account.account.balance.report" string="Account Balance"/>-->
|
||||
<!-- <menuitem icon="STOCK_PRINT" action="wizard_account_balance_report" id="menu_account_balance_report" parent="account.menu_generic_report" type="wizard"/>-->
|
||||
|
||||
<!-- <wizard id="wizard_general_ledger" menu="False" model="account.account" name="account.general.ledger.report" string="General Ledger"/>
|
||||
<!-- <wizard id="wizard_general_ledger" menu="False" model="account.account" name="account.general.ledger.report" string="General Ledger"/>
|
||||
<menuitem icon="STOCK_PRINT" action="wizard_general_ledger" id="menu_general_ledger" parent="account.menu_generic_report" type="wizard"/>-->
|
||||
|
||||
<!-- <wizard id="wizard_print_journal" menu="False" model="account.journal.period" name="account.print.journal.report" string="Print Journal" />
|
||||
<menuitem icon="STOCK_PRINT" action="wizard_print_journal" id="menu_print_journal" parent="account.menu_generic_report" type="wizard" />
|
||||
<menuitem icon="STOCK_PRINT" action="wizard_print_journal" id="menu_print_journal" parent="account.menu_generic_report" type="wizard" />
|
||||
|
||||
<wizard id="wizard_central_journal" menu="False" model="account.journal.period" name="account.central.journal.report" string="Print Central Journal" />
|
||||
<menuitem icon="STOCK_PRINT" action="wizard_central_journal" id="menu_central_journal" parent="account.menu_generic_report" type="wizard" />
|
||||
<menuitem icon="STOCK_PRINT" action="wizard_central_journal" id="menu_central_journal" parent="account.menu_generic_report" type="wizard" />
|
||||
|
||||
<wizard id="wizard_general_journal" menu="False" model="account.journal.period" name="account.general.journal.report" string="Print General Journal" />
|
||||
<menuitem icon="STOCK_PRINT" action="wizard_general_journal" id="menu_general_journal" parent="account.menu_generic_report" type="wizard" />-->
|
||||
<menuitem icon="STOCK_PRINT" action="wizard_general_journal" id="menu_general_journal" parent="account.menu_generic_report" type="wizard" />-->
|
||||
|
||||
<!-- <wizard id="wizard_invoice_currency_change" model="account.invoice" name="account.invoice.currency_change" string="Change Currency" groups="base.group_user"/>-->
|
||||
</data>
|
||||
|
||||
@@ -40,5 +40,7 @@ import account_account_report
|
||||
import account_entries_report
|
||||
import account_analytic_entries_report
|
||||
import voucher_print
|
||||
import report_bs
|
||||
import report_pl
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
||||
@@ -40,12 +40,9 @@ class general_ledger(rml_parse.rml_parse):
|
||||
new_ids = []
|
||||
if (data['model'] == 'account.account'):
|
||||
new_ids = 'active_ids' in data['form']['context'] and data['form']['context']['active_ids'] or []
|
||||
#new_ids = ids
|
||||
else:
|
||||
new_ids.append(data['form']['Account_list'])
|
||||
|
||||
objects = self.pool.get('account.account').browse(self.cr, self.uid, new_ids)
|
||||
|
||||
new_ids.append(data['form']['chart_account_id'])
|
||||
objects = self.pool.get('account.account').browse(self.cr, self.uid, new_ids)
|
||||
super(general_ledger, self).set_context(objects, data, new_ids, report_type)
|
||||
|
||||
def __init__(self, cr, uid, name, context):
|
||||
@@ -81,7 +78,7 @@ class general_ledger(rml_parse.rml_parse):
|
||||
res = self.cr.dictfetchall()
|
||||
borne_min = res[0]['start_date']
|
||||
borne_max = res[0]['stop_date']
|
||||
if form['state'] == 'byperiod':
|
||||
if form['filter'] == 'filter_period':
|
||||
## This function will return the most aged date
|
||||
periods = form['periods']
|
||||
#periods = form['periods'][0][2]
|
||||
@@ -99,43 +96,10 @@ class general_ledger(rml_parse.rml_parse):
|
||||
res = self.cr.dictfetchall()
|
||||
borne_min = res[0]['start_date']
|
||||
borne_max = res[0]['stop_date']
|
||||
elif form['state'] == 'bydate':
|
||||
elif form['filter'] == 'filter_date':
|
||||
borne_min = form['date_from']
|
||||
borne_max = form['date_to']
|
||||
elif form['state'] == 'all':
|
||||
periods = form['periods']
|
||||
#periods = form['periods'][0][2]
|
||||
if not periods:
|
||||
sql = """
|
||||
SELECT MIN(p.date_start) AS start_date,
|
||||
MAX(p.date_stop) AS stop_date
|
||||
FROM account_period AS p
|
||||
WHERE p.fiscalyear_id = %s
|
||||
"""
|
||||
sqlargs = (form['fiscalyear'],)
|
||||
else:
|
||||
sql = """
|
||||
SELECT MIN(p.date_start) AS start_date,
|
||||
MAX(p.date_stop) AS stop_date
|
||||
FROM account_period AS p
|
||||
WHERE p.id IN %s
|
||||
"""
|
||||
sqlargs = (tuple(periods),)
|
||||
self.cr.execute(sql, sqlargs)
|
||||
res = self.cr.dictfetchall()
|
||||
period_min = res[0]['start_date']
|
||||
period_max = res[0]['stop_date']
|
||||
date_min = form['date_from']
|
||||
date_max = form['date_to']
|
||||
if period_min<date_min:
|
||||
borne_min = period_min
|
||||
else :
|
||||
borne_min = date_min
|
||||
if date_max<period_max:
|
||||
borne_max = period_max
|
||||
else :
|
||||
borne_max = date_max
|
||||
elif form['state'] == 'none':
|
||||
elif form['filter'] == 'filter_no':
|
||||
sql = """
|
||||
SELECT min(date) as start_date,max(date) as stop_date FROM account_move_line """
|
||||
self.cr.execute(sql)
|
||||
@@ -149,46 +113,26 @@ class general_ledger(rml_parse.rml_parse):
|
||||
return self.date_borne
|
||||
|
||||
def get_children_accounts(self, account, form):
|
||||
|
||||
self.child_ids = self.pool.get('account.account').search(self.cr, self.uid,
|
||||
[('parent_id', 'child_of', self.ids)])
|
||||
#
|
||||
|
||||
res = []
|
||||
ctx = self.context.copy()
|
||||
## We will make the test for period or date
|
||||
## We will now make the test
|
||||
#
|
||||
ctx['state'] = form['context'].get('state', 'all')
|
||||
if form.has_key('fiscalyear'):
|
||||
ctx['fiscalyear'] = form['fiscalyear']
|
||||
ctx['periods'] = form['periods']
|
||||
#ctx['periods'] = form['periods'][0][2]
|
||||
|
||||
else:
|
||||
ctx['date_from'] = form['date_from']
|
||||
ctx['date_to'] = form['date_to']
|
||||
##
|
||||
#
|
||||
self.query = self.pool.get('account.move.line')._query_get(self.cr, self.uid, context=ctx)
|
||||
self.query = form['query_get']
|
||||
if account and account.child_consol_ids: # add ids of consolidated childs also of selected account
|
||||
ctx['consolidate_childs'] = True
|
||||
ctx['account_id'] = account.id
|
||||
ids_acc = self.pool.get('account.account').search(self.cr, self.uid, [('parent_id', 'child_of', [account.id])], context=ctx)
|
||||
for child_id in ids_acc:
|
||||
child_account = self.pool.get('account.account').browse(self.cr, self.uid, child_id)
|
||||
sold_account = self._sum_solde_account(child_account, form)
|
||||
ids_acc = self.pool.get('account.account').search(self.cr, self.uid,[('parent_id', 'child_of', [account.id])], context=ctx)
|
||||
for child_account in self.pool.get('account.account').browse(self.cr, self.uid, ids_acc):
|
||||
sold_account = self._sum_solde_account(child_account,form)
|
||||
self.sold_accounts[child_account.id] = sold_account
|
||||
if form['display_account'] == 'bal_mouvement':
|
||||
if child_account.type != 'view' \
|
||||
and len(self.pool.get('account.move.line').search(self.cr, self.uid,
|
||||
[('account_id','=',child_account.id)],
|
||||
context=ctx)) <> 0 :
|
||||
and len(self.pool.get('account.move.line').search(self.cr, self.uid, [('account_id','=',child_account.id)], context=ctx)) <> 0 :
|
||||
res.append(child_account)
|
||||
elif form['display_account'] == 'bal_solde':
|
||||
if child_account.type != 'view' \
|
||||
and len(self.pool.get('account.move.line').search(self.cr, self.uid,
|
||||
[('account_id','=',child_account.id)],
|
||||
context=ctx)) <> 0 :
|
||||
and len(self.pool.get('account.move.line').search(self.cr, self.uid, [('account_id','=',child_account.id)], context=ctx)) <> 0 :
|
||||
if ( sold_account <> 0.0):
|
||||
res.append(child_account)
|
||||
else:
|
||||
@@ -199,10 +143,11 @@ class general_ledger(rml_parse.rml_parse):
|
||||
res.append(child_account)
|
||||
##
|
||||
if not len(res):
|
||||
|
||||
return [account]
|
||||
else:
|
||||
## We will now compute solde initiaux
|
||||
if not form['soldeinit']:
|
||||
return res
|
||||
for move in res:
|
||||
SOLDEINIT = "SELECT SUM(l.debit) AS sum_debit,"\
|
||||
" SUM(l.credit) AS sum_credit "\
|
||||
@@ -227,20 +172,18 @@ class general_ledger(rml_parse.rml_parse):
|
||||
else:
|
||||
move.init_credit = 0
|
||||
move.init_debit = 0
|
||||
|
||||
|
||||
return res
|
||||
|
||||
def lines(self, account, form):
|
||||
""" Return all the account_move_line of account with their account code counterparts """
|
||||
|
||||
# First compute all counterpart strings for every move_id where this account appear
|
||||
# First compute all counterpart strings for every move_id where this account appear.
|
||||
# Currently, the counterpart info is used only in landscape mode
|
||||
sql = """
|
||||
SELECT m1.move_id,
|
||||
array_to_string(ARRAY(SELECT DISTINCT a.code FROM account_move_line m2 LEFT JOIN account_account a ON (m2.account_id=a.id) WHERE m2.move_id = m1.move_id AND m2.account_id<>%%s), ', ') AS counterpart
|
||||
FROM (SELECT move_id FROM account_move_line l WHERE %s AND l.account_id = %%s AND l.date<=%%s AND l.date>=%%s GROUP BY move_id) m1
|
||||
FROM (SELECT move_id FROM account_move_line l WHERE %s AND l.account_id = %%s GROUP BY move_id) m1
|
||||
""" % self.query
|
||||
self.cr.execute(sql, (account.id, account.id, self.date_borne['max_date'], self.date_borne['min_date']))
|
||||
self.cr.execute(sql, (account.id, account.id))
|
||||
counterpart_res = self.cr.dictfetchall()
|
||||
counterpart_accounts = {}
|
||||
for i in counterpart_res:
|
||||
@@ -248,10 +191,10 @@ class general_ledger(rml_parse.rml_parse):
|
||||
del counterpart_res
|
||||
|
||||
# Then select all account_move_line of this account
|
||||
if form['sortbydate'] == 'sort_date':
|
||||
sql_sort='l.date'
|
||||
if form['sortby'] == 'sort_journal_partner':
|
||||
sql_sort='j.code, p.name'
|
||||
else:
|
||||
sql_sort='j.code'
|
||||
sql_sort='l.date'
|
||||
sql = """
|
||||
SELECT l.id, l.date, j.code, l.amount_currency,l.ref, l.name, COALESCE(l.debit,0) AS debit, COALESCE(l.credit,0) AS credit, l.period_id, l.partner_id,
|
||||
m.name AS move_name, m.id AS move_id,
|
||||
@@ -264,9 +207,9 @@ class general_ledger(rml_parse.rml_parse):
|
||||
LEFT JOIN res_partner p on (l.partner_id=p.id)
|
||||
LEFT JOIN account_invoice i on (m.id =i.move_id)
|
||||
JOIN account_journal j on (l.journal_id=j.id)
|
||||
WHERE %s AND l.account_id = %%s AND l.date<=%%s AND l.date>=%%s ORDER by %s
|
||||
WHERE %s AND l.account_id = %%s ORDER by %s
|
||||
""" % (self.query, sql_sort)
|
||||
self.cr.execute(sql, (account.id, self.date_borne['max_date'], self.date_borne['min_date']))
|
||||
self.cr.execute(sql, (account.id,))
|
||||
res = self.cr.dictfetchall()
|
||||
account_sum = 0.0
|
||||
account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
|
||||
@@ -278,8 +221,6 @@ class general_ledger(rml_parse.rml_parse):
|
||||
l['ref'] = '%s: %s'%(inv_types[l['invoice_type']], l['invoice_number'])
|
||||
l['partner'] = l['partner_name'] or ''
|
||||
account_sum = l['debit'] - l ['credit']
|
||||
#c = time.strptime(l['date'],"%Y-%m-%d")
|
||||
#l['date'] = time.strftime("%d-%m-%Y",c)
|
||||
l['progress'] = account_sum
|
||||
l['line_corresp'] = counterpart_accounts[l['move_id']]
|
||||
# Modification du amount Currency
|
||||
@@ -314,9 +255,6 @@ class general_ledger(rml_parse.rml_parse):
|
||||
sum_credit = self.cr.fetchone()[0] or 0.0
|
||||
if form.get('soldeinit', False):
|
||||
sum_credit += account.init_credit
|
||||
#
|
||||
##
|
||||
|
||||
return sum_credit
|
||||
|
||||
def _sum_solde_account(self, account, form):
|
||||
|
||||
@@ -91,7 +91,7 @@
|
||||
</stylesheet>
|
||||
<story>
|
||||
<para>[[ repeatIn(objects, 'a') ]]</para>
|
||||
<blockTable colWidths="66.0,124.0,70.0,40.0,80.0,59.0,52.0,54.0" style="tbl_header" repeatRows="1">[[ data['form']['amount_currency'] == False or removeParentNode('blockTable') ]]
|
||||
<blockTable colWidths="66.0,124.0,70.0,40.0,80.0,59.0,52.0,54.0" style="tbl_header" repeatRows="1">[[data['form']['amount_currency'] == False or removeParentNode('blockTable')]]
|
||||
<tr>
|
||||
<td><para style="date">Date</para></td>
|
||||
<td><para style="P3">Partner</para></td>
|
||||
@@ -102,46 +102,45 @@
|
||||
<td><para style="P4">Crebit</para></td>
|
||||
<td><para style="P9">Balance</para></td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<section>
|
||||
<para>[[ repeatIn(get_children_accounts(a,data['form']), 'o') ]]</para>
|
||||
<blockTable rowHeights="0.65cm" colWidths="66.0,124.0,70.0,40.0,80.0,59.0,52.0,54.0" style="tbl_content">[[ data['form']['amount_currency'] == False or removeParentNode('blockTable') ]]
|
||||
<tr>
|
||||
<td>
|
||||
<blockTable colWidths="280.0,100.0,52.5,52.5,52.5" style="Table5">
|
||||
<tr>
|
||||
<td><para style="Standard">[[ o.code or '']] [[ o.name or '']]</para></td>
|
||||
<td><para style="Standard"></para></td>
|
||||
<td alignment="right"><para style="P9b"><u>[[formatLang(sum_debit_account(o, data['form'])) ]]</u></para></td>
|
||||
<td alignment="right"><para style="P9b"><u>[[formatLang(sum_credit_account(o, data['form'])) ]]</u></para></td>
|
||||
<td><para style="P9b"><u>[[formatLang(sum_solde_account(o, data['form'])) ]]</u></para></td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
</td>
|
||||
<td><para style="Standard"></para></td>
|
||||
<td><para style="Standard"></para></td>
|
||||
<td><para style="Standard"></para></td>
|
||||
<td><para style="Standard"></para></td>
|
||||
<td><para style="Standard"></para></td>
|
||||
<td><para style="Standard"></para></td>
|
||||
<td><para style="Standard"></para></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><para style="P3">[[ repeatIn(lines(o, data['form']), 'line') ]] <font>[[ formatLang(line['date'],date=True) ]]</font></para></td>
|
||||
<td><para style="P3">[[ line['partner'] or '']]</para></td>
|
||||
<td><para style="P3">[[ line['ref'] or '']]</para></td>
|
||||
<td><para style="P3">[[ line['move'] or '']]</para></td>
|
||||
<td><para style="P3">[[ line['name'] or '' ]]</para></td>
|
||||
<td><para style="P4">[[ formatLang(line['debit']) ]]</para></td>
|
||||
<td><para style="P4">[[ formatLang(line['credit']) ]]</para></td>
|
||||
<td><para style="P4">[[ formatLang(line['progress']) ]]</para></td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
</section>
|
||||
|
||||
|
||||
</blockTable>
|
||||
|
||||
<blockTable colWidths="72.0,93.0,66.0,40.0,100.0,50.0,50.0,50.0,40.0" style="tbl_header" repeatRows="1">[[ data['form']['amount_currency'] == True or removeParentNode('blockTable') ]]
|
||||
<section>
|
||||
<para>[[ repeatIn(get_children_accounts(a,data['form']), 'o') ]]</para>
|
||||
<blockTable rowHeights="0.65cm" colWidths="66.0,124.0,70.0,40.0,80.0,59.0,52.0,54.0" style="tbl_content">[[data['form']['amount_currency'] == False or removeParentNode('blockTable')]]
|
||||
<tr>
|
||||
<td>
|
||||
<blockTable colWidths="280.0,100.0,52.5,52.5,52.5" style="Table5">
|
||||
<tr>
|
||||
<td><para style="Standard">[[ o.code or '']] [[ o.name or '']]</para></td>
|
||||
<td><para style="Standard"></para></td>
|
||||
<td alignment="right"><para style="P9b"><u>[[formatLang(sum_debit_account(o, data['form'])) ]]</u></para></td>
|
||||
<td alignment="right"><para style="P9b"><u>[[formatLang(sum_credit_account(o, data['form'])) ]]</u></para></td>
|
||||
<td><para style="P9b"><u>[[formatLang(sum_solde_account(o, data['form'])) ]]</u></para></td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
</td>
|
||||
<td><para style="Standard"></para></td>
|
||||
<td><para style="Standard"></para></td>
|
||||
<td><para style="Standard"></para></td>
|
||||
<td><para style="Standard"></para></td>
|
||||
<td><para style="Standard"></para></td>
|
||||
<td><para style="Standard"></para></td>
|
||||
<td><para style="Standard"></para></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><para style="P3">[[ repeatIn(lines(o, data['form']), 'line') ]] <font>[[ formatLang(line['date'],date=True) ]]</font></para></td>
|
||||
<td><para style="P3">[[ line['partner'] or '']]</para></td>
|
||||
<td><para style="P3">[[ line['ref'] or '']]</para></td>
|
||||
<td><para style="P3">[[ line['move'] or '']]</para></td>
|
||||
<td><para style="P3">[[ line['name'] or '' ]]</para></td>
|
||||
<td><para style="P4">[[ formatLang(line['debit']) ]]</para></td>
|
||||
<td><para style="P4">[[ formatLang(line['credit']) ]]</para></td>
|
||||
<td><para style="P4">[[ formatLang(line['progress']) ]]</para></td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
</section>
|
||||
|
||||
<blockTable colWidths="72.0,93.0,66.0,40.0,100.0,50.0,50.0,50.0,40.0" style="tbl_header" repeatRows="1">[[data['form']['amount_currency'] == True or removeParentNode('blockTable')]]
|
||||
<tr>
|
||||
<td><para style="date">Date</para></td>
|
||||
<td><para style="P3">Partner</para></td>
|
||||
@@ -155,18 +154,18 @@
|
||||
</tr>
|
||||
</blockTable>
|
||||
<section>
|
||||
<para>[[ repeatIn(get_children_accounts(a,data['form']), 'o') ]]</para>
|
||||
<blockTable rowHeights="0.65cm" colWidths="72.0,93.0,66.0,40.0,100.0,50.0,50.0,50.0,40.0" style="tbl_content">[[ data['form']['amount_currency'] == True or removeParentNode('blockTable') ]]
|
||||
<para>[[repeatIn(get_children_accounts(a,data['form']), 'o')]]</para>
|
||||
<blockTable rowHeights="0.65cm" colWidths="72.0,93.0,66.0,40.0,100.0,50.0,50.0,50.0,40.0" style="tbl_content">[[data['form']['amount_currency'] == True or removeParentNode('blockTable')]]
|
||||
<tr>
|
||||
<td>
|
||||
<blockTable colWidths="264.00,100.0,50.0,50.0,49.0,40.00" style="Table5">
|
||||
<tr>
|
||||
<td><para style="Standard">[[ o.code or '' ]] [[ o.name or '' ]]</para></td>
|
||||
<td><para style="Standard"></para></td>
|
||||
<td alignment="right"><para style="P9b"><u>[[ formatLang(sum_debit_account(o, data['form'])) ]]</u></para></td>
|
||||
<td alignment="right"><para style="P9b"><u>[[formatLang(sum_debit_account(o, data['form'])) ]]</u></para></td>
|
||||
<td alignment="right"><para style="P9b"><u>[[formatLang(sum_credit_account(o, data['form'])) ]]</u></para></td>
|
||||
<td><para style="P9b"><u>[[formatLang(sum_solde_account(o, data['form'])) ]]</u></para></td>
|
||||
<td><para style="P9b"><u> [[ formatLang(sum_currency_amount_account(a, data['form'])) ]]</u></para></td>
|
||||
<td><para style="P9b"><u>[[formatLang(sum_currency_amount_account(a, data['form'])) ]]</u></para></td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
</td>
|
||||
@@ -193,7 +192,4 @@
|
||||
</blockTable>
|
||||
</section>
|
||||
</story>
|
||||
|
||||
|
||||
|
||||
</document>
|
||||
|
||||
@@ -84,7 +84,7 @@
|
||||
<story>
|
||||
<para>[[ repeatIn(objects, 'a') ]]</para>
|
||||
|
||||
<blockTable colWidths="66.0,35.0,150.0, 90.0,60.0,335.0,50.0,69.0,72.0,64.0,58.0" style="tbl_header" repeatRows="1">[[ data['form']['amount_currency'] == True or removeParentNode('blockTable') ]]
|
||||
<blockTable colWidths="66.0,35.0,150.0, 90.0,60.0,335.0,50.0,69.0,72.0,64.0,58.0" style="tbl_header" repeatRows="1">[[data['form']['amount_currency'] == True or removeParentNode('blockTable')]]
|
||||
<tr>
|
||||
<td><para style="P12"><font color="white"> </font></para><para style="date">Date</para></td>
|
||||
<td><para style="P12"><font color="white"> </font></para><para style="P2">JNRL</para></td>
|
||||
@@ -104,7 +104,7 @@
|
||||
|
||||
<para>[[ repeatIn(get_children_accounts(a,data['form']), 'o') ]]</para>
|
||||
|
||||
<blockTable rowHeights="0.65cm" colWidths="66.0,35.0,150.0, 90.0,60.0,335.0,50.0,69.0,72.0,64.0,58.0" style="tbl_content">[[ data['form']['amount_currency'] == True or removeParentNode('blockTable') ]]
|
||||
<blockTable rowHeights="0.65cm" colWidths="66.0,35.0,150.0, 90.0,60.0,335.0,50.0,69.0,72.0,64.0,58.0" style="tbl_content">[[data['form']['amount_currency'] == True or removeParentNode('blockTable')]]
|
||||
<tr>
|
||||
<td>
|
||||
<blockTable colWidths="404.0,375.0,69.0,72.0,64.0,59.00" style="Table5">
|
||||
@@ -165,7 +165,7 @@
|
||||
|
||||
<para>[[ repeatIn(get_children_accounts(a,data['form']), 'o') ]]</para>
|
||||
|
||||
<blockTable rowHeights="0.65cm" colWidths="66.0,35.0,166.0,90.0,60.0,378.0,50.0,69.0,72.0,64.0" style="tbl_content">[[ data['form']['amount_currency'] == False or removeParentNode('blockTable') ]]
|
||||
<blockTable rowHeights="0.65cm" colWidths="66.0,35.0,166.0,90.0,60.0,378.0,50.0,69.0,72.0,64.0" style="tbl_content">[[data['form']['amount_currency'] == False or removeParentNode('blockTable')]]
|
||||
<tr>
|
||||
<td>
|
||||
<blockTable colWidths="405.0,435.0,69.0,72.0,64.0" style="Table5">
|
||||
|
||||
+3
-3
@@ -24,7 +24,7 @@ import time
|
||||
import mx.DateTime
|
||||
import rml_parse
|
||||
from report import report_sxw
|
||||
from account_report_india.report import report_pl
|
||||
from account.report import report_pl
|
||||
|
||||
class report_balancesheet_horizontal(rml_parse.rml_parse):
|
||||
def __init__(self, cr, uid, name, context):
|
||||
@@ -195,9 +195,9 @@ class report_balancesheet_horizontal(rml_parse.rml_parse):
|
||||
return comp_obj.name
|
||||
|
||||
report_sxw.report_sxw('report.account.balancesheet.horizontal', 'account.account',
|
||||
'addons/account_report_india/report/report_balance_sheet_horizontal.rml',parser=report_balancesheet_horizontal,
|
||||
'addons/account/report/report_balance_sheet_horizontal.rml',parser=report_balancesheet_horizontal,
|
||||
header=False)
|
||||
|
||||
report_sxw.report_sxw('report.account.balancesheet', 'account.account',
|
||||
'addons/account_report_india/report/report_balance_sheet.rml',parser=report_balancesheet_horizontal,
|
||||
'addons/account/report/report_balance_sheet.rml',parser=report_balancesheet_horizontal,
|
||||
header=False)
|
||||
+2
-2
@@ -170,8 +170,8 @@ class report_pl_account_horizontal(rml_parse.rml_parse):
|
||||
return comp_obj.name
|
||||
|
||||
report_sxw.report_sxw('report.pl.account.horizontal', 'account.account',
|
||||
'addons/account_report_india/report/report_pl_account_horizontal.rml',parser=report_pl_account_horizontal, header=False)
|
||||
'addons/account/report/report_pl_account_horizontal.rml',parser=report_pl_account_horizontal, header=False)
|
||||
|
||||
report_sxw.report_sxw('report.pl.account', 'account.account',
|
||||
'addons/account_report_india/report/report_pl_account.rml',parser=report_pl_account_horizontal, header=False)
|
||||
'addons/account/report/report_pl_account.rml',parser=report_pl_account_horizontal, header=False)
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import account_common_report
|
||||
|
||||
import account_automatic_reconcile
|
||||
import account_move_line_reconcile_select
|
||||
import account_move_line_unreconcile_select
|
||||
@@ -32,7 +34,8 @@ import account_journal_select
|
||||
import account_move_bank_reconcile
|
||||
import account_subscription_generate
|
||||
import account_aged_trial_balance
|
||||
import account_general_ledger_report
|
||||
#import account_general_ledger_report
|
||||
import account_report_general_ledger
|
||||
import account_third_party_ledger
|
||||
import account_partner_balance_report
|
||||
import account_balance_report
|
||||
@@ -58,6 +61,8 @@ import account_central_journal
|
||||
import account_general_journal
|
||||
import account_change_currency
|
||||
|
||||
import account_bs_report
|
||||
import account_pl_report
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
||||
|
||||
+5
-3
@@ -8,14 +8,16 @@
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Select period">
|
||||
<group width="660" height="480">
|
||||
<field name="company_id"/>
|
||||
<field name="display_account" required = "True"/>
|
||||
<newline/>
|
||||
<field name="fiscalyear"/>
|
||||
<label colspan="2" string="(Keep empty for all open fiscal years)" align="0.0"/>
|
||||
<field name="display_type"/>
|
||||
<newline/>
|
||||
<separator string="Filters" colspan="4"/>
|
||||
<field name="state" required="True"/>
|
||||
<newline/>
|
||||
<group attrs="{'invisible':[('state','=','none')]}" colspan="4">
|
||||
<group attrs="{'invisible':[('state','=','byperiod')]}" colspan="4">
|
||||
<separator string="Date Filter" colspan="4"/>
|
||||
@@ -27,12 +29,12 @@
|
||||
<field name="periods" colspan="4" nolabel="1"/>
|
||||
</group>
|
||||
</group>
|
||||
<separator colspan="4"/>
|
||||
<newline/>
|
||||
<group colspan="4" col="6">
|
||||
<label string ="" colspan="2"/>
|
||||
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
|
||||
<button name="check_state" string="Print" type="object" icon="gtk-print" default_focus="1"/>
|
||||
</group>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
@@ -0,0 +1,127 @@
|
||||
# -*- 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 _
|
||||
import tools
|
||||
|
||||
class account_common_report(osv.osv_memory):
|
||||
_name = "account.common.report"
|
||||
_description = "Common Report"
|
||||
|
||||
_columns = {
|
||||
'chart_account_id': fields.many2one('account.account', 'Chart of account', required=True, domain = [('parent_id','=',False)]),
|
||||
'fiscalyear_id': fields.many2one('account.fiscalyear', 'Fiscal year', help='Keep empty for all open fiscal year'),
|
||||
|
||||
'filter': fields.selection([('filter_no','No filters'), ('filter_date','Date'), ('filter_period','Periods')],"Filter by:", required=True),
|
||||
|
||||
'period_from': fields.many2one('account.period', 'Start period'),
|
||||
'period_to': fields.many2one('account.period', 'End period'),
|
||||
#not used. Do we really need it? 'period_ids': fields.many2many('account.period', 'ledger_period_rel', 'ledger_id', 'period_id', 'Periods'),
|
||||
|
||||
'journal_ids': fields.many2many('account.journal', 'account_common_journal_rel', 'account_id', 'journal_id', 'Journals', required=True),
|
||||
|
||||
'date_from': fields.date("Start date"),
|
||||
'date_to': fields.date("End date"),
|
||||
|
||||
#'display_account': fields.selection([('bal_mouvement','With movements'), ('bal_all','All'), ('bal_solde','With balance is not equal to 0')],"Display accounts"),
|
||||
#'landscape': fields.boolean("Landscape Mode"),
|
||||
#'soldeinit': fields.boolean("Include initial balances"),
|
||||
#'amount_currency': fields.boolean("With Currency"),
|
||||
|
||||
#'filter': fields.boolean("Landscape Mode"),
|
||||
#'state': fields.selection([('bydate','By Date'), ('byperiod','By Period'), ('all','By Date and Period'), ('none','No Filter')],"Date/Period Filter"),
|
||||
#'company_id': fields.many2one('res.company', 'Company', required=True),
|
||||
}
|
||||
|
||||
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:
|
||||
context = {}
|
||||
user = user_obj.browse(cr, uid, uid, context=context)
|
||||
if user.company_id:
|
||||
return user.company_id.id
|
||||
else:
|
||||
return company_obj.search(cr, uid, [('parent_id', '=', False)])[0]
|
||||
|
||||
def _get_account(self, cr, uid, context=None):
|
||||
tmp = self.pool.get('account.account').search(cr, uid, [], limit=1 )
|
||||
if not tmp:
|
||||
return False
|
||||
return tmp[0]
|
||||
|
||||
def _get_fiscalyear(self, cr, uid, context=None):
|
||||
now = time.strftime('%Y-%m-%d')
|
||||
tmp = self.pool.get('account.fiscalyear').search(cr, uid, [('date_start', '<', now), ('date_stop', '>', now)], limit=1 )
|
||||
if not tmp:
|
||||
return False
|
||||
return tmp[0]
|
||||
|
||||
def _get_all_journal(self, cr, uid, context=None):
|
||||
return self.pool.get('account.journal').search(cr, uid ,[])
|
||||
|
||||
_defaults = {
|
||||
# 'state' : 'none',
|
||||
'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',
|
||||
'fiscalyear_id' : _get_fiscalyear,
|
||||
# 'landscape': True,
|
||||
# 'amount_currency' : True,
|
||||
'journal_ids': _get_all_journal,
|
||||
'filter': 'filter_no',
|
||||
'chart_account_id': _get_account,
|
||||
}
|
||||
|
||||
def _build_context(self, cr, uid, ids, data, context = None):
|
||||
result = {}
|
||||
result['fiscalyear'] = data['form']['fiscalyear_id'] and data['form']['fiscalyear_id'] or False
|
||||
if data['form']['filter'] == 'filter_date':
|
||||
result['date_from'] = data['form']['date_from']
|
||||
result['date_to'] = data['form']['date_to']
|
||||
elif data['form']['filter'] == 'filter_period':
|
||||
period_date_start = period_obj.read(cr, uid, data['form']['period_from'], ['date_start'])[0]['date_start']
|
||||
period_date_stop = period_obj.read(cr, uid, data['form']['period_to'], ['date_stop'])[0]['date_stop']
|
||||
cr.execute('SELECT id FROM account_period WHERE date_start >= %s AND date_stop <= %s', (period_date_start, period_date_stop))
|
||||
result['periods'] = lambda x: x[0], cr.fetchall()
|
||||
return result
|
||||
|
||||
def _print_report(self, cr, uid, ids, data, query_line, context):
|
||||
raise (_('Error'), _('not implemented'))
|
||||
|
||||
def check_report(self, cr, uid, ids, context=None):
|
||||
obj_acc_move_line = self.pool.get('account.move.line')
|
||||
data = {}
|
||||
data['ids'] = context.get('active_ids',[])
|
||||
data['model'] = context.get('active_model', 'ir.ui.menu')
|
||||
data['form'] = self.read(cr, uid, ids, ['date_from', 'date_to', 'fiscalyear_id', 'journal_ids', 'period_from', 'period_to', 'filter', 'chart_account_id'])[0]
|
||||
used_context = self._build_context(cr, uid, ids, data, context)
|
||||
query_line = obj_acc_move_line._query_get(cr, uid,
|
||||
obj='l', context=used_context)
|
||||
return self._print_report(cr, uid, ids, data, query_line, context)
|
||||
account_common_report()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record id="account_common_report_view" model="ir.ui.view">
|
||||
<field name="name">Common Report</field>
|
||||
<field name="model">account.common.report</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Select Date-Period">
|
||||
|
||||
<group colspan="4" col="6">
|
||||
<field name="chart_account_id" colspan="2" widget='selection'/>
|
||||
<field name="fiscalyear_id"/>
|
||||
<field name="filter"/>
|
||||
</group>
|
||||
|
||||
<notebook tabpos="up" colspan="6">
|
||||
<page string="Journals">
|
||||
<field name="journal_ids" colspan="4" nolabel="1"/>
|
||||
</page>
|
||||
<page string="Periods" attrs="{'invisible':[('filter','!=','filter_period')]}">
|
||||
<field name="period_from"/>
|
||||
<field name="period_to"/>
|
||||
</page>
|
||||
<page string="Date" attrs="{'invisible':[('filter','!=','filter_date')]}">
|
||||
<field name="date_from"/>
|
||||
<field name="date_to"/>
|
||||
</page>
|
||||
</notebook>
|
||||
|
||||
<!--
|
||||
<group colspan="4" col="4" attrs="{'invisible':[('state','!=','bydate')]}">
|
||||
<group colspan="2" col="4">
|
||||
</group>
|
||||
<group colspan="2" col="4">
|
||||
<separator string="Periods" colspan="4"/>
|
||||
<field name="state" required="True" colspan="2"/>
|
||||
<newline/>
|
||||
<group attrs="{'invisible':[('state','!=','bydate')]}" colspan="4">
|
||||
</group>
|
||||
<group attrs="{'invisible':[('state','!=','byperiod')]}" colspan="4">
|
||||
</group>
|
||||
</group>
|
||||
<group colspan="2" >
|
||||
</group>
|
||||
</group>
|
||||
|
||||
<separator string="" colspan="4"/>
|
||||
|
||||
<label string="" colspan="2"/>
|
||||
|
||||
<newline/>
|
||||
<field name="sortbydate" required="True"/>
|
||||
<field name="display_account" required="True"/>
|
||||
<field name="soldeinit" invisible="1"/>
|
||||
<field name="landscape"/>
|
||||
<field name="amount_currency"/>
|
||||
<newline/>
|
||||
-->
|
||||
<group colspan="4" col="6">
|
||||
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
|
||||
<button icon="gtk-print" name="check_report" string="Print" type="object"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_account_common_menu" model="ir.actions.act_window">
|
||||
<field name="name">Common report</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">account.common.report</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="account_common_report_view"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<menuitem icon="STOCK_PRINT" name="Common report" parent="account.menu_generic_report" action="action_account_common_menu" id="menu_account_common"/>
|
||||
|
||||
<!--
|
||||
<record id="action_account_general_ledger_report" model="ir.actions.act_window">
|
||||
<field name="name">General Ledger</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">account.general.ledger.report</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="account_general_ledger_report_view"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.values" id="account_general_ledger_report_values">
|
||||
<field name="model_id" ref="account.model_account_account" />
|
||||
<field name="object" eval="1" />
|
||||
<field name="name">Account General Ledger</field>
|
||||
<field name="key2">client_print_multi</field>
|
||||
<field name="value" eval="'ir.actions.act_window,' + str(ref('action_account_general_ledger_report'))" />
|
||||
<field name="key">action</field>
|
||||
<field name="model">account.account</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="action_account_general_ledger_menu" model="ir.actions.act_window">
|
||||
<field name="name">Select Chart</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">account.general.ledger.report</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="account_general_ledger_report_view1"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
-->
|
||||
|
||||
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -0,0 +1,89 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="account_pl_report_view" model="ir.ui.view">
|
||||
<field name="name">Select period</field>
|
||||
<field name="model">account.pl.report</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Select period">
|
||||
<field name="company_id"/>
|
||||
<field name="display_account" required = "True"/>
|
||||
<newline/>
|
||||
<field name="fiscalyear"/>
|
||||
<label colspan="2" string="(Keep empty for all open fiscal years)" align="0.0"/>
|
||||
<field name="display_type"/>
|
||||
<newline/>
|
||||
<separator string="Filters" colspan="4"/>
|
||||
<field name="state" required="True"/>
|
||||
<newline/>
|
||||
<group attrs="{'invisible':[('state','=','none')]}" colspan="4">
|
||||
<group attrs="{'invisible':[('state','=','byperiod')]}" colspan="4">
|
||||
<separator string="Date Filter" colspan="4"/>
|
||||
<field name="date_from"/>
|
||||
<field name="date_to"/>
|
||||
</group>
|
||||
<group attrs="{'invisible':[('state','=','bydate')]}" colspan="4">
|
||||
<separator string="Filter on Periods" colspan="4"/>
|
||||
<field name="periods" colspan="4" nolabel="1"/>
|
||||
</group>
|
||||
</group>
|
||||
<newline/>
|
||||
<group colspan="4" col="6">
|
||||
<label string ="" colspan="2"/>
|
||||
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
|
||||
<button name="check_state" string="Print" type="object" icon="gtk-print" default_focus="1"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_account_pl_report" model="ir.actions.act_window">
|
||||
<field name="name">Account Profit And Loss</field>
|
||||
<field name="res_model">account.pl.report</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="account_pl_report_view"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<record id="account_pl_report_account_view" model="ir.ui.view">
|
||||
<field name="name">Account Chart</field>
|
||||
<field name="model">account.pl.report</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Select Chart">
|
||||
<field name="Account_list"/>
|
||||
<separator colspan="4"/>
|
||||
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
|
||||
<button name="next_view" string="Next" type="object" icon="gtk-go-forward" default_focus="1"/>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_pl_balance_account_report" model="ir.actions.act_window">
|
||||
<field name="name">Select Account</field>
|
||||
<field name="res_model">account.pl.report</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_pl_report_account_view"/>
|
||||
<field name="context">{'record_id':active_id}</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<menuitem
|
||||
parent="account.menu_finance_legal_statement"
|
||||
id="final_accounting_reports"
|
||||
name="Accounting Reports"/>
|
||||
|
||||
<menuitem icon="STOCK_PRINT"
|
||||
name="Profit And Loss"
|
||||
action="action_pl_balance_account_report"
|
||||
id="menu_account_pl_report"
|
||||
parent="final_accounting_reports"/>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -0,0 +1,58 @@
|
||||
# -*- 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 _
|
||||
import tools
|
||||
|
||||
class account_report_general_ledger(osv.osv_memory):
|
||||
_inherit = "account.common.report"
|
||||
_name = "account.report.general.ledger"
|
||||
_description = "General Ledger Report"
|
||||
|
||||
_columns = {
|
||||
'display_account': fields.selection([('bal_mouvement','With movements'), ('bal_all','All'), ('bal_solde','With balance is not equal to 0')],"Display accounts"),
|
||||
'landscape': fields.boolean("Landscape Mode"),
|
||||
'soldeinit': fields.boolean("Include initial balances"),
|
||||
'amount_currency': fields.boolean("With Currency"),
|
||||
'sortby': fields.selection([('sort_date', 'Date'), ('sort_journal_partner', 'Journal & Partner')], 'Sort By'),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'display_account' : 'bal_all',
|
||||
'landscape': True,
|
||||
'amount_currency' : True,
|
||||
'sortby': 'sort_date',
|
||||
}
|
||||
|
||||
def _print_report(self, cr, uid, ids, data, query_line, context=None):
|
||||
data['form'].update(self.read(cr, uid, ids, ['display_account', 'landscape', 'soldeinit', 'amount_currency', 'sortby'])[0])
|
||||
data['form']['query_get'] = query_line
|
||||
if data['form']['landscape'] == True:
|
||||
return { '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_report_general_ledger()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -0,0 +1,60 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="account_report_general_ledger_view" model="ir.ui.view">
|
||||
<field name="name">General Ledger</field>
|
||||
<field name="model">account.report.general.ledger</field>
|
||||
<field name="type">form</field>
|
||||
<field name="inherit_id" ref="account_common_report_view" />
|
||||
<field name="arch" type="xml">
|
||||
<field name="journal_ids" position="after">
|
||||
<field name="display_account"/>
|
||||
<field name="landscape"/>
|
||||
<field name="soldeinit"/>
|
||||
<field name="amount_currency"/>
|
||||
<field name="sortby"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- <record id="action_account_report_general_ledger" model="ir.actions.act_window">
|
||||
<field name="name">General Ledger</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">account.report.general.ledger</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="account_report_general_ledger_view"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.values" id="account_report_general_ledger_values">
|
||||
<field name="model_id" ref="account.model_account_account" />
|
||||
<field name="object" eval="1" />
|
||||
<field name="name">Account General Ledger</field>
|
||||
<field name="key2">client_print_multi</field>
|
||||
<field name="value" eval="'ir.actions.act_window,' + str(ref('action_account_report_general_ledger'))" />
|
||||
<field name="key">action</field>
|
||||
<field name="model">account.account</field>
|
||||
</record>
|
||||
-->
|
||||
<record id="action_account_general_ledger_menu" model="ir.actions.act_window">
|
||||
<field name="name">Account General Ledger</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">account.report.general.ledger</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="account_report_general_ledger_view"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<menuitem
|
||||
icon="STOCK_PRINT"
|
||||
name="General Ledger"
|
||||
parent="account.menu_generic_report"
|
||||
action="action_account_general_ledger_menu"
|
||||
id="menu_general_ledger"
|
||||
/>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -2,37 +2,37 @@
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="view_account_subscription_generate" model="ir.ui.view">
|
||||
<record id="view_account_subscription_generate" model="ir.ui.view">
|
||||
<field name="name">account.subscription.generate.form</field>
|
||||
<field name="model">account.subscription.generate</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Subscription Compute">
|
||||
<group colspan="4" >
|
||||
<separator string="Generate entries before:" colspan="4"/>
|
||||
<field name="date"/>
|
||||
<group colspan="4" >
|
||||
<separator string="Generate entries before:" colspan="4"/>
|
||||
<field name="date"/>
|
||||
</group>
|
||||
<separator string="" colspan="4" />
|
||||
<separator string="" colspan="4" />
|
||||
<group colspan="4" col="6">
|
||||
<label string ="" colspan="2"/>
|
||||
<button icon="gtk-cancel" special="cancel" string="Cancel" />
|
||||
<button icon="gtk-execute" string="Compute Entry Dates"
|
||||
name="action_generate" type="object" />
|
||||
<label string ="" colspan="2"/>
|
||||
<button icon="gtk-cancel" special="cancel" string="Cancel" />
|
||||
<button icon="gtk-execute" string="Compute Entry Dates"
|
||||
name="action_generate" type="object" />
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
</record>
|
||||
|
||||
<record id="action_account_subscription_generate" model="ir.actions.act_window">
|
||||
<field name="name">Create Subscription Entries</field>
|
||||
<field name="name">Automatic Recurring</field>
|
||||
<field name="res_model">account.subscription.generate</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="view_account_subscription_generate"/>
|
||||
<field name="target">new</field>
|
||||
<field name="view_id" ref="view_account_subscription_generate"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<menuitem action="action_account_subscription_generate" id="menu_generate_subscription" parent="menu_finance_periodical_processing" />
|
||||
<menuitem action="action_account_subscription_generate" id="menu_generate_subscription" parent="account.menu_finance_recurrent_entries" />
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -2,89 +2,88 @@
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="view_account_use_model" model="ir.ui.view">
|
||||
<record id="view_account_use_model" model="ir.ui.view">
|
||||
<field name="name">account.use.model.form</field>
|
||||
<field name="model">account.use.model</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Create Entries From Models">
|
||||
<group height="250" width="470">
|
||||
<separator string="This wizard will create entries from Models" colspan="4"/>
|
||||
<separator string="Account Models" colspan="4"/>
|
||||
<field name="model" nolabel="1"/>
|
||||
<separator colspan="4"/>
|
||||
<group colspan="4" col="2">
|
||||
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
|
||||
<button icon="gtk-execute" string="Create Entries" name="create_entries" type="object"/>
|
||||
</group>
|
||||
</group>
|
||||
</form>
|
||||
<form string="Create Entries From Models">
|
||||
<group height="240" width="510">
|
||||
<separator string="This wizard will create recurring accounting entries" colspan="4"/>
|
||||
<field name="model"/>
|
||||
<separator colspan="4"/>
|
||||
<group colspan="4" col="2">
|
||||
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
|
||||
<button icon="gtk-execute" string="Create Entries" name="create_entries" type="object"/>
|
||||
</group>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_view_account_use_model" model="ir.actions.act_window">
|
||||
<field name="name">Create Entries From Models</field>
|
||||
<record id="action_view_account_use_model" model="ir.actions.act_window">
|
||||
<field name="name">Manual Recurring</field>
|
||||
<field name="res_model">account.use.model</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="view_account_use_model"/>
|
||||
<field name="target">new</field>
|
||||
<field name="context">{'model_line':'model_line'}</field>
|
||||
<field name="view_id" ref="view_account_use_model"/>
|
||||
<field name="target">new</field>
|
||||
<field name="context">{'model_line':'model_line'}</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.values" id="action_account_use_model_values">
|
||||
<field name="model_id" ref="account.model_account_move_line" />
|
||||
<field name="object" eval="1" />
|
||||
<field name="name">Create Entries From Models</field>
|
||||
<field name="name">Manual Recurring</field>
|
||||
<field name="key2">client_action_multi</field>
|
||||
<field name="value" eval="'ir.actions.act_window,' +str(ref('action_view_account_use_model'))" />
|
||||
<field name="key">action</field>
|
||||
<field name="model">account.move.line</field>
|
||||
</record>
|
||||
</record>
|
||||
|
||||
<menuitem action="action_view_account_use_model" name="Create Entries From Models"
|
||||
parent="account.menu_finance_recurrent_entries" id="menu_account_use_model"/>
|
||||
<menuitem action="action_view_account_use_model"
|
||||
parent="account.menu_finance_recurrent_entries" id="menu_account_use_model"/>
|
||||
|
||||
<record id="view_account_use_model_open_entry" model="ir.ui.view">
|
||||
<record id="view_account_use_model_open_entry" model="ir.ui.view">
|
||||
<field name="name">account.use.model.open.entry.form</field>
|
||||
<field name="model">account.use.model</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Use Model">
|
||||
<group colspan="4" col="6">
|
||||
<label string = "Entry Lines Created." colspan="2"/>
|
||||
<newline/>
|
||||
<button icon="gtk-ok" special="cancel" string="Ok"/>
|
||||
<button icon="terp-gtk-go-back-rtl" string="Open" name="open_moves" type="object" default_focus='1'/>
|
||||
<group colspan="4" col="6">
|
||||
<label string = "Entry Lines Created." colspan="2"/>
|
||||
<newline/>
|
||||
<button icon="gtk-ok" special="cancel" string="Ok"/>
|
||||
<button icon="terp-gtk-go-back-rtl" string="Open" name="open_moves" type="object" default_focus='1'/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_account_use_model_create_entry" model="ir.ui.view">
|
||||
<record id="view_account_use_model_create_entry" model="ir.ui.view">
|
||||
<field name="name">account.use.model.create.entry.form</field>
|
||||
<field name="model">account.use.model</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Use Model">
|
||||
<group colspan="4" col="6">
|
||||
<label string = "Are you sure you want to create entries?" colspan="2"/>
|
||||
<newline/>
|
||||
<button icon="terp-gtk-stop" special="cancel" string="Cancel"/>
|
||||
<button icon="gtk-execute" string="Ok" name="create_entries" type="object" default_focus='1'/>
|
||||
<group colspan="4" col="6">
|
||||
<label string = "Are you sure you want to create entries?" colspan="2"/>
|
||||
<newline/>
|
||||
<button icon="terp-gtk-stop" special="cancel" string="Cancel"/>
|
||||
<button icon="gtk-execute" string="Ok" name="create_entries" type="object" default_focus='1'/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_account_use_model_create_entry" model="ir.actions.act_window">
|
||||
<field name="name">Create Entries From Models</field>
|
||||
<record id="action_account_use_model_create_entry" model="ir.actions.act_window">
|
||||
<field name="name">Manual Recurring</field>
|
||||
<field name="res_model">account.use.model</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="view_account_use_model_create_entry"/>
|
||||
<field name="target">new</field>
|
||||
<field name="view_id" ref="view_account_use_model_create_entry"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -2,23 +2,22 @@
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<!--Account Moves-->
|
||||
<!--Account Moves-->
|
||||
<record id="validate_account_move_view" model="ir.ui.view">
|
||||
<field name="name">Validate Account Move</field>
|
||||
<field name="model">validate.account.move</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Validate Account Entries">
|
||||
<separator string="Select Period and Journal for Validation" colspan="4"/>
|
||||
<field name="journal_id"/>
|
||||
<newline/>
|
||||
<field name="period_id"/>
|
||||
<separator string="Information" colspan="4"/>
|
||||
<label string="All draft account entries in this journal and period will be validated. It means you won't be able to modify their accouting fields." colspan="4"/>
|
||||
<group colspan="4" col="6">
|
||||
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
|
||||
<button icon="terp-camera_test" string="Validate" name="validate_move" type="object"/>
|
||||
</group>
|
||||
<form string="Validate Account Entries">
|
||||
<separator string="Validate Journal Entries of a Journal" colspan="4"/>
|
||||
<label string="All draft account entries in this journal and period will be validated. It means you won't be able to modify their accouting fields." colspan="4"/>
|
||||
<field name="journal_id"/>
|
||||
<newline/>
|
||||
<field name="period_id"/>
|
||||
<group colspan="4" col="6">
|
||||
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
|
||||
<button icon="terp-camera_test" string="Validate" name="validate_move" type="object"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
@@ -33,38 +32,38 @@
|
||||
</record>
|
||||
|
||||
<menuitem
|
||||
name="Validate Ledger Postings"
|
||||
parent="periodical_processing_journal_entries_validation"
|
||||
action="action_validate_account_move"
|
||||
id="menu_validate_account_moves"
|
||||
/>
|
||||
name="Validate Ledger Postings"
|
||||
parent="periodical_processing_journal_entries_validation"
|
||||
action="action_validate_account_move"
|
||||
id="menu_validate_account_moves"
|
||||
/>
|
||||
|
||||
<!--Account Move lines-->
|
||||
<record id="validate_account_move_line_view" model="ir.ui.view">
|
||||
<record id="validate_account_move_line_view" model="ir.ui.view">
|
||||
<field name="name">Validate Ledger Postings</field>
|
||||
<field name="model">validate.account.move.lines</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Validate Moves">
|
||||
<separator string="Validate Ledger Postings" colspan="4"/>
|
||||
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
|
||||
<button name="validate_move_lines" string="Validate" type="object" icon="gtk-go-forward" default_focus="1"/>
|
||||
</form>
|
||||
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
|
||||
<button name="validate_move_lines" string="Validate" type="object" icon="gtk-go-forward" default_focus="1"/>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
</record>
|
||||
|
||||
<record id="action_validate_account_move_line" model="ir.actions.act_window">
|
||||
<record id="action_validate_account_move_line" model="ir.actions.act_window">
|
||||
<field name="name">Validate Ledger Postings</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">validate.account.move.lines</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="validate_account_move_line_view"/>
|
||||
<field name="context">{'record_id' : active_id}</field>
|
||||
<field name="context">{'record_id' : active_id}</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
</record>
|
||||
|
||||
<record model="ir.values" id="validate_account_move_line_values">
|
||||
<record model="ir.values" id="validate_account_move_line_values">
|
||||
<field name="model_id" ref="account.model_account_move_line" />
|
||||
<field name="object" eval="1" />
|
||||
<field name="name">Validate Ledger Postings</field>
|
||||
|
||||
@@ -271,7 +271,7 @@ class account_followup_print_all(osv.osv_memory):
|
||||
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]:
|
||||
if to_update[id]['partner_id'] in data['partner_ids']:
|
||||
cr.execute(
|
||||
"UPDATE account_move_line "\
|
||||
"SET followup_line_id=%s, followup_date=%s "\
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
|
||||
import report
|
||||
import wizard
|
||||
@@ -1,3 +0,0 @@
|
||||
|
||||
import report_bs
|
||||
import report_pl
|
||||
@@ -1,165 +0,0 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 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 report import report_sxw
|
||||
import xml.dom.minidom
|
||||
import os, time
|
||||
import osv
|
||||
import re
|
||||
import tools
|
||||
import pooler
|
||||
import re
|
||||
import sys
|
||||
|
||||
|
||||
class rml_parse(report_sxw.rml_parse):
|
||||
def __init__(self, cr, uid, name, context):
|
||||
super(rml_parse, self).__init__(cr, uid, name, context=None)
|
||||
self.localcontext.update({
|
||||
'comma_me': self.comma_me,
|
||||
'format_date': self._get_and_change_date_format_for_swiss,
|
||||
'strip_name' : self._strip_name,
|
||||
'explode_name' : self._explode_name,
|
||||
})
|
||||
|
||||
def comma_me(self,amount):
|
||||
#print "#" + str(amount) + "#"
|
||||
if not amount:
|
||||
amount = 0.0
|
||||
if type(amount) is float :
|
||||
amount = str('%.2f'%amount)
|
||||
else :
|
||||
amount = str(amount)
|
||||
if (amount == '0'):
|
||||
return ' '
|
||||
orig = amount
|
||||
new = re.sub("^(-?\d+)(\d{3})", "\g<1>'\g<2>", amount)
|
||||
if orig == new:
|
||||
return new
|
||||
else:
|
||||
return self.comma_me(new)
|
||||
|
||||
def _ellipsis(self, string, maxlen=100, ellipsis = '...'):
|
||||
ellipsis = ellipsis or ''
|
||||
try:
|
||||
return string[:maxlen - len(ellipsis) ] + (ellipsis, '')[len(string) < maxlen]
|
||||
except Exception, e:
|
||||
return False
|
||||
|
||||
def _strip_name(self, name, maxlen=50):
|
||||
return self._ellipsis(name, maxlen, '...')
|
||||
|
||||
def _get_and_change_date_format_for_swiss (self,date_to_format):
|
||||
date_formatted=''
|
||||
if date_to_format:
|
||||
date_formatted = strptime (date_to_format,'%Y-%m-%d').strftime('%d.%m.%Y')
|
||||
return date_formatted
|
||||
|
||||
def _explode_name(self,chaine,length):
|
||||
# We will test if the size is less then account
|
||||
full_string = ''
|
||||
if (len(str(chaine)) <= length):
|
||||
return chaine
|
||||
#
|
||||
else:
|
||||
chaine = unicode(chaine,'utf8').encode('iso-8859-1')
|
||||
rup = 0
|
||||
for carac in chaine:
|
||||
rup = rup + 1
|
||||
if rup == length:
|
||||
full_string = full_string + '\n'
|
||||
full_string = full_string + carac
|
||||
rup = 0
|
||||
else:
|
||||
full_string = full_string + carac
|
||||
|
||||
return full_string
|
||||
|
||||
def makeAscii(self,str):
|
||||
try:
|
||||
Stringer = str.encode("utf-8")
|
||||
except UnicodeDecodeError:
|
||||
try:
|
||||
Stringer = str.encode("utf-16")
|
||||
except UnicodeDecodeError:
|
||||
print "UTF_16 Error"
|
||||
Stringer = str
|
||||
else:
|
||||
return Stringer
|
||||
else:
|
||||
return Stringer
|
||||
return Stringer
|
||||
|
||||
def explode_this(self,chaine,length):
|
||||
#chaine = self.repair_string(chaine)
|
||||
chaine = rstrip(chaine)
|
||||
ast = list(chaine)
|
||||
i = length
|
||||
while i <= len(ast):
|
||||
ast.insert(i,'\n')
|
||||
i = i + length
|
||||
chaine = str("".join(ast))
|
||||
return chaine
|
||||
|
||||
def repair_string(self,chaine):
|
||||
ast = list(chaine)
|
||||
UnicodeAst = []
|
||||
_previouslyfound = False
|
||||
i = 0
|
||||
#print str(ast)
|
||||
while i < len(ast):
|
||||
elem = ast[i]
|
||||
try:
|
||||
Stringer = elem.encode("utf-8")
|
||||
except UnicodeDecodeError:
|
||||
to_reencode = elem + ast[i+1]
|
||||
print str(to_reencode)
|
||||
Good_char = to_reencode.decode('utf-8')
|
||||
UnicodeAst.append(Good_char)
|
||||
i += i +2
|
||||
else:
|
||||
UnicodeAst.append(elem)
|
||||
i += i + 1
|
||||
return "".join(UnicodeAst)
|
||||
|
||||
def ReencodeAscii(self,str):
|
||||
print sys.stdin.encoding
|
||||
try:
|
||||
Stringer = str.decode("ascii")
|
||||
except UnicodeEncodeError:
|
||||
print "REENCODING ERROR"
|
||||
return str.encode("ascii")
|
||||
except UnicodeDecodeError:
|
||||
print "DECODING ERROR"
|
||||
return str.encode("ascii")
|
||||
else:
|
||||
print Stringer
|
||||
return Stringer
|
||||
|
||||
def _add_header(self, node, header=1):
|
||||
if header==2:
|
||||
rml_head = self.rml_header2
|
||||
else:
|
||||
rml_head = self.rml_header
|
||||
rml_head = rml_head.replace('<pageGraphics>','''<pageGraphics> <image x="10" y="26cm" height="770.0" width="1120.0" >[[company.logo]] </image> ''')
|
||||
return True
|
||||
|
||||
|
||||
|
||||
@@ -1,87 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="account_pl_report_view" model="ir.ui.view">
|
||||
<field name="name">Select period</field>
|
||||
<field name="model">account.pl.report</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Select period">
|
||||
<group width="660" height="480">
|
||||
<field name="company_id"/>
|
||||
<field name="display_account" required = "True"/>
|
||||
<field name="fiscalyear"/>
|
||||
<label colspan="2" string="(Keep empty for all open fiscal years)" align="0.0"/>
|
||||
<field name="display_type"/>
|
||||
<separator string="Filters" colspan="4"/>
|
||||
<field name="state" required="True"/>
|
||||
<group attrs="{'invisible':[('state','=','none')]}" colspan="4">
|
||||
<group attrs="{'invisible':[('state','=','byperiod')]}" colspan="4">
|
||||
<separator string="Date Filter" colspan="4"/>
|
||||
<field name="date_from"/>
|
||||
<field name="date_to"/>
|
||||
</group>
|
||||
<group attrs="{'invisible':[('state','=','bydate')]}" colspan="4">
|
||||
<separator string="Filter on Periods" colspan="4"/>
|
||||
<field name="periods" colspan="4" nolabel="1"/>
|
||||
</group>
|
||||
</group>
|
||||
<separator colspan="4"/>
|
||||
<group colspan="4" col="6">
|
||||
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
|
||||
<button name="check_state" string="Print" type="object" icon="gtk-print" default_focus="1"/>
|
||||
</group>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_account_pl_report" model="ir.actions.act_window">
|
||||
<field name="name">Account Profit And Loss</field>
|
||||
<field name="res_model">account.pl.report</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="account_pl_report_view"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<record id="account_pl_report_account_view" model="ir.ui.view">
|
||||
<field name="name">Account Chart</field>
|
||||
<field name="model">account.pl.report</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Select Chart">
|
||||
<field name="Account_list"/>
|
||||
<separator colspan="4"/>
|
||||
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
|
||||
<button name="next_view" string="Next" type="object" icon="gtk-go-forward" default_focus="1"/>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_pl_balance_account_report" model="ir.actions.act_window">
|
||||
<field name="name">Select Account</field>
|
||||
<field name="res_model">account.pl.report</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_pl_report_account_view"/>
|
||||
<field name="context">{'record_id':active_id}</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<menuitem
|
||||
parent="account.menu_finance_legal_statement"
|
||||
id="final_accounting_reports"
|
||||
name="Accounting Reports"/>
|
||||
|
||||
<menuitem icon="STOCK_PRINT"
|
||||
name="Profit And Loss"
|
||||
action="action_pl_balance_account_report"
|
||||
id="menu_account_pl_report"
|
||||
parent="final_accounting_reports"/>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -27,5 +27,6 @@ import directory_content
|
||||
import directory_report
|
||||
import document
|
||||
import report
|
||||
import wizard
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
'update_xml': [
|
||||
'document_view.xml',
|
||||
'document_data.xml',
|
||||
'wizard/document_configuration_view.xml',
|
||||
'security/document_security.xml',
|
||||
'security/ir.model.access.csv',
|
||||
'report/document_report_view.xml',
|
||||
|
||||
@@ -112,7 +112,7 @@ class document_directory(osv.osv):
|
||||
while d2 and d2.parent_id:
|
||||
s = d2.name + (s and ('/' + s) or '')
|
||||
d2 = d2.parent_id
|
||||
res.append((d.id, s))
|
||||
res.append((d.id, s or d.name))
|
||||
return res
|
||||
|
||||
def get_full_path(self, cr, uid, dir_id, context=None):
|
||||
|
||||
@@ -193,10 +193,7 @@
|
||||
<group col="2" colspan="2" attrs="{'invisible':[('type','=','binary')]}">
|
||||
<field name="url" widget="url"/>
|
||||
</group>
|
||||
|
||||
</group>
|
||||
|
||||
|
||||
<group col="2" colspan="2">
|
||||
<separator string="Relation" colspan="2"/>
|
||||
<field name="res_name" readonly="1"/>
|
||||
@@ -219,7 +216,9 @@
|
||||
<page string="Security">
|
||||
<field name="group_ids" colspan="4" nolabel="1"/>
|
||||
</page>
|
||||
|
||||
<page string="Indexed Content" groups="base.group_extended">
|
||||
<field name="index_content" colspan="4" nolabel="1"/>
|
||||
</page>
|
||||
<page string="Notes">
|
||||
<field colspan="4" name="description" nolabel="1"/>
|
||||
</page>
|
||||
|
||||
@@ -19,3 +19,5 @@
|
||||
"access_report_document_file_group_system","report.document.file group system","model_report_document_file","base.group_system",1,0,0,0
|
||||
"access_report_document_wall_group_document_manager","report.document.wall document manager","model_report_document_wall","document.group_document_manager",1,0,0,0
|
||||
"access_report_document_wall_group_system","report.document.wall group system","model_report_document_wall","base.group_system",1,0,0,0
|
||||
"access_document_configuation","document.configuration document manager","model_document_configuration","document.group_document_manager",1,1,1,1
|
||||
"access_document_configuation_system","document.configuration group system","model_document_configuration","base.group_system",1,1,1,1
|
||||
|
||||
|
@@ -19,10 +19,11 @@
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from content_index import indexer, cntIndex
|
||||
from subprocess import Popen, PIPE
|
||||
import StringIO
|
||||
import odt2txt
|
||||
from subprocess import Popen, PIPE
|
||||
from content_index import indexer, cntIndex
|
||||
import sys, zipfile, xml.dom.minidom
|
||||
|
||||
def _to_unicode(s):
|
||||
try:
|
||||
@@ -36,6 +37,15 @@ def _to_unicode(s):
|
||||
except UnicodeError:
|
||||
return s
|
||||
|
||||
def textToString(element) :
|
||||
buffer = u""
|
||||
for node in element.childNodes :
|
||||
if node.nodeType == xml.dom.Node.TEXT_NODE :
|
||||
buffer += node.nodeValue
|
||||
elif node.nodeType == xml.dom.Node.ELEMENT_NODE :
|
||||
buffer += textToString(node)
|
||||
return buffer
|
||||
|
||||
class TxtIndex(indexer):
|
||||
def _getMimeTypes(self):
|
||||
return ['text/plain','text/html','text/diff','text/xml', 'text/*',
|
||||
@@ -44,7 +54,7 @@ class TxtIndex(indexer):
|
||||
def _getExtensions(self):
|
||||
return ['.txt', '.py']
|
||||
|
||||
def _doIndexContent(self, content):
|
||||
def _doIndexContent(self,content):
|
||||
return content
|
||||
|
||||
cntIndex.register(TxtIndex())
|
||||
@@ -56,15 +66,24 @@ class PptxIndex(indexer):
|
||||
def _getExtensions(self):
|
||||
return ['.pptx']
|
||||
|
||||
def _doIndexFile(self, fname):
|
||||
# pptx2txt.pl package not support in windows platform.
|
||||
# Download pptx2txt package from http://sourceforge.net/projects/pptx2txt/" link.
|
||||
# To install this tool, just copy pptx2txt.pl to appropriate place (e.g. /usr/bin directory)
|
||||
fp = Popen(['pptx2txt.pl', fname], shell=False, stdout=PIPE).stdout
|
||||
fp.read()
|
||||
file_obj = open(str(fname + ".txt"), "r")
|
||||
data = file_obj.read()
|
||||
return _to_unicode(data)
|
||||
def _doIndexFile(self,fname):
|
||||
def toString () :
|
||||
""" Converts the document to a string. """
|
||||
buffer = u""
|
||||
for val in ["a:t"]:
|
||||
for paragraph in content.getElementsByTagName(val) :
|
||||
buffer += textToString(paragraph) + "\n"
|
||||
return buffer
|
||||
|
||||
data = []
|
||||
zip = zipfile.ZipFile(fname)
|
||||
files = filter(lambda x: x.startswith('ppt/slides/slide'), zip.namelist())
|
||||
for i in range(1, len(files) + 1):
|
||||
content = xml.dom.minidom.parseString(zip.read('ppt/slides/slide%s.xml' % str(i)))
|
||||
res = toString().encode('ascii','replace')
|
||||
data.append(res)
|
||||
|
||||
return _to_unicode('\n'.join(data))
|
||||
|
||||
cntIndex.register(PptxIndex())
|
||||
|
||||
@@ -76,33 +95,60 @@ class DocIndex(indexer):
|
||||
return ['.doc']
|
||||
|
||||
def _doIndexFile(self,fname):
|
||||
fp = Popen(['antiword', fname], shell=False, stdout=PIPE).stdout
|
||||
return _to_unicode( fp.read())
|
||||
#fp = Popen(['antiword', fname], shell=False, stdout=PIPE).stdout
|
||||
return _to_unicode( 'None')
|
||||
|
||||
cntIndex.register(DocIndex())
|
||||
|
||||
class DocxIndex(indexer):
|
||||
def _getMimeTypes(self):
|
||||
return [ 'application/vnd.openxmlformats-officedocument.wordprocessingml.document']
|
||||
|
||||
|
||||
def _getExtensions(self):
|
||||
return ['.docx']
|
||||
|
||||
def _doIndexFile(self, fname):
|
||||
# docx2txt.pl package not support in windows platform.
|
||||
# Download docx2txt package from "http://sourceforge.net/projects/docx2txt/" link.
|
||||
# In case, you don't want to use Makefile for installation, you can follow these steps for manual installation.
|
||||
# Copy docx2txt.pl, docx2txt.sh and docx2txt.config to appropriate place (e.g. /usr/bin directory) . used following command.
|
||||
# --> cp docx2txt.pl docx2txt.sh docx2txt.config /usr/bin/
|
||||
def _doIndexFile(self,fname):
|
||||
zip = zipfile.ZipFile(fname)
|
||||
content = xml.dom.minidom.parseString(zip.read("word/document.xml"))
|
||||
def toString () :
|
||||
""" Converts the document to a string. """
|
||||
buffer = u""
|
||||
for val in ["w:p", "w:h", "text:list"]:
|
||||
for paragraph in content.getElementsByTagName(val) :
|
||||
buffer += textToString(paragraph) + "\n"
|
||||
return buffer
|
||||
|
||||
fp = Popen(['docx2txt.pl', fname], shell=False, stdout=PIPE).stdout
|
||||
fp.read()
|
||||
file_obj = open(str(fname + ".txt"), "r")
|
||||
data = file_obj.read()
|
||||
return _to_unicode(data)
|
||||
res = toString().encode('ascii','replace')
|
||||
|
||||
return _to_unicode(res)
|
||||
|
||||
cntIndex.register(DocxIndex())
|
||||
|
||||
|
||||
class XlsxIndex(indexer):
|
||||
def _getMimeTypes(self):
|
||||
return [ 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']
|
||||
|
||||
def _getExtensions(self):
|
||||
return ['.xlsx']
|
||||
|
||||
def _doIndexFile(self,fname):
|
||||
zip = zipfile.ZipFile(fname)
|
||||
content = xml.dom.minidom.parseString(zip.read("xl/sharedStrings.xml"))
|
||||
def toString () :
|
||||
""" Converts the document to a string. """
|
||||
buffer = u""
|
||||
for val in ["t"]:
|
||||
for paragraph in content.getElementsByTagName(val) :
|
||||
buffer += textToString(paragraph) + "\n"
|
||||
return buffer
|
||||
|
||||
res = toString().encode('ascii','replace')
|
||||
|
||||
return _to_unicode(res)
|
||||
|
||||
cntIndex.register(XlsxIndex())
|
||||
|
||||
class PdfIndex(indexer):
|
||||
def _getMimeTypes(self):
|
||||
return [ 'application/pdf']
|
||||
|
||||
Executable → Regular
+3
-5
@@ -1,8 +1,8 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
|
||||
# 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
|
||||
@@ -18,6 +18,4 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import account_bs_report
|
||||
import account_pl_report
|
||||
import document_configuration
|
||||
@@ -0,0 +1,120 @@
|
||||
# -*- 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 document_configuration(osv.osv_memory):
|
||||
|
||||
_name='document.configuration'
|
||||
_description = 'Auto Directory Configuration'
|
||||
_inherit = 'res.config'
|
||||
|
||||
_columns = {
|
||||
'sale_order' : fields.boolean('Sale Order', help="Auto directory configuration for Sale Orders and Quotation with report."),
|
||||
'product' : fields.boolean('Product', help="Auto directory configuration for Products."),
|
||||
'project': fields.boolean('Project', help="Auto directory configuration for Projects."),
|
||||
}
|
||||
|
||||
|
||||
def execute(self, cr, uid, ids, context=None):
|
||||
conf_id = ids and ids[0] or False
|
||||
conf = self.browse(cr, uid, conf_id, context)
|
||||
dir_pool = self.pool.get('document.directory')
|
||||
data_pool = self.pool.get('ir.model.data')
|
||||
model_pool = self.pool.get('ir.model')
|
||||
content_pool = self.pool.get('document.directory.content')
|
||||
if conf.sale_order and self.pool.get('sale.order'):
|
||||
# Sale order
|
||||
dir_data_id = data_pool._get_id(cr, uid, 'document', 'dir_sale_order_all')
|
||||
if dir_data_id:
|
||||
sale_dir_id = data_pool.browse(cr, uid, dir_data_id, context=context).res_id
|
||||
else:
|
||||
sale_dir_id = data_pool.create(cr, uid, {'name': 'Sale Orders'})
|
||||
mid = model_pool.search(cr, uid, [('model','=','sale.order')])
|
||||
dir_pool.write(cr, uid, [sale_dir_id], {
|
||||
'type':'ressource',
|
||||
'ressource_type_id': mid[0],
|
||||
'domain': '[]',
|
||||
})
|
||||
# Qutation
|
||||
dir_data_id = data_pool._get_id(cr, uid, 'document', 'dir_sale_order_quote')
|
||||
if dir_data_id:
|
||||
quta_dir_id = data_pool.browse(cr, uid, dir_data_id, context=context).res_id
|
||||
else:
|
||||
quta_dir_id = data_pool.create(cr, uid, {'name': 'Sale Quotations'})
|
||||
|
||||
dir_pool.write(cr, uid, [quta_dir_id], {
|
||||
'type':'ressource',
|
||||
'ressource_type_id': mid[0],
|
||||
'domain': "[('state','=','draft')]",
|
||||
})
|
||||
# Sale Order Report
|
||||
order_report_data_id = data_pool._get_id(cr, uid, 'sale', 'report_sale_order')
|
||||
if order_report_data_id:
|
||||
order_report_id = data_pool.browse(cr, uid, order_report_data_id, context=context).res_id
|
||||
|
||||
content_pool.create(cr, uid, {
|
||||
'name': "Print Order",
|
||||
'suffix': "_print",
|
||||
'report_id': order_report_id,
|
||||
'extension': '.pdf',
|
||||
'include_name': 1,
|
||||
'directory_id': sale_dir_id,
|
||||
})
|
||||
|
||||
content_pool.create(cr, uid, {
|
||||
'name': "Print Qutation",
|
||||
'suffix': "_print",
|
||||
'report_id': order_report_id,
|
||||
'extension': '.pdf',
|
||||
'include_name': 1,
|
||||
'directory_id': quta_dir_id,
|
||||
})
|
||||
|
||||
|
||||
if conf.product and self.pool.get('product.product'):
|
||||
# Product
|
||||
dir_data_id = data_pool._get_id(cr, uid, 'document', 'dir_product')
|
||||
if dir_data_id:
|
||||
product_dir_id = data_pool.browse(cr, uid, dir_data_id, context=context).res_id
|
||||
else:
|
||||
product_dir_id = data_pool.create(cr, uid, {'name': 'Products'})
|
||||
|
||||
mid = model_pool.search(cr, uid, [('model','=','product.product')])
|
||||
dir_pool.write(cr, uid, [product_dir_id], {
|
||||
'type':'ressource',
|
||||
'ressource_type_id': mid[0],
|
||||
})
|
||||
|
||||
if conf.project and self.pool.get('account.analytic.account'):
|
||||
# Project
|
||||
dir_data_id = data_pool._get_id(cr, uid, 'document', 'dir_project')
|
||||
if dir_data_id:
|
||||
project_dir_id = data_pool.browse(cr, uid, dir_data_id, context=context).res_id
|
||||
else:
|
||||
project_dir_id = data_pool.create(cr, uid, {'name': 'Projects'})
|
||||
|
||||
mid = model_pool.search(cr, uid, [('model','=','account.analytic.account')])
|
||||
dir_pool.write(cr, uid, [project_dir_id], {
|
||||
'type':'ressource',
|
||||
'ressource_type_id': mid[0],
|
||||
'domain': '[]',
|
||||
'ressource_tree': 1
|
||||
})
|
||||
document_configuration()
|
||||
@@ -0,0 +1,50 @@
|
||||
<openerp>
|
||||
<data>
|
||||
<record id="view_auto_config_form" model="ir.ui.view">
|
||||
<field name="name">Auto Configure Directory</field>
|
||||
<field name="model">document.configuration</field>
|
||||
<field name="type">form</field>
|
||||
<field name="inherit_id" ref="base.res_config_view_base"/>
|
||||
<field name="arch" type="xml">
|
||||
<data>
|
||||
<form position="attributes">
|
||||
<attribute name="string">Auto Configure</attribute>
|
||||
</form>
|
||||
<separator string="title" position="attributes">
|
||||
<attribute name="string">Resource Directory Configuration </attribute>
|
||||
</separator>
|
||||
<xpath expr="//label[@string='description']" position="attributes">
|
||||
<attribute name="string">Choose the following Resouces to auto directory configuration.</attribute>
|
||||
</xpath>
|
||||
<xpath expr='//separator[@string="vsep"]' position='attributes'>
|
||||
<attribute name='rowspan'>12</attribute>
|
||||
<attribute name='string'></attribute>
|
||||
</xpath>
|
||||
<group string="res_config_contents" position="replace">
|
||||
<group col="6" colspan="4">
|
||||
<field name="sale_order"/>
|
||||
<field name="product"/>
|
||||
<field name="project"/>
|
||||
</group>
|
||||
</group>
|
||||
<xpath expr="//button[@name='action_skip']" position="replace"/>
|
||||
</data>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_config_auto_directory" model="ir.actions.act_window">
|
||||
<field name="name">Auto Configure Directory</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">document.configuration</field>
|
||||
<field name="view_id" ref="view_auto_config_form"/>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.todo" id="config_auto_directory">
|
||||
<field name="action_id" ref="action_config_auto_directory"/>
|
||||
<field name="groups_id" eval="[(6,0,[ref('base.group_extended')])]"/>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -18,7 +18,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
import doc_conf_wizard
|
||||
import ftpserver
|
||||
import wizard
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -33,7 +33,8 @@
|
||||
'depends': ['base', 'document'],
|
||||
'init_xml': [],
|
||||
'update_xml': [
|
||||
'document_ftp_view.xml',
|
||||
'wizard/ftp_configuration_view.xml',
|
||||
'wizard/ftp_browse_view.xml',
|
||||
'security/ir.model.access.csv'
|
||||
],
|
||||
'demo_xml': [],
|
||||
|
||||
@@ -1,117 +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 base64
|
||||
|
||||
from osv import osv, fields
|
||||
from osv.orm import except_orm
|
||||
from tools import config
|
||||
import urlparse
|
||||
|
||||
import os
|
||||
|
||||
class document_configuration_wizard(osv.osv_memory):
|
||||
|
||||
_name='document.configuration.wizard'
|
||||
_description = 'Auto Directory Configuration'
|
||||
_inherit = 'res.config'
|
||||
_rec_name = 'host'
|
||||
_columns = {
|
||||
'host': fields.char('Address', size=64,
|
||||
help="Server address or IP and port to which users should connect to for DMS access",
|
||||
required=True),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'host': config.get('ftp_server_host', 'localhost') + ':' + config.get('ftp_server_port', '8021'),
|
||||
}
|
||||
|
||||
def execute(self, cr, uid, ids, context=None):
|
||||
conf = self.browse(cr, uid, ids[0], context)
|
||||
obj=self.pool.get('document.directory')
|
||||
objid=self.pool.get('ir.model.data')
|
||||
|
||||
if self.pool.get('sale.order'):
|
||||
id = objid._get_id(cr, uid, 'document', 'dir_sale_order_all')
|
||||
id = objid.browse(cr, uid, id, context=context).res_id
|
||||
mid = self.pool.get('ir.model').search(cr, uid, [('model','=','sale.order')])
|
||||
obj.write(cr, uid, [id], {
|
||||
'type':'ressource',
|
||||
'ressource_type_id': mid[0],
|
||||
'domain': '[]',
|
||||
})
|
||||
aid = objid._get_id(cr, uid, 'sale', 'report_sale_order')
|
||||
aid = objid.browse(cr, uid, aid, context=context).res_id
|
||||
|
||||
self.pool.get('document.directory.content').create(cr, uid, {
|
||||
'name': "Print Order",
|
||||
'suffix': "_print",
|
||||
'report_id': aid,
|
||||
'extension': '.pdf',
|
||||
'include_name': 1,
|
||||
'directory_id': id,
|
||||
})
|
||||
id = objid._get_id(cr, uid, 'document', 'dir_sale_order_quote')
|
||||
id = objid.browse(cr, uid, id, context=context).res_id
|
||||
obj.write(cr, uid, [id], {
|
||||
'type':'ressource',
|
||||
'ressource_type_id': mid[0],
|
||||
'domain': "[('state','=','draft')]",
|
||||
})
|
||||
|
||||
if self.pool.get('product.product'):
|
||||
id = objid._get_id(cr, uid, 'document', 'dir_product')
|
||||
id = objid.browse(cr, uid, id, context=context).res_id
|
||||
mid = self.pool.get('ir.model').search(cr, uid, [('model','=','product.product')])
|
||||
obj.write(cr, uid, [id], {
|
||||
'type':'ressource',
|
||||
'ressource_type_id': mid[0],
|
||||
})
|
||||
|
||||
if self.pool.get('stock.location'):
|
||||
aid = objid._get_id(cr, uid, 'stock', 'report_product_history')
|
||||
aid = objid.browse(cr, uid, aid, context=context).res_id
|
||||
|
||||
self.pool.get('document.directory.content').create(cr, uid, {
|
||||
'name': "Product Stock",
|
||||
'suffix': "_stock_forecast",
|
||||
'report_id': aid,
|
||||
'extension': '.pdf',
|
||||
'include_name': 1,
|
||||
'directory_id': id,
|
||||
})
|
||||
|
||||
if self.pool.get('account.analytic.account'):
|
||||
id = objid._get_id(cr, uid, 'document', 'dir_project')
|
||||
id = objid.browse(cr, uid, id, context=context).res_id
|
||||
mid = self.pool.get('ir.model').search(cr, uid, [('model','=','account.analytic.account')])
|
||||
obj.write(cr, uid, [id], {
|
||||
'type':'ressource',
|
||||
'ressource_type_id': mid[0],
|
||||
'domain': '[]',
|
||||
'ressource_tree': 1
|
||||
})
|
||||
|
||||
# Update the action for FTP browse.
|
||||
aid = objid._get_id(cr, uid, 'document_ftp', 'action_document_browse')
|
||||
aid = objid.browse(cr, uid, aid, context=context).res_id
|
||||
self.pool.get('ir.actions.url').write(cr, uid, [aid], {'url': 'ftp://'+(conf.host or 'localhost:8021')+'/'})
|
||||
document_configuration_wizard()
|
||||
@@ -1,3 +1,6 @@
|
||||
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
|
||||
"access_document_configuation_wizard","document.configuration.wizard document manager","model_document_configuration_wizard","document.group_document_manager",1,1,1,1
|
||||
"access_document_configuation_wizard_sytem","document.configuration.wizard group system","model_document_configuration_wizard","base.group_system",1,1,1,1
|
||||
"access_document_ftp_browse","document.ftp.browse document manager","model_document_ftp_browse","document.group_document_manager",1,1,1,1
|
||||
"access_document_ftp_browse","document.ftp.browse group system","model_document_ftp_browse","base.group_system",1,1,1,1
|
||||
"access_document_ftp_configuation","document.ftp.configuration document manager","model_document_ftp_configuration","document.group_document_manager",1,1,1,1
|
||||
"access_document_ftp_configuation_system","document.ftp.configuration group system","model_document_ftp_configuration","base.group_system",1,1,1,1
|
||||
|
||||
|
||||
|
+6
-28
@@ -1,8 +1,8 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
|
||||
# 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
|
||||
@@ -18,30 +18,8 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
import ftp_browse
|
||||
import ftp_configuration
|
||||
|
||||
{
|
||||
"name" : "Accounting Reports",
|
||||
"version" : "1.0",
|
||||
"depends" : [
|
||||
"account"
|
||||
],
|
||||
"author" : "Tiny ERP",
|
||||
"description": """Accounting Reports
|
||||
Modules gives the 2 most Important Reports for the Accounting
|
||||
* Profit and Loss Account
|
||||
* Balance Sheet
|
||||
""",
|
||||
"website" : "http://tinyerp.com/module_account.html",
|
||||
"category" : "Generic Modules/Accounting",
|
||||
"init_xml" : [
|
||||
],
|
||||
"demo_xml" : [
|
||||
|
||||
],
|
||||
"update_xml" : [
|
||||
"wizard/account_pl_report_view.xml",
|
||||
"wizard/account_bs_report_view.xml"
|
||||
],
|
||||
"active": False,
|
||||
"installable": True
|
||||
}
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -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/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import osv, fields
|
||||
from tools.translate import _
|
||||
from document_ftp import ftpserver
|
||||
class document_ftp_browse(osv.osv_memory):
|
||||
_name = 'document.ftp.browse'
|
||||
_description = 'Document FTP Browse'
|
||||
|
||||
_columns = {
|
||||
'url' : fields.char('FTP Server', size=64, required=True),
|
||||
}
|
||||
|
||||
def default_get(self, cr, uid, fields, context=None):
|
||||
res = {}
|
||||
if 'url' in fields:
|
||||
user_pool = self.pool.get('res.users')
|
||||
current_user = user_pool.browse(cr, uid, uid, context=context)
|
||||
dir_pool = self.pool.get('document.directory')
|
||||
data_pool = self.pool.get('ir.model.data')
|
||||
aid = data_pool._get_id(cr, uid, 'document_ftp', 'action_document_browse')
|
||||
aid = data_pool.browse(cr, uid, aid, context=context).res_id
|
||||
ftp_url = self.pool.get('ir.actions.url').browse(cr, uid, aid, context=context)
|
||||
url = ftp_url.url and ftp_url.url.split('ftp://') or []
|
||||
if url:
|
||||
url = url[1]
|
||||
else:
|
||||
url = '%s:%s' %(ftpserver.HOST, ftpserver.PORT)
|
||||
res['url'] = 'ftp://%s@%s'%(current_user.login, url)
|
||||
return res
|
||||
|
||||
def browse_ftp(self, cr, uid, ids, context):
|
||||
data_id = ids and ids[0] or False
|
||||
data = self.browse(cr, uid, data_id, context)
|
||||
final_url = data.url
|
||||
return {
|
||||
'type': 'ir.actions.act_url',
|
||||
'url':final_url,
|
||||
'target': 'new'
|
||||
}
|
||||
document_ftp_browse()
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="ftp_browse_form" model="ir.ui.view">
|
||||
<field name="name">Document FTP Browse</field>
|
||||
<field name="model">document.ftp.browse</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Browse Document">
|
||||
<separator string="Browse Document" colspan="4"/>
|
||||
<field name="url" widget="url" colspan="4"/>
|
||||
<separator colspan="4"/>
|
||||
<group col="4" colspan="4">
|
||||
<label string="" colspan="2"/>
|
||||
<button special="cancel" string="_Close" icon="gtk-cancel"/>
|
||||
<button name="browse_ftp" string="_Browse" type="object" icon="gtk-ok"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_ftp_browse" model="ir.actions.act_window">
|
||||
<field name="name">Document Browse</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">document.ftp.browse</field>
|
||||
<field name="view_id" ref="ftp_browse_form"/>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<menuitem
|
||||
name="Shared Repository (FTP)"
|
||||
action="action_ftp_browse"
|
||||
id="menu_document_browse"
|
||||
icon="STOCK_EXECUTE"
|
||||
parent="document.menu_document_doc" sequence="1"/>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -0,0 +1,55 @@
|
||||
# -*- 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 base64
|
||||
|
||||
from osv import osv, fields
|
||||
from osv.orm import except_orm
|
||||
from tools import config
|
||||
import urlparse
|
||||
|
||||
import os
|
||||
|
||||
class document_ftp_configuration(osv.osv_memory):
|
||||
|
||||
_name='document.ftp.configuration'
|
||||
_description = 'Auto Directory Configuration'
|
||||
_inherit = 'res.config'
|
||||
_rec_name = 'host'
|
||||
_columns = {
|
||||
'host': fields.char('Address', size=64,
|
||||
help="Server address or IP and port to which users should connect to for DMS access",
|
||||
required=True),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'host': config.get('ftp_server_host', 'localhost') + ':' + config.get('ftp_server_port', '8021'),
|
||||
}
|
||||
|
||||
def execute(self, cr, uid, ids, context=None):
|
||||
conf = self.browse(cr, uid, ids[0], context)
|
||||
dir_pool = self.pool.get('document.directory')
|
||||
data_pool = self.pool.get('ir.model.data')
|
||||
# Update the action for FTP browse.
|
||||
aid = data_pool._get_id(cr, uid, 'document_ftp', 'action_document_browse')
|
||||
aid = data_pool.browse(cr, uid, aid, context=context).res_id
|
||||
self.pool.get('ir.actions.url').write(cr, uid, [aid], {'url': 'ftp://'+(conf.host or 'localhost:8021')+'/'})
|
||||
document_ftp_configuration()
|
||||
+6
-13
@@ -3,26 +3,19 @@
|
||||
<record model="ir.actions.url" id="action_document_browse">
|
||||
<field name="name">Browse Files</field>
|
||||
<field name="url">ftp://localhost:8021/</field>
|
||||
</record>
|
||||
<menuitem
|
||||
name="Shared Repository (FTP)"
|
||||
action="action_document_browse"
|
||||
id="menu_document_browse"
|
||||
type="url"
|
||||
icon="STOCK_EXECUTE"
|
||||
parent="document.menu_document_doc" sequence="1"/>
|
||||
</record>
|
||||
|
||||
|
||||
|
||||
<record id="view_auto_config_form" model="ir.ui.view">
|
||||
<field name="name">Auto Configure Directory</field>
|
||||
<field name="model">document.configuration.wizard</field>
|
||||
<field name="name">FTP Server Configuration</field>
|
||||
<field name="model">document.ftp.configuration</field>
|
||||
<field name="type">form</field>
|
||||
<field name="inherit_id" ref="base.res_config_view_base"/>
|
||||
<field name="arch" type="xml">
|
||||
<data>
|
||||
<form position="attributes">
|
||||
<attribute name="string">Auto Configure</attribute>
|
||||
<attribute name="string">FTP Server Configuration</attribute>
|
||||
</form>
|
||||
<separator string="title" position="attributes">
|
||||
<attribute name="string">FTP Server Configuration</attribute>
|
||||
@@ -43,9 +36,9 @@
|
||||
</record>
|
||||
|
||||
<record id="action_config_auto_directory" model="ir.actions.act_window">
|
||||
<field name="name">Auto Configure Directory</field>
|
||||
<field name="name">FTP Server Configuration</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">document.configuration.wizard</field>
|
||||
<field name="res_model">document.ftp.configuration</field>
|
||||
<field name="view_id" ref="view_auto_config_form"/>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
@@ -108,7 +108,8 @@ class email_template(osv.osv):
|
||||
'enforce_from_account':fields.many2one(
|
||||
'email_template.account',
|
||||
string="Enforce From Account",
|
||||
help="Emails will be sent only from this account."),
|
||||
help="Emails will be sent only from this account(which are approved).",
|
||||
domain=[('state','=','approved')]),
|
||||
'from_email' : fields.related('enforce_from_account', 'email_id',
|
||||
type='char', string='From',),
|
||||
'def_to':fields.char(
|
||||
@@ -580,8 +581,8 @@ class email_template(osv.osv):
|
||||
context)
|
||||
|
||||
print 'Sending', mailbox_id
|
||||
self.pool.get('email_template.mailbox').send_this_mail(cursor, user, [mailbox_id], context)
|
||||
return mailbox_id
|
||||
|
||||
|
||||
def generate_mail(self,
|
||||
cursor,
|
||||
@@ -595,6 +596,7 @@ class email_template(osv.osv):
|
||||
if not template:
|
||||
raise Exception("The requested template could not be loaded")
|
||||
print 'loaded', record_ids
|
||||
result = True
|
||||
for record_id in record_ids:
|
||||
mailbox_id = self._generate_mailbox_item_from_template(
|
||||
cursor,
|
||||
@@ -625,7 +627,9 @@ class email_template(osv.osv):
|
||||
{'folder':'outbox'},
|
||||
context=context
|
||||
)
|
||||
return True
|
||||
# TODO : manage return value of all the records
|
||||
result = self.pool.get('email_template.mailbox').send_this_mail(cursor, user, [mailbox_id], context)
|
||||
return result
|
||||
|
||||
email_template()
|
||||
|
||||
@@ -641,7 +645,7 @@ class email_template_preview(osv.osv_memory):
|
||||
if 'template_id' in context.keys():
|
||||
ref_obj_id = self.pool.get('email.template').read(cr, uid, context['template_id'], ['object_name'], context)
|
||||
ref_obj_name = self.pool.get('ir.model').read(cr, uid, ref_obj_id['object_name'][0], ['model'], context)['model']
|
||||
ref_obj_ids = self.pool.get(ref_obj_name).search(cr, uid, [], context=context)
|
||||
ref_obj_ids = self.pool.get(ref_obj_name).search(cr, uid, [], 0, 20, 'id desc', context=context)
|
||||
ref_obj_recs = self.pool.get(ref_obj_name).name_get(cr, uid, ref_obj_ids, context)
|
||||
return ref_obj_recs
|
||||
|
||||
|
||||
@@ -266,7 +266,7 @@ class email_template_account(osv.osv):
|
||||
return result
|
||||
|
||||
def send_mail(self, cr, uid, ids, addresses, subject='', body=None, payload=None, context=None):
|
||||
#TODO: Replace all this crap with a single email object
|
||||
#TODO: Replace all this with a single email object
|
||||
if body is None:
|
||||
body = {}
|
||||
if payload is None:
|
||||
@@ -320,19 +320,20 @@ class email_template_account(osv.osv):
|
||||
msg.attach(part)
|
||||
except Exception, error:
|
||||
logger.notifyChannel(_("Email Template"), netsvc.LOG_ERROR, _("Mail from Account %s failed. Probable Reason:MIME Error\nDescription: %s") % (id, error))
|
||||
return error
|
||||
return {'error_msg': "Server Send Error\nDescription: %s"%error}
|
||||
try:
|
||||
#print msg['From'],toadds
|
||||
serv.sendmail(msg['From'], addresses_l['all'], msg.as_string())
|
||||
except Exception, error:
|
||||
logger.notifyChannel(_("Email Template"), netsvc.LOG_ERROR, _("Mail from Account %s failed. Probable Reason:Server Send Error\nDescription: %s") % (id, error))
|
||||
return error
|
||||
return {'error_msg': "Server Send Error\nDescription: %s"%error}
|
||||
#The mail sending is complete
|
||||
serv.close()
|
||||
logger.notifyChannel(_("Email Template"), netsvc.LOG_INFO, _("Mail from Account %s successfully Sent.") % (id))
|
||||
return True
|
||||
else:
|
||||
logger.notifyChannel(_("Email Template"), netsvc.LOG_ERROR, _("Mail from Account %s failed. Probable Reason:Account not approved") % id)
|
||||
return {'error_msg':"Mail from Account %s failed. Probable Reason:Account not approved"% id}
|
||||
|
||||
def extracttime(self, time_as_string):
|
||||
"""
|
||||
@@ -394,7 +395,6 @@ class email_template_account(osv.osv):
|
||||
return date_as_date
|
||||
|
||||
def send_receive(self, cr, uid, ids, context=None):
|
||||
self.get_mails(cr, uid, ids, context)
|
||||
for id in ids:
|
||||
ctx = context.copy()
|
||||
ctx['filters'] = [('account_id', '=', id)]
|
||||
|
||||
@@ -56,18 +56,19 @@ class email_template_mailbox(osv.osv):
|
||||
values['subject'] or u'',
|
||||
{'text':values.get('body_text', u'') or u'', 'html':values.get('body_html', u'') or u''},
|
||||
payload=payload, context=context)
|
||||
|
||||
if result == True:
|
||||
self.write(cr, uid, id, {'folder':'sent', 'state':'na', 'date_mail':time.strftime("%Y-%m-%d %H:%M:%S")}, context)
|
||||
self.historise(cr, uid, [id], "Email sent successfully", context)
|
||||
else:
|
||||
self.historise(cr, uid, [id], result, context)
|
||||
error = result['error_msg']
|
||||
self.historise(cr, uid, [id], error, context)
|
||||
|
||||
except Exception, error:
|
||||
logger = netsvc.Logger()
|
||||
logger.notifyChannel(_("Power Email"), netsvc.LOG_ERROR, _("Sending of Mail %s failed. Probable Reason:Could not login to server\nError: %s") % (id, error))
|
||||
self.historise(cr, uid, [id], error, context)
|
||||
self.write(cr, uid, id, {'state':'na'}, context)
|
||||
return True
|
||||
return result
|
||||
|
||||
def historise(self, cr, uid, ids, message='', context=None):
|
||||
for id in ids:
|
||||
|
||||
@@ -8,33 +8,29 @@
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Email Preview">
|
||||
<field name="rel_model" />
|
||||
<newline />
|
||||
<field name="rel_model_ref" on_change="on_change_ref(rel_model_ref, context)" />
|
||||
<newline />
|
||||
<field name="to" />
|
||||
<newline />
|
||||
<field name="cc" />
|
||||
<newline />
|
||||
<field name="bcc" />
|
||||
<newline />
|
||||
<field name="subject" />
|
||||
<newline />
|
||||
<separator string= "Body(Text)" colspan="2"/>
|
||||
<newline/>
|
||||
<field name="body_text" nolabel="1" colspan="2"/>
|
||||
<newline/>
|
||||
<separator string= "Body(Html)" colspan="2"/>
|
||||
<newline/>
|
||||
<field name="body_html" nolabel="1" colspan="2"/>
|
||||
<newline />
|
||||
<field name="report" />
|
||||
<newline/>
|
||||
<button icon="gtk-ok" special="cancel" string="OK" colspan="2"/>
|
||||
<group col="4" colspan="4">
|
||||
<field name="rel_model" />
|
||||
<field name="rel_model_ref" on_change="on_change_ref(rel_model_ref, context)"/>
|
||||
</group>
|
||||
<group col="8" colspan="4">
|
||||
<field name="to" />
|
||||
<field name="cc" />
|
||||
<field name="bcc" />
|
||||
<field name="subject" />
|
||||
</group>
|
||||
<group col="4" colspan="4">
|
||||
<separator string= "Body(Text)" colspan="2"/>
|
||||
<separator string= "Body(Html)" colspan="2"/>
|
||||
<newline/>
|
||||
<field name="body_text" nolabel="1" colspan="2"/>
|
||||
<field name="body_html" nolabel="1" colspan="2"/>
|
||||
</group>
|
||||
<field name="report" colspan="2"/>
|
||||
<button icon="gtk-ok" special="cancel" string="OK" colspan="1"/>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="wizard_email_template_preview" model="ir.actions.act_window">
|
||||
<field name="name">Template Preview</field>
|
||||
<field name="res_model">email_template.preview</field>
|
||||
|
||||
@@ -106,6 +106,9 @@ class l10n_be_vat_declaration(osv.osv_memory):
|
||||
data_of_file +='\n\t\t<DATA>\n\t\t\t<DATA_ELEM>'
|
||||
|
||||
for item in tax_info:
|
||||
if item['code'] == '91' and ending_month != 12:
|
||||
#the tax code 91 can only be send for the declaration of December
|
||||
continue
|
||||
if item['code']:
|
||||
if item['code'] == '71-72':
|
||||
item['code']='71'
|
||||
|
||||
@@ -73,7 +73,7 @@ class Tax_template(osv.osv_memory):
|
||||
|
||||
def on_change_paid(self, cr, uid, id, tax, account):
|
||||
return self._on_change(
|
||||
cr, uid, ids, tax, vals={'account_paid_id': account})
|
||||
cr, uid, id, tax, vals={'account_paid_id': account})
|
||||
|
||||
def execute(self,cr,uid,ids,context={}):
|
||||
jids = self.pool.get('account.tax.template').search(cr, uid, [])
|
||||
|
||||
@@ -73,11 +73,19 @@ you required for the campaign"),
|
||||
campaign = self.browse(cr, uid, ids[0])
|
||||
if not campaign.activity_ids :
|
||||
raise osv.except_osv("Error", "There is no activitity in the campaign")
|
||||
act_ids = [ act_id.id for act_id in campaign.activity_ids]
|
||||
act_ids = self.pool.get('marketing.campaign.activity').search(cr, uid,
|
||||
[('id', 'in', act_ids), ('start', '=', True)])
|
||||
actvity_ids = [ act_id.id for act_id in campaign.activity_ids]
|
||||
act_obj = self.pool.get('marketing.campaign.activity')
|
||||
act_ids = act_obj.search(cr, uid, [('id', 'in', actvity_ids),
|
||||
('start', '=', True)])
|
||||
if not act_ids :
|
||||
raise osv.except_osv("Error", "There is no starting activitity in the campaign")
|
||||
act_ids = act_obj.search(cr, uid, [('id', 'in', actvity_idsf),
|
||||
('type', '=', 'email')])
|
||||
for activity in act_obj.browse(cr, uid, act_ids):
|
||||
if not activity.email_template_id.enforce_from_account :
|
||||
raise osv.except_osv("Error", "Campaign cannot be start : Email Account is missing in email activity")
|
||||
if activity.email_template_id.enforce_from_account.state != 'approved' :
|
||||
raise osv.except_osv("Error", "Campaign cannot be start : Email Account is not approved for email activity")
|
||||
self.write(cr, uid, ids, {'state': 'running'})
|
||||
return True
|
||||
|
||||
@@ -239,7 +247,7 @@ class marketing_campaign_activity(osv.osv):
|
||||
def __init__(self, *args):
|
||||
self._actions = {'paper' : self.process_wi_report,
|
||||
'email' : self.process_wi_email,
|
||||
'server_action' : self.process_wi_action,
|
||||
'action' : self.process_wi_action,
|
||||
}
|
||||
return super(marketing_campaign_activity, self).__init__(*args)
|
||||
|
||||
@@ -273,13 +281,15 @@ class marketing_campaign_activity(osv.osv):
|
||||
return True
|
||||
|
||||
def process_wi_email(self, cr, uid, activity, workitem, context=None):
|
||||
return self.pool.get('email.template').generate_mail(cr, uid, activity.email_template_id.id, [workitem.res_id], context=context)
|
||||
return self.pool.get('email.template').generate_mail(cr, uid,
|
||||
activity.email_template_id.id,
|
||||
[workitem.res_id], context=context)
|
||||
|
||||
def process_wi_action(self, cr, uid, activity, workitem, context={}):
|
||||
context = {}
|
||||
server_obj = self.pool.get('ir.actions.server')
|
||||
server_obj.run(cr, uid, [activity.server_action_id.id], context)
|
||||
return True
|
||||
context['active_id'] = workitem.res_id
|
||||
return server_obj.run(cr, uid, [activity.server_action_id.id], context)
|
||||
|
||||
def process(self, cr, uid, act_id, wi_id, context={}):
|
||||
activity = self.browse(cr, uid, act_id)
|
||||
@@ -339,7 +349,7 @@ class marketing_campaign_workitem(osv.osv):
|
||||
type='many2one', relation='marketing.campaign', string='Campaign', readonly=True),
|
||||
'object_id': fields.related('segment_id', 'campaign_id', 'object_id',
|
||||
type='many2one', relation='ir.model', string='Object', select=1),
|
||||
'res_id': fields.integer('Resource ID', select=1),
|
||||
'res_id': fields.integer('Resource ID', select=1, readonly=1),
|
||||
'res_name': fields.function(_res_name_get, method=True, string='Resource Name', type="char", size=64),
|
||||
'date': fields.datetime('Execution Date'),
|
||||
'partner_id': fields.many2one('res.partner', 'Partner', select=1),
|
||||
@@ -408,7 +418,7 @@ class marketing_campaign_workitem(osv.osv):
|
||||
else:
|
||||
vals = {'state': 'exception'}
|
||||
if type(result) == type({}) and 'error_msg' in result:
|
||||
vals['error_msg'] = result['error_msg']
|
||||
vals['error_msg'] = result['error_msg']
|
||||
self.write(cr, uid, wi.id, vals)
|
||||
else:
|
||||
self.write(cr, uid, wi.id, {'state': 'cancelled'})
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
<field name="name" select="1" />
|
||||
<field name="start"/>
|
||||
<field name="variable_cost" select="1"/>
|
||||
<field name="object_id" invisible="1"/>
|
||||
</group>
|
||||
<group colspan="2" col="2">
|
||||
<separator string="Condition" colspan="2"/>
|
||||
@@ -44,7 +45,7 @@
|
||||
<field name="report_directory_id" attrs="{'required':[('type','=','paper')]}" />
|
||||
</group>
|
||||
<group colspan="4" attrs="{'invisible':[('type','!=','action')]}" >
|
||||
<field name="server_action_id" attrs="{'required':[('type','=','action')]}" />
|
||||
<field name="server_action_id" attrs="{'required':[('type','=','action')]}" domain="[('model_id','=',object_id)]" />
|
||||
</group>
|
||||
<group colspan="4" attrs="{'invisible':[('type','!=','subcampaign')]}" >
|
||||
<field name="subcampaign_id" attrs="{'required':[('type','=','subcampaign')]}" />
|
||||
@@ -366,6 +367,7 @@
|
||||
<field name="partner_id"/>
|
||||
<field name="date"/>
|
||||
<field name="state"/>
|
||||
<button string="Preview" states="todo" name="preview" icon="gtk-apply" type="object"/>
|
||||
<button string="Process" states="todo" name="process" type="object" icon="gtk-ok"/>
|
||||
<button string="Cancel" states="todo" name="button_cancel" type="object" icon="gtk-cancel"/>
|
||||
</tree>
|
||||
|
||||
@@ -48,7 +48,7 @@ class sale_order_line(osv.osv):
|
||||
return res
|
||||
|
||||
_columns = {
|
||||
'margin': fields.function(_product_margin, method=True, string='Margin', store={}),
|
||||
'margin': fields.function(_product_margin, method=True, string='Margin', store=True),
|
||||
'purchase_price': fields.float('Cost Price', digits=(16,2))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user