bzr revid: apa@tinyerp.com-20101015102603-xmvl60cruptl3g1n
This commit is contained in:
apa-tiny 2010-10-15 15:56:03 +05:30
commit 70d0b42c7f
164 changed files with 2522 additions and 1678 deletions

View File

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!--
Invoices
-->
@ -434,6 +433,7 @@
<field name="help">Most of customer invoices are automatically generated in draft mode by OpenERP flows, following a purchase order for instance. Review, confirm or cancel, pay or refund your customers' invoices here. A manual invoice can be created here.</field>
</record>
<record id="action_invoice_tree1_view1" model="ir.actions.act_window.view">
<field eval="1" name="sequence"/>
<field name="view_mode">tree</field>
@ -446,6 +446,7 @@
<field name="view_id" ref="invoice_form"/>
<field name="act_window_id" ref="action_invoice_tree1"/>
</record>
<menuitem action="action_invoice_tree1" id="menu_action_invoice_tree1" parent="menu_finance_receivables"/>
<record id="action_invoice_tree2" model="ir.actions.act_window">

View File

@ -1361,7 +1361,7 @@ class account_invoice_line(osv.osv):
else:
app_acc_in = in_acc_cate
app_acc_exp = ex_acc_cate
if app_acc_in.company_id.id != company_id and app_acc_exp.company_id.id != company_id:
if app_acc_in and app_acc_in.company_id.id != company_id and app_acc_exp and app_acc_exp.company_id.id != company_id:
in_res_id = account_obj.search(cr, uid, [('name','=',app_acc_in.name),('company_id','=',company_id)])
exp_res_id = account_obj.search(cr, uid, [('name','=',app_acc_exp.name),('company_id','=',company_id)])
if not in_res_id and not exp_res_id:

View File

@ -158,7 +158,7 @@
<!-- Calenadar's menu -->
<menuitem id="base.menu_calendar_configuration" name="Calendar"
parent="base.menu_base_config" sequence="6" groups="base.group_system" />
parent="base.menu_base_config" sequence="6" groups="base.group_system,base.group_sale_manager" />
<!-- Invitation menu -->

View File

@ -1,5 +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_attendee","calendar.attendee","model_calendar_attendee","base.group_user",1,1,1,0
"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 0
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_todo calendar.todo model_calendar_todo base.group_user 1 1 1 1

View File

