[MERGE] merged work of rpa

bzr revid: hmo@tinyerp.com-20100527070859-ydnjki88gdui73dc
This commit is contained in:
Harry (Open ERP) 2010-05-27 12:38:59 +05:30
commit 12477c61e0
29 changed files with 555 additions and 561 deletions

View File

@ -951,23 +951,8 @@ class account_invoice(osv.osv):
return taxes.values()
def _log_event(self, cr, uid, ids, factor=1.0, name='Open Invoice'):
invs = self.read(cr, uid, ids, ['type','partner_id','amount_untaxed'])
for inv in invs:
part=inv['partner_id'] and inv['partner_id'][0]
pc = pr = 0.0
cr.execute('select sum(quantity*price_unit) from account_invoice_line where invoice_id=%s', (inv['id'],))
total = inv['amount_untaxed']
if inv['type'] in ('in_invoice','in_refund'):
partnertype='supplier'
eventtype = 'purchase'
pc = total*factor
else:
partnertype = 'customer'
eventtype = 'sale'
pr = total*factor
if self.pool.get('res.partner.event.type').check(cr, uid, 'invoice_open'):
self.pool.get('res.partner.event').create(cr, uid, {'name':'Invoice: '+name, 'som':False, 'description':name+' '+str(inv['id']), 'document':name, 'partner_id':part, 'date':time.strftime('%Y-%m-%d %H:%M:%S'), 'canal_id':False, 'user_id':uid, 'partner_type':partnertype, 'probability':1.0, 'planned_revenue':pr, 'planned_cost':pc, 'type':eventtype})
return len(invs)
#TODO: implement messages system
return True
def name_get(self, cr, uid, ids, context=None):
if not len(ids):

View File

@ -132,11 +132,13 @@
<field name="type">form</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<notebook position="inside">
<page string="Project">
<field name="contract_ids" colspan="4" nolabel="1" />
</page>
</notebook>
<xpath expr="//notebook[last()]" position="after">
<notebook colspan="4">
<page string="Project">
<field name="contract_ids" colspan="4" nolabel="1" />
</page>
</notebook>
</xpath>
</field>
</record>

View File

@ -56,15 +56,15 @@
<field name="server_action_id"/>
<field name="filter_id"/>
</page>
<page string="E-Mail Actions">
<page string="Email Actions">
<!-- <group col="4" colspan="2">-->
<separator colspan="4" string="Template of Email to Send"/>
<separator colspan="4" string="Email Information"/>
<field name="act_mail_to_watchers"/>
<field name="act_mail_to_user"/>
<field colspan="4" name="act_mail_to_email"/>
<!-- </group>-->
<!-- <group col="4" colspan="2">-->
<separator colspan="4" string="E-Mail Reminders (includes the content of the object)"/>
<separator colspan="4" string="Email Reminders"/>
<field name="act_remind_partner"/>
<field name="act_remind_attach"/>
<field name="act_remind_user"/>
@ -73,7 +73,7 @@
</group>
<field colspan="4" name="act_email_cc"/>
<!-- </group>-->
<separator colspan="4" string="Mail Body"/>
<separator colspan="4" string="Email Body"/>
<field colspan="4" name="act_mail_body" height="250"
nolabel="1" attrs="{'required':[('act_remind_user','=',True)]}" />
<separator colspan="4" string="Special Keywords to Be Used in The Body"/>
@ -82,9 +82,9 @@
<label align="0.0" string="%%(object_description)s = Object description" colspan="2"/>
<label align="0.0" string="%%(object_date)s = Creation date" colspan="2"/>
<label align="0.0" string="%%(partner)s = Partner name" colspan="2"/>
<label align="0.0" string="%%(partner_email)s = Partner email" colspan="2"/>
<label align="0.0" string="%%(partner_email)s = Partner Email" colspan="2"/>
<label align="0.0" string="%%(object_user)s = Responsible name" colspan="2"/>
<label align="0.0" string="%%(object_user_email)s = Responsible email" colspan="2"/>
<label align="0.0" string="%%(object_user_email)s = Responsible Email" colspan="2"/>
<label align="0.0" string="%%(object_user_phone)s = Responsible phone" colspan="2"/>
</page>
</notebook>

View File

@ -203,9 +203,13 @@ class crm_case(object):
address = self.pool.get('res.partner.address').browse(cr, uid, add)
return {'value': {'email_from': address.email}}
def _history(self, cr, uid, cases, keyword, history=False, email=False, details=None, email_from=False, message_id=False, context={}):
def _history(self, cr, uid, cases, keyword, history=False, subject=None, email=False, details=None, email_from=False, message_id=False, attach=[], context={}):
mailgate_pool = self.pool.get('mailgate.thread')
return mailgate_pool._history(cr, uid, cases, keyword, history=history, email=email, details=details, email_from=email_from, message_id=message_id, context=context)
return mailgate_pool._history(cr, uid, cases, keyword, history=history,\
subject=subject, email=email, \
details=details, email_from=email_from,\
message_id=message_id, attach=attach, \
context=context)
def case_open(self, cr, uid, ids, *args):
"""Opens Case

View File

@ -82,23 +82,9 @@ this if you want the rule to send an email to the partner."),
if hasattr(obj, 'categ_id'):
ok = ok and (not action.trg_categ_id or action.trg_categ_id.id==obj.categ_id.id)
# TODO: history_line is removed
# if hasattr(obj, 'history_line'):
# ok = ok and (not action.trg_max_history or action.trg_max_history<=(len(obj.history_line)+1))
# reg_history = action.regex_history
# result_history = True
# if reg_history:
# ptrn = re.compile(str(reg_history))
# if obj.history_line:
# _result = ptrn.search(str(obj.history_line[0].description))
# if not _result:
# result_history = False
regex_h = not reg_history or result_history
ok = ok and regex_h
return ok
def do_action(self, cr, uid, action, model_obj, obj, context={}):
""" @param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@ -118,7 +104,7 @@ this if you want the rule to send an email to the partner."),
write['email_cc'] = obj.email_cc+','+obj.act_email_cc
else:
write['email_cc'] = obj.act_email_cc
model_obj.write(cr, uid, [obj.id], write, context)
emails = []

View File

