Skip to content

Commit

Permalink
Merge PR #17 into 14.0
Browse files Browse the repository at this point in the history
Signed-off-by etobella
  • Loading branch information
OCA-git-bot committed Feb 27, 2024
2 parents 8272680 + 6ac4998 commit 7f56a67
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 0 deletions.
13 changes: 13 additions & 0 deletions sign_oca/models/sign_oca_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,19 @@ def _compute_next_item_id(self):
record.signatory_data and max(record.signatory_data.keys()) or 0
) + 1

def preview(self):
self.ensure_one()
self._set_action_log("view")
return {
"type": "ir.actions.client",
"tag": "sign_oca_preview",
"name": self.name,
"params": {
"res_model": self._name,
"res_id": self.id,
},
}

def get_info(self):
self.ensure_one()
return {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
odoo.define(
"sign_oca/static/src/components/sign_oca_pdf_common/sign_oca_pdf_common_action.js",
function (require) {
"use strict";

const {ComponentWrapper} = require("web.OwlCompatibility");
const AbstractAction = require("web.AbstractAction");
const core = require("web.core");
const SignOcaPdfCommon = require("sign_oca/static/src/components/sign_oca_pdf_common/sign_oca_pdf_common.js");

const SignOcaPdfCommonAction = AbstractAction.extend({
hasControlPanel: true,
init: function (parent, action) {
this._super.apply(this, arguments);
this.model =
(action.params.res_model !== undefined &&
action.params.res_model) ||
action.context.params.res_model;
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, SignOcaPdfCommon, {
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 () {
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_preview", SignOcaPdfCommonAction);

return {
SignOcaPdfCommonAction,
};
}
);
4 changes: 4 additions & 0 deletions sign_oca/templates/assets.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
type="text/javascript"
src="/sign_oca/static/src/components/sign_oca_pdf_common/sign_oca_pdf_common.js"
/>
<script
type="text/javascript"
src="/sign_oca/static/src/components/sign_oca_pdf_common/sign_oca_pdf_common_action.js"
/>
<script
type="text/javascript"
src="/sign_oca/static/src/elements/registry.js"
Expand Down
2 changes: 2 additions & 0 deletions sign_oca/views/sign_oca_request.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
<sheet>
<div class="oe_button_box" name="button_box">
<button
name="preview"
type="object"
class="oe_stat_button"
icon="fa-pencil"
states="sent,signed"
Expand Down

0 comments on commit 7f56a67

Please sign in to comment.