Hi all,
Currently, sequences are referenced by (hardcoded) custom strings, for
example (taken from sale.py) :
reference = sequence_obj.get(cursor, user, 'sale.sale',
context=context)
self.write(cursor, user, sale_id, {
'reference': reference,
}, context=context)
And the string 'sale.sale' can be found in the code column of the
ir_sequence table.
So we (me and cedk) propose some refactoring to use a more traditional
approach :
Each module that needs one or more sequence will adds one (or more) M2O
(pre-filled to point to the default sequence) on the company object (if
the sequence cannot be shared across companies, like the invoice number)
or on a singleton object (if a sequence is used by all the companies,
like for the party numbering.
Above that, and to avoid to give write access to the company model to a
lot of users (each user that is allowed to change one sequence), we
propose to use function field on singletons :
Updating those function fields (of type m2o and pointing to ir.sequence)
will update the company record.
So at the end all sequences will be available on singletons, some with
regular fields, some with function field that show/edits the values on
the company record.
The main advantage is that UI will be greatly simplified:
- no need to get lost on the administration menu to find the sequences,
they will be available as a submenu of each module).
- when opening the singleton with the sequences, the user sees currently
used sequences and only them (not for example the invoice sequence of
two year ago), so it's easier and more straightforward to edit them.
Has this modification will needs to be carefully migrated, we would like
you to share your thought, remarks and questions.
Many thanks.
--
Bertrand Chenal
B2CK SPRL
Rue de Rotterdam, 4
4000 Liège
Belgium
Tel: +32 474 207 906
Email: [email protected]
Website: http://www.b2ck.com/
--
[email protected] mailing list