mirror of
https://github.com/OCA/reporting-engine.git
synced 2025-02-16 16:30:38 +02:00
[FIX] base_comment_template: Incorrect m2m column names + script + avoid FK constraint
- The name of the columns were swapped, so better to fix it for avoiding mistakes due to this. - Migration script for detecting the condition and swap column names. - On v12 > v13 migration, include JOINs for avoiding FK constraint, which `ON CONFLICT` clause doesn't protect.
This commit is contained in:
@@ -16,6 +16,9 @@ def migrate(env, version):
|
||||
SPLIT_PART(ip.value_reference, ',', 2)::int AS base_comment_template_id
|
||||
FROM ir_property ip
|
||||
JOIN ir_model_fields imf ON ip.fields_id = imf.id
|
||||
JOIN res_partner rp ON rp.id = SPLIT_PART(ip.res_id, ',', 2)::int
|
||||
JOIN base_comment_template bct
|
||||
ON bct.id = SPLIT_PART(ip.value_reference, ',', 2)::int
|
||||
WHERE imf.name = 'property_comment_template_id'
|
||||
AND imf.model = 'res.partner'
|
||||
AND ip.res_id IS NOT NULL
|
||||
|
||||
Reference in New Issue
Block a user