filter - 如何根据批号Odoo10按One2many字段记录分组?
问题描述
我正在使用 Odoo10 并希望根据批号对 One2many 字段记录进行分组/过滤。我尝试了不同的解决方案,但没有得到预期的结果。那么,任何人都可以建议我解决这个问题吗?
如果我们想根据相同的产品名称在销售订单中按销售订单行分组,这也是同样的问题。
我试过下面的代码:
<field name="weight_cal_machine" mode="tree,form" colspan="4" nolabel="1" widget="one2many_list" context="{'group_by':'batch_number'}">
<tree editable="bottom" delete="false"
colors="blue:status_type == 'assign'; darkgreen:status_type == 'verify';"
create="false">
<field name="batch_number" readonly="1" string="Batch"/>
<field name="status_type"/>
</tree>
<form>
<group colspan="4" col="4">
<field name="batch_number" readonly="1"/>
</group>
</form>
</field>
解决方案
AFAIK 没有办法让 One2many 或 Many2many 字段像不属于表单字段的常规树视图那样分组。我很久以前就实现了 Odoo 是 OpenERP 7.0 的时候,但需要大量的 js 小部件定制才能让它工作。这是客户的要求。开箱即用的 Odoo 表单小部件不支持它
推荐阅读
- javascript - 从键值对构造多列表
- rust - 将未来结果转换为另一个未来
- excel - 将整列内容翻译成所需语言(英文)
- rust - 如何使用 Iron 创建自定义 Content-Type?
- python - 遍历 python 3 字符串列表并将每个项目与其他项目匹配并返回最大的匹配项
- sql - 根据条件删除 SQL INNER JOIN 重复项
- system-verilog - 从 systemverilog 中的另一个类中采样覆盖组
- amazon-web-services - 如何使快照标签公开?
- jenkins - 无法在 Jenkins 的 Groovy 中运行 shell 命令
- typescript - 椭圆的打字稿界面