跳至内容
菜单
此问题已终结
1 回复
2155 查看

Here is my function:


setup() {
this.orm = useService("orm")
this.actionService = useService("action")

}


async getQuotations(){
let domain = [['state', 'in', ['sent', 'draft']]]
if (this.state.period > 0){
domain.push(['date_order','>', this.state.current_date])
}
const data = await this.orm.searchCount("sale.order", domain)
this.state.quotations.value = data

// previous period
let prev_domain = [['state', 'in', ['sent', 'draft']]]
if (this.state.period > 0){
prev_domain.push(['date_order','>', this.state.previous_date], ['date_order',' }
const prev_data = await this.orm.searchCount("sale.order", prev_domain)
const percentage = ((data - prev_data)/prev_data) * 100
this.state.quotations.percentage = percentage.toFixed(2)
}

Here is the error:

Uncaught (in promise) TypeError: this.orm.searchCount is not a function


Thanks.


形象
丢弃
最佳答案

Hi,

this.orm.searchCount is undefined hence you can't call just like any other function

You should try it like this 
const data = await this.orm.call('sale.order','search_count', domain)


Hope it helps

形象
丢弃
相关帖文 回复 查看 活动
2
12月 23
4426
4
5月 25
11244
1
1月 24
7729
0
7月 23
122
1
12月 22
3908