@ -1,59 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="event_type_case_create" model="res.partner.event.type">
<field name="name">CRM: Create Case</field>
<field name="key">crm_case_draft</field>
</record>
<record id="event_type_case_open" model="res.partner.event.type">
<field name="name">CRM: Open Case</field>
<field name="key">crm_case_open</field>
</record>
<record id="event_type_case_pending" model="res.partner.event.type">
<field name="name">CRM: Pending Case</field>
<field name="key">crm_case_pending</field>
</record>
<record id="event_type_case_cancel" model="res.partner.event.type">
<field name="name">CRM: Cancel Case</field>
<field name="key">crm_case_cancel</field>
</record>
<record id="event_type_case_close" model="res.partner.event.type">
<field name="name">CRM: Close Case</field>
<field name="key">crm_case_done</field>
</record>
</data>
<data noupdate="1">
<record model="crm.case.section" id="section_sales_department">
<field name="name">Sales Department</field>
<field name="code">Sales</field>
</record>
<record id="event_type_case_create" model="res.partner.event.type">
<field eval="False" name="active"/>
</record>
<record id="event_type_case_open" model="res.partner.event.type">
<field eval="True" name="active"/>
</record>
<record id="event_type_case_pending" model="res.partner.event.type">
<field eval="False" name="active"/>
</record>
<record id="event_type_case_close" model="res.partner.event.type">
<field eval="True" name="active"/>
</record>
<record id="event_type_case_cancel" model="res.partner.event.type">
<field eval="False" name="active"/>
</record>
<record id="ir_cron_crm_action" model="ir.cron">
<field name="name">Check cases rules</field>

View File

@ -137,7 +137,6 @@ and users by email"),
method=True, multi='day_open', type="float", store=True),
'day_close': fields.function(_compute_day, string='Days to Close', \
method=True, multi='day_close', type="float", store=True),
'function_name': fields.char('Function', size=64),
'state': fields.selection(crm.AVAILABLE_STATES, 'State', size=16, readonly=True,
help='The state is set to \'Draft\', when a case is created.\
\nIf the case is in progress the state is set to \'Open\'.\

View File

@ -72,7 +72,7 @@
<field name="partner_name" string="Partner Name" colspan="4"/>
<newline/>
<field domain="[('domain', '=', 'contact')]" name="title"/>
<field name="function_name" />
<field name="function" />
<field name="street" colspan="4"/>
<field name="street2" colspan="4"/>
<field name="zip"/>
@ -161,16 +161,21 @@
<field name="email_to"/>
<field name="email_from"/>
</group>
<newline/>
<field name="description" colspan="4" nolabel="1"/>
<notebook colspan="4">
<page string="Details">
<field name="description" colspan="4" nolabel="1"/>
</page>
<page string="Attachments">
<field name="attachment_ids" colspan="4" readonly="1" nolabel="1"/>
</page>
</notebook>
<button colspan="4"
string="Reply to Last Email"
name="%(action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'crm.lead', 'include_original' : True}"
icon="gtk-undo" type="action" />
string="Reply to Last Email"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'crm.lead', 'include_original' : True}"
icon="gtk-undo" type="action" />
</form>
<tree string="Communication history">
<field name="name" />
<field name="date"/>
<field name="email_from" />
<field name="email_to"/>
@ -178,7 +183,7 @@
</tree>
</field>
<button colspan="2" string="Send New Email"
name="%(action_crm_send_mail)d"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'new', 'model': 'crm.lead'}"
icon="gtk-go-forward" type="action" />
<button colspan="2" string="Forward to Partner"

View File

