details: https://code.tryton.org/tryton/commit/101e1d87a261
branch: default
user: Cédric Krier <[email protected]>
date: Fri Nov 28 12:06:48 2025 +0100
description:
Allow multiple products to be added to or removed from an accounting
category
Closes #14326
diffstat:
modules/account_product/CHANGELOG | 1 +
modules/account_product/product.py | 7 +++++++
modules/account_product/product.xml | 6 ++++++
modules/account_product/view/category_product_form.xml | 8 ++++++++
4 files changed, 22 insertions(+), 0 deletions(-)
diffs (53 lines):
diff -r e4480cb7619e -r 101e1d87a261 modules/account_product/CHANGELOG
--- a/modules/account_product/CHANGELOG Wed Nov 26 16:41:20 2025 +0100
+++ b/modules/account_product/CHANGELOG Fri Nov 28 12:06:48 2025 +0100
@@ -1,3 +1,4 @@
+* Allow multiple products to be added to or removed from an accounting category
Version 7.6.0 - 2025-04-28
--------------------------
diff -r e4480cb7619e -r 101e1d87a261 modules/account_product/product.py
--- a/modules/account_product/product.py Wed Nov 26 16:41:20 2025 +0100
+++ b/modules/account_product/product.py Fri Nov 28 12:06:48 2025 +0100
@@ -135,6 +135,13 @@
supplier_taxes_used = fields.Function(fields.Many2Many(
'account.tax', None, None, "Supplier Taxes Used"), 'get_taxes')
+ accounting_templates = fields.One2Many(
+ 'product.template', 'account_category', "Accounting Products",
+ states={
+ 'invisible': ~Eval('accounting', False),
+ },
+ help="The products for which the accounting category applies.")
+
@classmethod
def __setup__(cls):
super().__setup__()
diff -r e4480cb7619e -r 101e1d87a261 modules/account_product/product.xml
--- a/modules/account_product/product.xml Wed Nov 26 16:41:20 2025 +0100
+++ b/modules/account_product/product.xml Fri Nov 28 12:06:48 2025 +0100
@@ -10,6 +10,12 @@
<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 e4480cb7619e -r 101e1d87a261
modules/account_product/view/category_product_form.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/account_product/view/category_product_form.xml Fri Nov 28
12:06:48 2025 +0100
@@ -0,0 +1,8 @@
+<?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>