[MIG] document_page_approval: Migration to 17.0

This commit is contained in:
EdgarRetes
2024-10-02 10:40:29 -06:00
committed by Bhavesh Heliconia
parent 49f3835e45
commit a4972a014d
8 changed files with 47 additions and 55 deletions

View File

@@ -19,7 +19,6 @@ class DocumentPage(models.Model):
related="history_head.approved_date",
store=True,
index=True,
readonly=True,
)
approved_uid = fields.Many2one(
@@ -28,7 +27,6 @@ class DocumentPage(models.Model):
related="history_head.approved_uid",
store=True,
index=True,
readonly=True,
)
approval_required = fields.Boolean(
@@ -137,8 +135,9 @@ class DocumentPage(models.Model):
def action_changes_pending_approval(self):
self.ensure_one()
action = self.env.ref("document_page_approval.action_change_requests")
action = action.sudo().read()[0]
action = self.env["ir.actions.act_window"]._for_xml_id(
"document_page_approval.action_change_requests"
)
context = literal_eval(action["context"])
context["search_default_page_id"] = self.id
context["default_page_id"] = self.id

View File

@@ -22,7 +22,6 @@ class DocumentPageHistory(models.Model):
],
"Status",
default="draft",
readonly=True,
)
approved_date = fields.Datetime()
@@ -79,7 +78,7 @@ class DocumentPageHistory(models.Model):
[("groups_id", "in", guids), ("groups_id", "in", approver_gid.id)]
)
rec.message_subscribe(partner_ids=users.mapped("partner_id").ids)
rec.message_post_with_template(template.id)
rec.message_post_with_source(template)
else:
# auto-approve if approval is not required
rec.action_approve()