[IMP] edi: EDI preview - validation/presentation fixes

bzr revid: odo@openerp.com-20111102234029-gg88m5ftceg52r12
This commit is contained in:
Olivier Dony 2011-11-03 00:40:29 +01:00
parent c7ca5cafc4
commit 84a2075efb
3 changed files with 22 additions and 12 deletions

View File

@ -53,12 +53,12 @@ openerp.edi.EdiView = openerp.web.Widget.extend({
return url_prefix +'/edi/download?db=' + this.db + '&token=' + this.token;
},
get_paypal_url: function(document_type, ref_field) {
comp_name = encodeURIComponent(this.doc.company_id[1]);
doc_ref = encodeURIComponent(this.doc[ref_field]);
paypal_account = encodeURIComponent(this.doc.company_address.paypal_account);
amount = encodeURIComponent(this.doc.amount_total);
cur_code = encodeURIComponent(this.doc.currency.code);
paypal_url = "https://www.paypal.com/cgi-bin/webscr?cmd=_xclick" +
var comp_name = encodeURIComponent(this.doc.company_id[1]);
var doc_ref = encodeURIComponent(this.doc[ref_field]);
var paypal_account = encodeURIComponent(this.doc.company_address.paypal_account);
var amount = encodeURIComponent(this.doc.amount_total);
var cur_code = encodeURIComponent(this.doc.currency.code);
var paypal_url = "https://www.paypal.com/cgi-bin/webscr?cmd=_xclick" +
"&business=" + paypal_account +
"&item_name=" + document_type + "%20" + comp_name + "%20" + doc_ref +
"&invoice=" + doc_ref +
@ -80,8 +80,18 @@ openerp.edi.EdiView = openerp.web.Widget.extend({
},
do_import_existing: function(e) {
var url_download = this.get_download_url();
var server_url = this.$element.find('#oe_edi_txt_server_url').val()
window.location = 'http://' + server_url + '/edi/import_url?url=' + encodeURIComponent(url_download);
var $edi_text_server_input = this.$element.find('#oe_edi_txt_server_url');
var server_url = $edi_text_server_input.val();
$edi_text_server_input.removeClass('invalid');
if (!server_url) {
$edi_text_server_input.addClass('invalid');
return false;
}
var protocol = "http://";
if (server_url.toLowerCase().lastIndexOf('http', 0) == 0 ) {
protocol = '';
}
window.location = protocol + server_url + '/edi/import_url?url=' + encodeURIComponent(url_download);
},
do_import_create: function(e){
var url_download = this.get_download_url();

View File

@ -32,7 +32,7 @@
<p class="oe_edi_nested_block_import oe_edi_import_openerp_nested">
<label for="oe_edi_txt_server_url">OpenERP instance address:</label>
<br/>
http://<input type="text" id="oe_edi_txt_server_url"/><br/>
<input type="text" id="oe_edi_txt_server_url" placeholder="http://example.my.openerp.com/"/><br/>
<button type="button" class="oe_edi_import_button" id="oe_edi_import_existing">Import</button>
</p>

View File

@ -129,7 +129,7 @@
<p class="oe_edi_sidebar_title">Pay Online</p>
<t t-if="doc.company_address.paypal_account">
<div class="oe_edi_option">
<input type="radio" id="oe_edi_paypal" name="oe_edi_pay"/>
<input type="radio" id="oe_edi_paypal" name="oe_edi_pay" class="oe_edi_pay_choice"/>
<label for="oe_edi_paypal" id="oe_edi_paypal" class="oe_edi_pay_choice_label">Paypal</label>
</div>
<p class="oe_edi_nested_block_pay oe_edi_paypal_nested">
@ -141,11 +141,11 @@
</t>
<t t-if="doc.company_address.bank_ids">
<div class="oe_edi_option">
<input type="radio" id="oe_edi_pay_wire" name="oe_edi_pay"/>
<input type="radio" id="oe_edi_pay_wire" name="oe_edi_pay" class="oe_edi_pay_choice"/>
<label for="oe_edi_pay_wire" id="oe_edi_pay_wire" class="oe_edi_pay_choice_label">Bank Wire Transfer</label>
</div>
<p class="oe_edi_nested_block_pay oe_edi_pay_wire_nested">
Please transfer <strong><t t-esc="doc.amount_total"/> <t t-esc="doc.currency_code"/></strong> to
Please transfer <strong><t t-esc="_.sprintf('%.2f',doc.amount_total)"/> <t t-esc="doc.currency.code"/></strong> to
<strong><t t-esc="doc.company_id[1]"/></strong> (postal address on the invoice header)
using one of the following bank accounts. Be sure to mention the invoice
reference <strong><t t-esc="doc.internal_number"/></strong> on the transfer: