Skip to content

Commit

Permalink
[FIX] peoduct_configurator_mrp: pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
dreispt committed Feb 22, 2024
1 parent a8c7451 commit 1662454
Show file tree
Hide file tree
Showing 11 changed files with 69 additions and 48 deletions.
6 changes: 4 additions & 2 deletions product_configurator_mrp/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,10 @@ Authors
Contributors
------------

- Aion Tech `https://aiontech.company <https://aiontech.company>`__
- Simone Rubino [email protected]
- ``Aion Tech <https://aiontech.company>``\ \_\_\_\_:

- Simone Rubino [email protected]

- Murtaza Mithaiwala [email protected]

Maintainers
Expand Down
2 changes: 1 addition & 1 deletion product_configurator_mrp/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"/product_configurator_mrp/static/src/js/kanban_controller.js",
"/product_configurator_mrp/static/src/js/form_controller.js",
"/product_configurator_mrp/static/src/scss/mrp_config.scss",
"/product_configurator_mrp/static/src/xml/mrp_production_views.xml"
"/product_configurator_mrp/static/src/xml/mrp_production_views.xml",
],
},
"demo": ["demo/product_template.xml"],
Expand Down
2 changes: 1 addition & 1 deletion product_configurator_mrp/models/mrp.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (C) 2021 Open Source Integrators
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import fields, models, api
from odoo import api, fields, models


class MrpProduction(models.Model):
Expand Down
10 changes: 6 additions & 4 deletions product_configurator_mrp/models/product_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,7 @@ def create_get_bom(self, variant, product_tmpl_id=None, values=None):
parent_bom_line_vals, ["product_id", "product_qty"], specs
)
values = updates.get("value", {})
values = self.get_vals_to_write(
values=values, model="mrp.bom.line"
)
values = self.get_vals_to_write(values=values, model="mrp.bom.line")
values.update(parent_bom_line_vals)
bom_lines.append((0, 0, values))
if bom_lines:
Expand All @@ -123,7 +121,11 @@ def create_get_bom(self, variant, product_tmpl_id=None, values=None):
specs[key] = {}
updates = mrpBom.onchange(
bom_values,
["product_id", "product_configurator_sale_mrproduct_tmpl_id", "bom_line_ids"],
[
"product_id",
"product_configurator_sale_mrproduct_tmpl_id",
"bom_line_ids",
],
specs,
)
values = updates.get("value", {})
Expand Down
6 changes: 4 additions & 2 deletions product_configurator_mrp/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
- Aion Tech <https://aiontech.company>
- Simone Rubino <[email protected]>
- `Aion Tech <https://aiontech.company>`____:

* Simone Rubino <[email protected]>

- Murtaza Mithaiwala <[email protected]>
4 changes: 3 additions & 1 deletion product_configurator_mrp/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -402,8 +402,10 @@ <h2><a class="toc-backref" href="#toc-entry-3">Authors</a></h2>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#toc-entry-4">Contributors</a></h2>
<ul class="simple">
<li>Aion Tech <a class="reference external" href="https://aiontech.company">https://aiontech.company</a></li>
<li><tt class="docutils literal">Aion Tech <span class="pre">&lt;https://aiontech.company&gt;</span></tt>____:<ul>
<li>Simone Rubino <a class="reference external" href="mailto:simone.rubino&#64;aion-tech.it">simone.rubino&#64;aion-tech.it</a></li>
</ul>
</li>
<li>Murtaza Mithaiwala <a class="reference external" href="mailto:mmithaiwala&#64;opensourceintegrators.com">mmithaiwala&#64;opensourceintegrators.com</a></li>
</ul>
</div>
Expand Down
19 changes: 10 additions & 9 deletions product_configurator_mrp/static/src/js/form_controller.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/** @odoo-module **/

import { _t } from "@web/core/l10n/translation";
import { registry } from "@web/core/registry";
import { useService } from "@web/core/utils/hooks";
import { formView } from "@web/views/form/form_view";
import { FormController } from "@web/views/form/form_controller";
import {_t} from "@web/core/l10n/translation";
import {registry} from "@web/core/registry";
import {useService} from "@web/core/utils/hooks";
import {formView} from "@web/views/form/form_view";
import {FormController} from "@web/views/form/form_controller";

