[IMP] website_crm, website_sale: add a Website sale team and new lead and order to this sale team
[FIX] website_sale: remove auto assignation to administrator from website lead and order bzr revid: chm@openerp.com-20140124114224-w80wd2ea0bx20ldk
This commit is contained in:
parent
cc978e1490
commit
33eeff4448
|
@ -16,9 +16,16 @@ class contactus(http.Controller):
|
|||
return url
|
||||
|
||||
@http.route(['/crm/contactus'], type='http', auth="public", website=True, multilang=True)
|
||||
def contactus(self, *arg, **post):
|
||||
def contactus(self, description=None, partner_name=None, phone=None, contact_name=None, email_from=None, name=None):
|
||||
post = {}
|
||||
post['description'] = description
|
||||
post['partner_name'] = partner_name
|
||||
post['phone'] = phone
|
||||
post['contact_name'] = contact_name
|
||||
post['email_from'] = email_from
|
||||
post['name'] = name
|
||||
|
||||
required_fields = ['contact_name', 'email_from', 'description']
|
||||
post['user_id'] = False
|
||||
error = set()
|
||||
values = dict((key, post.get(key)) for key in post)
|
||||
values['error'] = error
|
||||
|
@ -34,6 +41,13 @@ class contactus(http.Controller):
|
|||
if not post.get('name'):
|
||||
post['name'] = post.get('contact_name')
|
||||
|
||||
section_ids = request.registry["crm.case.section"].search(
|
||||
request.cr, SUPERUSER_ID, [("code", "=", "Website")], context=request.context)
|
||||
if section_ids:
|
||||
post['section_id'] = section_ids[0]
|
||||
|
||||
post['user_id'] = False
|
||||
|
||||
request.registry['crm.lead'].create(request.cr, SUPERUSER_ID, post, request.context)
|
||||
company = request.website.company_id
|
||||
values = {
|
||||
|
|
|
@ -12,5 +12,13 @@
|
|||
<field name="state">open</field>
|
||||
</record>
|
||||
|
||||
<record model="crm.case.section" id="website.section_sales_department">
|
||||
<field name="name">Website</field>
|
||||
<field name="code">Website</field>
|
||||
<field name="use_leads">True</field>
|
||||
<field name="alias_name">Website</field>
|
||||
<field name="member_ids" eval="[(4, ref('base.user_root'))]"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
|
@ -517,9 +517,8 @@ class Ecommerce(http.Controller):
|
|||
'partner_invoice_id': partner_id,
|
||||
'partner_shipping_id': shipping_id or partner_id
|
||||
}
|
||||
print order_info
|
||||
order_info.update(registry.get('sale.order').onchange_partner_id(cr, SUPERUSER_ID, [], partner_id, context=context)['value'])
|
||||
print order_info
|
||||
order_info.pop('user_id')
|
||||
|
||||
order_line_obj.write(cr, SUPERUSER_ID, [order.id], order_info, context=context)
|
||||
|
||||
|
|
|
@ -32,5 +32,12 @@
|
|||
<field name="html_class">oe_image_full</field>
|
||||
</record>
|
||||
|
||||
<record model="crm.case.section" id="website.section_sales_department">
|
||||
<field name="name">Website</field>
|
||||
<field name="code">Website</field>
|
||||
<field name="alias_name">Website</field>
|
||||
<field name="member_ids" eval="[(4, ref('base.user_root'))]"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
|
@ -145,6 +145,14 @@ class Website(orm.Model):
|
|||
""" Create a new quotation used in the ecommerce (event, sale) """
|
||||
SaleOrder = self.pool.get('sale.order')
|
||||
quotation_values = self._ecommerce_get_quotation_values(cr, uid, context=context)
|
||||
|
||||
section_ids = request.registry["crm.case.section"].search(
|
||||
request.cr, SUPERUSER_ID, [("code", "=", "Website")], context=context)
|
||||
if section_ids:
|
||||
quotation_values['section_id'] = section_ids[0]
|
||||
|
||||
quotation_values['user_id'] = False
|
||||
|
||||
return SaleOrder.create(cr, SUPERUSER_ID, quotation_values, context=context)
|
||||
|
||||
def ecommerce_get_new_order(self, cr, uid, context=None):
|
||||
|
|
|
@ -7,6 +7,6 @@ $(document).ready(function () {
|
|||
$("div.oe_sale_acquirer_button[data-id]", $payment).addClass("hidden");
|
||||
$("div.oe_sale_acquirer_button[data-id='"+payment_id+"']", $payment).removeClass("hidden");
|
||||
})
|
||||
.find("#payment_method input[name='acquirer']:checked").click();
|
||||
.find("input[name='acquirer']:checked").click();
|
||||
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue