Skip to content

Commit

Permalink
shopfloor_mobile_base: add function for action path
Browse files Browse the repository at this point in the history
  • Loading branch information
TDu committed Aug 23, 2023
1 parent 417481b commit eddfb9b
Showing 1 changed file with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,15 @@ export var ItemDetailMixin = {
_render_date(record, field) {
return this.utils.display.format_date_display(_.result(record, field.path));
},
get_action_value_path(record, field) {
if (typeof field.action_val_path == "function") {
return field.action_val_path(record);
} else {
return field.action_val_path;
}
},
has_detail_action(record, field) {
return _.result(record, field.action_val_path);
return _.result(record, this.get_action_value_path(record, field));
},
on_detail_action(record, field, options = {}) {
let handler = this.default_detail_action_handler;
Expand All @@ -58,7 +65,10 @@ export var ItemDetailMixin = {
handler.call(this, record, field);
},
default_detail_action_handler(record, field) {
const identifier = _.result(record, field.action_val_path);
const identifier = _.result(
record,
this.get_action_value_path(record, field)
);
if (identifier) {
// TODO: we should probably delegate this to a global event
this.$router.push({
Expand Down

0 comments on commit eddfb9b

Please sign in to comment.