[MERGE] merge with trunk addons

bzr revid: mra@mra-laptop-20100628062601-swhjjvfsifsafhsq
bzr revid: mra@mra-laptop-20100628091020-zpr00l155h9a3vx1
bzr revid: mra@mra-laptop-20100628120512-h0kcgxv8xavf94ny
bzr revid: mra@mra-laptop-20100628134728-bangd7mely7g3302
This commit is contained in:
Mustufa Rangwala 2010-06-28 19:17:28 +05:30
commit 714f62d7bd
21 changed files with 321 additions and 90 deletions

View File

@ -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:

View File

@ -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])

View File

@ -405,12 +405,16 @@
<search string="Search Statement">
<group col="10" colspan="4">
<filter icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Draft Statement"/>
<filter icon="terp-check" string="Poster" domain="[('state','=','confirm')]" help="Confirm confirm"/>
<filter icon="terp-check" string="Posted" domain="[('state','=','confirm')]" help="Confirm confirm"/>
<separator orientation="vertical"/>
<field name="name"/>
<field name="date"/>
<field name="journal_id"/>
</group>
<group expand="0" string="Group By..." colspan="12" col="10">
<filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'journal_id'}"/>
<filter string="Period" icon="terp-go-month" domain="[]" context="{'group_by':'period_id'}"/>
</group>
</search>
</field>
</record>
@ -2325,6 +2329,19 @@
<field context="{'partner_id': partner_id, 'amount': amount, 'account_id': account_id, 'currency_id': parent.currency, 'journal_id': parent.journal_id, 'date':date}" name="reconcile_id"/>
<field invisible="1" name="reconcile_amount"/>
</tree>
<form string="Statement lines">
<field name="date"/>
<field name="name"/>
<field name="type"/>
<field name="partner_id" on_change="onchange_partner_id(partner_id, type, parent.currency)"/>
<field domain="[('journal_id', '=', parent.journal_id), ('type', '&lt;&gt;', 'view')]" name="account_id"/>
<field name="amount"/>
<field context="{'partner_id':partner_id,'amount':amount,'account_id':account_id,'currency_id': parent.currency,'journal_id':parent.journal_id, 'date':date}" name="reconcile_id"/>
<field name="ref"/>
<field name="sequence"/>
<separator colspan="4" string="Notes"/>
<field colspan="4" name="note" nolabel="1"/>
</form>
</field>
</page>
<page string="Cash Box">

View File

@ -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

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_calendar_attendee calendar.attendee model_calendar_attendee base.group_user 1 1 1 1
3 access_calendar_alarm calendar.alarm model_calendar_alarm base.group_user 1 1 1 1
4 access_res_alarm res.alarm model_res_alarm base.group_user 1 1 1 1
5 access_calendar_event_all access_calendar_todo calendar.event calendar.todo model_calendar_event model_calendar_todo 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

View File

@ -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',

View File

@ -67,7 +67,7 @@
<field name="view_mode">tree,calendar</field>
<field name="view_id" ref="crm_case_phone_tree_view"/>
<field name="domain" eval="'[(\'categ_id\',\'=\','+str(ref('categ_phone1'))+')]'"/>
<field name="context">{'set_editable':True,'default_state':'open','search_default_current':1,'search_default_today':1}</field>
<field name="context" eval="'{\'set_editable\':True,\'default_state\':\'open\', \'search_default_current\':1,\'search_default_today\':1, \'default_categ_id\': ' + str(ref('categ_phone1')) +'}'"/>
<field name="search_view_id" ref="crm.view_crm_case_phonecalls_filter"/>
</record>
@ -103,7 +103,7 @@
<field name="view_mode">tree,calendar</field>
<field name="view_id" ref="crm_case_phone_tree_view"/>
<field name="domain" eval="'[(\'categ_id\',\'=\','+str(ref('categ_phone2'))+')]'"/>
<field name="context">{'default_state':'open','search_default_current':1}</field>
<field name="context" eval="'{\'default_state\':\'open\', \'search_default_current\':1, \'default_categ_id\': ' + str(ref('categ_phone2')) +'}'"/>
<field name="search_view_id" ref="crm.view_crm_case_phonecalls_filter"/>
</record>

View File

