I'm extending gantt view to add new button. The button is working. The problem is when i try to use RPC or ORM, I got this error
`Uncaught Promise > Cannot read properties of null (reading 'component')`
I think GanttController is extending AbstractController
Here is the javascript
/** @odoo-module */
import { _t } from 'web.core';
import { useService } from "@web/core/utils/hooks";
export const ControllerMixin = {
async _onMovePlanClick(ev) {
// const rpc = useService('rpc');
ev.preventDefault();
$.exposed = {
this:this,
useService:useService
};
console.log(
'ControllerMixin._onMovePlanClick'
);
const orm = useService("orm");
const project_id = await orm.call('project.task', 'get_project_id', [this.context.active_id])
this.do_action({
name: _t('Move Plan'),
type: 'ir.actions.act_window',
res_model: 'project.task.move.plan.wizard',
views: [[false, 'form']],
target: 'new',
context: {'default_project_id': project_id},
})
},
};
This is the python
class Task(models.Model):
_inherit = "project.task"
def get_project_id(self):
return self.project_id.id
I test it without calling const orm = useService("orm");
. It's working fine. So the problem is when defining orm or rpc variable
In other case, I'm extending CharField and ORM is working fine