Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
1 Răspunde
2535 Vizualizări

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.


Imagine profil
Abandonează
Cel mai bun răspuns

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

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
2
dec. 23
5121
4
mai 25
12182
1
ian. 24
8028
0
iul. 23
122
1
dec. 22
4285