@ -204,8 +204,11 @@
<tree string="Phone Calls" colors="grey:state in ('cancel','done');blue:state in ('pending',)">
<field name="date" string="Date"/>
<field name="name" string="Call Summary"/>
<field name="partner_id" string="Partner"/>
<field name="partner_contact"/>
<field name="partner_id"
on_change="onchange_partner_id(partner_id, email_from)"
string="Partner" />
<field name="partner_address_id" string="Contact"
on_change="onchange_partner_address_id(partner_address_id, email_from)" />
<field name="partner_phone"/>
<field name="user_id"/>
<field name="state" invisible="1"/>

View File

@ -1,6 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record model="ir.ui.menu" id="base.menu_base_config">
<field eval="[(4, ref('crm.group_crm_manager'))]" name="groups_id"/>
</record>
<menuitem id="base.menu_crm_config_sales" name="Sales"
parent="base.menu_base_config" sequence="1"/>

View File

@ -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

Can't render this file because it contains an unexpected character in line 9 and column 38.

View File

@ -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})

View File

@ -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

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_crm_claim access_crm_claim_manager crm.claim crm.claim.manager model_crm_claim crm.group_crm_manager 1 1 1 1
3 access_crm_claim_report_user access_crm_claim_user crm.claim.report crm.claim.user model_crm_claim_report model_crm_claim crm.group_crm_user 1 0 1 0 1 0 1
4 access_crm_claim_report_user crm.claim.report.user model_crm_claim_report crm.group_crm_user 1 0 0 0
5 access_crm_claim_report_manager crm.claim.report.manager model_crm_claim_report crm.group_crm_manager 1 0 0 0

View File

@ -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

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_crm_fundraising access_crm_fundraising_manager crm.fundraising crm.fundraising.manager model_crm_fundraising crm.group_crm_manager 1 1 1 1
3 access_crm_fundraising_report_user access_crm_fundraising_user crm.fundraising.report crm.fundraising.user model_crm_fundraising_report model_crm_fundraising crm.group_crm_user 1 0 1 0 1 0 1
4 access_crm_fundraising_report_user crm.fundraising.report.user model_crm_fundraising_report crm.group_crm_user 1 0 0 0
5 access_crm_fundraising_report_manager crm.fundraising.report.manager model_crm_fundraising_report crm.group_crm_manager 1 0 0 0

View File

@ -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

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_crm_helpdesk access_crm_helpdesk_manager crm.helpdesk crm.helpdesk.manager model_crm_helpdesk crm.group_crm_manager 1 1 1 1
3 access_report_crm_helpdesk access_crm_helpdesk_user report.crm.helpdesk crm.helpdesk.user model_crm_helpdesk_report model_crm_helpdesk crm.group_crm_user 1 1 1 1
4 access_report_crm_helpdesk_user report.crm.helpdesk.user model_crm_helpdesk_report crm.group_crm_user 1 1 1 1
5 access_report_crm_helpdesk_manager report.crm.helpdesk.manager model_crm_helpdesk_report crm.group_crm_manager 1 1 1 1

View File

@ -21,5 +21,6 @@
import idea
import wizard
import report
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -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',
],

View File

@ -149,20 +149,6 @@
<field name="arch" type="xml">
<search string="Ideas vote">
<group col="10" colspan="4">
<filter icon="terp-go-year" string=" 365 Days "
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')),('date','&gt;',(datetime.date.today()-datetime.timedelta(days=365)).strftime('%%Y-%%m-%%d'))]"
help="Tasks performed in last 365 days"/>
<filter icon="terp-go-month" string=" 30 Days "
name="month"
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')), ('date','&gt;',(datetime.date.today()-datetime.timedelta(days=30)).strftime('%%Y-%%m-%%d'))]"
help="Tasks performed in last 30 days"/>
<filter icon="terp-go-week"
string=" 7 Days "
name="week"
separator="1"
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')), ('date','&gt;',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]"
help="Tasks during last 7 days"/>
<separator orientation="vertical"/>
<field name="idea_id" widget="selection"/>
<field name="user_id" string="User"/>
</group>
@ -385,10 +371,9 @@
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="search_view_id" ref="view_idea_vote_search"/>
<field name="context">{'search_default_week':1}</field>
</record>
<menuitem name="Votes" parent="menu_idea_reporting" id="menu_idea_vote" action="action_idea_vote"/>
<menuitem name="Votes" parent="menu_ideas1" id="menu_idea_vote" action="action_idea_vote"/>
</data>
</openerp>

