-
-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
117 additions
and
176 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,106 +1,81 @@ | ||
/** @odoo-module **/ | ||
/* @odoo-module */ | ||
|
||
import {registry} from "@web/core/registry"; | ||
import {patch} from "@web/core/utils/patch"; | ||
import {FormController} from "@web/views/form/form_controller"; | ||
import {ListController} from "@web/views/list/list_controller"; | ||
import {KanbanController} from "@web/views/kanban/kanban_controller"; | ||
import {pyUtils} from "@web/core/py_js/py_utils"; | ||
import {formView} from "@web/views/form/form_view"; | ||
import {onMounted} from "@odoo/owl"; | ||
|
||
export class FieldBooleanButton extends FormController { | ||
patch(FormController.prototype, { | ||
setup() { | ||
super.setup(); | ||
this.archInfo = this.props.archInfo; | ||
const footers = this.archInfo; | ||
console.log("================", footers); | ||
} | ||
|
||
_onButtonClicked(event) { | ||
alert("sssssss"); | ||
} | ||
} | ||
|
||
registry.category("views").add("product_template_form_view", { | ||
...formView, | ||
Controller: FieldBooleanButton, | ||
super.setup(...arguments); | ||
onMounted(() => { | ||
var form_element = this.rootRef.el; | ||
var self = this; | ||
if ( | ||
self.model.config.resModel === "product.product" && | ||
self.model.config.context.custom_create_variant | ||
) { | ||
var buttons = form_element.querySelector( | ||
".o_control_panel_main_buttons" | ||
); | ||
var createButtons = buttons.querySelectorAll(".o_form_button_create"); | ||
createButtons.forEach((button) => { | ||
button.style.display = "none"; | ||
}); | ||
} | ||
}); | ||
}, | ||
async beforeExecuteActionButton(clickParams) { | ||
console.log("beforeExecuteActionButton", clickParams); | ||
if (clickParams.special === "no_save") { | ||
delete clickParams.special; | ||
return true; | ||
} | ||
return super.beforeExecuteActionButton(...arguments); | ||
}, | ||
}); | ||
|
||
// odoo.define("product_configurator.FieldBooleanButton", function (require) { | ||
// "use strict"; | ||
|
||
// var FormController = require("web.FormController"); | ||
// var ListController = require("web.ListController"); | ||
// var KanbanController = require("web.KanbanController"); | ||
|
||
// var pyUtils = require("web.py_utils"); | ||
|
||
// FormController.include({ | ||
// /* eslint-disable no-unused-vars*/ | ||
// renderButtons: function ($node) { | ||
// var self = this; | ||
// this._super.apply(this, arguments); | ||
// if ( | ||
// self.modelName === "product.product" && | ||
// self.initialState.context.custom_create_variant | ||
// ) { | ||
// this.$buttons.find(".o_form_button_create").css("display", "none"); | ||
// } | ||
// }, | ||
// /* eslint-disable no-unused-vars*/ | ||
patch(ListController.prototype, { | ||
setup() { | ||
super.setup(...arguments); | ||
onMounted(() => { | ||
var form_element = this.rootRef.el; | ||
var self = this; | ||
if ( | ||
self.model.config.resModel === "product.product" && | ||
self.model.config.context.custom_create_variant | ||
) { | ||
var buttons = form_element.querySelector( | ||
".o_control_panel_main_buttons" | ||
); | ||
var createButtons = buttons.querySelectorAll(".o_list_button_add"); | ||
createButtons.forEach((button) => { | ||
button.style.display = "none"; | ||
}); | ||
} | ||
}); | ||
}, | ||
}); | ||
|
||
// _onButtonClicked: function (event) { | ||
// var self = this; | ||
// var attrs = event.data.attrs; | ||
// if (event.data.attrs.context) { | ||
// var record_ctx = self.model.get(event.data.record.id).context; | ||
// var btn_ctx = pyUtils.eval( | ||
// "context", | ||
// record_ctx, | ||
// event.data.attrs.context | ||
// ); | ||
// self.model.localData[event.data.record.id].context = _.extend( | ||
// {}, | ||
// btn_ctx, | ||
// record_ctx | ||
// ); | ||
// } | ||
// if (attrs.special === "no_save") { | ||
// this.canBeSaved = function () { | ||
// return true; | ||
// }; | ||
// var event_no_save = $.extend(true, {}, event); | ||
// event_no_save.data.attrs.special = false; | ||
// return this._super(event_no_save); | ||
// } | ||
// this._super(event); | ||
// }, | ||
// }); | ||
// ListController.include({ | ||
// /* eslint-disable no-unused-vars*/ | ||
// renderButtons: function ($node) { | ||
// var self = this; | ||
// this._super.apply(this, arguments); | ||
// if ( | ||
// self.modelName === "product.product" && | ||
// self.initialState.context.custom_create_variant | ||
// ) { | ||
// this.$buttons.find(".o_list_button_add").css("display", "none"); | ||
// } | ||
// }, | ||
// /* eslint-disable no-unused-vars*/ | ||
// }); | ||
// KanbanController.include({ | ||
// /* eslint-disable no-unused-vars*/ | ||
// renderButtons: function ($node) { | ||
// var self = this; | ||
// this._super.apply(this, arguments); | ||
// if ( | ||
// self.modelName === "product.product" && | ||
// self.initialState.context.custom_create_variant | ||
// ) { | ||
// this.$buttons.find(".o-kanban-button-new").css("display", "none"); | ||
// } | ||
// }, | ||
// /* eslint-disable no-unused-vars*/ | ||
// }); | ||
// }); | ||
patch(KanbanController.prototype, { | ||
setup() { | ||
super.setup(...arguments); | ||
onMounted(() => { | ||
var form_element = this.rootRef.el; | ||
var self = this; | ||
if ( | ||
self.model.config.resModel === "product.product" && | ||
self.model.config.context.custom_create_variant | ||
) { | ||
var buttons = form_element.querySelector( | ||
".o_control_panel_main_buttons" | ||
); | ||
var createButtons = buttons.querySelectorAll(".o-kanban-button-new"); | ||
createButtons.forEach((button) => { | ||
button.style.display = "none"; | ||
}); | ||
} | ||
}); | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,14 @@ | ||
odoo.define("product_configurator.FieldStatus", function (require) { | ||
"use strict"; | ||
/** @odoo-module **/ | ||
|
||
var fields = require("web.relational_fields"); | ||
var FieldStatus = fields.FieldStatus; | ||
import {patch} from "@web/core/utils/patch"; | ||
import {Many2OneField} from "@web/views/fields/many2one/many2one_field"; | ||
|
||
FieldStatus.include({ | ||
/* Prase input as string in order to have a clickable statusbar*/ | ||
_onClickStage: function (e) { | ||
this._setValue(String($(e.currentTarget).data("value"))); | ||
}, | ||
}); | ||
|
||
/* Bug from odoo: in case of widget many2many_tags $input and $el do not exist | ||
in 'this', so it returns 'undefine', but setIDForLabel(method in AbstractField) | ||
expecting getFocusableElement always return object*/ | ||
fields.FieldMany2One.include({ | ||
getFocusableElement: function () { | ||
var element = this._super.apply(this, arguments); | ||
if (element === undefined) { | ||
return $(); | ||
} | ||
return element; | ||
}, | ||
}); | ||
patch(Many2OneField.prototype, { | ||
computeActiveActions(props) { | ||
var element = super.computeActiveActions(...arguments); | ||
if (element === undefined) { | ||
return $(); | ||
} | ||
return element; | ||
}, | ||
}); |
Oops, something went wrong.