export class ProductConfiguratorFormController extends FormController {
setup() {
Expand All @@ -15,19 +15,20 @@ export class ProductConfiguratorFormController extends FormController {
}

async _onConfigure() {
let action = await this.orm.call("mrp.production", 'action_config_start', [])
this.action.doAction(action)
let action = await this.orm.call("mrp.production", "action_config_start", []);
this.action.doAction(action);
}
}
ProductConfiguratorFormController.components = {
...FormController.components,
};


export const ProductConfiguratorFormView = {
...formView,
Controller: ProductConfiguratorFormController,
buttonTemplate: "product_configurator_mrp.FormButtons",
};

registry.category("views").add("product_configurator_mrp_form", ProductConfiguratorFormView);
registry
.category("views")
.add("product_configurator_mrp_form", ProductConfiguratorFormView);
22 changes: 11 additions & 11 deletions product_configurator_mrp/static/src/js/kanban_controller.js
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
/** @odoo-module **/
/** @odoo-module **/

import { _t } from "@web/core/l10n/translation";
import { registry } from "@web/core/registry";
import { useService } from "@web/core/utils/hooks";
import { kanbanView } from "@web/views/kanban/kanban_view";
import { KanbanController } from "@web/views/kanban/kanban_controller";
import {_t} from "@web/core/l10n/translation";
import {registry} from "@web/core/registry";
import {useService} from "@web/core/utils/hooks";
import {kanbanView} from "@web/views/kanban/kanban_view";
import {KanbanController} from "@web/views/kanban/kanban_controller";

export class ProductConfiguratorKanbanController extends KanbanController {
setup() {
super.setup();
this.action = useService("action");
this.rpc = useService("rpc");
this.orm = useService("orm");

}

async _onConfigure() {
let action = await this.orm.call("mrp.production", 'action_config_start', [])
this.action.doAction(action)
let action = await this.orm.call("mrp.production", "action_config_start", []);
this.action.doAction(action);
}
}
ProductConfiguratorKanbanController.components = {
...KanbanController.components,
};


export const ProductConfiguratorKanbanView = {
...kanbanView,
Controller: ProductConfiguratorKanbanController,
buttonTemplate: "product_configurator_mrp.KanbanButtons",
};
registry.category("views").add("product_configurator_mrp_kanban", ProductConfiguratorKanbanView);
registry
.category("views")
.add("product_configurator_mrp_kanban", ProductConfiguratorKanbanView);
24 changes: 12 additions & 12 deletions product_configurator_mrp/static/src/js/list_controller.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
/** @odoo-module **/
/** @odoo-module **/

import { _t } from "@web/core/l10n/translation";
import { registry } from "@web/core/registry";
import { listView } from "@web/views/list/list_view";
import { ListController } from "@web/views/list/list_controller";
import { useService } from "@web/core/utils/hooks";
import {_t} from "@web/core/l10n/translation";
import {registry} from "@web/core/registry";
import {listView} from "@web/views/list/list_view";
import {ListController} from "@web/views/list/list_controller";
import {useService} from "@web/core/utils/hooks";

export class ProductConfiguratorController extends ListController {
setup() {
super.setup();
this.action = useService("action");
this.rpc = useService("rpc");
this.orm = useService("orm");

}

async _onConfigure() {
let action = await this.orm.call("mrp.production", 'action_config_start', [])
this.action.doAction(action)
let action = await this.orm.call("mrp.production", "action_config_start", []);
this.action.doAction(action);
}
};
}

ProductConfiguratorController.components = {
...ListController.components,
Expand All @@ -31,5 +30,6 @@ export const ProductConfiguratorListView = {
buttonTemplate: "product_configurator_mrp.ListButtons",
};


registry.category("views").add("product_configurator_mrp_tree", ProductConfiguratorListView);
registry
.category("views")
.add("product_configurator_mrp_tree", ProductConfiguratorListView);
20 changes: 16 additions & 4 deletions product_configurator_mrp/static/src/xml/mrp_production_views.xml
Original file line number Diff line number Diff line change
@@ -1,23 +1,35 @@
<?xml version="1.0" encoding="UTF-8" ?>
<templates>
<t t-name="product_configurator_mrp.ListButtons" t-inherit="web.ListView.Buttons" t-inherit-mode="primary">
<t
t-name="product_configurator_mrp.ListButtons"
t-inherit="web.ListView.Buttons"
t-inherit-mode="primary"
>
<xpath expr="//div[hasclass('o_list_buttons')]" position="inside">
<!-- t-on-click="onUnselectClick" -->
<button type="button" class="btn btn-primary" t-on-click="_onConfigure">
Configure
</button>
</xpath>
</t>

<t t-name="product_configurator_mrp.KanbanButtons" t-inherit="web.KanbanView.Buttons" t-inherit-mode="primary">

<t
t-name="product_configurator_mrp.KanbanButtons"
t-inherit="web.KanbanView.Buttons"
t-inherit-mode="primary"
>
<xpath expr="//div[hasclass('o_cp_buttons')]" position="inside">
<button type="button" class="btn btn-primary" t-on-click="_onConfigure">
Configure
</button>
</xpath>
</t>

<t t-name="product_configurator_mrp.FormButtons" t-inherit="web.FormView.Buttons" t-inherit-mode="primary">
<t
t-name="product_configurator_mrp.FormButtons"
t-inherit="web.FormView.Buttons"
t-inherit-mode="primary"
>
<xpath expr="//div[hasclass('o_cp_buttons')]" position="inside">
<button type="button" class="btn btn-primary" t-on-click="_onConfigure">
Configure
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def action_config_done(self):
# values = updates.get("value", {})
# values = cfg_session.get_vals_to_write(values=values, model=model_name)
# values.update(line_vals)
if not line_vals.get('bom_id'):
if not line_vals.get("bom_id"):
raise ValidationError(
_(
"There is no BOM associated with selected product. "
Expand Down

0 comments on commit 1662454

Please sign in to comment.