[IMP]: better table of content

[IMP] : The user should not be able to delete a sale order line ,unless it's an option that has been added previously
[IMP]: open the sent email link, it open the cms homepage, not the quote

bzr revid: aja@tinyerp.com-20140116064329-1da392uplmsm01me
This commit is contained in:
ajay javiya (OpenERP) 2014-01-16 12:13:29 +05:30
parent ba458f6abc
commit 1bcdc4dc2f
6 changed files with 96 additions and 13 deletions

View File

@ -117,6 +117,7 @@ class sale_quote(http.Controller):
'product_uom_qty': option.quantity,
'product_uom_id': option.uom_id.id,
'discount': option.discount,
'is_optional': True,
})
line = request.registry.get('sale.order.line').create(request.cr, SUPERUSER_ID, vals, context=request.context)
option_obj.write(request.cr, SUPERUSER_ID, [option.id], {'line_id': line}, context=request.context)

View File

@ -13,12 +13,11 @@
<p>Here is your ${object.state in ('draft', 'sent') and 'quotation' or 'order confirmation'} from ${object.company_id.name}: </p>
<% set signup_url = object.quote_url %>
<p>
You can access this document and pay online via our Customer Portal:
</p>
<a style="display:block; width: 150px; height:20px; margin-left: 120px; color: #DDD; font-family: 'Lucida Grande', Helvetica, Arial, sans-serif; font-size: 13px; font-weight: bold; text-align: center; text-decoration: none !important; line-height: 1; padding: 5px 0px 0px 0px; background-color: #8E0000; border-radius: 5px 5px; background-repeat: repeat no-repeat;"
href="${signup_url}">View ${object.state in ('draft', 'sent') and 'Quotation' or 'Order'}</a>
href="${object.open_quotation()['url']}">View ${object.state in ('draft', 'sent') and 'Quotation' or 'Order'}</a>
</div>
]]></field>
</record>

View File

@ -73,6 +73,7 @@ class sale_order_line(osv.osv):
_description = "Sales Order Line"
_columns = {
'website_description': fields.html('Line Description'),
'is_optional': fields.boolean('Optional Product')
}
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)
@ -152,7 +153,7 @@ class sale_option_line(osv.osv):
'uom_id': fields.many2one('product.uom', 'Unit of Measure ', required=True),
'quantity': fields.float('Quantity', required=True),
}
_defaults = {
'quantity': 1,
}

View File

