[FIX] misc fixes
bzr revid: fp@tinyerp.com-20140125192553-7vg5iao6afp1anwn
This commit is contained in:
parent
b2cc8d494e
commit
0ff4c48cb9
|
@ -58,15 +58,11 @@ class sale_quote(http.Controller):
|
|||
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!'
|
||||
error = {}
|
||||
if not signer: error['signer'] = 'missing'
|
||||
if not sign: error['sign'] = 'missing'
|
||||
if not error:
|
||||
order_obj.signal_order_confirm(request.cr, SUPERUSER_ID, [order_id], context=request.context)
|
||||
message = _('Order signed by %s') % (signer,)
|
||||
self.__message_post(message, order_id, type='comment', subtype='mt_comment',
|
||||
attachments=[('signature.png', sign)])
|
||||
return [error]
|
||||
attachments=sign and [('signature.png', sign)] or []
|
||||
order_obj.signal_order_confirm(request.cr, SUPERUSER_ID, [order_id], context=request.context)
|
||||
message = _('Order signed by %s') % (signer,)
|
||||
self.__message_post(message, order_id, type='comment', subtype='mt_comment', attachments=attachments)
|
||||
return True
|
||||
|
||||
@http.route(['/quote/<int:order_id>/<token>/decline'], type='http', auth="public", website=True)
|
||||
def decline(self, order_id, token, **post):
|
||||
|
|
|
@ -37,34 +37,27 @@ $(document).ready(function () {
|
|||
var href = $link.attr("action");
|
||||
var order_id = href.match(/accept\/([0-9]+)/);
|
||||
var token = href.match(/token=(.*)/);
|
||||
var sign = false;
|
||||
var signer_name = false;
|
||||
if($('#signature').length > 0){
|
||||
var isSignature=$("#signature").jSignature('getData','image')[1].length>1?true:false;
|
||||
if (isSignature)
|
||||
{
|
||||
sign = JSON.stringify($("#signature").jSignature("getData",'image')[1]);
|
||||
}
|
||||
signer_name = $("#name").val();
|
||||
}
|
||||
|
||||
var signer_name = $("#name").val();
|
||||
var sign = $("#signature").jSignature("getData",'image')[1];
|
||||
$('#signer').toggleClass('has-error', ! signer_name);
|
||||
$('#drawsign').toggleClass('panel-error', ! sign.length);
|
||||
|
||||
if (! signer_name)
|
||||
return false;
|
||||
|
||||
openerp.jsonRpc("/quote/accept/", 'call', {
|
||||
'order_id': parseInt(order_id[1]),
|
||||
'token': token[1],
|
||||
'signer': signer_name,
|
||||
'sign': sign,
|
||||
})
|
||||
.then(function (data) {
|
||||
if(_.isEmpty(data[0])){
|
||||
$('#modelaccept').modal('hide');
|
||||
var url = location.protocol+'//'+location.hostname+(location.port ? ':'+location.port : "")
|
||||
window.location.replace(url +'/quote/'+order_id[1]+'/'+token[1]+'?message=3');
|
||||
} else{
|
||||
if (data[0]['signer']) $('#signer').addClass('has-error'); else $('#signer').removeClass('has-error');
|
||||
if (data[0]['sign']) $('#drawsign').addClass('panel-danger'); else $('#drawsign').removeClass('panel-danger');
|
||||
}
|
||||
'sign': sign?JSON.stringify(sign):false,
|
||||
}).then(function (data) {
|
||||
$('#modelaccept').modal('hide');
|
||||
window.location.replace(url +'/quote/'+order_id[1]+'/'+token[1]+'?message=3');
|
||||
});
|
||||
return false
|
||||
});
|
||||
|
||||
// automatically generate a menu from h1 and h2 tag in content
|
||||
var ul = $('[data-id="quote_sidebar"]');
|
||||
var sub_li = null;
|
||||
|
|
|
@ -235,7 +235,7 @@
|
|||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
|
||||
<h4 class="modal-title">Validate Order</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="modal-body" id="sign-dialog">
|
||||
<p>
|
||||
I agree that by signing this proposal, I
|
||||
accept it on the behalf of <b t-field="quotation.company_id"/>,
|
||||
|
@ -244,6 +244,10 @@
|
|||
t-field-options='{"widget": "monetary", "display_currency": "quotation.pricelist_id.currency_id"}'/>
|
||||
with payment terms: <b t-field="quotation.payment_term"/>.
|
||||
</p>
|
||||
<div id="signer" class="form-group">
|
||||
<label class="control-label" for="name">Your Name:</label>
|
||||
<input type="text" name="signer" id="name" class="form-control"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" t-attf-class="btn btn-primary">Sign Order</button> or
|
||||
|
@ -366,12 +370,8 @@
|
|||
</template>
|
||||
|
||||
<!-- Options:Quotation Signature -->
|
||||
<template id="opt_quotation_signature" name="Signature" inherit_option_id="website_quotation.so_quotation" inherit_id="website_quotation.so_quotation">
|
||||
<xpath expr="//div[@class='modal-body']" position="inside">
|
||||
<div id="signer" class="form-group">
|
||||
<label class="control-label" for="name">Your Name:</label>
|
||||
<input type="text" name="signer" id="name" class="form-control"/>
|
||||
</div>
|
||||
<template id="opt_quotation_signature" name="Ask Signature" inherit_option_id="website_quotation.so_quotation" inherit_id="website_quotation.so_quotation">
|
||||
<xpath expr="//div[@id='sign-dialog']" position="inside">
|
||||
<div class="panel panel-default mt16 mb0" id="drawsign">
|
||||
<div class="panel-heading">
|
||||
<div class="pull-right">
|
||||
|
|
Loading…
Reference in New Issue