Hi, Some questions and explanations of something i thought easy to realize... I decide to create a custom module to add a sequence on an existing field. In my case, it concerns stock_lot module. There's a field "number" (type char, required=true) that i need to be "sequenced".
So in my module, there are 2 classes: Configuration, ConfigurationSequence to define my sequence and i update the original class "Lot" to define "number" field "readonly", and set sequence on this number field when creating a new lot. Here's the code: https://pastebin.com/74EXsjT7 In the first time, forgot the __register__ method. When executing my new module and saving a new lot, this was not working, i got error on "Number" that is required... it seems number field is not updated by my new sequence... Checking my create method, there's a test "if values.get('number') is None:"... I discovered this test is not working because value of the field is not None but "" (checking database, related field is defined as "NOT NULL" because of the "required = True" in the original model and then couldn't be None). Checking many tryton scripts, i saw it was possible to remove the "NOT NULL" through the register method with "table.not_null_action('number', action='remove')"... but not allowed to do this with a custom module because there is a check if the module_name attempting to update fields is the original module. So, what's the best way to finish my custom module? - Changing my original test "if values.get('number') is None:" by "if values.get('number') == "":" (and keeping the database unchanged) ? - Using some sql in the __register__ method to remove the "NOT NULL" on the "number" column ? Thanks for suggestions :-) -- You received this message because you are subscribed to the Google Groups "tryton-dev" group. To view this discussion on the web visit https://groups.google.com/d/msgid/tryton-dev/370607dd-b45c-4667-8555-f0e28fa4b449%40googlegroups.com.