@ -36,11 +36,11 @@ class base_calendar_invite_attendee(osv.osv_memory):
_columns = {
'type': fields.selection([('internal', 'Internal User'), \
('external', 'External Email'), \
('partner', 'Partner Contacts')], 'Type', required=True),
('partner', 'Partner Contacts')], 'Type', required=True, help="Select whom you want to Invite"),
'user_ids': fields.many2many('res.users', 'invite_user_rel',
'invite_id', 'user_id', 'Users'),
'partner_id': fields.many2one('res.partner', 'Partner'),
'email': fields.char('Email', size=124),
'email': fields.char('Email', size=124, help="Provide external email address who will receive this invitation."),
'contact_ids': fields.many2many('res.partner.address', 'invite_contact_rel',
'invite_id', 'contact_id', 'Contacts'),
'send_mail': fields.boolean('Send mail?', help='Check this if you want to \

View File

@ -10,42 +10,31 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Invite People">
<separator string="Invite People" colspan="4" />
<field name="type" />
<field name="send_mail" />
<newline />
<group col="2" colspan="6"
attrs="{'invisible': [('type', '!=', 'external')]}">
<field name="email" colspan="4"
attrs="{'required': [('type', '=', 'external')]}" />
</group>
<group col="2" colspan="6"
attrs="{'invisible': [('type', '!=', 'internal')]}">
<separator string="Users" colspan="4" />
<field name="user_ids" select="1" colspan="4"
nolabel="1" />
<newline />
</group>
<group col="2" colspan="6"
attrs="{'invisible': [('type', '!=', 'partner')]}">
<field name="partner_id" colspan="2"
on_change="onchange_partner_id(partner_id)"
attrs="{'required': [('type', '=', 'partner')]}" />
<newline />
<separator string="Partner Contacts"
colspan="6" />
<field name="contact_ids" select="1" colspan="4"
nolabel="1" domain="[('partner_id', '=', partner_id)]"
attrs="{'readonly': [('type', '!=', 'partner')]}" />
</group>
<newline />
<separator string="" colspan="6" />
<group col="4" colspan="4">
<button icon='gtk-cancel' special="cancel"
string="Cancel" />
<button name="do_invite" string="Invite"
type="object" icon="gtk-ok" />
</group>
<separator string="Invite People" colspan="4"/>
<field name="type"/>
<field name="send_mail"/>
<notebook colspan="4">
<page string="Data">
<group col="2" colspan="6" attrs="{'invisible': [('type', '!=', 'external')]}">
<field name="email" colspan="4" attrs="{'required': [('type', '=', 'external')]}"/>
</group>
<group col="2" colspan="6" attrs="{'invisible': [('type', '!=', 'internal')]}">
<separator string="Users" colspan="4"/>
<field name="user_ids" select="1" colspan="4" nolabel="1" height="180"/>
<newline/>
</group>
<group col="2" colspan="6" attrs="{'invisible': [('type', '!=', 'partner')]}">
<field name="partner_id" colspan="2" on_change="onchange_partner_id(partner_id)" attrs="{'required': [('type', '=', 'partner')]}"/>
<newline/>
<separator string="Partner Contacts" colspan="6"/>
<field name="contact_ids" select="1" colspan="4" nolabel="1" domain="[('partner_id', '=', partner_id)]" attrs="{'readonly': [('type', '!=', 'partner')]}"/>
</group>
</page>
</notebook>
<group col="4" colspan="4">
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
<button name="do_invite" string="Invite" type="object" icon="gtk-ok"/>
</group>
</form>
</field>
</record>

View File

@ -119,7 +119,8 @@
action="open_board_statistical_dash"
sequence="0"
id="menu_board_statistics_dash"
icon="terp-graph"/>
icon="terp-graph"
groups="base.group_sale_manager"/>
</data>
</openerp>

View File

@ -157,6 +157,8 @@
name="Sales Dashboard" parent="board.menu_dasboard"
action="open_board_crm"
sequence="1"
id="menu_board_crm" icon="terp-graph"/>
id="menu_board_crm" icon="terp-graph"
groups="base.group_sale_salesman"/>
<menuitem icon="terp-partner" id="base.menu_base_partner" name="Sales" sequence="0" groups="base.group_sale_salesman,base.group_sale_manager,base.group_system,base.group_partner_manager" action="open_board_crm"/>
</data>
</openerp>

View File

@ -538,7 +538,7 @@ class crm_case_section(osv.osv):
'resource_calendar_id': fields.many2one('resource.calendar', "Resource's Calendar"),
'note': fields.text('Description'),
'working_hours': fields.float('Working Hours', digits=(16,2 )),
'stage_ids':fields.many2many('crm.case.stage', 'section_stage_rel', 'section_id', 'stage_id', 'Stages'),
'stage_ids': fields.many2many('crm.case.stage', 'section_stage_rel', 'section_id', 'stage_id', 'Stages'),
}
_defaults = {
@ -628,6 +628,14 @@ class crm_case_categ(osv.osv):
crm_case_categ()
class crm_case_stage(osv.osv):
_inherit = "crm.case.stage"
_columns = {
'section_ids':fields.many2many('crm.case.section', 'section_stage_rel', 'stage_id', 'section_id', 'Sections'),
}
crm_case_stage()
class crm_case_resource_type(osv.osv):
""" Resource Type of case """
_name = "crm.case.resource.type"

View File

@ -128,13 +128,10 @@
<field eval="&quot;Questionnaire&quot;" name="name"/>
<field eval="&quot;open&quot;" name="state"/>
<field name="section_id" ref="crm.section_sales_department"/>
<field eval="&quot;Smith John&quot;" name="partner_name2"/>
<field eval="&quot;(487) 013-1504&quot;" name="partner_mobile"/>
<field name="categ_id" ref="crm.categ_oppor6"/>
<field name="stage_id" ref="crm.stage_lead1"/>
<field eval="&quot;Website Visitor&quot;" name="partner_name"/>
<field eval="&quot;smith_john@gmail.com&quot;" name="email_from"/>
<field eval="time.strftime('%Y-%m-16 10:05:15')" name="date"/>
</record>
<record id="crm_case_business_card0" model="crm.lead">
<field eval="1" name="active"/>
@ -145,13 +142,9 @@
<field eval="&quot;Marketing Products&quot;" name="name"/>
<field eval="&quot;open&quot;" name="state"/>
<field name="section_id" ref="crm.section_sales_department"/>
<field eval="&quot;Elvis Borne&quot;" name="partner_name2"/>
<field eval="&quot;(147) 014-6574&quot;" name="partner_mobile"/>
<field name="categ_id" ref="crm.categ_oppor5"/>
<field name="stage_id" ref="crm.stage_lead1"/>
<field eval="&quot;Business Card&quot;" name="partner_name"/>
<field eval="&quot;(124) 587-8974&quot;" name="partner_phone"/>
<field eval="time.strftime('%Y-%m-16 11:05:15')" name="date"/>
</record>
<record id="crm_case_imported_contact0" model="crm.lead">
<field eval="1" name="active"/>
@ -162,8 +155,6 @@
<field eval="&quot;Business Group&quot;" name="name"/>
<field eval="&quot;cancel&quot;" name="state"/>
<field name="section_id" ref="crm.section_sales_department"/>
<field eval="&quot;Drew Clark&quot;" name="partner_name2"/>
<field eval="&quot;(125) 021-4781&quot;" name="partner_mobile"/>
<field name="categ_id" ref="crm.categ_oppor1"/>
<field name="stage_id" ref="crm.stage_lead2"/>
<field eval="&quot;Imported Contact&quot;" name="partner_name"/>
@ -177,12 +168,9 @@
<field eval="&quot;OpenERP Campaining&quot;" name="name"/>
<field eval="&quot;draft&quot;" name="state"/>
<field name="section_id" ref="crm.section_sales_department"/>
<field eval="&quot;Carl Nelson&quot;" name="partner_name2"/>
<field eval="&quot;(874) 022-6574&quot;" name="partner_mobile"/>
<field name="categ_id" ref="crm.categ_oppor3"/>
<field name="stage_id" ref="crm.stage_lead3"/>
<field eval="&quot;Campaining&quot;" name="partner_name"/>
<field eval="&quot;(232) 147-6329&quot;" name="partner_phone"/>
</record>
<record id="crm_case_company_partnership0" model="crm.lead">
<field eval="1" name="active"/>
@ -193,12 +181,9 @@
<field eval="&quot;Offer&quot;" name="name"/>
<field eval="&quot;done&quot;" name="state"/>
<field name="section_id" ref="crm.section_sales_department"/>
<field eval="&quot;Joe Lucas&quot;" name="partner_name2"/>
<field eval="&quot;(234) 031-1254&quot;" name="partner_mobile"/>
<field name="categ_id" ref="crm.categ_oppor7"/>
<field name="stage_id" ref="crm.stage_lead1"/>
<field eval="&quot;Partnership Offer&quot;" name="partner_name"/>
<field eval="&quot;(254) 954-2147&quot;" name="partner_phone"/>
</record>

View File

@ -31,7 +31,7 @@
parent="base.menu_base_partner" sequence="1" />
<menuitem parent="base.menu_sales" name="Leads"
groups="base.group_extended"
groups="base.group_extended,base.group_sale_salesman"
id="menu_crm_case_categ0_act_leads"
action="crm_case_category_act_leads_all" sequence="1" />

View File

@ -54,7 +54,7 @@
<newline />
<field name="section_id" widget="selection" />
<field name="user_id" />
<field name="stage_id" readonly="1"/>
<field name="stage_id" domain="[('object_id.model', '=', 'crm.lead'), ('section_ids', '=', section_id)]"/>
<group col="2" colspan="1">
<button name="stage_previous" string=""
states="open,pending,draft" type="object"
@ -233,7 +233,7 @@
<field name="referred" invisible="1"/>
<field name="channel_id" invisible="1"/>
<field name="stage_id" readonly="1"/>
<field name="stage_id"/>
<button name="stage_previous" string="Previous Stage"
states="open,pending" type="object" icon="gtk-go-back" />
<button name="stage_next" string="Next Stage"
@ -314,11 +314,11 @@
</field>
<field name="section_id" default="context.get('section_id', False)" widget="selection"
context="{'invisible_section': False}">
<filter icon="terp-personal+"
<filter icon="terp-personal+" groups="base.group_extended"
context="{'invisible_section': False}"
domain="['|', ('section_id', '=', context.get('section_id')), '|', ('section_id.user_id','=',uid), ('section_id.member_ids', 'in', [uid])]"
help="My Sales Team(s)"/>
<filter icon="terp-personal+"
<filter icon="terp-personal+" groups="base.group_extended"
context="{'invisible_section': False}"
domain="[]"
help="Show Sales Team"/>
@ -347,7 +347,7 @@
<filter string="Category" icon="terp-gtk-jump-to-rtl" domain="[]" context="{'group_by':'categ_id'}"/>
<filter string="Campaign" icon="terp-stock_symbol-selection"
domain="[]" context="{'group_by':'type_id'}" />
<filter string="Channel" icon="terp-stock_symbol-selection"
<filter string="Channel" icon="terp-call-start"
domain="[]" context="{'group_by':'channel_id'}" />
<separator orientation="vertical"/>
<filter string="Stage" icon="terp-stage" domain="[]" context="{'group_by':'stage_id'}"/>

View File

@ -111,7 +111,7 @@
<menuitem id="menu_attendee_invitations"
name="Meeting Invitations" parent="crm.menu_meeting_sale"
sequence="10" action="action_view_attendee_form"
groups="base.group_extended" />
groups="base.group_extended,base.group_sale_salesman" />
</data>
</openerp>

View File

@ -313,7 +313,7 @@
<separator orientation="vertical"/>
<field name="partner_id" select="1" />
<field name="section_id" select="1" widget="selection">
<filter icon="terp-personal+"
<filter icon="terp-personal+" groups="base.group_extended"
domain="['|', ('section_id', '=', context.get('section_id')), '|', ('section_id.user_id','=',uid), ('section_id.member_ids', 'in', [uid])]"
help="My Sales Team(s)" />
</field>

View File

@ -19,7 +19,7 @@
#
##############################################################################
from osv import fields,osv
from osv import fields, osv
from tools.translate import _
import crm
import time

View File

@ -2,12 +2,12 @@
<openerp>
<data noupdate="1">
<record model="crm.case.categ" id="categ_oppor1">
<field name="name">Interrest in Computer</field>
<field name="name">Interest in Computer</field>
<field name="section_id" ref="section_sales_department"/>
<field name="object_id" search="[('model','=','crm.lead')]" model="ir.model"/>
</record>
<record model="crm.case.categ" id="categ_oppor2">
<field name="name">Interrest in Accessories</field>
<field name="name">Interest in Accessories</field>
<field name="section_id" ref="section_sales_department"/>
<field name="object_id" search="[('model','=','crm.lead')]" model="ir.model"/>
</record>

View File

@ -14,9 +14,8 @@
<label string="Stage:" align="1.0"/>
<group colspan="1" col="4">
<field name="stage_id" nolabel="1"
widget="selection"
on_change="onchange_stage_id(stage_id)"
domain="[('object_id.model', '=', 'crm.lead')]"/>
domain="[('object_id.model', '=', 'crm.lead'), ('section_ids', '=', section_id)]"/>
<button name="stage_previous"
states="draft,open,pending" type="object"
icon="gtk-go-back" string="" />
@ -294,11 +293,11 @@
default="context.get('section_id', False)"
context="{'invisible_section': False}"
widget="selection">
<filter icon="terp-personal+"
<filter icon="terp-personal+" groups="base.group_extended"
domain="['|', ('section_id', '=', context.get('section_id')), '|', ('section_id.user_id','=',uid), ('section_id.member_ids', 'in', [uid])]"
context="{'invisible_section': False}"
help="My Sales Team(s)" />
<filter icon="terp-personal+"
<filter icon="terp-personal+" groups="base.group_extended"
context="{'invisible_section': False}"
domain="[]"
help="Show Sales Team"/>
@ -312,6 +311,8 @@
<filter icon="terp-personal+" context="{'invisible_country': False}" help="Show countries"/>
</field>
<separator orientation="vertical"/>
<field name="email_from"/>
<separator orientation="vertical"/>
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
<newline/>
<field name="create_date" string="Creation Date"/>

View File

@ -57,7 +57,7 @@
</record>
<menuitem name="Phone Calls" id="menu_crm_case_phone"
groups="base.group_extended"
groups="base.group_extended,base.group_sale_salesman"
parent="base.menu_base_partner" sequence="4" />
<record model="ir.actions.act_window" id="crm_case_categ_phone_incoming0">

View File

@ -31,6 +31,7 @@
<field name="partner_phone"/>
<field name="user_id"/>
<field name="categ_id" string="Type"/>
<field name="create_date" invisible="1"/>
<button string="Opportunity"
name="%(phonecall2opportunity_act)d"
states="draft,open,pending"
@ -271,7 +272,7 @@
</field>
<field name="section_id"
select="1" widget="selection" string="Sales Team">
<filter icon="terp-personal+"
<filter icon="terp-personal+" groups="base.group_extended"
domain="['|', ('section_id', '=', context.get('section_id')), '|', ('section_id.user_id','=',uid), ('section_id.member_ids', 'in', [uid])]"
help="My Sales Team(s)" />
</field>

View File

@ -45,8 +45,10 @@
<field name="allow_unlink" select="2"/>
<field name="change_responsible"/>
</group>
<separator string="Team Members" colspan="4"/>
<field name="member_ids" nolabel="1" colspan="4"/>
<group col="1" colspan="4" groups="base.group_extended">
<separator string="Team Members" colspan="4"/>
<field name="member_ids" nolabel="1" colspan="4" height="250"/>
</group>
</page>
<page string="Stages">
<separator string="Select stages for this Sales Team" colspan="4"/>

View File

@ -37,41 +37,6 @@ class crm_lead_report(osv.osv):
_auto = False
_description = "CRM Lead Report"
def _get_data(self, cr, uid, ids, field_name, arg, context={}):
""" @param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of case and section Datas IDs
@param context: A standard dictionary for contextual values """
res = {}
avg_ans = 0.0
for case in self.browse(cr, uid, ids, context):
if field_name != 'avg_answers':
state = field_name[5:]
cr.execute("select count(id) from crm_lead where \
section_id =%s and state='%s'"%(case.section_id.id, state))
state_cases = cr.fetchone()[0]
perc_state = (state_cases / float(case.nbr)) * 100
res[case.id] = perc_state
else:
model_name = self._name.split('report.')
if len(model_name) < 2:
res[case.id] = 0.0
else:
model_name = model_name[1]
cr.execute("select count(id) from crm_case_log l, ir_model m \
where l.model_id=m.id and m.model = '%s'" , model_name)
logs = cr.fetchone()[0]
avg_ans = logs / case.nbr
res[case.id] = avg_ans
return res
_columns = {
'name': fields.char('Year', size=64, required=False, readonly=True),
'user_id':fields.many2one('res.users', 'User', readonly=True),
@ -80,9 +45,6 @@ class crm_lead_report(osv.osv):
'channel_id':fields.many2one('res.partner.canal', 'Channel', readonly=True),
'type_id':fields.many2one('crm.case.resource.type', 'Campaign', readonly=True),
'state': fields.selection(AVAILABLE_STATES, 'State', size=16, readonly=True),
'avg_answers': fields.function(_get_data, string='Avg. Answers', method=True, type="integer"),
'perc_done': fields.function(_get_data, string='%Done', method=True, type="float"),
'perc_cancel': fields.function(_get_data, string='%Cancel', method=True, type="float"),
'month':fields.selection([('01', 'January'), ('02', 'February'), \
('03', 'March'), ('04', 'April'),\
('05', 'May'), ('06', 'June'), \
@ -147,9 +109,6 @@ class crm_lead_report(osv.osv):
c.planned_revenue,
c.planned_revenue*(c.probability/100) as probable_revenue,
1 as nbr,
0 as avg_answers,
0.0 as perc_done,
0.0 as perc_cancel,
(SELECT count(id) FROM mailgate_message WHERE model='crm.lead' AND res_id=c.id AND history=True) AS email,
date_trunc('day',c.create_date) as create_date,
extract('epoch' from (c.date_closed-c.create_date))/(3600*24) as delay_close,

View File

@ -29,7 +29,6 @@
<field name="email" sum="# Mails"/>
<field name="delay_open"/>
<field name="delay_close"/>
<field name="avg_answers"/>
</tree>
</field>
</record>
@ -75,10 +74,10 @@
domain="[('create_date','&lt;=', time.strftime('%%Y-%%m-%%d')),('create_date','&gt;=',time.strftime('%%Y-01-01'))]"
help="Leads/Opportunities created in current year"/>
<filter string=" Month " icon="terp-go-month" name="this_month"
domain="[('create_date','&lt;=', time.strftime('%%Y-%%m-%%d')),('create_date','&gt;=',time.strftime('%%Y-%%m-01'))]"
domain="[('create_date','&lt;=',(datetime.date.today()+relativedelta(day=31)).strftime('%%Y-%%m-%%d')),('create_date','&gt;=',(datetime.date.today()-relativedelta(day=1)).strftime('%%Y-%%m-%%d'))]"
help="Leads/Opportunities created in current month"/>
<filter icon="terp-go-month" string=" Month-1 " separator="1"
domain="[('create_date','&lt;=', (datetime.date (int(time.strftime('%%Y')), datetime.date.today().month, 1) - datetime.timedelta (days = 1)).strftime('%%Y-%%m-%%d')),('create_date','&gt;',(datetime.date (int(time.strftime('%%Y')), datetime.date.today().month-1, 1)).strftime('%%Y-%%m-%%d'))]"
domain="[('create_date','&lt;=', (datetime.date.today() - relativedelta(day=31, months=1)).strftime('%%Y-%%m-%%d')),('create_date','&gt;=',(datetime.date.today() - relativedelta(day=1,months=1)).strftime('%%Y-%%m-%%d'))]"
help="Leads/Opportunities created in last month"/>
<separator orientation="vertical" />
@ -99,40 +98,40 @@
<field name="section_id"
default="context.get('section_id', False)"
context="{'invisible_section': False}">
<filter icon="terp-personal+"
<filter icon="terp-personal+" groups="base.group_extended"
context="{'invisible_section': False}"
domain="[('section_id.user_id','=',uid)]"
help="My team" />
help="My Sales Team(s)" />
</field>
<field name="user_id" string="Salesman">
<filter icon="terp-personal" string="My Case(s)" help="My Case(s)" domain="[('user_id','=',uid)]" />
</field>
</group>
<newline/>
<group expand="0" string="Extended Filters..." groups="base.group_extended">
<field name="partner_id"/>
<separator orientation="vertical"/>
<field name="stage_id" widget="selection" domain="[('object_id.model', '=', 'crm.lead')]" />
<field name="categ_id" widget="selection"/>
<field name="type_id" widget="selection"/>
<field name="channel_id" widget="selection"/>
<separator orientation="vertical"/>
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
<newline/>
<field name="creation_date"/>
<field name="opening_date"/>
<field name="date_closed"/>
</group>
<newline/>
<group expand="1" string="Group By...">
</group>
<newline/>
<group expand="0" string="Extended Filters..." groups="base.group_extended">
<field name="partner_id"/>
<separator orientation="vertical"/>
<field name="stage_id" widget="selection" domain="[('object_id.model', '=', 'crm.lead')]" />
<field name="categ_id" widget="selection"/>
<field name="type_id" widget="selection"/>
<field name="channel_id" widget="selection"/>
<separator orientation="vertical"/>
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
<newline/>
<field name="creation_date"/>
<field name="opening_date"/>
<field name="date_closed"/>
</group>
<newline/>
<group expand="1" string="Group By...">
<filter string="Salesman" name="user" icon="terp-personal"
domain="[]" context="{'group_by':'user_id'}" />
<filter string="Sales Team" icon="terp-personal+"
domain="[]"
domain="[]"
context="{'group_by':'section_id'}" />
<filter string="Partner" icon="terp-partner" context="{'group_by':'partner_id'}" />
<filter string="Country" icon="terp-go-home" context="{'group_by':'country_id'}" />
<filter string="Company" icon="terp-go-home"
<filter string="Partner" icon="terp-partner" context="{'group_by':'partner_id'}" />
<filter string="Country" icon="terp-go-home" context="{'group_by':'country_id'}" />
<filter string="Company" icon="terp-go-home"
domain="[]"
context="{'group_by':'company_id'}" />
<separator orientation="vertical" />
@ -154,14 +153,14 @@
domain="[]" context="{'group_by':'month'}" help="Month in which lead/opportunity is created"/>
<filter string="Year" icon="terp-go-year"
domain="[]" context="{'group_by':'name'}" help="Year in which lead/opportunity is created"/>
</group>
</search>
</group>
</search>
</field>
</record>
<!-- Opportunity tree view -->
<record id="view_report_crm_opportunity_tree" model="ir.ui.view">
<record id="view_report_crm_opportunity_tree" model="ir.ui.view">
<field name="name">crm.lead.report.tree</field>
<field name="model">crm.lead.report</field>
<field name="type">tree</field>
@ -246,11 +245,11 @@
<menuitem name="Leads Analysis" id="menu_report_crm_leads_tree"
groups="base.group_extended"
parent="base.next_id_64" action="action_report_crm_lead" sequence="3"/>
parent="base.next_id_64" action="action_report_crm_lead" sequence="3"/>
<menuitem name="Opportunities Analysis" id="menu_report_crm_opportunities_tree"
groups="base.group_extended"
parent="base.next_id_64" action="action_report_crm_opportunity" sequence="4"/>
parent="base.next_id_64" action="action_report_crm_opportunity" sequence="4"/>
</data>
</openerp>

View File

@ -39,41 +39,6 @@ class crm_phonecall_report(osv.osv):
_description = "Phone calls by user and section"
_auto = False
def _get_data(self, cr, uid, ids, field_name, arg, context={}):
""" @param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of case and section Datas IDs
@param context: A standard dictionary for contextual values """
res = {}
avg_ans = 0.0
for case in self.browse(cr, uid, ids, context):
if field_name != 'avg_answers':
state = field_name[5:]
cr.execute("select count(*) from crm_lead where \
section_id =%s and state='%s'"%(case.section_id.id, state))
state_cases = cr.fetchone()[0]
perc_state = (state_cases / float(case.nbr)) * 100
res[case.id] = perc_state
else:
model_name = self._name.split('report.')
if len(model_name) < 2:
res[case.id] = 0.0
else:
model_name = model_name[1]
cr.execute("select count(*) from crm_case_log l, ir_model m \
where l.model_id=m.id and m.model = '%s'" , model_name)
logs = cr.fetchone()[0]
avg_ans = logs / case.nbr
res[case.id] = avg_ans
return res
_columns = {
'name': fields.char('Year', size=64, required=False, readonly=True),
'user_id':fields.many2one('res.users', 'User', readonly=True),
@ -81,9 +46,6 @@ class crm_phonecall_report(osv.osv):
'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Priority'),
'nbr': fields.integer('# of Cases', readonly=True),
'state': fields.selection(AVAILABLE_STATES, 'State', size=16, readonly=True),
'avg_answers': fields.function(_get_data, string='Avg. Answers', method=True, type="integer"),
'perc_done': fields.function(_get_data, string='%Done', method=True, type="float"),
'perc_cancel': fields.function(_get_data, string='%Cancel', method=True, type="float"),
'month':fields.selection([('01', 'January'), ('02', 'February'), \
('03', 'March'), ('04', 'April'),\
('05', 'May'), ('06', 'June'), \
@ -130,9 +92,6 @@ class crm_phonecall_report(osv.osv):
c.company_id,
c.priority,
1 as nbr,
0 as avg_answers,
0.0 as perc_done,
0.0 as perc_cancel,
date_trunc('day',c.create_date) as create_date,
extract('epoch' from (c.date_closed-c.create_date))/(3600*24) as delay_close,
extract('epoch' from (c.date_open-c.create_date))/(3600*24) as delay_open

View File

@ -9,7 +9,7 @@
<field name="model">crm.phonecall.report</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Phone calls">
<tree string="Phone calls">
<field name="name" invisible="1"/>
<field name="month" invisible="1"/>
<field name="section_id" invisible="1"/>
@ -41,9 +41,7 @@
<field name="user_id" select="1"/>
<field name="section_id" select="1"/>
<field name="nbr" select="1"/>
<field name="delay_close"/>
<field name="amount_revenue"/>
<field name="amount_revenue_prob"/>
<field name="delay_close"/>
<field name="probability"/>
<field name="state" select="1"/>
</form>
@ -79,14 +77,13 @@
help="Phone calls made in current year"/>
<filter string=" Month " icon="terp-go-month" name="This Month"
domain="[('create_date','&lt;=', time.strftime('%%Y-%%m-%%d')),('create_date','&gt;=',time.strftime('%%Y-%%m-01'))]"
domain="[('create_date','&lt;=',(datetime.date.today()+relativedelta(day=31)).strftime('%%Y-%%m-%%d')),('create_date','&gt;=',(datetime.date.today()-relativedelta(day=1)).strftime('%%Y-%%m-%%d'))]"
help="Phone calls made in current month"/>
<filter icon="terp-go-month" string=" Month-1 " separator="1"
domain="[('create_date','&lt;=', (datetime.date (int(time.strftime('%%Y')), datetime.date.today().month, 1) - datetime.timedelta (days = 1)).strftime('%%Y-%%m-%%d')),('create_date','&gt;',(datetime.date (int(time.strftime('%%Y')), datetime.date.today().month-1, 1)).strftime('%%Y-%%m-%%d'))]"
domain="[('create_date','&lt;=', (datetime.date.today() - relativedelta(day=31, months=1)).strftime('%%Y-%%m-%%d')),('create_date','&gt;=',(datetime.date.today() - relativedelta(day=1,months=1)).strftime('%%Y-%%m-%%d'))]"
help="Phone calls made in last month"/>
<separator orientation="vertical" />
<separator orientation="vertical" />
<filter icon="terp-check"
string="Todo"
domain="[('state','in',('draft','open'))]"
@ -99,40 +96,37 @@
string="Not Held"
domain="[('state','=','pending')]"
help="Phone calls which are in pending state"/>
<separator orientation="vertical" />
<separator orientation="vertical" />
<field name="section_id" string="Sales Team"
default="context.get('section_id', False)"
context="{'invisible_section': False}">
<filter icon="terp-personal+"
context="{'invisible_section': False}"
domain="[('section_id.user_id','=',uid)]"
help="My team" />
</field>
<field name="user_id" string="Salesman" select="1">
context="{'invisible_section': False}">
<filter icon="terp-personal+" groups="base.group_extended"
context="{'invisible_section': False}"
domain="[('section_id.user_id','=',uid)]"
help="My Sales Team(s)" />
</field>
<field name="user_id" string="Salesman" select="1">
<filter icon="terp-personal" string="My Case(s)" help="My Case(s)" domain="[('user_id','=',uid)]" />
</field>
</group>
<newline/>
<group expand="0" string="Extended Filters..." groups="base.group_extended">
<field name="partner_id"/>
<separator orientation="vertical"/>
<field name="categ_id" widget="selection" string="Type"
domain="[('object_id.model', '=', 'crm.phonecall')]" />
</field>
</group>
<newline/>
<group expand="0" string="Extended Filters..." groups="base.group_extended">
<field name="partner_id"/>
<separator orientation="vertical"/>
<field name="company_id" groups="base.group_multi_company"/>
<newline/>
<newline/>
<field name="creation_date"/>
<field name="opening_date"/>
<field name="date_closed"/>
</group>
<newline/>
<group expand="1" string="Group By...">
</group>
<newline/>
<group expand="1" string="Group By...">
<filter string="Salesman" name="Salesman" icon="terp-personal"
domain="[]" context="{'group_by':'user_id'}" />
<filter string="Sales Team" icon="terp-personal+"
domain="[]"
context="{'group_by':'section_id'}" />
<filter string="Partner" icon="terp-partner" context="{'group_by':'partner_id'}" />
<filter string="Partner" icon="terp-partner" context="{'group_by':'partner_id'}" />
<separator orientation="vertical" />
<filter string="Priority" icon="terp-rating-rated" domain="[]" context="{'group_by':'priority'}" />
<filter string="Type" icon="terp-stock_symbol-selection"
@ -150,8 +144,8 @@
domain="[]" context="{'group_by':'month'}" help="Month of call"/>
<filter string="Year" icon="terp-go-year"
domain="[]" context="{'group_by':'name'}" help="Year of call"/>
</group>
</search>
</group>
</search>
</field>
</record>
@ -168,7 +162,7 @@
<field name="help">Get an anlysis of Phone Calls number and delay to close, stage, user suits to different groups for a global or a fine grained analysis.</field>
</record>
<record model="ir.actions.act_window.view" id="action_report_crm_phonecall_tree">
<record model="ir.actions.act_window.view" id="action_report_crm_phonecall_tree">
<field name="sequence" eval="1"/>
<field name="view_mode">tree</field>
<field name="view_id" ref="view_report_crm_phonecall_tree"/>

View File

@ -11,7 +11,7 @@
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<page string="History" position="inside">
<field name="opportunity_ids" colspan="4" nolabel="1">
<field name="opportunity_ids" colspan="4" nolabel="1" context="{'default_partner_id': active_id}">
<tree string="Leads and Opportunities" colors="blue:state=='pending';gray:state=='cancel'">
<field name="create_date"/>
<field name="name"/>
@ -44,7 +44,7 @@
icon="gtk-go-up" />
</tree>
</field>
<field name="meeting_ids" colspan="4" nolabel="1" >
<field name="meeting_ids" colspan="4" nolabel="1" context="{'default_partner_id': active_id}">
<tree string="Meetings" colors="gray:state in ('draft', 'cancel','done','pending')">
<field name="user_id" string="Responsible"/>
<field name="name" string="Subject" />
@ -52,7 +52,7 @@
<field name="date_deadline" string="End Date"/>
</tree>
</field>
<field name="phonecall_ids" colspan="4" nolabel="1">
<field name="phonecall_ids" colspan="4" nolabel="1" context="{'default_partner_id': active_id}">
<tree string="Phone Calls" colors="gray:state in ('draft', 'cancel','done','pending')">
<field name="date" string="Date"/>
<field name="name" string="Call Summary"/>

View File

@ -10,20 +10,30 @@
<field name="name">Sales / User</field>
</record>
<record id="base.group_sale_salesman_personal" context="{'noadmin':True}" model="res.groups">
<field name="name">Sales / User / See Personal Leads</field>
<record id="base.group_sale_salesman_all_leads" model="res.groups">
<field name="name">Sales / User - See All Leads</field>
</record>
<record id="crm_rule_personal_lead" model="ir.rule">
<field name="name">Personal Leads</field>
<field ref="model_crm_lead" name="model_id"/>
<field name="domain_force">['|',('user_id','=',user.id),('user_id','=',False)]</field>
<field name="groups" eval="[(4, ref('base.group_sale_salesman_personal'))]"/>
<field name="groups" eval="[(4, ref('base.group_sale_salesman'))]"/>
</record>
<record id="crm_rule_all_lead" model="ir.rule">
<field name="name">All Leads</field>
<field ref="model_crm_lead" name="model_id"/>
<field name="domain_force">[(1,'=',1)]</field>
<field name="groups" eval="[(4, ref('base.group_sale_salesman_all_leads'))]"/>
</record>
<record model='ir.ui.menu' id='base.menu_base_partner'>
<field name="groups_id" eval="[(4,ref('base.group_sale_manager')),(4,ref('base.group_sale_salesman'))]"/>
</record>
<record model="ir.ui.menu" id="base.menu_base_config">
<field eval="[(4, ref('base.group_sale_manager'))]" name="groups_id"/>
</record>
</data>
</openerp>

View File

@ -5,14 +5,14 @@
"access_crm_segmentation_line","crm.segmentation.line","model_crm_segmentation_line","base.group_sale_manager",1,1,1,1
"access_crm_case_section","crm.case.section","model_crm_case_section","base.group_sale_salesman",1,1,1,0
"access_crm_case_categ","crm.case.categ","model_crm_case_categ","base.group_sale_salesman",1,1,1,0
"access_crm_meeting_manager","crm.meeting.manager","model_crm_meeting","base.group_sale_manager",1,0,0,0
"access_crm_lead_manager","crm.lead.manager","model_crm_lead","base.group_sale_manager",1,0,0,0
"access_crm_meeting_manager","crm.meeting.manager","model_crm_meeting","base.group_sale_manager",1,1,1,1
"access_crm_lead_manager","crm.lead.manager","model_crm_lead","base.group_sale_manager",1,1,1,1
"access_crm_phonecall_system","crm.phonecall.system","model_crm_phonecall","base.group_system",1,0,0,0
"access_crm_phonecall_manager","crm.phonecall.manager","model_crm_phonecall","base.group_sale_manager",1,0,0,0
"access_crm_phonecall_manager","crm.phonecall.manager","model_crm_phonecall","base.group_sale_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","base.group_sale_salesman",1,0,0,0
"access_crm_meeting","crm.meeting","model_crm_meeting","base.group_sale_salesman",1,1,1,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","base.group_sale_salesman",1,1,1,1
"access_crm_lead","crm.lead","model_crm_lead","base.group_sale_salesman",1,1,1,0
"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","base.group_sale_salesman",1,1,1,0
"access_crm_phonecall.all","crm.phonecall.all","model_crm_phonecall","base.group_user",1,0,0,0
@ -41,12 +41,13 @@
"mail_gateway_mailgate_message_user","mail_gateway.mailgate.message.user","mail_gateway.model_mailgate_message","base.group_sale_salesman",1,1,1,1
"access_base_res_bank_system","base.res.bank system","base.model_res_bank","base.group_system",1,1,1,1
"access_crm_case_stage_system","crm.case.stage system","model_crm_case_stage","base.group_system",1,1,1,1
"access_crm_case_categ_manager","crm.case.categ manager","model_crm_case_categ","base.group_sale_manager",1,1,1,0
"access_crm_case_categ_manager","crm.case.categ manager","model_crm_case_categ","base.group_sale_manager",1,1,1,1
"access_crm_case_resource_type_system","crm.case.resource.type system","model_crm_case_resource_type","base.group_system",1,1,1,1
"access_crm_case_section_system","crm.case.section system","model_crm_case_section","base.group_system",1,1,1,1
"access_crm_lead_report_system","crm.lead.report system","model_crm_lead_report","base.group_system",1,1,1,1
"access_base_res_country_system","base.res.country system","base.model_res_country","base.group_system",1,1,1,1
"access_base_res_country_state_system","base.res.country.state system","base.model_res_country_state","base.group_system",1,1,1,1
"access_base_action_rule_manager","base.action.rule manager","model_base_action_rule","base.group_sale_manager",1,1,1,1
"access_base_action_rule_system","base.action.rule system","model_base_action_rule","base.group_system",1,1,1,1
"access_crm_segmentation_system","crm.segmentation system","model_crm_segmentation","base.group_system",1,1,1,1
"access_crm_segmentation_line_system","crm.segmentation.line system","model_crm_segmentation_line","base.group_system",1,1,1,1
@ -61,3 +62,4 @@
"access_calendar_attendee_system","calendar.attendee.system","model_calendar_attendee","base.group_system",1,0,0,0
"access_res_partner_bank_type_crm_user","res.partner.bank.type.crm.user","base.model_res_partner_bank_type","base.group_sale_salesman",1,0,0,0
"access_res_partner_bank_type_crm_manager","res.partner.bank.type.crm.manager","base.model_res_partner_bank_type","base.group_sale_manager",1,0,0,0
"access_res_partner_canal_manager","res.partner.canal.manager","base.model_res_partner_canal","base.group_sale_manager",1,1,1,1

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
5 access_crm_segmentation_line crm.segmentation.line model_crm_segmentation_line base.group_sale_manager 1 1 1 1
6 access_crm_case_section crm.case.section model_crm_case_section base.group_sale_salesman 1 1 1 0
7 access_crm_case_categ crm.case.categ model_crm_case_categ base.group_sale_salesman 1 1 1 0
8 access_crm_meeting_manager crm.meeting.manager model_crm_meeting base.group_sale_manager 1 0 1 0 1 0 1
9 access_crm_lead_manager crm.lead.manager model_crm_lead base.group_sale_manager 1 0 1 0 1 0 1
10 access_crm_phonecall_system crm.phonecall.system model_crm_phonecall base.group_system 1 0 0 0
11 access_crm_phonecall_manager crm.phonecall.manager model_crm_phonecall base.group_sale_manager 1 0 1 0 1 0 1
12 access_crm_case_categ crm.case.categ model_crm_case_categ base.group_user 1 0 0 0
13 access_crm_meeting crm.meeting model_crm_meeting base.group_sale_salesman 1 0 1 0 1 0
14 access_crm_meeting_all crm.meeting_allll model_crm_meeting base.group_user 1 0 0 0
15 access_crm_lead crm.lead model_crm_lead base.group_sale_salesman 1 1 1 1 0
16 access_crm_lead.all crm.lead.all model_crm_lead base.group_user 1 0 0 0
17 access_crm_phonecall crm.phonecall model_crm_phonecall base.group_sale_salesman 1 1 1 0
18 access_crm_phonecall.all crm.phonecall.all model_crm_phonecall base.group_user 1 0 0 0
41 mail_gateway_mailgate_message_user mail_gateway.mailgate.message.user mail_gateway.model_mailgate_message base.group_sale_salesman 1 1 1 1
42 access_base_res_bank_system base.res.bank system base.model_res_bank base.group_system 1 1 1 1
43 access_crm_case_stage_system crm.case.stage system model_crm_case_stage base.group_system 1 1 1 1
44 access_crm_case_categ_manager crm.case.categ manager model_crm_case_categ base.group_sale_manager 1 1 1 0 1
45 access_crm_case_resource_type_system crm.case.resource.type system model_crm_case_resource_type base.group_system 1 1 1 1
46 access_crm_case_section_system crm.case.section system model_crm_case_section base.group_system 1 1 1 1
47 access_crm_lead_report_system crm.lead.report system model_crm_lead_report base.group_system 1 1 1 1
48 access_base_res_country_system base.res.country system base.model_res_country base.group_system 1 1 1 1
49 access_base_res_country_state_system base.res.country.state system base.model_res_country_state base.group_system 1 1 1 1
50 access_base_action_rule_manager base.action.rule manager model_base_action_rule base.group_sale_manager 1 1 1 1
51 access_base_action_rule_system base.action.rule system model_base_action_rule base.group_system 1 1 1 1
52 access_crm_segmentation_system crm.segmentation system model_crm_segmentation base.group_system 1 1 1 1
53 access_crm_segmentation_line_system crm.segmentation.line system model_crm_segmentation_line base.group_system 1 1 1 1
62 access_calendar_attendee_system calendar.attendee.system model_calendar_attendee base.group_system 1 0 0 0
63 access_res_partner_bank_type_crm_user res.partner.bank.type.crm.user base.model_res_partner_bank_type base.group_sale_salesman 1 0 0 0
64 access_res_partner_bank_type_crm_manager res.partner.bank.type.crm.manager base.model_res_partner_bank_type base.group_sale_manager 1 0 0 0
65 access_res_partner_canal_manager res.partner.canal.manager base.model_res_partner_canal base.group_sale_manager 1 1 1 1

View File

@ -157,41 +157,7 @@ class crm_lead2opportunity_partner(osv.osv_memory):
'partner_id': fields.many2one('res.partner', 'Partner'),
'action': fields.selection([('exist', 'Link to an existing partner'), ('create', 'Create a new partner'), ('no','Do not create a partner')], 'Action'),
}
def default_get(self, cr, uid, fields, context=None):
"""
This function gets default values
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param fields: List of fields for default value
@param context: A standard dictionary for contextual values
@return : default values of fields.
"""
lead_obj = self.pool.get('crm.lead')
partner_obj = self.pool.get('res.partner')
contact_obj = self.pool.get('res.partner.address')
partner_id = False
data = context and context.get('active_ids', []) or []
res = super(crm_lead2opportunity_partner, self).default_get(cr, uid, fields, context=context)
for lead in lead_obj.browse(cr, uid, data, context=context):
partner_ids = partner_obj.search(cr, uid, [('name', '=', lead.partner_name or lead.name)])
if not partner_ids and lead.email_from:
address_ids = contact_obj.search(cr, uid, [('email', '=', lead.email_from)])
if address_ids:
addresses = contact_obj.browse(cr, uid, address_ids)
partner_ids = addresses and [addresses[0].partner_id.id] or False
partner_id = partner_ids and partner_ids[0] or False
if 'partner_id' in fields:
res.update({'partner_id': partner_id})
if 'action' in fields:
res.update({'action': partner_id and 'exist' or 'create'})
return res
def make_partner(self, cr, uid, ids, context=None):
"""
This function Makes partner based on action.

View File

@ -46,6 +46,9 @@
<form string="Create a Partner">
<label string="Are you sure you want to create a partner based on this lead ?" colspan="4"/>
<label string="You may have to verify that this partner does not exist already." colspan="4"/>
<group colspan="4" col="1" attrs="{'invisible':[('msg','=',False)]}">
<field name="msg" colspan="4" nolabel="1" height="50"/>
</group>
<newline />
<field name="action"/>
<group attrs="{'invisible':[('action','!=','exist')]}">

View File

@ -21,6 +21,7 @@
from osv import osv, fields
from tools.translate import _
import re
class crm_lead2partner(osv.osv_memory):
""" Converts lead to partner """
@ -32,7 +33,8 @@ class crm_lead2partner(osv.osv_memory):
'action': fields.selection([('exist', 'Link to an existing partner'), \
('create', 'Create a new partner')], \
'Action', required=True),
'partner_id': fields.many2one('res.partner', 'Partner')
'partner_id': fields.many2one('res.partner', 'Partner'),
'msg': fields.text('Message', readonly=True)
}
def view_init(self, cr, uid, fields, context=None):
@ -73,14 +75,48 @@ class crm_lead2partner(osv.osv_memory):
res = super(crm_lead2partner, self).default_get(cr, uid, fields, context=context)
for lead in lead_obj.browse(cr, uid, data, context=context):
partner_ids = partner_obj.search(cr, uid, [('name', '=', lead.partner_name or lead.name)])
if not partner_ids and lead.email_from:
address_ids = contact_obj.search(cr, uid, [('email', '=', lead.email_from)])
partner_ids = []
# Find partner address matches the email_from of the lead
email = re.findall(r'([^ ,<@]+@[^> ,]+)', lead.email_from or '')
email = map(lambda x: "'" + x + "'", email)
if email:
cr.execute("""select id from res_partner_address
where
substring(email from '([^ ,<@]+@[^> ,]+)') in (%s)""" % (','.join(email)))
address_ids = map(lambda x: x[0], cr.fetchall())
if address_ids:
addresses = contact_obj.browse(cr, uid, address_ids)
partner_ids = addresses and [addresses[0].partner_id.id] or False
# Find partner name that matches the name of the lead
if not partner_ids and lead.partner_name:
partner_ids = partner_obj.search(cr, uid, [('name', '=', lead.partner_name)], context=context)
if not partner_ids:
cr.execute("""SELECT p.id from res_partner p
where regexp_replace(lower(p.name), '[^a-z]*', '', 'g') = regexp_replace(%s, '[^a-z]*', '', 'g')""", (lead.name.lower(), ))
partner_ids = map(lambda x: x[0], cr.fetchall())
partner_id = partner_ids and partner_ids[0] or False
if not partner_id:
label = False
opp_ids = []
if email:
# Find email of existing opportunity matches the email_from of the lead
cr.execute("""select id from crm_lead
where type='opportunity' and
substring(email_from from '([^ ,<@]+@[^> ,]+)') in (%s)""" % (','.join(email)))
opp_ids = map(lambda x:x[0], cr.fetchall())
label = opp_ids and 'email' or False
if not opp_ids:
# Find name of existing opportunity matches the name of the lead
cr.execute("""SELECT l.id from crm_lead l
where type = 'opportunity' and
regexp_replace(lower(l.name), '[^a-z]*', '', 'g') = regexp_replace(%s, '[^a-z]*', '', 'g')""", (lead.name.lower(), ))
opp_ids = map(lambda x: x[0], cr.fetchall())
label = opp_ids and 'name' or False
if label:
res.update({'msg': "An existing opportunity seems to match the %s of this lead, you should double-check before converting it." % (label)})
if 'partner_id' in fields:
res.update({'partner_id': partner_id})
if 'action' in fields:

View File

@ -31,7 +31,7 @@
<record model="crm.case.resource.type" id="type_claim1">
<field name="name">Corrective</field>
<field name="section_id" ref="crm.section_sales_department"/>
</record>
</record>
<record model="crm.case.resource.type" id="type_claim2">
<field name="name">Preventive</field>
@ -44,31 +44,26 @@
<record model="crm.case.stage" id="stage_claim1">
<field name="name">Accepted as Claim</field>
<field name="section_id" ref="crm.section_sales_department"/>
<field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/>
</record>
</record>
<record model="crm.case.stage" id="stage_claim2">
<field name="name">Fixed</field>
<field name="section_id" ref="crm.section_sales_department"/>
<field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/>
</record>
<record model="crm.case.stage" id="stage_claim3">
<field name="name">Won't fix</field>
<field name="section_id" ref="crm.section_sales_department"/>
<field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/>
</record>
</record>
<record model="crm.case.stage" id="stage_claim4">
<field name="name">Invalid</field>
<field name="section_id" ref="crm.section_sales_department"/>
<field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/>
</record>
</record>
<record model="crm.case.stage" id="stage_claim5">
<field name="name">Awaiting Response</field>
<field name="section_id" ref="crm.section_sales_department"/>
<field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/>
</record>

View File

@ -3,7 +3,7 @@
<data>
<menuitem id="base.menu_aftersale" name="After-Sale Services"
groups="base.group_extended"
groups="base.group_extended,base.group_sale_salesman"
parent="base.menu_base_partner" sequence="7" />
<!-- Claims Menu -->

View File

@ -107,11 +107,10 @@
<group colspan="4" col="6">
<field name="user_id" string="Responsible"/>
<field name="section_id" widget="selection"/>
<label string="Stage: " align="1.0"/>
<group colspan="1" col="3">
<field name="stage_id" nolabel="1" readonly="1"
<group colspan="2" col="4">
<field name="stage_id"
on_change="onchange_stage_id(stage_id)"
domain="[('object_id.model', '=', 'crm.claim')]" />
domain="[('object_id.model', '=', 'crm.claim'), ('section_ids', '=', section_id)]" />
<button name="stage_previous" string="" type="object" icon="gtk-go-back" />
<button icon="gtk-go-forward" string="" name="stage_next" type="object"/>
</group>
@ -251,66 +250,66 @@
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Search Claims">
<filter icon="terp-check" string="Current" name="current"
domain="[('state','in',('draft', 'open'))]"
separator="1" help="Draft and Open Claims" default="1"
/>
<filter icon="terp-camera_test"
string="In Progress"
domain="[('state','=','open')]"
separator="1" help="In Progress Claims"
/>
<filter icon="terp-gtk-media-pause"
string="Pending"
domain="[('state','=','pending')]"
separator="1" help="All pending Claims"
/>
<separator orientation="vertical"/>
<field name="name" select='1'/>
<field name="partner_id" select="1"/>
<field name="user_id" select="1" widget="selection">
<filter icon="terp-personal-"
domain="[('user_id','=', False)]"
help="Unassigned Claims" />
</field>
<field name="section_id" select="1"
widget="selection">
<filter icon="terp-personal+"
domain="['|', ('section_id', '=', context.get('section_id')), '|', ('section_id.user_id','=',uid), ('section_id.member_ids', 'in', [uid])]"
help="My section" />
<filter icon="terp-check" string="Current" name="current"
domain="[('state','in',('draft', 'open'))]"
separator="1" help="Draft and Open Claims" default="1"
/>
<filter icon="terp-camera_test"
string="In Progress"
domain="[('state','=','open')]"
separator="1" help="In Progress Claims"
/>
<filter icon="terp-gtk-media-pause"
string="Pending"
domain="[('state','=','pending')]"
separator="1" help="All pending Claims"
/>
<separator orientation="vertical"/>
<field name="name" select='1'/>
<field name="partner_id" select="1"/>
<field name="user_id" select="1" widget="selection">
<filter icon="terp-personal-"
domain="[('user_id','=', False)]"
help="Unassigned Claims" />
</field>
<newline/>
<group expand="0" string="Group By...">
<field name="section_id" select="1"
widget="selection">
<filter icon="terp-personal+" groups="base.group_extended"
domain="['|', ('section_id', '=', context.get('section_id')), '|', ('section_id.user_id','=',uid), ('section_id.member_ids', 'in', [uid])]"
help="My Sales Team(s)" />
</field>
<newline/>
<group expand="0" string="Group By...">
<filter string="Partner" icon="terp-partner"
domain="[]" help="Partner"
context="{'group_by':'partner_id'}" />
domain="[]" help="Partner"
context="{'group_by':'partner_id'}" />
<filter string="Responsible" icon="terp-personal"
domain="[]" help="Responsible User"
context="{'group_by':'user_id'}" />
domain="[]" help="Responsible User"
context="{'group_by':'user_id'}" />
<filter string="Sales Team" icon="terp-personal+"
domain="[]" help="Sales Team"
context="{'group_by':'section_id'}" />
domain="[]" help="Sales Team"
context="{'group_by':'section_id'}" />
<separator orientation="vertical"/>
<filter string="Stage" icon="terp-stage"
domain="[]" context="{'group_by':'stage_id'}" />
<filter string="Type" icon="terp-stock_symbol-selection"
domain="[]" context="{'group_by':'categ_id'}" />
<filter string="State"
<filter string="State"
icon="terp-stock_effects-object-colorize"
domain="[]" context="{'group_by':'state'}" />
<separator orientation="vertical"/>
<filter string="Claim Date" icon="terp-go-month"
domain="[]" help="Claim Date"
context="{'group_by':'date'}" />
<filter string="Deadline" icon="terp-go-month"
domain="[]"
context="{'group_by':'date_deadline'}" />
<filter string="Closure" icon="terp-go-month"
domain="[]" help="Date Closed"
context="{'group_by':'date_closed'}" />
</group>
</search>
</field>
domain="[]" help="Claim Date"
context="{'group_by':'date'}" />
<filter string="Deadline" icon="terp-go-month"
domain="[]"
context="{'group_by':'date_deadline'}" />
<filter string="Closure" icon="terp-go-month"
domain="[]" help="Date Closed"
context="{'group_by':'date_closed'}" />
</group>
</search>
</field>
</record>
<act_window

View File

@ -70,7 +70,8 @@ class crm_claim_report(osv.osv):
'company_id': fields.many2one('res.company', 'Company', readonly=True),
'priority': fields.selection(AVAILABLE_PRIORITIES, 'Priority'),
'type_action': fields.selection([('correction','Corrective Action'),('prevention','Preventive Action')], 'Action Type'),
'date_closed': fields.date('Closed', readonly=True),
'date_closed': fields.date('Close Date', readonly=True),
'date_deadline': fields.date('Deadline', readonly=True),
'delay_expected': fields.float('Overpassed Deadline',digits=(16,2),readonly=True, group_operator="avg"),
}
@ -89,6 +90,7 @@ class crm_claim_report(osv.osv):
to_char(c.date, 'MM') as month,
to_char(c.date, 'YYYY-MM-DD') as day,
to_char(c.date_closed, 'YYYY-MM-DD') as date_closed,
to_char(c.date_deadline, 'YYYY-MM-DD') as date_deadline,
c.state,
c.user_id,
c.stage_id,

View File

@ -77,94 +77,98 @@
<field name="arch" type="xml">
<search string="Search">
<group col="16" colspan="8">
<filter string=" Year " icon="terp-go-year"
<filter string=" Year " icon="terp-go-year"
domain="[('create_date','&lt;=', time.strftime('%%Y-%%m-%%d')),('create_date','&gt;=',time.strftime('%%Y-01-01'))]"
help="Claims created in current year"/>
<filter string=" Month " icon="terp-go-month" name="This Month"
domain="[('create_date','&lt;=', time.strftime('%%Y-%%m-%%d')),('create_date','&gt;=',time.strftime('%%Y-%%m-01'))]"
domain="[('create_date','&lt;=',(datetime.date.today()+relativedelta(day=31)).strftime('%%Y-%%m-%%d')),('create_date','&gt;=',(datetime.date.today()-relativedelta(day=1)).strftime('%%Y-%%m-%%d'))]"
help="Claims created in current month"/>
<filter icon="terp-go-month" string=" Month-1 " separator="1"
domain="[('create_date','&lt;=', (datetime.date (int(time.strftime('%%Y')), datetime.date.today().month, 1) - datetime.timedelta (days = 1)).strftime('%%Y-%%m-%%d')),('create_date','&gt;',(datetime.date (int(time.strftime('%%Y')), datetime.date.today().month-1, 1)).strftime('%%Y-%%m-%%d'))]"
domain="[('create_date','&lt;=', (datetime.date.today() - relativedelta(day=31, months=1)).strftime('%%Y-%%m-%%d')),('create_date','&gt;=',(datetime.date.today() - relativedelta(day=1,months=1)).strftime('%%Y-%%m-%%d'))]"
help="Claims created in last month"/>
<separator orientation="vertical" />
<separator orientation="vertical" />
<filter icon="terp-document-new"
string="Draft"
domain="[('state','=','draft')]"/>
<filter icon="terp-camera_test"
<filter icon="terp-camera_test"
string="Open"
domain="[('state','=','open')]"/>
<filter icon="terp-gtk-media-pause"
<filter icon="terp-gtk-media-pause"
string="Pending"
domain="[('state','=','pending')]"/>
<separator orientation="vertical" />
<field name="section_id" string="Sales Team"
default="context.get('section_id', False)"
context="{'invisible_section': False}">
<separator orientation="vertical" />
<field name="section_id" string="Sales Team"
default="context.get('section_id', False)"
context="{'invisible_section': False}">
<filter icon="terp-personal+"
context="{'invisible_section': False}"
domain="[('section_id.user_id','=',uid)]"
help="My team" />
<filter icon="terp-personal+" groups="base.group_extended"
context="{'invisible_section': False}"
domain="[('section_id.user_id','=',uid)]"
help="My Sales Team(s)" />
</field>
<field name="company_id">
<filter icon="terp-go-home"
context="{'invisible_section': False}"
domain="[('section_id.user_id.company_id','=',uid)]"
help="My company"/>
</field>
<field name="company_id">
<filter icon="terp-go-home"
context="{'invisible_section': False}"
domain="[('section_id.user_id.company_id','=',uid)]"
help="My company"/>
</field>
<field name="user_id" string="Salesman" select="1">
<filter icon="terp-personal" string="My Case(s)" help="My Case(s)" domain="[('user_id','=',uid)]" />
</field>
</group>
<newline/>
<group expand="0" string="Extended Filters..." groups="base.group_extended">
<filter icon="terp-dialog-close"
<field name="user_id" string="Salesman" select="1">
<filter icon="terp-personal" string="My Case(s)" help="My Case(s)" domain="[('user_id','=',uid)]" />
</field>
</group>
<newline/>
<group expand="0" string="Extended Filters..." groups="base.group_extended">
<filter icon="terp-dialog-close"
string="Done"
domain="[('state','=','done')]"/>
<filter icon="gtk-cancel"
string="Cancel"
domain="[('state','=','cancel')]"/>
<group>
<separator orientation="vertical"/>
<field name="stage_id" widget="selection" domain="[('object_id.model', '=', 'crm.claim')]"/>
<field name="categ_id" widget="selection" domain="[('object_id.model', '=', 'crm.claim')]"/>
<separator orientation="vertical"/>
<field name="priority" />
<field name="type_action" />
</group>
</group>
<newline/>
<group expand="1" string="Group By...">
<separator orientation="vertical"/>
<field name="partner_id"/>
<separator orientation="vertical"/>
<field name="stage_id" widget="selection" domain="[('object_id.model', '=', 'crm.claim')]"/>
<field name="categ_id" widget="selection" domain="[('object_id.model', '=', 'crm.claim')]"/>
<separator orientation="vertical"/>
<field name="priority" />
<field name="type_action" />
<newline/>
<field name="date_closed" />
<field name="date_deadline" />
</group>
<newline/>
<group expand="1" string="Group By...">
<filter string="Salesman" name="Salesman" icon="terp-personal"
domain="[]" context="{'group_by':'user_id'}" />
<filter string="Sales Team" icon="terp-personal+"
domain="[]"
context="{'group_by':'section_id'}" />
<filter string="Partner" name="partner" icon="terp-partner"
domain="[]" context="{'group_by':'partner_id'}" />
<separator orientation="vertical" />
<filter string="Stage" icon="terp-stage" domain="[]"
context="{'group_by':'stage_id'}" />
context="{'group_by':'stage_id'}" />
<filter string="Priority" icon="terp-rating-rated" domain="[]"
context="{'group_by':'priority'}" />
context="{'group_by':'priority'}" />
<filter string="Category" icon="terp-stock_symbol-selection"
domain="[]" context="{'group_by':'categ_id'}" />
<separator orientation="vertical"/>
<filter string="Type" icon="terp-stock_symbol-selection" domain="[]"
context="{'group_by':'type_action'}" />
context="{'group_by':'type_action'}" help="Action Type"/>
<filter string="State" icon="terp-stock_effects-object-colorize"
domain="[]" context="{'group_by':'state'}" />
<separator orientation="vertical" />
<filter string="Company" icon="terp-go-home"
domain="[]"
context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
<separator orientation="vertical" />
<filter string="Day" icon="terp-go-today"
domain="[]" context="{'group_by':'day'}"
@ -177,8 +181,8 @@
<filter string="Year" icon="terp-go-year"
domain="[]" context="{'group_by':'name'}"
help="Year of claim"/>
</group>
</search>
</group>
</search>
</field>
</record>
@ -188,30 +192,29 @@
<field name="name">Claims Analysis</field>
<field name="res_model">crm.claim.report</field>
<field name="view_type">form</field>
<field name="view_mode">tree,graph</field>
<field name="context">{"search_default_User":1,"search_default_This Month":1,'group_by_no_leaf':1,'group_by':[]}</field>
<field name="view_mode">tree,graph</field>
<field name="context">{"search_default_User":1,"search_default_This Month":1,'group_by_no_leaf':1,'group_by':[]}</field>
<field name="view_id" ref="view_report_crm_claim_tree"/>
<field name="search_view_id" ref="view_report_crm_claim_filter"/>
</record>
<record model="ir.actions.act_window.view" id="action_report_crm_claim_tree">
<record model="ir.actions.act_window.view" id="action_report_crm_claim_tree">
<field name="sequence" eval="1"/>
<field name="view_mode">tree</field>
<field name="view_id" ref="view_report_crm_claim_tree"/>
<field name="act_window_id" ref="action_report_crm_claim"/>
</record>
<record model="ir.actions.act_window.view" id="action_report_crm_claim_graph">
<record model="ir.actions.act_window.view" id="action_report_crm_claim_graph">
<field name="sequence" eval="2"/>
<field name="view_mode">graph</field>
<field name="view_id" ref="view_report_crm_claim_graph"/>
<field name="act_window_id" ref="action_report_crm_claim"/>
</record>
<menuitem name="Claims Analysis" id="menu_report_crm_claim_tree"
groups="base.group_extended"
action="action_report_crm_claim" parent="base.next_id_64" sequence="6"/>
<menuitem name="Claims Analysis" id="menu_report_crm_claim_tree"
groups="base.group_extended"
action="action_report_crm_claim" parent="base.next_id_64" sequence="6"/>
</data>

View File

@ -1,5 +1,5 @@
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
"access_crm_claim_manager","crm.claim.manager","model_crm_claim","base.group_sale_manager",1,0,0,0
"access_crm_claim_manager","crm.claim.manager","model_crm_claim","base.group_sale_manager",1,1,1,1
"access_crm_claim_user","crm.claim.user","model_crm_claim","base.group_sale_salesman",1,1,1,0
"access_crm_claim_report_manager","crm.claim.report.manager","model_crm_claim_report","base.group_sale_manager",1,1,1,1
"access_crm_claim_system","crm.claim.system","model_crm_claim","base.group_system",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_manager crm.claim.manager model_crm_claim base.group_sale_manager 1 0 1 0 1 0 1
3 access_crm_claim_user crm.claim.user model_crm_claim base.group_sale_salesman 1 1 1 0
4 access_crm_claim_report_manager crm.claim.report.manager model_crm_claim_report base.group_sale_manager 1 1 1 1
5 access_crm_claim_system crm.claim.system model_crm_claim base.group_system 1 0 0 0

View File

@ -3,56 +3,52 @@
<data noupdate="1">
<!-- FUNDRAISING CATEGORY(categ_id) -->
<record model="crm.case.categ" id="categ_fund1">
<field name="name">Social Rehabilitation And Rural Upliftment</field>
<field name="section_id" ref="crm.section_sales_department"/>
<field name="object_id" search="[('model','=','crm.fundraising')]" model="ir.model"/>
<field name="object_id" search="[('model','=','crm.fundraising')]" model="ir.model"/>
</record>
<record model="crm.case.categ" id="categ_fund2">
<field name="name">Learning And Education</field>
<field name="section_id" ref="crm.section_sales_department"/>
<field name="object_id" search="[('model','=','crm.fundraising')]" model="ir.model"/>
</record>
<field name="object_id" search="[('model','=','crm.fundraising')]" model="ir.model"/>
</record>
<record model="crm.case.categ" id="categ_fund3">
<field name="name">Healthcare</field>
<field name="section_id" ref="crm.section_sales_department"/>
<field name="object_id" search="[('model','=','crm.fundraising')]" model="ir.model"/>
</record>
<field name="object_id" search="[('model','=','crm.fundraising')]" model="ir.model"/>
</record>
<record model="crm.case.categ" id="categ_fund4">
<field name="name">Arts And Culture</field>
<field name="section_id" ref="crm.section_sales_department"/>
<field name="object_id" search="[('model','=','crm.fundraising')]" model="ir.model"/>
</record>
<field name="object_id" search="[('model','=','crm.fundraising')]" model="ir.model"/>
</record>
<!-- CASE Resource(type_id) -->
<record model="crm.case.resource.type" id="type_fund1">
<field name="name">Cash</field>
<field name="section_id" ref="crm.section_sales_department"/>
<field name="object_id" search="[('model','=','crm.fundraising')]" model="ir.model"/>
</record>
<record model="crm.case.resource.type" id="type_fund2">
<field name="name">Cheque</field>
<field name="section_id" ref="crm.section_sales_department"/>
<field name="object_id" search="[('model','=','crm.fundraising')]" model="ir.model"/>
</record>
</record>
<record model="crm.case.resource.type" id="type_fund3">
<field name="name">Credit Card</field>
<field name="section_id" ref="crm.section_sales_department"/>
<field name="object_id" search="[('model','=','crm.fundraising')]" model="ir.model"/>
</record>
<record model="crm.case.resource.type" id="type_fund4">
<field name="name">Demand Draft</field>
<field name="section_id" ref="crm.section_sales_department"/>
<field name="object_id" search="[('model','=','crm.fundraising')]" model="ir.model"/>
</record>
</record>
</data>
</openerp>

View File

@ -5,7 +5,7 @@
<!-- MENU -->
<menuitem id="base.menu_fundrising" name="Fund Raising"
groups="base.group_extended"
groups="base.group_extended,base.group_sale_salesman"
parent="base.menu_base_partner" sequence="8" />
<record model="ir.actions.act_window" id="crm_case_category_act_fund_all1">
@ -40,8 +40,8 @@
</record>
<menuitem name="Fund Raising" id="menu_crm_case_fund_raise"
parent="base.menu_fundrising"
action="crm_case_category_act_fund_all1" sequence="1" />
parent="base.menu_fundrising"
action="crm_case_category_act_fund_all1" sequence="1" />
</data>
</openerp>

View File

@ -3,8 +3,8 @@
<data>
<!-- Fund Raising Configuration Menu -->
<menuitem id="menu_config_fundrising" name="Fund Raising"
groups="base.group_extended"
parent="base.menu_base_config" sequence="8" />
groups="base.group_extended"
parent="base.menu_base_config" sequence="8" />
<!-- Fund Raising Categories Form View -->
@ -273,9 +273,9 @@
help="Unassigned" />
</field>
<field name="section_id" select="1" widget="selection" string="Sales Team">
<filter icon="terp-personal+"
<filter icon="terp-personal+" groups="base.group_extended"
domain="['|', ('section_id', '=', context.get('section_id')), '|', ('section_id.user_id','=',uid), ('section_id.member_ids', 'in', [uid])]"
help="My section" />
help="My Sales Team(s)" />
</field>
</group>
<newline/>

View File

@ -9,15 +9,15 @@
<field name="model">crm.fundraising.report</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Fundraising">
<field name="name" invisible="1"/>
<field name="month" invisible="1"/>
<field name="section_id" invisible="1"/>
<tree string="Fundraising">
<field name="name" invisible="1"/>
<field name="month" invisible="1"/>
<field name="section_id" invisible="1"/>
<field name="user_id" invisible="1"/>
<field name="company_id" invisible="1"/>
<field name="company_id" invisible="1"/>
<field name="partner_id" invisible="1"/>
<field name="nbr" string='#Fundraising' sum="#Fundraising"/>
<field name="planned_cost" sum='Planned Costs'/>
<field name="nbr" string='#Fundraising' sum="#Fundraising"/>
<field name="planned_cost" sum='Planned Costs'/>
<field name="amount_revenue" sum='Est.Revenue'/>
<field name="probability" avg='Avg. Probability' widget="progressbar"/>
<field name="amount_revenue_prob" sum='Est. Rev*Prob.'/>
@ -26,7 +26,7 @@
<field name="categ_id" invisible="1"/>
<field name="day" invisible="1"/>
<field name="type_id" invisible="1"/>
</tree>
</tree>
</field>
<!-- Fundraising by user and section Form View-->
@ -37,11 +37,11 @@
<field name="model">crm.fundraising.report</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Cases">
<form string="Cases">
<field name="name" select="1"/>
<field name="month" select="1"/>
<field name="user_id" select="1"/>
<field name="section_id" select="1"/>
<field name="section_id" select="1"/>
<field name="nbr" select="1"/>
<field name="delay_close"/>
<field name="amount_revenue"/>
@ -81,72 +81,63 @@
help="Funds raised in current year"/>
<filter string=" Month " icon="terp-go-month" name="This Month"
domain="[('create_date','&lt;=', time.strftime('%%Y-%%m-%%d')),('create_date','&gt;=',time.strftime('%%Y-%%m-01'))]"
domain="[('create_date','&lt;=',(datetime.date.today()+relativedelta(day=31)).strftime('%%Y-%%m-%%d')),('create_date','&gt;=',(datetime.date.today()-relativedelta(day=1)).strftime('%%Y-%%m-%%d'))]"
help="Funds raised in current month"/>
<filter icon="terp-go-month" string=" Month-1 " separator="1"
domain="[('create_date','&lt;=', (datetime.date (int(time.strftime('%%Y')), datetime.date.today().month, 1) - datetime.timedelta (days = 1)).strftime('%%Y-%%m-%%d')),('create_date','&gt;',(datetime.date (int(time.strftime('%%Y')), datetime.date.today().month-1, 1)).strftime('%%Y-%%m-%%d'))]"
domain="[('create_date','&lt;=', (datetime.date.today() - relativedelta(day=31, months=1)).strftime('%%Y-%%m-%%d')),('create_date','&gt;=',(datetime.date.today() - relativedelta(day=1,months=1)).strftime('%%Y-%%m-%%d'))]"
help="Funds raised in last month"/>
<separator orientation="vertical" />
<separator orientation="vertical" />
<filter icon="terp-document-new"
string="Draft"
domain="[('state','=','draft')]"/>
<filter icon="terp-camera_test"
string="Open"
domain="[('state','=','open')]"/>
<filter icon="terp-gtk-media-pause"
string="Pending"
domain="[('state','=','pending')]"/>
<separator orientation="vertical" />
<field name="section_id" string="Sales Team"
default="context.get('section_id', False)"
context="{'invisible_section': False}">
<filter icon="terp-personal+"
context="{'invisible_section': False}"
domain="[('section_id.user_id','=',uid)]"
help="My team" />
</field>
<field name="company_id">
<filter icon="terp-go-home"
context="{'invisible_section': False}"
domain="[('section_id.user_id.company_id','=',uid)]"
help="My company"/>
string="Draft"
domain="[('state','=','draft')]"/>
<filter icon="terp-camera_test"
string="Open"
domain="[('state','=','open')]"/>
<filter icon="terp-gtk-media-pause"
string="Pending"
domain="[('state','=','pending')]"/>
<separator orientation="vertical" />
<field name="section_id" string="Sales Team"
default="context.get('section_id', False)"
context="{'invisible_section': False}">
<filter icon="terp-personal+" groups="base.group_extended"
context="{'invisible_section': False}"
domain="[('section_id.user_id','=',uid)]"
help="My Sales Team(s)" />
</field>
<field name="user_id" select="1" string="Salesman">
<filter icon="terp-personal" string="My Case(s)" help="My Case(s)" domain="[('user_id','=',uid)]" />
</field>
</group>
<newline/>
<group expand="0" string="Extended Filters..." groups="base.group_extended">
<filter icon="terp-dialog-close"
<field name="company_id">
<filter icon="terp-go-home"
context="{'invisible_section': False}"
domain="[('section_id.user_id.company_id','=',uid)]"
help="My company"/>
</field>
<field name="user_id" select="1" string="Salesman">
<filter icon="terp-personal" string="My Case(s)" help="My Case(s)" domain="[('user_id','=',uid)]" />
</field>
</group>
<newline/>
<group expand="0" string="Extended Filters..." groups="base.group_extended">
<filter icon="terp-dialog-close"
string="Done"
domain="[('state','=','done')]"/>
<filter icon="gtk-cancel"
string="Cancel"
domain="[('state','=','cancel')]"/>
<group>
<separator orientation="vertical"/>
<field name="categ_id" widget="selection" domain="[('object_id.model', '=', 'crm.fundraising')]"/>
</group>
</group>
<newline/>
<group expand="1" string="Group By...">
</group>
</group>
<newline/>
<group expand="1" string="Group By...">
<filter string="Salesman" name="Salesman" icon="terp-personal"
domain="[]" context="{'group_by':'user_id'}" />
<filter string="Sales Team" icon="terp-personal+"
domain="[]"
context="{'group_by':'section_id'}" />
<separator orientation="vertical" />
<filter string="State" icon="terp-stock_effects-object-colorize"
<filter string="State" icon="terp-stock_effects-object-colorize"
domain="[]" context="{'group_by':'state'}" />
<filter string="Category" icon="terp-stock_symbol-selection"
domain="[]" context="{'group_by':'categ_id'}" />
@ -157,20 +148,17 @@
<filter string="Company" icon="terp-go-home"
domain="[]"
context="{'group_by':'company_id'}" />
<separator orientation="vertical" />
<filter string="Day" icon="terp-go-today"
domain="[]" context="{'group_by':'day'}"
help="Date of fundraising"/>
<filter string="Month" icon="terp-go-month"
domain="[]" context="{'group_by':'month'}"
help="Month of fundraising"/>
<filter string="Year" icon="terp-go-year"
domain="[]" context="{'group_by':'name'}" />
</group>
</search>
</group>
</search>
</field>
</record>

View File

@ -1,5 +1,5 @@
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
"access_crm_fundraising_manager","crm.fundraising.manager","model_crm_fundraising","base.group_sale_manager",1,0,0,0
"access_crm_fundraising_manager","crm.fundraising.manager","model_crm_fundraising","base.group_sale_manager",1,1,1,1
"access_crm_fundraising_user","crm.fundraising.user","model_crm_fundraising","base.group_sale_salesman",1,1,1,0
"access_crm_fundraising_report_user","crm.fundraising.report.user","model_crm_fundraising_report","base.group_sale_salesman",1,0,0,0
"access_crm_fundraising_report_manager","crm.fundraising.report.manager","model_crm_fundraising_report","base.group_sale_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_fundraising_manager crm.fundraising.manager model_crm_fundraising base.group_sale_manager 1 0 1 0 1 0 1
3 access_crm_fundraising_user crm.fundraising.user model_crm_fundraising base.group_sale_salesman 1 1 1 0
4 access_crm_fundraising_report_user crm.fundraising.report.user model_crm_fundraising_report base.group_sale_salesman 1 0 0 0
5 access_crm_fundraising_report_manager crm.fundraising.report.manager model_crm_fundraising_report base.group_sale_manager 1 1 1 1

View File

@ -1,44 +1,45 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="1">
<menuitem id="base.menu_aftersale" name="After-Sale Services"
parent="base.menu_base_partner" sequence="7" />
<menuitem id="base.menu_aftersale" name="After-Sale Services"
parent="base.menu_base_partner" sequence="7" />
<!-- Help Desk (menu) -->
<record model="ir.actions.act_window" id="crm_case_helpdesk_act111">
<field name="name">Helpdesk Requests</field>
<field name="res_model">crm.helpdesk</field>
<field name="view_mode">tree,calendar,form</field>
<field name="view_id" ref="crm_case_tree_view_helpdesk"/>
<field name="context">{"search_default_user_id":uid, 'search_default_section_id': section_id}</field>
<field name="search_view_id" ref="view_crm_case_helpdesk_filter"/>
<field name="help">Alike records and processing of claims, Helpdesk and Support is a good tool to trace your interventions. This menu is more adapted to an oral communication, which is not necessarily related to a claim. Select a customer, add notes and categorize your interventions with a channel and a priority level.</field>
</record>
<record model="ir.actions.act_window" id="crm_case_helpdesk_act111">
<field name="name">Helpdesk Requests</field>
<field name="res_model">crm.helpdesk</field>
<field name="view_mode">tree,calendar,form</field>
<field name="view_id" ref="crm_case_tree_view_helpdesk"/>
<field name="context">{"search_default_user_id":uid, 'search_default_section_id': section_id}</field>
<field name="search_view_id" ref="view_crm_case_helpdesk_filter"/>
<field name="help">Alike records and processing of claims, Helpdesk and Support is a good tool to trace your interventions. This menu is more adapted to an oral communication, which is not necessarily related to a claim. Select a customer, add notes and categorize your interventions with a channel and a priority level.</field>
</record>
<record model="ir.actions.act_window.view" id="action_crm_sec_tree_view_act111">
<field name="sequence" eval="1"/>
<field name="view_mode">tree</field>
<field name="view_id" ref="crm_case_tree_view_helpdesk"/>
<field name="act_window_id" ref="crm_case_helpdesk_act111"/>
</record>
<record model="ir.actions.act_window.view" id="action_crm_sec_tree_view_act111">
<field name="sequence" eval="1"/>
<field name="view_mode">tree</field>
<field name="view_id" ref="crm_case_tree_view_helpdesk"/>
<field name="act_window_id" ref="crm_case_helpdesk_act111"/>
</record>
<record model="ir.actions.act_window.view" id="action_crm_sec_calendar_view_act111">
<field name="sequence" eval="2"/>
<field name="view_mode">calendar</field>
<field name="view_id" ref="crm_case_helpdesk_calendar_view"/>
<field name="act_window_id" ref="crm_case_helpdesk_act111"/>
</record>
<record model="ir.actions.act_window.view" id="action_crm_sec_calendar_view_act111">
<field name="sequence" eval="2"/>
<field name="view_mode">calendar</field>
<field name="view_id" ref="crm_case_helpdesk_calendar_view"/>
<field name="act_window_id" ref="crm_case_helpdesk_act111"/>
</record>
<record model="ir.actions.act_window.view" id="action_crm_sec_form_view_act111">
<field name="sequence" eval="3"/>
<field name="view_mode">form</field>
<field name="view_id" ref="crm_case_form_view_helpdesk"/>
<field name="act_window_id" ref="crm_case_helpdesk_act111"/>
</record>
<record model="ir.actions.act_window.view" id="action_crm_sec_form_view_act111">
<field name="sequence" eval="3"/>
<field name="view_mode">form</field>
<field name="view_id" ref="crm_case_form_view_helpdesk"/>
<field name="act_window_id" ref="crm_case_helpdesk_act111"/>
</record>
<menuitem name="Helpdesk and Support" id="menu_help_support_main"
parent="base.menu_aftersale" action="crm_case_helpdesk_act111" sequence="2"/>
<menuitem name="Helpdesk and Support" id="menu_help_support_main"
groups="base.group_extended,base.group_sale_salesman"
parent="base.menu_aftersale" action="crm_case_helpdesk_act111" sequence="2"/>
</data>
</openerp>

View File

@ -248,21 +248,21 @@
<field name="partner_id" />
<field name="user_id" select="1" widget="selection"/>
<field name="section_id" select="1" widget="selection" string="Sales Team">
<filter icon="terp-personal+"
<filter icon="terp-personal+" groups="base.group_extended"
domain="['|', ('section_id', '=', context.get('section_id')), '|', ('section_id.user_id','=',uid), ('section_id.member_ids', 'in', [uid])]"
help="My section" />
help="My Sales Team(s)" />
</field>
<newline/>
<group expand="0" string="Group By...">
<filter string="Partner" icon="terp-partner"
domain="[]" help="Partner"
context="{'group_by':'partner_id'}" />
domain="[]" help="Partner"
context="{'group_by':'partner_id'}" />
<filter string="Responsible" icon="terp-personal"
domain="[]" help="Responsible User"
context="{'group_by':'user_id'}" />
domain="[]" help="Responsible User"
context="{'group_by':'user_id'}" />
<filter string="Sales Team" icon="terp-personal+"
domain="[]" help="Sales Team"
context="{'group_by':'section_id'}" />
domain="[]" help="Sales Team"
context="{'group_by':'section_id'}" />
<separator orientation="vertical"/>
<filter string="Priority" icon="terp-rating-rated"
domain="[]" context="{'group_by':'priority'}" />
@ -270,11 +270,11 @@
context="{'group_by':'state'}" />
<separator orientation="vertical"/>
<filter string="Date" icon="terp-go-month"
domain="[]" help="Request Date"
context="{'group_by':'date'}" />
<filter string="Deadline" icon="terp-go-month"
domain="[]"
context="{'group_by':'date_deadline'}" />
domain="[]" help="Request Date"
context="{'group_by':'date'}" />
<filter string="Deadline" icon="terp-go-month"
domain="[]"
context="{'group_by':'date_deadline'}" />
</group>
</search>
</field>

View File

@ -9,7 +9,7 @@
<field name="model">crm.helpdesk.report</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Helpdesk">
<tree string="Helpdesk">
<field name="name" invisible="1"/>
<field name="month" invisible="1"/>
<field name="section_id" invisible="1"/>
@ -38,16 +38,16 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Cases">
<field name="name" select="1"/>
<field name="month" select="1"/>
<field name="user_id" select="1"/>
<field name="section_id" select="1"/>
<field name="nbr" select="1"/>
<field name="delay_close"/>
<field name="amount_revenue"/>
<field name="amount_revenue_prob"/>
<field name="probability"/>
<field name="state" select="1"/>
<field name="name" select="1"/>
<field name="month" select="1"/>
<field name="user_id" select="1"/>
<field name="section_id" select="1"/>
<field name="nbr" select="1"/>
<field name="delay_close"/>
<field name="amount_revenue"/>
<field name="amount_revenue_prob"/>
<field name="probability"/>
<field name="state" select="1"/>
</form>
</field>
</record>
@ -75,56 +75,51 @@
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Search">
<group col="16" colspan="9">
<filter string=" Year " icon="terp-go-year"
<group col="16" colspan="9">
<filter string=" Year " icon="terp-go-year"
domain="[('create_date','&lt;=', time.strftime('%%Y-%%m-%%d')),('create_date','&gt;=',time.strftime('%%Y-01-01'))]"
help="Helpdesk requests occurred in current year"/>
<filter string=" Month " icon="terp-go-month" name="this_month"
domain="[('create_date','&lt;=', time.strftime('%%Y-%%m-%%d')),('create_date','&gt;=',time.strftime('%%Y-%%m-01'))]"
domain="[('create_date','&lt;=',(datetime.date.today()+relativedelta(day=31)).strftime('%%Y-%%m-%%d')),('create_date','&gt;=',(datetime.date.today()-relativedelta(day=1)).strftime('%%Y-%%m-%%d'))]"
help="Helpdesk requests occurred in current month"/>
<filter icon="terp-go-month" string=" Month-1 " separator="1"
domain="[('create_date','&lt;=', (datetime.date (int(time.strftime('%%Y')), datetime.date.today().month, 1) - datetime.timedelta (days = 1)).strftime('%%Y-%%m-%%d')),('create_date','&gt;',(datetime.date (int(time.strftime('%%Y')), datetime.date.today().month-1, 1)).strftime('%%Y-%%m-%%d'))]"
domain="[('create_date','&lt;=', (datetime.date.today() - relativedelta(day=31, months=1)).strftime('%%Y-%%m-%%d')),('create_date','&gt;=',(datetime.date.today() - relativedelta(day=1,months=1)).strftime('%%Y-%%m-%%d'))]"
help="Helpdesk requests occurred in last month"/>
<separator orientation="vertical" />
<filter string="Current" icon="terp-check"
domain="[('state','in',('open','draft'))]" />
<filter string="Won" icon="terp-check"
domain="[('state','=','done')]" />
<filter string="Lost" icon="terp-dialog-close"
domain="[('state','=','cancel')]" />
<separator orientation="vertical" />
<field name="section_id" string="Sales Team"
default="context.get('section_id', False)"
context="{'invisible_section': False}">
<filter icon="terp-personal+"
context="{'invisible_section': False}"
domain="[('section_id.user_id','=',uid)]"
help="My team" />
</field>
<field name="company_id">
<filter icon="terp-go-home"
context="{'invisible_section': False}"
domain="[('section_id.user_id.company_id','=',uid)]"
help="My company"/>
<separator orientation="vertical" />
<filter string="Current" icon="terp-check"
domain="[('state','in',('open','draft'))]" />
<filter string="Won" icon="terp-check"
domain="[('state','=','done')]" />
<filter string="Lost" icon="terp-dialog-close"
domain="[('state','=','cancel')]" />
<separator orientation="vertical" />
<field name="section_id" string="Sales Team"
default="context.get('section_id', False)"
context="{'invisible_section': False}">
<filter icon="terp-personal+" groups="base.group_extended"
context="{'invisible_section': False}"
domain="[('section_id.user_id','=',uid)]"
help="My Sales Team(s)" />
</field>
<field name="user_id" string="Salesman">
<filter icon="terp-personal" string="My Case(s)" help="My Case(s)" domain="[('user_id','=',uid)]" />
</field>
</group>
<newline/>
<group expand="0" string="Extended Filters..." groups="base.group_extended">
<field name="priority" string="Priority"/>
<field name="categ_id"/>
<field name="date_closed" string="Close Date"/>
</group>
<newline/>
<group expand="1" string="Group By...">
<field name="company_id">
<filter icon="terp-go-home"
context="{'invisible_section': False}"
domain="[('section_id.user_id.company_id','=',uid)]"
help="My company"/>
</field>
<field name="user_id" string="Salesman">
<filter icon="terp-personal" string="My Case(s)" help="My Case(s)" domain="[('user_id','=',uid)]" />
</field>
</group>
<newline/>
<group expand="0" string="Extended Filters..." groups="base.group_extended">
<field name="priority" string="Priority"/>
<field name="categ_id"/>
<newline/>
<field name="date_closed" string="Close Date"/>
</group>
<newline/>
<group expand="1" string="Group By...">
<filter string="Salesman" icon="terp-personal"
domain="[]" context="{'group_by':'user_id'}"
default="1" />
@ -134,21 +129,17 @@
<filter string="Partner" icon="terp-partner"
domain="[]"
context="{'group_by':'partner_id'}" />
<separator orientation="vertical" />
<filter string="Channel" icon="terp-call-start"
domain="[]"
context="{'group_by':'canal_id'}" />
context="{'group_by':'canal_id'}" />
<separator orientation="vertical" />
<filter string="State" icon="terp-stock_effects-object-colorize"
domain="[]" context="{'group_by':'state'}" />
<separator orientation="vertical" />
<filter string="Company" icon="terp-go-home"
domain="[]"
context="{'group_by':'company_id'}" />
<separator orientation="vertical" />
<filter string="Day" icon="terp-go-today"
domain="[]" context="{'group_by':'day'}" help="Date of helpdesk requests"/>
@ -156,8 +147,8 @@
domain="[]" context="{'group_by':'month'}" help="Month of helpdesk requests"/>
<filter string="Year" icon="terp-go-year"
domain="[]" context="{'group_by':'name'}" help="Year of helpdesk requests" />
</group>
</search>
</group>
</search>
</field>
</record>

View File

@ -1,5 +1,5 @@
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
"access_crm_helpdesk_manager","crm.helpdesk.manager","model_crm_helpdesk","base.group_sale_manager",1,0,0,0
"access_crm_helpdesk_user","crm.helpdesk.user","model_crm_helpdesk","base.group_sale_salesman",1,1,1,1
"access_crm_helpdesk_manager","crm.helpdesk.manager","model_crm_helpdesk","base.group_sale_manager",1,1,1,1
"access_crm_helpdesk_user","crm.helpdesk.user","model_crm_helpdesk","base.group_sale_salesman",1,1,1,0
"access_report_crm_helpdesk_manager","report.crm.helpdesk.manager","model_crm_helpdesk_report","base.group_sale_manager",1,1,1,1
"access_crm_helpdesk_system","crm.helpdesk.system","model_crm_helpdesk","base.group_system",1,0,0,0

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_crm_helpdesk_manager crm.helpdesk.manager model_crm_helpdesk base.group_sale_manager 1 0 1 0 1 0 1
3 access_crm_helpdesk_user crm.helpdesk.user model_crm_helpdesk base.group_sale_salesman 1 1 1 1 0
4 access_report_crm_helpdesk_manager report.crm.helpdesk.manager model_crm_helpdesk_report base.group_sale_manager 1 1 1 1
5 access_crm_helpdesk_system crm.helpdesk.system model_crm_helpdesk base.group_system 1 0 0 0

View File

@ -171,7 +171,8 @@ class crm_lead(osv.osv):
AND partner_weight > 0) AS d
ORDER BY distance LIMIT 1""", (result[1],result[0]))
res = cr.dictfetchone()
part_ids.append(res['id'])
if res:
part_ids.append(res['id'])
total = 0
toassign = []

View File

@ -16,9 +16,7 @@
<action
string="New Files"
name="%(document.action_view_all_document_tree1)d"
view_mode="tree"
domain="[('name','=',time.strftime('%%Y')),('month','=',time.strftime('%%m'))]"/>
view_mode="tree,form"/>
<action
string="File Size by Month"
name="%(document.action_view_size_month)d"
@ -28,7 +26,8 @@
<action
string="Files by Resource Type"
name="%(document.action_view_document_by_resourcetype_graph)d"
view_mode="graph,tree"/>
view_mode="graph,tree"
/>
<action
string="Files by Partner"

View File

@ -41,7 +41,7 @@ class document_file(osv.osv):
fbrl = self.browse(cr, uid, ids, context=context)
nctx = nodes.get_node_context(cr, uid, context={})
# nctx will /not/ inherit the caller's context. Most of
# it would be useless, anyway (like active_id, active_model,
# it would be useless, anyway (like active_id, active_model,
# bin_size etc.)
result = {}
bin_size = context.get('bin_size', False)
@ -88,20 +88,19 @@ class document_file(osv.osv):
'parent_id': fields.many2one('document.directory', 'Directory', select=1, required=True),
'index_content': fields.text('Indexed Content'),
'partner_id':fields.many2one('res.partner', 'Partner', select=1),
'company_id': fields.many2one('res.company', 'Company'),
'file_size': fields.integer('File Size', required=True),
'file_type': fields.char('Content Type', size=128),
# fields used for file storage
'store_fname': fields.char('Stored Filename', size=200),
}
_order = "create_date desc"
def __get_def_directory(self, cr, uid, context=None):
dirobj = self.pool.get('document.directory')
return dirobj._get_root_directory(cr, uid, context)
_defaults = {
'company_id': lambda s,cr,uid,c: s.pool.get('res.company')._company_default_get(cr, uid, 'ir.attachment', context=c),
'user_id': lambda self, cr, uid, ctx:uid,
'file_size': lambda self, cr, uid, ctx:0,
'parent_id': __get_def_directory
@ -150,7 +149,7 @@ class document_file(osv.osv):
return False
if not self._check_duplication(cr, uid, vals, ids, 'write'):
raise osv.except_osv(_('ValidateError'), _('File name must be unique!'))
# if nodes call this write(), they must skip the code below
from_node = context and context.get('__from_node', False)
if (('parent_id' in vals) or ('name' in vals)) and not from_node:
@ -255,10 +254,11 @@ class document_file(osv.osv):
storage_id = par.storage_id
break
par = par.parent_id
assert storage_id, "Strange, found file #%s w/o storage!" % f.id
r = stor.prepare_unlink(cr, uid, storage_id, f)
if r:
unres.append(r)
#assert storage_id, "Strange, found file #%s w/o storage!" % f.id #TOCHECK: after run yml, it's fail
if storage_id:
r = stor.prepare_unlink(cr, uid, storage_id, f)
if r:
unres.append(r)
res = super(document_file, self).unlink(cr, uid, ids, context)
stor.do_unlink(cr, uid, unres)
return res

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
#
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
@ -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 <http://www.gnu.org/licenses/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
@ -29,7 +29,7 @@ from tools.translate import _
class document_directory(osv.osv):
_name = 'document.directory'
_description = 'Directory'
_order = 'name desc'
_order = 'name'
_columns = {
'name': fields.char('Name', size=64, required=True, select=1),
'write_date': fields.datetime('Date Modified', readonly=True),
@ -44,13 +44,12 @@ class document_directory(osv.osv):
'child_ids': fields.one2many('document.directory', 'parent_id', 'Children'),
'file_ids': fields.one2many('ir.attachment', 'parent_id', 'Files'),
'content_ids': fields.one2many('document.directory.content', 'directory_id', 'Virtual Files'),
'type': fields.selection([
'type': fields.selection([
('directory','Static Directory'),
('ressource','Folders per resource'),
],
'Type', required=True, select=1,
help="Defines directory's behaviour."),
help="Each directory can either have the type Static or be linked to another resource. A static directory, as with Operating Systems, is the classic directory that can contain a set of files. The directories linked to systems resources automatically possess sub-directories for each of resource types defined in the parent directory."),
'ressource_type_id': fields.many2one('ir.model', 'Resource model',
help="Select an object here and there will be one folder per record of that resource."),
'resource_field': fields.many2one('ir.model.fields', 'Name field', help='Field to be used as name on resource directories. If empty, the "name" will be used.'),
@ -95,13 +94,13 @@ class document_directory(osv.osv):
return objid.browse(cr, uid, mid, context=context).res_id
except Exception:
return None
_defaults = {
'company_id': lambda s,cr,uid,c: s.pool.get('res.company')._company_default_get(cr, uid, 'document.directory', context=c),
'user_id': lambda self,cr,uid,ctx: uid,
'domain': lambda self,cr,uid,ctx: '[]',
'type': lambda *args: 'directory',
'ressource_id': lambda *a: 0,
'ressource_id': lambda *a: 0,
'storage_id': _get_def_storage,
'resource_find_all': True,
}
@ -151,7 +150,7 @@ class document_directory(osv.osv):
_constraints = [
(_check_recursion, 'Error! You can not create recursive Directories.', ['parent_id'])
]
def __init__(self, *args, **kwargs):
super(document_directory, self).__init__(*args, **kwargs)
@ -172,7 +171,7 @@ class document_directory(osv.osv):
"""
if not context:
context = {}
return nodes.get_node_context(cr, uid, context).get_uri(cr, uri)
def get_dir_permissions(self, cr, uid, ids ):
@ -180,7 +179,7 @@ class document_directory(osv.osv):
"""
assert len(ids) == 1
id = ids[0]
cr.execute( "SELECT count(dg.item_id) AS needs, count(ug.uid) AS has " \
" FROM document_directory_group_rel dg " \
" LEFT OUTER JOIN res_groups_users_rel ug " \
@ -197,7 +196,7 @@ class document_directory(osv.osv):
Return a tuple (node_dir, remaining_path)
"""
return (nodes.node_database(context=ncontext), uri)
def copy(self, cr, uid, id, default=None, context=None):
if not default:
default ={}

View File

@ -148,6 +148,7 @@
<field name="name"/>
<field name="type"/>
<field name="user_id"/>
<field name="storage_id"/>
<field name="create_date"/>
<field name="write_date"/>
</tree>
@ -276,38 +277,42 @@
</form>
</field>
</record>
<record id="view_attach_filter" model="ir.ui.view">
<field name="name">IR Attachment</field>
<record id="view_attach_filter_inherit0" model="ir.ui.view">
<field name="name">IR Attachment0</field>
<field name="model">ir.attachment</field>
<field name="type">search</field>
<field name="inherit_id" ref="base.view_attachment_search"/>
<field name="arch" type="xml">
<search string="Document">
<filter icon="terp-go-month" string="Month"
domain="[('create_date','&lt;=', time.strftime('%%Y-%%m-%%d')),('create_date','&gt;=',time.strftime('%%Y-%%m-01'))]"
/>
<separator orientation="vertical"/>
<field name="name"/>
<field name="parent_id" />
<field name="user_id">
<filter icon="terp-personal"
domain="[('user_id','=', False)]"
help="Filter on my documents" />
</field>
<field name="partner_id"/>
<field name="company_id" groups="base.group_multi_company"/>
<newline/>
<group expand="0" string="Group By...">
<filter string="Partner" icon="terp-personal" domain="[]"
<field name="create_uid" position="replace">
<field name="user_id">
<filter icon="terp-personal"
domain="[('user_id','=',uid)]"
help="Filter on my documents" />
</field>
<field name="parent_id" />
<field name="index_content"/>
</field>
</field>
</record>
<record id="view_attach_filter_inherit2" model="ir.ui.view">
<field name="name">IR Attachment2</field>
<field name="model">ir.attachment</field>
<field name="type">search</field>
<field name="inherit_id" ref="base.view_attachment_search"/>
<field name="arch" type="xml">
<filter string="Owner" position="replace">
<filter string="Owner" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}"/>
<filter string="Partner" icon="terp-partner" domain="[]"
context="{'group_by':'partner_id'}" groups="base.group_extended"/>
<filter string="Directory" icon="terp-folder-green" domain="[]" context="{'group_by':'parent_id'}"/>
<filter string="Type" icon="terp-stock_symbol-selection" domain="[]" context="{'group_by':'type'}" groups="base.group_extended"/>
<filter string="Owner" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}"/>
<filter string="Company" icon="terp-personal" domain="[]" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
</group>
</search>
</field>
</record>
</filter>
</field>
</record>
<record model="ir.ui.view" id="view_document_file_tree">
<field name="name">ir.attachment</field>
<field name="model">ir.attachment</field>
@ -318,6 +323,7 @@
<field name="name"/>
<field name="parent_id" />
<field name="user_id"/>
<field name="company_id"/>
<field name="create_date"/>
<field name="write_date"/>
<field name="partner_id" groups="base.group_extended" />
@ -332,8 +338,7 @@
<field name="type">ir.actions.act_window</field>
<field name="res_model">ir.attachment</field>
<field name="view_type">form</field>
<field name="search_view_id" ref="view_attach_filter"/>
<field name="help">Documents give your access to all attached documents; it's a repository of all attached documents (mails, documents attached to a project, etc.)</field>
<field name="help">The Documents repository gives you access to all attachments, such as mails, project documents, invoices etc.</field>
</record>
<menuitem name="Documents" id="menu_document_doc" parent="knowledge.menu_document" sequence="0"/>
<menuitem
@ -403,15 +408,11 @@
src_model="res.partner"
groups="base.group_extended"/>
<act_window
context="{'search_default_parent_id': [active_id]}"
id="zoom_directory" name="Related Documents"
<act_window
domain="[('parent_id', '=', active_id)]"
id="zoom_directory" name="Related Documents"
res_model="ir.attachment"
src_model="document.directory"/>
</data>
</openerp>

View File

@ -34,6 +34,7 @@ class report_document_user(osv.osv):
'user_id':fields.integer('Owner', readonly=True),
'user':fields.char('User',size=64,readonly=True),
'directory': fields.char('Directory',size=64,readonly=True),
'datas_fname': fields.char('File Name',size=64,readonly=True),
'create_date': fields.datetime('Date Created', readonly=True),
'change_date': fields.datetime('Modified Date', readonly=True),
'file_size': fields.integer('File Size', readonly=True),
@ -52,6 +53,7 @@ class report_document_user(osv.osv):
u.name as user,
count(*) as nbr,
d.name as directory,
f.datas_fname as datas_fname,
f.create_date as create_date,
f.file_size as file_size,
min(d.type) as type,
@ -59,11 +61,13 @@ class report_document_user(osv.osv):
FROM ir_attachment f
left join document_directory d on (f.parent_id=d.id and d.name<>'')
inner join res_users u on (f.user_id=u.id)
group by to_char(f.create_date, 'YYYY'), to_char(f.create_date, 'MM'),d.name,f.parent_id,d.type,f.create_date,f.user_id,f.file_size,u.name,d.type,f.write_date
group by to_char(f.create_date, 'YYYY'), to_char(f.create_date, 'MM'),d.name,f.parent_id,d.type,f.create_date,f.user_id,f.file_size,u.name,d.type,f.write_date,f.datas_fname
)
""")
report_document_user()
class report_files_partner(osv.osv):
_name = "report.files.partner"
_description = "Files details by Partners"
@ -86,7 +90,7 @@ class report_files_partner(osv.osv):
to_char(date_trunc('month', f.create_date),'MM') AS month,
SUM(f.file_size) AS file_size,
p.name AS partner
FROM ir_attachment f
LEFT JOIN res_partner p ON (f.partner_id=p.id)
WHERE f.datas_fname IS NOT NULL

View File

@ -10,6 +10,7 @@
<field name="name" select="1"/>
<field name="user" select="1"/>
<field name="directory" select="1"/>
<field name="datas_fname" select="1"/>
<field name="file_size"/>
<field name="create_date"/>
</form>
@ -25,10 +26,11 @@
<tree string="Files">
<field name="name" select="1"/>
<field name="month" select="1"/>
<field name="user" select="1"/>
<field name="directory" select="1"/>
<field name="file_size"/>
<field name="create_date"/>
<field name="user" select="1" invisible="1"/>
<field name="directory" select="1" invisible="1"/>
<field name="file_size" invisible="1"/>
<field name="create_date" invisible="1"/>
<field name="nbr"/>
</tree>
</field>
</record>
@ -60,8 +62,8 @@
<field name="name">All Users files</field>
<field name="res_model">report.document.user</field>
<field name="view_type">form</field>
<field name="view_mode">tree</field>
<field name="context">{'search_default_user': 'user_id'}</field>
<field name="view_mode">tree,form</field>
<field name="context">{'group_by': ['name','month']}</field>
<field name="search_view_id" ref="view_report_document_user_search"/>
</record>
@ -112,30 +114,18 @@
<field name="arch" type="xml">
<graph string="Files by Resource Type" type="pie">
<field name="type" />
<!-- <field name="file_size" operator="+"/>-->
<field name="nbr" operator="+"/>
</graph>
</field>
</record>
<!-- <record model="ir.ui.view" id="view_document_by_resourcetype_tree">-->
<!-- <field name="name">report.document.resource.tree.view</field>-->
<!-- <field name="model">report.document.user</field>-->
<!-- <field name="type">tree</field>-->
<!-- <field name="arch" type="xml">-->
<!-- <tree string="Files by Resource Type">-->
<!-- <field name="type" />-->
<!-- <field name="nbr"/>-->
<!-- </tree>-->
<!-- </field>-->
<!-- </record>-->
<record model="ir.actions.act_window" id="action_view_document_by_resourcetype_graph">
<field name="name">Files by Resource Type</field>
<field name="res_model">report.document.user</field>
<field name="view_id" ref="view_document_by_resourcetype_graph"></field>
<field name="view_id" ref="view_document_by_resourcetype_graph"/>
<field name="view_type">form</field>
<field name="view_mode">tree</field>
<field name="view_mode">graph,tree</field>
</record>
<!--***************************************************************************************-->
@ -150,7 +140,7 @@
<field name="file_size" operator="+"/>
</graph>
</field>
</record>
</record>
<record model="ir.ui.view" id="view_size_month_tree">
<field name="name">report.document.user.tree</field>

View File

@ -196,7 +196,7 @@
!python {model: ir.attachment}: |
from document_ftp import test_easyftp as te
ftp = te.get_ftp_folder(cr, uid, self, 'Documents')
ftp.mkd("Test-Folder2")
ftp.mkd("Test-Folder3")
# TODO move
-
I remove the 'Test-Folder3'

View File

@ -31,7 +31,7 @@ def get_plain_ftp(timeout=10.0):
ftp = FTP()
host = config.get('ftp_server_host', '127.0.0.1')
port = config.get('ftp_server_port', '8021')
ftp.connect(host, port, timeout=timeout)
ftp.connect(host, port,timeout)
return ftp
def get_ftp_login(cr, uid, ormobj):

View File

@ -8,7 +8,7 @@
<field name="arch" type="xml">
<form string="Browse Document">
<separator string="Browse Document" colspan="4"/>
<field name="url" widget="url" colspan="4"/>
<field name="url" widget="url" colspan="4" width="250"/>
<separator colspan="4"/>
<group col="4" colspan="4">
<label string="" colspan="2"/>

View File

@ -30,7 +30,7 @@ class document_ftp_configuration(osv.osv_memory):
_rec_name = 'host'
_columns = {
'host': fields.char('Address', size=64,
help="Server address or IP and port to which users should connect to for DMS access",
help="Server address or IP and port to which users should connect to for DMS access",
required=True),
}

View File

@ -21,7 +21,7 @@
<attribute name="string">Configure FTP Server</attribute>
</separator>
<xpath expr="//label[@string='description']" position="attributes">
<attribute name="string">Choose the address for the Document Management System's FTP server.</attribute>
<attribute name="string">Indicate the network address on which your OpenERP server should be reachable for end-users. This depends on your network topology and configuration, and will only affect the links displayed to the users. The format is HOST:PORT and the default host (localhost) is only suitable for access from the server machine itself..</attribute>
</xpath>
<xpath expr='//separator[@string="vsep"]' position='attributes'>
<attribute name='rowspan'>12</attribute>

View File

@ -31,6 +31,7 @@ TEMPLATE_ENGINES = []
from osv import osv, fields
from tools.translate import _
try:
from mako.template import Template as MakoTemplate
TEMPLATE_ENGINES.append(('mako', 'Mako Templates'))

View File

@ -1,8 +1,12 @@
<?xml version="1.0"?>
<openerp>
<data>
<menuitem name="Association" id="base.menu_association" icon="terp-calendar" sequence="9"/>
<menuitem name="Marketing" icon="terp-crm" id="base.marketing_menu" sequence="17"/>
<menuitem name="Events Organisation" id="base.menu_event_main" parent="base.marketing_menu" />
<menuitem name="Events Organisation" id="base.menu_event_association" parent="base.menu_association" />
<!-- EVENTS -->
@ -34,7 +38,10 @@
<field name="view_type">form</field>
</record>
<menuitem name="Configuration" id="base.menu_marketing_config_root" parent="base.marketing_menu" sequence="30" groups="base.group_extended"/>
<menuitem name="Configuration" id="base.menu_marketing_config_association" parent="base.menu_association" sequence="30" groups="base.group_extended"/>
<menuitem name="Types of Events" id="menu_event_type" action="action_event_type" parent="base.menu_marketing_config_root" groups="base.group_extended"/>
<menuitem name="Types of Events" id="menu_event_type_association" action="action_event_type" parent="base.menu_marketing_config_association" groups="base.group_extended"/>
<!-- Events Organisation/CONFIGURATION/EVENTS -->
@ -174,6 +181,7 @@
<field name="register_current"/>
<field name="section_id" invisible="context.get('invisible_section', True)"/>
<field name="state"/>
<field name="user_id"/>
<button string="Confirm Event" help="Confirm Event" name="button_confirm" states="draft" type="object" icon="gtk-apply"/>
<button string="Cancel Event" help="Cancel Event" name="button_cancel" states="draft,confirm" type="object" icon="gtk-cancel"/>
<button string="Event Done" help="Event Done" name="button_done" states="confirm" type="object" icon="gtk-jump-to"/>
@ -285,6 +293,7 @@
view_type="form"/>
<menuitem name="Events" id="menu_event_event" action="action_event_view" parent="base.menu_event_main" />
<menuitem name="Events" id="menu_event_event_assiciation" action="action_event_view" parent="base.menu_event_association" />
<!-- EVENTS/REGISTRATIONS/EVENTS -->
@ -507,6 +516,12 @@
name="Registrations"
id="menu_action_registration" parent="base.menu_event_main"
action="action_registration"/>
<menuitem
name="Registrations"
id="menu_action_registration_association" parent="base.menu_event_association"
action="action_registration"/>
<menuitem name="Reporting" id="base.menu_report_association" parent="base.marketing_menu" sequence="20"/>
</data>
</openerp>

View File

@ -49,9 +49,12 @@
<group>
<filter icon="terp-go-year" string=" Year "
domain="[('create_date','&lt;=', time.strftime('%%Y-%%m-%%d')),('create_date','&gt;=',time.strftime('%%Y-01-01'))]" help="Evaluation done in current year"/>
<filter icon="terp-go-month" string=" Month " name="month" domain="[('create_date','&lt;=', time.strftime('%%Y-%%m-%%d')),('create_date','&gt;=',time.strftime('%%Y-%%m-01'))]" help="Evaluation done in current month"/>
<filter icon="terp-go-month" string=" Month " name="month"
domain="[('create_date','&lt;=',(datetime.date.today()+relativedelta(day=31)).strftime('%%Y-%%m-%%d')),('create_date','&gt;=',(datetime.date.today()-relativedelta(day=1)).strftime('%%Y-%%m-%%d'))]"
help="Evaluation done in current month"/>
<filter icon="terp-go-month" string=" Month-1 " separator="1"
domain="[('create_date','&lt;=', (datetime.date (int(time.strftime('%%Y')), datetime.date.today().month, 1) - datetime.timedelta (days = 1)).strftime('%%Y-%%m-%%d')),('create_date','&gt;=',(datetime.date (int(time.strftime('%%Y')), datetime.date.today().month-1, 1)).strftime('%%Y-%%m-%%d'))]" help="Evaluation done in last month"/>
domain="[('create_date','&lt;=', (datetime.date.today() - relativedelta(day=31, months=1)).strftime('%%Y-%%m-%%d')),('create_date','&gt;=',(datetime.date.today() - relativedelta(day=1,months=1)).strftime('%%Y-%%m-%%d'))]"
help="Evaluation done in last month"/>
<separator orientation="vertical"/>
<filter string="In Progress" icon="terp-camera_test" domain="[('state', '=' ,'wait')]"
help = "In progress Evaluations"/>

View File

@ -139,7 +139,7 @@
help="Expenses to Invoice"/>
<separator orientation="vertical"/>
<filter icon="terp-go-month" string="This Month" name="this"
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')), ('date','&gt;',(datetime.date.today()-datetime.timedelta(days=30)).strftime('%%Y-%%m-%%d'))]"/>
domain="[('date','&lt;=',(datetime.date.today()+relativedelta(day=31)).strftime('%%Y-%%m-%%d')),('date','&gt;=',(datetime.date.today()-relativedelta(day=1)).strftime('%%Y-%%m-%%d'))]"/>
<separator orientation="vertical"/>
<field name="employee_id" select='1'/>
<field name="date" select='1'/>

View File

@ -58,10 +58,11 @@
help="Expenses during current year"/>
<filter icon="terp-go-month" string=" Month "
name="month"
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')),('date','&gt;=',time.strftime('%%Y-%%m-01'))]"
domain="[('date','&lt;=',(datetime.date.today()+relativedelta(day=31)).strftime('%%Y-%%m-%%d')),('date','&gt;=',(datetime.date.today()-relativedelta(day=1)).strftime('%%Y-%%m-%%d'))]"
help="Expenses during current month"/>
<filter icon="terp-go-month" string=" Month-1 " separator="1"
domain="[('date','&lt;=', (datetime.date (int(time.strftime('%%Y')), datetime.date.today().month, 1) - datetime.timedelta (days = 1)).strftime('%%Y-%%m-%%d')),('date','&gt;',(datetime.date (int(time.strftime('%%Y')), datetime.date.today().month-1, 1)).strftime('%%Y-%%m-%%d'))]" help="Expenses during last month"/>
domain="[('date','&lt;=', (datetime.date.today() - relativedelta(day=31, months=1)).strftime('%%Y-%%m-%%d')),('date','&gt;=',(datetime.date.today() - relativedelta(day=1,months=1)).strftime('%%Y-%%m-%%d'))]"
help="Expenses during last month"/>
<separator orientation="vertical"/>
<filter string="Waiting" icon="terp-gtk-media-pause" domain="[('state', '=' ,'confirm')]"
help = "Confirm Expenses"/>

View File

@ -16,7 +16,7 @@
<filter icon="terp-camera_test" domain="[('state','=','confirm')]" string="To Approve"/>
<separator orientation="vertical"/>
<filter string="This Month" icon="terp-go-month" name="This Month"
domain="[('date_from','&lt;=', time.strftime('%%Y-%%m-%%d')), ('date_from','&gt;',(datetime.date.today()-datetime.timedelta(days=30)).strftime('%%Y-%%m-%%d'))]"/>
domain="[('date_from','&lt;=',(datetime.date.today()+relativedelta(day=31)).strftime('%%Y-%%m-%%d')),('date_from','&gt;=',(datetime.date.today()-relativedelta(day=1)).strftime('%%Y-%%m-%%d'))]"/>
<separator orientation="vertical"/>
<field name="employee_id">
<filter icon="terp-personal"

View File

@ -48,8 +48,12 @@
<search string="Leaves">
<group>
<filter icon="terp-go-year" string=" Year " domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')),('date','&gt;=',time.strftime('%%Y-01-01'))]" help="Available Leaves of current year"/>
<filter icon="terp-go-month" string=" Month " name="month" domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')),('date','&gt;=',time.strftime('%%Y-%%m-01'))]" help="Available Leaves of current month"/>
<filter icon="terp-go-month" string=" Month-1 " separator="1" domain="[('date','&lt;=', (datetime.date (int(time.strftime('%%Y')), datetime.date.today().month, 1) - datetime.timedelta (days = 1)).strftime('%%Y-%%m-%%d')),('date','&gt;',(datetime.date (int(time.strftime('%%Y')), datetime.date.today().month-1, 1)).strftime('%%Y-%%m-%%d'))]" help="Available Leaves of last month"/>
<filter icon="terp-go-month" string=" Month " name="month"
domain="[('date','&lt;=',(datetime.date.today()+relativedelta(day=31)).strftime('%%Y-%%m-%%d')),('date','&gt;=',(datetime.date.today()-relativedelta(day=1)).strftime('%%Y-%%m-%%d'))]"
help="Available Leaves of current month"/>
<filter icon="terp-go-month" string=" Month-1 " separator="1"
domain="[('date','&lt;=', (datetime.date.today() - relativedelta(day=31, months=1)).strftime('%%Y-%%m-%%d')),('date','&gt;=',(datetime.date.today() - relativedelta(day=1,months=1)).strftime('%%Y-%%m-%%d'))]"
help="Available Leaves of last month"/>
<separator orientation="vertical"/>
<filter string="Validated" icon="terp-camera_test" domain="[('state','=','validate')]"/>
<separator orientation="vertical"/>

View File

@ -48,9 +48,12 @@
<group>
<filter icon="terp-go-year" string=" Year "
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')),('date','&gt;=',time.strftime('%%Y-01-01'))]" help="Leaves taken in current year"/>
<filter icon="terp-go-month" string=" Month " name="month" domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')),('date','&gt;=',time.strftime('%%Y-%%m-01'))]" help="Leaves taken in current month"/>
<filter icon="terp-go-month" string=" Month " name="month"
domain="[('date','&lt;=',(datetime.date.today()+relativedelta(day=31)).strftime('%%Y-%%m-%%d')),('date','&gt;=',(datetime.date.today()-relativedelta(day=1)).strftime('%%Y-%%m-%%d'))]"
help="Leaves taken in current month"/>
<filter icon="terp-go-month" string=" Month-1 " separator="1"
domain="[('date','&lt;=', (datetime.date (int(time.strftime('%%Y')), datetime.date.today().month, 1) - datetime.timedelta (days = 1)).strftime('%%Y-%%m-%%d')),('date','&gt;',(datetime.date (int(time.strftime('%%Y')), datetime.date.today().month-1, 1)).strftime('%%Y-%%m-%%d'))]" help="Leaves taken in last month"/>
domain="[('date','&lt;=', (datetime.date.today() - relativedelta(day=31, months=1)).strftime('%%Y-%%m-%%d')),('date','&gt;=',(datetime.date.today() - relativedelta(day=1,months=1)).strftime('%%Y-%%m-%%d'))]"
help="Leaves taken in last month"/>
<separator orientation="vertical"/>
<filter string="Future Leaves" icon="terp-gtk-media-pause" domain="[('state', 'in' ,('draft','confirm'))]"
help = "Draft and Confirmed leaves"/>

View File

@ -254,11 +254,6 @@ msgstr "Convert To Partner"
msgid "Recruitments Statistics"
msgstr "Recruitments Statistics"
#. module: hr_recruitment
#: field:hr.recruitment.report,perc_done:0
msgid "%Done"
msgstr "%Done"
#. module: hr_recruitment
#: constraint:ir.ui.view:0
msgid "Invalid XML for View Architecture!"
@ -312,11 +307,6 @@ msgstr "Email"
msgid "Availability (Days)"
msgstr "Availability (Days)"
#. module: hr_recruitment
#: field:hr.recruitment.report,avg_answers:0
msgid "Avg. Answers"
msgstr "Avg. Answers"
#. module: hr_recruitment
#: view:hr.recruitment.report:0
msgid "Available"
@ -464,11 +454,6 @@ msgstr "Stage of Recruitment"
msgid "Stages"
msgstr "Stages"
#. module: hr_recruitment
#: field:hr.recruitment.report,perc_cancel:0
msgid "%Cancel"
msgstr "%Cancel"
#. module: hr_recruitment
#: field:hr.applicant,probability:0
msgid "Probability"

View File

@ -257,11 +257,6 @@ msgstr ""
msgid "Recruitments Statistics"
msgstr ""
#. module: hr_recruitment
#: field:hr.recruitment.report,perc_done:0
msgid "%Done"
msgstr ""
#. module: hr_recruitment
#: constraint:ir.ui.view:0
msgid "Invalid XML for View Architecture!"
@ -315,11 +310,6 @@ msgstr ""
msgid "Availability (Days)"
msgstr ""
#. module: hr_recruitment
#: field:hr.recruitment.report,avg_answers:0
msgid "Avg. Answers"
msgstr ""
#. module: hr_recruitment
#: view:hr.recruitment.report:0
msgid "Available"
@ -467,11 +457,6 @@ msgstr ""
msgid "Stages"
msgstr ""
#. module: hr_recruitment
#: field:hr.recruitment.report,perc_cancel:0
msgid "%Cancel"
msgstr ""
#. module: hr_recruitment
#: field:hr.applicant,probability:0
msgid "Probability"

View File

@ -254,11 +254,6 @@ msgstr ""
msgid "Recruitments Statistics"
msgstr ""
#. module: hr_recruitment
#: field:hr.recruitment.report,perc_done:0
msgid "%Done"
msgstr ""
#. module: hr_recruitment
#: constraint:ir.ui.view:0
msgid "Invalid XML for View Architecture!"
@ -464,11 +459,6 @@ msgstr ""
msgid "Stages"
msgstr ""
#. module: hr_recruitment
#: field:hr.recruitment.report,perc_cancel:0
msgid "%Cancel"
msgstr ""
#. module: hr_recruitment
#: field:hr.applicant,probability:0
msgid "Probability"

View File

@ -258,11 +258,6 @@ msgstr ""
msgid "Recruitments Statistics"
msgstr ""
#. module: hr_recruitment
#: field:hr.recruitment.report,perc_done:0
msgid "%Done"
msgstr ""
#. module: hr_recruitment
#: constraint:ir.ui.view:0
msgid "Invalid XML for View Architecture!"
@ -316,11 +311,6 @@ msgstr ""
msgid "Availability (Days)"
msgstr ""
#. module: hr_recruitment
#: field:hr.recruitment.report,avg_answers:0
msgid "Avg. Answers"
msgstr ""
#. module: hr_recruitment
#: view:hr.recruitment.report:0
msgid "Available"
@ -468,11 +458,6 @@ msgstr ""
msgid "Stages"
msgstr ""
#. module: hr_recruitment
#: field:hr.recruitment.report,perc_cancel:0
msgid "%Cancel"
msgstr ""
#. module: hr_recruitment
#: field:hr.applicant,probability:0
msgid "Probability"

View File

@ -36,26 +36,10 @@ class hr_recruitment_report(osv.osv):
_auto = False
_rec_name = 'date'
def _get_data(self, cr, uid, ids, field_name, arg, context={}):
""" @param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of case and section Datas IDs
@param context: A standard dictionary for contextual values """
res = {}
state_perc = 0.0
avg_ans = 0.0
#TODO: Calculate avg_answer, perc_done, perc_cancel
return res
_columns = {
'user_id':fields.many2one('res.users', 'User', readonly=True),
'nbr': fields.integer('# of Cases', readonly=True),
'state': fields.selection(AVAILABLE_STATES, 'State', size=16, readonly=True),
'avg_answers': fields.function(_get_data, string='Avg. Answers', method=True, type="integer"),
'perc_done': fields.function(_get_data, string='%Done', method=True, type="float"),
'perc_cancel': fields.function(_get_data, string='%Cancel', method=True, type="float"),
'month':fields.selection([('01', 'January'), ('02', 'February'), \
('03', 'March'), ('04', 'April'),\
('05', 'May'), ('06', 'June'), \

View File

@ -55,12 +55,12 @@
help="Recruitment performed in current year"/>
<filter icon="terp-go-month" string="Month"
name="month"
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')),('date','&gt;=',time.strftime('%%Y-%%m-01'))]"
domain="[('date','&lt;=',(datetime.date.today()+relativedelta(day=31)).strftime('%%Y-%%m-%%d')),('date','&gt;=',(datetime.date.today()-relativedelta(day=1)).strftime('%%Y-%%m-%%d'))]"
help="Recruitment performed in current month"/>
<filter icon="terp-go-month"
string=" Month-1 "
separator="1"
domain="[('date','&lt;=', (datetime.date (int(time.strftime('%%Y')), datetime.date.today().month, 1) - datetime.timedelta (days = 1)).strftime('%%Y-%%m-%%d')),('date','&gt;',(datetime.date (int(time.strftime('%%Y')), datetime.date.today().month-1, 1)).strftime('%%Y-%%m-%%d'))]"
domain="[('date','&lt;=', (datetime.date.today() - relativedelta(day=31, months=1)).strftime('%%Y-%%m-%%d')),('date','&gt;=',(datetime.date.today() - relativedelta(day=1,months=1)).strftime('%%Y-%%m-%%d'))]"
help="Recruitment during last month"/>
<separator orientation="vertical"/>
<filter string="New"

View File

@ -101,6 +101,7 @@
<menuitem id="menu_project_working_hours" parent="base.menu_project_management_time_tracking" action="act_hr_timesheet_line_evry1_all_form"/>
<menuitem id="menu_hr_working_hours" parent="hr_attendance.menu_hr_time_tracking" action="act_hr_timesheet_line_evry1_all_form"/>
<menuitem id="menu_partner_invc" parent="base.menu_project_management_time_tracking" action="account.action_invoice_tree1"/>
<record id="hr_timesheet_employee_extd_form" model="ir.ui.view">
<field name="name">hr.timesheet.employee.extd_form</field>

View File

@ -52,7 +52,7 @@
help="Timesheet lines in this year"/>
<filter icon="terp-go-month" string="This Month"
name="month"
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')), ('date','&gt;',(datetime.date.today()-datetime.timedelta(days=30)).strftime('%%Y-%%m-%%d'))]"
domain="[('date','&lt;=',(datetime.date.today()+relativedelta(day=31)).strftime('%%Y-%%m-%%d')),('date','&gt;=',(datetime.date.today()-relativedelta(day=1)).strftime('%%Y-%%m-%%d'))]"
help="Timesheet lines in this month"/>
<filter icon="terp-go-week"
string=" 7 Days "

View File

@ -47,11 +47,11 @@
help="Timesheet in current year"/>
<filter icon="terp-go-month" string=" Month "
name="month"
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')),('date','&gt;=',time.strftime('%%Y-%%m-01'))]"
domain="[('date','&lt;=',(datetime.date.today()+relativedelta(day=31)).strftime('%%Y-%%m-%%d')),('date','&gt;=',(datetime.date.today()-relativedelta(day=1)).strftime('%%Y-%%m-%%d'))]"
help="Timesheet in current month"/>
<filter icon="terp-go-month"
string=" Month-1 "
domain="[('date','&lt;=', (datetime.date (int(time.strftime('%%Y')), datetime.date.today().month, 1) - datetime.timedelta (days = 1)).strftime('%%Y-%%m-%%d')),('date','&gt;',(datetime.date (int(time.strftime('%%Y')), datetime.date.today().month-1, 1)).strftime('%%Y-%%m-%%d'))]"
domain="[('date','&lt;=', (datetime.date.today() - relativedelta(day=31, months=1)).strftime('%%Y-%%m-%%d')),('date','&gt;=',(datetime.date.today() - relativedelta(day=1,months=1)).strftime('%%Y-%%m-%%d'))]"
help="Timesheet of last month"/>
<separator orientation="vertical"/>
<field name="account_id" groups="analytic.group_analytic_accounting"/>

View File

@ -4,6 +4,5 @@
"access_hr_timesheet_sheet_sheet_day","hr_timesheet_sheet.sheet.day","model_hr_timesheet_sheet_sheet_day","base.group_hr_user",1,1,1,1
"access_hr_timesheet_sheet_sheet_account","hr_timesheet_sheet.sheet.account","model_hr_timesheet_sheet_sheet_account","base.group_hr_user",1,1,1,1
"access_hr_timesheet_report","hr.timesheet.report","model_hr_timesheet_report","base.group_hr_manager",1,1,1,1
"access_timesheet_report_employee","timesheet.report.employee","model_hr_timesheet_report","base.group_hr_user",1,1,1,1
"access_hr_analytic_timesheet_system_user","hr.analytic.timesheet.system.user","model_hr_analytic_timesheet","base.group_user",1,0,0,0
"access_hr_timesheet_sheet_sheet_day","hr.timesheet.sheet.sheet.day.user","model_hr_timesheet_sheet_sheet_day","base.group_user",1,0,0,0

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
4 access_hr_timesheet_sheet_sheet_day hr_timesheet_sheet.sheet.day model_hr_timesheet_sheet_sheet_day base.group_hr_user 1 1 1 1
5 access_hr_timesheet_sheet_sheet_account hr_timesheet_sheet.sheet.account model_hr_timesheet_sheet_sheet_account base.group_hr_user 1 1 1 1
6 access_hr_timesheet_report hr.timesheet.report model_hr_timesheet_report base.group_hr_manager 1 1 1 1
access_timesheet_report_employee timesheet.report.employee model_hr_timesheet_report base.group_hr_user 1 1 1 1
7 access_hr_analytic_timesheet_system_user hr.analytic.timesheet.system.user model_hr_analytic_timesheet base.group_user 1 0 0 0
8 access_hr_timesheet_sheet_sheet_day hr.timesheet.sheet.sheet.day.user model_hr_timesheet_sheet_sheet_day base.group_user 1 0 0 0

View File

@ -33,12 +33,12 @@
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')),('date','&gt;=',time.strftime('%%Y-01-01'))]"
help="Idea Vote created in curren year"/>
<filter icon="terp-go-month" string=" Month "
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')),('date','&gt;=',time.strftime('%%Y-%%m-01'))]"
domain="[('date','&lt;=',(datetime.date.today()+relativedelta(day=31)).strftime('%%Y-%%m-%%d')),('date','&gt;=',(datetime.date.today()-relativedelta(day=1)).strftime('%%Y-%%m-%%d'))]"
help="Idea Vote created in current month"/>
<filter icon="terp-go-month"
string=" Month-1 "
separator="1"
domain="[('date','&lt;=', (datetime.date (int(time.strftime('%%Y')), datetime.date.today().month, 1) - datetime.timedelta (days = 1)).strftime('%%Y-%%m-%%d')),('date','&gt;',(datetime.date (int(time.strftime('%%Y')), datetime.date.today().month-1, 1)).strftime('%%Y-%%m-%%d'))]"
domain="[('date','&lt;=', (datetime.date.today() - relativedelta(day=31, months=1)).strftime('%%Y-%%m-%%d')),('date','&gt;=',(datetime.date.today() - relativedelta(day=1,months=1)).strftime('%%Y-%%m-%%d'))]"
help="Idea Vote created last month"/>
<separator orientation="vertical"/>
<filter icon="terp-go-today"

View File

@ -38,7 +38,7 @@ class knowledge_installer(osv.osv_memory):
help="Lets you create wiki pages and page groups in order "
"to keep track of business knowledge and share it with "
"and between your employees."),
# Templates of Content
# Content templates
'wiki_faq':fields.boolean('Internal FAQ',
help="Creates a skeleton internal FAQ pre-filled with "
"documentation about OpenERP's Document Management "

View File

@ -27,7 +27,7 @@
<field name="document_ftp"/>
<field name="document_webdav"/>
<field name="wiki"/>
<separator string="Templates of Content" colspan="4"/>
<separator string="Content templates" colspan="4"/>
<field name="wiki_faq"/>
<field name="wiki_quality_manual"/>
</group>

View File

@ -368,13 +368,13 @@
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')),('date','&gt;=',time.strftime('%%Y-01-01'))]"
help="Box amount in current year"/>
<filter icon="terp-go-month" string=" Month "
name="month"
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')),('date','&gt;=',time.strftime('%%Y-%%m-01'))]"
help="Box amount in current month"/>
name="month"
domain="[('date','&lt;=',(datetime.date.today()+relativedelta(day=31)).strftime('%%Y-%%m-%%d')),('date','&gt;=',(datetime.date.today()-relativedelta(day=1)).strftime('%%Y-%%m-%%d'))]"
help="Box amount in current month"/>
<filter icon="terp-go-month"
string=" Month-1 "
separator="1"
domain="[('date','&lt;=', (datetime.date (int(time.strftime('%%Y')), datetime.date.today().month, 1) - datetime.timedelta (days = 1)).strftime('%%Y-%%m-%%d')),('date','&gt;',(datetime.date (int(time.strftime('%%Y')), datetime.date.today().month-1, 1)).strftime('%%Y-%%m-%%d'))]"
domain="[('date','&lt;=', (datetime.date.today() - relativedelta(day=31, months=1)).strftime('%%Y-%%m-%%d')),('date','&gt;=',(datetime.date.today() - relativedelta(day=1,months=1)).strftime('%%Y-%%m-%%d'))]"
help="Box amount in last month"/>
<separator orientation="vertical"/>
<field name="user_id" select="1"/>

View File

@ -199,11 +199,11 @@ class mailgate_message(osv.osv):
if action_ids:
action_data = action_pool.read(cr, uid, action_ids[0], context=context)
action_data.update({
'res_id': res_id,
'domain' : "[('id','=',%d)]"%(res_id),
'nodestroy': True
})
return action_data
def open_attachment(self, cr, uid, ids, context):
""" To Open attachments
@param self: The object pointer.
@ -214,11 +214,12 @@ class mailgate_message(osv.osv):
"""
action_data = False
action_pool = self.pool.get('ir.actions.act_window')
message_pool = self.browse(cr ,uid, ids)[0]
action_ids = action_pool.search(cr, uid, [('res_model', '=', 'ir.attachment')])
if action_ids:
action_data = action_pool.read(cr, uid, action_ids[0], context=context)
action_data.update({
'domain': [('res_id','in',ids),('res_model','=',self._name)],
'domain': [('res_id','=',message_pool.res_id),('res_model','=',message_pool.model)],
'nodestroy': True
})
return action_data

View File

@ -11,7 +11,7 @@
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<page string="History" position="inside">
<field name="emails" colspan="4" nolabel="1"/>
<field name="emails" colspan="4" nolabel="1" domain="[('history', '=', True)]"/>
</page>
</field>
</record>

View File

@ -53,12 +53,12 @@
help="Production performed during current year"/>
<filter icon="terp-go-month" string="Month"
name="month"
domain="[('month','=',time.strftime('%%m'))]"
domain="[('date','&lt;=',(datetime.date.today()+relativedelta(day=31)).strftime('%%Y-%%m-%%d')),('date','&gt;=',(datetime.date.today()-relativedelta(day=1)).strftime('%%Y-%%m-%%d'))]"
help="Production performed during current month"/>
<filter icon="terp-go-week"
string="Month -1"
separator="1"
domain="[('month','=',(datetime.date.today() - datetime.timedelta(365/12)).strftime('%%m'))]"
domain="[('date','&lt;=', (datetime.date.today() - relativedelta(day=31, months=1)).strftime('%%Y-%%m-%%d')),('date','&gt;=',(datetime.date.today() - relativedelta(day=1,months=1)).strftime('%%Y-%%m-%%d'))]"
help="Production during last month"/>
<separator orientation="vertical"/>
<filter string="Current" icon="terp-check" domain="[('state','in',('open','draft'))]"/>

View File

@ -4,6 +4,7 @@ Pre requirements :
======================================================================================
1.Python 2.6+ . python can be downloaded from http://www.python.org/download/releases/ .
2.Python for Windows extensions - PyWin32 this module for python must be installed for appropriate version of the Python. It can be downloaded from http://sourceforge.net/projects/pywin32/files/ or http://starship.python.net/crew/mhammond/win32/
3.If you are using MS Outlook 2007 than you are required to install "Microsoft Exchange Server MAPI Client and Collaboration Data Objects 1.2.1 (CDO 1.21)". It can be downloaded from http://www.microsoft.com/downloads/en/details.aspx?FamilyID=e17e7f31-079a-43a9-bff2-0a110307611e&displaylang=en
How to install openerp-outlook plug-in?
======================================================================================

View File

@ -55,6 +55,7 @@ class outlook_installer(osv.osv_memory):
Pre-requirements :
1. Python 2.6+ .
2. Python for Windows extensions - PyWin32 this module for python must be installed for appropriate version of the Python.
3. If you are using MS Outlook 2007 than you are required to install "Microsoft Exchange Server MAPI Client and Collaboration Data Objects 1.2.1 (CDO 1.21)".
How to install openerp-outlook plug-in?
1. Extract zip file openerp-outlook-plugin.zip .
@ -65,6 +66,9 @@ How to install openerp-outlook plug-in?
6. See User Guide for more information.
7. Keep All extratced files in some safe places
(e.g. python installation Directory "C:\pythonXX\" or Windows installation Directory "C:\Program Files\" ).
Note :
Please refer README file for dependecies external link, openobject-addons/outlook/README.
"""
}
outlook_installer()

View File

@ -1,2 +1,2 @@
python addin.py
pause
pause

View File

@ -1,2 +1,2 @@
python addin.py --unregister
pause
python addin.py --unregister
pause

View File

@ -67,7 +67,7 @@ class ButtonEvent:
mngr = manager.GetManager()
mngr.ShowManager()
except Exception,e:
win32ui.MessageBox("Fail to Initialize dialog.\n"+str(e),"OpenERP Configuration", win32con.MB_ICONERROR)
win32ui.MessageBox("Fail to Initialize dialog.\n"+str(e),"OpenERP Configuration", win32con.MB_ICONERROR)
return cancel
#
class ViewPartners:
@ -89,6 +89,47 @@ class ViewPartners:
win32ui.MessageBox("Multiple selection not allowed. Please select only one mail at a time.","Open Contact",win32con.MB_ICONINFORMATION)
return cancel
#
class OpenPartner:
def OnClick(self, button, cancel):
import win32ui
from manager import ustr
mngr = manager.GetManager()
data=mngr.LoadConfig()
outlook = Dispatch("Outlook.Application")
ex = outlook.ActiveExplorer()
if ex:
is_login = str(data['login'])
if is_login == 'False':
win32ui.MessageBox("Please login to the database first", "OpenERP Connection", win32con.MB_ICONEXCLAMATION)
elif ex.Selection.Count == 1:
mngr = manager.GetManager()
mngr.ShowManager("IDD_OPEN_PARTNER_DIALOG")
elif ex.Selection.Count == 0:
win32ui.MessageBox("No mail selected to push to OpenERP","Push to OpenERP",win32con.MB_ICONINFORMATION)
elif ex.Selection.Count > 1:
win32ui.MessageBox("Multiple selection not allowed. Please select only one mail at a time.","Push to OpenERP",win32con.MB_ICONINFORMATION)
return cancel
#
class OpenDocument:
def OnClick(self, button, cancel):
from win32com.client import Dispatch
import win32con
import win32ui
mngr = manager.GetManager()
data=mngr.LoadConfig()
outlook = Dispatch("Outlook.Application")
ex = outlook.ActiveExplorer()
if ex:
is_login = str(data['login'])
if is_login == 'False':
win32ui.MessageBox("Please login to the database first", "OpenERP Connection", win32con.MB_ICONEXCLAMATION)
elif ex.Selection.Count == 1 or ex.Selection.Count == 0:
mngr = manager.GetManager()
mngr.ShowManager("IDD_OPEN_DOCUEMNT_DIALOG")
elif ex.Selection.Count > 1:
win32ui.MessageBox("Multiple selection not allowed. Please select only one mail at a time.","Open Document",win32con.MB_ICONINFORMATION)
return cancel
#
class ArchiveEvent:
def OnClick(self, button, cancel):
from win32com.client import Dispatch
@ -151,7 +192,22 @@ class OutlookAddin:
item.Enabled = True
# Adding Menu in Menu Bar to the Web Menu of the Outlook
toolbaradvance = bars.Item("Advanced")
toolbarweb = bars.Item("Web")
item = toolbarweb.Controls.Add(Type = constants.msoControlButton, Temporary = True)
item = self.toolbarButtonOpenPartner = DispatchWithEvents(item, OpenPartner)
item.Caption = "Open Partners"
item.TooltipText = "Click to Open OpenERP Partner Contact Information."
item.Enabled = True
item = toolbarweb.Controls.Add(Type = constants.msoControlButton, Temporary = True)
item = self.toolbarButtonOpenDocument = DispatchWithEvents(item, OpenDocument)
item.Caption = "Open Document"
item.TooltipText = "Click to Open Document that ha been pushed to server."
item.Enabled = True
# Hook events for the item
item = toolbarweb.Controls.Add(Type = constants.msoControlButton, Temporary = True)
item = self.toolbarButtonPartner = DispatchWithEvents(item, ViewPartners)
@ -159,6 +215,7 @@ class OutlookAddin:
item.TooltipText = "Click to Open OpenERP Partner Contact Information."
item.Enabled = True
item = tools_menu.Controls.Add(Type=constants.msoControlButton, Temporary=True)
# Hook events for the item
item = self.menu_bar_viewpartner_Button = DispatchWithEvents(item, ViewPartners)
@ -166,6 +223,14 @@ class OutlookAddin:
item.TooltipText = "Click to Open Partner detail"
item.Enabled = True
item = tools_menu.Controls.Add(Type=constants.msoControlButton, Temporary=True)
# Hook events for the item
item = self.menu_bar_openpartner_Button = DispatchWithEvents(item, OpenPartner)
item.Caption = "Open Partner"
item.TooltipText = "Click to Open Partner detail"
item.Enabled = True
def OnDisconnection(self, mode, custom):
mngr = manager.GetManager()
mngr.config['login'] = False

View File

@ -635,6 +635,8 @@ class CkSocket(_object):
def GetSslAcceptableClientCaDn(self, *args): return _chilkat.CkSocket_GetSslAcceptableClientCaDn(self, *args)
def getSslAcceptableClientCaDn(self, *args): return _chilkat.CkSocket_getSslAcceptableClientCaDn(self, *args)
def AddSslAcceptableClientCaDn(self, *args): return _chilkat.CkSocket_AddSslAcceptableClientCaDn(self, *args)
def get_ReceivedCount(self): return _chilkat.CkSocket_get_ReceivedCount(self)
def put_ReceivedCount(self, *args): return _chilkat.CkSocket_put_ReceivedCount(self, *args)
def UnlockComponent(self, *args): return _chilkat.CkSocket_UnlockComponent(self, *args)
def IsUnlocked(self): return _chilkat.CkSocket_IsUnlocked(self)
def AsyncSendBytes(self, *args): return _chilkat.CkSocket_AsyncSendBytes(self, *args)
@ -2173,6 +2175,11 @@ class CkMailMan(_object):
def put_Pop3Stls(self, *args): return _chilkat.CkMailMan_put_Pop3Stls(self, *args)
def AddPfxSourceData(self, *args): return _chilkat.CkMailMan_AddPfxSourceData(self, *args)
def AddPfxSourceFile(self, *args): return _chilkat.CkMailMan_AddPfxSourceFile(self, *args)
def SmtpSendRawCommand(self, *args): return _chilkat.CkMailMan_SmtpSendRawCommand(self, *args)
def smtpSendRawCommand(self, *args): return _chilkat.CkMailMan_smtpSendRawCommand(self, *args)
def Pop3SendRawCommand(self, *args): return _chilkat.CkMailMan_Pop3SendRawCommand(self, *args)
def pop3SendRawCommand(self, *args): return _chilkat.CkMailMan_pop3SendRawCommand(self, *args)
def Pop3EndSessionNoQuit(self): return _chilkat.CkMailMan_Pop3EndSessionNoQuit(self)
def lastErrorText(self): return _chilkat.CkMailMan_lastErrorText(self)
def lastErrorXml(self): return _chilkat.CkMailMan_lastErrorXml(self)
def lastErrorHtml(self): return _chilkat.CkMailMan_lastErrorHtml(self)
@ -3155,7 +3162,7 @@ class CkHttp(_object):
def put_UseBgThread(self, *args): return _chilkat.CkHttp_put_UseBgThread(self, *args)
def BgResponseObject(self): return _chilkat.CkHttp_BgResponseObject(self)
def BgTaskAbort(self): return _chilkat.CkHttp_BgTaskAbort(self)
def ClearEventLog(self): return _chilkat.CkHttp_ClearEventLog(self)
def ClearBgEventLog(self): return _chilkat.CkHttp_ClearBgEventLog(self)
def EventLogName(self, *args): return _chilkat.CkHttp_EventLogName(self, *args)
def eventLogName(self, *args): return _chilkat.CkHttp_eventLogName(self, *args)
def EventLogValue(self, *args): return _chilkat.CkHttp_EventLogValue(self, *args)
@ -3759,6 +3766,8 @@ class CkSpider(_object):
def put_ProxyPassword(self, *args): return _chilkat.CkSpider_put_ProxyPassword(self, *args)
def get_ProxyPort(self): return _chilkat.CkSpider_get_ProxyPort(self)
def put_ProxyPort(self, *args): return _chilkat.CkSpider_put_ProxyPort(self, *args)
def get_VerboseLogging(self): return _chilkat.CkSpider_get_VerboseLogging(self)
def put_VerboseLogging(self, *args): return _chilkat.CkSpider_put_VerboseLogging(self, *args)
def put_UserAgent(self, *args): return _chilkat.CkSpider_put_UserAgent(self, *args)
def userAgent(self): return _chilkat.CkSpider_userAgent(self)
def get_UserAgent(self, *args): return _chilkat.CkSpider_get_UserAgent(self, *args)
@ -3781,6 +3790,7 @@ class CkSpider(_object):
def CanonicalizeUrl(self, *args): return _chilkat.CkSpider_CanonicalizeUrl(self, *args)
def getDomain(self, *args): return _chilkat.CkSpider_getDomain(self, *args)
def getBaseDomain(self, *args): return _chilkat.CkSpider_getBaseDomain(self, *args)
def canonicalizeUrl(self, *args): return _chilkat.CkSpider_canonicalizeUrl(self, *args)
def lastErrorText(self): return _chilkat.CkSpider_lastErrorText(self)
def lastErrorXml(self): return _chilkat.CkSpider_lastErrorXml(self)

View File

@ -31,7 +31,7 @@ import addin
from dialogs import ShowDialog, MakePropertyPage
import win32ui
import webbrowser
import commctrl
import win32con
import win32gui
@ -168,6 +168,20 @@ global name
name=''
global email
email=''
global web_server
web_server = 'localhost'
global web_server_port
web_server_port = '8080'
global country_ref
country_ref = ""
global state_ref
state_ref = ""
global new_con_country
new_con_country= ""
global new_con_state
new_con_state= ""
global search_country
search_country = None
def check():
server = NewConn.getitem('_server')
@ -251,7 +265,6 @@ class OKButtonProcessor(ButtonProcessor):
try:
port = int(win32gui.GetDlgItemText(self.window.hwnd, self.other_ids[1]))
except ValueError, e:
print "Exception : %s"%str(e)
win32ui.MessageBox("Port should be an integer", "OpenERP Connection", flag_excl)
return
except Exception,e:
@ -277,6 +290,27 @@ class DoneButtonProcessor(ButtonProcessor):
self.window.manager.SaveConfig()
win32gui.EndDialog(self.window.hwnd, id)
class WEBOKButtonProcessor(ButtonProcessor):
def __init__(self, window, control_ids):
self.mngr = window.manager
ControlProcessor.__init__(self, window, control_ids)
def OnClicked(self, id):
global web_server
global web_server_port
server = win32gui.GetDlgItemText(self.window.hwnd, self.other_ids[0])
try:
port = int(win32gui.GetDlgItemText(self.window.hwnd, self.other_ids[1]))
except ValueError, e:
win32ui.MessageBox("Port should be an integer", "OpenERP Connection", flag_excl)
return
if server.strip() == "" or server.strip() == "http:\\\\":
win32ui.MessageBox("Invalid web Server address.", "OpenERP Connection", flag_excl)
return
web_server = server
web_server_port = port
win32gui.EndDialog(self.window.hwnd, id)
class MessageProcessor(ControlProcessor):
def Init(self):
text = " This Outlook Plugin for OpenERP has been developed by OpenERP s.a.\n\n \
@ -404,6 +438,8 @@ def TestConnection(btnProcessor,*args):
win32ui.MessageBox("No database found on host "+ server+" at port "+str(port), "OpenERP Connection", flag_excl)
return
uname = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[1])
pwd = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[2])
@ -596,6 +632,8 @@ def GetSelectedItems(hwndList):
def MakeAttachment(btnProcessor,*args):
#Check if server running or user logged in
from win32com.client import Dispatch
import win32com
b = check()
if not b:
return
@ -603,7 +641,6 @@ def MakeAttachment(btnProcessor,*args):
assert ex.Selection.Count == 1
mail = ex.Selection.Item(1)
mail = GetMail(btnProcessor)
#get selected records
hwndList = win32gui.GetDlgItem(btnProcessor.window.hwnd, btnProcessor.other_ids[0])
r = GetSelectedItems(hwndList)
@ -646,17 +683,21 @@ def CreateCase(btnProcessor,*args):
for rec in r:
if rec[0] == 'res.partner':
partner_ids.append(rec[1])
f = False
#Create new case
try:
NewConn.CreateCase(str(section), mail, partner_ids)
f = NewConn.CreateCase(str(section), mail, partner_ids)
msg="New Document created."
flag=flag_info
except Exception,e:
msg="New Document not created \n\n"+str(e)
flag=flag_error
win32ui.MessageBox(msg, "Create Document", flag)
return
if f:
win32ui.MessageBox(msg, "Create Document", flag)
return
else:
win32ui.MessageBox("Error While creating document.\n Document can not be created.", "Create Document", flag_error)
return
else:
win32ui.MessageBox("Document can not be created. CRM not installed", "Create Object", flag_info)
except Exception, e:
@ -784,6 +825,8 @@ def CreateContact(btnProcessor,*args):
street2 = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[6])
city = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[7])
zip = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[8])
state = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[10])
country = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[11])
if not name:
win32ui.MessageBox("Please enter name.", "Create Contact", flag_stop)
return
@ -798,9 +841,10 @@ def CreateContact(btnProcessor,*args):
'street':ustr(street),
'street2':ustr(street2),
'city':ustr(city),
'zip':ustr(zip)
'zip':ustr(zip),
'state_id':ustr(state),
'country_id':ustr(country)
}
try:
id = NewConn.CreateContact(str(res))
if not partner:
@ -818,6 +862,10 @@ def CreateContact(btnProcessor,*args):
def SetAllText(txtProcessor,*args):
# Set values for url, uname, pwd from config file
global web_server
global web_server_port
serverBox = txtProcessor.GetControl(txtProcessor.other_ids[2])
win32gui.SendMessage(serverBox, win32con.WM_SETTEXT, 0, "http:\\\\"+str(web_server)+":"+str(web_server_port))
url = NewConn.getitem('_uri')
tbox = txtProcessor.GetControl()
win32gui.SendMessage(tbox, win32con.WM_SETTEXT, 0, str(url))
@ -893,10 +941,26 @@ def SetDefaultContact(txtProcessor,*args):
global name
global email
global partner_ref
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[1],partner_ref)
global new_con_country
global new_con_state
global state_ref
global country_ref
state = win32gui.GetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[2])
country = win32gui.GetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[3])
if txtProcessor.init_done:
if new_con_country == "":
new_con_country = country
if new_con_state == "":
new_con_state = state
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[1],partner_ref)
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.control_id,name)
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[0],email)
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[2],new_con_state)
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[3],new_con_country)
new_con_country = ""
new_con_state = ""
state_ref = ""
country_ref =""
return
#
try:
@ -978,7 +1042,7 @@ def CreatePartner(btnProcessor,*args):
b = check()
if not b:
return
global partner_ref
partner_name = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[0])
if not partner_name:
win32ui.MessageBox("Please enter Partner name.", "Create Partner", flag_excl)
@ -992,6 +1056,7 @@ def CreatePartner(btnProcessor,*args):
return
if id:
win32ui.MessageBox("New Partner '%s' created."%partner_name, "Create Partner", flag_info)
partner_ref = str(partner_name)
win32gui.EndDialog(btnProcessor.window.hwnd, btnProcessor.id)
else:
win32ui.MessageBox("Partner '%s' already Exists."%partner_name, "Create Partner", flag_info)
@ -1010,13 +1075,37 @@ def set_name_email(dialogProcessor,*args):
name = win32gui.GetDlgItemText(dialogProcessor.window.hwnd, dialogProcessor.other_ids[0])
email = win32gui.GetDlgItemText(dialogProcessor.window.hwnd, dialogProcessor.other_ids[1])
#Function for Getting default mail when dialog is loaded and finding contact related to this
#setting values to the appropriate text areas
def GetDefaultEmail(txtProcessor,*args):
from win32com.client import Dispatch
import win32con
b = check()
global partner_ref
global country_ref
global state_ref
global new_con_country
global new_con_state
partner_n = win32gui.GetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[0])
state_n = win32gui.GetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[10])
country_n = win32gui.GetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[11])
if partner_ref == "":
partner_ref = partner_n
if country_ref == "":
country_ref = country_n
if state_ref == "":
state_ref = state_n
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[0], ustr(partner_ref))
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[10], ustr(state_ref))
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[11], ustr(country_ref))
partner_ref = ""
country_ref = ""
state_ref = ""
new_con_country = ""
new_con_state = ""
if country_ref == None:
country_ref = ""
if not b:
return
#Acquiring control of the text box
@ -1077,6 +1166,8 @@ def GetDefaultEmail(txtProcessor,*args):
if val[0] == 'country_id' and val[1] != False :
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[11], ustr(val[1][1]))
global search_country
search_country = ustr(val[1][1])
if val[0] == 'phone' and val[1] != False :
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[5], ustr(val[1]))
@ -1140,6 +1231,8 @@ def SearchPartner(btnProcessor,*args):
if val[0] == 'country_id' and val[1] != False :
win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[12], ustr(val[1][1]))
global search_country
search_country = ustr(val[1][1])
if val[0] == 'phone' and val[1] != False :
win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[6], ustr(val[1]))
@ -1167,6 +1260,8 @@ def WritePartner(btnProcessor,*args):
street = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[2])
street2 = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[3])
city = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[4])
state = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[5])
country = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[6])
phone = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[7])
mobile = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[8])
fax = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[9])
@ -1185,6 +1280,9 @@ def WritePartner(btnProcessor,*args):
new_vals.append(['email',email])
new_vals.append(['fax',fax])
new_vals.append(['zip',zip])
new_vals.append(['state',state])
new_vals.append(['country',country])
new_vals.append(['state',state])
flag = 0
try:
#writing the updated values to the Server.
@ -1198,7 +1296,7 @@ def WritePartner(btnProcessor,*args):
elif flag == 0:
win32ui.MessageBox("Error in Updating the Changes.\n Please check the Database Connection.", "Open Contact", flag_error)
elif flag == -1:
win32ui.MessageBox("Contact can not be Save.\nFirst select contact using Search.","Open Contact", flag_info)
win32ui.MessageBox("Contact can not be Save.\nFirst select partner using Search.","Open Contact", flag_info)
def SetPartnerNameColumn(listProcessor,*args):
hwndList = listProcessor.GetControl()
@ -1235,7 +1333,7 @@ def SelectPartnerFromList(btnProcessor,*args):
sel_text = nombre[0:size]
global partner_ref
if str(sel_text).strip() == "":
win32ui.MessageBox("Invalid Partner Selected.","Search Partner")
win32ui.MessageBox("Invalid partner selected.","Search Partner")
return
try:
partner_ref = str(sel_text)
@ -1244,10 +1342,10 @@ def SelectPartnerFromList(btnProcessor,*args):
win32gui.EndDialog(btnProcessor.window.hwnd, btnProcessor.other_ids[1])
return
elif sel_count < 1:
win32ui.MessageBox("You should Select atleast one partner.","Search Partner")
win32ui.MessageBox("You should select one partner.","Search Partner")
return
else:
win32ui.MessageBox("Multiple Selection is not allowded.","Search Partner")
win32ui.MessageBox("Multiple Selection is not allowed.","Search Partner")
return
def SearchPartnerList(btnProcessor,*args):
@ -1275,82 +1373,375 @@ def SearchPartnerList(btnProcessor,*args):
win32ui.MessageBox(msg, "Search Partner", flag_error)
pass
def ConnectWebServer(btnProcessor, *args):
b = check()
if not b:
return
server = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[0])
webbrowser.open_new(str(server)+"\\openerp\\")
def OpenPartnerForm(txtProcessor,*args):
from win32com.client import Dispatch
import win32con
b = check()
if not b:
return
#Acquiring control of the text box
partner_link = txtProcessor.GetControl()
#Reading Current Selected Email.
ex = txtProcessor.window.manager.outlook.ActiveExplorer()
assert ex.Selection.Count == 1
mail = ex.Selection.Item(1)
partner_text = ""
try:
partner_text = ustr(mail.SenderName).encode('iso-8859-1')
except Exception,e:
win32gui.SendMessage(partner_link, win32con.WM_SETTEXT, 0, "< Error in reading email.>")
pass
vals = NewConn.SearchPartner(partner_text)
if vals == None:
win32gui.SendMessage(partner_link, win32con.WM_SETTEXT, 0, "< No Partner with named "+str(partner_text)+" found.>")
txtProcessor.init_done=True
return
global web_server
global web_server_port
if web_server.strip() == "" or web_server.strip() == "http:\\\\":
win32gui.SendMessage(partner_link, win32con.WM_SETTEXT, 0, " <Invalid Server Address>")
txtProcessor.init_done=True
return
try:
linktopartner = "http:\\\\"+web_server+":"+str(web_server_port)+"\\openerp\\form\\view?model=res.partner&id="+str(vals)
win32gui.SendMessage(partner_link, win32con.WM_SETTEXT, 0, linktopartner)
except Exception,e:
win32ui.MessageBox("Error While Opening Partner.\n"+str(e),"Open Partner", flag_error)
webbrowser.open_new(linktopartner)
txtProcessor.init_done=True
def SerachOpenDocuemnt(txtProcessor,*args):
from win32com.client import Dispatch
import win32con
import win32ui
import win32com
from win32com.mapi import mapi, mapiutil, mapitags
import pythoncom
b = check()
if not b:
return
global web_server
global web_server_port
#Reading Current Selected Email.
ex = txtProcessor.window.manager.outlook.ActiveExplorer()
assert ex.Selection.Count == 1
mail = ex.Selection.Item(1)
#Acquiring control of the text box
link_box = txtProcessor.GetControl()
#Checking for the web server Parameters
if web_server.strip() == "" or web_server.strip() == "http:\\\\":
win32gui.SendMessage(link_box, win32con.WM_SETTEXT, 0, " <Invalid Server Address>")
txtProcessor.init_done=True
return
linktodoc = ""
message_id = None
try:
outlook = win32com.client.Dispatch("Outlook.Application")
session = win32com.client.Dispatch("MAPI.session")
session.Logon('Outlook')
objMessage = session.GetMessage(mail.EntryID, mail.Parent.StoreID)
objFields = objMessage.Fields
strheader = objFields.Item(mapitags.PR_TRANSPORT_MESSAGE_HEADERS)
strheader = ustr(strheader).encode('iso-8859-1')
headers = {}
strheader = strheader.replace("\n ", " ").splitlines()
for line in strheader:
split_here = line.find(":")
headers[line[:split_here]] = line[split_here:]
temp1 = headers.get('Message-ID')
temp2 = headers.get('Message-Id')
if temp1 == None: message_id = temp2
if temp2 == None: message_id = temp1
startCut = message_id.find("<")
endCut = message_id.find(">")
message_id = message_id[startCut:endCut+1]
except Exception,e:
win32ui.MessageBox(str(e),"Open Document")
vals = NewConn.SearchEmailResources(message_id)
if vals == None:
win32gui.SendMessage(link_box, win32con.WM_SETTEXT, 0, "< Mail is still not archived.>")
txtProcessor.init_done=True
return
try:
linktodoc = "http:\\\\" +web_server+ ":"+str(web_server_port)+"\\openerp\\form\\view?model="+vals[0][1]+"&id="+str(vals[1][1])
win32gui.SendMessage(link_box, win32con.WM_SETTEXT, 0, str(linktodoc))
except Exception,e:
win32ui.MessageBox("Error While Opening Document.\n"+str(e),"Open Document", flag_error)
webbrowser.open_new(linktodoc)
txtProcessor.init_done=True
def SearchCountry(btnProcessor, *args):
b = check()
if not b:
return
try :
search_country = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[0])
if not search_country:
win32ui.MessageBox("Please enter country name to search for.", "Search Country", flag_excl)
return
#Searching the contact.
hwndList = win32gui.GetDlgItem(btnProcessor.window.hwnd, btnProcessor.other_ids[1])
countries = list(NewConn.GetCountry(search_country))
win32gui.SendMessage(hwndList, commctrl.LVM_DELETEALLITEMS)
if not countries:
win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[0],"<enter text to search>")
win32ui.MessageBox("No country found with name {0}.".format(search_country),"Search Country",flag_error)
for country in countries:
num_items = win32gui.SendMessage(hwndList, commctrl.LVM_GETITEMCOUNT)
item = LVITEM(text=country[1],iItem = num_items)
win32gui.SendMessage(hwndList, commctrl.LVM_INSERTITEM, 0, item.toparam())
except Exception,e:
msg = getMessage(e)
win32ui.MessageBox(msg, "Search Country", flag_error)
pass
def SetCountryList(listProcessor,*args):
hwndList = listProcessor.GetControl()
child_ex_style = win32gui.SendMessage(hwndList, commctrl.LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0)
child_ex_style |= commctrl.LVS_EX_FULLROWSELECT
win32gui.SendMessage(hwndList, commctrl.LVM_SETEXTENDEDLISTVIEWSTYLE, 0, child_ex_style)
# set header row
lvc = LVCOLUMN(
mask = commctrl.LVCF_FMT | commctrl.LVCF_WIDTH | \
commctrl.LVCF_TEXT | commctrl.LVCF_SUBITEM
)
lvc.fmt = commctrl.LVCFMT_LEFT
lvc.iSubItem = 1
lvc.text = "Country Name"
lvc.cx = 275
win32gui.SendMessage(hwndList, commctrl.LVM_INSERTCOLUMN, 0, lvc.toparam())
listProcessor.init_done = True
def SelectCountryFromList(btnProcessor,*args):
hwndList = win32gui.GetDlgItem(btnProcessor.window.hwnd, btnProcessor.other_ids[0])
sel_count = win32gui.SendMessage(hwndList, commctrl.LVM_GETSELECTEDCOUNT)
sel_text = ''
if sel_count == 1:
sel=-1
for i in range(0,sel_count):
sel = win32gui.SendMessage(hwndList, commctrl.LVM_GETNEXTITEM, sel, commctrl.LVNI_SELECTED)
buf,extra = win32gui_struct.EmptyLVITEM(1, 0)
size = win32gui.SendMessage(hwndList, commctrl.LVM_GETITEMTEXT, sel, buf)
sel_text = ''
for n in extra:
nombre = n.tostring()
sel_text = nombre[0:size]
global country_ref
global new_con_country
global search_country
if str(sel_text).strip() == "":
win32ui.MessageBox("Invalid country selected.","Search Country")
return
try:
country_ref = str(sel_text)
new_con_country = str(sel_text)
search_country = str(sel_text)
except Exception,e:
pass
win32gui.EndDialog(btnProcessor.window.hwnd, btnProcessor.other_ids[1])
return
elif sel_count < 1:
win32ui.MessageBox("You must one country.","Search Country")
return
else:
win32ui.MessageBox("Multiple selection is not allowed.","Search Country")
return
def SearchState(btnProcessor, *args):
b = check()
if not b:
return
try :
global new_con_country
global search_country
search_state = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[0])
if not search_state:
win32ui.MessageBox("Please enter state name to search for.", "Search Fed.State", flag_excl)
return
#Searching the contact.
hwndList = win32gui.GetDlgItem(btnProcessor.window.hwnd, btnProcessor.other_ids[1])
states = list(NewConn.GetStates(search_state, search_country))
win32gui.SendMessage(hwndList, commctrl.LVM_DELETEALLITEMS)
if not states:
win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[0],"<enter text to search>")
win32ui.MessageBox("No state found with name {0}.".format(search_state),"Search Fed.State",flag_error)
for state in states:
num_items = win32gui.SendMessage(hwndList, commctrl.LVM_GETITEMCOUNT)
item = LVITEM(text=state[1],iItem = num_items)
win32gui.SendMessage(hwndList, commctrl.LVM_INSERTITEM, 0, item.toparam())
except Exception,e:
msg = getMessage(e)
win32ui.MessageBox(msg, "Search Fed.State", flag_error)
pass
def SetStateList(listProcessor,*args):
hwndList = listProcessor.GetControl()
child_ex_style = win32gui.SendMessage(hwndList, commctrl.LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0)
child_ex_style |= commctrl.LVS_EX_FULLROWSELECT
win32gui.SendMessage(hwndList, commctrl.LVM_SETEXTENDEDLISTVIEWSTYLE, 0, child_ex_style)
# set header row
lvc = LVCOLUMN(
mask = commctrl.LVCF_FMT | commctrl.LVCF_WIDTH | \
commctrl.LVCF_TEXT | commctrl.LVCF_SUBITEM
)
lvc.fmt = commctrl.LVCFMT_LEFT
lvc.iSubItem = 1
lvc.text = "Fed.State Name"
lvc.cx = 275
win32gui.SendMessage(hwndList, commctrl.LVM_INSERTCOLUMN, 0, lvc.toparam())
listProcessor.init_done = True
def SelectStateFromList(btnProcessor,*args):
hwndList = win32gui.GetDlgItem(btnProcessor.window.hwnd, btnProcessor.other_ids[0])
sel_count = win32gui.SendMessage(hwndList, commctrl.LVM_GETSELECTEDCOUNT)
sel_text = ''
if sel_count == 1:
sel=-1
for i in range(0,sel_count):
sel = win32gui.SendMessage(hwndList, commctrl.LVM_GETNEXTITEM, sel, commctrl.LVNI_SELECTED)
buf,extra = win32gui_struct.EmptyLVITEM(1, 0)
size = win32gui.SendMessage(hwndList, commctrl.LVM_GETITEMTEXT, sel, buf)
sel_text = ''
for n in extra:
nombre = n.tostring()
sel_text = nombre[0:size]
global state_ref
global new_con_state
if str(sel_text).strip() == "":
win32ui.MessageBox("Invalid fed. state selected.","Search Fed.State")
return
try:
state_ref = str(sel_text)
new_con_state = str(sel_text)
win32gui.EndDialog(btnProcessor.window.hwnd, btnProcessor.other_ids[1])
except Exception,e:
pass
return
elif sel_count < 1:
win32ui.MessageBox("You must select state.","Search Fed.State")
return
else:
win32ui.MessageBox("Multiple selection is not allowed.","Search Fed.State")
return
dialog_map = {
"IDD_MANAGER" : (
(CancelButtonProcessor, "IDCANCEL", resetConnAttribs, ()),
(TabProcessor, "IDC_TAB IDC_LIST",
"""IDD_GENERAL IDD_OBJECT_SETTINGS IDD_ABOUT"""),
(DoneButtonProcessor, "ID_DONE"),
),
"IDD_MANAGER" : (
(CancelButtonProcessor, "IDCANCEL", resetConnAttribs, ()),
(TabProcessor, "IDC_TAB IDC_LIST",
"""IDD_GENERAL IDD_OBJECT_SETTINGS IDD_ABOUT"""),
(DoneButtonProcessor, "ID_DONE"),
),
"IDD_GENERAL": (
(DBComboProcessor, "ID_DB_DROPDOWNLIST", GetConn, ()),
(TextProcessor, "ID_SERVER_PORT ID_USERNAME ID_PASSWORD", SetAllText, ()),
(CommandButtonProcessor, "ID_BUT_TESTCONNECTION ID_DB_DROPDOWNLIST ID_USERNAME \
ID_PASSWORD", TestConnection, ()),
(CommandButtonProcessor, "IDC_RELOAD", ReloadAllControls, ()),
(DialogCommand, "IDC_BUT_SET_SERVER_PORT", "IDD_SERVER_PORT_DIALOG"),
),
"IDD_GENERAL": (
(DBComboProcessor, "ID_DB_DROPDOWNLIST", GetConn, ()),
(TextProcessor, "ID_SERVER_PORT ID_USERNAME ID_PASSWORD IDET_WED_SERVER", SetAllText, ()),
(CommandButtonProcessor, "ID_BUT_TESTCONNECTION ID_DB_DROPDOWNLIST ID_USERNAME \
ID_PASSWORD", TestConnection, ()),
(CommandButtonProcessor, "IDC_RELOAD", ReloadAllControls, ()),
(DialogCommand, "IDC_BUT_SET_SERVER_PORT", "IDD_SERVER_PORT_DIALOG"),
(DialogCommand, "ID_SET_WEB_CONNECTION", "IDD_WEB_SERVER_PORT_DIALOG" ),
(CommandButtonProcessor, "IDPB_WEB_CONNECTION IDET_WED_SERVER", ConnectWebServer, ()),
),
"IDD_OBJECT_SETTINGS" : (
(CommandButtonProcessor, "IDC_BUT_LOAD_IMAGE IDC_IMAGE_PATH", GetImagePath, ()),
(CommandButtonProcessor, "IDC_BUT_SAVE_OBJECT IDC_OBJECT_TITLE IDC_OBJECT_NAME \
IDC_IMAGE_PATH IDC_LIST", AddNewObject, ()),
(CommandButtonProcessor, "IDC_BUT_DEL_OBJECT IDC_LIST", DeleteSelectedObjects, ()),
(ListBoxProcessor, "IDC_LIST", SetDefaultList, ())
),
"IDD_OBJECT_SETTINGS" : (
(CommandButtonProcessor, "IDC_BUT_LOAD_IMAGE IDC_IMAGE_PATH", GetImagePath, ()),
(CommandButtonProcessor, "IDC_BUT_SAVE_OBJECT IDC_OBJECT_TITLE IDC_OBJECT_NAME \
IDC_IMAGE_PATH IDC_LIST", AddNewObject, ()),
(CommandButtonProcessor, "IDC_BUT_DEL_OBJECT IDC_LIST", DeleteSelectedObjects, ()),
(ListBoxProcessor, "IDC_LIST", SetDefaultList, ())
),
"IDD_ABOUT" : (
(ImageProcessor, "IDB_OPENERPLOGO"),
(MessageProcessor, "IDC_ABOUT"),
),
"IDD_ABOUT" : (
(ImageProcessor, "IDB_OPENERPLOGO"),
(MessageProcessor, "IDC_ABOUT"),
),
"IDD_SERVER_PORT_DIALOG" : (
(CloseButtonProcessor, "IDCANCEL"),
(OKButtonProcessor, "IDOK ID_SERVER ID_PORT IDR_XML_PROTOCOL"),
(RadioButtonProcessor, "IDR_XML_PROTOCOL", GetConn, ()),
(RadioButtonProcessor, "IDR_XMLS_PROTOCOL", GetConn, ()),
(RadioButtonProcessor, "IDR_NETRPC_PROTOCOL", GetConn, ()),
),
"IDD_SERVER_PORT_DIALOG" : (
(CloseButtonProcessor, "IDCANCEL"),
(OKButtonProcessor, "IDOK ID_SERVER ID_PORT IDR_XML_PROTOCOL"),
),
"IDD_SYNC" : (
(CommandButtonProcessor, "ID_SEARCH ID_SEARCH_TEXT IDC_NAME_LIST", SearchObjectsForText,()),
(GroupProcessor, "IDC_STATIC_GROUP", setCheckList, ()),
(CSComboProcessor, "ID_ATT_METHOD_DROPDOWNLIST", GetConn,()),
(TextProcessor, "ID_SEARCH_TEXT", GetSearchText, ()),
(DialogCommand, "ID_CREATE_CONTACT ID_SEARCH_TEXT", "IDD_NEW_CONTACT_DIALOG", set_search_text, ()),
(CloseButtonProcessor, "IDCANCEL"),
(CommandButtonProcessor, "ID_MAKE_ATTACHMENT IDC_NAME_LIST IDD_SYNC", MakeAttachment, ()),
(CommandButtonProcessor, "ID_CREATE_CASE ID_ATT_METHOD_DROPDOWNLIST IDC_NAME_LIST", CreateCase, ()),
(ListBoxProcessor, "IDC_NAME_LIST", SetNameColumn, ())
),
"IDD_SYNC" : (
(CommandButtonProcessor, "ID_SEARCH ID_SEARCH_TEXT IDC_NAME_LIST", SearchObjectsForText,()),
(GroupProcessor, "IDC_STATIC_GROUP", setCheckList, ()),
(CSComboProcessor, "ID_ATT_METHOD_DROPDOWNLIST", GetConn,()),
(TextProcessor, "ID_SEARCH_TEXT", GetSearchText, ()),
(DialogCommand, "ID_CREATE_CONTACT ID_SEARCH_TEXT", "IDD_NEW_CONTACT_DIALOG", set_search_text, ()),
(CloseButtonProcessor, "IDCANCEL"),
(CommandButtonProcessor, "ID_MAKE_ATTACHMENT IDC_NAME_LIST IDD_SYNC", MakeAttachment, ()),
(CommandButtonProcessor, "ID_CREATE_CASE ID_ATT_METHOD_DROPDOWNLIST IDC_NAME_LIST", CreateCase, ()),
(ListBoxProcessor, "IDC_NAME_LIST", SetNameColumn, ())
),
"IDD_NEW_CONTACT_DIALOG" : (
(CloseButtonProcessor, "IDCANCEL"),
(CommandButtonProcessor, "ID_CONTACT_SAVE_BUTTON ID_CONTACT_NAME_TEXT ID_CONTACT_EMAIL_TEXT ID_CONTACT_OFFICE_TEXT ID_CONTACT_MOBILE_TEXT ID_FAX_TEXT ID_STREET_TEXT ID_STREET2_TEXT ID_PARTNER_CITY_TEXT ID_ZIP_TEXT ID_PARTNER_TEXT", CreateContact, ()),
(TextProcessor, "ID_CONTACT_NAME_TEXT ID_CONTACT_EMAIL_TEXT ID_PARTNER_TEXT" , SetDefaultContact, ()),
(DialogCommand, "ID_NEW_PARTNER_BUTTON", "IDD_SELECT_PARTNER"),
),
"IDD_NEW_CONTACT_DIALOG" : (
(CloseButtonProcessor, "IDCANCEL"),
(CommandButtonProcessor, "ID_CONTACT_SAVE_BUTTON ID_CONTACT_NAME_TEXT ID_CONTACT_EMAIL_TEXT ID_CONTACT_OFFICE_TEXT ID_CONTACT_MOBILE_TEXT ID_FAX_TEXT ID_STREET_TEXT ID_STREET2_TEXT ID_PARTNER_CITY_TEXT ID_ZIP_TEXT ID_PARTNER_TEXT IDET_NC_PARTNER_STATE IDET_NC_PARTNER_COUNTRY", CreateContact, ()),
(TextProcessor, "ID_CONTACT_NAME_TEXT ID_CONTACT_EMAIL_TEXT ID_PARTNER_TEXT IDET_NC_PARTNER_STATE IDET_NC_PARTNER_COUNTRY" , SetDefaultContact, ()),
(DialogCommand, "ID_NEW_PARTNER_BUTTON", "IDD_SELECT_PARTNER"),
(DialogCommand, "IDPB_NEW_PARTNER_BUTTON", "IDD_NEW_PARTNER_DIALOG"),
(DialogCommand, "IDPB_NC_SEARCH_STATE1", "IDD_SELECT_STATE"),
(DialogCommand, "IDPB_NC_SEARCH_COUNTRY1", "IDD_SELECT_COUNTRY"),
),
"IDD_NEW_PARTNER_DIALOG" : (
(CloseButtonProcessor, "IDCANCEL"),
(CommandButtonProcessor, "ID_SAVE_PARTNER_BUTTON ID_PARTNER_NAME_TEXT", CreatePartner, ()),
),
"IDD_NEW_PARTNER_DIALOG" : (
(CloseButtonProcessor, "IDCANCEL"),
(CommandButtonProcessor, "ID_SAVE_PARTNER_BUTTON ID_PARTNER_NAME_TEXT", CreatePartner, ()),
),
"IDD_VIEW_PARTNER_DIALOG" : (
(TextProcessor, "IDET_SEARCH_PARTNER IDET_PARTNER IDET_PARTNER_CONTACT_NAME IDET_PARTNER_STREET IDET_PARTNER_STREET2 IDET_PARTNER_CITY IDET_PARTNER_OFFICENO IDET_PARTNER_MOBILENO IDET_PARTNER_EMAIL IDET_PARTNER_FAX IDET_ZIP IDET_PARTNER_STATE IDET_PARTNER_COUNTRY", GetDefaultEmail, ()),
(CommandButtonProcessor, "IDPB_SEARCH_PARTNER IDET_SEARCH_PARTNER IDET_PARTNER IDET_PARTNER_CONTACT_NAME IDET_PARTNER_STREET IDET_PARTNER_STREET2 IDET_PARTNER_CITY IDET_PARTNER_OFFICENO IDET_PARTNER_MOBILENO IDET_PARTNER_EMAIL IDET_PARTNER_FAX IDET_ZIP IDET_PARTNER_STATE IDET_PARTNER_COUNTRY", SearchPartner, ()),
(CommandButtonProcessor, "IDPB_WRITE_CHANGES IDET_PARTNER IDET_PARTNER_CONTACT_NAME IDET_PARTNER_STREET IDET_PARTNER_STREET2 IDET_PARTNER_CITY IDET_PARTNER_STATE IDET_PARTNER_COUNTRY IDET_PARTNER_OFFICENO IDET_PARTNER_MOBILENO IDET_PARTNER_EMAIL IDET_PARTNER_FAX IDET_ZIP", WritePartner, ()),
(CloseButtonProcessor, "IDCANCEL"),
(DialogCommand, "ID_NEW_PART_BUTTON", "IDD_SELECT_PARTNER" ),
(DialogCommand, "IDPB_NEWPARTNER_BUTTON" , "IDD_NEW_CONTACT_DIALOG")
),
"IDD_SELECT_PARTNER" : (
(CloseButtonProcessor, "IDCANCEL"),
(ListBoxProcessor, "IDC_LIST_PARTNER" ,SetPartnerNameColumn, ()),
(CommandButtonProcessor, "IDPB_PARTNER_SEARCH IDET_PARTNER_SEARCH_NAME IDC_LIST_PARTNER", SearchPartnerList,()),
(CommandButtonProcessor, "IDPB_SELECT_PARTNER IDC_LIST_PARTNER IDD_SELECT_PARTNER" , SelectPartnerFromList,()),
(DialogCommand, "IDPB_CREATE_NEW_PARTNER" , "IDD_NEW_PARTNER_DIALOG")
),
"IDD_VIEW_PARTNER_DIALOG" : (
(TextProcessor, "IDET_SEARCH_PARTNER IDET_PARTNER IDET_PARTNER_CONTACT_NAME IDET_PARTNER_STREET IDET_PARTNER_STREET2 IDET_PARTNER_CITY IDET_PARTNER_OFFICENO IDET_PARTNER_MOBILENO IDET_PARTNER_EMAIL IDET_PARTNER_FAX IDET_ZIP IDET_PARTNER_STATE IDET_PARTNER_COUNTRY", GetDefaultEmail, ()),
(CommandButtonProcessor, "IDPB_SEARCH_PARTNER IDET_SEARCH_PARTNER IDET_PARTNER IDET_PARTNER_CONTACT_NAME IDET_PARTNER_STREET IDET_PARTNER_STREET2 IDET_PARTNER_CITY IDET_PARTNER_OFFICENO IDET_PARTNER_MOBILENO IDET_PARTNER_EMAIL IDET_PARTNER_FAX IDET_ZIP IDET_PARTNER_STATE IDET_PARTNER_COUNTRY", SearchPartner, ()),
(CommandButtonProcessor, "IDPB_WRITE_CHANGES IDET_PARTNER IDET_PARTNER_CONTACT_NAME IDET_PARTNER_STREET IDET_PARTNER_STREET2 IDET_PARTNER_CITY IDET_PARTNER_STATE IDET_PARTNER_COUNTRY IDET_PARTNER_OFFICENO IDET_PARTNER_MOBILENO IDET_PARTNER_EMAIL IDET_PARTNER_FAX IDET_ZIP", WritePartner, ()),
(CloseButtonProcessor, "IDCANCEL"),
(DialogCommand, "ID_NEW_PART_BUTTON", "IDD_SELECT_PARTNER" ),
(DialogCommand, "IDPB_NEWPARTNER_BUTTON" , "IDD_NEW_CONTACT_DIALOG"),
(DialogCommand, "IDPB_NEW_PART_BUTTON", "IDD_NEW_PARTNER_DIALOG"),
(DialogCommand, "IDPB_SEARCH_COUNTRY1", "IDD_SELECT_COUNTRY"),
(DialogCommand, "IDPB_SEARCH_STATE1", "IDD_SELECT_STATE"),
),
"IDD_SELECT_PARTNER" : (
(ListBoxProcessor, "IDC_LIST_PARTNER" ,SetPartnerNameColumn, ()),
(CommandButtonProcessor, "IDPB_PARTNER_SEARCH IDET_PARTNER_SEARCH_NAME IDC_LIST_PARTNER", SearchPartnerList,()),
(CommandButtonProcessor, "IDPB_SELECT_PARTNER IDC_LIST_PARTNER IDD_SELECT_PARTNER" , SelectPartnerFromList,()),
(DialogCommand, "IDPB_CREATE_NEW_PARTNER" , "IDD_NEW_PARTNER_DIALOG")
),
"IDD_OPEN_PARTNER_DIALOG" : (
(CloseButtonProcessor, "IDCANCEL"),
(TextProcessor, "IDET_PARTNER_LINK_TEXT", OpenPartnerForm, ()),
),
"IDD_OPEN_DOCUEMNT_DIALOG" : (
(CloseButtonProcessor, "IDCANCEL"),
(TextProcessor, "IDEB_OPENDOC_LINK_TEXT", SerachOpenDocuemnt,()),
),
"IDD_WEB_SERVER_PORT_DIALOG" :(
(CloseButtonProcessor, "IDCANCEL"),
(WEBOKButtonProcessor, "ID_WEB_OK IDET_WEB_SERVER IDET_WEB_PORT")
),
"IDD_SELECT_COUNTRY" : (
(CommandButtonProcessor, "IDPB_SEARCH_COUNTRY IDET_COUNTRY_SEARCH_NAME IDC_LIST_COUNTRY" , SearchCountry, ()),
(ListBoxProcessor, "IDC_LIST_COUNTRY" ,SetCountryList, ()),
(CommandButtonProcessor, "IDPB_SELECT_COUNTRY IDC_LIST_COUNTRY IDD_SELECT_COUNTRY" , SelectCountryFromList,()),
),
"IDD_SELECT_STATE" : (
(CommandButtonProcessor, "IDPB_STATE_SEARCH IDET_STATE_SEARCH_NAME IDC_LIST_STATE" , SearchState, ()),
(ListBoxProcessor, "IDC_LIST_STATE" ,SetStateList, ()),
(CommandButtonProcessor, "IDPB_SELECT_STATE IDC_LIST_STATE IDD_SELECT_STATE" , SelectStateFromList,()),
),
}

View File

@ -177,6 +177,37 @@
#define IDPB_PARTNER_SEARCH 2077
#define IDPB_CREATE_NEW_PARTNER 2078
#define ID_PARTNER_TEXT 2079
#define IDET_WED_SERVER 2080
#define IDET_WEB_PORT 2081
#define ID_SET_WEB_CONNECTION 2082
#define IDPB_WEB_CONNECTION 2083
#define IDD_OPEN_PARTNER_DIALOG 2084
#define IDET_PARTNER_LINK_TEXT 2085
#define IDEB_OPENDOC_LINK_TEXT 2086
#define IDD_OPEN_DOCUEMNT_DIALOG 2087
#define IDD_WEB_SERVER_PORT_DIALOG 2088
#define IDET_WEB_SERVER 2089
#define IDET_WEB_PORT 2090
#define ID_WEB_OK 2091
#define IDPB_NEW_PARTNER_BUTTON 2092
#define IDPB_NEW_PART_BUTTON 2093
#define IDD_SELECT_COUNTRY 2094
#define IDET_COUNTRY_SEARCH_NAME 2095
#define IDC_LIST_COUNTRY 2096
#define IDPB_SELECT_COUNTRY 2097
#define IDPB_SEARCH_COUNTRY 2098
#define IDD_SELECT_STATE 2099
#define IDET_STATE_SEARCH_NAME 2100
#define IDC_LIST_STATE 2101
#define IDPB_SELECT_STATE 2102
#define IDPB_SEARCH_STATE 2103
#define IDPB_SEARCH_STATE1 2104
#define IDPB_SEARCH_COUNTRY1 2105
#define IDET_NC_PARTNER_STATE 2106
#define IDPB_NC_SEARCH_STATE1 2107
#define IDET_NC_PARTNER_COUNTRY 2108
#define IDPB_NC_SEARCH_COUNTRY1 2109
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED

File diff suppressed because one or more lines are too long

View File

@ -30,7 +30,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
IDD_MANAGER DIALOGEX 0, 0, 460, 260
STYLE DS_SETFONT | WS_POPUP | WS_CAPTION | WS_SYSMENU | DS_MODALFRAME
CAPTION "OpenERP Configuarion"
CAPTION "OpenERP Configuration"
FONT 8, "Tahoma", 1000, 0, 0x0
BEGIN
DEFPUSHBUTTON "Close",ID_DONE,400,239,50,14//,WS_VISIBLE //| WS_TABSTOP
@ -57,6 +57,12 @@ BEGIN
LTEXT "Password : ",IDC_STATIC,30,90,100,17
EDITTEXT ID_PASSWORD,85,90,154,12,ES_AUTOHSCROLL | WS_VISIBLE | WS_TABSTOP | ES_PASSWORD
PUSHBUTTON "Connect",ID_BUT_TESTCONNECTION,179,110,60,13, WS_VISIBLE | WS_TABSTOP
GROUPBOX "WebServer Parameters",IDC_STATIC_GROUP, 270, 10,150,130
LTEXT "Server : ",IDC_STATIC, 280, 30, 50, 15
EDITTEXT IDET_WED_SERVER,310, 29, 90, 12,ES_AUTOHSCROLL | ES_READONLY
PUSHBUTTON "Change",ID_SET_WEB_CONNECTION, 295, 50, 50, 12 , WS_VISIBLE | WS_TABSTOP
PUSHBUTTON "Connect",IDPB_WEB_CONNECTION, 350, 50, 50, 12 , WS_VISIBLE | WS_TABSTOP
END
IDD_OBJECT_SETTINGS DIALOGEX 0, 0, 430, 210
@ -131,7 +137,7 @@ BEGIN
PUSHBUTTON "Close",IDCANCEL,385,300,60,14,WS_TABSTOP
END
IDD_NEW_CONTACT_DIALOG DIALOGEX 0, 0, 350, 150
IDD_NEW_CONTACT_DIALOG DIALOGEX 0, 0, 350, 180
STYLE DS_SETFONT | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_CONTEXTHELP
CAPTION "Create a New Contact"
@ -139,10 +145,11 @@ FONT 8, "Tahoma", 1000, 0, 0x0
BEGIN
LTEXT "Select Partner : ",IDC_STATIC,13,20,50,17
EDITTEXT ID_PARTNER_TEXT, 70, 18, 200, 12 , ES_AUTOHSCROLL |ES_READONLY
PUSHBUTTON "Search Partner",ID_NEW_PARTNER_BUTTON,280,17,60,14, WS_TABSTOP
EDITTEXT ID_PARTNER_TEXT, 70, 18, 150, 12 , ES_AUTOHSCROLL |ES_READONLY
PUSHBUTTON "Search Partner",ID_NEW_PARTNER_BUTTON,225,17,60,14, WS_TABSTOP
PUSHBUTTON "New Partner",IDPB_NEW_PARTNER_BUTTON,290, 17, 50, 14, WS_TABSTOP
GROUPBOX "Postal Address ", IDC_STATIC_GROUP,10,35,175,90
GROUPBOX "Postal Address ", IDC_STATIC_GROUP,10,35,175,123
LTEXT "Contact Name : ",IDC_STATIC, 18, 53, 100, 17
EDITTEXT ID_CONTACT_NAME_TEXT, 76, 52, 100, 12, ES_AUTOHSCROLL | WS_TABSTOP
LTEXT "Street : ",IDC_STATIC, 18, 67, 40, 17
@ -153,9 +160,15 @@ BEGIN
EDITTEXT ID_ZIP_TEXT,76, 93, 100, 12,ES_AUTOHSCROLL | WS_TABSTOP
LTEXT "City : ",IDC_STATIC, 18,106, 50, 17
EDITTEXT ID_PARTNER_CITY_TEXT,76,107,100,12,ES_AUTOHSCROLL | WS_TABSTOP
LTEXT "Fed. State : ",IDC_STATIC,18,121,50,17
EDITTEXT IDET_NC_PARTNER_STATE, 76, 122, 54, 12,ES_AUTOHSCROLL |ES_READONLY
PUSHBUTTON "Search", IDPB_NC_SEARCH_STATE1 ,135, 121, 40, 12, WS_TABSTOP
LTEXT "Country :",IDC_STATIC, 18, 134, 35, 17
EDITTEXT IDET_NC_PARTNER_COUNTRY, 76, 135, 54, 12,ES_AUTOHSCROLL |ES_READONLY
PUSHBUTTON "Search", IDPB_NC_SEARCH_COUNTRY1, 135, 136, 40, 12, WS_TABSTOP
GROUPBOX "Communication ", IDC_STATIC_GROUP, 188, 35, 150, 90
GROUPBOX "Communication ", IDC_STATIC_GROUP, 188, 35, 150, 123
LTEXT "Office : ",IDC_STATIC,194, 53, 30, 17
EDITTEXT ID_CONTACT_OFFICE_TEXT, 224, 52, 100, 12,ES_AUTOHSCROLL | WS_TABSTOP
LTEXT "Mobile : ",IDC_STATIC,194, 67, 30, 17
@ -165,8 +178,8 @@ BEGIN
LTEXT "Email : ",IDC_STATIC, 194, 95, 30, 17
EDITTEXT ID_CONTACT_EMAIL_TEXT, 224, 94, 100, 12,ES_AUTOHSCROLL | WS_TABSTOP
PUSHBUTTON "Cancel",IDCANCEL,290,130,45,14, WS_TABSTOP
PUSHBUTTON "Save",ID_CONTACT_SAVE_BUTTON,240,130,45,14, WS_TABSTOP
PUSHBUTTON "Cancel",IDCANCEL,290,162,45,13, WS_TABSTOP
PUSHBUTTON "Save",ID_CONTACT_SAVE_BUTTON,240,162,45,13, WS_TABSTOP
END
IDD_NEW_PARTNER_DIALOG DIALOGEX 0, 0, 140,40
@ -192,8 +205,9 @@ BEGIN
PUSHBUTTON "Search Contact ",IDPB_SEARCH_PARTNER,280,15,60,14,WS_TABSTOP
LTEXT "Partner Name : ",IDC_STATIC,13,42,50,17
EDITTEXT IDET_PARTNER,70, 42, 200, 12,ES_AUTOHSCROLL |ES_READONLY
PUSHBUTTON "Search Partner",ID_NEW_PART_BUTTON,280,41,60,14, WS_TABSTOP
EDITTEXT IDET_PARTNER,70, 42, 150, 12,ES_AUTOHSCROLL |ES_READONLY
PUSHBUTTON "Search Partner",ID_NEW_PART_BUTTON,225,41,60,14, WS_TABSTOP
PUSHBUTTON "New Partner",IDPB_NEW_PART_BUTTON,290,41,50,14, WS_TABSTOP
GROUPBOX "Postal Address ", IDC_STATIC_GROUP,10,65,175,125
LTEXT "Contact Name : ",IDC_STATIC,18,83,50,17
@ -206,10 +220,14 @@ BEGIN
EDITTEXT IDET_ZIP, 76, 125, 100, 12 , ES_AUTOHSCROLL | WS_TABSTOP
LTEXT "City : ",IDC_STATIC,18,140,50,17
EDITTEXT IDET_PARTNER_CITY,76,139,100,12,ES_AUTOHSCROLL | WS_TABSTOP
LTEXT "Fed. State : ",IDC_STATIC,18,154,50,17
EDITTEXT IDET_PARTNER_STATE, 76, 153, 100, 12,ES_AUTOHSCROLL |ES_READONLY
EDITTEXT IDET_PARTNER_STATE, 76, 153, 54, 12,ES_AUTOHSCROLL |ES_READONLY
PUSHBUTTON "Search", IDPB_SEARCH_STATE1 ,135, 153, 40, 12, WS_TABSTOP
LTEXT "Country :",IDC_STATIC, 18, 169, 35, 17
EDITTEXT IDET_PARTNER_COUNTRY, 76, 168, 100, 12,ES_AUTOHSCROLL |ES_READONLY
EDITTEXT IDET_PARTNER_COUNTRY, 76, 168, 54, 12,ES_AUTOHSCROLL |ES_READONLY
PUSHBUTTON "Search", IDPB_SEARCH_COUNTRY1, 135, 168, 40, 12, WS_TABSTOP
GROUPBOX "Communication ", IDC_STATIC_GROUP, 188, 65, 152, 125
LTEXT "Phone : ",IDC_STATIC, 194, 83, 30, 17
@ -240,7 +258,75 @@ BEGIN
CONTROL "List1",IDC_LIST_PARTNER,"SysListView32",WS_CHILD | WS_VISIBLE | WS_BORDER | WS_HSCROLL | WS_VSCROLL |
LVS_SHOWSELALWAYS | LVS_EX_GRIDLINES | LVS_REPORT | LVS_EX_FULLROWSELECT, 8,40,200,185
PUSHBUTTON "Create New Partner", IDPB_CREATE_NEW_PARTNER, 10, 230, 100, 14, WS_TABSTOP
PUSHBUTTON "Select", IDPB_SELECT_PARTNER, 130, 230, 40, 14, WS_TABSTOP
PUSHBUTTON "Cancel", IDCANCEL, 175, 230, 40, 14, WS_TABSTOP
PUSHBUTTON "Select", IDPB_SELECT_PARTNER, 170, 230, 40, 14, WS_TABSTOP
END
IDD_OPEN_PARTNER_DIALOG DIALOGEX 0, 0, 200,65
STYLE DS_SETFONT | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_CONTEXTHELP
CAPTION "Open Partner"
FONT 8, "Tahoma", 400, 0, 0x0
BEGIN
LTEXT "Link to Partner : (If this link does not opens directly in web browser then copy an the link and paste in web browser.) ",IDC_STATIC,5,3,190,25
EDITTEXT IDET_PARTNER_LINK_TEXT,5,31,190,12,ES_AUTOHSCROLL | WS_TABSTOP
PUSHBUTTON "Ok",IDCANCEL,150,45,45,13,WS_TABSTOP
END
IDD_OPEN_DOCUEMNT_DIALOG DIALOGEX 0, 0, 200,65
STYLE DS_SETFONT | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_CONTEXTHELP
CAPTION "Open Document"
FONT 8, "Tahoma", 400, 0, 0x0
BEGIN
LTEXT "Link to Document : (If this link does not opens directly in web browser then copy an the link and paste in web browser.) ",IDC_STATIC,5,3,190,25
EDITTEXT IDEB_OPENDOC_LINK_TEXT,5,31,190,12,ES_AUTOHSCROLL | WS_TABSTOP
PUSHBUTTON "Ok",IDCANCEL,150,45,45,14,WS_TABSTOP
END
IDD_WEB_SERVER_PORT_DIALOG DIALOGEX 0, 0, 160, 55
STYLE DS_SETFONT | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_CONTEXTHELP
CAPTION "OpenERP Connection"
FONT 8, "Tahoma", 400, 0, 0x0
BEGIN
LTEXT "Server : ",IDC_STATIC,5,3,150,17
EDITTEXT IDET_WEB_SERVER,40,3,100,12,ES_AUTOHSCROLL | WS_TABSTOP
LTEXT "Port : ",IDC_STATIC,5,18,100,17
EDITTEXT IDET_WEB_PORT,40,18,100,12,ES_AUTOHSCROLL | WS_TABSTOP
PUSHBUTTON "Close",IDCANCEL,110,35,45,14,WS_TABSTOP
DEFPUSHBUTTON "OK",ID_WEB_OK,60,35,45,14,WS_TABSTOP
END
IDD_SELECT_COUNTRY DIALOGEX 0, 0, 220, 250
STYLE DS_SETFONT | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_CONTEXTHELP
CAPTION "Search Country"
FONT 8, "Tahoma", 400, 0, 0x0
BEGIN
LTEXT "Enter Name : ",IDC_STATIC,8,12,80,17
EDITTEXT IDET_COUNTRY_SEARCH_NAME, 55, 10, 100, 12, ES_AUTOHSCROLL | WS_TABSTOP
PUSHBUTTON "Search", IDPB_SEARCH_COUNTRY, 160, 10, 50, 14, WS_TABSTOP
CONTROL "List1",IDC_LIST_COUNTRY,"SysListView32",WS_CHILD | WS_VISIBLE | WS_BORDER | WS_HSCROLL | WS_VSCROLL |
LVS_SHOWSELALWAYS | LVS_EX_GRIDLINES | LVS_REPORT | LVS_EX_FULLROWSELECT, 8,40,200,185
PUSHBUTTON "Select", IDPB_SELECT_COUNTRY, 170, 230, 40, 14, WS_TABSTOP
END
IDD_SELECT_STATE DIALOGEX 0, 0, 220, 250
STYLE DS_SETFONT | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_CONTEXTHELP
CAPTION "Search Fed. State"
FONT 8, "Tahoma", 400, 0, 0x0
BEGIN
LTEXT "Enter Name : ",IDC_STATIC,8,12,80,17
EDITTEXT IDET_STATE_SEARCH_NAME, 55, 10, 100, 12, ES_AUTOHSCROLL | WS_TABSTOP
PUSHBUTTON "Search", IDPB_STATE_SEARCH, 160, 10, 50, 14, WS_TABSTOP
CONTROL "List1",IDC_LIST_STATE,"SysListView32",WS_CHILD | WS_VISIBLE | WS_BORDER | WS_HSCROLL | WS_VSCROLL |
LVS_SHOWSELALWAYS | LVS_EX_GRIDLINES | LVS_REPORT | LVS_EX_FULLROWSELECT, 8,40,200,185
PUSHBUTTON "Select", IDPB_SELECT_STATE, 170, 230, 40, 14, WS_TABSTOP
END

View File

@ -26,7 +26,8 @@ import chilkat
import os
from manager import ustr
import win32ui
email = chilkat.CkEmail()
import email
cemail = chilkat.CkEmail()
dt = chilkat.SYSTEMTIME()
def generateEML(mail):
sub = (mail.Subject).replace(' ','')
@ -36,20 +37,21 @@ def generateEML(mail):
sender_name = mail.SenderEmailAddress
attachments=mail.Attachments
email = chilkat.CkEmail()
email.put_Subject (ustr(sub).encode('iso-8859-1'))
email.put_Body (ustr(body).encode('utf-8'))
email.put_FromAddress (ustr(sender_email).encode('iso-8859-1'))
email.put_From (ustr(sender_email).encode('iso-8859-1'))
cemail = chilkat.CkEmail()
cemail.put_Subject (ustr(sub).encode('iso-8859-1'))
cemail.put_Body (ustr(body).encode('utf-8'))
cemail.put_FromAddress (ustr(sender_email).encode('iso-8859-1'))
cemail.put_From (ustr(sender_email).encode('iso-8859-1'))
for i in xrange(1, recipients.Count+1):
name = ustr(recipients.Item(i).Name).encode('iso-8859-1')
address = ustr(recipients.Item(i).Address).encode('iso-8859-1')
email.AddTo(name,address)
cemail.AddTo(name,address)
eml_name= ustr(sub).encode('iso-8859-1')+'-'+str(mail.EntryID)[-9:]
ls = ['*', '/', '\\', '<', '>', ':', '?', '"', '|', '\t', '\n']
mails_folder_path = os.path.abspath(os.path.dirname(__file__)+"\\dialogs\\resources\\mails\\")
#mails_folder_path = os.path.abspath("%temp%\\dialogs\\resources\\mails\\")
mails_folder_path = os.path.abspath("C:\\printing")
attachments_folder_path = mails_folder_path + "\\attachments\\"
if not os.path.exists(attachments_folder_path):
os.makedirs(attachments_folder_path)
@ -70,7 +72,7 @@ def generateEML(mail):
os.remove(att_file)
f1 = att_file
attachments[i].SaveAsFile(att_file)
contentType = email.addFileAttachment(att_file)
contentType = cemail.addFileAttachment(att_file)
if (contentType == None ):
print mail.lastErrorText()
sys.exit()
@ -85,9 +87,11 @@ def generateEML(mail):
f = eml_name.split('-')
eml_name = f[0][0:l] + '.' + f[-1]
eml_path = ustr(os.path.join(mails_folder_path,eml_name+".eml")).encode('iso-8859-1')
success = email.SaveEml(eml_path)
success = cemail.SaveEml(eml_path)
fp = open(eml_path, 'rb')
new_mail = email.message_from_file(fp)
fp.close()
if (success == False):
print email.lastErrorText()
print cemail.lastErrorText()
sys.exit()
return eml_path
return new_mail

View File

@ -27,7 +27,9 @@ import pythoncom
import time
from manager import ustr
import email
from win32com.mapi import mapi, mapiutil, mapitags
import pythoncom
import win32com
waittime = 10
wait_count = 0
wait_limit = 12
@ -58,7 +60,8 @@ class XMLRpcConn(object):
_public_methods_ = ['GetDBList', 'login', 'GetAllObjects', 'GetObjList', 'InsertObj', 'DeleteObject', 'GetCSList', \
'ArchiveToOpenERP', 'IsCRMInstalled', 'GetPartners', 'GetObjectItems', \
'CreateCase', 'MakeAttachment', 'CreateContact', 'CreatePartner', 'getitem', 'setitem', \
'SearchPartnerDetail', 'WritePartnerValues', 'GetAllState', 'GetAllCountry' ]
'SearchPartnerDetail', 'WritePartnerValues', 'GetAllState', 'GetAllCountry', 'SearchPartner', 'SearchEmailResources', \
'GetCountry', 'GetStates', 'FindCountryForState']
_reg_clsctx_ = pythoncom.CLSCTX_INPROC_SERVER
_reg_clsid_ = "{C6399AFD-763A-400F-8191-7F9D0503CAE2}"
_reg_progid_ = "Python.OpenERP.XMLRpcConn"
@ -135,24 +138,42 @@ class XMLRpcConn(object):
import win32ui, win32con
conn = xmlrpclib.ServerProxy(self._uri + '/xmlrpc/object')
import eml
flag = False
new_msg = files = ext_msg =""
eml_path=eml.generateEML(mail)
att_name = ustr(eml_path.split('\\')[-1])
flag=False
attachments=mail.Attachments
message_id = referances = None
try:
fp = open(eml_path, 'rb')
msg =fp.read()
fp.close()
new_mail = email.message_from_string(str(msg))
outlook = win32com.client.Dispatch("Outlook.Application")
session = win32com.client.Dispatch("MAPI.session")
session.Logon('Outlook')
objMessage = session.GetMessage(mail.EntryID, mail.Parent.StoreID)
objFields = objMessage.Fields
strheader = objFields.Item(mapitags.PR_TRANSPORT_MESSAGE_HEADERS)
strheader = ustr(strheader).encode('iso-8859-1')
headers = {}
strheader = strheader.replace("\n ", " ").splitlines()
for line in strheader:
split_here = line.find(":")
headers[line[:split_here]] = line[split_here:]
temp1 = headers.get('Message-ID')
temp2 = headers.get('Message-Id')
referances = headers.get('References')
if temp1 == None: message_id = temp2
if temp2 == None: message_id = temp1
startCut = message_id.find("<")
endCut = message_id.find(">")
message_id = message_id[startCut:endCut+1]
if not referances == None:
startCut = referances.find("<")
endCut = referances.find(">")
referances = referances[startCut:endCut+1]
except Exception,e:
win32ui.MessageBox(str(e),"Reading Error Mail")
win32ui.MessageBox(str(e),"Archive To OpenERP")
return
new_mail=eml.generateEML(mail)
attachments=mail.Attachments
for rec in recs: #[('res.partner', 3, 'Agrolait')]
model = rec[0]
res_id = rec[1]
#Check if mailgate installed
object_id = execute ( conn,'execute',self._dbname,int(self._uid),self._pwd,'ir.model','search',[('model','=','mailgate.message')])
if not object_id:
@ -164,13 +185,12 @@ class XMLRpcConn(object):
#Reading the Object ir.model Name
ext_ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'mailgate.message','search',[('message_id','=',mail.EntryID),('model','=',model),('res_id','=',res_id)])
ext_ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'mailgate.message','search',[('message_id','=',message_id),('model','=',model),('res_id','=',res_id)])
if ext_ids:
name = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,model,'read',res_id,['name'])['name']
ext_msg += """This mail is already archived to {1} '{2}'.
""".format(object_name,name)
ext_msg += """This mail is already archived to {0} '{1}'.\n""".format(object_name,name)
flag = True
continue
msg = {
'subject':mail.Subject,
'date':str(mail.ReceivedTime),
@ -178,22 +198,20 @@ class XMLRpcConn(object):
'cc':mail.CC,
'from':mail.SenderEmailAddress,
'to':mail.To,
'message-id':str(new_mail.get('Message-Id')),
'references':str(new_mail.get('References')),
'message-id':message_id,
'references':ustr(referances),
}
result = {}
if attachments:
result = self.MakeAttachment([rec], mail)
attachment_ids = result.get(model, {}).get(res_id, [])
ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'email.server.tools','history',model, res_id, msg, attachment_ids)
new_msg += """- {0} : {1}\n""".format(object_name,str(rec[2]))
flag = True
if flag:
t = ext_msg
t += """Mail archived Successfully with attachments.\n"""+new_msg
t = """Mail archived Successfully with attachments.\n"""+ext_msg
t += "\n"+new_msg
win32ui.MessageBox(t,"Archived to OpenERP",win32con.MB_ICONINFORMATION)
return flag
@ -250,27 +268,50 @@ class XMLRpcConn(object):
return res
def CreateCase(self, section, mail, partner_ids, with_attachments=True):
res={}
import win32ui
import eml
section=str(section)
partner_ids=eval(str(partner_ids))
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
flag = False
id = -1
try:
eml_path=eml.generateEML(mail)
fp = open(eml_path, 'rb')
msg =fp.read()
fp.close()
new_mail = email.message_from_string(str(msg))
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
email=eml.generateEML(mail)
message_id = referances = None
outlook = win32com.client.Dispatch("Outlook.Application")
session = win32com.client.Dispatch("MAPI.session")
session.Logon('Outlook')
objMessage = session.GetMessage(mail.EntryID, mail.Parent.StoreID)
objFields = objMessage.Fields
strheader = objFields.Item(mapitags.PR_TRANSPORT_MESSAGE_HEADERS)
strheader = ustr(strheader).encode('iso-8859-1')
headers = {}
strheader = strheader.replace("\n ", " ").splitlines()
for line in strheader:
split_here = line.find(":")
headers[line[:split_here]] = line[split_here:]
temp1 = headers.get('Message-ID')
temp2 = headers.get('Message-Id')
if temp1 == None: message_id = temp2
if temp2 == None: message_id = temp1
startCut = message_id.find("<")
endCut = message_id.find(">")
message_id = message_id[startCut:endCut+1]
email.replace_header('Message-Id',message_id)
id = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'email.server.tools','process_email',section, str(email))
if id > 0:
flag = True
return flag
else:
flag = False
return flag
except Exception,e:
win32ui.MessageBox(str(e),"Mail Reading Error")
execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'email.server.tools','process_email',section, str(new_mail))
win32ui.MessageBox("Create Case\n"+str(e),"Mail Reading Error")
return flag
def MakeAttachment(self, recs, mail):
attachments = mail.Attachments
result = {}
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
att_folder_path = os.path.abspath(os.path.dirname(__file__)+"\\dialogs\\resources\\mails\\attachments\\")
att_folder_path = os.path.abspath(os.path.dirname("%temp%\\"))
if not os.path.exists(att_folder_path):
os.makedirs(att_folder_path)
for rec in recs: #[('res.partner', 3, 'Agrolait')]
@ -303,12 +344,19 @@ class XMLRpcConn(object):
return result
def CreateContact(self, res=None):
import win32ui
res=eval(str(res))
partner = res['partner_id']
state = res['state_id']
country = res['country_id']
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
partner_id = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.partner', 'search', [('name','=',ustr(partner))])
res.update({'partner_id' : partner_id[0]})
if not state == "":
country_id = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.country', 'search', [('name','=',ustr(country))])
res.update({'country_id' : country_id[0]})
if not country == "":
state_id = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.country.state', 'search', [('name','=',ustr(state))])
res.update({'state_id' : state_id[0]})
id = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.partner.address','create',res)
return id
@ -340,10 +388,14 @@ class XMLRpcConn(object):
new_dict = dict(new_vals)
email=new_dict['email']
partner = new_dict['partner']
country_val = new_dict['country']
state_val = new_dict['state']
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
partner_id = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.partner', 'search', [('name','=',ustr(partner))])
country_id = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.country', 'search', [('name','=',ustr(country_val))])
state_id = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.country.state', 'search', [('name','=',ustr(state_val))])
address_id = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.partner.address', 'search', [('email','=',ustr(email))])
if not address_id:
if not partner_id or not address_id or not country_id or not state_id:
return flag
address = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.partner.address','read',address_id[0],['id','partner_id','state_id','country_id'])
vals_res_address={
@ -356,6 +408,8 @@ class XMLRpcConn(object):
'mobile' : new_dict['mobile'],
'fax' : new_dict['fax'],
'zip' : new_dict['zip'],
'country_id' : country_id[0],
'state_id' : state_id[0]
}
temp = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.partner.address', 'write', address_id, vals_res_address)
if temp:
@ -385,3 +439,69 @@ class XMLRpcConn(object):
obj = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.country','read', [country_id], ['id','name'])[0]
country_list.append((obj['id'], ustr(obj['name'])))
return country_list
def SearchPartner(self, partner = ""):
import win32ui
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
partner_id = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.partner', 'search', [('name','=',ustr(partner))])
if not partner_id:
return None
return partner_id[0]
def SearchEmailResources(self, message_id):
import win32ui
import eml
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
sub = ""
res_vals = []
mail_id = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'mailgate.message', 'search', [('message_id','=',message_id)])
if not mail_id:
return None
address = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'mailgate.message','read',mail_id[0],['model','res_id'])
for key, vals in address.items():
res_vals.append([key,vals])
return res_vals
def GetCountry(self, country_search=''):
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
ids=[]
obj_list=[]
ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.country','search',[('name','ilike',ustr(country_search))])
if ids:
ids.sort()
for id in ids:
object = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.country','read',[id],['id','name'])[0]
obj_list.append((object['id'], ustr(object['name'])))
obj_list.sort(lambda x, y: cmp(x[1],y[1]))
return obj_list
def GetStates(self, state_search='', country=None):
import win32ui
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
ids = []
c_id = []
obj_list = []
if country == None:
ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.country.state','search',[('name','ilike',ustr(state_search))])
if not country == None:
c_id = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.country','search',[('name','=',ustr(country))])
ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.country.state','search',[('name','ilike',ustr(state_search)),('country_id','=',c_id[0])])
if ids:
ids.sort()
for id in ids:
object = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.country.state','read',[id],['id','name'])[0]
obj_list.append((object['id'], ustr(object['name'])))
obj_list.sort(lambda x, y: cmp(x[1],y[1]))
return obj_list
def FindCountryForState(self, state_search=''):
import win32ui
res_vals = []
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.country.state','search',[('name','=',ustr(state_search))])
if not ids:
return None
object = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.country.state','read',ids)[0]
country = object['country_id'][1]
return country

View File

@ -31,12 +31,12 @@
domain="[('year','=',time.strftime('%%Y'))]"
help="Cash Analysis created during this year"/>
<filter icon="terp-go-month" string="Month"
domain="[('month','=',time.strftime('%%m'))]"
domain="[('date','&lt;=',(datetime.date.today()+relativedelta(day=31)).strftime('%%Y-%%m-%%d')),('date','&gt;=',(datetime.date.today()-relativedelta(day=1)).strftime('%%Y-%%m-%%d'))]"
help="Cash Analysis created in current month"/>
<filter icon="terp-go-month"
string="Month -1"
separator="1"
domain="[('month','=',(datetime.date.today() - datetime.timedelta(365/12)).strftime('%%m'))]"
domain="[('date','&lt;=', (datetime.date.today() - relativedelta(day=31, months=1)).strftime('%%Y-%%m-%%d')),('date','&gt;=',(datetime.date.today() - relativedelta(day=1,months=1)).strftime('%%Y-%%m-%%d'))]"
help="Cash Analysis created in last month"/>
<separator orientation="vertical"/>
<filter icon="terp-go-today"

View File

@ -42,12 +42,12 @@
domain="[('year','=',time.strftime('%%Y'))]"
help="POS ordered created during current year"/>
<filter icon="terp-go-month" string="Month"
domain="[('month','=',time.strftime('%%m'))]"
domain="[('date','&lt;=',(datetime.date.today()+relativedelta(day=31)).strftime('%%Y-%%m-%%d')),('date','&gt;=',(datetime.date.today()-relativedelta(day=1)).strftime('%%Y-%%m-%%d'))]"
help="POS ordered created during current month"/>
<filter icon="terp-go-month"
string="Month -1"
separator="1"
domain="[('month','=',(datetime.date.today() - datetime.timedelta(365/12)).strftime('%%m'))]"
domain="[('date','&lt;=', (datetime.date.today() - relativedelta(day=31, months=1)).strftime('%%Y-%%m-%%d')),('date','&gt;=',(datetime.date.today() - relativedelta(day=1,months=1)).strftime('%%Y-%%m-%%d'))]"
help="POS ordered created last month"/>
<separator orientation="vertical"/>
<filter icon="terp-go-today"

View File

@ -129,7 +129,7 @@ class project(osv.osv):
state<>'cancelled'
GROUP BY
project_id''',(tuple(all_projects),))
progress = dict(map(lambda x: (x[0], (x[1], x[2], x[3])), cr.fetchall()))
progress = dict(map(lambda x: (x[0], (x[1] or 0.0, x[2] or 0.0, x[3] or 0.0)), cr.fetchall()))
user_uom, def_uom = self._get_user_and_default_uom_ids(cr, uid)
for project in self.browse(cr, uid, par_child_projects.keys(), context=context):
@ -145,12 +145,10 @@ class project(osv.osv):
s[0] = uom_obj._compute_qty(cr, uid, user_uom, s[0], def_uom)
s[1] = uom_obj._compute_qty(cr, uid, user_uom, s[1], def_uom)
s[2] = uom_obj._compute_qty(cr, uid, user_uom, s[2], def_uom)
if project.state == 'close':
progress_rate = 100.0
else:
progress_rate = s[1] and round(min(100.0 * s[2] / s[1], 99.99), 2)
res[project.id] = {
'planned_hours': s[0],
'effective_hours': s[2],
@ -159,6 +157,23 @@ class project(osv.osv):
}
return res
def _get_project_task(self, cr, uid, ids, context=None):
if context is None:
context = {}
result = {}
for task in self.pool.get('project.task').browse(cr, uid, ids, context=context):
if task.project_id: result[task.project_id.id] = True
return result.keys()
def _get_project_work(self, cr, uid, ids, context=None):
if context is None:
context = {}
result = {}
for work in self.pool.get('project.task.work').browse(cr, uid, ids, context=context):
if work.task_id and work.task_id.project_id: result[work.task_id.project_id.id] = True
return result.keys()
def unlink(self, cr, uid, ids, *args, **kwargs):
for proj in self.browse(cr, uid, ids):
if proj.tasks:
@ -174,10 +189,30 @@ class project(osv.osv):
'warn_manager': fields.boolean('Warn Manager', help="If you check this field, the project manager will receive a request each time a task is completed by his team.", states={'close':[('readonly',True)], 'cancelled':[('readonly',True)]}),
'members': fields.many2many('res.users', 'project_user_rel', 'project_id', 'uid', 'Project Members', help="Project's member. Not used in any computation, just for information purpose.", states={'close':[('readonly',True)], 'cancelled':[('readonly',True)]}),
'tasks': fields.one2many('project.task', 'project_id', "Project tasks"),
'planned_hours': fields.function(_progress_rate, multi="progress", method=True, string='Planned Time', help="Sum of planned hours of all tasks related to this project and its child projects.", store=True),
'effective_hours': fields.function(_progress_rate, multi="progress", method=True, string='Time Spent', help="Sum of spent hours of all tasks related to this project and its child projects.", store=True),
'total_hours': fields.function(_progress_rate, multi="progress", method=True, string='Total Time', help="Sum of total hours of all tasks related to this project and its child projects.", store=True),
'progress_rate': fields.function(_progress_rate, multi="progress", method=True, string='Progress', type='float', group_operator="avg", help="Percent of tasks closed according to the total of tasks todo.", store=True),
'planned_hours': fields.function(_progress_rate, multi="progress", method=True, string='Planned Time', help="Sum of planned hours of all tasks related to this project and its child projects.",
store = {
'project.project': (lambda self, cr, uid, ids, c={}: ids, ['tasks'], 10),
'project.task': (_get_project_task, ['planned_hours', 'effective_hours', 'remaining_hours', 'total_hours', 'progress', 'delay_hours'], 10),
'project.task.work': (_get_project_work, ['hours'], 10),
}),
'effective_hours': fields.function(_progress_rate, multi="progress", method=True, string='Time Spent', help="Sum of spent hours of all tasks related to this project and its child projects.",
store = {
'project.project': (lambda self, cr, uid, ids, c={}: ids, ['tasks'], 10),
'project.task': (_get_project_task, ['planned_hours', 'effective_hours', 'remaining_hours', 'total_hours', 'progress', 'delay_hours'], 10),
'project.task.work': (_get_project_work, ['hours'], 10),
}),
'total_hours': fields.function(_progress_rate, multi="progress", method=True, string='Total Time', help="Sum of total hours of all tasks related to this project and its child projects.",
store = {
'project.project': (lambda self, cr, uid, ids, c={}: ids, ['tasks'], 10),
'project.task': (_get_project_task, ['planned_hours', 'effective_hours', 'remaining_hours', 'total_hours', 'progress', 'delay_hours'], 10),
'project.task.work': (_get_project_work, ['hours'], 10),
}),
'progress_rate': fields.function(_progress_rate, multi="progress", method=True, string='Progress', type='float', group_operator="avg", help="Percent of tasks closed according to the total of tasks todo.",
store = {
'project.project': (lambda self, cr, uid, ids, c={}: ids, ['tasks'], 10),
'project.task': (_get_project_task, ['planned_hours', 'effective_hours', 'remaining_hours', 'total_hours', 'progress', 'delay_hours'], 10),
'project.task.work': (_get_project_work, ['hours'], 10),
}),
'warn_customer': fields.boolean('Warn Partner', help="If you check this, the user will have a popup when closing a task that propose a message to send by email to the customer.", states={'close':[('readonly',True)], 'cancelled':[('readonly',True)]}),
'warn_header': fields.text('Mail Header', help="Header added at the beginning of the email for the warning message sent to the customer when a task is closed.", states={'close':[('readonly',True)], 'cancelled':[('readonly',True)]}),
'warn_footer': fields.text('Mail Footer', help="Footer added at the beginning of the email for the warning message sent to the customer when a task is closed.", states={'close':[('readonly',True)], 'cancelled':[('readonly',True)]}),
@ -414,6 +449,14 @@ class task(osv.osv):
res[task.id] = False
return res
def _get_task(self, cr, uid, ids, context=None):
if context is None:
context = {}
result = {}
for work in self.pool.get('project.task.work').browse(cr, uid, ids, context=context):
if work.task_id: result[work.task_id.id] = True
return result.keys()
_columns = {
'active': fields.function(_is_template, method=True, store=True, string='Not a Template Task', type='boolean', help="This field is computed automatically and have the same behavior than the boolean 'active' field: if the task is linked to a template or unactivated project, it will be hidden unless specifically asked."),
'name': fields.char('Task Summary', size=128, required=True),
@ -433,12 +476,27 @@ class task(osv.osv):
'child_ids': fields.many2many('project.task', 'project_task_parent_rel', 'parent_id', 'task_id', 'Delegated Tasks'),
'notes': fields.text('Notes'),
'planned_hours': fields.float('Planned Hours', help='Estimated time to do the task, usually set by the project manager when the task is in draft state.'),
'effective_hours': fields.function(_hours_get, method=True, string='Hours Spent', multi='hours', store=True, help="Computed using the sum of the task work done."),
'effective_hours': fields.function(_hours_get, method=True, string='Hours Spent', multi='hours', help="Computed using the sum of the task work done.",
store = {
'project.task': (lambda self, cr, uid, ids, c={}: ids, ['work_ids'], 10),
'project.task.work': (_get_task, ['hours'], 10),
}),
'remaining_hours': fields.float('Remaining Hours', digits=(16,2), help="Total remaining time, can be re-estimated periodically by the assignee of the task."),
'total_hours': fields.function(_hours_get, method=True, string='Total Hours', multi='hours', store=True, help="Computed as: Time Spent + Remaining Time."),
'progress': fields.function(_hours_get, method=True, string='Progress (%)', multi='hours', group_operator="avg", store=True, help="Computed as: Time Spent / Total Time."),
'delay_hours': fields.function(_hours_get, method=True, string='Delay Hours', multi='hours', store=True, help="Computed as difference of the time estimated by the project manager and the real time to close the task."),
'total_hours': fields.function(_hours_get, method=True, string='Total Hours', multi='hours', help="Computed as: Time Spent + Remaining Time.",
store = {
'project.task': (lambda self, cr, uid, ids, c={}: ids, ['work_ids'], 10),
'project.task.work': (_get_task, ['hours'], 10),
}),
'progress': fields.function(_hours_get, method=True, string='Progress (%)', multi='hours', group_operator="avg", help="Computed as: Time Spent / Total Time.",
store = {
'project.task': (lambda self, cr, uid, ids, c={}: ids, ['work_ids'], 10),
'project.task.work': (_get_task, ['hours'], 10),
}),
'delay_hours': fields.function(_hours_get, method=True, string='Delay Hours', multi='hours', help="Computed as difference of the time estimated by the project manager and the real time to close the task.",
store = {
'project.task': (lambda self, cr, uid, ids, c={}: ids, ['work_ids'], 10),
'project.task.work': (_get_task, ['hours'], 10),
}),
'user_id': fields.many2one('res.users', 'Assigned to'),
'delegated_user_id': fields.related('child_ids', 'user_id', type='many2one', relation='res.users', string='Delegated To'),
'partner_id': fields.many2one('res.partner', 'Partner'),
@ -579,6 +637,7 @@ class task(osv.osv):
if context is None:
context = {}
request = self.pool.get('res.request')
for task in self.browse(cr, uid, ids, context=context):
project = task.project_id
if project and project.warn_manager and project.user_id.id and (project.user_id.id != uid):
@ -593,6 +652,7 @@ class task(osv.osv):
})
self.write(cr, uid, [task.id], {'state': 'open'})
return True
def do_cancel(self, cr, uid, ids, *args):

View File

@ -5,10 +5,10 @@
<menuitem
icon="terp-project" id="base.menu_main_pm"
name="Project" sequence="10"
groups="group_project_manager,group_project_user,base.group_system"/>
groups="group_project_manager,group_project_user,base.group_system,group_project_finance_user"/>
<menuitem id="menu_project_management" name="Project Management" parent="base.menu_main_pm" sequence="1"/>
<menuitem id="menu_definitions" name="Configuration" parent="base.menu_main_pm" sequence="60" groups="base.group_system"/>
<menuitem id="menu_project_management" name="Project" parent="base.menu_main_pm" sequence="1"/>
<menuitem id="menu_definitions" name="Configuration" parent="base.menu_main_pm" sequence="60" groups="base.group_system,group_project_finance_user"/>
<!-- Project -->
<record id="edit_project" model="ir.ui.view">
@ -114,7 +114,7 @@
<field name="name" string="Project Name"/>
<field name="user_id" string="Project Manager" default="1">
<filter domain="[('user_id','=',uid)]" help="Projects in which I am a manage" icon="terp-personal"/>
</field>
</field>
<field name="partner_id" string="Partner"/>
</group>
<newline />
@ -304,7 +304,7 @@
<field name="type">tree</field>
<field eval="2" name="priority"/>
<field name="arch" type="xml">
<tree colors="grey:state in ('cancelled','done');blue:remaining_hours&lt;0 and state in ('pending');red:date_deadline and (date_deadline&gt;current_date) and (state in ('draft','open'));black:state not in ('cancelled','done')" string="Tasks">
<tree colors="grey:state in ('cancelled','done');blue:remaining_hours&lt;0 and state in ('pending');red:date_deadline and (date_deadline&lt;current_date) and (state in ('draft','open'))" string="Tasks">
<field name="sequence" invisible="not context.get('seq_visible', False)"/>
<field name="name"/>
<field name="project_id" icon="gtk-indent" domain="['|',('user_id','=',uid),('members','=',uid)]" invisible="context.get('user_invisible', False)"/>
@ -328,7 +328,7 @@
<button name="do_cancel" states="draft,open,pending" string="Cancel" type="object" icon="gtk-cancel" help="For cancelling the task"/>
<button name="do_open" states="pending,draft,done,cancel" string="Start Task" type="object" icon="gtk-execute" help="For changing to open state" invisible="context.get('set_visible',False)"/>
<button groups="base.group_extended" name="%(action_project_task_delegate)d" states="pending,open,draft" string="Delegate" type="action" icon="gtk-sort-descending" help="For changing to delegate state"/>
<button name="action_close" states="draft,pending,open" string="Done" type="object" icon="gtk-apply" help="For changing to done state"/>
<button name="action_close" states="draft,pending,open" string="Done" type="object" icon="terp-dialog-close" help="For changing to done state"/>
</tree>
</field>
</record>
@ -380,7 +380,7 @@
<field name="arch" type="xml">
<search string="Task Edition">
<group col="20" colspan="4">
<filter string="Current" domain="[('state','in',('open','draft'))]" name="current" help="Draft, In Progress and Pending Tasks" icon="terp-check" default="1"/>
<filter string="Current" domain="[('state','in',('open','draft'))]" name="current" help="Draft and In Progress tasks" icon="terp-check" default="1"/>
<filter string="In Progress" domain="[('state','=','open')]" help="In Progress Tasks" icon="terp-camera_test"/>
<filter string="Pending" domain="[('state','=','pending')]" context="{'show_delegated':False}" help="Pending Tasks" icon="terp-gtk-media-pause"/>
<separator orientation="vertical"/>
@ -392,6 +392,8 @@
<filter string="Deadlines" domain="[('date_deadline','&lt;&gt;',False)]" help="Show only tasks having a deadline" icon="terp-gnome-cpu-frequency-applet+"/>
<separator orientation="vertical"/>
<field name="name" select="1"/>
<field name="type_id" widget="selection"/>
<separator orientation="vertical"/>
<field name="project_id" select="1">
<filter domain="[('project_id.user_id','=',uid)]" help="My Projects" icon="terp-personal"/>
</field>
@ -405,7 +407,7 @@
<separator orientation="vertical"/>
<filter string="Project" name="group_project_id" icon="terp-folder-blue" domain="[]" context="{'group_by':'project_id'}"/>
<separator orientation="vertical"/>
<filter string="Stages" name="group_stage_id" icon="terp-stage" domain="[]" context="{'group_by':'type_id'}"/>
<filter string="Stage" name="group_stage_id" icon="terp-stage" domain="[]" context="{'group_by':'type_id'}"/>
<filter string="State" name="group_state" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
<separator orientation="vertical"/>
<filter string="Deadline" icon="terp-gnome-cpu-frequency-applet+" domain="[]" context="{'group_by':'date_deadline'}"/>
@ -492,7 +494,7 @@
<field name="view_id" ref="task_type_tree"/>
</record>
<menuitem id="menu_tasks_config" name="Tasks" parent="project.menu_definitions" sequence="1" groups="base.group_system"/>
<menuitem id="menu_tasks_config" name="Tasks" parent="project.menu_definitions" sequence="1" groups="base.group_system,group_project_finance_user"/>
<menuitem action="open_task_type_form" id="menu_task_types_view" parent="menu_tasks_config" sequence="1"/>
<act_window context="{'search_default_user_id': [active_id]}" id="act_res_users_2_project_project" name="User's projects" res_model="project.project" src_model="res.users" view_mode="tree,form" view_type="form"/>

View File

@ -89,7 +89,7 @@ class report_project_task_user(osv.osv):
planned_hours as hours_planned,
(extract('epoch' from (t.date_end-t.create_date)))/(3600*24) as closing_days,
(extract('epoch' from (t.date_start-t.create_date)))/(3600*24) as opening_days,
(extract('epoch' from (t.date_deadline-t.date_end)))/(3600*24) as delay_endings_days
abs((extract('epoch' from (t.date_deadline-t.date_end)))/(3600*24)) as delay_endings_days
FROM project_task t
GROUP BY

View File

@ -63,12 +63,12 @@
help="Current Year"/>
<filter icon="terp-go-month" string=" Month "
name="month"
domain="[('date_start','&lt;=', time.strftime('%%Y-%%m-%%d')),('date_start','&gt;=',time.strftime('%%Y-%%m-01'))]"
domain="[('date_start','&lt;=',(datetime.date.today()+relativedelta(day=31)).strftime('%%Y-%%m-%%d')),('date_start','&gt;=',(datetime.date.today()-relativedelta(day=1)).strftime('%%Y-%%m-%%d'))]"
help="Current Month"/>
<filter icon="terp-go-week"
string=" Month-1 "
separator="1"
domain="[('date_start','&lt;=', (datetime.date (int(time.strftime('%%Y')), datetime.date.today().month, 1) - datetime.timedelta (days = 1)).strftime('%%Y-%%m-%%d')),('date_start','&gt;',(datetime.date (int(time.strftime('%%Y')), datetime.date.today().month-1, 1)).strftime('%%Y-%%m-%%d'))]"
domain="[('date_start','&lt;=', (datetime.date.today() - relativedelta(day=31, months=1)).strftime('%%Y-%%m-%%d')),('date_start','&gt;=',(datetime.date.today() - relativedelta(day=1,months=1)).strftime('%%Y-%%m-%%d'))]"
help="Previous Month"/>
<separator orientation="vertical"/>
<filter string="Draft"
@ -91,7 +91,7 @@
<field name="project_id">
<filter icon="terp-folder-blue"
string="My Projects"
help="My Projects" domain="[('project_id','=',uid)]"/>
help="My Projects" domain="[('project_id.user_id','=',uid)]"/>
</field>
<field name="user_id" widget="selection">
@ -108,14 +108,16 @@
</group>
<newline/>
<group expand="0" string="Extended Filters..." colspan="10" col="12" groups="base.group_extended">
<field name="priority"/>
<field name="type_id" widget="selection"/>
<separator orientation="vertical"/>
<field name="date_start"/>
<field name="date_deadline"/>
<field name="date_end"/>
<separator orientation="vertical"/>
<field name="priority"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
<newline/>
<field name="date_start"/>
<field name="date_end"/>
<field name="date_deadline"/>
<separator orientation="vertical"/>
</group>
<newline/>
<group expand="1" string="Group By..." colspan="10" col="12">
@ -129,9 +131,9 @@
<filter string="Company" icon="terp-go-home" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
<filter string="Stage" icon="terp-stage" context="{'group_by':'type_id'}" />
<separator orientation="vertical"/>
<filter string="Day" icon="terp-go-today" context="{'group_by':'day'}" help="Current Day"/>
<filter string="Month" icon="terp-go-month" context="{'group_by':'month'}" help="Current Month"/>
<filter string="Year" icon="terp-go-year" context="{'group_by':'year'}" help="Current Year"/>
<filter string="Day" icon="terp-go-today" context="{'group_by':'day'}" help="Creation Date"/>
<filter string="Month" icon="terp-go-month" context="{'group_by':'month'}" help="Creation Date"/>
<filter string="Year" icon="terp-go-year" context="{'group_by':'year'}" help="Creation Date"/>
</group>
</search>
</field>

Some files were not shown because too many files have changed in this diff Show More