-
-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by simahawk
- Loading branch information
Showing
28 changed files
with
477 additions
and
449 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,19 +17,19 @@ Product Configurator | |
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html | ||
:alt: License: AGPL-3 | ||
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fproduct--configurator-lightgray.png?logo=github | ||
:target: https://github.com/OCA/product-configurator/tree/16.0/product_configurator | ||
:target: https://github.com/OCA/product-configurator/tree/17.0/product_configurator | ||
:alt: OCA/product-configurator | ||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png | ||
:target: https://translation.odoo-community.org/projects/product-configurator-16-0/product-configurator-16-0-product_configurator | ||
:target: https://translation.odoo-community.org/projects/product-configurator-17-0/product-configurator-17-0-product_configurator | ||
:alt: Translate me on Weblate | ||
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png | ||
:target: https://runboat.odoo-community.org/builds?repo=OCA/product-configurator&target_branch=16.0 | ||
:target: https://runboat.odoo-community.org/builds?repo=OCA/product-configurator&target_branch=17.0 | ||
:alt: Try me on Runboat | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
This module has all the mechanics to support product configuration. It serves as a base | ||
dependency for configuration interfaces. | ||
This module has all the mechanics to support product configuration. It | ||
serves as a base dependency for configuration interfaces. | ||
|
||
**Table of contents** | ||
|
||
|
@@ -42,27 +42,27 @@ Bug Tracker | |
Bugs are tracked on `GitHub Issues <https://github.com/OCA/product-configurator/issues>`_. | ||
In case of trouble, please check there if your issue has already been reported. | ||
If you spotted it first, help us to smash it by providing a detailed and welcomed | ||
`feedback <https://github.com/OCA/product-configurator/issues/new?body=module:%20product_configurator%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. | ||
`feedback <https://github.com/OCA/product-configurator/issues/new?body=module:%20product_configurator%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. | ||
|
||
Do not contact contributors directly about support or help with technical issues. | ||
|
||
Credits | ||
======= | ||
|
||
Authors | ||
~~~~~~~ | ||
------- | ||
|
||
* Pledra | ||
|
||
Contributors | ||
~~~~~~~~~~~~ | ||
------------ | ||
|
||
* `Aion Tech <https://aiontech.company/>`_: | ||
- `Aion Tech <https://aiontech.company/>`__: | ||
|
||
* Simone Rubino <[email protected]> | ||
- Simone Rubino <[email protected]> | ||
|
||
Maintainers | ||
~~~~~~~~~~~ | ||
----------- | ||
|
||
This module is maintained by the OCA. | ||
|
||
|
@@ -82,6 +82,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__: | |
|
||
|maintainer-PCatinean| | ||
|
||
This module is part of the `OCA/product-configurator <https://github.com/OCA/product-configurator/tree/16.0/product_configurator>`_ project on GitHub. | ||
This module is part of the `OCA/product-configurator <https://github.com/OCA/product-configurator/tree/17.0/product_configurator>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
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
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[build-system] | ||
requires = ["whool"] | ||
build-backend = "whool.buildapi" |
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
- [Aion Tech](https://aiontech.company/): | ||
- Simone Rubino \<<[email protected]>\> |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
This module has all the mechanics to support product configuration. It | ||
serves as a base dependency for configuration interfaces. |
This file was deleted.
Oops, something went wrong.
46 changes: 26 additions & 20 deletions
46
product_configurator/static/src/js/boolean_button_widget.esm.js
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,58 +1,64 @@ | ||
/** @odoo-module **/ | ||
const {onMounted, onRendered, useRef, useState} = owl; | ||
import {BooleanField} from "@web/views/fields/boolean/boolean_field"; | ||
import {BooleanField, booleanField} from "@web/views/fields/boolean/boolean_field"; | ||
import {onMounted, onRendered, useRef} from "@odoo/owl"; | ||
import {registry} from "@web/core/registry"; | ||
import {standardFieldProps} from "@web/views/fields/standard_field_props"; | ||
|
||
export class BooleanButtonField extends BooleanField { | ||
export class BooleanButton extends BooleanField { | ||
static template = "product_configurator.BooleanButtonField"; | ||
|
||
setup() { | ||
super.setup(); | ||
this.state1 = useState({value: 0}); | ||
this.root = useRef("root"); | ||
|
||
onMounted(() => { | ||
this.updateConfigurableButton(); | ||
}); | ||
|
||
onRendered(() => { | ||
this.updateConfigurableButton(); | ||
}); | ||
} | ||
|
||
onChange() { | ||
this.state1.value++; | ||
} | ||
|
||
updateConfigurableButton() { | ||
this.text = this.props.value | ||
this.text = this.state.value | ||
? this.props.activeString | ||
: this.props.inactiveString; | ||
this.hover = this.props.value | ||
this.hover = this.state.value | ||
? this.props.inactiveString | ||
: this.props.activeString; | ||
var val_color = this.props.value ? "text-success" : "text-danger"; | ||
var hover_color = this.props.value ? "text-danger" : "text-success"; | ||
|
||
var val_color = this.state.value ? "text-success" : "text-danger"; | ||
var hover_color = this.state.value ? "text-danger" : "text-success"; | ||
|
||
var $val = $("<span>") | ||
.addClass("o_stat_text o_boolean_button o_not_hover " + val_color) | ||
.text(this.text); | ||
var $hover = $("<span>") | ||
.addClass("o_stat_text o_boolean_button o_hover d-none " + hover_color) | ||
.text(this.hover); | ||
|
||
$(this.root.el).empty(); | ||
$(this.root.el).append($val).append($hover); | ||
} | ||
} | ||
|
||
BooleanButtonField.props = { | ||
BooleanButton.props = { | ||
...standardFieldProps, | ||
activeString: {type: String, optional: true}, | ||
activeString: {type: String}, | ||
inactiveString: {type: String, optional: true}, | ||
}; | ||
|
||
BooleanButtonField.extractProps = ({attrs}) => { | ||
return { | ||
activeString: attrs.options.active, | ||
inactiveString: attrs.options.inactive, | ||
}; | ||
export const BooleanButtonField = { | ||
...booleanField, | ||
component: BooleanButton, | ||
extractProps: ({options}) => { | ||
return { | ||
activeString: options.active, | ||
inactiveString: options.inactive, | ||
}; | ||
}, | ||
}; | ||
|
||
BooleanButtonField.template = "product_configurator.BooleanButtonField"; | ||
// Register the field component | ||
registry.category("fields").add("boolean_button", BooleanButtonField); |
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* @odoo-module */ | ||
import {FormController} from "@web/views/form/form_controller"; | ||
import {patch} from "@web/core/utils/patch"; | ||
|
||
patch(FormController.prototype, { | ||
setup() { | ||
super.setup(...arguments); | ||
if ( | ||
this.props.resModel === "product.product" && | ||
this.props.context.custom_create_variant | ||
) { | ||
this.canCreate = false; | ||
} | ||
}, | ||
async beforeExecuteActionButton(clickParams) { | ||
if (clickParams.special === "no_save") { | ||
delete clickParams.special; | ||
return true; | ||
} | ||
return super.beforeExecuteActionButton(...arguments); | ||
}, | ||
}); |
Oops, something went wrong.