@ -1,23 +1,23 @@
<?xml version="1.0"?>
<openerp>
<data>
<data>
<!-- Opportunity Categories Form View -->
<!-- Opportunity Categories Form View -->
<record id="crm_opportunity_categ_action" model="ir.actions.act_window">
<field name="name">Opportunity Categories</field>
<field name="res_model">crm.case.categ</field>
<field name="view_type">form</field>
<field name="view_id" ref="crm.crm_case_categ_tree-view"/>
<field name="domain">[('object_id.model', '=', 'crm.lead')]</field>
<field name="context">{'object_id':'crm.lead'}</field>
</record>
<record id="crm_opportunity_categ_action" model="ir.actions.act_window">
<field name="name">Opportunity Categories</field>
<field name="res_model">crm.case.categ</field>
<field name="view_type">form</field>
<field name="view_id" ref="crm.crm_case_categ_tree-view"/>
<field name="domain">[('object_id.model', '=', 'crm.lead')]</field>
<field name="context">{'object_id':'crm.lead'}</field>
</record>
<menuitem action="crm_opportunity_categ_action"
id="menu_crm_case_opportunity-act"
parent="crm.menu_crm_case_categ" />
<menuitem action="crm_opportunity_categ_action"
id="menu_crm_case_opportunity-act"
parent="crm.menu_crm_case_categ" />
<!-- Opportunity Stages Form View-->
<!-- Opportunity Stages Form View-->
<record id="crm_opportunity_stage_act" model="ir.actions.act_window">
<field name="name">Opportunity Stages</field>
@ -47,282 +47,304 @@
id="menu_crm_opportunity_resource_act"
parent="crm.menu_crm_case_resource_type" />
<!-- Opportunities Form View -->
<!-- Opportunities Form View -->
<record model="ir.ui.view" id="crm_case_form_view_oppor">
<field name="name">Opportunities</field>
<field name="model">crm.lead</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Opportunities">
<group colspan="4" col="7">
<field name="name" required="1" string="Opportunity"/>
<label string="Stage:" align="1.0"/>
<group colspan="1" col="4">
<field name="stage_id" nolabel="1"
on_change="onchange_stage_id(stage_id)"
widget="selection"
domain="[('object_id.model', '=', 'crm.lead')]" />
<button name="stage_previous"
<record model="ir.ui.view" id="crm_case_form_view_oppor">
<field name="name">Opportunities</field>
<field name="model">crm.lead</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Opportunities">
<group colspan="4" col="7">
<field name="name" required="1" string="Opportunity"/>
<label string="Stage:" align="1.0"/>
<group colspan="1" col="4">
<field name="stage_id" nolabel="1"
on_change="onchange_stage_id(stage_id)"
widget="selection"
domain="[('object_id.model', '=', 'crm.lead')]" />
<button name="stage_previous"
states="open,pending" type="object"
icon="gtk-go-back" string="" />
<button name="stage_next" states="open,pending"
type="object" icon="gtk-go-forward" string="" />
</group>
<field name="user_id"/>
<button name="action_makeMeeting" type="object"
string="Schedule Meeting" icon="gtk-redo" />
<field name="planned_revenue"/>
<field name="probability"/>
<field name="date_deadline" string="Expected Closing"/>
<button string="Schedule Call"
name="%(opportunity2phonecall_act)d" icon="gtk-redo" type="action" />
<newline/>
<field name="date_action"/>
<field name="priority" string="Priority"/>
</group>
<notebook colspan="4">
<page string="Opportunity">
<group col="4" colspan="2">
<separator colspan="4" string="Contacts"/>
<field name="partner_id" select="1"
on_change="onchange_partner_id(partner_id, email_from)"
colspan="2" />
<field name="partner_address_id"
string="Contact"
on_change="onchange_partner_address_id(partner_address_id, email_from)"
colspan="1" />
<field name="email_from" string="Email" />
<field name="phone"/>
</group>
<group col="2" colspan="2">
<separator colspan="2" string="Categorization"/>
<field name="section_id" colspan="1" widget="selection"/>
<field name="categ_id" select="1" groups="base.group_extended"
string="Category" widget="selection"
domain="[('object_id.model', '=', 'crm.lead')]" />
</group>
<separator colspan="4" string="Details"/>
<field name="description" nolabel="1" colspan="4"/>
<separator colspan="4"/>
<group col="8" colspan="4">
<field name="state"/>
<button name="case_open" string="Open"
states="draft,pending" type="object"
icon="gtk-go-forward" />
<button name="case_pending" string="Pending"
states="draft,open" type="object"
icon="gtk-media-pause" />
<button name="case_escalate" string="Escalate"
states="open,draft,pending" type="object"
groups="base.group_extended"
icon="gtk-go-up" />
<button name="case_cancel" string="Mark Lost"
states="draft,open,pending" type="object"
icon="gtk-close" />
<button name="case_close" string="Mark Won"
states="open,draft,pending" type="object"
icon="gtk-apply" />
<button name="case_reset" string="Reset to New"
states="done,cancel" type="object"
icon="gtk-convert" />
</group>
</page>
<page string="Emails" groups="base.group_extended">
<group colspan="4">
<field colspan="4" name="email_cc" string="CC"/>
</group>
<field name="message_ids" colspan="4" nolabel="1" mode="form,tree" height="280">
<form string="Communication history">
<group col="6" colspan="4">
<field name="date"/>
<field name="email_to"/>
<field name="email_from"/>
</group>
<notebook colspan="4">
<page string="Details">
<field name="description" colspan="4" nolabel="1"/>
</page>
<page string="Attachments">
<field name="attachment_ids" colspan="4" readonly="1" nolabel="1"/>
</page>
</notebook>
<button colspan="4"
string="Reply to Last Email"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'crm.lead', 'include_original' : True}"
icon="gtk-undo" type="action" />
</form>
<tree string="Communication history">
<field name="date"/>
<field name="email_from" />
<field name="email_to"/>
<field name="description"/>
</tree>
</field>
<button colspan="2" string="Send New Email"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'new', 'model': 'crm.lead'}"
icon="gtk-go-forward" type="action" />
<button colspan="2" string="Forward to Partner"
name="%(crm_lead_forward_to_partner_act)d"
icon="gtk-go-forward" type="action" />
</page>
<page string="History" groups="base.group_extended">
<group col="2" colspan="2">
<separator string="Dates" colspan="2"/>
<field name="create_date"/>
<field name="write_date"/>
<field name="date_closed"/>
<field name="date_open"/>
</group>
<group col="2" colspan="2">
<separator string="Misc" colspan="2"/>
<field name="active"/>
<field name="day_open"/>
<field name="day_close"/>
<field name="referred"/>
</group>
<separator colspan="4" string="References"/>
<field name="ref"/>
<field name="ref2"/>
<field name="log_ids" nolabel="1" colspan="4">
<tree string="Logs">
<field name="name" colspan="4"/>
<field name="date"/>
<field name="user_id"/>
</tree>
<form string="Logs">
<separator string="Action Information" colspan="4"/>
<field name="name" colspan="4"/>
<field name="date"/>
<field name="user_id"/>
</form>
</field>
</page>
</notebook>
</form>
</field>
</record>
<!-- Opportunities Tree View -->
<record model="ir.ui.view" id="crm_case_tree_view_oppor">
<field name="name">Opportunities Tree</field>
<field name="model">crm.lead</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Opportunities" colors="blue:state=='pending';grey:state in ('cancel', 'done');red:date_deadline &lt; current_date">
<field name="date_deadline" invisible="1"/>
<field name="create_date"/>
<field name="name" string="Opportunity"/>
<field name="partner_id"/>
<field name="stage_id"/>
<field name="categ_id" invisible="1" groups="base.group_extended"/>
<button name="stage_previous" string="Previous"
states="open,pending" type="object" icon="gtk-go-back" />
<button name="stage_next" string="Next"
states="open,pending" type="object"
icon="gtk-go-back" string="" />
<button name="stage_next" states="open,pending"
type="object" icon="gtk-go-forward" string="" />
</group>
<field name="user_id"/>
<button name="action_makeMeeting" type="object"
string="Schedule Meeting" icon="gtk-redo" />
<field name="planned_revenue"/>
<field name="probability"/>
<field name="date_deadline" string="Expected Closing"/>
<button string="Schedule Call"
name="%(opportunity2phonecall_act)d" icon="gtk-redo" type="action" />
<newline/>
<field name="date_action"/>
<field name="priority" string="Priority"/>
</group>
<notebook colspan="4">
<page string="Opportunity">
<group col="4" colspan="2">
<separator colspan="4" string="Contacts"/>
<field name="partner_id" select="1"
on_change="onchange_partner_id(partner_id, email_from)"
colspan="2" />
<field name="partner_address_id"
string="Contact"
on_change="onchange_partner_address_id(partner_address_id, email_from)"
colspan="1" />
<field name="email_from" string="Email" />
<field name="phone"/>
</group>
<group col="2" colspan="2">
<separator colspan="2" string="Categorization"/>
<field name="section_id" colspan="1" widget="selection"/>
<field name="categ_id" select="1" groups="base.group_extended"
string="Category" widget="selection"
domain="[('object_id.model', '=', 'crm.lead')]" />
</group>
<separator colspan="4" string="Details"/>
<field name="description" nolabel="1" colspan="4"/>
<separator colspan="4"/>
<group col="8" colspan="4">
icon="gtk-go-forward" />
<field name="planned_revenue" sum="Total of Planned Revenue"/>
<field name="probability" widget="progressbar" avg="Avg. of Probability"/>
<field name="date_action"/>
<field name="section_id" groups="base.group_extended"/>
<field name="user_id"/>
<field name="priority"/>
<field name="state"/>
<button name="case_open" string="Open"
states="draft,pending" type="object"
icon="gtk-go-forward" />
<button name="case_pending" string="Pending"
states="draft,open" type="object"
icon="gtk-media-pause" />
<button name="case_escalate" string="Escalate"
states="open,draft,pending" type="object"
groups="base.group_extended"
icon="gtk-go-up" />
<button name="case_cancel" string="Mark Lost"
states="draft,open,pending" type="object"
icon="gtk-close" />
<button name="case_close" string="Mark Won"
<button name="case_close" string="Won"
states="open,draft,pending" type="object"
icon="gtk-apply" />
<button name="case_reset" string="Reset to New"
states="done,cancel" type="object"
icon="gtk-convert" />
</group>
</page>
<page string="Emails" groups="base.group_extended">
<group colspan="4">
<field colspan="4" name="email_cc" string="CC"/>
</group>
<field name="message_ids" colspan="4" nolabel="1" mode="form,tree">
<form string="Communication history">
<group col="6" colspan="4">
<field name="date"/>
<field name="email_to"/>
<field name="email_from"/>
</group>
<newline/>
<field name="description" colspan="4" nolabel="1"/>
<button colspan="4"
string="Reply to Last Email"
name="%(action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'crm.lead'}"
icon="gtk-undo" type="action" />
</form>
<tree string="Communication history">
<field name="description"/>
<field name="email_to"/>
<field name="date"/>
</tree>
</field>
<button colspan="2" string="Send New Email"
name="%(action_crm_send_mail)d"
context="{'mail':'new', 'model': 'crm.lead'}"
icon="gtk-go-forward" type="action" />
<button colspan="2" string="Forward to Partner"
name="%(crm_lead_forward_to_partner_act)d"
icon="gtk-go-forward" type="action" />
</page>
<page string="History" groups="base.group_extended">
<group col="2" colspan="2">
<separator string="Dates" colspan="2"/>
<field name="create_date"/>
<field name="write_date"/>
<field name="date_closed"/>
<field name="date_open"/>
</group>
<group col="2" colspan="2">
<separator string="Misc" colspan="2"/>
<field name="active"/>
<field name="day_open"/>
<field name="day_close"/>
<field name="referred"/>
</group>
<separator colspan="4" string="References"/>
<field name="ref"/>
<field name="ref2"/>
<field name="log_ids" nolabel="1" colspan="4">
<tree string="Logs">
<field name="name" colspan="4"/>
<field name="date"/>
<field name="user_id"/>
</tree>
<form string="Logs">
<separator string="Action Information" colspan="4"/>
<field name="name" colspan="4"/>
<field name="date"/>
<field name="user_id"/>
</form>
</field>
</page>
</notebook>
</form>
</field>
</record>
<!-- Opportunities Tree View -->
<record model="ir.ui.view" id="crm_case_tree_view_oppor">
<field name="name">Opportunities Tree</field>
<field name="model">crm.lead</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Opportunities" colors="blue:state=='pending';grey:state in ('cancel', 'done');red:date_deadline &lt; current_date">
<field name="date_deadline" invisible="1"/>
<field name="create_date"/>
<field name="name" string="Opportunity"/>
<field name="partner_id"/>
<field name="stage_id"/>
<field name="categ_id" invisible="1" groups="base.group_extended"/>
<button name="stage_previous" string="Previous"
states="open,pending" type="object" icon="gtk-go-back" />
<button name="stage_next" string="Next"
states="open,pending" type="object"
icon="gtk-go-forward" />
<field name="planned_revenue" sum="Total of Planned Revenue"/>
<field name="probability" widget="progressbar" avg="Avg. of Probability"/>
<field name="date_action"/>
<field name="section_id" groups="base.group_extended"/>
<field name="user_id"/>
<field name="priority"/>
<field name="state"/>
<button name="case_open" string="Open"
states="draft,pending" type="object"
icon="gtk-go-forward" />
<button name="case_close" string="Won"
states="open,draft,pending" type="object"
icon="gtk-apply" />
<button name="case_pending" string="Pending"
states="open,draft" type="object"
icon="gtk-media-pause" />
<button name="case_cancel" string="Lost"
states="draft,open,pending" type="object"
icon="gtk-cancel" />
</tree>
</field>
</record>
<!-- Opportunities Graph View -->
<record model="ir.ui.view" id="crm_case_graph_view_opportunity">
<field name="name">CRM - Opportunity Graph</field>
<field name="model">crm.lead</field>
<field name="type">graph</field>
<field name="arch" type="xml">
<graph string="Opportunity by Categories" type="bar" orientation="horizontal">
<field name="categ_id"/>
<field name="planned_revenue" operator="+"/>
<field name="state" group="True"/>
</graph>
</field>
</record>
<!-- Opportunities Search View -->
<record id="view_crm_case_opportunities_filter" model="ir.ui.view">
<field name="name">CRM - Opportunities Search</field>
<field name="model">crm.lead</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Search Opportunities">
<filter icon="terp-project"
string="Current"
name="current"
domain="[('state','in',('draft','open'))]"/>
<filter icon="terp-project"
string="Open"
domain="[('state','=','open')]"/>
<filter icon="terp-project"
string="Pending"
domain="[('state','=','pending')]"/>
<separator orientation="vertical"/>
<filter icon="gtk-home" string="Today"
domain="[('create_date','&lt;', time.strftime('%%Y-%%m-%%d 23:59:59')), ('create_date','&gt;=', time.strftime('%%Y-%%m-%%d 23:59:59'))]"
help="Todays' Opportunities" />
<filter icon="gtk-media-rewind" string="7 Days"
help="Opportunities during last 7 days"
domain="[('create_date','&lt;', time.strftime('%%Y-%%m-%%d')),\
('create_date','&gt;=',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]"
/>
<separator orientation="vertical"/>
<field name="name" string="Opportunity"/>
<field name="user_id" widget="selection">
<filter icon="terp-partner"
domain="[('user_id','=', False)]"
help="Unassigned Opportunities" />
<button name="case_pending" string="Pending"
states="open,draft" type="object"
icon="gtk-media-pause" />
<button name="case_cancel" string="Lost"
states="draft,open,pending" type="object"
icon="gtk-cancel" />
</tree>
</field>
<field name="section_id"
default="context.get('section_id', False)" select="1"
widget="selection">
<filter icon="terp-crm"
domain="[('section_id','=',context.get('section_id',False))]"
help="My Sale Team" />
</field>
<newline/>
<group expand="1" string="Group By...">
<filter string="Stage" icon="terp-crm" domain="[]"
context="{'group_by':'stage_id'}"/>
<filter string="Priority" icon="terp-crm" domain="[]"
context="{'group_by':'priority'}"/>
<filter string="Category" icon="terp-crm"
domain="[]" context="{'group_by':'categ_id'}"/>
</record>
<separator orientation="vertical"/>
<filter string="Salesman" icon="terp-crm"
domain="[('user_id','=',uid)]" context="{'group_by':'user_id'}"/>
<separator orientation="vertical"/>
<filter string="Creation" icon="terp-project"
domain="[]" context="{'group_by':'create_date'}"/>
<filter string="Exp.Closing" icon="terp-project"
domain="[]" context="{'group_by':'date_deadline'}"/>
</group>
</search>
</field>
</record>
<!-- Opportunities Graph View -->
<record model="ir.ui.view" id="crm_case_graph_view_opportunity">
<field name="name">CRM - Opportunity Graph</field>
<field name="model">crm.lead</field>
<field name="type">graph</field>
<field name="arch" type="xml">
<graph string="Opportunity by Categories" type="bar" orientation="horizontal">
<field name="categ_id"/>
<field name="planned_revenue" operator="+"/>
<field name="state" group="True"/>
</graph>
</field>
</record>
<!-- Opportunities Search View -->
<record id="view_crm_case_opportunities_filter" model="ir.ui.view">
<field name="name">CRM - Opportunities Search</field>
<field name="model">crm.lead</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Search Opportunities">
<filter icon="terp-project"
string="Current"
name="current"
domain="[('state','in',('draft','open'))]"/>
<filter icon="terp-project"
string="Open"
domain="[('state','=','open')]"/>
<filter icon="terp-project"
string="Pending"
domain="[('state','=','pending')]"/>
<separator orientation="vertical"/>
<filter icon="gtk-home" string="Today"
domain="[('create_date','&lt;', time.strftime('%%Y-%%m-%%d 23:59:59')), ('create_date','&gt;=', time.strftime('%%Y-%%m-%%d 23:59:59'))]"
help="Todays' Opportunities" />
<filter icon="gtk-media-rewind" string="7 Days"
help="Opportunities during last 7 days"
domain="[('create_date','&lt;', time.strftime('%%Y-%%m-%%d')),\
('create_date','&gt;=',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]"
/>
<separator orientation="vertical"/>
<field name="name" string="Opportunity"/>
<field name="user_id" widget="selection">
<filter icon="terp-partner"
domain="[('user_id','=', False)]"
help="Unassigned Opportunities" />
</field>
<field name="section_id"
default="context.get('section_id', False)" select="1"
widget="selection">
<filter icon="terp-crm"
domain="[('section_id','=',context.get('section_id',False))]"
help="My Sale Team" />
</field>
<newline/>
<group expand="0" string="Group By..." colspan="16">
<filter string="Stage" icon="terp-crm" domain="[]"
context="{'group_by':'stage_id'}" />
<filter string="Priority" icon="terp-crm" domain="[]"
context="{'group_by':'priority'}" />
<filter string="Category" icon="terp-crm"
domain="[]" context="{'group_by':'categ_id'}" />
<separator orientation="vertical" />
<filter string="Salesman" icon="terp-crm"
domain="[('user_id','=',uid)]" context="{'group_by':'user_id'}" />
<separator orientation="vertical" />
<filter string="Creation" icon="terp-project"
domain="[]" context="{'group_by':'create_date'}" />
<filter string="Exp.Closing" icon="terp-project"
domain="[]" context="{'group_by':'date_deadline'}" />
</group>
</search>
</field>
</record>
<!-- Opportunities Graph View -->
<record model="ir.ui.view" id="crm_case_graph_view_opportunity">
<field name="name">CRM - Opportunity Graph</field>
<field name="model">crm.lead</field>
<field name="type">graph</field>
<field name="arch" type="xml">
<graph string="Opportunity by Categories" type="bar" orientation="horizontal">
<field name="categ_id"/>
<field name="planned_revenue" operator="+"/>
<field name="state" group="True"/>
</graph>
</field>
</record>
</data>
</openerp>

View File

@ -38,6 +38,9 @@ class crm_phonecall(osv.osv, crm_case):
'name': fields.char('Name', size=64),
'active': fields.boolean('Active', required=False),
'thread_id': fields.many2one('mailgate.thread', 'Thread', required=False),
'date_action_last': fields.datetime('Last Action', readonly=1),
'date_action_next': fields.datetime('Next Action', readonly=1),
'create_date': fields.datetime('Creation Date' , readonly=True),
'section_id': fields.many2one('crm.case.section', 'Sales Team', \
select=True, help='Sales team to which Case belongs to.\
Define Responsible user and Email account for mail gateway.'),

View File

@ -27,10 +27,12 @@ class res_partner(osv.osv):
_columns = {
'opportunity_ids': fields.one2many('crm.lead', 'partner_id',\
'Opportunities', domain=[('type', '=', 'opportunity')]),
'Opportunities', readonly=True, \
domain=[('type', '=', 'opportunity')]),
'meeting_ids': fields.one2many('crm.meeting', 'partner_id',\
'Meetings'),
'phonecall_ids': fields.one2many('crm.phonecall', 'partner_id', 'Phonecalls'),
'Meetings', readonly=True),
'phonecall_ids': fields.one2many('crm.phonecall', 'partner_id',\
'Phonecalls', readonly=True),
}
res_partner()

