当我尝试在 odoo 模块中使用 moment 时,它遇到了如下错误:
以下模块是其他模块所需要的,但尚未定义,它们可能不存在于正确的资源包中: 片刻 无法加载以下模块,因为它们具有未满足的依赖关系,这是一个次要错误,可能是由上述问题之一引起的:
@my_dashboard/组件/sales_dashboard
import { registry } from "@web/core/registry"
import { KpiCard } from "./kpi_card/kpi_card"
import { ChartRenderer } from "./chart_renderer/chart_renderer"
import { loadJS } from "@web/core/assets"
import moment from 'moment';
import { useService } from "@web/core/utils/hooks"
const { Component, onWillStart, useRef, onMounted, useState } = owl
export class OwlSalesDashboard extends Component {
setup(){
this.state=useState({
quotations:{
value:10,
percentage:6,
},
period:90,
})
this.orm=useService("orm")
onWillStart(async() => {
await this.getQuotations()
})
}
onChangePeriod() {
console.log(this.state.period)
console.log(moment().format())
}
async getQuotations(){
const data = await this.orm.searchCount("sale.order",[['state','in',['send','draft']]])
this.state.quotations.value = data
}
}
OwlSalesDashboard.template = "owl.OwlSalesDashboard"
OwlSalesDashboard.components = { KpiCard, ChartRenderer }
registry.category("actions").add("owl.sales_dashboard", OwlSalesDashboard)
请给出正确答案