[IMP]: show alert only post a new message by user

[FIX] : z-index issue when scroll down to footer
[IMP] : demo data

bzr revid: aja@tinyerp.com-20140117100746-zaa2rgkfp288nl8f
This commit is contained in:
ajay javiya (OpenERP) 2014-01-17 15:37:46 +05:30
parent 722aee5336
commit c707b0edca
5 changed files with 62 additions and 15 deletions

View File

@ -36,6 +36,7 @@ class sale_quote(http.Controller):
# TODO: if not order.template_id: return to the URL of the portal view of SO
values = {
'quotation': order,
'new_post' : request.httprequest.session.get('new_post',False)
}
return request.website.render('website_quotation.so_quotation', values)
@ -57,11 +58,13 @@ class sale_quote(http.Controller):
@website.route(['/quote/<int:order_id>/<token>/post'], type='http', auth="public")
def post(self, order_id, token, **post):
# use SUPERUSER_ID allow to access/view order for public user
order = request.registry.get('sale.order').browse(request.cr, SUPERUSER_ID, order_id)
order_obj = request.registry.get('sale.order')
order = order_obj.browse(request.cr, SUPERUSER_ID, order_id)
message = post.get('comment')
assert token == order.access_token, 'Access denied, wrong token!'
if message:
self.message_post(message, order_id)
request.httprequest.session['new_post'] = True
return werkzeug.utils.redirect("/quote/%s/%s" % (order_id, token))
def message_post(self , message, order_id):
@ -77,6 +80,15 @@ class sale_quote(http.Controller):
request.session.body = False
return True
@website.route(['/quote/<int:order_id>/<token>/close'], type='http', auth="public")
def close(self, order_id, token, **post):
""" close an alert message when click on 'X' and set session new_post as False"""
order_obj = request.registry.get('sale.order')
order = order_obj.browse(request.cr, SUPERUSER_ID, order_id)
assert token == order.access_token, 'Access denied, wrong token!'
request.httprequest.session['new_post'] = False
return werkzeug.utils.redirect("/quote/%s/%s" % (order_id, token))
@website.route(['/quote/update_line'], type='json', auth="public")
def update(self, line_id=None, remove=False, unlink=False, order_id=None, token=None, **post):
order = request.registry.get('sale.order').browse(request.cr, SUPERUSER_ID, int(order_id))
@ -109,9 +121,9 @@ class sale_quote(http.Controller):
option_obj = request.registry.get('sale.option.line')
option = option_obj.browse(request.cr, SUPERUSER_ID, option_id)
vals.update({
'price_unit': option.product_id.list_price,
'website_description': option.product_id.website_description,
'name': option.product_id.name,
'price_unit': option.price_unit,
'website_description': option.website_description,
'name': option.name,
'order_id': order.id,
'product_id' : option.product_id.id,
'product_uom_qty': option.quantity,

View File

@ -153,7 +153,7 @@
</section>
<section data-snippet-id="text-block">
<h2>Your OpenERP Enterprise commissions</h2>
<h2>Enterprise commissions</h2>
<p>
As an official partner, you benefit from OpenERP Enterprise
commissions, according to your partner grade, as well as
@ -192,7 +192,7 @@
<section data-snippet-id="text-block">
<div class="row">
<div class="col-md-12">
<h2>Get access to our consultants and technical experts</h2>
<h2>Get access to our experts</h2>
</div>
<div class="col-md-7">
<p>
@ -212,7 +212,7 @@
<section data-snippet-id="text-block">
<div class="row">
<div class="col-md-12">
<h2>Get recognition as an official certified partner</h2>
<h2>Official certified partner</h2>
</div>
<div class="col-md-7">
<p>
@ -233,7 +233,7 @@
<section data-snippet-id="text-block">
<div class="row">
<div class="col-md-12">
<h2>Access to the Lead Generation Program</h2>
<h2>Access to the Lead</h2>
</div>
<div class="col-md-7">
<p>
@ -264,7 +264,7 @@
</section>
<section class="mb32" data-snippet-id="text-block">
<h2>Test all your developments automatically</h2>
<h2>Test developments automatically</h2>
<div class="row">
<div class="col-md-5">
<img src="/website_quotation/static/src/img/partner_sc_01.png" class="img shadow"/>
@ -375,5 +375,38 @@
</section>
</field>
</record>
<record id="website_sale_option_line_1" model="sale.option.line">
<field name="temp_option_id" ref="website_quote_template_1"/>
<field name="name">Advanced CRM Functional</field>
<field name="product_id" ref="product_product_quote_3"/>
<field name="product_uom_qty">1</field>
<field name="uom_id" ref="product.product_uom_unit"/>
<field name="price_unit">9000.00</field>
<field name="website_description" type="html">
<section data-snippet-id="title">
<h1>Advanced CRM Functional</h1>
</section>
<section data-snippet-id="text-image">
</section>
</field>
</record>
<record id="website_sale_option_line_2" model="sale.option.line">
<field name="temp_option_id" ref="website_quote_template_1"/>
<field name="name">Advanced Account Functional</field>
<field name="product_id" ref="product_product_quote_4"/>
<field name="product_uom_qty">1</field>
<field name="uom_id" ref="product.product_uom_unit"/>
<field name="price_unit">18000.00</field>
<field name="website_description" type="html">
<section data-snippet-id="title">
<h1>Advanced Account Functional</h1>
</section>
<section data-snippet-id="text-image">
</section>
</field>
</record>
</data>
</openerp>

View File

@ -32,7 +32,7 @@ class sale_quote_template(osv.osv):
'website_description': fields.html('Description'),
'quote_line': fields.one2many('sale.quote.line', 'quote_id', 'Quote Template Lines'),
'note': fields.text('Terms and conditions'),
'options': fields.one2many('sale.option.line', 'option_id', 'Optional Products Lines'),
'options': fields.one2many('sale.option.line', 'temp_option_id', 'Optional Products Lines'),
}
def open_template(self, cr, uid, quote_id, context=None):
@ -127,6 +127,7 @@ class sale_order(osv.osv):
'uom_id': option.uom_id.id,
'price_unit': option.price_unit,
'discount': option.discount,
'website_description': option.website_description,
}))
data = {'order_line': lines, 'website_description': quote_template.website_description, 'note': quote_template.note, 'options': options}
return {'value': data}
@ -143,7 +144,8 @@ class sale_option_line(osv.osv):
_name = "sale.option.line"
_description = "Sale Options"
_columns = {
'option_id': fields.many2one('sale.order', 'Sale Order Reference', required=True, ondelete='cascade', select=True),
'option_id': fields.many2one('sale.order', 'Sale Order Reference', ondelete='cascade', select=True),
'temp_option_id': fields.many2one('sale.quote.template', 'Quotation Template Reference', ondelete='cascade', select=True),
'line_id': fields.many2one('sale.order.line', on_delete="set null"),
'name': fields.text('Description', required=True),
'product_id': fields.many2one('product.product', 'Product', domain=[('sale_ok', '=', True)], change_default=True),
@ -163,7 +165,7 @@ class sale_option_line(osv.osv):
product_obj = self.pool.get('product.product').browse(cr, uid, product, context=context)
vals.update({
'price_unit': product_obj.list_price,
'website_description': product_obj.website_description,
'website_description': product_obj.product_tmpl_id.website_description,
'name': product_obj.name,
'uom_id': product_obj.product_tmpl_id.uom_id.id,
})

View File

@ -1,6 +1,7 @@
.bs-sidebar.affix {
position: static;
margin-top: 30px;
z-index : 1;
}
.bs-sidenav {

View File

@ -159,9 +159,8 @@
</div>
</div>
<div class="col-md-9">
<div id="psot_info"/>
<div id="post_info" class="alert alert-info alert-dismissable">
<button type="button" class="close hidden-print" data-dismiss="alert" aria-hidden="true">&amp;times;</button>
<div class="alert alert-info alert-dismissable" t-if="new_post">
<a class="close hidden-print" data-dismiss="alert" aria-hidden="true" t-href="/quote/#{quotation.id}/#{quotation.access_token}/close">&amp;times;</a>
<strong>Your message has been sent! We will come back to you as soon as possible!.</strong>
</div>
<t t-call="website_quotation.quotation_toolbar"/>