View File

@ -10,52 +10,54 @@
<field name="type">form</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<notebook position="inside">
<page string="CRM">
<field name="meeting_ids" colspan="4" nolabel="1" />
<field name="phonecall_ids" colspan="4" nolabel="1" />
<field name="opportunity_ids" colspan="4" nolabel="1" domain="[('type', '=', 'opportunity')]">
<tree string="Opportunities" colors="blue:state=='pending';grey:state in ('cancel', 'done')">
<field name="create_date"/>
<field name="partner_name"/>
<field name="name"/>
<field name="email_from"/>
<field name="phone"/>
<field name="categ_id" invisible="1"/>
<field name="type_id" invisible="1"/>
<field name="referred" invisible="1"/>
<field name="stage_id"/>
<button name="stage_previous" string="Previous"
states="open,pending" type="object" icon="gtk-go-back" />
<button name="stage_next" string="Next"
states="open,pending" type="object"
icon="gtk-go-forward" />
<field name="section_id"
invisible="context.get('invisible_section', True)" />
<field name="user_id" />
<field name="state" />
<button name="case_open" string="Open"
states="draft,pending" type="object"
icon="gtk-go-forward" />
<button name="case_close" string="Close"
states="open,draft,pending" type="object"
icon="gtk-close" />
<button string="Convert to Opportunity"
name="convert_opportunity"
states="draft,open,pending" icon="gtk-index"
type="object" />
<button name="case_escalate" string="Escalate"
states="open,draft,pending" type="object"
icon="gtk-go-up" />
<button name="case_cancel" string="Cancel"
states="draft,open,pending" type="object"
icon="gtk-cancel" />
</tree>
</field>
</page>
</notebook>
<xpath expr="//notebook[last()]" position="after">
<notebook colspan="4">
<page string="CRM">
<field name="meeting_ids" colspan="4" nolabel="1" />
<field name="phonecall_ids" colspan="4" nolabel="1" />
<field name="opportunity_ids" colspan="4" nolabel="1" domain="[('type', '=', 'opportunity')]">
<tree string="Opportunities" colors="blue:state=='pending';grey:state in ('cancel', 'done')">
<field name="create_date"/>
<field name="partner_name"/>
<field name="name"/>
<field name="email_from"/>
<field name="phone"/>
<field name="categ_id" invisible="1"/>
<field name="type_id" invisible="1"/>
<field name="referred" invisible="1"/>
<field name="stage_id"/>
<button name="stage_previous" string="Previous"
states="open,pending" type="object" icon="gtk-go-back" />
<button name="stage_next" string="Next"
states="open,pending" type="object"
icon="gtk-go-forward" />
<field name="section_id"
invisible="context.get('invisible_section', True)" />
<field name="user_id" />
<field name="state" />
<button name="case_open" string="Open"
states="draft,pending" type="object"
icon="gtk-go-forward" />
<button name="case_close" string="Close"
states="open,draft,pending" type="object"
icon="gtk-close" />
<button string="Convert to Opportunity"
name="convert_opportunity"
states="draft,open,pending" icon="gtk-index"
type="object" />
<button name="case_escalate" string="Escalate"
states="open,draft,pending" type="object"
icon="gtk-go-up" />
<button name="case_cancel" string="Cancel"
states="draft,open,pending" type="object"
icon="gtk-cancel" />
</tree>
</field>
</page>
</notebook>
</xpath>
</field>
</record>

View File

@ -117,7 +117,7 @@ class Contact
"email_from" => new xmlrpcval($post['email'], "string"),
"phone" => new xmlrpcval($post['phone'], "string"),
"partner_name" => new xmlrpcval($post['name'], "string"),
"function_name" => new xmlrpcval($post["jobtitle"], "string"),
"function" => new xmlrpcval($post["jobtitle"], "string"),
"zip" => new xmlrpcval($post['zip'], "string"),
"stage_id" => new xmlrpcval(6, "int"),
"city" => new xmlrpcval($post['city'], "string"),

View File

@ -212,7 +212,7 @@ class crm_lead_forward_to_partner(osv.osv_memory):
lead = lead_proxy.browse(cr, uid, lead_id, context=context)
if lead.type == 'lead':
field_names = [
'partner_name', 'title', 'function_name', 'street', 'street2',
'partner_name', 'title', 'function', 'street', 'street2',
'zip', 'city', 'country_id', 'state_id', 'email_from',
'phone', 'fax', 'mobile'
]

View File

@ -155,7 +155,7 @@ class crm_lead2partner(osv.osv_memory):
'email': lead.email_from,
'fax': lead.fax,
'title': lead.title,
'function': lead.function_name,
'function': lead.function,
'street': lead.street,
'street2': lead.street2,
'zip': lead.zip,

View File

@ -99,7 +99,7 @@ class crm_send_new_email(osv.osv_memory):
model = hist.model_id.model
model_pool = self.pool.get(model)
res_ids = model_pool.search(cr, uid, [('thread_id','=', hist.thread_id.id)])
res_id = res_ids and res_ids[0] or False
res_id = res_ids and res_ids[0] or False
case = model_pool.browse(cr, uid, res_id)
emails = [obj.email_to] + (obj.email_cc or '').split(',')
emails = filter(None, emails)
@ -107,7 +107,11 @@ class crm_send_new_email(osv.osv_memory):
body = case_pool.format_body(body)
email_from = getattr(obj, 'email_from', False)
case_pool._history(cr, uid, [case], _('Send'), history=True, email=obj.email_to, details=body, email_from=email_from, message_id=message_id)
case_pool._history(cr, uid, [case], _('Send'), history=True, \
email=obj.email_to, details=body, \
subject=obj.subject, email_from=email_from, \
message_id=message_id, attach=attach)
x_headers = dict()
#x_headers = {

View File

@ -174,31 +174,38 @@
<group colspan="4">
<field colspan="4" name="email_cc" string="CC"/>
</group>
<field name="message_ids" colspan="4" nolabel="1" mode="form,tree">
<form string="Communication history">
<group col="6" colspan="4">
<field name="date"/>
<field name="email_to"/>
<field name="email_from"/>
</group>
<newline/>
<field name="description" colspan="4" nolabel="1"/>
<button colspan="4"
string="Reply to Last Email"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'crm.claim'}"
icon="gtk-undo" type="action" />
</form>
<tree string="Communication history">
<field name="description"/>
<field name="email_to"/>
<field name="date"/>
</tree>
</field>
<button colspan="4" string="Send New Email"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'new', 'model': 'crm.claim'}"
icon="gtk-go-forward" type="action" />
<field name="message_ids" colspan="4" nolabel="1" mode="form,tree" height="280">
<form string="Communication history">
<group col="6" colspan="4">
<field name="date"/>
<field name="email_to"/>
<field name="email_from"/>
</group>
<notebook colspan="4">
<page string="Details">
<field name="description" colspan="4" nolabel="1"/>
</page>
<page string="Attachments">
<field name="attachment_ids" colspan="4" readonly="1" nolabel="1"/>
</page>
</notebook>
<button colspan="4"
string="Reply to Last Email"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'crm.lead'}"
icon="gtk-undo" type="action" />
</form>
<tree string="Communication history">
<field name="date"/>
<field name="email_from" />
<field name="email_to"/>
<field name="description"/>
</tree>
</field>
<button colspan="4" string="Send New Email"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'new', 'model': 'crm.claim'}"
icon="gtk-go-forward" type="action" />
</page>
</notebook>

View File

@ -195,18 +195,25 @@
<field name="email_to"/>
<field name="email_from"/>
</group>
<newline/>
<field name="description" colspan="4" nolabel="1"/>
<notebook colspan="4">
<page string="Details">
<field name="description" colspan="4" nolabel="1"/>
</page>
<page string="Attachments">
<field name="attachment_ids" colspan="4" readonly="1" nolabel="1"/>
</page>
</notebook>
<button colspan="4"
string="Reply to Last Email"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'crm.fundraising'}"
icon="gtk-undo" type="action" />
string="Reply to Last Email"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'crm.fundraising'}"
icon="gtk-undo" type="action" />
</form>
<tree string="Communication history">
<field name="description"/>
<field name="email_to"/>
<field name="date"/>
<field name="email_from" />
<field name="email_to"/>
<field name="description"/>
</tree>
</field>
<button colspan="4" string="Send New Email"

View File

@ -135,18 +135,25 @@
<field name="email_to"/>
<field name="email_from"/>
</group>
<newline/>
<field name="description" colspan="4" nolabel="1"/>
<notebook colspan="4">
<page string="Details">
<field name="description" colspan="4" nolabel="1"/>
</page>
<page string="Attachments">
<field name="attachment_ids" colspan="4" readonly="1" nolabel="1"/>
</page>
</notebook>
<button colspan="4"
string="Reply to Last Email"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'crm.helpdesk'}"
icon="gtk-undo" type="action" />
string="Reply to Last Email"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'crm.helpdesk'}"
icon="gtk-undo" type="action" />
</form>
<tree string="Communication history">
<field name="description"/>
<field name="email_to"/>
<field name="date"/>
<field name="email_from" />
<field name="email_to"/>
<field name="description"/>
</tree>
</field>
<button colspan="4" string="Send New Email"

View File

@ -223,25 +223,32 @@
<page string="History">
<field name="message_ids" colspan="4" nolabel="1" mode="tree,form">
<form string="Communication history">
<group col="6" colspan="4">
<field name="date"/>
<field name="email_to"/>
<field name="email_from"/>
</group>
<newline/>
<field name="description" colspan="4" nolabel="1"/>
<button colspan="4"
string="Reply to Last Email"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'crm.lead'}"
icon="gtk-undo" type="action" />
</form>
<tree string="Communication history">
<field name="description"/>
<field name="email_to"/>
<field name="date"/>
</tree>
</field>
<group col="6" colspan="4">
<field name="date"/>
<field name="email_to"/>
<field name="email_from"/>
</group>
<notebook colspan="4">
<page string="Details">
<field name="description" colspan="4" nolabel="1"/>
</page>
<page string="Attachments">
<field name="attachment_ids" colspan="4" readonly="1" nolabel="1"/>
</page>
</notebook>
<button colspan="4"
string="Reply to Last Email"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'event.registration'}"
icon="gtk-undo" type="action" />
</form>
<tree string="Communication history">
<field name="date"/>
<field name="email_from" />
<field name="email_to"/>
<field name="description"/>
</tree>
</field>
<field name="log_ids" nolabel="1" colspan="4" mode="tree,form" readonly="1">
<tree string="Actions">
<separator string="Action Information" colspan="4"/>

View File

@ -69,7 +69,7 @@ class event_make_invoice(osv.osv_memory):
inv_rej_reason += "ID "+str(reg.id)+": Registration doesn't have any partner to invoice. \n"
continue
else:
val_invoice = pool_obj.get('account.invoice').onchange_partner_id(cr, uid, [], 'out_invoice', reg.partner_invoice_id.id, False, False)
val_invoice = inv_obj.onchange_partner_id(cr, uid, [], 'out_invoice', reg.partner_invoice_id.id, False, False)
val_invoice['value'].update({'partner_id': reg.partner_invoice_id.id})
partner_address_id = val_invoice['value']['address_invoice_id']

View File

@ -152,26 +152,33 @@
<field colspan="4" name="email_cc" string="CC"/>
</group>
<field name="message_ids" colspan="4" nolabel="1" mode="form,tree">
<form string="Communication history">
<group col="6" colspan="4">
<field name="date"/>
<field name="email_to"/>
<field name="email_from"/>
</group>
<newline/>
<field name="description" colspan="4" nolabel="1"/>
<button colspan="4"
string="Reply to Last Email"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'hr.applicant'}"
icon="gtk-undo" type="action" />
</form>
<tree string="Communication history">
<field name="description"/>
<field name="email_to"/>
<field name="date"/>
</tree>
</field>
<form string="Communication history">
<group col="6" colspan="4">
<field name="date"/>
<field name="email_to"/>
<field name="email_from"/>
</group>
<notebook colspan="4">
<page string="Details">
<field name="description" colspan="4" nolabel="1"/>
</page>
<page string="Attachments">
<field name="attachment_ids" colspan="4" readonly="1" nolabel="1"/>
</page>
</notebook>
<button colspan="4"
string="Reply to Last Email"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'hr.applicant'}"
icon="gtk-undo" type="action" />
</form>
<tree string="Communication history">
<field name="date"/>
<field name="email_from" />
<field name="email_to"/>
<field name="description"/>
</tree>
</field>
<button colspan="4" string="Send New Email"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'new', 'model': 'hr.applicant'}"

