-
-
Notifications
You must be signed in to change notification settings - Fork 550
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MIG] base_tier_validation: Migration to 17.0
- Loading branch information
Showing
31 changed files
with
263 additions
and
706 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -218,6 +218,7 @@ Contributors | |
- Pedro Gonzalez <[email protected]> | ||
- Kitti U. <[email protected]> | ||
- Saran Lim. <[email protected]> | ||
- Carlos Lopez <[email protected]> | ||
|
||
Maintainers | ||
----------- | ||
|
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,14 +1,14 @@ | ||
# Copyright 2021 Ecosoft Co., Ltd. (http://ecosoft.co.th) | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
from odoo import fields, models | ||
from odoo import models | ||
|
||
|
||
class ResConfigSettings(models.TransientModel): | ||
_inherit = "res.config.settings" | ||
|
||
# Activate me back when modules are migrated | ||
|
||
module_base_tier_validation_formula = fields.Boolean(string="Tier Formula") | ||
module_base_tier_validation_forward = fields.Boolean("Tier Forward & Backward") | ||
# module_base_tier_validation_formula = fields.Boolean(string="Tier Formula") | ||
# module_base_tier_validation_forward = fields.Boolean("Tier Forward & Backward") | ||
# module_base_tier_validation_server_action = fields.Boolean("Tier Server Action") | ||
# module_base_tier_validation_report = fields.Boolean("Tier Reports") |
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 |
---|---|---|
|
@@ -5,3 +5,4 @@ | |
- Pedro Gonzalez \<<[email protected]>\> | ||
- Kitti U. \<<[email protected]>\> | ||
- Saran Lim. \<<[email protected]>\> | ||
- Carlos Lopez \<<[email protected]>\> |
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
72 changes: 72 additions & 0 deletions
72
base_tier_validation/static/src/components/tier_review_menu/tier_review_menu.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 |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/* @odoo-module */ | ||
|
||
import {Component, useState} from "@odoo/owl"; | ||
import {Dropdown} from "@web/core/dropdown/dropdown"; | ||
import {DropdownItem} from "@web/core/dropdown/dropdown_item"; | ||
import {registry} from "@web/core/registry"; | ||
import {useDiscussSystray} from "@mail/utils/common/hooks"; | ||
import {useService} from "@web/core/utils/hooks"; | ||
|
||
const systrayRegistry = registry.category("systray"); | ||
|
||
export class TierReviewMenu extends Component { | ||
setup() { | ||
this.discussSystray = useDiscussSystray(); | ||
this.orm = useService("orm"); | ||
this.store = useState(useService("mail.store")); | ||
this.action = useService("action"); | ||
this.fetchSystrayReviewer(); | ||
} | ||
async fetchSystrayReviewer() { | ||
const groups = await this.orm.call("res.users", "review_user_count"); | ||
let total = 0; | ||
for (const group of groups) { | ||
total += group.pending_count || 0; | ||
} | ||
this.store.tierReviewCounter = total; | ||
this.store.tierReviewGroups = groups; | ||
} | ||
onBeforeOpen() { | ||
this.fetchSystrayReviewer(); | ||
} | ||
availableViews() { | ||
return [ | ||
[false, "kanban"], | ||
[false, "list"], | ||
[false, "form"], | ||
[false, "activity"], | ||
]; | ||
} | ||
openReviewGroup(group) { | ||
document.body.click(); // Hack to close dropdown | ||
const context = {}; | ||
var domain = [["can_review", "=", true]]; | ||
if (group.active_field) { | ||
domain.push(["active", "in", [true, false]]); | ||
} | ||
const views = this.availableViews(); | ||
|
||
this.action.doAction( | ||
{ | ||
context, | ||
domain, | ||
name: group.name, | ||
res_model: group.model, | ||
search_view_id: [false], | ||
type: "ir.actions.act_window", | ||
views, | ||
}, | ||
{ | ||
clearBreadcrumbs: true, | ||
} | ||
); | ||
} | ||
} | ||
|
||
TierReviewMenu.template = "base_tier_validation.TierReviewMenu"; | ||
TierReviewMenu.components = {Dropdown, DropdownItem}; | ||
TierReviewMenu.props = []; | ||
|
||
export const systrayItem = {Component: TierReviewMenu}; | ||
|
||
systrayRegistry.add("base_tier_validation.ReviewerMenu", systrayItem, {sequence: 99}); |
63 changes: 63 additions & 0 deletions
63
base_tier_validation/static/src/components/tier_review_menu/tier_review_menu.xml
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,63 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<templates xml:space="preserve"> | ||
|
||
<t t-name="base_tier_validation.TierReviewMenu"> | ||
<Dropdown | ||
position="'bottom-end'" | ||
beforeOpen.bind="onBeforeOpen" | ||
autoOpen="false" | ||
menuClass="discussSystray.menuClass" | ||
class="discussSystray.class" | ||
> | ||
<t t-set-slot="toggler"> | ||
<i class="fa fa-pencil-square-o" role="img" aria-label="Reviews" /> | ||
<span | ||
t-if="store.tierReviewCounter > 0" | ||
class="o-mail-ActivityMenu-counter badge rounded-pill" | ||
t-out="store.tierReviewCounter" | ||
/> | ||
</t> | ||
<t t-set-slot="default"> | ||
<div t-att-class="`${discussSystray.contentClass} o-mail-ActivityMenu`"> | ||
<div | ||
t-if="store.tierReviewCounter === 0" | ||
class="o-mail-ActivityMenu-empty align-items-center text-muted p-2 opacity-50 d-flex justify-content-center" | ||
> | ||
<span>No reviews to do.</span> | ||
</div> | ||
<div class="d-flex flex-column list-group-flush" name="activityGroups"> | ||
<t | ||
t-foreach="store.tierReviewGroups" | ||
t-as="group" | ||
t-key="group_index" | ||
name="activityGroupLoop" | ||
> | ||
<div | ||
class="o-mail-ActivityGroup list-group-item list-group-item-action d-flex p-2 cursor-pointer" | ||
t-att-data-model_name="group.model" | ||
t-on-click="() => this.openReviewGroup(group)" | ||
> | ||
<img alt="Activity" t-att-src="group.icon" /> | ||
<div class="flex-grow-1 overflow-hidden"> | ||
<div | ||
class="d-flex px-2" | ||
name="activityTitle" | ||
t-out="group.name" | ||
/> | ||
<div class="d-flex"> | ||
<span | ||
t-attf-class="#{group.pending_count ? '' : 'text-muted'} py-0 px-2" | ||
> | ||
<t t-out="group.pending_count" /> Pending | ||
</span> | ||
</div> | ||
</div> | ||
</div> | ||
</t> | ||
</div> | ||
</div> | ||
</t> | ||
</Dropdown> | ||
</t> | ||
|
||
</templates> |
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
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...n/static/src/xml/tier_review_template.xml → ...tier_review_widget/tier_review_widget.xml
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.