frePPLe / frepple

frePPLe - open source supply chain planning
https://frepple.com
Other
524 stars 248 forks source link

Error when reading setup rule with wildcard character from XML #354

Closed kunesj closed 4 years ago

kunesj commented 4 years ago

Error happened when importing XML (via "Read Odoo data"), that included setup rule with wildcard character in fromsetup field. Creating identical setup rule manually (via web interface) works without any problem.

Part of imported XML with problematic setup rule:

<setupmatrices>
    <setupmatrix name="Slow or Fast" source="odoo_1">
        <rules>
            <rule cost="10.0" duration="PT1H0M0S" fromsetup="*" priority="0" tosetup="Fast"/>
        </rules>
    </setupmatrix>
</setupmatrices>

Logged error:

INFO Start step 119 'Load Odoo data' at 15:12:08
Error during planning: Error during XML parsing: Invalid setup matrix rule "* to .*" on setup matrix "Slow or Fast"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python3.6/dist-packages/freppledb/common/commands.py", line 547, in <module>
    register.run(database=database)
  File "/usr/local/lib/python3.6/dist-packages/freppledb/common/commands.py", line 487, in run
    cls.reg.run(**cls.arguments)
  File "/usr/local/lib/python3.6/dist-packages/freppledb/common/commands.py", line 220, in run
    step.run(**PlanTaskRegistry.getArguments())
  File "/usr/local/lib/python3.6/dist-packages/freppledb/odoo/commands.py", line 162, in run
    frepple.readXMLdata(f.read().decode("utf-8"), False, False)
frepple.RuntimeException: Error during XML parsing: Invalid setup matrix rule "* to .*" on setup matrix "Slow or Fast"
Error: Error executing Python command
jdetaeye commented 4 years ago

Error happened when importing XML (via "Read Odoo data"), that included setup rule with wildcard character in fromsetup field.

frepple is not using "wildcard characters", but "regular expressions".

Creating identical setup rule manually (via web interface) works without any problem.

There is the same error message in the log file about an invalid expression.