View File

@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import report_vote
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,78 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import 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:

View File

@ -0,0 +1,90 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_report_vote_tree" model="ir.ui.view">
<field name="name">report.vote.tree</field>
<field name="model">report.vote</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Idea Vote Analysis">
<field name="date" invisible="1"/>
<field name="year" invisible="1"/>
<field name="day" invisible="1"/>
<field name="month" invisible="1"/>
<field name="user_id" invisible="1"/>
<field name="idea_id" invisible="1"/>
<field name="idea_state"/>
<field name="creater_id" invisible="1"/>
<field name="category_id" invisible="1"/>
<field name="nbr" sum="# of Lines"/>
<field name="score" sum="Score"/>
</tree>
</field>
</record>
<record id="view_report_vote_search" model="ir.ui.view">
<field name="name">report.vote.search</field>
<field name="model">report.vote</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Idea Vote Analysis">
<group>
<filter icon="terp-go-year" string=" 365 Days "
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')),('date','&gt;',(datetime.date.today()-datetime.timedelta(days=365)).strftime('%%Y-%%m-%%d'))]"
help="Idea Vote created last 365 days"/>
<filter icon="terp-go-month" string=" 30 Days "
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')), ('date','&gt;',(datetime.date.today()-datetime.timedelta(days=30)).strftime('%%Y-%%m-%%d'))]"
help="Idea Vote created in last 30 days"/>
<filter icon="terp-go-week"
string=" 7 Days "
separator="1"
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')), ('date','&gt;',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]"
help="Idea Vote created last 7 days"/>
<separator orientation="vertical"/>
<filter icon="terp-go-today"
string=" Today "
name="today"
separator="1"
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d'))]"
help="Idea Vote created by today"/>
<separator orientation="vertical"/>
<filter icon="terp-camera_test"
string="Open"
domain="[('idea_state','=',('open'))]"/>
<filter icon="terp-camera_test"
string="Accepted"
domain="[('idea_state','=',('close'))]"/>
<filter icon="terp-gtk-stop"
string="Refused"
domain="[('idea_state','=',('cancel'))]"/>
</group>
<newline/>
<group expand="0" string="Group By..." colspan="10" col="12">
<filter string="Idea" icon="terp-personal" context="{'group_by':'idea_id'}"/>
<filter string="Category" icon="terp-stock_symbol-selection" context="{'group_by':'category_id'}"/>
<separator orientation="vertical"/>
<filter string="User" icon="terp-personal" name="User" context="{'group_by':'user_id'}"/>
<filter string="Creater" icon="terp-personal" context="{'group_by':'creater_id'}"/>
<filter string="State" icon="terp-stock_effects-object-colorize" context="{'group_by':'idea_state'}"/>
<separator orientation="vertical"/>
<filter string="Day" icon="terp-go-today" context="{'group_by':'day'}"/>
<filter string="Month" icon="terp-go-month" context="{'group_by':'month'}"/>
<filter string="Year" icon="terp-go-year" context="{'group_by':'year'}"/>
</group>
</search>
</field>
</record>
<record id="action_report_vote_all" model="ir.actions.act_window">
<field name="name">Idea Vote Analysis</field>
<field name="res_model">report.vote</field>
<field name="view_type">form</field>
<field name="view_mode">tree,graph</field>
<field name="search_view_id" ref="view_report_vote_search"/>
<field name="context">{'search_default_User':1,'group_by_no_leaf':1,'group_by':[]}</field>
</record>
<menuitem action="action_report_vote_all" id="menu_report_vote_all" parent="menu_idea_reporting" sequence="1"/>
</data>
</openerp>

View File

@ -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):

View File

@ -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

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_project_issue_all project.issue model_project_issue project.group_project_manager 1 1 1 1
3 access_project_issue_user project.issue model_project_issue project.group_project_user 1 1 1 1
4 access_project_issue project.issue model_project_issue project_issue.group_project_supporter 1 1 1 1
5 access_project_issue_report_all project.issue.report model_project_issue_report project.group_project_manager 1 1 1 1
6 access_project_issue_report project.issue.report model_project_issue_report project_issue.group_project_supporter 1 1 1 1