[IMP] some improvements
bzr revid: fp@tinyerp.com-20140101200519-gj5jnibdsim8nwfi
This commit is contained in:
parent
c997c0c66b
commit
13a8cd9232
|
@ -9,7 +9,7 @@ OpenERP Sale Quote Roller
|
|||
|
||||
""",
|
||||
'author': 'OpenERP SA',
|
||||
'depends': ['website_sale','portal_sale', 'mail'],
|
||||
'depends': ['sale', 'portal_sale', 'mail'],
|
||||
'data': [
|
||||
'views/website_sale_quote.xml',
|
||||
'sale_quote_view.xml',
|
||||
|
|
|
@ -34,13 +34,6 @@ class sale_quote(http.Controller):
|
|||
user = user_pool.search(request.cr, SUPERUSER_ID, [('partner_id', '=', partner)])[0]
|
||||
return user
|
||||
|
||||
def _get_message(self, order):
|
||||
total = 0
|
||||
for msg in order.message_ids:
|
||||
if msg.subtype_id.name in ['Sales Order Confirmed', 'Discussions']:
|
||||
total += 1
|
||||
return total
|
||||
|
||||
@website.route(["/quote/<int:order_id>/<token>"], type='http', auth="public")
|
||||
def view(self, order_id, token, **post):
|
||||
# use SUPERUSER_ID allow to access/view order for public user
|
||||
|
@ -48,7 +41,6 @@ class sale_quote(http.Controller):
|
|||
assert token == order.access_token, 'Access denied, wrong token!'
|
||||
values = {
|
||||
'quotation': order,
|
||||
'message': self._get_message(order)
|
||||
}
|
||||
return request.website.render('website_sale_quote.so_quotation', values)
|
||||
|
||||
|
|
|
@ -33,10 +33,10 @@ class sale_quote_template(osv.osv):
|
|||
'quote_line': fields.one2many('sale.quote.line', 'quote_id', 'Quote Template Lines'),
|
||||
'note': fields.text('Terms and conditions'),
|
||||
}
|
||||
|
||||
def open_template(self, cr, uid, quote_id, context=None):
|
||||
return {
|
||||
'action': 'ir.act.url',
|
||||
'type': 'ir.actions.act_url',
|
||||
'target': 'self',
|
||||
'url': '/template/%d' % quote_id
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,6 @@ class sale_order_line(osv.osv):
|
|||
_columns = {
|
||||
'website_description': fields.html('Line Description'),
|
||||
}
|
||||
|
||||
def product_id_change(self, cr, uid, ids, pricelist, product, qty=0, uom=False, qty_uos=0, uos=False, name='', partner_id=False, lang=False, update_tax=True, date_order=False, packaging=False, fiscal_position=False, flag=False, context=None):
|
||||
res = super(sale_order_line, self).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, context)
|
||||
if product:
|
||||
|
@ -84,13 +83,21 @@ class sale_order_line(osv.osv):
|
|||
class sale_order(osv.osv):
|
||||
_inherit = 'sale.order'
|
||||
_columns = {
|
||||
'access_token': fields.char('Quotation Token', size=256, required=True),
|
||||
'access_token': fields.char('Security Token', size=256, required=True),
|
||||
'template_id': fields.many2one('sale.quote.template', 'Quote Template'),
|
||||
'website_description': fields.html('Description'),
|
||||
}
|
||||
_defaults = {
|
||||
'access_token': lambda self, cr, uid, ctx={}: len(uuid.uuid4())
|
||||
'access_token': lambda self, cr, uid, ctx={}: str(uuid.uuid4())
|
||||
}
|
||||
def open_quotation(self, cr, uid, quote_id, context=None):
|
||||
quote = self.browse(cr, uid, quote_id[0], context=context)
|
||||
return {
|
||||
'type': 'ir.actions.act_url',
|
||||
'target': 'self',
|
||||
'url': '/quote/%d/%s' % (quote.id, quote.access_token)
|
||||
}
|
||||
|
||||
def _get_sale_order_line(self, cr, uid, template_id, context=None):
|
||||
"""create order line from selected quote template line."""
|
||||
|
||||
|
|
|
@ -6,10 +6,9 @@
|
|||
<field name="model">sale.order</field>
|
||||
<field name="inherit_id" ref="sale.view_order_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//header" position="after">
|
||||
<div class="oe_form_box_info oe_text_center" attrs="{'invisible': ['|',('quote_url', '=', False),('template_id','=',False)]}">
|
||||
<field name="quote_url" widget="url"/>
|
||||
</div>
|
||||
<xpath expr="//header/button[@name='invoice_corrected']" position="after">
|
||||
<button name="open_quotation" string="View Quotation" type="object"
|
||||
attrs="{'invisible': [('template_id','=',False)]}"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='client_order_ref']" position="after">
|
||||
<field name="template_id" on_change="onchange_template_id(template_id)"/>
|
||||
|
@ -29,7 +28,7 @@
|
|||
<button string="Template" type="object" name="open_template"/>
|
||||
</div>
|
||||
<div class="oe_title">
|
||||
<label for="name" class="oe_edit_only">
|
||||
<label for="name" class="oe_edit_only"/>
|
||||
<h1>
|
||||
<field name="name"/>
|
||||
</h1>
|
||||
|
|
|
@ -77,18 +77,21 @@
|
|||
</template>
|
||||
|
||||
<template id="quote_status">
|
||||
<div class="btn-group btn-group-lg mt16 mb16">
|
||||
<a class="btn btn-success fa fa-check" type="submit" t-if="quotation.state != 'manual' and quotation.state != 'cancel'" t-href="/quote/#{ quotation.id }/accept">
|
||||
<div class="btn-group btn-group-lg mt16 mb16" t-if="quotation.state in ('draft', 'sent', 'waiting_date')">
|
||||
<a class="btn btn-success fa fa-check" type="submit" t-href="/quote/#{ quotation.id }/accept">
|
||||
Accept
|
||||
</a>
|
||||
<a class="btn btn-info fa fa-comment" type="submit" t-if="quotation.state != 'manual' and quotation.state != 'cancel'" href="#chat">
|
||||
<a class="btn btn-info fa fa-comment" type="submit" href="#chat">
|
||||
Send us a Feedback
|
||||
<sup class="label label-info"><t t-esc="message"/></sup>
|
||||
</a>
|
||||
<a class="btn btn-danger fa fa-times" data-toggle="modal" data-target="#modeldecline">
|
||||
Refuse
|
||||
</a>
|
||||
</div>
|
||||
<div class="alert alert-warning alert-dismissable" t-if="quotation.state == 'cancel'">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
|
||||
<strong>This quotation has been canceled.</strong> Contact <t t-field="quotation.user_id"/> to ask a new one.
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template id="chatter">
|
||||
|
@ -134,7 +137,21 @@
|
|||
<script type="text/javascript" src="/website_sale_quote/static/src/js/sale_quote.js"></script>
|
||||
<t t-raw="head or ''"/>
|
||||
</t>
|
||||
<div class="col-xs-12 col-md-8 tab-content">
|
||||
<div class="col-md-4">
|
||||
<ul class="nav nav-pills nav-stacked" data-spy="affix">
|
||||
<li class="active">
|
||||
<a href="#introduction11" data-toggle="tab">Introduction</a>
|
||||
</li>
|
||||
<li t-foreach="quotation.order_line" t-as="line">
|
||||
<a t-att-href="'#%s'% line.id" data-toggle="tab">
|
||||
<t t-raw="line.product_id.name_template"/>
|
||||
</a>
|
||||
</li>
|
||||
<li><a href="#quote" data-toggle="tab">Pricing</a></li>
|
||||
<li><a href="#terms" data-toggle="tab">Terms & Conditions</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<t t-call="website_sale_quote.quote_status"/>
|
||||
<div class="modal fade" id="modeldecline" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
|
@ -166,16 +183,6 @@
|
|||
<t t-call="website_sale_quote.product_recommendation"/>
|
||||
<t t-call="website_sale_quote.chatter"/>
|
||||
</div>
|
||||
<div class="col-xs-6 col-md-4 sidebar" id="sidebar">
|
||||
<ul class="nav nav-pills nav-stacked" data-spy="affix">
|
||||
<li class="active"><a href="#introduction11" data-toggle="tab"><i class="icon-chevron-right"></i> Introduction</a></li>
|
||||
<t t-foreach="quotation.order_line" t-as="line">
|
||||
<li><a t-att-href="'#%s'% line.id" data-toggle="tab"><i class="icon-chevron-right"></i><t t-raw="line.product_id.name_template"/> </a></li>
|
||||
</t>
|
||||
<li><a href="#quote" data-toggle="tab"><i class="icon-chevron-right"></i> Pricing</a></li>
|
||||
<li><a href="#terms" data-toggle="tab"><i class="icon-chevron-right"></i> Terms & Conditions</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</t>
|
||||
</template>
|
||||
|
||||
|
|
Loading…
Reference in New Issue