[IMP] misc useability improvements

bzr revid: fp@tinyerp.com-20101008144049-2deun7vlgd6ek1be
This commit is contained in:
Fabien Pinckaers 2010-10-08 16:40:49 +02:00
parent 4f284c3ac2
commit 900be54ed6
18 changed files with 82 additions and 551 deletions

View File

@ -49,6 +49,10 @@ module named account_voucher.
'security/ir.model.access.csv',
'account_menuitem.xml',
'account_wizard.xml',
'report/account_invoice_report_view.xml',
'report/account_entries_report_view.xml',
'report/account_report_view.xml',
'report/account_analytic_entries_report_view.xml',
'wizard/account_move_bank_reconcile_view.xml',
'wizard/account_use_model_view.xml',
'account_installer.xml',
@ -106,10 +110,6 @@ module named account_voucher.
'process/supplier_invoice_process.xml',
'sequence_view.xml',
'company_view.xml',
'report/account_invoice_report_view.xml',
'report/account_entries_report_view.xml',
'report/account_report_view.xml',
'report/account_analytic_entries_report_view.xml',
'board_account_view.xml',
"wizard/account_report_profit_loss_view.xml",
"wizard/account_report_balance_sheet_view.xml"

View File

@ -308,9 +308,10 @@
<button name="action_cancel_draft" states="cancel" string="Reset to Draft" type="object" icon="terp-stock_effects-object-colorize"/>
<button name="invoice_proforma2" states="draft" string="PRO-FORMA" icon="terp-gtk-media-pause" groups="account.group_account_user"/>
<button name="invoice_open" states="draft,proforma2" string="Create" icon="terp-camera_test"/>
<button name="invoice_open" states="draft,proforma2" string="Validate" icon="gtk-go-forward"/>
<button name="%(action_account_invoice_refund)d" type='action' string='Refund' states='open,paid' icon="gtk-execute"/>
<button name='%(action_account_state_open)d' type='action' string='Re-Open' states='paid' icon="gtk-convert" groups="base.group_no_one"/>
<button name="%(account_invoices)d" type='action' string='Print' states='open' icon="gtk-print"/>
</group>
</group>
</page>

View File

@ -25,7 +25,7 @@
<menuitem id="menu_configuration_misc" name="Miscellaneous" parent="menu_finance_configuration" sequence="30" groups="group_account_manager"/>
<menuitem id="base.menu_action_currency_form" parent="menu_configuration_misc" sequence="20"/>
<menuitem id="menu_finance_generic_reporting" name="Generic Reporting" parent="menu_finance_reporting" sequence="100" groups="group_account_manager"/>
<menuitem id="menu_finance_entries" name="Accounting" parent="menu_finance" sequence="4"
<menuitem id="menu_finance_entries" name="Journal Entries" parent="menu_finance" sequence="4"
groups="group_account_user,group_account_manager"/>
<menuitem id="account.menu_finance_recurrent_entries" name="Recurring Entries" parent="menu_finance_periodical_processing" sequence="15" groups="base.group_extended"/>

View File