@ -1,3 +1,74 @@
.affix {
width : 260px;
.bs-sidebar.affix {
position: static;
margin-top: 30px;
}
.bs-sidenav {
margin-top: 30px;
margin-bottom: 30px;
padding-top: 10px;
padding-bottom: 10px;
text-shadow: 0 1px 0 #fff;
background-color: #f7f5fa;
border-radius: 5px;
}
.bs-sidebar .nav > li > a {
display: block;
color: #716b7a;
padding: 5px 20px;
}
.bs-sidebar .nav > li > a:hover,
.bs-sidebar .nav > li > a:focus {
text-decoration: none;
background-color: #e5e3e9;
border-right: 1px solid #dbd8e0;
}
.bs-sidebar .nav > .active > a,
.bs-sidebar .nav > .active:hover > a,
.bs-sidebar .nav > .active:focus > a {
font-weight: bold;
color: #563d7c;
background-color: transparent;
border-right: 1px solid #563d7c;
}
.bs-sidebar .nav .nav {
display: none;
margin-bottom: 8px;
}
.bs-sidebar .nav .nav > li > a {
padding-top: 3px;
padding-bottom: 3px;
padding-left: 30px;
font-size: 90%;
}
@media (min-width: 992px) {
.bs-sidebar .nav > .active > ul {
display: block;
}
.bs-sidebar.affix,
.bs-sidebar.affix-bottom {
width: 213px;
}
.bs-sidebar.affix {
position: fixed;
top: 80px;
}
.bs-sidebar.affix-bottom {
position: absolute;
}
.bs-sidebar.affix-bottom .bs-sidenav,
.bs-sidebar.affix .bs-sidenav {
margin-top: 0;
margin-bottom: 0;
}
}
@media (min-width: 1200px) {
.bs-sidebar.affix-bottom,
.bs-sidebar.affix {
width: 263px;
}
}

View File

@ -23,6 +23,7 @@ $(document).ready(function () {
return false;
});
// automatically generate a menu from h1 and h1 tag in content
var ul = null;
var sub_li = null;
@ -31,17 +32,19 @@ $(document).ready(function () {
$("section h1, section h2").each(function() {
switch (this.tagName.toLowerCase()) {
case "h1":
id = _.uniqueId('quote_header_')
if (!ul) {
ul = $('[data-id="quote_sidebar"]');
}
sub_li = $("<li>").html('<label class="nav-header">'+$(this).text()+'</label>').appendTo(ul);
$(this).attr('id',id)
sub_li = $("<li>").html('<a href="#'+id+'">'+$(this).text()+'</a>').appendTo(ul);
sub_ul = null;
break;
case "h2":
id = _.uniqueId('quote_')
if (sub_li) {
if (!sub_ul) {
sub_ul = $("<ul class='nav nav-pills nav-stacked nav-hierarchy'>").appendTo(sub_li);
sub_ul = $("<ul class='nav'>").appendTo(sub_li);
}
$(this).attr('id',id)
$("<li>").html('<a href="#'+id+'">'+$(this).text()+'</a>').appendTo(sub_ul);
@ -49,5 +52,6 @@ $(document).ready(function () {
break;
}
});
//vim:et fdc=0 fdl=0 foldnestmax=3 fdm=syntax:
});

View File

@ -2,6 +2,9 @@
<openerp>
<data>
<template id="pricing" name="Price">
<section data-snippet-id="title">
<h1 class="page-header">Pricing</h1>
</section>
<section id="quote" class="container">
<table class="table table-hover">
<thead>
@ -40,7 +43,7 @@
t-field-options='{"widget": "monetary", "display_currency": "quotation.pricelist_id.currency_id"}'/>
</td>
<td>
<a t-href="./update_line/#{ line.id }/?order_id=#{ quotation.id }&amp;unlink=True&amp;token=#{ quotation.access_token }" class="mb8 js_update_line_json pull-right hidden-print">
<a t-href="./update_line/#{ line.id }/?order_id=#{ quotation.id }&amp;unlink=True&amp;token=#{ quotation.access_token }" class="mb8 js_update_line_json pull-right hidden-print" t-if="line.is_optional">
<span class="fa fa-trash-o"></span>
</a>
</td>
@ -84,7 +87,9 @@
</template>
<template id="chatter">
<h2 class="page-header">History</h2>
<section data-snippet-id="title">
<h1 class="page-header">History</h1>
</section>
<ul class="media-list" id="comments-list">
<li t-foreach="quotation.message_ids" t-as="message" class="media">
<div class="media-body">
@ -102,7 +107,7 @@
<!-- Options:Quotation Chatter: user can reply -->
<template id="opt_quotation_chatter_post_complete_comment" name="Allow Comments" inherit_option_id="website_quotation.chatter" inherit_id="website_quotation.chatter">
<xpath expr="//h2" position="after">
<xpath expr="//h1" position="after">
<section class="mb32 css_editable_mode_hidden hidden-print">
<form id="comment" t-attf-action="/quote/#{quotation.id}/#{quotation.access_token}/post"
method="POST">
@ -124,11 +129,13 @@
<link rel='stylesheet' href='/website_quotation/static/src/css/website_quotation.css'/>
<t t-raw="head or ''"/>
</t>
<body data-spy="scroll" data-target=".nav">
<body data-spy="scroll" data-target=".navspy">
<div class="container">
<div class="row mt16">
<div class="col-md-3">
<ul class="nav" data-id="quote_sidebar" data-offset-top="60" data-offset-bottom="110" data-spy="affix"/>
<div class="bs-sidebar hidden-print affix navspy" role="complementary">
<ul class="nav bs-sidenav" data-id="quote_sidebar" />
</div>
</div>
<div class="col-md-9">
@ -149,7 +156,7 @@
<h1 class="page-header">
<span t-if="quotation.state in ('draft','sent','cancel')">Your Quotation</span>
<span t-if="quotation.state not in ('draft','sent','cancel')">Your Order</span>
<em t-esc="quotation.name"/>
<a t-att-href="'/web#return_label=Website&amp;model=%s&amp;id=%s' % (quotation._name, quotation.id)"><em t-esc="quotation.name"/></a>
<small t-field="quotation.state"/>
</h1>