diff --git a/addons/account/__openerp__.py b/addons/account/__openerp__.py
index d4731fa0215..cea696f590f 100644
--- a/addons/account/__openerp__.py
+++ b/addons/account/__openerp__.py
@@ -107,8 +107,11 @@ module named account_voucherss
'company_view.xml',
'account_installer.xml',
'report/account_invoice_report_view.xml',
+ 'report/account_entries_report_view.xml',
'report/account_report_view.xml',
'report/account_analytic_report_view.xml',
+ 'report/account_account_report_view.xml',
+ 'report/account_analytic_entries_report_view.xml'
],
'demo_xml': [
#'demo/price_accuracy00.yml',
diff --git a/addons/account/account_invoice_view.xml b/addons/account/account_invoice_view.xml
index b292ea36a1a..db487ed511e 100644
--- a/addons/account/account_invoice_view.xml
+++ b/addons/account/account_invoice_view.xml
@@ -478,14 +478,9 @@
-<<<<<<< TREE
-=======
-
-
->>>>>>> MERGE-SOURCE
res.partner.invoice.info.inherit
diff --git a/addons/account/account_menuitem.xml b/addons/account/account_menuitem.xml
index 37d539a4b25..a2d18095618 100644
--- a/addons/account/account_menuitem.xml
+++ b/addons/account/account_menuitem.xml
@@ -22,6 +22,7 @@
groups="group_account_user"/>
+
diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml
index 6c5be231657..1edb56d6044 100644
--- a/addons/account/account_view.xml
+++ b/addons/account/account_view.xml
@@ -351,7 +351,7 @@
-
+
diff --git a/addons/account/i18n/eu.po b/addons/account/i18n/eu.po
index 68344247171..84652c621ae 100644
--- a/addons/account/i18n/eu.po
+++ b/addons/account/i18n/eu.po
@@ -8,13 +8,13 @@ msgstr ""
"Project-Id-Version: openobject-addons\n"
"Report-Msgid-Bugs-To: FULL NAME \n"
"POT-Creation-Date: 2009-08-28 16:01+0000\n"
-"PO-Revision-Date: 2010-05-17 13:10+0000\n"
-"Last-Translator: Jon A. Ortuondo (Euskotec) \n"
+"PO-Revision-Date: 2010-05-23 09:59+0000\n"
+"Last-Translator: ninaiz \n"
"Language-Team: Basque \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2010-05-19 05:12+0000\n"
+"X-Launchpad-Export-Date: 2010-05-24 03:46+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: account
@@ -236,7 +236,7 @@ msgstr ""
#: field:account.tax.template,amount:0
#: xsl:account.transfer:0
msgid "Amount"
-msgstr ""
+msgstr "Kopurua"
#. module: account
#: model:ir.actions.report.xml,name:account.account_3rdparty_ledger
@@ -338,7 +338,7 @@ msgstr ""
#: field:account.invoice,amount_tax:0
#: field:account.move.line,account_tax_id:0
msgid "Tax"
-msgstr ""
+msgstr "Zerga"
#. module: account
#: rml:account.general.journal:0
@@ -465,7 +465,7 @@ msgstr ""
#. module: account
#: rml:account.invoice:0
msgid "Disc.(%)"
-msgstr ""
+msgstr "Desk. (%)"
#. module: account
#: rml:account.general.ledger:0
diff --git a/addons/account/i18n/fr.po b/addons/account/i18n/fr.po
index 1785d79bf38..e6bddde1647 100644
--- a/addons/account/i18n/fr.po
+++ b/addons/account/i18n/fr.po
@@ -7,13 +7,13 @@ msgstr ""
"Project-Id-Version: OpenERP Server 5.0.1\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2009-08-28 16:01+0000\n"
-"PO-Revision-Date: 2010-02-18 09:24+0000\n"
-"Last-Translator: Olivier Dony (OpenERP) \n"
+"PO-Revision-Date: 2010-05-21 17:48+0000\n"
+"Last-Translator: Christophe Chauvet - http://www.syleam.fr/ \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2010-04-17 04:06+0000\n"
+"X-Launchpad-Export-Date: 2010-05-22 04:00+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: account
@@ -2495,7 +2495,8 @@ msgid "Analytic Entry"
msgstr "Ecriture analytique"
#. module: account
-#: view:res.company:0 field:res.company,overdue_msg:0
+#: view:res.company:0
+#: field:res.company,overdue_msg:0
msgid "Overdue Payments Message"
msgstr "Message pour les paiements en retard"
@@ -2784,7 +2785,7 @@ msgstr "Ouvrir journal"
#. module: account
#: rml:account.analytic.account.journal:0
msgid "KI"
-msgstr ""
+msgstr "KI"
#. module: account
#: model:ir.actions.wizard,name:account.action_account_analytic_line
@@ -3034,7 +3035,7 @@ msgstr "-"
#. module: account
#: rml:account.analytic.account.journal:0
msgid "asgfas"
-msgstr ""
+msgstr "asgfas"
#. module: account
#: model:ir.actions.act_window,name:account.action_account_analytic_account_tree2
@@ -6082,3 +6083,6 @@ msgid ""
msgstr ""
"Cochez cette case si l'utilisateur peut réconcilier les entrées dans ce "
"compte."
+
+#~ msgid "account.config.wizard"
+#~ msgstr "account.config.wizard"
diff --git a/addons/account/report/__init__.py b/addons/account/report/__init__.py
index 09ff866d1a8..b411e404cac 100644
--- a/addons/account/report/__init__.py
+++ b/addons/account/report/__init__.py
@@ -37,6 +37,8 @@ import compare_account_balance
import account_invoice_report
import account_report
import account_analytic_report
-
+import account_account_report
+import account_entries_report
+import account_analytic_entries_report
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/account/report/account_account_report.py b/addons/account/report/account_account_report.py
new file mode 100644
index 00000000000..55e5d7030c7
--- /dev/null
+++ b/addons/account/report/account_account_report.py
@@ -0,0 +1,86 @@
+# -*- 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 tools
+from osv import fields,osv
+
+class account_account_report(osv.osv):
+ _name = "account.account.report"
+ _description = "Account Report"
+ _auto = False
+ _columns = {
+ 'name': fields.char('Name', size=128, readonly=True),
+ 'code': fields.char('Code', size=64, readonly=True),
+ 'type': fields.selection([
+ ('receivable', 'Receivable'),
+ ('payable', 'Payable'),
+ ('view', 'View'),
+ ('consolidation', 'Consolidation'),
+ ('other', 'Others'),
+ ('closed', 'Closed'),
+ ], 'Internal Type', readonly=True),
+ 'company_id': fields.many2one('res.company', 'Company', required=True),
+ 'currency_mode': fields.selection([('current', 'At Date'), ('average', 'Average Rate')], 'Outgoing Currencies Rate',readonly=True),
+ 'user_type': fields.many2one('account.account.type', 'Account Type',readonly=True),
+ 'quantity': fields.float('Quantity', readonly=True),
+ 'amount_total': fields.float('Total Amount', readonly=True),
+ 'credit': fields.float('Credit', readonly=True),
+ 'debit': fields.float('Debit', readonly=True),
+ 'balance': fields.float('Balance', readonly=True),
+ 'nbr': fields.integer('#Accounts', readonly=True),
+ 'parent_account_id': fields.many2one('account.account', 'Parent Account', required=True),
+ }
+ def init(self, cr):
+ tools.drop_view_if_exists(cr, 'account_account_report')
+ cr.execute("""
+ create or replace view account_account_report as (
+ select
+ min(a.id) as id,
+ count(distinct a.id) as nbr,
+ a.name,
+ a.code,
+ a.type as type,
+ a.company_id as company_id,
+ a.currency_mode as currency_mode,
+ a.user_type as user_type,
+ a.parent_id as parent_account_id,
+ sum(ail.quantity) as quantity,
+ sum(ail.price_subtotal) as amount_total,
+ sum(m.credit) as credit,
+ sum(m.debit) as debit,
+ (sum(m.credit)-sum(m.debit)) as balance
+ from
+ account_account as a
+ left join account_move_line as m on m.account_id=a.id
+ left join account_invoice_line as ail on ail.account_id=a.id
+ left join account_invoice as ai on ai.account_id=a.id
+ group by
+ a.name,
+ a.code,
+ a.type,
+ a.company_id,
+ a.currency_mode,
+ a.user_type,
+ m.account_id,
+ a.parent_id
+ )
+ """)
+account_account_report()
diff --git a/addons/account/report/account_account_report_view.xml b/addons/account/report/account_account_report_view.xml
new file mode 100644
index 00000000000..32e77be341f
--- /dev/null
+++ b/addons/account/report/account_account_report_view.xml
@@ -0,0 +1,92 @@
+
+
+
+
+ account.account.report.tree
+ account.account.report
+ tree
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ account.account.report.graph
+ account.account.report
+ graph
+
+
+
+
+
+
+
+
+
+
+
+ account.account.report.search
+ account.account.report
+ search
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Accounts
+ account.account.report
+ form
+ tree,graph
+ {"search_default_Account":1,"search_default_At Date":1,'group_by_no_leaf':1,'group_by':[]}
+
+
+
+
+
+
+
diff --git a/addons/account/report/account_analytic_entries_report.py b/addons/account/report/account_analytic_entries_report.py
new file mode 100644
index 00000000000..2a1b4ad993b
--- /dev/null
+++ b/addons/account/report/account_analytic_entries_report.py
@@ -0,0 +1,83 @@
+# -*- 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 tools
+from osv import fields,osv
+
+class analytic_entries_report(osv.osv):
+ _name = "analytic.entries.report"
+ _description = "Analytic Entries Statistics"
+ _auto = False
+ _columns = {
+ 'date': fields.date('Date', readonly=True),
+ 'year': fields.char('Year', size=4, readonly=True),
+ 'day': fields.char('Day', size=128, readonly=True),
+ 'month':fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'),
+ ('05','May'), ('06','June'), ('07','July'), ('08','August'), ('09','September'),
+ ('10','October'), ('11','November'), ('12','December')], 'Month',readonly=True),
+ 'user_id' : fields.many2one('res.users', 'User',readonly=True),
+ 'name': fields.char('Description', size=64, readonly=True),
+ 'company_id': fields.many2one('res.company', 'Company', required=True),
+ 'currency_id': fields.many2one('res.currency', 'Currency', required=True),
+ 'account_id': fields.many2one('account.analytic.account', 'Account', required=True),
+ 'general_account_id': fields.many2one('account.account', 'General Account', required=True),
+ 'journal_id': fields.many2one('account.analytic.journal', 'Journal', required=True),
+ 'move_id': fields.many2one('account.move.line', 'Move', required=True),
+ 'product_id': fields.many2one('product.product', 'Product', required=True),
+ 'product_uom_id': fields.many2one('product.uom', 'Product UOM', required=True),
+ 'amount': fields.float('Amount', readonly=True),
+ 'unit_amount': fields.float('Unit Amount', readonly=True),
+ 'amount_currency': fields.float('Amount Currency', readonly=True),
+ 'nbr': fields.integer('#Entries', readonly=True),
+ }
+ def init(self, cr):
+ tools.drop_view_if_exists(cr, 'analytic_entries_report')
+ cr.execute("""
+ create or replace view analytic_entries_report as (
+ select
+ min(a.id) as id,
+ count(distinct a.id) as nbr,
+ a.create_date as date,
+ to_char(a.create_date, 'YYYY') as year,
+ to_char(a.create_date, 'MM') as month,
+ to_char(a.create_date, 'YYYY-MM-DD') as day,
+ a.user_id as user_id,
+ a.name as name,
+ a.company_id as company_id,
+ a.currency_id as currency_id,
+ a.account_id as account_id,
+ a.general_account_id as general_account_id,
+ a.journal_id as journal_id,
+ a.move_id as move_id,
+ a.product_id as product_id,
+ a.product_uom_id as product_uom_id,
+ sum(a.amount) as amount,
+ sum(a.unit_amount) as unit_amount,
+ sum(a.amount_currency) as amount_currency
+ from
+ account_analytic_line a
+ group by
+ a.create_date, a.user_id,a.name,company_id,a.currency_id,
+ a.account_id,a.general_account_id,a.journal_id,
+ a.move_id,a.product_id,a.product_uom_id
+ )
+ """)
+analytic_entries_report()
diff --git a/addons/account/report/account_analytic_entries_report_view.xml b/addons/account/report/account_analytic_entries_report_view.xml
new file mode 100644
index 00000000000..41d9c0976f2
--- /dev/null
+++ b/addons/account/report/account_analytic_entries_report_view.xml
@@ -0,0 +1,112 @@
+
+
+
+
+ analytic.entries.report.tree
+ analytic.entries.report
+ tree
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ analytic.entries.report.search
+ analytic.entries.report
+ search
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ account.analytic.entries.graph
+ analytic.entries.report
+ graph
+
+
+
+
+
+
+
+
+
+
+ Analytic Entries
+ analytic.entries.report
+ form
+ tree,graph
+ {'search_default_month':1,'search_default_User':1,'group_by_no_leaf':1,'group_by':[]}
+
+
+
+
+
+
+
diff --git a/addons/account/report/account_analytic_report.py b/addons/account/report/account_analytic_report.py
index 45057d950bd..87912b4a3ef 100644
--- a/addons/account/report/account_analytic_report.py
+++ b/addons/account/report/account_analytic_report.py
@@ -35,7 +35,7 @@ class analytic_report(osv.osv):
'parent_id': fields.many2one('account.analytic.account', 'Parent Analytic Account', readonly=True),
'user_id' : fields.many2one('res.users', 'Account Manager',readonly=True),
'product_id' : fields.many2one('product.product', 'Product',readonly=True),
- 'quantity': fields.float('Quantity',readonly=True),
+ 'total_quantity': fields.float('# Total Quantity',readonly=True),
'debit' : fields.float('Debit',readonly=True),
'credit' : fields.float('Credit',readonly=True),
'balance' : fields.float('Balance',readonly=True),
@@ -43,6 +43,11 @@ class analytic_report(osv.osv):
'month':fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'),
('05','May'), ('06','June'), ('07','July'), ('08','August'), ('09','September'),
('10','October'), ('11','November'), ('12','December')], 'Month',readonly=True),
+ 'day': fields.char('Day', size=128, readonly=True),
+ 'nbr':fields.integer('# of Lines', readonly=True),
+ 'company_id': fields.many2one('res.company', 'Company', readonly=True),
+ 'type': fields.selection([('view','View'), ('normal','Normal')], 'Account Type'),
+
'state': fields.selection([('draft','Draft'),
('open','Open'),
('pending','Pending'),
@@ -50,6 +55,7 @@ class analytic_report(osv.osv):
('close','Close'),
('template', 'Template')],
'State', readonly=True),
+
}
_order = 'date_start desc'
def init(self, cr):
@@ -60,15 +66,18 @@ class analytic_report(osv.osv):
min(s.id) as id,
to_char(s.create_date, 'YYYY') as year,
to_char(s.create_date, 'MM') as month,
+ to_char(s.create_date, 'YYYY-MM-DD') as day,
l.journal_id,
l.product_id,
s.parent_id,
s.date_start,
s.date as date_end,
s.user_id,
+ s.company_id,
+ s.type,
s.name,
s.partner_id,
- s.quantity,
+ sum(s.quantity) as total_quantity,
s.debit,
s.credit,
s.balance,
@@ -77,7 +86,8 @@ class analytic_report(osv.osv):
from account_analytic_account s
left join account_analytic_line l on (s.id=l.account_id)
GROUP BY s.create_date,s.state,l.journal_id,s.name,
- s.partner_id,s.date_start,s.date,s.user_id,s.quantity,
+ s.partner_id,s.date_start,s.date,s.user_id,
+ s.company_id,s.type,
s.debit,s.credit,s.balance,s.parent_id,l.product_id
)
""")
diff --git a/addons/account/report/account_analytic_report_view.xml b/addons/account/report/account_analytic_report_view.xml
index de97bfcb798..25ed33c3902 100644
--- a/addons/account/report/account_analytic_report_view.xml
+++ b/addons/account/report/account_analytic_report_view.xml
@@ -9,23 +9,26 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
+
+
-
analytic.report.search
analytic.report
@@ -38,23 +41,15 @@
domain="[('year','=',time.strftime('%%Y'))]"/>
+
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
@@ -70,40 +77,59 @@
string="Template"
domain="[('state','=','template')]"/>
+
-
-
+
+
+
+
-
-
+
+
+
+
+
+
-
-
+
+
-
+
+ account.analytic.report.graph
+ analytic.report
+ graph
+
+
+
+
+
+
+
+
+
+
Analytic Accounts
analytic.report
form
- tree
- {'search_default_User':1,'search_default_user_id':uid}
+ tree,graph
+ {'search_default_This Month':1,'search_default_User':1,'group_by_no_leaf':1,'group_by':[]}
-
-
+
diff --git a/addons/account/report/account_entries_report.py b/addons/account/report/account_entries_report.py
new file mode 100644
index 00000000000..85ba8a058f7
--- /dev/null
+++ b/addons/account/report/account_entries_report.py
@@ -0,0 +1,123 @@
+# -*- 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 tools
+from osv import fields,osv
+
+class account_entries_report(osv.osv):
+ _name = "account.entries.report"
+ _description = "Entries"
+ _auto = False
+ _rec_name = 'date'
+ _columns = {
+ 'date': fields.date('Effective Date', readonly=True),
+ 'date_created': fields.date('Date Created', readonly=True),
+ 'date_maturity': fields.date('Date Maturity', readonly=True),
+ 'nbr':fields.integer('# of Entries', readonly=True),
+ 'nbl':fields.integer('# of Lines', readonly=True),
+ 'amount': fields.float('Amount',readonly=True),
+ 'year': fields.char('Year', size=4, readonly=True),
+ 'day': fields.char('Day', size=128, readonly=True),
+ 'month':fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'),
+ ('05','May'), ('06','June'), ('07','July'), ('08','August'), ('09','September'),
+ ('10','October'), ('11','November'), ('12','December')], 'Month',readonly=True),
+ 'ref': fields.char('Reference', size=64,readonly=True),
+ 'period_id': fields.many2one('account.period', 'Period', readonly=True),
+ 'account_id': fields.many2one('account.account', 'Account', readonly=True),
+ 'journal_id': fields.many2one('account.journal', 'Journal', readonly=True),
+ 'product_id': fields.many2one('product.product', 'Product', readonly=True),
+ 'state': fields.selection([('draft','Draft'), ('posted','Posted')], 'State',readonly=True,
+ help='When new account move is created the state will be \'Draft\'. When all the payments are done it will be in \'Posted\' state.'),
+ 'state_2': fields.selection([('draft','Draft'), ('valid','Valid')], 'State of Move Line', readonly=True,
+ help='When new move line is created the state will be \'Draft\'.\n* When all the payments are done it will be in \'Valid\' state.'),
+ 'partner_id': fields.many2one('res.partner','Partner', readonly=True),
+ 'period_id2': fields.many2one('account.period', 'Move Line Period', readonly=True),
+ 'analytic_account_id' : fields.many2one('account.analytic.account', 'Analytic Account', readonly=True),
+ 'journal_id2': fields.many2one('account.journal', 'Move Line Journal', readonly=True),
+ 'type': fields.selection([
+ ('pay_voucher','Cash Payment'),
+ ('bank_pay_voucher','Bank Payment'),
+ ('rec_voucher','Cash Receipt'),
+ ('bank_rec_voucher','Bank Receipt'),
+ ('cont_voucher','Contra'),
+ ('journal_sale_vou','Journal Sale'),
+ ('journal_pur_voucher','Journal Purchase'),
+ ('journal_voucher','Journal Voucher'),
+ ],'Type',readonly=True),
+ 'quantity': fields.float('Products Quantity', digits=(16,2), readonly=True),
+ 'company_id': fields.many2one('res.company', 'Company', readonly=True),
+ }
+ _order = 'date desc'
+
+ def init(self, cr):
+ tools.drop_view_if_exists(cr, 'account_entries_report')
+ cr.execute("""
+ create or replace view account_entries_report as (
+ select
+ min(l.id) as id,
+ am.ref as ref,
+ sum(l.quantity) as quantity,
+ am.state as state,
+ l.state as state_2,
+ am.date as date,
+ count(l.id) as nbr,
+ count(distinct am.id) as nbl,
+ l.debit as amount,
+ to_char(am.date, 'YYYY') as year,
+ to_char(am.date, 'MM') as month,
+ to_char(am.date, 'YYYY-MM-DD') as day,
+ am.company_id as company_id,
+ l.account_id as account_id,
+ l.analytic_account_id as analytic_account_id,
+ l.date_created as date_created,
+ l.date_maturity as date_maturity,
+ am.journal_id as journal_id,
+ l.journal_id as journal_id2,
+ l.period_id as period_id2,
+ am.period_id as period_id,
+ l.partner_id as partner_id,
+ l.product_id as product_id,
+ am.type as type
+ from
+ account_move_line l
+ left join
+ account_move am on (am.id=l.move_id)
+ group by am.ref,
+ am.state,
+ am.date,
+ am.company_id,
+ am.journal_id,
+ l.journal_id,
+ am.period_id,
+ l.period_id,
+ am.type,
+ l.partner_id,
+ l.analytic_account_id,
+ l.product_id,
+ l.date_created,
+ l.date_maturity,
+ l.account_id,
+ l.state,
+ l.debit
+ )
+ """)
+
+account_entries_report()
diff --git a/addons/account/report/account_entries_report_view.xml b/addons/account/report/account_entries_report_view.xml
new file mode 100644
index 00000000000..c6308ec9928
--- /dev/null
+++ b/addons/account/report/account_entries_report_view.xml
@@ -0,0 +1,127 @@
+
+
+
+
+ account.entries.report.tree
+ account.entries.report
+ tree
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ account.entries.report.graph
+ account.entries.report
+ graph
+
+
+
+
+
+
+
+
+ account.entries.report.search
+ account.entries.report
+ search
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Entries
+ account.entries.report
+ form
+ tree,graph
+ {'search_default_This Month':1,'search_default_Journal':1,'group_by_no_leaf':1,'group_by':[]}
+
+
+
+
+
diff --git a/addons/account/report/account_invoice_report.py b/addons/account/report/account_invoice_report.py
index 36fa5a0d132..cd1477e79cf 100644
--- a/addons/account/report/account_invoice_report.py
+++ b/addons/account/report/account_invoice_report.py
@@ -61,6 +61,13 @@ class account_invoice_report(osv.osv):
('paid','Done'),
('cancel','Cancelled')
], 'Order State', readonly=True),
+ 'date_due': fields.date('Due Date', readonly=True),
+ 'address_contact_id': fields.many2one('res.partner.address', 'Contact Address Name', readonly=True),
+ 'address_invoice_id': fields.many2one('res.partner.address', 'Invoice Address Name', readonly=True),
+ 'account_id': fields.many2one('account.account', 'Account',readonly=True),
+ 'partner_bank': fields.many2one('res.partner.bank', 'Bank Account',readonly=True),
+ 'residual':fields.float('Total Residual', readonly=True),
+ 'delay_to_pay':fields.float('Avg. Delay To Pay', readonly=True, group_operator="avg"),
}
_order = 'date desc'
def init(self, cr):
@@ -87,12 +94,24 @@ class account_invoice_report(osv.osv):
(sum(l.quantity*l.price_unit)/sum(l.quantity * u.factor))::decimal(16,2) as price_average,
count(*) as nbr,
s.type as type,
- s.state
- from
+ s.state,
+ s.date_due as date_due,
+ s.address_contact_id as address_contact_id,
+ s.address_invoice_id as address_invoice_id,
+ s.account_id as account_id,
+ s.partner_bank as partner_bank,
+ s.residual as residual,
+ case when s.state != 'paid' then null else
+ extract(epoch from avg(am.date_created-l.create_date))/(24*60*60)::decimal(16,2)
+ end as delay_to_pay
+ from
account_invoice_line l
left join
account_invoice s on (s.id=l.invoice_id)
- left join product_uom u on (u.id=l.uos_id)
+ left join product_uom u on (u.id=l.uos_id),
+ account_move_line am left join account_invoice i on (i.move_id=am.move_id)
+ where
+ am.account_id=i.account_id
group by
s.type,
s.date_invoice,
@@ -101,12 +120,18 @@ class account_invoice_report(osv.osv):
l.uos_id,
s.user_id,
s.state,
+ s.residual,
s.company_id,
s.payment_term,
s.period_id,
s.fiscal_position,
s.currency_id,
- s.journal_id
+ s.journal_id,
+ s.date_due,
+ s.address_contact_id,
+ s.address_invoice_id,
+ s.account_id,
+ s.partner_bank
)
""")
account_invoice_report()
diff --git a/addons/account/report/account_invoice_report_view.xml b/addons/account/report/account_invoice_report_view.xml
index 5a833e454fb..0aad5dca794 100644
--- a/addons/account/report/account_invoice_report_view.xml
+++ b/addons/account/report/account_invoice_report_view.xml
@@ -17,7 +17,6 @@
-
@@ -27,6 +26,13 @@
+
+
+
+
+
+
+
@@ -49,14 +55,14 @@
search
-
-
+
-
+
+ help="Invoices of last 30 days"/>
+
-
-
-
+
+
-
-
-
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
-
-
-
-
-
+
-
-
+
+
+
+
+
+
+
+
-
+
-
+
@@ -145,7 +155,7 @@
-
+
diff --git a/addons/account/report/account_report_view.xml b/addons/account/report/account_report_view.xml
index f0f67b477e3..9b1688730aa 100644
--- a/addons/account/report/account_report_view.xml
+++ b/addons/account/report/account_report_view.xml
@@ -47,7 +47,7 @@
form
tree,graph
-
+
@@ -116,7 +116,7 @@
-
+
report.account.sales.tree
@@ -169,7 +169,7 @@
graph,tree
-
+
@@ -237,7 +237,7 @@
graph,tree
-
+
diff --git a/addons/account_coda/__init__.py b/addons/account_coda/__init__.py
new file mode 100644
index 00000000000..af866f5dc70
--- /dev/null
+++ b/addons/account_coda/__init__.py
@@ -0,0 +1,25 @@
+# -*- 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 .
+#
+##############################################################################
+
+import coda
+import wizard
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
diff --git a/addons/account_coda/__openerp__.py b/addons/account_coda/__openerp__.py
new file mode 100644
index 00000000000..306098d137b
--- /dev/null
+++ b/addons/account_coda/__openerp__.py
@@ -0,0 +1,39 @@
+# -*- 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 .
+#
+##############################################################################
+
+{
+ "name":"Account CODA - import bank statements from coda file",
+ "version":"1.0",
+ "author":"Tiny",
+ "category":"Account CODA",
+ "description":"""Module provides functionality to import
+ bank statements from coda files.
+ """,
+ "depends":["base", "account"],
+ "demo_xml":["coda_demo.xml"],
+ "init_xml":[],
+ "update_xml" : ["security/ir.model.access.csv","coda_wizard.xml","coda_view.xml"],
+ "active":False,
+ "installable":True,
+
+}
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
diff --git a/addons/account_coda/coda.py b/addons/account_coda/coda.py
new file mode 100644
index 00000000000..f37b563c245
--- /dev/null
+++ b/addons/account_coda/coda.py
@@ -0,0 +1,50 @@
+# -*- 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 .
+#
+##############################################################################
+
+import time
+from osv import osv,fields
+
+class account_coda(osv.osv):
+ _name = "account.coda"
+ _description = "coda for an Account"
+ _columns = {
+ 'name': fields.binary('Coda file', readonly=True),
+ 'statement_ids': fields.one2many('account.bank.statement','coda_id','Generated Bank Statement', readonly=True),
+ 'note': fields.text('Import log', readonly=True),
+ 'journal_id': fields.many2one('account.journal','Bank Journal', readonly=True,select=True),
+ 'date': fields.date('Import Date', readonly=True,select=True),
+ 'user_id': fields.many2one('res.users','User', readonly=True, select=True),
+ }
+ _defaults = {
+ 'date': lambda *a: time.strftime('%Y-%m-%d'),
+ 'user_id': lambda self,cr,uid,context: uid,
+ }
+account_coda()
+
+class account_bank_statement(osv.osv):
+ _inherit = "account.bank.statement"
+ _columns = {
+ 'coda_id':fields.many2one('account.coda','Coda'),
+ }
+account_bank_statement()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
diff --git a/addons/account_coda/coda_demo.xml b/addons/account_coda/coda_demo.xml
new file mode 100644
index 00000000000..f91d34d4cbc
--- /dev/null
+++ b/addons/account_coda/coda_demo.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/addons/account_coda/coda_view.xml b/addons/account_coda/coda_view.xml
new file mode 100644
index 00000000000..3813fe40bf0
--- /dev/null
+++ b/addons/account_coda/coda_view.xml
@@ -0,0 +1,63 @@
+
+
+
+
+
+ account.coda.form
+ account.coda
+ form
+
+
+
+
+
+
+
+ account.coda.tree
+ account.coda
+ tree
+
+
+
+
+
+
+
+
+
+
+ Coda import
+ ir.actions.act_window
+ account.coda
+ form
+ tree,form
+
+
+
+
+
+
+
+
+
+
diff --git a/addons/account_coda/coda_wizard.xml b/addons/account_coda/coda_wizard.xml
new file mode 100644
index 00000000000..ecd8eb65913
--- /dev/null
+++ b/addons/account_coda/coda_wizard.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
diff --git a/addons/account_coda/i18n/account_coda.pot b/addons/account_coda/i18n/account_coda.pot
new file mode 100644
index 00000000000..348fb035c0d
--- /dev/null
+++ b/addons/account_coda/i18n/account_coda.pot
@@ -0,0 +1,163 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+# * account_coda
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 5.0.6\n"
+"Report-Msgid-Bugs-To: support@openerp.com\n"
+"POT-Creation-Date: 2009-11-24 13:11:29+0000\n"
+"PO-Revision-Date: 2009-11-24 13:11:29+0000\n"
+"Last-Translator: <>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Plural-Forms: \n"
+
+#. module: account_coda
+#: field:account.coda,journal_id:0
+#: wizard_field:account.coda_import,init,journal_id:0
+msgid "Bank Journal"
+msgstr ""
+
+#. module: account_coda
+#: constraint:ir.model:0
+msgid "The Object name must start with x_ and not contain any special character !"
+msgstr ""
+
+#. module: account_coda
+#: wizard_field:account.coda_import,extraction,note:0
+msgid "Log"
+msgstr ""
+
+#. module: account_coda
+#: wizard_button:account.coda_import,extraction,open:0
+msgid "_Open Statement"
+msgstr ""
+
+#. module: account_coda
+#: model:ir.module.module,shortdesc:account_coda.module_meta_information
+msgid "Account CODA"
+msgstr ""
+
+#. module: account_coda
+#: field:account.coda,name:0
+msgid "Coda file"
+msgstr ""
+
+#. module: account_coda
+#: wizard_view:account.coda_import,init:0
+msgid "Clic on 'New' to select your file :"
+msgstr ""
+
+#. module: account_coda
+#: model:ir.actions.wizard,name:account_coda.wizard_account_coda_import
+msgid "Import Coda File"
+msgstr ""
+
+#. module: account_coda
+#: constraint:ir.actions.act_window:0
+msgid "Invalid model name in the action definition."
+msgstr ""
+
+#. module: account_coda
+#: field:account.coda,note:0
+msgid "Import log"
+msgstr ""
+
+#. module: account_coda
+#: wizard_field:account.coda_import,init,def_receivable:0
+msgid "Default receivable Account"
+msgstr ""
+
+#. module: account_coda
+#: model:ir.module.module,description:account_coda.module_meta_information
+msgid "Module provides functionality to import\n"
+" bank statements from .csv file.\n"
+" Import coda file wizard is used to import bank statements."
+msgstr ""
+
+#. module: account_coda
+#: wizard_button:account.coda_import,extraction,end:0
+msgid "_Close"
+msgstr ""
+
+#. module: account_coda
+#: field:account.coda,statement_id:0
+msgid "Generated Bank Statement"
+msgstr ""
+
+#. module: account_coda
+#: view:account.coda:0
+#: model:ir.actions.act_window,name:account_coda.act_account_payment_account_bank_statement
+#: model:ir.actions.act_window,name:account_coda.action_account_coda
+msgid "Coda import"
+msgstr ""
+
+#. module: account_coda
+#: field:account.coda,user_id:0
+msgid "User"
+msgstr ""
+
+#. module: account_coda
+#: constraint:ir.ui.view:0
+msgid "Invalid XML for View Architecture!"
+msgstr ""
+
+#. module: account_coda
+#: model:ir.model,name:account_coda.model_account_coda
+msgid "coda for an Account"
+msgstr ""
+
+#. module: account_coda
+#: wizard_field:account.coda_import,init,def_payable:0
+msgid "Default Payable Account"
+msgstr ""
+
+#. module: account_coda
+#: model:ir.ui.menu,name:account_coda.menu_account_coda
+msgid "Coda Statements"
+msgstr ""
+
+#. module: account_coda
+#: model:ir.ui.menu,name:account_coda.menu_account_coda_wizard
+msgid "Import Coda Statements"
+msgstr ""
+
+#. module: account_coda
+#: wizard_button:account.coda_import,init,extraction:0
+msgid "_Ok"
+msgstr ""
+
+#. module: account_coda
+#: wizard_view:account.coda_import,extraction:0
+#: wizard_view:account.coda_import,init:0
+msgid "Import Coda Statement"
+msgstr ""
+
+#. module: account_coda
+#: field:account.bank.statement,coda_id:0
+msgid "Coda"
+msgstr ""
+
+#. module: account_coda
+#: wizard_view:account.coda_import,extraction:0
+msgid "Results :"
+msgstr ""
+
+#. module: account_coda
+#: wizard_field:account.coda_import,init,coda:0
+msgid "Coda File"
+msgstr ""
+
+#. module: account_coda
+#: field:account.coda,date:0
+msgid "Import Date"
+msgstr ""
+
+#. module: account_coda
+#: wizard_view:account.coda_import,init:0
+msgid "Select your bank journal :"
+msgstr ""
+
diff --git a/addons/account_coda/i18n/fr_BE.po b/addons/account_coda/i18n/fr_BE.po
new file mode 100644
index 00000000000..348fb035c0d
--- /dev/null
+++ b/addons/account_coda/i18n/fr_BE.po
@@ -0,0 +1,163 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+# * account_coda
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 5.0.6\n"
+"Report-Msgid-Bugs-To: support@openerp.com\n"
+"POT-Creation-Date: 2009-11-24 13:11:29+0000\n"
+"PO-Revision-Date: 2009-11-24 13:11:29+0000\n"
+"Last-Translator: <>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Plural-Forms: \n"
+
+#. module: account_coda
+#: field:account.coda,journal_id:0
+#: wizard_field:account.coda_import,init,journal_id:0
+msgid "Bank Journal"
+msgstr ""
+
+#. module: account_coda
+#: constraint:ir.model:0
+msgid "The Object name must start with x_ and not contain any special character !"
+msgstr ""
+
+#. module: account_coda
+#: wizard_field:account.coda_import,extraction,note:0
+msgid "Log"
+msgstr ""
+
+#. module: account_coda
+#: wizard_button:account.coda_import,extraction,open:0
+msgid "_Open Statement"
+msgstr ""
+
+#. module: account_coda
+#: model:ir.module.module,shortdesc:account_coda.module_meta_information
+msgid "Account CODA"
+msgstr ""
+
+#. module: account_coda
+#: field:account.coda,name:0
+msgid "Coda file"
+msgstr ""
+
+#. module: account_coda
+#: wizard_view:account.coda_import,init:0
+msgid "Clic on 'New' to select your file :"
+msgstr ""
+
+#. module: account_coda
+#: model:ir.actions.wizard,name:account_coda.wizard_account_coda_import
+msgid "Import Coda File"
+msgstr ""
+
+#. module: account_coda
+#: constraint:ir.actions.act_window:0
+msgid "Invalid model name in the action definition."
+msgstr ""
+
+#. module: account_coda
+#: field:account.coda,note:0
+msgid "Import log"
+msgstr ""
+
+#. module: account_coda
+#: wizard_field:account.coda_import,init,def_receivable:0
+msgid "Default receivable Account"
+msgstr ""
+
+#. module: account_coda
+#: model:ir.module.module,description:account_coda.module_meta_information
+msgid "Module provides functionality to import\n"
+" bank statements from .csv file.\n"
+" Import coda file wizard is used to import bank statements."
+msgstr ""
+
+#. module: account_coda
+#: wizard_button:account.coda_import,extraction,end:0
+msgid "_Close"
+msgstr ""
+
+#. module: account_coda
+#: field:account.coda,statement_id:0
+msgid "Generated Bank Statement"
+msgstr ""
+
+#. module: account_coda
+#: view:account.coda:0
+#: model:ir.actions.act_window,name:account_coda.act_account_payment_account_bank_statement
+#: model:ir.actions.act_window,name:account_coda.action_account_coda
+msgid "Coda import"
+msgstr ""
+
+#. module: account_coda
+#: field:account.coda,user_id:0
+msgid "User"
+msgstr ""
+
+#. module: account_coda
+#: constraint:ir.ui.view:0
+msgid "Invalid XML for View Architecture!"
+msgstr ""
+
+#. module: account_coda
+#: model:ir.model,name:account_coda.model_account_coda
+msgid "coda for an Account"
+msgstr ""
+
+#. module: account_coda
+#: wizard_field:account.coda_import,init,def_payable:0
+msgid "Default Payable Account"
+msgstr ""
+
+#. module: account_coda
+#: model:ir.ui.menu,name:account_coda.menu_account_coda
+msgid "Coda Statements"
+msgstr ""
+
+#. module: account_coda
+#: model:ir.ui.menu,name:account_coda.menu_account_coda_wizard
+msgid "Import Coda Statements"
+msgstr ""
+
+#. module: account_coda
+#: wizard_button:account.coda_import,init,extraction:0
+msgid "_Ok"
+msgstr ""
+
+#. module: account_coda
+#: wizard_view:account.coda_import,extraction:0
+#: wizard_view:account.coda_import,init:0
+msgid "Import Coda Statement"
+msgstr ""
+
+#. module: account_coda
+#: field:account.bank.statement,coda_id:0
+msgid "Coda"
+msgstr ""
+
+#. module: account_coda
+#: wizard_view:account.coda_import,extraction:0
+msgid "Results :"
+msgstr ""
+
+#. module: account_coda
+#: wizard_field:account.coda_import,init,coda:0
+msgid "Coda File"
+msgstr ""
+
+#. module: account_coda
+#: field:account.coda,date:0
+msgid "Import Date"
+msgstr ""
+
+#. module: account_coda
+#: wizard_view:account.coda_import,init:0
+msgid "Select your bank journal :"
+msgstr ""
+
diff --git a/addons/account_coda/security/ir.model.access.csv b/addons/account_coda/security/ir.model.access.csv
new file mode 100644
index 00000000000..9c1e0a486dc
--- /dev/null
+++ b/addons/account_coda/security/ir.model.access.csv
@@ -0,0 +1,3 @@
+"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
+"access_account_coda","account.coda","model_account_coda","account.group_account_user",1,0,0,0
+"access_account_coda_manager","account.coda","model_account_coda","account.group_account_manager",1,1,1,1
\ No newline at end of file
diff --git a/addons/account_coda/statement_coda.txt b/addons/account_coda/statement_coda.txt
new file mode 100644
index 00000000000..44fe70220ca
--- /dev/null
+++ b/addons/account_coda/statement_coda.txt
@@ -0,0 +1,10 @@
+0000006060712505 00000CPH CODA TINY 0047747270100477472701 00000 1
+1 049126201326907 EUR0BE 0000000015632900050607TINY COMPTE COURANT ORDINAIRE 049
+2100010000 0000000001150000060607001500000INVOICE OF 2006-12-19 0606070020100
+2200010000 EUR000000001150000 100
+2300010000301915554082 PROLIBRE SARL CAROUGE GE 000
+2100020000 0000000000500000060607001500000CONTRACT PARTNER ERREUR ECART YEA 0606070030100
+2200020000RTY CONTRACT PARTNER EUR000000000500000 100
+2300020000050000000017 SEDNACOM 43 ALLEE DES FOUGERES 9522 0 HERBLAY 000
+8049126201326907 0000000017282900060607
+9 000008000000000000000000000001650000 2
diff --git a/addons/account_coda/wizard/__init__.py b/addons/account_coda/wizard/__init__.py
new file mode 100644
index 00000000000..72d3b950cf7
--- /dev/null
+++ b/addons/account_coda/wizard/__init__.py
@@ -0,0 +1,25 @@
+# -*- 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 .
+#
+##############################################################################
+
+import coda_import
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
diff --git a/addons/account_coda/wizard/coda_import.py b/addons/account_coda/wizard/coda_import.py
new file mode 100644
index 00000000000..5e1ffa365e8
--- /dev/null
+++ b/addons/account_coda/wizard/coda_import.py
@@ -0,0 +1,339 @@
+# -*- 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 .
+#
+##############################################################################
+
+import pooler
+import time
+import datetime
+import wizard
+import netsvc
+import base64
+from osv import osv
+from tools.translate import _
+
+codawiz_form = """
+
+"""
+
+codawiz_fields = {
+ 'journal_id' : {
+ 'string':'Bank Journal',
+ 'type':'many2one',
+ 'relation':'account.journal',
+ 'required':True,
+
+ },
+ 'coda' : {
+ 'string':'Coda File',
+ 'type':'binary',
+ 'required':True,
+ },
+ 'def_payable' : {
+ 'string' : 'Default Payable Account',
+ 'type' : 'many2one',
+ 'relation': 'account.account',
+ 'required':True,
+ 'domain':[('type','=','payable')],
+ 'help': 'Set here the payable account that will be used, by default, if the partner is not found',
+ },
+ 'def_receivable' : {
+ 'string' : 'Default receivable Account',
+ 'type' : 'many2one',
+ 'relation': 'account.account',
+ 'required':True,
+ 'domain':[('type','=','receivable')],
+ 'help': 'Set here the receivable account that will be used, by default, if the partner is not found',
+ },
+ 'awaiting_account' : {
+ 'string' : 'Default Account for Unrecognized Movement',
+ 'type' : 'many2one',
+ 'relation': 'account.account',
+ 'required':True,
+ 'help': 'Set here the default account that will be used, if the partner is found but does not have the bank account , or if he is domiciled',
+
+ }
+
+}
+
+result_form = """
+
+"""
+
+result_fields = {
+
+ 'note' : {'string':'Log','type':'text'}
+
+}
+
+
+def _coda_parsing(self, cr, uid, data, context):
+ pool = pooler.get_pool(cr.dbname)
+ codafile = data['form']['coda']
+ journal_code = pool.get('account.journal').browse(cr, uid, data['form']['journal_id'], context).code
+ def_pay_acc = data['form']['def_payable']
+ def_rec_acc = data['form']['def_receivable']
+
+ str_log = ""
+ err_log = "Errors:\n------\n"
+ nb_err=0
+ std_log=''
+ str_log1 = "Coda File is Imported : "
+ str_not=''
+ str_not1=''
+
+ bank_statements=[]
+ recordlist = base64.decodestring(codafile).split('\n')
+ recordlist.pop()
+ for line in recordlist:
+ if line[0] == '0':
+ # header data
+ bank_statement = {}
+ bank_statement["bank_statement_line"]={}
+ bank_statement_lines = {}
+ bank_statement['date'] = str2date(line[5:11])
+ bank_statement['journal_id']=data['form']['journal_id']
+ period_id = pool.get('account.period').search(cr,uid,[('date_start','<=',time.strftime('%Y-%m-%d',time.strptime(bank_statement['date'],"%y/%m/%d"))),('date_stop','>=',time.strftime('%Y-%m-%d',time.strptime(bank_statement['date'],"%y/%m/%d")))])
+ bank_statement['period_id'] = period_id[0]
+ bank_statement['state']='draft'
+ elif line[0] == '1':
+ # old balance data
+ bal_start = list2float(line[43:58])
+ if line[42] == '1':
+ bal_start = - bal_start
+ bank_statement["balance_start"]= bal_start
+ bank_statement["acc_number"]=line[5:17]
+ bank_statement["acc_holder"]=line[64:90]
+ bank_statement['name'] = journal_code + ' ' + str(line[2:5])
+
+ elif line[0]=='2':
+ # movement data record 2
+ if line[1]=='1':
+ # movement data record 2.1
+ if bank_statement_lines.has_key(line[2:6]):
+ continue
+ st_line = {}
+ st_line['extra_note'] = ''
+ st_line['statement_id']=0
+ st_line['ref'] = line[2:10]
+ st_line['date'] = time.strftime('%Y-%m-%d',time.strptime(str2date(line[115:121]),"%y/%m/%d")),
+ st_line_amt = list2float(line[32:47])
+
+ if line[61]=='1':
+ st_line['toreconcile'] = True
+ st_line['name']=line[65:77]
+ else:
+ st_line['toreconcile'] = False
+ st_line['name']=line[62:115]
+
+ st_line['free_comm'] = st_line['name']
+ st_line['val_date']=time.strftime('%Y-%m-%d',time.strptime(str2date(line[47:53]),"%y/%m/%d")),
+ st_line['entry_date']=time.strftime('%Y-%m-%d',time.strptime(str2date(line[115:121]),"%y/%m/%d")),
+ st_line['partner_id']=0
+ if line[31] == '1':
+ st_line_amt = - st_line_amt
+ st_line['account_id'] = def_pay_acc
+ else:
+ st_line['account_id'] = def_rec_acc
+ st_line['amount'] = st_line_amt
+ bank_statement_lines[line[2:6]]=st_line
+ bank_statement["bank_statement_line"]=bank_statement_lines
+ elif line[1] == '2':
+ st_line_name = line[2:6]
+ bank_statement_lines[st_line_name].update({'account_id': data['form']['awaiting_account']})
+
+ elif line[1] == '3':
+ # movement data record 3.1
+ st_line_name = line[2:6]
+ st_line_partner_acc = str(line[10:47]).strip()
+ cntry_number=line[10:47].strip()
+ contry_name=line[47:125].strip()
+ bank_ids = pool.get('res.partner.bank').search(cr,uid,[('acc_number','=',st_line_partner_acc)])
+ bank_statement_lines[st_line_name].update({'cntry_number': cntry_number, 'contry_name': contry_name})
+ if bank_ids:
+ bank = pool.get('res.partner.bank').browse(cr,uid,bank_ids[0],context)
+ if line and bank.partner_id:
+ bank_statement_lines[st_line_name].update({'partner_id': bank.partner_id.id})
+ if bank_statement_lines[st_line_name]['amount'] < 0 :
+ bank_statement_lines[st_line_name].update({'account_id': bank.partner_id.property_account_payable.id})
+ else :
+ bank_statement_lines[st_line_name].update({'account_id': bank.partner_id.property_account_receivable.id})
+ else:
+ nb_err += 1
+ err_log += _('The bank account %s is not defined for the partner %s.\n')%(cntry_number,contry_name)
+ bank_statement_lines[st_line_name].update({'account_id': data['form']['awaiting_account']})
+
+ bank_statement["bank_statement_line"]=bank_statement_lines
+ elif line[0]=='3':
+ if line[1] == '1':
+ st_line_name = line[2:6]
+ bank_statement_lines[st_line_name]['extra_note'] += '\n' + line[40:113]
+ elif line[1] == '2':
+ st_line_name = line[2:6]
+ bank_statement_lines[st_line_name]['extra_note'] += '\n' + line[10:115]
+ elif line[1] == '3':
+ st_line_name = line[2:6]
+ bank_statement_lines[st_line_name]['extra_note'] += '\n' + line[10:100]
+ elif line[0]=='8':
+ # new balance record
+ bal_end = list2float(line[42:57])
+ if line[41] == '1':
+ bal_end = - bal_end
+ bank_statement["balance_end_real"]= bal_end
+
+ elif line[0]=='9':
+ # footer record
+ bank_statements.append(bank_statement)
+ #end for
+ bkst_list=[]
+ for statement in bank_statements:
+ try:
+ bk_st_id = pool.get('account.bank.statement').create(cr,uid,{
+ 'journal_id': statement['journal_id'],
+ 'date':time.strftime('%Y-%m-%d',time.strptime(statement['date'],"%y/%m/%d")),
+ 'period_id':statement['period_id'],
+ 'balance_start': statement["balance_start"],
+ 'balance_end_real': statement["balance_end_real"],
+ 'state': 'draft',
+ 'name': statement['name'],
+ })
+ lines=statement["bank_statement_line"]
+ for value in lines:
+ line=lines[value]
+ reconcile_id = False
+ if line['toreconcile']:
+ rec_id = pool.get('account.move.line').search(cr, uid, [('name','=',line['name']),('reconcile_id','=',False),('account_id.reconcile','=',True)])
+ if rec_id:
+ reconcile_id = pool.get('account.bank.statement.reconcile').create(cr, uid, {
+ 'line_ids': [(6, 0, rec_id)]
+ }, context=context)
+ str_not1 = ''
+ if line.has_key('contry_name') and line.has_key('cntry_number'):
+ str_not1="Partner name:%s \n Partner Account Number:%s \n Communication:%s \n Value Date:%s \n Entry Date:%s \n"%(line["contry_name"],line["cntry_number"],line["free_comm"]+line['extra_note'],line["val_date"][0],line["entry_date"][0])
+ id=pool.get('account.bank.statement.line').create(cr,uid,{
+ 'name':line['name'],
+ 'date': line['date'],
+ 'amount': line['amount'],
+ 'partner_id':line['partner_id'] or 0,
+ 'account_id':line['account_id'],
+ 'statement_id': bk_st_id,
+ 'reconcile_id': reconcile_id,
+ 'note':str_not1,
+ 'ref':line['ref'],
+ })
+
+ str_not= "\n \n Account Number: %s \n Account Holder Name: %s " %(statement["acc_number"],statement["acc_holder"])
+ std_log += "\nStatement : %s , Date : %s, Starting Balance : %.2f , Ending Balance : %.2f \n"\
+ %(statement['name'], statement['date'], float(statement["balance_start"]), float(statement["balance_end_real"]))
+ bkst_list.append(bk_st_id)
+
+ except osv.except_osv, e:
+ cr.rollback()
+ nb_err+=1
+ err_log += '\n Application Error : ' + str(e)
+ raise # REMOVEME
+
+ except Exception, e:
+ cr.rollback()
+ nb_err+=1
+ err_log += '\n System Error : '+str(e)
+ raise # REMOVEME
+ except :
+ cr.rollback()
+ nb_err+=1
+ err_log += '\n Unknown Error'
+ raise
+ err_log += '\n\nNumber of statements : '+ str(len(bkst_list))
+ err_log += '\nNumber of error :'+ str(nb_err) +'\n'
+
+ pool.get('account.coda').create(cr, uid,{
+ 'name':codafile,
+ 'statement_ids': [(6, 0, bkst_list,)],
+ 'note':str_log1+str_not+std_log+err_log,
+ 'journal_id':data['form']['journal_id'],
+ 'date':time.strftime("%Y-%m-%d"),
+ 'user_id':uid,
+ })
+
+ return {'note':str_log1 + std_log + err_log ,'journal_id': data['form']['journal_id'], 'coda': data['form']['coda'],'statment_ids':bkst_list}
+
+
+def str2date(date_str):
+ return time.strftime("%y/%m/%d",time.strptime(date_str,"%d%m%y"))
+
+def str2float(str):
+ try:
+ return float(str)
+ except:
+ return 0.0
+
+def list2float(lst):
+ try:
+ return str2float((lambda s : s[:-3] + '.' + s[-3:])(lst))
+ except:
+ return 0.0
+
+class coda_import(wizard.interface):
+ def _action_open_window(self, cr, uid, data, context):
+ form=data['form']
+ return {
+ 'domain':"[('id','in',%s)]"%(form['statment_ids']),
+ 'name': 'Statement',
+ 'view_type': 'form',
+ 'view_mode': 'tree,form',
+ 'res_model': 'account.bank.statement',
+ 'view_id': False,
+ 'type': 'ir.actions.act_window',
+ }
+ states = {
+ 'init' : {
+ 'actions' : [],
+ 'result' : {'type' : 'form',
+ 'arch' : codawiz_form,
+ 'fields' : codawiz_fields,
+ 'state' : [('end', '_Close'),('extraction', '_Ok') ]}
+ },
+ 'extraction' : {
+ 'actions' : [_coda_parsing],
+ 'result' : {'type' : 'form',
+ 'arch' : result_form,
+ 'fields' : result_fields,
+ 'state' : [('end', '_Close'),('open', '_Open Statement')]}
+ },
+ 'open': {
+ 'actions': [],
+ 'result': {'type': 'action', 'action': _action_open_window, 'state': 'end'}
+
+ },
+
+ }
+coda_import("account.coda_import")
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/audittrail/i18n/fr.po b/addons/audittrail/i18n/fr.po
index 12c15bb34f4..fbe01ff7c9b 100644
--- a/addons/audittrail/i18n/fr.po
+++ b/addons/audittrail/i18n/fr.po
@@ -7,19 +7,19 @@ msgstr ""
"Project-Id-Version: OpenERP Server 5.0.0\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2009-08-28 16:01+0000\n"
-"PO-Revision-Date: 2009-09-08 14:56+0000\n"
-"Last-Translator: Fabien (Open ERP) \n"
+"PO-Revision-Date: 2010-05-21 17:51+0000\n"
+"Last-Translator: Christophe Chauvet - http://www.syleam.fr/ \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2010-04-17 04:17+0000\n"
+"X-Launchpad-Export-Date: 2010-05-22 04:00+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: audittrail
#: model:ir.module.module,shortdesc:audittrail.module_meta_information
msgid "Audit Trail"
-msgstr ""
+msgstr "Rapport de l' audit"
#. module: audittrail
#: constraint:ir.model:0
@@ -72,7 +72,7 @@ msgstr "Ancienne valeur"
#. module: audittrail
#: constraint:ir.actions.act_window:0
msgid "Invalid model name in the action definition."
-msgstr ""
+msgstr "Nom de modèle invalide pour la définition de l'action"
#. module: audittrail
#: model:ir.actions.wizard,name:audittrail.wizard_audittrail_log
@@ -143,7 +143,7 @@ msgstr "Règle AuditTrail"
#. module: audittrail
#: wizard_field:audittrail.view.log,init,to:0
msgid "Log To"
-msgstr ""
+msgstr "Connecter à"
#. module: audittrail
#: view:audittrail.log:0
@@ -158,6 +158,10 @@ msgid ""
" Subscribe Rules for read, write, create and delete on objects and check "
"logs"
msgstr ""
+"Autorise un administrateur à tracer toutes les manipulations des "
+"utilisateurs sur tous les objets du système.\n"
+" Règles d'abonnement pour la lecture, l'écriture, la création, la "
+"suppression des objets et la consultation des journaux"
#. module: audittrail
#: field:audittrail.log,timestamp:0
diff --git a/addons/base_calendar/__openerp__.py b/addons/base_calendar/__openerp__.py
index c1b30890e68..7eaf68fd5d5 100644
--- a/addons/base_calendar/__openerp__.py
+++ b/addons/base_calendar/__openerp__.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
-#
+#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL ().
#
@@ -15,7 +15,7 @@
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
+# along with this program. If not, see .
#
##############################################################################
@@ -26,23 +26,24 @@
'description': """Full featured calendar system that supports:
- Alerts (create requests)
- Recurring events (*)
- - Invitations to others people""",
- "author" : "Tiny",
- 'category': 'Generic Modules/Others',
- 'website': 'http://www.openerp.com',
+ - Invitations to others people""",
+ "author" : "Tiny",
+ 'category': 'Generic Modules/Others',
+ 'website': 'http://www.openerp.com',
"init_xml" : [
'base_calendar_data.xml'
- ],
- "demo_xml" : [],
+ ],
+ "demo_xml" : [],
"update_xml" : [
'security/ir.model.access.csv',
- 'wizard/calendar_event_edit_all_view.xml',
- 'wizard/base_calendar_invite_attendee_view.xml',
+ 'wizard/calendar_event_edit_all_view.xml',
+ 'wizard/base_calendar_invite_attendee_view.xml',
+ 'wizard/base_calendar_set_exrule_view.xml',
'base_calendar_view.xml'
- ],
- "test" : ['test/base_calendar_test.yml'],
- "installable" : True,
- "active" : False,
+ ],
+ # "test" : ['test/base_calendar_test.yml'],
+ "installable" : True,
+ "active" : False,
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/base_calendar/base_calendar.py b/addons/base_calendar/base_calendar.py
index c53bf131002..4c3940301b3 100644
--- a/addons/base_calendar/base_calendar.py
+++ b/addons/base_calendar/base_calendar.py
@@ -44,7 +44,6 @@ def get_recurrent_dates(rrulestring, exdate, startdate=None, exrule=None):
@param startdate: Startdate for computing recurrent dates
@return: List of Recurrent dates
"""
-
def todate(date):
val = parser.parse(''.join((re.compile('\d')).findall(date)))
return val
@@ -97,7 +96,7 @@ def real_id2base_calendar_id(real_id, recurrent_date):
return '%d-%s' % (real_id, recurrent_date)
return real_id
-def _links_get(self, cr, uid, context={}):
+def _links_get(self, cr, uid, context=None):
"""
Get request link.
@param cr: the current row, from the database cursor,
@@ -213,7 +212,9 @@ class calendar_attendee(osv.osv):
def _get_address(self, name=None, email=None):
"""
- Get Email Address
+ Gives email information in ical CAL-ADDRESS type format
+ @param name: Name for CAL-ADDRESS value
+ @param email: Email address for CAL-ADDRESS value
"""
if name and email:
name += ':'
@@ -221,7 +222,7 @@ class calendar_attendee(osv.osv):
def _compute_data(self, cr, uid, ids, name, arg, context):
"""
- Compute data on field.
+ Compute data on function fields for attendee values .
@param cr: the current row, from the database cursor,
@param uid: the current user’s ID for security checks,
@param ids: List of calendar attendee’s IDs.
@@ -241,6 +242,7 @@ class calendar_attendee(osv.osv):
else:
result[id][name] = self._get_address(attdata.sent_by_uid.name, \
attdata.sent_by_uid.address_id.email)
+
if name == 'cn':
if attdata.user_id:
result[id][name] = attdata.user_id.name
@@ -248,40 +250,47 @@ class calendar_attendee(osv.osv):
result[id][name] = attdata.partner_address_id.name or attdata.partner_id.name
else:
result[id][name] = attdata.email or ''
+
if name == 'delegated_to':
todata = []
for child in attdata.child_ids:
if child.email:
todata.append('MAILTO:' + child.email)
result[id][name] = ', '.join(todata)
+
if name == 'delegated_from':
fromdata = []
for parent in attdata.parent_ids:
if parent.email:
fromdata.append('MAILTO:' + parent.email)
result[id][name] = ', '.join(fromdata)
+
if name == 'event_date':
if attdata.ref:
result[id][name] = attdata.ref.date
else:
result[id][name] = False
+
if name == 'event_end_date':
if attdata.ref:
result[id][name] = attdata.ref.date_deadline
else:
result[id][name] = False
+
if name == 'sent_by_uid':
if attdata.ref:
result[id][name] = (attdata.ref.user_id.id, attdata.ref.user_id.name)
else:
result[id][name] = uid
+
if name == 'language':
user_obj = self.pool.get('res.users')
lang = user_obj.read(cr, uid, uid, ['context_lang'], context=context)['context_lang']
result[id][name] = lang.replace('_', '-')
+
return result
- def _links_get(self, cr, uid, context={}):
+ def _links_get(self, cr, uid, context=None):
"""
Get request link for ref field in calendar attendee.
@param cr: the current row, from the database cursor,
@@ -297,7 +306,7 @@ class calendar_attendee(osv.osv):
def _lang_get(self, cr, uid, context={}):
"""
- Get language for language function field.
+ Get language for language selection field.
@param cr: the current row, from the database cursor,
@param uid: the current user’s ID for security checks,
@param context: A standard dictionary for contextual values
@@ -313,60 +322,60 @@ class calendar_attendee(osv.osv):
'cutype': fields.selection([('individual', 'Individual'), \
('group', 'Group'), ('resource', 'Resource'), \
('room', 'Room'), ('unknown', '') ], \
- 'Invite Type', help="Specify the type of Invitation"),
- 'member': fields.char('Member', size=124,
- help="Indicate the groups that the attendee belongs to"),
+ 'Invite Type', help="Specify the type of Invitation"),
+ 'member': fields.char('Member', size=124,
+ help="Indicate the groups that the attendee belongs to"),
'role': fields.selection([('req-participant', 'Participation required'), \
('chair', 'Chair Person'), \
('opt-participant', 'Optional Participation'), \
('non-participant', 'For information Purpose')], 'Role', \
- help='Participation role for the calendar user'),
- 'state': fields.selection([('tentative', 'Tentative'),
- ('needs-action', 'Needs Action'),
- ('accepted', 'Accepted'),
- ('declined', 'Declined'),
+ help='Participation role for the calendar user'),
+ 'state': fields.selection([('tentative', 'Tentative'),
+ ('needs-action', 'Needs Action'),
+ ('accepted', 'Accepted'),
+ ('declined', 'Declined'),
('delegated', 'Delegated')], 'State', readonly=True, \
- help="Status of the attendee's participation"),
- 'rsvp': fields.boolean('Required Reply?',
- help="Indicats whether the favor of a reply is requested"),
+ help="Status of the attendee's participation"),
+ 'rsvp': fields.boolean('Required Reply?',
+ help="Indicats whether the favor of a reply is requested"),
'delegated_to': fields.function(_compute_data, method=True, \
string='Delegated To', type="char", size=124, store=True, \
multi='delegated_to', help="The users that the original \
-request was delegated to"),
+request was delegated to"),
'delegated_from': fields.function(_compute_data, method=True, string=\
- 'Delegated From', type="char", store=True, size=124, multi='delegated_from'),
+ 'Delegated From', type="char", store=True, size=124, multi='delegated_from'),
'parent_ids': fields.many2many('calendar.attendee', 'calendar_attendee_parent_rel', \
- 'attendee_id', 'parent_id', 'Delegrated From'),
+ 'attendee_id', 'parent_id', 'Delegrated From'),
'child_ids': fields.many2many('calendar.attendee', 'calendar_attendee_child_rel', \
- 'attendee_id', 'child_id', 'Delegrated To'),
+ 'attendee_id', 'child_id', 'Delegrated To'),
'sent_by': fields.function(_compute_data, method=True, string='Sent By', \
type="char", multi='sent_by', store=True, size=124, \
- help="Specify the user that is acting on behalf of the calendar user"),
+ help="Specify the user that is acting on behalf of the calendar user"),
'sent_by_uid': fields.function(_compute_data, method=True, string='Sent By User', \
- type="many2one", relation="res.users", multi='sent_by_uid'),
+ type="many2one", relation="res.users", multi='sent_by_uid'),
'cn': fields.function(_compute_data, method=True, string='Common name', \
- type="char", size=124, multi='cn', store=True),
+ type="char", size=124, multi='cn', store=True),
'dir': fields.char('URI Reference', size=124, help="Reference to the URI\
-that points to the directory information corresponding to the attendee."),
+that points to the directory information corresponding to the attendee."),
'language': fields.function(_compute_data, method=True, string='Language', \
type="selection", selection=_lang_get, multi='language', \
store=True, help="To specify the language for text values in a\
-property or property parameter."),
- 'user_id': fields.many2one('res.users', 'User'),
- 'partner_address_id': fields.many2one('res.partner.address', 'Contact'),
+property or property parameter."),
+ 'user_id': fields.many2one('res.users', 'User'),
+ 'partner_address_id': fields.many2one('res.partner.address', 'Contact'),
'partner_id': fields.related('partner_address_id', 'partner_id', type='many2one', \
- relation='res.partner', string='Partner', help="Partner related to contact"),
- 'email': fields.char('Email', size=124, help="Email of Invited Person"),
+ relation='res.partner', string='Partner', help="Partner related to contact"),
+ 'email': fields.char('Email', size=124, help="Email of Invited Person"),
'event_date': fields.function(_compute_data, method=True, string='Event Date', \
- type="datetime", multi='event_date'),
+ type="datetime", multi='event_date'),
'event_end_date': fields.function(_compute_data, method=True, \
string='Event End Date', type="datetime", \
- multi='event_end_date'),
- 'ref': fields.reference('Event Ref', selection=_links_get, size=128),
- 'availability': fields.selection([('free', 'Free'), ('busy', 'Busy')], 'Free/Busy', readonly="True"),
+ multi='event_end_date'),
+ 'ref': fields.reference('Event Ref', selection=_links_get, size=128),
+ 'availability': fields.selection([('free', 'Free'), ('busy', 'Busy')], 'Free/Busy', readonly="True"),
}
_defaults = {
- 'state': lambda *x: 'needs-action',
+ 'state': lambda *x: 'needs-action',
}
def get_ics_file(self, cr, uid, event_obj, context=None):
@@ -401,7 +410,7 @@ property or property parameter."),
event.add('location').value = event_obj.location
if event_obj.rrule:
event.add('rrule').value = event_obj.rrule
-
+
if event_obj.alarm_id:
# computes alarm data
valarm = event.add('valarm')
@@ -422,10 +431,10 @@ property or property parameter."),
if interval == 'minutes':
delta = timedelta(minutes=duration)
trigger.value = delta
-
+
# Compute other details
valarm.add('DESCRIPTION').value = alarm_data['name'] or 'OpenERP'
-
+
for attendee in event_obj.attendee_ids:
attendee_add = event.add('attendee')
attendee_add.params['CUTYPE'] = [str(attendee.cutype)]
@@ -435,15 +444,18 @@ property or property parameter."),
res = cal.serialize()
return res
- def _send_mail(self, cr, uid, ids, mail_to, email_from=tools.config.get('email_from', False), context={}):
+ def _send_mail(self, cr, uid, ids, mail_to, email_from=tools.config.get('email_from', False), context=None):
"""
- Send mail for calendar attendee.
+ Send mail for event invitation to event attendees.
@param cr: the current row, from the database cursor,
@param uid: the current user’s ID for security checks,
- @param ids: List of calendar attendee’s IDs.
+ @param ids: List of attendee’s IDs.
+ @param email_from: Email address for user sending the mail
@param context: A standard dictionary for contextual values
@return: True
"""
+ if not context:
+ context = {}
company = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.name
for att in self.browse(cr, uid, ids, context=context):
@@ -457,26 +469,26 @@ property or property parameter."),
att_infos.append(((att2.user_id and att2.user_id.name) or \
(att2.partner_id and att2.partner_id.name) or \
att2.email) + ' - Status: ' + att2.state.title())
- body_vals = {'name': res_obj.name,
- 'start_date': res_obj.date,
- 'end_date': res_obj.date_deadline or False,
- 'description': res_obj.description or '-',
- 'location': res_obj.location or '-',
- 'attendees': '
'.join(att_infos),
- 'user': res_obj.user_id and res_obj.user_id.name or 'OpenERP User',
- 'sign': sign,
+ body_vals = {'name': res_obj.name,
+ 'start_date': res_obj.date,
+ 'end_date': res_obj.date_deadline or False,
+ 'description': res_obj.description or '-',
+ 'location': res_obj.location or '-',
+ 'attendees': '
'.join(att_infos),
+ 'user': res_obj.user_id and res_obj.user_id.name or 'OpenERP User',
+ 'sign': sign,
'company': company
}
body = html_invitation % body_vals
attach = self.get_ics_file(cr, uid, res_obj, context=context)
if mail_to and email_from:
tools.email_send(
- email_from,
- mail_to,
- sub,
- body,
- attach=attach and [('invitation.ics', attach)] or None,
- subtype='html',
+ email_from,
+ mail_to,
+ sub,
+ body,
+ attach=attach and [('invitation.ics', attach)] or None,
+ subtype='html',
reply_to=email_from
)
return True
@@ -487,7 +499,7 @@ property or property parameter."),
@param cr: the current row, from the database cursor,
@param uid: the current user’s ID for security checks,
@param ids: List of calendar attendee’s IDs.
- @param user_id: User id
+ @param user_id: Changed value of User id
@return: dictionary of value. which put value in email and availability fields.
"""
@@ -498,24 +510,27 @@ property or property parameter."),
return {'value': {'email': user.address_id.email, 'availability':user.availability}}
def do_tentative(self, cr, uid, ids, context=None, *args):
- """ @param self: The object pointer
- @param cr: the current row, from the database cursor,
- @param uid: the current user’s ID for security checks,
- @param ids: List of calendar attendee’s IDs
- @param *args: Get Tupple value
- @param context: A standard dictionary for contextual values """
+ """ Makes event invitation as Tentative
+ @param self: The object pointer
+ @param cr: the current row, from the database cursor,
+ @param uid: the current user’s ID for security checks,
+ @param ids: List of calendar attendee’s IDs
+ @param *args: Get Tupple value
+ @param context: A standard dictionary for contextual values
+ """
self.write(cr, uid, ids, {'state': 'tentative'}, context)
def do_accept(self, cr, uid, ids, context=None, *args):
"""
- Update state which value is accepted.
+ Update state of invitation as Accepted and
+ if the invited user is other then event user it will make a copy of this event for invited user
@param cr: the current row, from the database cursor,
@param uid: the current user’s ID for security checks,
@param ids: List of calendar attendee’s IDs.
+ @param context: A standard dictionary for contextual values
@return: True
"""
-
if not context:
context = {}
@@ -532,21 +547,23 @@ property or property parameter."),
return True
def do_decline(self, cr, uid, ids, context=None, *args):
- """ @param self: The object pointer
- @param cr: the current row, from the database cursor,
- @param uid: the current user’s ID for security checks,
- @param ids: List of calendar attendee’s IDs
- @param *args: Get Tupple value
- @param context: A standard dictionary for contextual values """
+ """ Marks event invitation as Declined
+ @param self: The object pointer
+ @param cr: the current row, from the database cursor,
+ @param uid: the current user’s ID for security checks,
+ @param ids: List of calendar attendee’s IDs
+ @param *args: Get Tupple value
+ @param context: A standard dictionary for contextual values """
self.write(cr, uid, ids, {'state': 'declined'}, context)
def create(self, cr, uid, vals, context=None):
- """ @param self: The object pointer
- @param cr: the current row, from the database cursor,
- @param uid: the current user’s ID for security checks,
- @param vals: Get Values
- @param context: A standard dictionary for contextual values """
+ """ Overrides orm create method.
+ @param self: The object pointer
+ @param cr: the current row, from the database cursor,
+ @param uid: the current user’s ID for security checks,
+ @param vals: Get Values
+ @param context: A standard dictionary for contextual values """
if not context:
context = {}
@@ -561,46 +578,50 @@ property or property parameter."),
calendar_attendee()
class res_alarm(osv.osv):
+ """Resource Alarm """
_name = 'res.alarm'
_description = 'Basic Alarm Information'
+
_columns = {
- 'name':fields.char('Name', size=256, required=True),
+ 'name':fields.char('Name', size=256, required=True),
'trigger_occurs': fields.selection([('before', 'Before'), \
('after', 'After')], \
- 'Triggers', required=True),
+ 'Triggers', required=True),
'trigger_interval': fields.selection([('minutes', 'Minutes'), \
('hours', 'Hours'), \
('days', 'Days')], 'Interval', \
- required=True),
- 'trigger_duration': fields.integer('Duration', required=True),
+ required=True),
+ 'trigger_duration': fields.integer('Duration', required=True),
'trigger_related': fields.selection([('start', 'The event starts'), \
('end', 'The event ends')], \
- 'Related to', required=True),
+ 'Related to', required=True),
'duration': fields.integer('Duration', help="""Duration' and 'Repeat' \
-are both optional, but if one occurs, so MUST the other"""),
- 'repeat': fields.integer('Repeat'),
+are both optional, but if one occurs, so MUST the other"""),
+ 'repeat': fields.integer('Repeat'),
'active': fields.boolean('Active', help="If the active field is set to \
true, it will allow you to hide the event alarm information without removing it.")
}
_defaults = {
- 'trigger_interval': lambda *x: 'minutes',
- 'trigger_duration': lambda *x: 5,
- 'trigger_occurs': lambda *x: 'before',
- 'trigger_related': lambda *x: 'start',
- 'active': lambda *x: 1,
+ 'trigger_interval': lambda *x: 'minutes',
+ 'trigger_duration': lambda *x: 5,
+ 'trigger_occurs': lambda *x: 'before',
+ 'trigger_related': lambda *x: 'start',
+ 'active': lambda *x: 1,
}
- def do_alarm_create(self, cr, uid, ids, model, date, context={}):
+ def do_alarm_create(self, cr, uid, ids, model, date, context=None):
"""
- Create Alarm for meeting.
+ Create Alarm for event.
@param cr: the current row, from the database cursor,
@param uid: the current user’s ID for security checks,
@param ids: List of res alarm’s IDs.
@param model: Model name.
+ @param date: Event date
@param context: A standard dictionary for contextual values
@return: True
"""
-
+ if not context:
+ context = {}
alarm_obj = self.pool.get('calendar.alarm')
ir_obj = self.pool.get('ir.model')
model_id = ir_obj.search(cr, uid, [('model', '=', model)])[0]
@@ -615,20 +636,20 @@ true, it will allow you to hide the event alarm information without removing it.
self.do_alarm_unlink(cr, uid, [data.id], model)
if basic_alarm:
vals = {
- 'action': 'display',
- 'description': data.description,
- 'name': data.name,
- 'attendee_ids': [(6, 0, map(lambda x:x.id, data.attendee_ids))],
- 'trigger_related': basic_alarm.trigger_related,
- 'trigger_duration': basic_alarm.trigger_duration,
- 'trigger_occurs': basic_alarm.trigger_occurs,
- 'trigger_interval': basic_alarm.trigger_interval,
- 'duration': basic_alarm.duration,
- 'repeat': basic_alarm.repeat,
- 'state': 'run',
- 'event_date': data[date],
- 'res_id': data.id,
- 'model_id': model_id,
+ 'action': 'display',
+ 'description': data.description,
+ 'name': data.name,
+ 'attendee_ids': [(6, 0, map(lambda x:x.id, data.attendee_ids))],
+ 'trigger_related': basic_alarm.trigger_related,
+ 'trigger_duration': basic_alarm.trigger_duration,
+ 'trigger_occurs': basic_alarm.trigger_occurs,
+ 'trigger_interval': basic_alarm.trigger_interval,
+ 'duration': basic_alarm.duration,
+ 'repeat': basic_alarm.repeat,
+ 'state': 'run',
+ 'event_date': data[date],
+ 'res_id': data.id,
+ 'model_id': model_id,
'user_id': uid
}
alarm_id = alarm_obj.create(cr, uid, vals)
@@ -638,16 +659,17 @@ true, it will allow you to hide the event alarm information without removing it.
cr.commit()
return True
- def do_alarm_unlink(self, cr, uid, ids, model, context={}):
+ def do_alarm_unlink(self, cr, uid, ids, model, context=None):
"""
Delete alarm specified in ids
@param cr: the current row, from the database cursor,
@param uid: the current user’s ID for security checks,
@param ids: List of res alarm’s IDs.
- @param model: Model name.
+ @param model: Model name for which alarm is to be cleared.
@return: True
"""
-
+ if not context:
+ context = {}
alarm_obj = self.pool.get('calendar.alarm')
ir_obj = self.pool.get('ir.model')
model_id = ir_obj.search(cr, uid, [('model', '=', model)])[0]
@@ -670,51 +692,53 @@ class calendar_alarm(osv.osv):
__attribute__ = {}
_columns = {
- 'alarm_id': fields.many2one('res.alarm', 'Basic Alarm', ondelete='cascade'),
+ 'alarm_id': fields.many2one('res.alarm', 'Basic Alarm', ondelete='cascade'),
'name': fields.char('Summary', size=124, help="""Contains the text to be \
used as the message subject for email \
- or contains the text to be used for display"""),
+ or contains the text to be used for display"""),
'action': fields.selection([('audio', 'Audio'), ('display', 'Display'), \
('procedure', 'Procedure'), ('email', 'Email') ], 'Action', \
- required=True, help="Defines the action to be invoked when an alarm is triggered"),
+ required=True, help="Defines the action to be invoked when an alarm is triggered"),
'description': fields.text('Description', help='Provides a more complete \
description of the calendar component, than that \
- provided by the "SUMMARY" property'),
+ provided by the "SUMMARY" property'),
'attendee_ids': fields.many2many('calendar.attendee', 'alarm_attendee_rel', \
- 'alarm_id', 'attendee_id', 'Attendees', readonly=True),
+ 'alarm_id', 'attendee_id', 'Attendees', readonly=True),
'attach': fields.binary('Attachment', help="""* Points to a sound resource,\
which is rendered when the alarm is triggered for audio,
* File which is intended to be sent as message attachments for email,
* Points to a procedure resource, which is invoked when\
- the alarm is triggered for procedure."""),
- 'res_id': fields.integer('Resource ID'),
- 'model_id': fields.many2one('ir.model', 'Model'),
- 'user_id': fields.many2one('res.users', 'Owner'),
- 'event_date': fields.datetime('Event Date'),
- 'event_end_date': fields.datetime('Event End Date'),
- 'trigger_date': fields.datetime('Trigger Date', readonly="True"),
+ the alarm is triggered for procedure."""),
+ 'res_id': fields.integer('Resource ID'),
+ 'model_id': fields.many2one('ir.model', 'Model'),
+ 'user_id': fields.many2one('res.users', 'Owner'),
+ 'event_date': fields.datetime('Event Date'),
+ 'event_end_date': fields.datetime('Event End Date'),
+ 'trigger_date': fields.datetime('Trigger Date', readonly="True"),
'state':fields.selection([
- ('draft', 'Draft'),
- ('run', 'Run'),
- ('stop', 'Stop'),
- ('done', 'Done'),
- ], 'State', select=True, readonly=True),
+ ('draft', 'Draft'),
+ ('run', 'Run'),
+ ('stop', 'Stop'),
+ ('done', 'Done'),
+ ], 'State', select=True, readonly=True),
}
_defaults = {
- 'action': lambda *x: 'email',
- 'state': lambda *x: 'run',
+ 'action': lambda *x: 'email',
+ 'state': lambda *x: 'run',
}
- def create(self, cr, uid, vals, context={}):
+
+ def create(self, cr, uid, vals, context=None):
"""
- create new record.
+ Overrides orm create method.
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param vals: dictionary of fields value.{‘name_of_the_field’: value, ...}
@param context: A standard dictionary for contextual values
@return: new record id for calendar_alarm.
"""
-
+ if not context:
+ context = {}
event_date = vals.get('event_date', False)
if event_date:
dtstart = datetime.strptime(vals['event_date'], "%Y-%m-%d %H:%M:%S")
@@ -731,7 +755,7 @@ class calendar_alarm(osv.osv):
def do_run_scheduler(self, cr, uid, automatic=False, use_new_cursor=False, \
context=None):
- """
+ """Scheduler for event reminder
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current user’s ID for security checks,
@@ -754,11 +778,11 @@ class calendar_alarm(osv.osv):
for alarm in self.browse(cr, uid, alarm_ids):
if alarm.action == 'display':
value = {
- 'name': alarm.name,
- 'act_from': alarm.user_id.id,
- 'act_to': alarm.user_id.id,
- 'body': alarm.description,
- 'trigger_date': alarm.trigger_date,
+ 'name': alarm.name,
+ 'act_from': alarm.user_id.id,
+ 'act_to': alarm.user_id.id,
+ 'body': alarm.description,
+ 'trigger_date': alarm.trigger_date,
'ref_doc1': '%s,%s' % (alarm.model_id.model, alarm.res_id)
}
request_id = request_obj.create(cr, uid, value)
@@ -788,9 +812,9 @@ class calendar_alarm(osv.osv):
mail_to.append(att.user_id.address_id.email)
if mail_to:
tools.email_send(
- tools.config.get('email_from', False),
- mail_to,
- sub,
+ tools.config.get('email_from', False),
+ mail_to,
+ sub,
body
)
self.write(cr, uid, [alarm.id], {'state':'done'})
@@ -808,7 +832,7 @@ class calendar_event(osv.osv):
return [(x.lower(), x) for x in pytz.all_timezones]
def onchange_allday(self, cr, uid, ids, allday, context={}):
- """
+ """Sets duration as 24 Hours if event is selcted for all day
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current user’s ID for security checks,
@@ -820,23 +844,23 @@ class calendar_event(osv.osv):
return {}
event = self.browse(cr, uid, ids, context=context)[0]
value = {
- 'date': event.date and event.date[:11] + '00:00:00',
- 'date_deadline': event.date_deadline and event.date_deadline[:11] + '00:00:00',
'duration': 24
}
return {'value': value}
- def onchange_dates(self, cr, uid, ids, start_date, duration=False, end_date=False, allday=False, context={}):
- """
+ def onchange_dates(self, cr, uid, ids, start_date, duration=False, end_date=False, allday=False, context=None):
+ """Returns duration and/or end date based on values passed
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current user’s ID for security checks,
@param ids: List of calendar event’s IDs.
- @param start_date: Get starting date
- @param duration: Get Duration between start date and end date or False
- @param end_date: Get Ending Date or False
+ @param start_date: Starting date
+ @param duration: Duration between start date and end date
+ @param end_date: Ending Datee
@param context: A standard dictionary for contextual values
"""
+ if not context:
+ context = {}
value = {}
if not start_date:
return value
@@ -845,10 +869,7 @@ class calendar_event(osv.osv):
value['duration'] = duration
if allday: # For all day event
- start = start_date[:11] + '00:00:00'
value = {
- 'date': start,
- 'date_deadline': start,
'duration': 24
}
return {'value': value}
@@ -865,19 +886,21 @@ class calendar_event(osv.osv):
return {'value': value}
- def _set_rrulestring(self, cr, uid, id, name, value, arg, context):
+ def _set_rrulestring(self, cr, uid, id, name, value, arg, context=None):
"""
- Set rule string.
+ Sets values of fields that defines event recurrence from the value of rrule string
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param id: List of calendar event's ids.
@param context: A standard dictionary for contextual values
@return: dictionary of rrule value.
"""
+ if not context:
+ context = {}
cr.execute("UPDATE %s set freq='None',interval=0,count=0,end_date=Null,\
mo=False,tu=False,we=False,th=False,fr=False,sa=False,su=False,\
day=0,select1='date',month_list=Null ,byday=Null where id=%s" % (self._table, id))
-
+
if not value:
cr.execute("UPDATE %s set rrule_type='none' where id=%s" % (self._table, id))
return True
@@ -906,19 +929,19 @@ class calendar_event(osv.osv):
for day in val['byday'].split(','):
new_val[day] = True
val.pop('byday')
-
+
if val.get('until'):
until = parser.parse(''.join((re.compile('\d')).findall(val.get('until'))))
new_val['end_date'] = until.strftime('%Y-%m-%d')
val.pop('until')
new_val.pop('until')
-
+
if val.get('bymonthday'):
new_val['day'] = val.get('bymonthday')
val.pop('bymonthday')
new_val['select1'] = 'date'
new_val.pop('bymonthday')
-
+
if val.get('byday'):
d = val.get('byday')
if '-' in d:
@@ -928,12 +951,12 @@ class calendar_event(osv.osv):
new_val['byday'] = d[:1]
new_val['week_list'] = d[1:3].upper()
new_val['select1'] = 'day'
-
+
if val.get('bymonth'):
new_val['month_list'] = val.get('bymonth')
val.pop('bymonth')
new_val.pop('bymonth')
-
+
for k, v in new_val.items():
temp = ", %s='%s'" % (k, v)
qry += temp
@@ -941,16 +964,16 @@ class calendar_event(osv.osv):
whr = " where id=%(id)s"
qry = qry + whr
val.update({
- 'table': self._table,
- 'rule_type': rrule_type,
- 'id': id,
+ 'table': self._table,
+ 'rule_type': rrule_type,
+ 'id': id,
})
cr.execute(qry % val)
return True
def _get_rulestring(self, cr, uid, ids, name, arg, context=None):
"""
- Get rule string.
+ Gets Recurrence rule string according to value type RECUR of iCalendar from the values given.
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param id: List of calendar event's ids.
@@ -968,7 +991,7 @@ class calendar_event(osv.osv):
raise osv.except_osv('Warning!', 'Interval can not be Negative')
if datas.get('count', 0) < 0:
raise osv.except_osv('Warning!', 'Count can not be Negative')
- rrule_custom = self.compute_rule_string(cr, uid, datas,\
+ rrule_custom = self.compute_rule_string(cr, uid, datas, \
context=context)
result[event] = rrule_custom
else:
@@ -977,40 +1000,40 @@ class calendar_event(osv.osv):
return result
_columns = {
- 'id': fields.integer('ID'),
- 'sequence': fields.integer('Sequence'),
- 'name': fields.char('Description', size=64, required=True),
- 'date': fields.datetime('Date'),
- 'date_deadline': fields.datetime('Deadline'),
- 'create_date': fields.datetime('Created', readonly=True),
- 'duration': fields.float('Duration'),
- 'description': fields.text('Your action'),
+ 'id': fields.integer('ID'),
+ 'sequence': fields.integer('Sequence'),
+ 'name': fields.char('Description', size=64, required=False),
+ 'date': fields.datetime('Date'),
+ 'date_deadline': fields.datetime('Deadline'),
+ 'create_date': fields.datetime('Created', readonly=True),
+ 'duration': fields.float('Duration'),
+ 'description': fields.text('Your action'),
'class': fields.selection([('public', 'Public'), ('private', 'Private'), \
- ('confidential', 'Confidential')], 'Mark as'),
- 'location': fields.char('Location', size=264, help="Location of Event"),
+ ('confidential', 'Confidential')], 'Mark as'),
+ 'location': fields.char('Location', size=264, help="Location of Event"),
'show_as': fields.selection([('free', 'Free'), ('busy', 'Busy')], \
- 'Show as'),
- 'base_calendar_url': fields.char('Caldav URL', size=264),
+ 'Show as'),
+ 'base_calendar_url': fields.char('Caldav URL', size=264),
'exdate': fields.text('Exception Date/Times', help="This property \
-defines the list of date/time exceptions for arecurring calendar component."),
+defines the list of date/time exceptions for arecurring calendar component."),
'exrule': fields.char('Exception Rule', size=352, help="defines a \
-rule or repeating pattern for an exception to a recurrence set"),
+rule or repeating pattern for an exception to a recurrence set"),
'rrule': fields.function(_get_rulestring, type='char', size=124, method=True, \
string='Recurrent Rule', store=True, \
fnct_inv=_set_rrulestring, help='Defines a\
rule or repeating pattern for recurring events\n\
e.g.: Every other month on the last Sunday of the month for 10 occurrences:\
- FREQ=MONTHLY;INTERVAL=2;COUNT=10;BYDAY=-1SU'),
+ FREQ=MONTHLY;INTERVAL=2;COUNT=10;BYDAY=-1SU'),
'rrule_type': fields.selection([('none', ''), ('daily', 'Daily'), \
('weekly', 'Weekly'), ('monthly', 'Monthly'), \
- ('yearly', 'Yearly'), ('custom', 'Custom')], 'Recurrency'),
- 'alarm_id': fields.many2one('res.alarm', 'Alarm'),
- 'base_calendar_alarm_id': fields.many2one('calendar.alarm', 'Alarm'),
- 'recurrent_uid': fields.integer('Recurrent ID'),
- 'recurrent_id': fields.datetime('Recurrent ID date'),
+ ('yearly', 'Yearly'), ('custom', 'Custom')], 'Recurrency'),
+ 'alarm_id': fields.many2one('res.alarm', 'Alarm'),
+ 'base_calendar_alarm_id': fields.many2one('calendar.alarm', 'Alarm'),
+ 'recurrent_uid': fields.integer('Recurrent ID'),
+ 'recurrent_id': fields.datetime('Recurrent ID date'),
'vtimezone': fields.related('user_id', 'context_tz', type='char', size=24, \
- string='Timezone', store=True),
- 'user_id': fields.many2one('res.users', 'Responsible'),
+ string='Timezone', store=True),
+ 'user_id': fields.many2one('res.users', 'Responsible'),
'freq': fields.selection([('None', 'No Repeat'), \
('secondly', 'Secondly'), \
('minutely', 'Minutely'), \
@@ -1018,44 +1041,44 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\
('daily', 'Daily'), \
('weekly', 'Weekly'), \
('monthly', 'Monthly'), \
- ('yearly', 'Yearly')], 'Frequency'),
- 'interval': fields.integer('Interval'),
- 'count': fields.integer('Count'),
- 'mo': fields.boolean('Mon'),
- 'tu': fields.boolean('Tue'),
- 'we': fields.boolean('Wed'),
- 'th': fields.boolean('Thu'),
- 'fr': fields.boolean('Fri'),
- 'sa': fields.boolean('Sat'),
- 'su': fields.boolean('Sun'),
+ ('yearly', 'Yearly')], 'Frequency'),
+ 'interval': fields.integer('Interval'),
+ 'count': fields.integer('Count'),
+ 'mo': fields.boolean('Mon'),
+ 'tu': fields.boolean('Tue'),
+ 'we': fields.boolean('Wed'),
+ 'th': fields.boolean('Thu'),
+ 'fr': fields.boolean('Fri'),
+ 'sa': fields.boolean('Sat'),
+ 'su': fields.boolean('Sun'),
'select1': fields.selection([('date', 'Date of month'), \
- ('day', 'Day of month')], 'Option'),
- 'day': fields.integer('Date of month'),
+ ('day', 'Day of month')], 'Option'),
+ 'day': fields.integer('Date of month'),
'week_list': fields.selection([('MO', 'Monday'), ('TU', 'Tuesday'), \
('WE', 'Wednesday'), ('TH', 'Thursday'), \
('FR', 'Friday'), ('SA', 'Saturday'), \
- ('SU', 'Sunday')], 'Weekday'),
+ ('SU', 'Sunday')], 'Weekday'),
'byday': fields.selection([('1', 'First'), ('2', 'Second'), \
('3', 'Third'), ('4', 'Fourth'), \
('5', 'Fifth'), ('-1', 'Last')], 'By day'),
'month_list': fields.selection(months.items(), 'Month'),
'end_date': fields.date('Repeat Until'),
- 'attendee_ids': fields.many2many('calendar.attendee', 'event_attendee_rel',\
- 'event_id', 'attendee_id', 'Attendees'),
+ 'attendee_ids': fields.many2many('calendar.attendee', 'event_attendee_rel', \
+ 'event_id', 'attendee_id', 'Attendees'),
'allday': fields.boolean('All Day'),
'active': fields.boolean('Active', help="If the active field is set to \
true, it will allow you to hide the event alarm information without removing it.")
}
_defaults = {
- 'class': lambda *a: 'public',
- 'show_as': lambda *a: 'busy',
- 'freq': lambda *x: 'None',
- 'select1': lambda *x: 'date',
- 'interval': lambda *x: 1,
- 'active': lambda *x: 1,
+ 'class': lambda *a: 'public',
+ 'show_as': lambda *a: 'busy',
+ 'freq': lambda *x: 'None',
+ 'select1': lambda *x: 'date',
+ 'interval': lambda *x: 1,
+ 'active': lambda *x: 1,
}
-
+
def open_event(self, cr, uid, ids, context=None):
"""
Open Event From for Editing
@@ -1067,11 +1090,11 @@ true, it will allow you to hide the event alarm information without removing it.
"""
if not context:
context = {}
-
+
data_obj = self.pool.get('ir.model.data')
-
+
value = {}
-
+
id2 = data_obj._get_id(cr, uid, 'base_calendar', 'event_form_view')
id3 = data_obj._get_id(cr, uid, 'base_calendar', 'event_tree_view')
id4 = data_obj._get_id(cr, uid, 'base_calendar', 'event_calendar_view')
@@ -1088,32 +1111,32 @@ true, it will allow you to hide the event alarm information without removing it.
'view_mode': 'form,tree',
'res_model': 'calendar.event',
'view_id': False,
- 'views': [(id2, 'form'), (id3, 'tree'), (id4, 'calendar')],
+ 'views': [(id2, 'form'), (id3, 'tree'), (id4, 'calendar')],
'type': 'ir.actions.act_window',
'res_id': base_calendar_id2real_id(id),
'nodestroy': True
}
-
+
return value
def modify_this(self, cr, uid, event_id, defaults, real_date, context=None, *args):
- """
+ """Modifies only one event record out of virtual recurrent events
+ and creates new event as a specific instance of a Recurring Event",
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current user’s ID for security checks,
- @param event_id: Get Event_id
- @param real_date: Get Real Date
+ @param event_id: Id of Recurring Event
+ @param real_date: Date of event recurrence that is being modified
@param context: A standard dictionary for contextual values
- @param *args: Get Tuppel Value
-
+ @param *args: Get Tupple Value
"""
event_id = base_calendar_id2real_id(event_id)
datas = self.read(cr, uid, event_id, context=context)
defaults.update({
- 'recurrent_uid': base_calendar_id2real_id(datas['id']),
- 'recurrent_id': defaults.get('date') or real_date,
- 'rrule_type': 'none',
+ 'recurrent_uid': base_calendar_id2real_id(datas['id']),
+ 'recurrent_id': defaults.get('date') or real_date,
+ 'rrule_type': 'none',
'rrule': ''
})
exdate = datas['exdate'] and datas['exdate'].split(',') or []
@@ -1125,13 +1148,14 @@ true, it will allow you to hide the event alarm information without removing it.
def modify_all(self, cr, uid, event_ids, defaults, context=None, *args):
"""
- Modify name, date, date_deadline fields.
+ Modifies the recurring event
@param cr: the current row, from the database cursor,
@param uid: the current user’s ID for security checks,
@param event_ids: List of crm meeting’s IDs.
+ @param context: A standard dictionary for contextual values
@return: True
"""
-
+
for event_id in event_ids:
event_id = base_calendar_id2real_id(event_id)
@@ -1146,11 +1170,12 @@ true, it will allow you to hide the event alarm information without removing it.
qry += ", location = '%(location)s'"
qry += "WHERE id = %s" % (event_id)
cr.execute(qry %(defaults))
-
+
return True
def get_recurrent_ids(self, cr, uid, select, base_start_date, base_until_date, limit=100):
- """
+ """Gives virtual event ids for recurring events based on value of Recurrence Rule
+ This method gives ids of dates that comes between start date and end date of calendar views
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current user’s ID for security checks,
@@ -1167,7 +1192,7 @@ true, it will allow you to hide the event alarm information without removing it.
result = []
if ids and (base_start_date or base_until_date):
cr.execute("select m.id, m.rrule, m.date, m.date_deadline, \
- m.exdate from " + self._table + \
+ m.exdate, m.exrule from " + self._table + \
" m where m.id in ("\
+ ','.join(map(lambda x: str(x), ids))+")")
@@ -1214,7 +1239,7 @@ true, it will allow you to hide the event alarm information without removing it.
new_rule = '%s=%s' % (name, value)
new_rrule_str.append(new_rule)
new_rrule_str = ';'.join(new_rrule_str)
- rdates = get_recurrent_dates(str(new_rrule_str), exdate, start_date)
+ rdates = get_recurrent_dates(str(new_rrule_str), exdate, start_date, data['exrule'])
for rdate in rdates:
r_date = datetime.strptime(rdate, "%Y-%m-%d %H:%M:%S")
if start_date and r_date < start_date:
@@ -1229,15 +1254,16 @@ true, it will allow you to hide the event alarm information without removing it.
if isinstance(select, (str, int, long)):
return ids and ids[0] or False
return ids
-
+
def compute_rule_string(self, cr, uid, datas, context=None, *args):
"""
- Compute rule string.
+ Compute rule string according to value type RECUR of iCalendar from the values given.
@param self: the object pointer
@param cr: the current row, from the database cursor,
@param uid: the current user’s ID for security checks,
@param datas: dictionary of freq and interval value.
- @return: string value which compute FREQILY;INTERVAL
+ @param context: A standard dictionary for contextual values
+ @return: String value of the format RECUR of iCalendar
"""
weekdays = ['mo', 'tu', 'we', 'th', 'fr', 'sa', 'su']
@@ -1248,9 +1274,9 @@ true, it will allow you to hide the event alarm information without removing it.
freq = datas.get('freq')
if freq == 'None':
return ''
-
+
interval_srting = datas.get('interval') and (';INTERVAL=' + str(datas.get('interval'))) or ''
-
+
if freq == 'weekly':
byday = map(lambda x: x.upper(), filter(lambda x: datas.get(x) and x in weekdays, datas))
@@ -1286,7 +1312,7 @@ true, it will allow you to hide the event alarm information without removing it.
return rrule_string
- def search(self, cr, uid, args, offset=0, limit=100, order=None,
+ def search(self, cr, uid, args, offset=0, limit=100, order=None,
context=None, count=False):
"""
Overrides orm search method.
@@ -1295,6 +1321,8 @@ true, it will allow you to hide the event alarm information without removing it.
@param args: list of tuples of form [(‘name_of_the_field’, ‘operator’, value), ...].
@param offset: The Number of Results to Pass
@param limit: The Number of Results to Return
+ @param context: A standard dictionary for contextual values
+ @param count: If its True the method returns number of records instead of ids
@return: List of id
"""
args_without_date = []
@@ -1317,14 +1345,16 @@ true, it will allow you to hide the event alarm information without removing it.
return self.get_recurrent_ids(cr, uid, res, start_date, until_date, limit)
+
def write(self, cr, uid, ids, vals, context=None, check=True, update_check=True):
"""
- Writes values in one or several fields.
+ Overrides orm write method.
@param self: the object pointer
@param cr: the current row, from the database cursor,
@param uid: the current user’s ID for security checks,
@param ids: List of crm meeting's ids
@param vals: Dictionary of field value.
+ @param context: A standard dictionary for contextual values
@return: True
"""
if not context:
@@ -1348,7 +1378,7 @@ true, it will allow you to hide the event alarm information without removing it.
event_id = base_calendar_id2real_id(event_id)
if not event_id in new_ids:
new_ids.append(event_id)
-
+
res = super(calendar_event, self).write(cr, uid, new_ids, vals, context=context)
if vals.has_key('alarm_id') or vals.has_key('base_calendar_alarm_id'):
alarm_obj = self.pool.get('res.alarm')
@@ -1364,6 +1394,7 @@ true, it will allow you to hide the event alarm information without removing it.
@param cr: the current row, from the database cursor,
@param uid: the current user’s ID for security checks,
@param ids: List of crm meeting's ids
+ @param context: A standard dictionary for contextual values
@return: the object list.
"""
if isinstance(ids, (str, int, long)):
@@ -1378,15 +1409,19 @@ true, it will allow you to hide the event alarm information without removing it.
return res
- def read(self, cr, uid, ids, fields=None, context={}, load='_classic_read'):
+ def read(self, cr, uid, ids, fields=None, context=None, load='_classic_read'):
"""
Overrides orm Read method.Read List of fields for calendar event.
@param cr: the current row, from the database cursor,
@param user: the current user’s ID for security checks,
@param ids: List of calendar event's id.
@param fields: List of fields.
+ @param context: A standard dictionary for contextual values
@return: List of Dictionary of form [{‘name_of_the_field’: value, ...}, ...]
"""
+ if not context:
+ context = {}
+
if isinstance(ids, (str, int, long)):
select = [ids]
else:
@@ -1408,14 +1443,17 @@ true, it will allow you to hide the event alarm information without removing it.
return result and result[0] or False
return result
- def copy(self, cr, uid, id, default=None, context={}):
+ def copy(self, cr, uid, id, default=None, context=None):
"""
Duplicate record on specified id.
@param self: the object pointer.
@param cr: the current row, from the database cursor,
@param id: id of record from which we duplicated.
+ @param context: A standard dictionary for contextual values
@return: Duplicate record id.
"""
+ if not context:
+ context = {}
res = super(calendar_event, self).copy(cr, uid, base_calendar_id2real_id(id), default, context)
alarm_obj = self.pool.get('res.alarm')
alarm_obj.do_alarm_create(cr, uid, [res], self._name, 'date')
@@ -1428,6 +1466,7 @@ true, it will allow you to hide the event alarm information without removing it.
@param self: the object pointer.
@param cr: the current row, from the database cursor,
@param id: List of calendar event's id.
+ @param context: A standard dictionary for contextual values
@return: True
"""
res = False
@@ -1454,15 +1493,18 @@ true, it will allow you to hide the event alarm information without removing it.
alarm_obj.do_alarm_unlink(cr, uid, ids, self._name)
return res
- def create(self, cr, uid, vals, context={}):
+ def create(self, cr, uid, vals, context=None):
"""
Create new record.
@param self: the object pointer
@param cr: the current row, from the database cursor,
@param uid: the current user’s ID for security checks,
@param vals: dictionary of every field value.
+ @param context: A standard dictionary for contextual values
@return: new created record id.
"""
+ if not context:
+ context = {}
res = super(calendar_event, self).create(cr, uid, vals, context)
alarm_obj = self.pool.get('res.alarm')
alarm_obj.do_alarm_create(cr, uid, [res], self._name, 'date')
@@ -1478,7 +1520,7 @@ class calendar_todo(osv.osv):
_description = "Calendar Task"
def _get_date(self, cr, uid, ids, name, arg, context):
- """
+ """
Get Date
@param self: The object pointer
@param cr: the current row, from the database cursor,
@@ -1494,7 +1536,7 @@ class calendar_todo(osv.osv):
return res
def _set_date(self, cr, uid, id, name, value, arg, context):
- """
+ """
Set Date
@param self: The object pointer
@param cr: the current row, from the database cursor,
@@ -1512,8 +1554,8 @@ class calendar_todo(osv.osv):
_columns = {
'date': fields.function(_get_date, method=True, fnct_inv=_set_date, \
- string='Duration', store=True, type='datetime'),
- 'duration': fields.integer('Duration'),
+ string='Duration', store=True, type='datetime'),
+ 'duration': fields.integer('Duration'),
}
__attribute__ = {}
@@ -1526,7 +1568,7 @@ class ir_attachment(osv.osv):
_inherit = 'ir.attachment'
def search_count(self, cr, user, args, context=None):
- """
+ """
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param user: the current user’s ID for security checks,
@@ -1539,9 +1581,9 @@ class ir_attachment(osv.osv):
args1.append(map(lambda x:str(x).split('-')[0], arg))
return super(ir_attachment, self).search_count(cr, user, args1, context)
- def search(self, cr, uid, args, offset=0, limit=None, order=None,
+ def search(self, cr, uid, args, offset=0, limit=None, order=None,
context=None, count=False):
- """
+ """
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current user’s ID for security checks,
@@ -1555,8 +1597,8 @@ class ir_attachment(osv.osv):
for i, arg in enumerate(new_args):
if arg[0] == 'res_id':
new_args[i] = (arg[0], arg[1], base_calendar_id2real_id(arg[2]))
- return super(ir_attachment, self).search(cr, uid, new_args, offset=offset,
- limit=limit, order=order,
+ return super(ir_attachment, self).search(cr, uid, new_args, offset=offset,
+ limit=limit, order=order,
context=context, count=False)
ir_attachment()
@@ -1565,12 +1607,12 @@ class ir_values(osv.osv):
def set(self, cr, uid, key, key2, name, models, value, replace=True, \
isobject=False, meta=False, preserve_user=False, company=False):
- """
+ """
Set IR Values
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current user’s ID for security checks,
- @param model: Get The Model
+ @param model: Get The Model
"""
new_model = []
@@ -1582,16 +1624,17 @@ class ir_values(osv.osv):
return super(ir_values, self).set(cr, uid, key, key2, name, new_model, \
value, replace, isobject, meta, preserve_user, company)
- def get(self, cr, uid, key, key2, models, meta=False, context={}, \
+ def get(self, cr, uid, key, key2, models, meta=False, context=None, \
res_id_req=False, without_user=True, key2_req=True):
- """
+ """
Get IR Values
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current user’s ID for security checks,
- @param model: Get The Model
+ @param model: Get The Model
"""
-
+ if not context:
+ context = {}
new_model = []
for data in models:
if type(data) in (list, tuple):
@@ -1607,20 +1650,19 @@ class ir_model(osv.osv):
_inherit = 'ir.model'
- def read(self, cr, uid, ids, fields=None, context={},
+ def read(self, cr, uid, ids, fields=None, context=None,
load='_classic_read'):
"""
- Read IR Model
+ Overrides orm read method.
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current user’s ID for security checks,
@param ids: List of IR Model’s IDs.
- @param context: A standard dictionary for contextual values
+ @param context: A standard dictionary for contextual values
"""
-
- new_ids = isinstance(ids, (str, int, long)) and [ids] or ids
-
- data = super(ir_model, self).read(cr, uid, new_ids, fields=fields, \
+ if not context:
+ context = {}
+ data = super(ir_model, self).read(cr, uid, ids, fields=fields, \
context=context, load=load)
if data:
for val in data:
@@ -1632,12 +1674,12 @@ ir_model()
class virtual_report_spool(web_services.report_spool):
def exp_report(self, db, uid, object, ids, datas=None, context=None):
- """
+ """
Export Report
@param self: The object pointer
@param db: get the current database,
@param uid: the current user’s ID for security checks,
- @param context: A standard dictionary for contextual values
+ @param context: A standard dictionary for contextual values
"""
if object == 'printscreen.list':
@@ -1657,19 +1699,19 @@ class res_users(osv.osv):
def _get_user_avail(self, cr, uid, ids, context=None):
"""
- Get USer Availability
+ Get User Availability
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current user’s ID for security checks,
@param ids: List of res user’s IDs.
- @param context: A standard dictionary for contextual values
+ @param context: A standard dictionary for contextual values
"""
current_datetime = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
res = {}
attendee_obj = self.pool.get('calendar.attendee')
attendee_ids = attendee_obj.search(cr, uid, [
- ('event_date', '<=', current_datetime), ('event_end_date', '<=', current_datetime),
+ ('event_date', '<=', current_datetime), ('event_end_date', '<=', current_datetime),
('state', '=', 'accepted'), ('user_id', 'in', ids)
])
@@ -1688,12 +1730,12 @@ class res_users(osv.osv):
def _get_user_avail_fun(self, cr, uid, ids, name, args, context=None):
"""
- Get USer Availability Function
+ Get User Availability Function
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current user’s ID for security checks,
@param ids: List of res user’s IDs.
- @param context: A standard dictionary for contextual values
+ @param context: A standard dictionary for contextual values
"""
return self._get_user_avail(cr, uid, ids, context=context)
@@ -1701,8 +1743,9 @@ class res_users(osv.osv):
_columns = {
'availability': fields.function(_get_user_avail_fun, type='selection', \
selection=[('free', 'Free'), ('busy', 'Busy')], \
- string='Free/Busy', method=True),
+ string='Free/Busy', method=True),
}
+
res_users()
diff --git a/addons/base_calendar/base_calendar_view.xml b/addons/base_calendar/base_calendar_view.xml
index 0c8a52260ef..d31266c9090 100644
--- a/addons/base_calendar/base_calendar_view.xml
+++ b/addons/base_calendar/base_calendar_view.xml
@@ -1,6 +1,8 @@
+
+
calendar.attendee.form
@@ -65,6 +67,8 @@
+
+
calendar.attendee.tree
@@ -77,10 +81,14 @@
+
+
-
+
+
+
calendar.attendee.search
calendar.attendee
@@ -99,11 +107,26 @@
+
+
+
+
+
+
+
+
+
-
+
+
Event Invitations
ir.actions.act_window
@@ -115,10 +138,12 @@
+
+
@@ -138,9 +163,6 @@
-
-
-
@@ -162,7 +184,8 @@
-
+
+
Available Alarms
ir.actions.act_window
@@ -170,6 +193,8 @@
form
tree,form
+
+