@@ -165,7 +165,7 @@
[[ repeatIn(get_children_accounts(a,data['form']), 'o') ]]
- [[ data['form']['amount_currency'] == False or removeParentNode('blockTable') ]]
+ [[data['form']['amount_currency'] == False or removeParentNode('blockTable')]]
|
diff --git a/addons/account_report_india/report/report_balance_sheet.rml b/addons/account/report/report_balance_sheet.rml
similarity index 100%
rename from addons/account_report_india/report/report_balance_sheet.rml
rename to addons/account/report/report_balance_sheet.rml
diff --git a/addons/account_report_india/report/report_balance_sheet_horizontal.rml b/addons/account/report/report_balance_sheet_horizontal.rml
similarity index 100%
rename from addons/account_report_india/report/report_balance_sheet_horizontal.rml
rename to addons/account/report/report_balance_sheet_horizontal.rml
diff --git a/addons/account_report_india/report/report_bs.py b/addons/account/report/report_bs.py
similarity index 96%
rename from addons/account_report_india/report/report_bs.py
rename to addons/account/report/report_bs.py
index 51b2f349224..5a7294338c5 100644
--- a/addons/account_report_india/report/report_bs.py
+++ b/addons/account/report/report_bs.py
@@ -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)
diff --git a/addons/account_report_india/report/report_pl.py b/addons/account/report/report_pl.py
similarity index 96%
rename from addons/account_report_india/report/report_pl.py
rename to addons/account/report/report_pl.py
index b8b77e08be9..c693b9940c9 100644
--- a/addons/account_report_india/report/report_pl.py
+++ b/addons/account/report/report_pl.py
@@ -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)
diff --git a/addons/account_report_india/report/report_pl_account.rml b/addons/account/report/report_pl_account.rml
similarity index 100%
rename from addons/account_report_india/report/report_pl_account.rml
rename to addons/account/report/report_pl_account.rml
diff --git a/addons/account_report_india/report/report_pl_account_horizontal.rml b/addons/account/report/report_pl_account_horizontal.rml
similarity index 100%
rename from addons/account_report_india/report/report_pl_account_horizontal.rml
rename to addons/account/report/report_pl_account_horizontal.rml
diff --git a/addons/account/wizard/__init__.py b/addons/account/wizard/__init__.py
index c56c6c2e764..1231c67463a 100644
--- a/addons/account/wizard/__init__.py
+++ b/addons/account/wizard/__init__.py
@@ -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:
diff --git a/addons/account_report_india/wizard/account_bs_report.py b/addons/account/wizard/account_bs_report.py
similarity index 100%
rename from addons/account_report_india/wizard/account_bs_report.py
rename to addons/account/wizard/account_bs_report.py
diff --git a/addons/account_report_india/wizard/account_bs_report_view.xml b/addons/account/wizard/account_bs_report_view.xml
similarity index 96%
rename from addons/account_report_india/wizard/account_bs_report_view.xml
rename to addons/account/wizard/account_bs_report_view.xml
index 0dc3faa5a4a..a07ef94d81c 100644
--- a/addons/account_report_india/wizard/account_bs_report_view.xml
+++ b/addons/account/wizard/account_bs_report_view.xml
@@ -8,14 +8,16 @@
form
diff --git a/addons/account/wizard/account_common_report.py b/addons/account/wizard/account_common_report.py
new file mode 100644
index 00000000000..d38adf1cbcd
--- /dev/null
+++ b/addons/account/wizard/account_common_report.py
@@ -0,0 +1,127 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+import time
+
+from osv import 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:
+
diff --git a/addons/account/wizard/account_common_report.xml b/addons/account/wizard/account_common_report.xml
new file mode 100644
index 00000000000..d138c8ec2de
--- /dev/null
+++ b/addons/account/wizard/account_common_report.xml
@@ -0,0 +1,116 @@
+
+
+
+
+ Common Report
+ account.common.report
+ form
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/addons/account_report_india/wizard/account_pl_report.py b/addons/account/wizard/account_pl_report.py
similarity index 100%
rename from addons/account_report_india/wizard/account_pl_report.py
rename to addons/account/wizard/account_pl_report.py
diff --git a/addons/account/wizard/account_pl_report_view.xml b/addons/account/wizard/account_pl_report_view.xml
new file mode 100644
index 00000000000..b1104df8d25
--- /dev/null
+++ b/addons/account/wizard/account_pl_report_view.xml
@@ -0,0 +1,89 @@
+
+
+
+
+
+ Select period
+ account.pl.report
+ form
+
+
+
+
+
+
+ Account Profit And Loss
+ account.pl.report
+ ir.actions.act_window
+ form
+ form
+
+ new
+
+
+
+ Account Chart
+ account.pl.report
+ form
+
+
+
+
+
+
+ Select Account
+ account.pl.report
+ ir.actions.act_window
+ form
+ tree,form
+
+ {'record_id':active_id}
+ new
+
+
+
+
+
+
+
+
diff --git a/addons/account/wizard/account_report_general_ledger.py b/addons/account/wizard/account_report_general_ledger.py
new file mode 100644
index 00000000000..f63bbe4dac4
--- /dev/null
+++ b/addons/account/wizard/account_report_general_ledger.py
@@ -0,0 +1,58 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+import time
+
+from osv import 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:
diff --git a/addons/account/wizard/account_report_general_ledger_view.xml b/addons/account/wizard/account_report_general_ledger_view.xml
new file mode 100644
index 00000000000..f4f27f350f6
--- /dev/null
+++ b/addons/account/wizard/account_report_general_ledger_view.xml
@@ -0,0 +1,60 @@
+
+
+
+
+
+ General Ledger
+ account.report.general.ledger
+ form
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/addons/account/wizard/account_subscription_generate_view.xml b/addons/account/wizard/account_subscription_generate_view.xml
index ad0e4f958d1..aeb6aef8324 100644
--- a/addons/account/wizard/account_subscription_generate_view.xml
+++ b/addons/account/wizard/account_subscription_generate_view.xml
@@ -2,37 +2,37 @@
-
+
account.subscription.generate.form
account.subscription.generate
form
-
+
- Create Subscription Entries
+ Automatic Recurring
account.subscription.generate
form
tree,form
-
- new
+
+ new
-
+
diff --git a/addons/account/wizard/account_use_model_view.xml b/addons/account/wizard/account_use_model_view.xml
index 59ff85e1a57..03ca451e509 100644
--- a/addons/account/wizard/account_use_model_view.xml
+++ b/addons/account/wizard/account_use_model_view.xml
@@ -2,89 +2,88 @@
-
+
account.use.model.form
account.use.model
form
-
+
-
- Create Entries From Models
+
+ Manual Recurring
account.use.model
form
tree,form
-
- new
- {'model_line':'model_line'}
+
+ new
+ {'model_line':'model_line'}
- Create Entries From Models
+ Manual Recurring
client_action_multi
action
account.move.line
-
+
-
+
-
+
account.use.model.open.entry.form
account.use.model
form
-
+
account.use.model.create.entry.form
account.use.model
form
-
- Create Entries From Models
+
+ Manual Recurring
account.use.model
form
tree,form
-
- new
+
+ new
-
+
diff --git a/addons/account/wizard/account_validate_move_view.xml b/addons/account/wizard/account_validate_move_view.xml
index 3ef7f16d47c..232a924dbd9 100644
--- a/addons/account/wizard/account_validate_move_view.xml
+++ b/addons/account/wizard/account_validate_move_view.xml
@@ -2,23 +2,22 @@
-
+
Validate Account Move
validate.account.move
form
-
@@ -33,38 +32,38 @@
+ name="Validate Ledger Postings"
+ parent="periodical_processing_journal_entries_validation"
+ action="action_validate_account_move"
+ id="menu_validate_account_moves"
+ />
-
+
Validate Ledger Postings
validate.account.move.lines
form
+
+
+
-
+
-
+
Validate Ledger Postings
ir.actions.act_window
validate.account.move.lines
form
form
- {'record_id' : active_id}
+ {'record_id' : active_id}
new
-
+
-
+
Validate Ledger Postings
diff --git a/addons/account_followup/wizard/account_followup_print.py b/addons/account_followup/wizard/account_followup_print.py
index f49ae945cca..d7327638669 100644
--- a/addons/account_followup/wizard/account_followup_print.py
+++ b/addons/account_followup/wizard/account_followup_print.py
@@ -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 "\
diff --git a/addons/account_report_india/__init__.py b/addons/account_report_india/__init__.py
deleted file mode 100644
index f8c96cb3c42..00000000000
--- a/addons/account_report_india/__init__.py
+++ /dev/null
@@ -1,3 +0,0 @@
-
-import report
-import wizard
diff --git a/addons/account_report_india/report/__init__.py b/addons/account_report_india/report/__init__.py
deleted file mode 100755
index 5bcdacfefaf..00000000000
--- a/addons/account_report_india/report/__init__.py
+++ /dev/null
@@ -1,3 +0,0 @@
-
-import report_bs
-import report_pl
diff --git a/addons/account_report_india/report/rml_parse.py b/addons/account_report_india/report/rml_parse.py
deleted file mode 100755
index 2d2c1d5a763..00000000000
--- a/addons/account_report_india/report/rml_parse.py
+++ /dev/null
@@ -1,165 +0,0 @@
-# -*- encoding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2009 Tiny SPRL ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
-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('',''' [[company.logo]] ''')
- return True
-
-
-
diff --git a/addons/account_report_india/wizard/account_pl_report_view.xml b/addons/account_report_india/wizard/account_pl_report_view.xml
deleted file mode 100644
index 7e05200b220..00000000000
--- a/addons/account_report_india/wizard/account_pl_report_view.xml
+++ /dev/null
@@ -1,87 +0,0 @@
-
-
-
-
-
- Select period
- account.pl.report
- form
-
-
-
-
-
-
- Account Profit And Loss
- account.pl.report
- ir.actions.act_window
- form
- form
-
- new
-
-
-
- Account Chart
- account.pl.report
- form
-
-
-
-
-
-
- Select Account
- account.pl.report
- ir.actions.act_window
- form
- tree,form
-
- {'record_id':active_id}
- new
-
-
-
-
-
-
-
-
diff --git a/addons/document/__init__.py b/addons/document/__init__.py
index 694989bdd79..12306b0499b 100644
--- a/addons/document/__init__.py
+++ b/addons/document/__init__.py
@@ -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:
diff --git a/addons/document/__openerp__.py b/addons/document/__openerp__.py
index e7d3f767010..5e1aa939b54 100644
--- a/addons/document/__openerp__.py
+++ b/addons/document/__openerp__.py
@@ -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',
diff --git a/addons/document/document_directory.py b/addons/document/document_directory.py
index 1d0bbf3ed7c..e275adcb5c6 100644
--- a/addons/document/document_directory.py
+++ b/addons/document/document_directory.py
@@ -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):
diff --git a/addons/document/document_view.xml b/addons/document/document_view.xml
index 29f3617d64f..8fcd791144e 100644
--- a/addons/document/document_view.xml
+++ b/addons/document/document_view.xml
@@ -193,10 +193,7 @@
-
-
-
@@ -219,7 +216,9 @@
-
+
+
+
diff --git a/addons/document/security/ir.model.access.csv b/addons/document/security/ir.model.access.csv
index 245bcbffeab..a4412195745 100644
--- a/addons/document/security/ir.model.access.csv
+++ b/addons/document/security/ir.model.access.csv
@@ -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
diff --git a/addons/document/std_index.py b/addons/document/std_index.py
index c4f7d787d4d..2facb14eeb3 100644
--- a/addons/document/std_index.py
+++ b/addons/document/std_index.py
@@ -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']
diff --git a/addons/account_report_india/wizard/__init__.py b/addons/document/wizard/__init__.py
old mode 100755
new mode 100644
similarity index 87%
rename from addons/account_report_india/wizard/__init__.py
rename to addons/document/wizard/__init__.py
index 2a870d96fad..b143b583426
--- a/addons/account_report_india/wizard/__init__.py
+++ b/addons/document/wizard/__init__.py
@@ -1,8 +1,8 @@
-# -*- encoding: utf-8 -*-
+# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2009 Tiny SPRL ().
+# Copyright (C) 2004-2010 Tiny SPRL ().
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
@@ -18,6 +18,4 @@
# along with this program. If not, see .
#
##############################################################################
-
-import account_bs_report
-import account_pl_report
\ No newline at end of file
+import document_configuration
diff --git a/addons/document/wizard/document_configuration.py b/addons/document/wizard/document_configuration.py
new file mode 100644
index 00000000000..a497eb6af90
--- /dev/null
+++ b/addons/document/wizard/document_configuration.py
@@ -0,0 +1,120 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+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()
diff --git a/addons/document/wizard/document_configuration_view.xml b/addons/document/wizard/document_configuration_view.xml
new file mode 100644
index 00000000000..c6f40deb429
--- /dev/null
+++ b/addons/document/wizard/document_configuration_view.xml
@@ -0,0 +1,50 @@
+
+
+
+ Auto Configure Directory
+ document.configuration
+ form
+
+
+
+
+
+ Resource Directory Configuration
+
+
+ Choose the following Resouces to auto directory configuration.
+
+
+ 12
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Auto Configure Directory
+ ir.actions.act_window
+ document.configuration
+
+ form
+ form
+ new
+
+
+
+
+
+
+
+
diff --git a/addons/document_ftp/__init__.py b/addons/document_ftp/__init__.py
index 45ec4a6b67f..af514df8985 100644
--- a/addons/document_ftp/__init__.py
+++ b/addons/document_ftp/__init__.py
@@ -18,7 +18,7 @@
# along with this program. If not, see .
#
##############################################################################
-import doc_conf_wizard
import ftpserver
+import wizard
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/document_ftp/__openerp__.py b/addons/document_ftp/__openerp__.py
index 18042dabf93..a2b88d0a2a2 100644
--- a/addons/document_ftp/__openerp__.py
+++ b/addons/document_ftp/__openerp__.py
@@ -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': [],
diff --git a/addons/document_ftp/doc_conf_wizard.py b/addons/document_ftp/doc_conf_wizard.py
deleted file mode 100644
index 0f2f970572e..00000000000
--- a/addons/document_ftp/doc_conf_wizard.py
+++ /dev/null
@@ -1,117 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see
-#
-##############################################################################
-
-import 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()
diff --git a/addons/document_ftp/security/ir.model.access.csv b/addons/document_ftp/security/ir.model.access.csv
index c9c082f4397..b3ffdbd5350 100644
--- a/addons/document_ftp/security/ir.model.access.csv
+++ b/addons/document_ftp/security/ir.model.access.csv
@@ -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
+
diff --git a/addons/account_report_india/__openerp__.py b/addons/document_ftp/wizard/__init__.py
similarity index 56%
rename from addons/account_report_india/__openerp__.py
rename to addons/document_ftp/wizard/__init__.py
index 0765af339a1..40997cc6b90 100644
--- a/addons/account_report_india/__openerp__.py
+++ b/addons/document_ftp/wizard/__init__.py
@@ -1,8 +1,8 @@
-# -*- encoding: utf-8 -*-
+# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2009 Tiny SPRL ().
+# Copyright (C) 2004-2010 Tiny SPRL ().
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
@@ -18,30 +18,8 @@
# along with this program. If not, see .
#
##############################################################################
+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:
diff --git a/addons/document_ftp/wizard/ftp_browse.py b/addons/document_ftp/wizard/ftp_browse.py
new file mode 100644
index 00000000000..d033302f22a
--- /dev/null
+++ b/addons/document_ftp/wizard/ftp_browse.py
@@ -0,0 +1,61 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+
+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()
+
diff --git a/addons/document_ftp/wizard/ftp_browse_view.xml b/addons/document_ftp/wizard/ftp_browse_view.xml
new file mode 100644
index 00000000000..44cedccfc3e
--- /dev/null
+++ b/addons/document_ftp/wizard/ftp_browse_view.xml
@@ -0,0 +1,40 @@
+
+
+
+
+ Document FTP Browse
+ document.ftp.browse
+ form
+
+
+
+
+
+
+ Document Browse
+ ir.actions.act_window
+ document.ftp.browse
+
+ form
+ form
+ new
+
+
+
+
+
+
diff --git a/addons/document_ftp/wizard/ftp_configuration.py b/addons/document_ftp/wizard/ftp_configuration.py
new file mode 100644
index 00000000000..40926bdf7c9
--- /dev/null
+++ b/addons/document_ftp/wizard/ftp_configuration.py
@@ -0,0 +1,55 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see
+#
+##############################################################################
+
+import 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()
diff --git a/addons/document_ftp/document_ftp_view.xml b/addons/document_ftp/wizard/ftp_configuration_view.xml
similarity index 76%
rename from addons/document_ftp/document_ftp_view.xml
rename to addons/document_ftp/wizard/ftp_configuration_view.xml
index d3f4c09498c..df3aee360af 100644
--- a/addons/document_ftp/document_ftp_view.xml
+++ b/addons/document_ftp/wizard/ftp_configuration_view.xml
@@ -3,26 +3,19 @@
Browse Files
ftp://localhost:8021/
-
-
+
- Auto Configure Directory
- document.configuration.wizard
+ FTP Server Configuration
+ document.ftp.configuration
form
FTP Server Configuration
@@ -43,9 +36,9 @@
- Auto Configure Directory
+ FTP Server Configuration
ir.actions.act_window
- document.configuration.wizard
+ document.ftp.configuration
form
form
diff --git a/addons/email_template/email_template.py b/addons/email_template/email_template.py
index 37b38774a7d..9190bd17e2b 100644
--- a/addons/email_template/email_template.py
+++ b/addons/email_template/email_template.py
@@ -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
diff --git a/addons/email_template/email_template_account.py b/addons/email_template/email_template_account.py
index 0bcf3c3d099..52cff384ec4 100644
--- a/addons/email_template/email_template_account.py
+++ b/addons/email_template/email_template_account.py
@@ -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)]
diff --git a/addons/email_template/email_template_mailbox.py b/addons/email_template/email_template_mailbox.py
index fe9ca334d21..b89a9aeda26 100644
--- a/addons/email_template/email_template_mailbox.py
+++ b/addons/email_template/email_template_mailbox.py
@@ -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:
diff --git a/addons/email_template/email_template_view.xml b/addons/email_template/email_template_view.xml
index 934a7324b07..12a24ca0934 100644
--- a/addons/email_template/email_template_view.xml
+++ b/addons/email_template/email_template_view.xml
@@ -8,33 +8,29 @@
form
-
+
Template Preview
email_template.preview
diff --git a/addons/l10n_be/wizard/l10n_be_account_vat_declaration.py b/addons/l10n_be/wizard/l10n_be_account_vat_declaration.py
index a5e664c833a..155e40b256b 100644
--- a/addons/l10n_be/wizard/l10n_be_account_vat_declaration.py
+++ b/addons/l10n_be/wizard/l10n_be_account_vat_declaration.py
@@ -106,6 +106,9 @@ class l10n_be_vat_declaration(osv.osv_memory):
data_of_file +='\n\t\t\n\t\t\t'
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'
diff --git a/addons/l10n_ch_chart_c2c_pcg/wizard/config.py b/addons/l10n_ch_chart_c2c_pcg/wizard/config.py
index 07ee7a6efe0..dbef21389bf 100644
--- a/addons/l10n_ch_chart_c2c_pcg/wizard/config.py
+++ b/addons/l10n_ch_chart_c2c_pcg/wizard/config.py
@@ -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, [])
diff --git a/addons/marketing_campaign/marketing_campaign.py b/addons/marketing_campaign/marketing_campaign.py
index feeaa074b6d..c36b669ffcc 100644
--- a/addons/marketing_campaign/marketing_campaign.py
+++ b/addons/marketing_campaign/marketing_campaign.py
@@ -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'})
diff --git a/addons/marketing_campaign/marketing_campaign_view.xml b/addons/marketing_campaign/marketing_campaign_view.xml
index f8dfc003369..f954d5de006 100644
--- a/addons/marketing_campaign/marketing_campaign_view.xml
+++ b/addons/marketing_campaign/marketing_campaign_view.xml
@@ -28,6 +28,7 @@
+
@@ -44,7 +45,7 @@
-
+
@@ -366,6 +367,7 @@
+
diff --git a/addons/sale_margin/sale_margin.py b/addons/sale_margin/sale_margin.py
index 37da229733a..80bb542fa3d 100644
--- a/addons/sale_margin/sale_margin.py
+++ b/addons/sale_margin/sale_margin.py
@@ -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))
}
| |