diff --git a/sign_oca/__manifest__.py b/sign_oca/__manifest__.py index ba0e188a..1b4a58b5 100644 --- a/sign_oca/__manifest__.py +++ b/sign_oca/__manifest__.py @@ -5,7 +5,7 @@ "name": "Sign Oca", "summary": """ Allow to sign documents inside Odoo CE""", - "version": "16.0.4.0.0", + "version": "17.0.1.0.0", "license": "AGPL-3", "author": "Dixmit,Odoo Community Association (OCA)", "website": "https://github.com/OCA/sign", @@ -63,7 +63,6 @@ "sign_oca/static/src/components/sign_oca_pdf_portal/sign_oca_pdf_portal.esm.js", "sign_oca/static/src/components/sign_oca_pdf_portal/sign_oca_pdf_portal.xml", "sign_oca/static/src/scss/portal.scss", - "sign_oca/static/src/js/*.js", "sign_oca/static/src/xml/*.xml", ], "sign_oca.sign_assets": [ diff --git a/sign_oca/migrations/16.0.1.1.1/pre-migration.py b/sign_oca/migrations/16.0.1.1.1/pre-migration.py deleted file mode 100644 index bcb86c05..00000000 --- a/sign_oca/migrations/16.0.1.1.1/pre-migration.py +++ /dev/null @@ -1,25 +0,0 @@ -# Copyright 2024 ForgeFlow S.L. -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). - -from openupgradelib import openupgrade - - -@openupgrade.migrate() -def migrate(env, version): - old_column_name = "partner_type" - new_column_name = "partner_selection_policy" - - if not openupgrade.column_exists( - env.cr, "sign_oca_role", new_column_name - ) and openupgrade.column_exists(env.cr, "sign_oca_role", old_column_name): - openupgrade.rename_columns( - env.cr, - { - "sign_oca_role": [ - ( - old_column_name, - new_column_name, - ), - ] - }, - ) diff --git a/sign_oca/models/sign_oca_request.py b/sign_oca/models/sign_oca_request.py index 9d33e61d..8cf714a6 100644 --- a/sign_oca/models/sign_oca_request.py +++ b/sign_oca/models/sign_oca_request.py @@ -27,16 +27,12 @@ class SignOcaRequest(models.Model): name = fields.Char(required=True) active = fields.Boolean(default=True) - template_id = fields.Many2one("sign.oca.template", readonly=True) - data = fields.Binary( - required=True, readonly=True, states={"draft": [("readonly", False)]} - ) + template_id = fields.Many2one("sign.oca.template") + data = fields.Binary(required=True) filename = fields.Char() user_id = fields.Many2one( comodel_name="res.users", string="Responsible", - readonly=True, - states={"draft": [("readonly", False)]}, default=lambda self: self.env.user, required=True, ) @@ -48,8 +44,6 @@ class SignOcaRequest(models.Model): .search([("transient", "=", False), ("model", "not like", "sign.oca")]) ], string="Object", - readonly=True, - states={"draft": [("readonly", False)]}, ) signed = fields.Boolean(copy=False) signer_ids = fields.One2many( @@ -75,7 +69,6 @@ class SignOcaRequest(models.Model): ("cancel", "Cancelled"), ], default="draft", - readonly=True, required=True, copy=False, tracking=True, @@ -85,16 +78,13 @@ class SignOcaRequest(models.Model): to_sign = fields.Boolean(compute="_compute_to_sign") signatory_data = fields.Serialized( default=lambda r: {}, - readonly=True, copy=False, ) - current_hash = fields.Char(readonly=True, copy=False) + current_hash = fields.Char(copy=False) company_id = fields.Many2one( "res.company", default=lambda r: r.env.company.id, required=True, - readonly=True, - states={"draft": [("readonly", False)]}, ) next_item_id = fields.Integer(compute="_compute_next_item_id") ask_location = fields.Boolean() @@ -351,8 +341,8 @@ class SignOcaRequestSigner(models.Model): partner_name = fields.Char(related="partner_id.name") partner_id = fields.Many2one("res.partner", required=True, ondelete="restrict") role_id = fields.Many2one("sign.oca.role", required=True, ondelete="restrict") - signed_on = fields.Datetime(readonly=True) - signature_hash = fields.Char(readonly=True) + signed_on = fields.Datetime() + signature_hash = fields.Char() model = fields.Char(compute="_compute_model", store=True) res_id = fields.Integer(compute="_compute_res_id", store=True) is_allow_signature = fields.Boolean(compute="_compute_is_allow_signature") @@ -584,9 +574,9 @@ def _set_action_log(self, action, **kwargs): self.ensure_one() return self.request_id._set_action_log(action, signer_id=self.id, **kwargs) - def name_get(self): - result = [(signer.id, (signer.partner_id.display_name)) for signer in self] - return result + def _compute_display_name(self): + for signer in self: + signer.display_name = signer.partner_id.display_name def _get_sequence(self): return self.env.ref("sign_oca.sign_inalterability_sequence") @@ -663,13 +653,10 @@ class SignRequestLog(models.Model): uid = fields.Many2one( "res.users", required=True, - readonly=True, ondelete="cascade", default=lambda r: r.env.user.id, ) - date = fields.Datetime( - required=True, readonly=True, default=lambda r: fields.Datetime.now() - ) + date = fields.Datetime(required=True, default=lambda r: fields.Datetime.now()) partner_id = fields.Many2one( "res.partner", required=True, default=lambda r: r.env.user.partner_id.id ) @@ -688,7 +675,6 @@ class SignRequestLog(models.Model): ("configure", "Configure"), ], required=True, - readonly=True, ) - access_token = fields.Char(readonly=True) - ip = fields.Char(readonly=True) + access_token = fields.Char() + ip = fields.Char() diff --git a/sign_oca/static/src/components/sign_oca_configure/sign_oca_configure.esm.js b/sign_oca/static/src/components/sign_oca_configure/sign_oca_configure.esm.js index 5178eb92..ace400de 100644 --- a/sign_oca/static/src/components/sign_oca_configure/sign_oca_configure.esm.js +++ b/sign_oca/static/src/components/sign_oca_configure/sign_oca_configure.esm.js @@ -1,12 +1,14 @@ -/** @odoo-module **/ +/** @odoo-module QWeb **/ -import {ComponentWrapper} from "web.OwlCompatibility"; -import AbstractAction from "web.AbstractAction"; -import Dialog from "web.Dialog"; -import core from "web.core"; -import ControlPanel from "web.ControlPanel"; +import {Component} from "@odoo/owl"; +import {ControlPanel} from "@web/search/control_panel/control_panel"; +import {Dialog} from "@web/core/dialog/dialog"; +import {FormRenderer} from "@web/views/form/form_renderer"; import SignOcaPdfCommon from "../sign_oca_pdf_common/sign_oca_pdf_common.esm.js"; -const _t = core._t; +import {_t} from "@web/core/l10n/translation"; +import {registry} from "@web/core/registry"; +import {renderToString} from "@web/core/utils/render"; + export class SignOcaConfigureControlPanel extends ControlPanel {} SignOcaConfigureControlPanel.template = "sign_oca.SignOcaConfigureControlPanel"; export class SignOcaConfigure extends SignOcaPdfCommon { @@ -35,7 +37,7 @@ export class SignOcaConfigure extends SignOcaPdfCommon { } var position = page.getBoundingClientRect(); this.contextMenu = $( - core.qweb.render("sign_oca.sign_iframe_contextmenu", { + renderToString("sign_oca.sign_iframe_contextmenu", { page, e, left: ((e.pageX - position.x) * 100) / position.width + "%", @@ -111,7 +113,7 @@ export class SignOcaConfigure extends SignOcaPdfCommon { var dialog = new Dialog(this, { title: _t("Edit field"), $content: $( - core.qweb.render("sign_oca.sign_oca_field_edition", { + renderToString("sign_oca.sign_oca_field_edition", { item, info: this.info, }) @@ -367,9 +369,8 @@ export class SignOcaConfigure extends SignOcaPdfCommon { } } -export const SignOcaConfigureAction = AbstractAction.extend({ - hasControlPanel: true, - init: function (parent, action) { +export class SignOcaConfigureAction extends Component { + init(parent, action) { this._super.apply(this, arguments); this.model = (action.params.res_model !== undefined && action.params.res_model) || @@ -377,24 +378,24 @@ export const SignOcaConfigureAction = AbstractAction.extend({ this.res_id = (action.params.res_id !== undefined && action.params.res_id) || action.context.params.id; - }, + } async start() { await this._super(...arguments); - this.component = new ComponentWrapper(this, SignOcaConfigure, { + this.component = new FormRenderer(this, SignOcaConfigure, { model: this.model, res_id: this.res_id, }); this.$el.addClass("o_sign_oca_action"); return this.component.mount(this.$(".o_content")[0]); - }, - getState: function () { + } + getState() { var result = this._super(...arguments); result = _.extend({}, result, { res_model: this.model, res_id: this.res_id, }); return result; - }, -}); -core.action_registry.add("sign_oca_configure", SignOcaConfigureAction); + } +} SignOcaConfigure.template = "sign_oca.SignOcaConfigure"; +registry.category("actions").add("sign_oca_configure", SignOcaConfigureAction); diff --git a/sign_oca/static/src/components/sign_oca_configure/sign_oca_configure.xml b/sign_oca/static/src/components/sign_oca_configure/sign_oca_configure.xml index 01801d67..15bf4b1c 100644 --- a/sign_oca/static/src/components/sign_oca_configure/sign_oca_configure.xml +++ b/sign_oca/static/src/components/sign_oca_configure/sign_oca_configure.xml @@ -107,7 +107,6 @@ t-name="sign_oca.SignOcaConfigure" t-inherit="sign_oca.SignOcaPdfCommon" t-inherit-mode="primary" - owl="1" >
- +