From c707b0edca2ae9a8ff233389f10a07b33551a157 Mon Sep 17 00:00:00 2001 From: "ajay javiya (OpenERP)" Date: Fri, 17 Jan 2014 15:37:46 +0530 Subject: [PATCH] [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 --- addons/website_quotation/controllers/main.py | 20 +++++++-- .../data/website_quotation_demo.xml | 43 ++++++++++++++++--- addons/website_quotation/models/order.py | 8 ++-- .../static/src/css/website_quotation.css | 1 + .../views/website_quotation.xml | 5 +-- 5 files changed, 62 insertions(+), 15 deletions(-) diff --git a/addons/website_quotation/controllers/main.py b/addons/website_quotation/controllers/main.py index a9830f091af..4eb588b8a04 100644 --- a/addons/website_quotation/controllers/main.py +++ b/addons/website_quotation/controllers/main.py @@ -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///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///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, diff --git a/addons/website_quotation/data/website_quotation_demo.xml b/addons/website_quotation/data/website_quotation_demo.xml index 84b6aec79f1..4d06f473397 100644 --- a/addons/website_quotation/data/website_quotation_demo.xml +++ b/addons/website_quotation/data/website_quotation_demo.xml @@ -153,7 +153,7 @@
-

Your OpenERP Enterprise commissions

+

Enterprise commissions

As an official partner, you benefit from OpenERP Enterprise commissions, according to your partner grade, as well as @@ -192,7 +192,7 @@

-

Get access to our consultants and technical experts

+

Get access to our experts

@@ -212,7 +212,7 @@

-

Get recognition as an official certified partner

+

Official certified partner

@@ -233,7 +233,7 @@

-

Access to the Lead Generation Program

+

Access to the Lead

@@ -264,7 +264,7 @@

-

Test all your developments automatically

+

Test developments automatically

@@ -375,5 +375,38 @@
+ + + + Advanced CRM Functional + + 1 + + 9000.00 + +
+

Advanced CRM Functional

+
+
+
+
+
+ + + + Advanced Account Functional + + 1 + + 18000.00 + +
+

Advanced Account Functional

+
+
+
+
+
+ diff --git a/addons/website_quotation/models/order.py b/addons/website_quotation/models/order.py index eda1d0f0977..9a301c7e49d 100644 --- a/addons/website_quotation/models/order.py +++ b/addons/website_quotation/models/order.py @@ -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, }) diff --git a/addons/website_quotation/static/src/css/website_quotation.css b/addons/website_quotation/static/src/css/website_quotation.css index 2ae5c3155e7..a3c2b4460c5 100644 --- a/addons/website_quotation/static/src/css/website_quotation.css +++ b/addons/website_quotation/static/src/css/website_quotation.css @@ -1,6 +1,7 @@ .bs-sidebar.affix { position: static; margin-top: 30px; + z-index : 1; } .bs-sidenav { diff --git a/addons/website_quotation/views/website_quotation.xml b/addons/website_quotation/views/website_quotation.xml index 8a1fcfc36bb..d2d4e47abf5 100644 --- a/addons/website_quotation/views/website_quotation.xml +++ b/addons/website_quotation/views/website_quotation.xml @@ -159,9 +159,8 @@
-
-
- +
+ Your message has been sent! We will come back to you as soon as possible!.