View File

@ -24,11 +24,7 @@
'version': '1.0',
'category': 'Generic Modules/Mail Service',
'description': """The generic email gateway system allows to send and receive emails
* IMAP / IMAP with SSL
* POP / POP with SSL
* SMTP / SMTP with TLS
* ACL basd access polocy
* Queing and History for Emails
* History for Emails
* Easy Integration with any Module""",
'author': 'Tiny',
'website': 'http://www.openerp.com',

View File

@ -21,6 +21,7 @@
from osv import osv, fields
import time
import base64
class one2many_domain(fields.one2many):
def set(self, cr, obj, id, field, values, user=None, context=None):
@ -54,7 +55,7 @@ class mailgate_thread(osv.osv):
'log_ids': one2many_domain('mailgate.message', 'thread_id', 'Logs', domain=[('history', '=', False)], required=False),
}
def __history(self, cr, uid, cases, keyword, history=False, email=False, details=None, email_from=False, message_id=False, context={}):
def __history(self, cr, uid, cases, keyword, history=False, subject=None, email=False, details=None, email_from=False, message_id=False, attach=[], context={}):
"""
@param self: The object pointer
@param cr: the current row, from the database cursor,
@ -64,6 +65,7 @@ class mailgate_thread(osv.osv):
@param history: Value True/False, If True it makes entry in case History otherwise in Case Log
@param email: Email address if any
@param details: Details of case history if any
@param atach: Attachment sent in email
@param context: A standard dictionary for contextual values"""
if not context:
context = {}
@ -72,8 +74,9 @@ class mailgate_thread(osv.osv):
cases = self.pool.get(context['model']).browse(cr, uid, cases, context=context)
model_obj = self.pool.get('ir.model')
att_obj = self.pool.get('ir.attachment')
obj = self.pool.get('mailgate.message')
for case in cases:
model_ids = model_obj.search(cr, uid, [('model', '=', case._name)])
data = {
@ -84,10 +87,13 @@ class mailgate_thread(osv.osv):
'thread_id': case.thread_id.id,
'message_id': message_id,
}
attachments = []
if history:
for att in attach:
attachments.append(att_obj.create(cr, uid, {'name': att[0], 'datas': base64.encodestring(att[1])}))
data = {
'name': keyword,
'name': subject or 'History',
'history': True,
'user_id': uid,
'model_id' : model_ids and model_ids[0] or False,
@ -103,6 +109,7 @@ class mailgate_thread(osv.osv):
'partner_id': hasattr(case, 'partner_id') and (case.partner_id and case.partner_id.id or False) or False,
'thread_id': case.thread_id.id,
'message_id': message_id,
'attachment_ids': [(6, 0, attachments)]
}
res = obj.create(cr, uid, data, context)
return True

View File

@ -27,7 +27,7 @@
</page>
<page string="Attachments">
<separator string="Attachments" colspan="4"/>
<field name="attachment_ids" nolabel="1" colspan="4" />
<field name="attachment_ids" nolabel="1" colspan="4" readonly="1"/>
</page>
</notebook>
</form>

View File

@ -112,20 +112,27 @@
<field name="date"/>
<field name="email_to"/>
<field name="email_from"/>
</group>
<newline/>
<field name="description" colspan="4" nolabel="1"/>
<button colspan="4"
string="Reply to Last Email"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'project.issue'}"
icon="gtk-undo" type="action" />
</form>
<tree string="Communication history">
<field name="description"/>
<field name="email_to"/>
<field name="date"/>
</tree>
</group>
<notebook colspan="4">
<page string="Details">
<field name="description" colspan="4" nolabel="1"/>
</page>
<page string="Attachments">
<field name="attachment_ids" colspan="4" readonly="1" nolabel="1"/>
</page>
</notebook>
<button colspan="4"
string="Reply to Last Email"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'project.issue'}"
icon="gtk-undo" type="action" />
</form>
<tree string="Communication history">
<field name="date"/>
<field name="email_from" />
<field name="email_to"/>
<field name="description"/>
</tree>
</field>
<button colspan="4" string="Send New Email"
name="%(crm.action_crm_send_mail)d"

View File

@ -261,12 +261,10 @@ class purchase_order(osv.osv):
self.write(cr, uid, ids, {'state': 'approved', 'date_approve': time.strftime('%Y-%m-%d')})
return True
#TODO: implement messages system
def wkf_confirm_order(self, cr, uid, ids, context={}):
todo = []
for po in self.browse(cr, uid, ids):
if self.pool.get('res.partner.event.type').check(cr, uid, 'purchase_open'):
self.pool.get('res.partner.event').create(cr, uid, {'name':'Purchase Order: '+po.name, 'partner_id':po.partner_id.id, 'date':time.strftime('%Y-%m-%d %H:%M:%S'), 'user_id':uid, 'partner_type':'retailer', 'probability': 1.0, 'planned_cost':po.amount_untaxed})
for po in self.browse(cr, uid, ids):
if not po.order_line:
raise osv.except_osv(_('Error !'),_('You can not confirm purchase order without Purchase Order Lines.'))
for line in po.order_line:

View File

@ -7,11 +7,6 @@
<field name="object">purchase.order</field>
</record>
<record id="event_type_purchase_open" model="res.partner.event.type">
<field name="name">Purchase: Purchase Confirmation</field>
<field name="key">purchase_open</field>
</record>
<record id="pricelist_type_purchase" model="product.pricelist.type">
<field name="name">Purchase Pricelist</field>
<field name="key">purchase</field>

View File

@ -9,16 +9,6 @@
<field name="object">sale.order</field>
</record>
<!--
Partner event type
-->
<record id="event_type_sale_open" model="res.partner.event.type">
<field name="name">SALE: Sale Confirmation</field>
<field name="key">sale_open</field>
</record>
<!--
Resource: sale.shop
-->