1.js
/** @odoo-module **/ const { Component } = owl; import { registry } from "@web/core/registry"; export class FsnMonth extends Component { setup() { super.setup(); } onChangeValue(ev) { this.props.record.update({ [this.props.name]: ev.target.value }); } } FsnMonth.template = "fsn_month_template" registry.category("fields").add("fsn_month", FsnMonth);
2.xml
<?xml version="1.0" encoding="UTF-8"?> <templates xml:space="preserve"> <t t-name="fsn_month_template" owl="1"> <input type="month" t-att-value="this.props.value" t-on-change="(ev) => this.onChangeValue(ev)"/> </t> </templates>
3.导入资源
'assets': { 'web.assets_backend': [ 'my_widget/static/src/components/temp/temp.js', 'my_widget/static/src/components/temp/temp.xml' ], },
标签:owl,temp,Odoo16,FsnMonth,选择,registry,ev From: https://www.cnblogs.com/wangdianchao/p/17307129.html