SelectionValidationError when creating menu entry with timesheet icon
When initializing a custom module we get the following error:
======================================================================
ERROR: setUpClass (test_module.ProjectTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/pokoli/projectes/tryton/trytond/trytond/convert.py", line 464, in parse_xmlstream
self.sax_parser.parse(source)
File "/usr/lib/python3.11/xml/sax/expatreader.py", line 111, in parse
xmlreader.IncrementalParser.parse(self, source)
File "/usr/lib/python3.11/xml/sax/xmlreader.py", line 125, in parse
self.feed(buffer)
File "/usr/lib/python3.11/xml/sax/expatreader.py", line 217, in feed
self._parser.Parse(data, isFinal)
File "/usr/src/debug/python/Python-3.11.3/Modules/pyexpat.c", line 468, in EndElement
File "/usr/lib/python3.11/xml/sax/expatreader.py", line 336, in end_element
self._cont_handler.endElement(name)
File "/home/pokoli/projectes/tryton/trytond/trytond/convert.py", line 519, in endElement
self.taghandler = self.taghandler.endElement(name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/pokoli/projectes/tryton/trytond/trytond/convert.py", line 170, in endElement
self.mh.import_record('ir.ui.menu', self.values, self.xml_id)
File "/home/pokoli/projectes/tryton/trytond/trytond/convert.py", line 695, in import_record
self.create_records(model, [values], [fs_id])
File "/home/pokoli/projectes/tryton/trytond/trytond/convert.py", line 701, in create_records
records = Model.create(vlist)
^^^^^^^^^^^^^^^^^^^
File "/home/pokoli/projectes/tryton/trytond/trytond/model/modelsql.py", line 262, in wrapper
return func(cls, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/pokoli/projectes/tryton/trytond/trytond/model/modelsql.py", line 963, in create
cls._validate(sub_records)
File "/home/pokoli/projectes/tryton/trytond/trytond/transaction.py", line 50, in wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/home/pokoli/projectes/tryton/trytond/trytond/model/modelstorage.py", line 1502, in _validate
raise SelectionValidationError(gettext(
trytond.model.modelstorage.SelectionValidationError: The value "tryton-timesheet" for field "Icon" in "Productions / Timesheet" of "UI menu" is not one of the allowed options. -
This can be reproduced with an empty module with the following tryton.cfg
:
[tryton]
version=6.8.0
depends:
ir
attendance
analytic_account
analytic_invoice
account_asset
account_credit_limit
account_es
account_payment_sepa
account_statement_aeb43
account_statement_rule
notification_email
purchase
purchase_request_quotation
purchase_invoice_line_standalone
purchase_secondary_unit
product_cost_fifo
production_outsourcing
production_work_timesheet
timesheet
timesheet_cost
sale_amendment
sale_opportunity
sale_credit_limit
sale_invoice_grouping
sale_supply_production
stock_supply
xml:
production.xml
And with the following production.xml
:
<?xml version="1.0"?>
<tryton>
<data>
<menuitem
parent="production.menu_production"
name="Timesheet"
sequence="24"
id="menu_timesheet"
icon="tryton-timesheet"/>
</data>
</tryton>
This is similar to #12246 (closed) but I can reproduce the issue on latest trunk (and 6.8.1 where the fix is applied).