[IMP] working crash dialog

bzr revid: rlo@openerp.com-20111221171137-flojvtf10547ekfl
This commit is contained in:
Roberto López López (OpenERP) 2011-12-21 18:11:37 +01:00
parent fb7d80d56f
commit b3f7278d12
6 changed files with 78 additions and 69 deletions

View File

@ -45,6 +45,12 @@ class OpenERPSession(object):
del state['config']
return state
def has_pwc(self):
if not self._uid:
return False
else:
return self.model('publisher_warranty.contract').status()['status'] == 'full'
def build_connection(self):
conn = openerplib.Connection(self.config.connector, database=self._db, login=self._login,
user_id=self._uid, password=self._password)

View File

@ -370,7 +370,8 @@ class Session(openerpweb.Controller):
"uid": req.session._uid,
"context": ctx,
"db": req.session._db,
"login": req.session._login
"login": req.session._login,
"has_pwc": req.session.has_pwc()
}
@openerpweb.jsonrequest
@ -379,7 +380,8 @@ class Session(openerpweb.Controller):
"uid": req.session._uid,
"context": req.session.get_context() if req.session._uid else False,
"db": req.session._db,
"login": req.session._login
"login": req.session._login,
"has_pwc": req.session.has_pwc()
}
@openerpweb.jsonrequest

View File

