Skip to content

Instantly share code, notes, and snippets.

View PierreCourt's full-sized avatar

Pierre Courtoy PierreCourt

  • Odoo
View GitHub Profile
@PierreCourt
PierreCourt / no_app_linked.py
Last active May 25, 2023 08:21
Find ir.model with no app linked
l = []
for m in env['ir.model'].search([]):
m._in_modules()
if m.modules is '':
l.append(m.id)
#query = ("delete from ir_model_fields where model_id in (%s)" % ','.join(map(str, l)))
#env.cr.execute(query)
#env.cr.commit()
#query = ("delete from ir_model where id in (%s)" % ','.join(map(str, l)))
@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).