odoo.define('ecare_medical_history.EditPatientProfile', function (require) {
"use strict";
self = this;
var rpc = require('web.rpc');
var AbstractAction = require('web.AbstractAction');
var servicesMixin = require('web.ServicesMixin');
var core = require('web.core');
$(document).on('click', '.editPatientProfile', async function() {
try {
var result = await rpc.query({
model: 'ec.patient.timeline',
method: 'action_open_patient_time_view',
args: [],
});
alert("test");
console.log(result);
// Check if the result is valid before calling do_action
if (result) {
return await this.do_action(result);
} else {
console.error('RPC call did not return a valid result.');
}
} catch (error) {
console.error('Error while making the RPC call:', error);
}
});
});
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- إدارة علاقات العملاء
- e-Commerce
- المحاسبة
- المخزون
- PoS
- Project
- MRP
لقد تم الإبلاغ عن هذا السؤال
Hi,
Can you try to write your function like this:
odoo.define('ecare_medical_history.EditPatientProfile', function (require) {
"use strict";
self = this;
var rpc = require('web.rpc');
var AbstractAction = require('web.AbstractAction');
var servicesMixin = require('web.ServicesMixin');
var core = require('web.core');
$(document).on('click', '.editPatientProfile', async function() {
try {
var result = await rpc.query({
model: 'ec.patient.timeline',
method: 'action_open_patient_time_view',
args: [],
});
alert("test");
console.log(result);
// Check if the result is valid before calling do_action
if (result) {
return await self.do_action(result);
} else {
console.error('RPC call did not return a valid result.');
}
} catch (error) {
console.error('Error while making the RPC call:', error);
}
});
});
Use self instead of this.
Hope it helps
هل أعجبك النقاش؟ لا تكن مستمعاً فقط. شاركنا!
أنشئ حساباً اليوم لتستمتع بالخصائص الحصرية، وتفاعل مع مجتمعنا الرائع!
تسجيلالمنشورات ذات الصلة | الردود | أدوات العرض | النشاط | |
---|---|---|---|---|
|
1
أبريل 25
|
1353 | ||
Odoo App
تم الحل
|
|
1
نوفمبر 23
|
1921 | |
|
0
مايو 24
|
1657 | ||
|
0
سبتمبر 23
|
2603 | ||
|
0
سبتمبر 23
|
2220 |