@ -1746,42 +1746,45 @@ ul.oe-arrow-list li.oe-arrow-list-selected .oe-arrow-list-after {
}
/* Dialog traceback cases */
.expandcase {
background: transparent url(/web/static/src/img/expand.gif) 0 50% no-repeat;
.openerp .expandcase {
background: transparent url(/web/static/src/img/expand.gif) 0 50% no-repeat;
margin-top:10px;
}
.collapsecase {
background: transparent url(/web/static/src/img/collapse.gif) 0 50% no-repeat;
margin-top:10px;
.openerp .collapsecase {
background: transparent url(/web/static/src/img/collapse.gif) 0 50% no-repeat;
margin-top:10px;
}
.case-head{
padding-left:18px;
margin-top:5px;
.openerp .case-head{
padding-left:18px;
margin-top:5px;
}
.error-detail{
.openerp .error-detail{
display:none;
}
.error-fix{
border:1px solid #999999;
overflow:auto;
.openerp .error-send{
display:block;
}
.fielddiv{
.openerp .error-fix{
border:1px solid #999999;
overflow:auto;
}
.openerp .fielddiv{
display:inline-block;
}
.fielddiv label{
/* width:20%; */
float:left;
text-align:right;
.openerp .fielddiv label{
/* width:20%; */
float:left;
text-align:right;
}
.fielddiv div{
width:79%;
.openerp .fielddiv div{
width:79%;
float:right;
}
.fielddiv input[type=text],textarea{
width:80%;
.openerp .fielddiv input[type=text],textarea{
width:200px;
}
/* for Alignment center */
.centeralign{
.openerp .centeralign{
text-align:center;
}
/* Buttons */

View File

@ -188,34 +188,29 @@ openerp.web.ServerError = openerp.web.Dialog.extend({
]
}).start();
dialog.$element.html(QWeb.render('DialogTraceback', {error: this.error}));
$('#button_send_error').click(function() {
var issuename = $('#issuename').val();
var explanation = $('#explanation').val();
var remark = $('#remark').val();
// Call the send method from server to send mail with details
new openerp.web.DataSet(self, 'publisher_warranty.contract').call_and_eval('send', [self.error.data,explanation,remark,issuename]).then(function(result){
if (result === false) (
alert('There was a communication error.'))
console.log(arguments);
});
});
if (!self.session.has_pwc) {
$('.error-send').html('<span><a href="http://www.openerp.com/support-or-publisher-warranty-contract" target="_blank">Unsupported/Community Version</a></span>');
}
dialog.$element.find('.expandcase').each(function() {
var $this = $(this);
$this.click( function() {
if ($this.attr('id') == "case2") {
/* call the status method from the server to verify status of contract
if status is full then contract is valid
if status is none then contract is invalid
*/
new openerp.web.DataSet(self, 'publisher_warranty.contract').call_and_eval('status', []).then(function(res) {
var hasacontract = res.status == "full";
if (!hasacontract) {
$this.find('a').attr({ href : 'http://www.openerp.com/support-or-publisher-warranty-contract',target: "_blank" });
$this.find('a').css( 'text-decoration', 'none' );
} else {
$this.next().find('[type=button]').click( function() {
var issuename = $('#issuename').val();
var explanation = $('#explanation').val();
var remark = $('#remark').val();
// Call the send method from server to send mail with details
new openerp.web.DataSet(self, 'publisher_warranty.contract').call_and_eval('send', [self.error.data,explanation,remark,issuename]);
});
$this.next().toggle().prev().toggleClass("expandcase collapsecase");
}
});
} else {
$this.next().toggle().prev().toggleClass("expandcase collapsecase");
}
$this.click( function() {
$this.next().toggle().prev().toggleClass("expandcase collapsecase");
});
});
}
@ -1080,6 +1075,10 @@ openerp.web.WebClient = openerp.web.Widget.extend(/** @lends openerp.web.WebClie
self.action_manager = new openerp.web.ActionManager(self);
self.action_manager.appendTo($("#oe_app"));
self.bind_hashchange();
if (!self.session.has_pwc) {
self.$element.find('.oe_footer_powered').append('<span> - <a href="http://www.openerp.com/support-or-publisher-warranty-contract" target="_blank">Unsupported/Community Version</a></span>');
$('title').html('OpenERP - Community Version');
}
});
},
do_reload: function() {

View File

@ -544,7 +544,8 @@ openerp.web.Connection = openerp.web.CallbackEnabled.extend( /** @lends openerp.
db: result.db,
username: result.login,
uid: result.uid,
user_context: result.context
user_context: result.context,
has_pwc: result.has_pwc
});
var deferred = self.do_load_qweb(['/web/webclient/qweb']);
if(self.uid) {
@ -569,7 +570,8 @@ openerp.web.Connection = openerp.web.CallbackEnabled.extend( /** @lends openerp.
db: result.db,
username: result.login,
uid: result.uid,
user_context: result.context
user_context: result.context,
has_pwc: result.has_pwc
});
// TODO: session store in cookie should be optional
self.set_cookie('session_id', self.session_id);

View File

@ -57,9 +57,6 @@
<td colspan="2">
<div id="oe_footer" class="oe_footer">
<p class="oe_footer_powered">Powered by <a href="http://www.openerp.com">openerp.com</a>.
<t t-if="contract !== full">
This is a non supported version.
</t>
</p>
</div>
</td>
@ -1381,7 +1378,7 @@
</table>
</t>
<t t-name="DialogTraceback">
<div>
<form>
<div class="expandcase">
<span class="case-head"><t t-esc="'Let me fix it'" /></span>
</div>
@ -1390,29 +1387,29 @@
<hr/>
<pre><t t-esc="error.data.debug"/></pre>
</div>
<div id="case2" class="expandcase">
<!--div id="case2" class="expandcase">
<span class="case-head"><a><t t-esc="'Fix it for me'" /></a></span>
</div>
<div class="error-detail">
</div-->
<div class="error-send">
<div>
<div class="centeralign"><b>OpenERP Enterprise Contract.</b></div>
<div class="centeralign">Your request will be sent to OpenERP and OpenERP Enterprise team will reply you shortly.</div>
<div class="fielddiv">
<div><br/>Your request will be sent to OpenERP and OpenERP Enterprise team will reply you shortly.<br/></div>
<span class="fielddiv">
<label>Summary:</label><br/>
<div><input id="issuename" type="text" size="15" /></div>
<input id="issuename" type="text"/>
</span><br/><br/>
<div class="fielddiv">
<label>Description:</label><br/>
<textarea id="explanation" rows="6"></textarea>
</div><br/><br/>
<div class="fielddiv">
<span><label>Description:</label></span><br/>
<span><textarea id="explanation" rows="6" ></textarea></span>
</div><br/><br/>
<div class="fielddiv">
<span><label>What you did:</label></span><br/>
<span><textarea id="remark" rows="6" ></textarea></span>
<label>What you did:</label><br/>
<textarea id="remark" rows="6" ></textarea>
</div>
<div class="centeralign"><input type="button" value="Send To OpenERP Enterprise Team" /></div>
<div><br/><input type="button" value="Send To OpenERP Enterprise Team" id="button_send_error"/></div>
</div>
</div>
</div>
</form>
</t>
<t t-name="SelectCreatePopup">
<div t-att-id="element_id">