[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:
Pedro M. Baeza
2021-05-15 16:58:39 +02:00
committed by Víctor Martínez
parent 19b7692ee8
commit 34333c4216
5 changed files with 54 additions and 4 deletions

View File

@@ -11,8 +11,8 @@ class ResPartner(models.Model):
base_comment_template_ids = fields.Many2many(
comodel_name="base.comment.template",
relation="base_comment_template_res_partner_rel",
column1="base_comment_template_id",
column2="res_partner_id",
column1="res_partner_id",
column2="base_comment_template_id",
string="Comment Templates",
help="Specific partner comments that can be included in reports",
)