commit
df96c1aa76
|
@ -0,0 +1,21 @@
|
||||||
|
from openupgradelib import openupgrade
|
||||||
|
|
||||||
|
|
||||||
|
@openupgrade.migrate()
|
||||||
|
def migrate(env, version):
|
||||||
|
|
||||||
|
openupgrade.logged_query(
|
||||||
|
env.cr,
|
||||||
|
"""
|
||||||
|
UPDATE ir_model_fields SET trackable = false;
|
||||||
|
UPDATE ir_model_fields SET trackable = true
|
||||||
|
WHERE name NOT IN (
|
||||||
|
'activity_ids',
|
||||||
|
'message_ids',
|
||||||
|
'message_last_post',
|
||||||
|
'message_main_attachment',
|
||||||
|
'message_main_attachement_id'
|
||||||
|
)
|
||||||
|
AND store AND related IS NULL;
|
||||||
|
""",
|
||||||
|
)
|
|
@ -100,21 +100,27 @@ class IrModel(models.Model):
|
||||||
def _default_automatic_custom_tracking_domain_rules(self):
|
def _default_automatic_custom_tracking_domain_rules(self):
|
||||||
return {
|
return {
|
||||||
"product.product": [
|
"product.product": [
|
||||||
|
("readonly", "=", False),
|
||||||
"|",
|
"|",
|
||||||
("ttype", "!=", "one2many"),
|
("ttype", "!=", "one2many"),
|
||||||
("name", "in", ["barcode_ids"]),
|
("name", "in", ["barcode_ids"]),
|
||||||
],
|
],
|
||||||
"sale.order": [
|
"sale.order": [
|
||||||
|
("readonly", "=", False),
|
||||||
"|",
|
"|",
|
||||||
("ttype", "!=", "one2many"),
|
("ttype", "!=", "one2many"),
|
||||||
("name", "in", ["order_line"]),
|
("name", "in", ["order_line"]),
|
||||||
],
|
],
|
||||||
"account.move": [
|
"account.move": [
|
||||||
|
("readonly", "=", False),
|
||||||
"|",
|
"|",
|
||||||
("ttype", "!=", "one2many"),
|
("ttype", "!=", "one2many"),
|
||||||
("name", "in", ["invoice_line_ids"]),
|
("name", "in", ["invoice_line_ids"]),
|
||||||
],
|
],
|
||||||
"default_automatic_rule": [("ttype", "!=", "one2many")],
|
"default_automatic_rule": [
|
||||||
|
("ttype", "!=", "one2many"),
|
||||||
|
("readonly", "=", False),
|
||||||
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
@api.depends("automatic_custom_tracking")
|
@api.depends("automatic_custom_tracking")
|
||||||
|
@ -176,7 +182,7 @@ class IrModelFields(models.Model):
|
||||||
for record in self:
|
for record in self:
|
||||||
record.native_tracking = bool(record.tracking)
|
record.native_tracking = bool(record.tracking)
|
||||||
|
|
||||||
@api.depends("readonly", "related", "store")
|
@api.depends("related", "store")
|
||||||
def _compute_trackable(self):
|
def _compute_trackable(self):
|
||||||
blacklists = [
|
blacklists = [
|
||||||
"activity_ids",
|
"activity_ids",
|
||||||
|
@ -185,13 +191,9 @@ class IrModelFields(models.Model):
|
||||||
"message_main_attachment",
|
"message_main_attachment",
|
||||||
"message_main_attachement_id",
|
"message_main_attachement_id",
|
||||||
]
|
]
|
||||||
|
|
||||||
for rec in self:
|
for rec in self:
|
||||||
rec.trackable = (
|
rec.trackable = rec.name not in blacklists and rec.store and not rec.related
|
||||||
rec.name not in blacklists
|
|
||||||
and rec.store
|
|
||||||
and not rec.readonly
|
|
||||||
and not rec.related
|
|
||||||
)
|
|
||||||
|
|
||||||
def write(self, vals):
|
def write(self, vals):
|
||||||
custom_tracking = None
|
custom_tracking = None
|
||||||
|
|
Loading…
Reference in New Issue