details: https://code.tryton.org/tryton/commit/dd6799120c9c
branch: default
user: Cédric Krier <[email protected]>
date: Fri Apr 24 23:31:34 2026 +0200
description:
Manage products directly on category form
Closes #14811
diffstat:
modules/account_product/product.xml | 6 ----
modules/account_product/view/category_form.xml | 3 ++
modules/account_product/view/category_product_form.xml | 8 ------
modules/product/CHANGELOG | 1 +
modules/product/category.py | 16 +-----------
modules/product/category.xml | 23 ------------------
modules/product/view/category_form.xml | 4 ++-
modules/product/view/category_product_form.xml | 8 ------
8 files changed, 8 insertions(+), 61 deletions(-)
diffs (157 lines):
diff -r 280d7c937fa2 -r dd6799120c9c modules/account_product/product.xml
--- a/modules/account_product/product.xml Fri Apr 17 18:59:58 2026 +0200
+++ b/modules/account_product/product.xml Fri Apr 24 23:31:34 2026 +0200
@@ -10,12 +10,6 @@
<field name="name">category_form</field>
</record>
- <record model="ir.ui.view" id="category_view_form_product">
- <field name="model">product.category</field>
- <field name="inherit" ref="product.category_view_form_product"/>
- <field name="name">category_product_form</field>
- </record>
-
<record model="ir.rule.group" id="rule_group_category_default">
<field name="name">Not accounting category</field>
<field name="model">product.category</field>
diff -r 280d7c937fa2 -r dd6799120c9c
modules/account_product/view/category_form.xml
--- a/modules/account_product/view/category_form.xml Fri Apr 17 18:59:58
2026 +0200
+++ b/modules/account_product/view/category_form.xml Fri Apr 24 23:31:34
2026 +0200
@@ -27,5 +27,8 @@
<field name="customer_taxes" colspan="2"/>
<field name="supplier_taxes" colspan="2"/>
</page>
+ <page name="accounting_templates" col="1">
+ <field name="accounting_templates" widget="many2many"/>
+ </page>
</xpath>
</data>
diff -r 280d7c937fa2 -r dd6799120c9c
modules/account_product/view/category_product_form.xml
--- a/modules/account_product/view/category_product_form.xml Fri Apr 17
18:59:58 2026 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-<?xml version="1.0"?>
-<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
-this repository contains the full copyright notices and license terms. -->
-<data>
- <xpath expr="//field[@name='templates']" position="after">
- <field name="accounting_templates" widget="many2many" colspan="2"/>
- </xpath>
-</data>
diff -r 280d7c937fa2 -r dd6799120c9c modules/product/CHANGELOG
--- a/modules/product/CHANGELOG Fri Apr 17 18:59:58 2026 +0200
+++ b/modules/product/CHANGELOG Fri Apr 24 23:31:34 2026 +0200
@@ -1,3 +1,4 @@
+* Manage products directly on category form
Version 8.0.0 - 2026-04-20
--------------------------
diff -r 280d7c937fa2 -r dd6799120c9c modules/product/category.py
--- a/modules/product/category.py Fri Apr 17 18:59:58 2026 +0200
+++ b/modules/product/category.py Fri Apr 24 23:31:34 2026 +0200
@@ -7,7 +7,7 @@
from trytond.model import Exclude, ModelSQL, ModelView, fields, tree
from trytond.pool import Pool
-from trytond.pyson import Eval, PYSONEncoder
+from trytond.pyson import Eval
from trytond.tools import is_full_text, lstrip_wildcard
@@ -41,11 +41,6 @@
'product.msg_category_code_unique'),
]
cls._order.insert(0, ('name', 'ASC'))
- cls._buttons.update({
- 'add_products': {
- 'icon': 'tryton-add',
- },
- })
@classmethod
def default_code_readonly(cls):
@@ -81,15 +76,6 @@
]
@classmethod
- @ModelView.button_action('product.act_category_product')
- def add_products(cls, categories):
- return {
- 'res_id': [categories[0].id if categories else None],
- 'pyson_domain': PYSONEncoder().encode(
- [('id', '=', categories[0].id if categories else None)]),
- }
-
- @classmethod
def _code_sequence(cls):
pool = Pool()
Configuration = pool.get('product.configuration')
diff -r 280d7c937fa2 -r dd6799120c9c modules/product/category.xml
--- a/modules/product/category.xml Fri Apr 17 18:59:58 2026 +0200
+++ b/modules/product/category.xml Fri Apr 24 23:31:34 2026 +0200
@@ -22,13 +22,6 @@
<field name="priority" eval="10"/>
<field name="name">category_form</field>
</record>
- <record model="ir.ui.view" id="category_view_form_product">
- <field name="model">product.category</field>
- <field name="type">form</field>
- <field name="priority" eval="20"/>
- <field name="name">category_product_form</field>
- </record>
-
<record model="ir.action.act_window" id="act_category_tree">
<field name="name">Categories</field>
<field name="res_model">product.category</field>
@@ -71,22 +64,6 @@
sequence="10"
id="menu_category_list"/>
- <record model="ir.action.act_window" id="act_category_product">
- <field name="name">Add products</field>
- <field name="res_model">product.category</field>
- </record>
- <record model="ir.action.act_window.view"
id="act_category_product_view1">
- <field name="sequence" eval="10"/>
- <field name="view" ref="category_view_form_product"/>
- <field name="act_window" ref="act_category_product"/>
- </record>
-
- <record model="ir.model.button" id="category_add_products_button">
- <field name="model">product.category</field>
- <field name="name">add_products</field>
- <field name="string">Add products</field>
- </record>
-
<record model="ir.model.access" id="access_product_category">
<field name="model">product.category</field>
<field name="perm_read" eval="True"/>
diff -r 280d7c937fa2 -r dd6799120c9c modules/product/view/category_form.xml
--- a/modules/product/view/category_form.xml Fri Apr 17 18:59:58 2026 +0200
+++ b/modules/product/view/category_form.xml Fri Apr 24 23:31:34 2026 +0200
@@ -13,10 +13,12 @@
<label name="parent"/>
<field name="parent" colspan="3"/>
- <button name="add_products" colspan="6"/>
<notebook colspan="6">
<page string="Children" col="1" id="childs">
<field name="childs"/>
</page>
+ <page name="templates" col="1">
+ <field name="templates"/>
+ </page>
</notebook>
</form>
diff -r 280d7c937fa2 -r dd6799120c9c
modules/product/view/category_product_form.xml
--- a/modules/product/view/category_product_form.xml Fri Apr 17 18:59:58
2026 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-<?xml version="1.0"?>
-<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
-this repository contains the full copyright notices and license terms. -->
-<form col="2">
- <label name="rec_name"/>
- <field name="rec_name" readonly="1"/>
- <field name="templates" colspan="2"/>
-</form>