diff --git a/addons/account/account_bank_statement.py b/addons/account/account_bank_statement.py index 0e46944a436..572cb9d04fd 100644 --- a/addons/account/account_bank_statement.py +++ b/addons/account/account_bank_statement.py @@ -303,6 +303,13 @@ class account_bank_statement(osv.osv): _('Ledger Posting line "%s" is not valid') % line.name) if move.reconcile_id and move.reconcile_id.line_ids: + ## Search if move has already a partial reconciliation + previous_partial = False + for line_reconcile_move in move.reconcile_id.line_ids: + if line_reconcile_move.reconcile_partial_id: + previous_partial = True + break + ## torec += map(lambda x: x.id, move.reconcile_id.line_ids) #try: if abs(move.reconcile_amount-move.amount)<0.0001: @@ -312,8 +319,14 @@ class account_bank_statement(osv.osv): for entry in move.reconcile_id.line_new_ids: writeoff_acc_id = entry.account_id.id break - - account_move_line_obj.reconcile(cr, uid, torec, 'statement', writeoff_acc_id=writeoff_acc_id, writeoff_period_id=st.period_id.id, writeoff_journal_id=st.journal_id.id, context=context) + ## If we have already a partial reconciliation + ## We need to make a partial reconciliation + ## To add this amount to previous paid amount + if previous_partial: + account_move_line_obj.reconcile_partial(cr, uid, torec, 'statement', context) + ## If it's the first reconciliation, we do a full reconciliation as regular + else: + account_move_line_obj.reconcile(cr, uid, torec, 'statement', writeoff_acc_id=writeoff_acc_id, writeoff_period_id=st.period_id.id, writeoff_journal_id=st.journal_id.id, context=context) else: account_move_line_obj.reconcile_partial(cr, uid, torec, 'statement', context) #except: diff --git a/addons/account/account_cash_statement.py b/addons/account/account_cash_statement.py index eea57359099..3c9ecbec386 100644 --- a/addons/account/account_cash_statement.py +++ b/addons/account/account_cash_statement.py @@ -26,16 +26,16 @@ from mx import DateTime from decimal import Decimal from tools.translate import _ -class singer_statement(osv.osv): +class account_cashbox_line(osv.osv): - """ Singer Statements """ + """ Cash Box Details """ - _name = 'singer.statement' - _description = 'Statement' + _name = 'account.cashbox.line' + _description = 'CashBox Line' def _sub_total(self, cr, uid, ids, name, arg, context=None): - """ Calculates Sub total" + """ Calculates Sub total @param name: Names of fields. @param arg: User defined arguments @return: Dictionary of values. @@ -61,7 +61,7 @@ class singer_statement(osv.osv): 'starting_id': fields.many2one('account.bank.statement',ondelete='cascade'), 'ending_id': fields.many2one('account.bank.statement',ondelete='cascade'), } -singer_statement() +account_cashbox_line() class account_cash_statement(osv.osv): @@ -157,22 +157,32 @@ class account_cash_statement(osv.osv): res[r] = round(res[r], 2) return res + def _get_company(self, cr, uid, ids, context={}): + user_pool = self.pool.get('res.users') + company_pool = self.pool.get('res.company') + user = user_pool.browse(cr, uid, uid, uid) + company_id = user.company_id and user.company_id.id + if not company_id: + company_id = company_pool.search(cr, uid, [])[0] + + return company_id + _columns = { 'company_id':fields.many2one('res.company', 'Company', required=False), 'journal_id': fields.many2one('account.journal', 'Journal', required=True), - 'balance_start': fields.function(_get_starting_balance, method=True, string='Opening Balance', type='float',digits=(16,2), help="Opening balance based on cashBox"), + 'balance_start': fields.function(_get_starting_balance, store=True, method=True, string='Opening Balance', type='float',digits=(16,2), help="Opening balance based on cashBox"), 'balance_end_real': fields.float('Closing Balance', digits=(16,2), states={'confirm':[('readonly', True)]}, help="closing balance entered by the cashbox verifier"), 'state': fields.selection( [('draft', 'Draft'), ('confirm', 'Confirm'), ('open','Open')], 'State', required=True, states={'confirm': [('readonly', True)]}, readonly="1"), - 'total_entry_encoding':fields.function(_get_sum_entry_encoding, method=True, string="Cash Transaction", help="Total cash transactions"), + 'total_entry_encoding':fields.function(_get_sum_entry_encoding, method=True, store=True, string="Cash Transaction", help="Total cash transactions"), 'date':fields.datetime("Open On"), 'closing_date':fields.datetime("Closed On"), - 'balance_end': fields.function(_end_balance, method=True, string='Balance', help="Closing balance based on transactions"), - 'balance_end_cash': fields.function(_balance_end_cash, method=True, string='Balance', help="Closing balance based on cashBox"), - 'starting_details_ids': fields.one2many('singer.statement', 'starting_id', string='Opening Cashbox'), - 'ending_details_ids': fields.one2many('singer.statement', 'ending_id', string='Closing Cashbox'), + 'balance_end': fields.function(_end_balance, method=True, store=True, string='Balance', help="Closing balance based on transactions"), + 'balance_end_cash': fields.function(_balance_end_cash, method=True, store=True, string='Balance', help="Closing balance based on cashBox"), + 'starting_details_ids': fields.one2many('account.cashbox.line', 'starting_id', string='Opening Cashbox'), + 'ending_details_ids': fields.one2many('account.cashbox.line', 'ending_id', string='Closing Cashbox'), 'name': fields.char('Name', size=64, required=True, readonly=True), 'user_id':fields.many2one('res.users', 'Responsible', required=False), } @@ -181,7 +191,8 @@ class account_cash_statement(osv.osv): 'name': lambda *a: '/', 'date': lambda *a:time.strftime("%Y-%m-%d %H:%M:%S"), 'journal_id': _default_journal_id, - 'user_id': lambda self, cr, uid, context=None: uid + 'user_id': lambda self, cr, uid, context=None: uid, + 'company_id': _get_company } def create(self, cr, uid, vals, context=None): @@ -205,7 +216,7 @@ class account_cash_statement(osv.osv): @return: Dictionary of changed values """ - cash_pool = self.pool.get('singer.statement') + cash_pool = self.pool.get('account.cashbox.line') statement_pool = self.pool.get('account.bank.statement') res = {} @@ -226,7 +237,7 @@ class account_cash_statement(osv.osv): """ Changes statement state to Running. @return: True """ - cash_pool = self.pool.get('singer.statement') + cash_pool = self.pool.get('account.cashbox.line') statement_pool = self.pool.get('account.bank.statement') statement = statement_pool.browse(cr, uid, ids[0]) diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index 7024c2cb7c6..ec908928341 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -405,12 +405,16 @@ - + + + + + @@ -2325,6 +2329,19 @@ +
+ + + + + + + + + + + + diff --git a/addons/base_calendar/security/ir.model.access.csv b/addons/base_calendar/security/ir.model.access.csv index a95b1e1a129..a334fd90081 100644 --- a/addons/base_calendar/security/ir.model.access.csv +++ b/addons/base_calendar/security/ir.model.access.csv @@ -1,9 +1,5 @@ "id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink" -"access_calendar_attendee","calendar.attendee","model_calendar_attendee",base.group_user,1,1,1,1 -"access_calendar_alarm","calendar.alarm","model_calendar_alarm",base.group_user,1,1,1,1 -"access_res_alarm","res.alarm","model_res_alarm",base.group_user,1,1,1,1 -"access_calendar_event_all","calendar.event","model_calendar_event",base.group_user,1,1,1,1 -"access_calendar_todo","calendar.todo","model_calendar_todo",base.group_user,1,1,1,1 -"access_base_calendar_invite_attendee","base_calendar.invite.attendee","model_base_calendar_invite_attendee",base.group_user,1,1,1,1 -"access_calendar_event_edit_all","calendar_event_edit_all","model_calendar_event_edit_all",base.group_user,1,1,1,1 -"access_base_calendar_set_exrule","base.calendar.set.exrule","model_base_calendar_set_exrule",base.group_user,1,1,1,1 +"access_calendar_attendee","calendar.attendee","model_calendar_attendee","base.group_user",1,1,1,1 +"access_calendar_alarm","calendar.alarm","model_calendar_alarm","base.group_user",1,1,1,1 +"access_res_alarm","res.alarm","model_res_alarm","base.group_user",1,1,1,1 +"access_calendar_todo","calendar.todo","model_calendar_todo","base.group_user",1,1,1,1 diff --git a/addons/crm/__openerp__.py b/addons/crm/__openerp__.py index 6e7a8edb807..973bb12dc5c 100644 --- a/addons/crm/__openerp__.py +++ b/addons/crm/__openerp__.py @@ -70,6 +70,9 @@ Create dashboard for CRM that includes: 'crm_phonecall_data.xml', ], 'update_xml': [ + 'security/crm_security.xml', + 'security/ir.model.access.csv', + 'wizard/crm_lead_to_partner_view.xml', 'wizard/crm_lead_to_opportunity_view.xml', @@ -97,9 +100,6 @@ Create dashboard for CRM that includes: 'crm_opportunity_view.xml', 'crm_opportunity_menu.xml', - 'security/crm_security.xml', - 'security/ir.model.access.csv', - 'report/crm_lead_report_view.xml', 'report/crm_phonecall_report_view.xml', diff --git a/addons/crm/crm_phonecall_menu.xml b/addons/crm/crm_phonecall_menu.xml index 6c5472afa99..9beb4f4c0c4 100644 --- a/addons/crm/crm_phonecall_menu.xml +++ b/addons/crm/crm_phonecall_menu.xml @@ -67,7 +67,7 @@ tree,calendar - {'set_editable':True,'default_state':'open','search_default_current':1,'search_default_today':1} + @@ -103,7 +103,7 @@ tree,calendar - {'default_state':'open','search_default_current':1} + diff --git a/addons/crm/crm_phonecall_view.xml b/addons/crm/crm_phonecall_view.xml index bb143964d70..479e73fe8fb 100644 --- a/addons/crm/crm_phonecall_view.xml +++ b/addons/crm/crm_phonecall_view.xml @@ -204,8 +204,11 @@ - - + + diff --git a/addons/crm/crm_view.xml b/addons/crm/crm_view.xml index b196d9cb4ca..ab9e5aa0162 100644 --- a/addons/crm/crm_view.xml +++ b/addons/crm/crm_view.xml @@ -1,6 +1,10 @@ + + + + diff --git a/addons/crm/security/ir.model.access.csv b/addons/crm/security/ir.model.access.csv index 3d9921db9ec..bd881630aff 100644 --- a/addons/crm/security/ir.model.access.csv +++ b/addons/crm/security/ir.model.access.csv @@ -4,9 +4,13 @@ "access_crm_segmentation","crm.segmentation","model_crm_segmentation","crm.group_crm_manager",1,1,1,1 "access_crm_segmentation_line","crm.segmentation.line","model_crm_segmentation_line","crm.group_crm_manager",1,1,1,1 "access_crm_case_section","crm.case.section","model_crm_case_section","crm.group_crm_user",1,0,0,0 +"access_crm_case_categ","crm.case.categ","model_crm_case_categ","crm.group_crm_user",1,0,0,0 +"access_crm_meeting_manager","crm.meeting.manager","model_crm_meeting","crm.group_crm_manager",1,1,1,1 +"access_crm_lead_manager","crm.lead.manager","model_crm_lead","crm.group_crm_manager",1,1,1,1 +"access_crm_phonecall_manager","crm.phonecall.manager","model_crm_phonecall","crm.group_crm_manager",1,1,1,1 "access_crm_case_categ","crm.case.categ","model_crm_case_categ","base.group_user",1,0,0,0 "access_crm_meeting","crm.meeting","model_crm_meeting","crm.group_crm_user",1,1,1,1 -"access_crm_meeting_all","crm.meeting"_allll,"model_crm_meeting","base.group_user",1,0,0,0 +"access_crm_meeting_all","crm.meeting_allll","model_crm_meeting","base.group_user",1,0,0,0 "access_crm_lead","crm.lead","model_crm_lead","crm.group_crm_user",1,1,1,1 "access_crm_lead.all","crm.lead.all","model_crm_lead","base.group_user",1,0,0,0 "access_crm_phonecall","crm.phonecall","model_crm_phonecall","crm.group_crm_user",1,1,1,1 @@ -19,12 +23,17 @@ "access_crm_case_stage_manager","crm.case.stage","model_crm_case_stage","crm.group_crm_manager",1,1,1,1 "access_crm_case_resource_type_user","crm_case_resource_type user","model_crm_case_resource_type","crm.group_crm_user",1,0,0,0 "access_crm_case_resource_type_manager","crm_case_resource_type manager","model_crm_case_resource_type","crm.group_crm_manager",1,1,1,1 +"access_crm_lead_report_user","crm.lead.report.user","model_crm_lead_report","crm.group_crm_user",1,0,0,0 +"access_crm_phonecall_report_user","crm.phonecall.report.user","model_crm_phonecall_report","crm.group_crm_user",1,0,0,0 "access_crm_lead_report_manager","crm.lead.report","model_crm_lead_report","crm.group_crm_manager",1,0,0,0 "access_crm_phonecall_report_manager","crm.phonecall.report","model_crm_phonecall_report","crm.group_crm_manager",1,0,0,0 -"access_crm_send_mail","crm.send.mail","model_crm_send_mail","crm.group_crm_user",1,1,1,1 -"access_crm_send_mail_attachment","crm.send.mail.attachment","model_crm_send_mail_attachment","crm.group_crm_user",1,1,1,1 -"access_crm_partner2opportunity","crm.partner2opportunity","model_crm_partner2opportunity","crm.group_crm_user",1,1,1,1 -"access_crm_installer","crm.installer.rule","model_crm_installer","base.group_system",1,1,1,1 +"access_res_partner_manager","res.partner.crm.manager","base.model_res_partner","crm.group_crm_manager",1,0,1,0 +"access_res_partner_address_manager","res.partner.address.crm.user.manager","base.model_res_partner_address","crm.group_crm_manager",1,0,1,0 +"access_res_partner_category_manager","res.partner.category.crm.manager","base.model_res_partner_category","crm.group_crm_manager",1,0,0,0 +"mail_gateway_mailgate_message_manager","mail_gateway.mailgate.message.manager","mail_gateway.model_mailgate_message","crm.group_crm_manager",1,1,1,1 +"mail_gateway_mailgate_thread_manager","mail_gateway.mailgate.thread.manager","mail_gateway.model_mailgate_thread","crm.group_crm_manager",1,1,1,1 +"access_calendar_attendee_crm_user","calendar.attendee.crm.user","model_calendar_attendee","crm.group_crm_user",1,1,1,0 +"access_calendar_attendee_crm_manager","calendar.attendee.crm.manager","model_calendar_attendee","crm.group_crm_manager",1,1,1,1 "access_res_partner","res.partner.crm.user","base.model_res_partner","crm.group_crm_user",1,0,0,0 "access_res_partner_address","res.partner.address.crm.user","base.model_res_partner_address","crm.group_crm_user",1,0,0,0 "access_res_partner_category","res.partner.category.crm.user","base.model_res_partner_category","crm.group_crm_user",1,0,0,0 diff --git a/addons/crm/wizard/crm_send_email.py b/addons/crm/wizard/crm_send_email.py index d790d9b7a0a..1f03d650130 100644 --- a/addons/crm/wizard/crm_send_email.py +++ b/addons/crm/wizard/crm_send_email.py @@ -207,7 +207,7 @@ class crm_send_new_email(osv.osv_memory): res_id = hist.res_id case = model_pool.browse(cr, uid, res_id) if 'email_to' in fields: - res.update({'email_to': case.email_from or hist.email_from or False}) + res.update({'email_to': hist.email_from or False}) if 'email_from' in fields: res.update({'email_from': user_mail_from}) diff --git a/addons/crm_claim/security/ir.model.access.csv b/addons/crm_claim/security/ir.model.access.csv index f903ab0c1d7..beb40a19dca 100644 --- a/addons/crm_claim/security/ir.model.access.csv +++ b/addons/crm_claim/security/ir.model.access.csv @@ -1,3 +1,5 @@ "id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink" -"access_crm_claim","crm.claim","model_crm_claim","crm.group_crm_manager",1,1,1,1 -"access_crm_claim_report_user","crm.claim.report","model_crm_claim_report","crm.group_crm_user",1,0,0,0 +"access_crm_claim_manager","crm.claim.manager","model_crm_claim","crm.group_crm_manager",1,1,1,1 +"access_crm_claim_user","crm.claim.user","model_crm_claim","crm.group_crm_user",1,1,1,1 +"access_crm_claim_report_user","crm.claim.report.user","model_crm_claim_report","crm.group_crm_user",1,0,0,0 +"access_crm_claim_report_manager","crm.claim.report.manager","model_crm_claim_report","crm.group_crm_manager",1,0,0,0 diff --git a/addons/crm_fundraising/security/ir.model.access.csv b/addons/crm_fundraising/security/ir.model.access.csv index 43e607538ee..44880de6332 100644 --- a/addons/crm_fundraising/security/ir.model.access.csv +++ b/addons/crm_fundraising/security/ir.model.access.csv @@ -1,3 +1,5 @@ "id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink" -"access_crm_fundraising","crm.fundraising","model_crm_fundraising","crm.group_crm_manager",1,1,1,1 -"access_crm_fundraising_report_user","crm.fundraising.report","model_crm_fundraising_report","crm.group_crm_user",1,0,0,0 +"access_crm_fundraising_manager","crm.fundraising.manager","model_crm_fundraising","crm.group_crm_manager",1,1,1,1 +"access_crm_fundraising_user","crm.fundraising.user","model_crm_fundraising","crm.group_crm_user",1,1,1,1 +"access_crm_fundraising_report_user","crm.fundraising.report.user","model_crm_fundraising_report","crm.group_crm_user",1,0,0,0 +"access_crm_fundraising_report_manager","crm.fundraising.report.manager","model_crm_fundraising_report","crm.group_crm_manager",1,0,0,0 diff --git a/addons/crm_helpdesk/security/ir.model.access.csv b/addons/crm_helpdesk/security/ir.model.access.csv index c1420a5b2d6..c156428afbd 100644 --- a/addons/crm_helpdesk/security/ir.model.access.csv +++ b/addons/crm_helpdesk/security/ir.model.access.csv @@ -1,3 +1,5 @@ "id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink" -"access_crm_helpdesk","crm.helpdesk","model_crm_helpdesk","crm.group_crm_manager",1,1,1,1 -"access_report_crm_helpdesk","report.crm.helpdesk","model_crm_helpdesk_report","crm.group_crm_user",1,1,1,1 +"access_crm_helpdesk_manager","crm.helpdesk.manager","model_crm_helpdesk","crm.group_crm_manager",1,1,1,1 +"access_crm_helpdesk_user","crm.helpdesk.user","model_crm_helpdesk","crm.group_crm_user",1,1,1,1 +"access_report_crm_helpdesk_user","report.crm.helpdesk.user","model_crm_helpdesk_report","crm.group_crm_user",1,1,1,1 +"access_report_crm_helpdesk_manager","report.crm.helpdesk.manager","model_crm_helpdesk_report","crm.group_crm_manager",1,1,1,1 diff --git a/addons/idea/__init__.py b/addons/idea/__init__.py index 4c285a7a0a7..3c359952022 100644 --- a/addons/idea/__init__.py +++ b/addons/idea/__init__.py @@ -21,5 +21,6 @@ import idea import wizard +import report # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/idea/__openerp__.py b/addons/idea/__openerp__.py index f10a00c75e2..d2b854ba0b5 100644 --- a/addons/idea/__openerp__.py +++ b/addons/idea/__openerp__.py @@ -39,6 +39,7 @@ 'wizard/idea_post_vote_view.xml', 'idea_view.xml', 'idea_workflow.xml', + 'report/report_vote_view.xml', 'security/idea_security.xml', 'security/ir.model.access.csv', ], diff --git a/addons/idea/idea_view.xml b/addons/idea/idea_view.xml index 6b728560277..0160d228248 100644 --- a/addons/idea/idea_view.xml +++ b/addons/idea/idea_view.xml @@ -149,20 +149,6 @@ - - - - @@ -385,10 +371,9 @@ form tree,form - {'search_default_week':1} - + diff --git a/addons/idea/report/__init__.py b/addons/idea/report/__init__.py new file mode 100644 index 00000000000..91cacda571a --- /dev/null +++ b/addons/idea/report/__init__.py @@ -0,0 +1,23 @@ +# -*- 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 report_vote +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/idea/report/report_vote.py b/addons/idea/report/report_vote.py new file mode 100644 index 00000000000..2751450129c --- /dev/null +++ b/addons/idea/report/report_vote.py @@ -0,0 +1,78 @@ +# -*- 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 report_vote(osv.osv): + _name = "report.vote" + _description = "Idea Vote Statistics" + _auto = False + _rec_name = 'date' + _columns = { + 'date': fields.date('Date Order', readonly=True), + 'year': fields.char('Year', size=4, 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), + 'day': fields.char('Day', size=128, readonly=True), + 'user_id': fields.many2one('res.users', 'User Name'), + 'score': fields.integer('Score'), + 'idea_id': fields.many2one('idea.idea', 'Idea'), + 'nbr':fields.integer('# of Lines', readonly=True), + 'idea_state': fields.selection([('draft', 'Draft'),('open', 'Opened'), + ('close', 'Accepted'), + ('cancel', 'Cancelled')], + 'State'), + 'category_id': fields.many2one('idea.category', 'Category'), + 'creater_id': fields.many2one('res.users', 'User Name'), + + } + _order = 'date desc' + def init(self, cr): + tools.drop_view_if_exists(cr, 'report_vote') + cr.execute(""" + create or replace view report_vote as ( + select + min(iv.id) as id, + count(*) as nbr, + to_date(to_char(iv.date, 'dd-MM-YYYY'),'dd-MM-YYYY') as date, + to_char(iv.date, 'YYYY') as year, + to_char(iv.date, 'MM') as month, + to_char(iv.date, 'YYYY-MM-DD') as day, + iv.user_id as user_id, + iv.idea_id as idea_id, + ii.state as idea_state, + ii.user_id as creater_id, + ii.category_id, + (sum(CAST(iv.score as integer))/count(iv.*)) as score + from + idea_vote as iv + left join idea_idea as ii on (ii.id = iv.idea_id) + group by + iv.id ,to_char(iv.date, 'dd-MM-YYYY'),to_char(iv.date, 'YYYY'), + to_char(iv.date, 'MM'),to_char(iv.date, 'YYYY-MM-DD'),ii.state, + iv.user_id,ii.user_id,ii.category_id,iv.idea_id + ) + """) +report_vote() + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/idea/report/report_vote_view.xml b/addons/idea/report/report_vote_view.xml new file mode 100644 index 00000000000..d2a4006a7e0 --- /dev/null +++ b/addons/idea/report/report_vote_view.xml @@ -0,0 +1,90 @@ + + + + + report.vote.tree + report.vote + tree + + + + + + + + + + + + + + + + + + + report.vote.search + report.vote + search + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Idea Vote Analysis + report.vote + form + tree,graph + + {'search_default_User':1,'group_by_no_leaf':1,'group_by':[]} + + + + + + diff --git a/addons/mail_gateway/mail_gateway.py b/addons/mail_gateway/mail_gateway.py index 3ccde181883..e4e964cac28 100644 --- a/addons/mail_gateway/mail_gateway.py +++ b/addons/mail_gateway/mail_gateway.py @@ -217,39 +217,34 @@ class mailgate_tool(osv.osv_memory): msg_id = msg_pool.create(cr, uid, msg_data, context=context) return True - def email_forward(self, cr, uid, model, res_ids, msg, email_error=False): + def email_forward(self, cr, uid, model, res_ids, msg, email_error=False, context=None): """Sends an email to all people following the thread - @param res_id: Id of the record of OpenObject model created from the Email details - @param msg: Email details + @param res_id: Id of the record of OpenObject model created from the email message + @param msg: email.message.Message to forward @param email_error: Default Email address in case of any Problem """ - for res_id in res_ids: - history_pool = self.pool.get('mailgate.message') - message = email.message_from_string(tools.ustr(msg).encode('utf-8')) - encoding = message.get_content_charset() - message['body'] = message.get_payload(decode=True) - if encoding: - message['body'] = self._to_decode(message['body'], [encoding]) - subject = message['Subject'] + model_pool = self.pool.get(model) - from_email = self._decode_header(message['From']) - - model_pool = self.pool.get(model) - message_followers = model_pool.message_followers(cr, uid, [res_id])[res_id] + for res in model_pool.browse(cr, uid, res_ids, context=context): + message_followers = model_pool.message_followers(cr, uid, [res.id])[res.id] message_followers_emails = self.to_email(','.join(message_followers)) - - message_recipients = self.to_email(','.join([from_email,self._decode_header(message['To']),self._decode_header(message['Cc'])]) ) + message_recipients = self.to_email(','.join([self._decode_header(msg['from']), + self._decode_header(msg['to']), + self._decode_header(msg['cc'])])) message_forward = [i for i in message_followers_emails if (i and (i not in message_recipients))] - res = None - try: - res = tools.email_send(from_email, message_forward, subject, body, openobject_id=res_id) - except Exception, e: - if email_error: - temp_msg = '[%s] %s'%(res_id, message['Subject']) - del message['Subject'] - message['Subject'] = '[OpenERP-Error] %s' %(temp_msg) - tools.email_send(from_email, email_error, message.get('Subject'), message.get('body'), openobject_id=res_id) + if message_forward: + # TODO: we need an interface for this for all types of objects, not just leads + if hasattr(res, 'section'): + del msg['reply-to'] + msg['reply-to'] = res.section.email_from + + if not tools.misc._email_send(msg, openobject_id=res_id) and email_error: + subj = msg['subject'] + del msg['subject'], msg['to'], msg['cc'], msg['bcc'] + msg['subject'] = '[OpenERP-Forward-Failed] %s' % subj + msg['to'] = email_error + tools.misc._email_send(msg, openobject_id=res_id) def process_email(self, cr, uid, model, message, attach=True, context=None): """This function Processes email and create record for given OpenERP model @@ -295,8 +290,6 @@ class mailgate_tool(osv.osv_memory): return res_id - history_pool = self.pool.get('mailgate.message') - # Warning: message_from_string doesn't always work correctly on unicode, # we must use utf-8 strings here :-( msg_txt = email.message_from_string(tools.ustr(message).encode('utf-8')) @@ -426,7 +419,7 @@ class mailgate_tool(osv.osv_memory): context = context) else: self.history(cr, uid, model, res_ids, msg, att_ids, context=context) - self.email_forward(cr, uid, model, res_ids, message) + self.email_forward(cr, uid, model, res_ids, msg_txt) return new_res_id def get_partner(self, cr, uid, from_email, context=None): diff --git a/addons/project_issue/security/ir.model.access.csv b/addons/project_issue/security/ir.model.access.csv index 2a0b1f24bce..29b2532eb55 100755 --- a/addons/project_issue/security/ir.model.access.csv +++ b/addons/project_issue/security/ir.model.access.csv @@ -1,5 +1,6 @@ "id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink" "access_project_issue_all","project.issue","model_project_issue","project.group_project_manager",1,1,1,1 +"access_project_issue_user","project.issue","model_project_issue","project.group_project_user",1,1,1,1 "access_project_issue","project.issue","model_project_issue","project_issue.group_project_supporter",1,1,1,1 "access_project_issue_report_all","project.issue.report","model_project_issue_report","project.group_project_manager",1,1,1,1 "access_project_issue_report","project.issue.report","model_project_issue_report","project_issue.group_project_supporter",1,1,1,1