Я создал эту функцию, и я не знаю, почему она возвращает [Object Object]
, а не то значение, которое я получил. Функция должна возвращать строку, такую как (Main/121)
. Тем не менее, предупреждение показывает значение, которое я хотел.Функция return [Object Object] не значение
module.Order = Backbone.Model.extend({
initialize: function (attributes) {
Backbone.Model.prototype.initialize.apply(this, arguments);
this.pos = attributes.pos;
var that = this;
this.sequence_number = this.pos.pos_session.sequence_number++;
debugger;
this.uid = this.generateUniqueId();
this.pro = this.get_the_other_main();
this.set({
creationDate: new Date(),
orderLines: new module.OrderlineCollection(),
paymentLines: new module.PaymentlineCollection(),
name: _t("Order ") + this.uid,
client: null,
sales_person: null,
sales_person_name: null,
new_id: this.pro
});
this.selected_orderline = undefined;
this.selected_paymentline = undefined;
this.screen_data = {}; // see ScreenSelector
this.receipt_type = 'receipt'; // 'receipt' || 'invoice'
this.temporary = attributes.temporary || false;
return this;
},
get_the_other_main: function (callback) {
return new instance.web.Model("pos.order").call('get_the_product', []).done(
function(results) {
var result = results.toString().split(',');
var stringsl=result[1];
var thenum = stringsl.replace(/^\D+/g, '');
var sasa=parseInt(thenum,10)+1
var zika=('00' + sasa).slice(-4)
var the_str=result[1].slice(0,-4).toString();
var new_seq_sasa=the_str+zika
alert(new_seq_sasa)
return callback(new_seq_sasa);
}
);
},
Похож асинхронный вызов, который означает, что вы не можете вернуться от него. – epascarello
то как я могу получить значение? –