Skip to content

Instantly share code, notes, and snippets.

View alt-odoo's full-sized avatar
👻
"We will all be archived one day, one way or another." Odoobot

Alex Tuyls alt-odoo

👻
"We will all be archived one day, one way or another." Odoobot
View GitHub Profile
@PierreCourt
PierreCourt / gist:cad494aa3d482abba0382fd6db08c396
Last active February 18, 2021 22:02
[FIX] Sequence mixin constraint
# In case you find the following error, the scripts might be useful :
# "The %(date_field)s (%(date)s) doesn't match the %(sequence_field)s (%(sequence)s).\n"
# "You might want to clear the field %(sequence_field)s before proceeding with the change of the date.",
# The sequence mixin (addons/account/models/sequence_mixin.py) contains a new method, _constrains_date_sequence.
# That method checks that the date in the sequence is aligned with
# the date of the model (INV/2020/12/0001 for a date of 25/12/2020)
# This is a new constraints, and this can cause some problems for users that where using another format.
# Since v14, for account.move and other models, the sequence is defaulted in the code
# (on the format <JOURNAL_CODE>/YYYY/MONTH/NUMBER for accounting).
# Add the below code in your Python file,
# then add @own_profiler as a decorator on the method you would like to profile.
# Note:
# - If there is already a decorator on the method, set @own_profiler above,
# - Each time the method is called, it generates a new profile file,
# don't set this decorator on a method called hundred of times or you will have hundred of profile files to analyze.
#
# To display the resulting profiling data file:
#
# Snakeviz: Callstack layer graph & stats table