@ -86,7 +86,7 @@ class base_setup_company(osv.osv_memory):
'street2':fields.char('Street 2', size=128),
'zip':fields.char('Zip Code', size=24),
'city':fields.char('City', size=128),
'state_id':fields.selection(_get_all_states, 'State'),
'state_id':fields.selection(_get_all_states, 'Fed. State'),
'country_id':fields.selection(_get_all_countries, 'Country'),
'email':fields.char('E-mail', size=64),
'phone':fields.char('Phone', size=64),
@ -105,7 +105,7 @@ We suggest you to put bank information here:
IBAN: BE74 1262 0121 6907 - SWIFT: CPDF BE71 - VAT: BE0477.472.701'''),
'logo':fields.binary('Logo'),
'account_no':fields.char('Account No', size=64),
'website': fields.char('Web', size=64),
'website': fields.char('Company Website', size=64, help="Exemple: http://openerp.com"),
}
def execute(self, cr, uid, ids, context=None):

View File

@ -670,85 +670,3 @@ class res_partner(osv.osv):
}
res_partner()
class crm_case_section_custom(osv.osv):
_name = "crm.case.section.custom"
_description = 'Custom CRM Case Teams'
_columns = {
'name': fields.char('Case Team',size=64, required=True, translate=True),
'code': fields.char('Team Code',size=8),
'active': fields.boolean('Active'),
'allow_unlink': fields.boolean('Allow Delete', help="Allows to delete non draft cases"),
'sequence': fields.integer('Sequence'),
'user_id': fields.many2one('res.users', 'Responsible User'),
'reply_to': fields.char('Reply-To', size=64, help="The email address put in the 'Reply-To' of all emails sent by OpenERP about cases in this section"),
'parent_id': fields.many2one('crm.case.section.custom', 'Parent Team'),
'note': fields.text('Notes'),
}
_defaults = {
'active': 1,
'allow_unlink': 1,
}
_sql_constraints = [
('code_uniq', 'unique (code)', 'The code of the team must be unique !')
]
def _check_recursion(self, cr, uid, ids):
level = 100
while len(ids):
cr.execute('SELECT DISTINCT parent_id FROM crm_case_section_custom '\
'WHERE id IN %s',
(tuple(ids),))
ids = filter(None, map(lambda x:x[0], cr.fetchall()))
if not level:
return False
level -= 1
return True
_constraints = [
(_check_recursion, 'Error ! You cannot create recursive sections.', ['parent_id'])
]
crm_case_section_custom()
class crm_case_custom(osv.osv, crm_case):
_name = 'crm.case.custom'
_inherit = 'mailgate.thread'
_description = "Custom CRM Case"
_columns = {
'id': fields.integer('ID', readonly=True),
'name': fields.char('Name',size=64,required=True),
'priority': fields.selection(AVAILABLE_PRIORITIES, 'Priority'),
'active': fields.boolean('Active'),
'description': fields.text('Description'),
'section_id': fields.many2one('crm.case.section.custom', 'Team', required=True, select=True),
'probability': fields.float('Probability (%)'),
'email_from': fields.char('Partner Email', size=128),
'email_cc': fields.char('CC', size=252),
'partner_id': fields.many2one('res.partner', 'Partner'),
'partner_address_id': fields.many2one('res.partner.address', 'Partner Contact', domain="[('partner_id','=',partner_id)]"),
'date': fields.datetime('Date'),
'create_date': fields.datetime('Created' ,readonly=True),
'date_deadline': fields.datetime('Deadline'),
'date_closed': fields.datetime('Closed', readonly=True),
'user_id': fields.many2one('res.users', 'Responsible'),
'state': fields.selection(AVAILABLE_STATES, 'Status', size=16, readonly=True),
'ref' : fields.reference('Reference', selection=_links_get, size=128),
'date_action_last': fields.datetime('Last Action', readonly=1),
'date_action_next': fields.datetime('Next Action', readonly=1),
}
_defaults = {
'active': 1,
'state': 'draft',
'priority': AVAILABLE_PRIORITIES[2][0],
'date': time.strftime('%Y-%m-%d %H:%M:%S'),
}
crm_case_custom()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -102,7 +102,7 @@ class crm_lead(crm_case, osv.osv):
# Overridden from res.partner.address:
'partner_id': fields.many2one('res.partner', 'Partner', ondelete='set null',
select=True, help="Optional linked partner, usually after conversion of the lead"),
# From crm.case
'id': fields.integer('ID'),
'name': fields.char('Name', size=64),
@ -125,7 +125,7 @@ class crm_lead(crm_case, osv.osv):
'channel_id': fields.many2one('res.partner.canal', 'Channel'),
'contact_name': fields.char('Contact Name', size=64),
'partner_name': fields.char("Partner Name", size=64),
'partner_name': fields.char("Customer Name", size=64),
'optin': fields.boolean('Opt-In', help="If opt-in is checked, this contact has accepted to receive emails."),
'optout': fields.boolean('Opt-Out', help="If opt-out is checked, this contact has refused to receive emails or unsubscribed to a campaign."),
'type':fields.selection([
@ -315,10 +315,8 @@ class crm_lead(crm_case, osv.osv):
vals.update(res)
res = self.create(cr, uid, vals, context)
message = _('A Lead created') + " '" + subject + "' " + _("from Mailgate.")
self.log(cr, uid, res, message)
attachents = msg.get('attachments', [])
for attactment in attachents or []:
data_attach = {

View File

@ -49,18 +49,17 @@
<button
name="convert_opportunity"
string="Convert to Opportunity"
help="Convert to Opportunity"
icon="gtk-index"
help="Convert to Opportunity" icon="gtk-go-forward"
type="object"/>
<newline />
<field name="section_id" widget="selection" />
<field name="user_id" />
<field name="stage_id" readonly="1"/>
<group col="2" colspan="1">
<button name="stage_previous" string="Previous"
<button name="stage_previous" string=""
states="open,pending,draft" type="object"
icon="gtk-go-back" />
<button name="stage_next" string="Next"
<button name="stage_next" string=""
states="open,pending,draft" type="object"
icon="gtk-go-forward" />
</group>
@ -75,7 +74,7 @@
<separator string="Contact" colspan="4" col="4"/>
<field name="contact_name" colspan="4"/>
<newline/>
<field domain="[('domain', '=', 'contact')]" name="title"/>
<field domain="[('domain', '=', 'contact')]" name="title" widget="selection"/>
<field name="function" />
<field name="street" colspan="4"/>
<field name="street2" colspan="4"/>
@ -95,7 +94,7 @@
<field name="mobile"/>
<newline/>
<separator string="Links" colspan="4" col="3"/>
<field name="partner_id" on_change="onchange_partner_id(partner_id, email_from)"/>
<field name="partner_id" on_change="onchange_partner_id(partner_id, email_from)" string="Customer"/>
<button
name="%(action_crm_lead2partner)d"
icon="gtk-index" type="action"
@ -107,20 +106,20 @@
<separator colspan="4"/>
<group col="8" colspan="4">
<field name="state"/>
<button name="case_cancel" string="Cancel"
states="draft,open,pending" type="object"
icon="gtk-cancel" />
<button name="case_open" string="Open"
states="draft,pending" type="object"
icon="gtk-go-forward" />
<button name="case_mark_lost" string="Close"
states="open,draft,pending" type="object"
states="open,pending" type="object"
icon="gtk-close" />
<button name="case_pending" string="Pending"
states="draft,open" type="object"
states="open" type="object"
icon="gtk-media-pause" />
<button name="case_cancel" string="Cancel"
states="draft,open,pending" type="object"
icon="gtk-cancel" />
<button name="case_escalate" string="Escalate"
states="open,draft,pending" type="object"
states="open,pending" type="object"
groups="base.group_extended"
icon="gtk-go-up" />
<button name="case_reset"
@ -251,7 +250,7 @@
icon="gtk-close" />
<button string="Convert to Opportunity"
name="convert_opportunity"
states="draft,open,pending" icon="gtk-index"
states="draft,open,pending" icon="gtk-go-forward"
type="object" />
<button name="case_escalate" string="Escalate"
states="open,draft,pending" type="object"

View File

@ -46,7 +46,7 @@
<separator colspan="4" string="Contacts"/>
<group colspan="2">
<field name="partner_id" select="1"
on_change="onchange_partner_id(partner_id, email_from)"
on_change="onchange_partner_id(partner_id, email_from)" string="Customer"
colspan="2" />
<button name="%(action_crm_lead2partner)d"
icon="gtk-index" type="action"
@ -101,9 +101,9 @@
<page string="Lead">
<group colspan="2" col="4">
<separator string="Contact" colspan="4" col="4"/>
<field name="partner_name" string="Partner Name" colspan="4"/>
<field name="partner_name" string="Customer Name" colspan="4"/>
<newline/>
<field domain="[('domain', '=', 'contact')]" name="title"/>
<field domain="[('domain', '=', 'contact')]" name="title" widget="selection"/>
<field name="function" />
<field name="street" colspan="4"/>
<field name="street2" colspan="4"/>
@ -216,7 +216,7 @@
<field name="date_deadline" invisible="1"/>
<field name="create_date"/>
<field name="name" string="Opportunity"/>
<field name="partner_id"/>
<field name="partner_id" string="Customer"/>
<field name="country_id" invisible="context.get('invisible_country', True)" />
<field name="date_action"/>
<field name="title_action" />
@ -284,7 +284,7 @@
domain="[('state','=','pending')]"/>
<separator orientation="vertical"/>
<field name="name" string="Opportunity"/>
<field name="partner_id"/>
<field name="partner_id" string="Customer"/>
<field name="user_id">
<filter icon="terp-personal-"
domain="[('user_id','=', False)]"

View File

@ -402,257 +402,5 @@
</record>
<!-- Custom Case Sections -->
<record id="crm_case_section_custom_view_form" model="ir.ui.view">
<field name="name">crm.case.section.custom.form</field>
<field name="model">crm.case.section.custom</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Custom Case Section">
<group col="6" colspan="4">
<field name="name" select="1" colspan="2"/>
<field name="parent_id" select="2" widget="selection"/>
<field name="code" select="1"/>
<newline/>
<field name="user_id" select="2"/>
<field name="active" select="2"/>
</group>
<notebook colspan="4">
<page string="Information">
<group col="2" colspan="1">
<separator string="Mailgateway" colspan="2"/>
<field name="reply_to" select="2"/>
</group>
<group col="2" colspan="1">
<separator string="Configuration" colspan="2"/>
<field name="allow_unlink" select="2"/>
</group>
</page>
<page string="Notes">
<field name="note" select="1" colspan="4" nolabel="1"/>
</page>
</notebook>
</form>
</field>
</record>
<record id="crm_case_section_custom_view_tree" model="ir.ui.view">
<field name="name">crm.case.section.custom.tree</field>
<field name="model">crm.case.section.custom</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Custom Case Teams">
<field name="name" select="1"/>
<field name="code" select="1"/>
<field name="user_id" select="1"/>
</tree>
</field>
</record>
<!-- Custom crm case-->
<record id="crm_case_custom_tree_view" model="ir.ui.view">
<field name="name">Custom Cases - Tree</field>
<field name="model">crm.case.custom</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree colors="red:date_deadline&lt;current_date and state=='open'" string="Custom Cases">
<field name="id"/>
<field name="date"/>
<field name="date_deadline"/>
<field name="name"/>
<field name="partner_id"/>
<field name="user_id"/>
<field name="priority"/>
<field name="state"/>
<field name="create_date" invisible="1"/>
</tree>
</field>
</record>
<record id="crm_case_custom_form_view" model="ir.ui.view">
<field name="name">Custom Cases - Form</field>
<field name="model">crm.case.custom</field>
<field name="type">form</field>
<field name="priority" eval="1"/>
<field name="arch" type="xml">
<form string="Custom Cases">
<group colspan="4" col="6">
<field name="name" select="1"/>
<field name="section_id" widget="selection"/>
<field name="user_id" select="1"/>
<field name="priority"/>
<field name="date" select="1"/>
<field name="date_deadline" select="2"/>
</group>
<notebook colspan="4">
<page string="General">
<group col="4" colspan="4">
<separator string="Communication" colspan="4"/>
<field name="partner_id" on_change="onchange_partner_id(partner_id, email_from)" select="1"/>
<field name="partner_address_id" on_change="onchange_partner_address_id(partner_address_id, email_from)" select="2"/>
<newline/>
<field name="email_from" select="2"/>
</group>
<separator string="Notes" colspan="4"/>
<field colspan="4" name="description" nolabel="1" select="2"/>
<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_close" string="Close"
states="open,draft,pending" type="object"
icon="gtk-close" />
<button name="case_pending" string="Pending"
states="draft,open" type="object"
icon="gtk-media-pause" />
<button name="case_cancel" string="Cancel"
states="draft,open,pending" type="object"
icon="gtk-cancel" />
<button name="case_reset"
string="Reset to Draft" states="done,cancel"
type="object" icon="gtk-convert" />
</group>
</page>
<page string="Extra Info">
<separator colspan="4" string="Dates"/>
<field name="create_date"/>
<field name="date_closed"/>
<field name="date_action_last"/>
<field name="date_action_next"/>
<separator colspan="4" string="Others"/>
<field name="id" select="1"/>
<field name="active" select="2"/>
<separator colspan="4" string="References"/>
<field colspan="4" name="ref"/>
</page>
<page string="Emails" groups="base.group_extended">
<group colspan="4">
<field colspan="4" name="email_cc" widget="char" size="512"/>
</group>
<field name="message_ids" colspan="4" nolabel="1" mode="tree,form">
<tree string="History">
<field name="display_text" string="History Information"/>
<field name="history" invisible="1"/>
<button
string="Reply" attrs="{'invisible': [('history', '!=', True)]}"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'crm.case.custom', 'include_original' : True}"
icon="terp-mail-replied" type="action" />
</tree>
<form string="History">
<group col="4" colspan="4">
<field name="email_from"/>
<field name="date"/>
<field name="email_to" widget="char" size="512"/>
<field name="email_cc" widget="char" size="512"/>
<field name="name" colspan="4" widget="char" size="512"/>
<field name="history" invisible="1"/>
</group>
<notebook colspan="4">
<page string="Details">
<group attrs="{'invisible': [('history', '!=', True)]}">
<field name="description" colspan="4" nolabel="1" height="250"/>
<button colspan="4"
string="Reply"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'crm.case.custom', 'include_original' : True}"
icon="terp-mail-replied" type="action" />
</group>
<group attrs="{'invisible': [('history', '=', True)]}">
<field name="display_text" colspan="4" nolabel="1" height="250"/>
</group>
</page>
<page string="Attachments">
<field name="attachment_ids" colspan="4" readonly="1" nolabel="1"/>
</page>
</notebook>
</form>
</field>
<button string="Add Internal Note"
name="%(crm.action_crm_add_note)d"
context="{'model': 'crm.lead' }"
icon="terp-document-new" type="action" />
<button string="Send New Email"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'new', 'model': 'crm.case.custom'}"
icon="terp-mail-message-new" type="action" />
</page>
</notebook>
</form>
</field>
</record>
<record model="ir.ui.view" id="crm_case_custom_calendar_view">
<field name="name">Custom Cases - Calendar</field>
<field name="model">crm.case.custom</field>
<field name="type">calendar</field>
<field name="priority" eval="2"/>
<field name="arch" type="xml">
<calendar string="Cases"
date_start="date" color="user_id">
<field name="name" />
<field name="partner_id" />
</calendar>
</field>
</record>
<!-- Custom Cases Search View -->
<record id="crm_case_custom_search_view" model="ir.ui.view">
<field name="name">Custom Cases - Search</field>
<field name="model">crm.case.custom</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Search Cases">
<filter icon="terp-check"
string="Current"
default="1" name="current"
domain="[('state','in',('draft','open'))]"/>
<filter icon="terp-camera_test"
string="Open"
domain="[('state','=','open')]"/>
<filter icon="terp-gtk-media-pause"
string="Pending"
domain="[('state','=','pending')]"/>
<separator orientation="vertical"/>
<filter icon="terp-go-today" string="Today"
domain="[('create_date','&lt;', time.strftime('%%Y-%%m-%%d 23:59:59')), ('create_date','&gt;=', time.strftime('%%Y-%%m-%%d 00:00:00'))]"
help="Todays' Cases" />
<filter icon="terp-go-week" string="7 Days"
help="Cases creating during last 7 days"
domain="[('create_date','&lt;', time.strftime('%%Y-%%m-%%d 23:59:59')),('create_date','&gt;=',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d 00:00:00'))]"
/>
<separator orientation="vertical"/>
<field name="name"/>
<field name="user_id">
<filter icon="terp-personal-"
domain="[('user_id','=', False)]"
help="Unassigned Cases" />
</field>
<newline/>
<group expand="0" string="Extended options..." groups="base.group_extended">
<field name="create_date" string="Creation Date"/>
<field name="date_closed"/>
</group>
<newline/>
<group expand="0" string="Group By...">
<filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
<filter string="Priority" icon="terp-rating-rated"
domain="[]" context="{'group_by':'priority'}" />
<separator orientation="vertical"/>
<filter string="Salesman" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}"/>
<filter string="Partner" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/>
<separator orientation="vertical"/>
<filter string="Creation" icon="terp-go-month"
domain="[]" context="{'group_by':'create_date'}" />
</group>
</search>
</field>
</record>
</data>
</openerp>

View File

@ -38,10 +38,6 @@
"access_res_partner_category","res.partner.category.crm.user","base.model_res_partner_category","base.group_sale_salesman",1,1,1,0
"mail_gateway_mailgate_message","mail_gateway.mailgate.message","mail_gateway.model_mailgate_message","base.group_system",1,1,1,1
"mail_gateway_mailgate_thread","mail_gateway.mailgate.thread","mail_gateway.model_mailgate_thread","base.group_sale_salesman",1,1,1,1
"access_crm_case_section_custom_user","crm.case.section.custom.user","model_crm_case_section_custom","base.group_sale_salesman",1,0,0,0
"access_crm_case_section_custom_manager","crm.case.section.custom.manager","model_crm_case_section_custom","base.group_sale_manager",1,1,1,1
"access_crm_case_custom_user","crm.case.custom.user","model_crm_case_custom","base.group_sale_salesman",1,1,1,1
"access_crm_case_custom_manager","crm.case.custom.manager","model_crm_case_custom","base.group_sale_manager",1,1,1,1
"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

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
38 access_res_partner_category res.partner.category.crm.user base.model_res_partner_category base.group_sale_salesman 1 1 1 0
39 mail_gateway_mailgate_message mail_gateway.mailgate.message mail_gateway.model_mailgate_message base.group_system 1 1 1 1
40 mail_gateway_mailgate_thread mail_gateway.mailgate.thread mail_gateway.model_mailgate_thread base.group_sale_salesman 1 1 1 1
access_crm_case_section_custom_user crm.case.section.custom.user model_crm_case_section_custom base.group_sale_salesman 1 0 0 0
access_crm_case_section_custom_manager crm.case.section.custom.manager model_crm_case_section_custom base.group_sale_manager 1 1 1 1
access_crm_case_custom_user crm.case.custom.user model_crm_case_custom base.group_sale_salesman 1 1 1 1
access_crm_case_custom_manager crm.case.custom.manager model_crm_case_custom base.group_sale_manager 1 1 1 1
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

View File

@ -98,7 +98,6 @@ class crm_lead2opportunity(osv.osv_memory):
'type': 'ir.actions.act_window',
'search_view_id': res['res_id']
}
return value
_columns = {
@ -124,9 +123,6 @@ class crm_lead2opportunity(osv.osv_memory):
if lead.state in ['done', 'cancel']:
raise osv.except_osv(_("Warning !"), _("Closed/Cancelled \
Leads Could not convert into Opportunity"))
if lead.state not in ('open', 'pending'):
raise osv.except_osv(_('Warning !'), _('Lead should be in \
\'Open\' or \'Pending\' state before converting to Opportunity.'))
return False
def default_get(self, cr, uid, fields, context=None):
@ -284,9 +280,6 @@ class crm_lead2opportunity_partner(osv.osv_memory):
if lead.state in ['done', 'cancel']:
raise osv.except_osv(_("Warning !"), _("Closed/Cancelled \
Leads Could not convert into Opportunity"))
if lead.state not in ('open', 'pending'):
raise osv.except_osv(_('Warning !'), _('Lead should be in \
\'Open\' or \'Pending\' state before converting to Opportunity.'))
return False
crm_lead2opportunity_partner()
@ -297,16 +290,12 @@ class crm_lead2opportunity_action(osv.osv_memory):
'''
_name = 'crm.lead2opportunity.action'
_description = 'Convert/Merge Opportunity'
_columns = {
'name': fields.selection([('convert', 'Convert to Opportunity'), ('merge', 'Merge with existing Opportunity')],'Select Action', required=True),
}
_defaults = {
'name': 'convert',
}
}
def do_action(self, cr, uid, ids, context=None):
"""
This function opens form according to selected Action

View File

@ -11,7 +11,7 @@
<form string="Convert To Opportunity">
<field name="name"/>
<group attrs="{'invisible':[('partner_id','=',False)]}" col="2" colspan="2">
<field name="partner_id"/>
<field name="partner_id"/>
</group>
<newline/>
<field name="planned_revenue"/>
@ -20,7 +20,7 @@
<group col="4" colspan="4">
<label string="" colspan="2"/>
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
<button name="action_apply" string="Create Opportunity" type="object" icon="gtk-ok"/>
<button name="action_apply" string="Create Opportunity" type="object" icon="gtk-go-forward"/>
</group>
</form>
</field>

View File

@ -507,6 +507,7 @@ class sale_order(osv.osv):
if order.order_policy == 'picking':
picking_obj.write(cr, uid, map(lambda x: x.id, order.picking_ids), {'invoice_state': 'invoiced'})
cr.execute('insert into sale_order_invoice_rel (order_id,invoice_id) values (%s,%s)', (order.id, res))
return res
def action_invoice_cancel(self, cr, uid, ids, context=None):
@ -1175,7 +1176,7 @@ class sale_config_picking_policy(osv.osv_memory):
'picking_policy': fields.selection([
('direct', 'Direct Delivery'),
('one', 'All at Once')
], 'Picking Default Policy', required=True, help="The Shipping Policy is used to synchronise invoices and delivery operations."),
], 'Picking Default Policy', required=True, help="The Shipping Policy is used to configure per order if you want to deliver as soon as possible when one product is available or you wait that all products are available.."),
'order_policy': fields.selection([
('manual', 'Invoice Based on Sales Orders'),
('picking', 'Invoice Based on Deliveries'),

View File

@ -199,17 +199,17 @@
</group>
<group col="13" colspan="4">
<field name="state"/>
<button name="order_confirm" states="draft" string="Confirm Order" icon="gtk-apply"/>
<button name="invoice_recreate" states="invoice_except" string="Recreate Invoice" icon="gtk-print"/>
<button name="invoice_recreate" states="invoice_except" string="Recreate Invoice" icon="gtk-go-forward"/>
<button name="invoice_corrected" states="invoice_except" string="Invoice Corrected" icon="gtk-apply"/>
<button name="ship_recreate" states="shipping_except" string="Recreate Procurement" icon="gtk-ok"/>
<button name="ship_corrected" states="shipping_except" string="Procurement Corrected" icon="gtk-apply"/>
<button name="action_cancel" states="manual,progress" string="Cancel Order" type="object" icon="gtk-cancel"/>
<button name="manual_invoice" states="manual" string="Create Invoice" icon="terp-document-new"/>
<button name="manual_invoice" states="manual" string="Create Invoice" icon="gtk-go-forward"/>
<button name="ship_cancel" states="shipping_except" string="Cancel Order" icon="gtk-cancel"/>
<button name="action_cancel_draft" states="cancel" string="Set to Draft" type="object" icon="gtk-convert"/>
<button name="cancel" states="draft" string="Cancel Order" icon="gtk-cancel"/>
<button name="invoice_cancel" states="invoice_except" string="Cancel Order" icon="gtk-cancel"/>
<button name="order_confirm" states="draft" string="Confirm Order" icon="gtk-apply"/>
</group>
</page>
<page string="Other Information">
@ -549,7 +549,6 @@ to your configuration: from the sales order, from the pickings, etc.
<field name="step"/>
</group>
<xpath expr='//button[@name="action_skip"]' position='replace'/>
</data>
</field>
</record>

View File

@ -1,47 +1,47 @@
<?xml version="1.0"?>
<openerp>
<data>
<data>
<record model="ir.ui.view" id="crm_case_form_view_oppor">
<field name="name">CRM - Opportunities - Quote Inherit</field>
<field name="model">crm.lead</field>
<field name="type">form</field>
<field name="inherit_id" ref="crm.crm_case_form_view_oppor"/>
<field name="arch" type="xml">
<field name="priority" position="after">
<button string="Convert to Sale" icon="gtk-go-forward" name="%(action_crm_make_sale)d" type="action"/>
</field>
</field>
</record>
<record model="ir.ui.view" id="crm_case_form_view_oppor">
<field name="name">CRM - Opportunities - Quote Inherit</field>
<field name="model">crm.lead</field>
<field name="type">form</field>
<field name="inherit_id" ref="crm.crm_case_form_view_oppor"/>
<field name="arch" type="xml">
<field name="priority" position="after">
<button string="Convert to Quote" icon="gtk-go-forward" name="%(action_crm_make_sale)d" type="action"/>
</field>
</field>
</record>
<record model="ir.ui.view" id="sale_view_inherit123">
<field name="name">sale.order.inherit</field>
<field name="model">sale.order</field>
<field name="type">form</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<field name="user_id" position="after">
<field name="section_id" widget="selection" groups="base.group_extended"/>
</field>
</field>
</record>
<record model="ir.ui.view" id="sale_view_inherit123">
<field name="name">sale.order.inherit</field>
<field name="model">sale.order</field>
<field name="type">form</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<field name="user_id" position="after">
<field name="section_id" widget="selection" groups="base.group_extended"/>
</field>
</field>
</record>
<record id="view_sales_order_filter_inherit" model="ir.ui.view">
<field name="name">sale.order.list.select</field>
<field name="model">sale.order</field>
<field name="type">search</field>
<field name="inherit_id" ref="sale.view_sales_order_filter"/>
<field name="arch" type="xml">
<field name="date_order" position="after">
<field name="section_id" default="context.get('section_id', False)" widget="selection" string="Sales Team" groups="base.group_extended">
<filter icon="terp-personal+"
domain="[('section_id.user_id','=',uid)]"
groups="base.group_extended"
help="My Sales Team(s)"/>
</field>
</field>
</field>
</record>
<record id="view_sales_order_filter_inherit" model="ir.ui.view">
<field name="name">sale.order.list.select</field>
<field name="model">sale.order</field>
<field name="type">search</field>
<field name="inherit_id" ref="sale.view_sales_order_filter"/>
<field name="arch" type="xml">
<field name="date_order" position="after">
<field name="section_id" default="context.get('section_id', False)" widget="selection" string="Sales Team" groups="base.group_extended">
<filter icon="terp-personal+"
domain="[('section_id.user_id','=',uid)]"
groups="base.group_extended"
help="My Sales Team(s)"/>
</field>
</field>
</field>
</record>
</data>
</openerp>
</data>
</openerp>

View File

@ -23,14 +23,6 @@
-
!record {model: crm.make.sale, id: crm_make_sale_0}:
partner_id: base.res_partner_4
sale_order_line:
- name: '[KEYA] Keyboard - AZERTY'
price_unit: 7.0
product_uom: product.product_uom_unit
product_uom_qty: 50.0
delay: 7.0
product_id: product.product_product_24
type: make_to_stock
shop_id: sale.shop
-
Then I click on the 'Ok' button of wizard
@ -47,4 +39,4 @@
-
!python {model: crm.lead}: |
crm = self.browse(cr, uid, ref("crm_lead_opportunity0"))
assert (crm.ref),("sale order has not been created")
assert (crm.ref),("sale order has not been created")

View File

@ -76,7 +76,6 @@ class crm_make_sale(osv.osv_memory):
case_obj = self.pool.get('crm.lead')
sale_obj = self.pool.get('sale.order')
partner_obj = self.pool.get('res.partner')
sale_line_obj = self.pool.get('sale.order.line')
data = context and context.get('active_ids', []) or []
@ -115,30 +114,10 @@ class crm_make_sale(osv.osv_memory):
if partner.id:
vals['user_id'] = partner.user_id and partner.user_id.id or uid
if make.analytic_account.id:
vals['project_id'] = make.analytic_account.id
new_id = sale_obj.create(cr, uid, vals)
for line in make.sale_order_line:
value = {
'order_id': new_id,
'name': line.name,
'delay': line.delay,
'product_id': line.product_id and line.product_id.id or False,
'price_unit': line.price_unit,
'tax_id': line.tax_id and [(6, 0, map(lambda x: x.id, line.tax_id))] or False,
'type': line.type,
'product_uom_qty': line.product_uom_qty,
'product_uom': line.product_uom.id,
'product_uos_qty': line.product_uos_qty,
'product_uos': line.product_uos and line.product_uos.id or False,
'product_packaging': line.product_packaging and line.product_packaging.id or False,
'discount': line.discount,
'notes': line.notes
}
sale_line_obj.create(cr, uid, value, context=context)
case_obj.write(cr, uid, [case.id], {'ref': 'sale.order,%s' % new_id})
new_ids.append(new_id)
message = _('Opportunity ') + " '" + case.name + "' "+ _("is converted to Sales Quotation.")
message = _('Opportunity ') + " '" + case.name + "' "+ _("is converted to Quotation.")
self.log(cr, uid, case.id, message)
if make.close:
@ -178,8 +157,6 @@ class crm_make_sale(osv.osv_memory):
_columns = {
'shop_id': fields.many2one('sale.shop', 'Shop', required=True),
'partner_id': fields.many2one('res.partner', 'Customer', required=True),
'sale_order_line': fields.one2many('sale.order.make.line', 'opportunity_order_id', 'Product Line'),
'analytic_account': fields.many2one('account.analytic.account', 'Analytic Account'),
'close': fields.boolean('Close Opportunity', help='Check this to close the opportunity after having created the sale order.'),
}
_defaults = {
@ -189,48 +166,3 @@ class crm_make_sale(osv.osv_memory):
}
crm_make_sale()
class sale_order_make_line(osv.osv_memory):
def product_id_change(self, cr, uid, ids, product, qty=0,
uom=False, qty_uos=0, uos=False, name='', partner_id=False,
lang=False, update_tax=True, packaging=False, flag=False):
if not partner_id:
raise osv.except_osv(_('No Customer Defined !'), _('You have to select a customer in the sale form !\nPlease set one customer before choosing a product.'))
date_order = time.strftime('%Y-%m-%d')
part = self.pool.get('res.partner').browse(cr, uid, partner_id)
pricelist = part.property_product_pricelist and part.property_product_pricelist.id or False
fiscal_position = part.property_account_position and part.property_account_position.id or False
return self.pool.get('sale.order.line').product_id_change(cr, uid, ids, pricelist, product, qty, uom, qty_uos, uos, name, partner_id, lang, update_tax, date_order, packaging, fiscal_position, flag)
_name = 'sale.order.make.line'
_description = 'Opportunity Sale Order Line'
_columns = {
'opportunity_order_id': fields.many2one('crm.make.sale', 'Order Reference', required=True, ondelete='cascade', select=True, readonly=True,),
'name': fields.char('Description', size=256, required=True, select=True,),
'delay': fields.float('Delivery Lead Time', required=True, help="Number of days between the order confirmation the the shipping of the products to the customer"),
'product_id': fields.many2one('product.product', 'Product', domain=[('sale_ok', '=', True)], change_default=True),
'price_unit': fields.float('Unit Price', required=True, digits_compute= dp.get_precision('Sale Price')),
'tax_id': fields.many2many('account.tax', 'sale_order_tax', 'order_line_id', 'tax_id', 'Taxes'),
'type': fields.selection([('make_to_stock', 'from stock'), ('make_to_order', 'on order')], 'Procurement Method', required=True),
'product_uom_qty': fields.float('Quantity (UoM)', digits=(16, 2), required=True,),
'product_uom': fields.many2one('product.uom', 'Unit of Measure ', required=True,),
'product_uos_qty': fields.float('Quantity (UoS)'),
'product_uos': fields.many2one('product.uom', 'Product UoS'),
'product_packaging': fields.many2one('product.packaging', 'Packaging'),
'discount': fields.float('Discount (%)', digits=(16, 2)),
'notes': fields.text('Notes'),
}
_order = 'sequence, id'
_defaults = {
'discount': 0.0,
'delay': 0.0,
'product_uom_qty': 1,
'product_uos_qty': 1,
'type': 'make_to_stock',
'product_packaging': False
}
sale_order_make_line()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -16,54 +16,12 @@
groups="base.group_extended"/>
<field name="close"/>
</group>
<field colspan="4" mode="tree,form,graph" name="sale_order_line" nolabel="1" widget="one2many_list">
<form string="Sale Order Lines">
<notebook>
<page string="Order Line">
<field colspan="4"
context="partner_id=parent.partner_id,shop=parent.shop_id"
name="product_id"
on_change="product_id_change(product_id,product_uom_qty,product_uom,product_uos_qty,product_uos,name,parent.partner_id, 'lang' in context and context['lang'], True, product_packaging, False)"
/>
<field name="product_uom_qty"/>
<field name="product_uom"/>
<group colspan="2" groups="product.group_uos">
<field name="product_uos_qty"/>
<field name="product_uos" nolabel="1"/></group>
<field
name="product_packaging"
domain="[('product_id','=',product_id)]"
groups="base.group_extended"/>
<field colspan="4" name="name"/>
<field name="price_unit"/>
<field name="discount"/>
<field name="type" groups="base.group_extended"/>
<field name="delay" groups="base.group_extended"/>
<newline/>
<separator colspan="5" string="Taxes"/>
<field colspan="4" name="tax_id" nolabel="1" domain="[('parent_id','=',False),('type_tax_use','&lt;&gt;','purchase')]"/>
</page>
<page string="Notes">
<field colspan="4" name="notes" nolabel="1"/>
</page>
</notebook>
</form>
<tree string="Sales order lines">
<field colspan="4" name="name"/>
<field name="product_uom_qty" string="Qty"/>
<field name="product_uom" string="UoM"/>
<field name="discount"/>
<field name="price_unit"/>
</tree>
</field>
<newline/>
<newline/>
<separator colspan="4"/>
<group col="4" colspan="4">
<label string="" colspan="2"/>
<button special="cancel" string="_Close" icon="gtk-cancel"/>
<button name="makeOrder" string="_Create" type="object" icon='gtk-ok'/>
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
<button name="makeOrder" string="_Create" type="object" icon='gtk-go-forward'/>
</group>
</form>
</field>