This commit is contained in:
胡尧
2025-07-07 11:59:14 +08:00
parent c6c4331c0b
commit 8b3eef1256
118 changed files with 140103 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="70" height="70" viewBox="0 0 70 70"><defs><path id="a" d="M4 0h61c4 0 5 1 5 5v60c0 4-1 5-5 5H4c-3 0-4-1-4-5V5c0-4 1-5 4-5z"/><linearGradient id="c" x1="100%" x2="0%" y1="0%" y2="100%"><stop offset="0%" stop-color="#7CC098"/><stop offset="100%" stop-color="#5F8A71"/></linearGradient></defs><g fill="none" fill-rule="evenodd"><mask id="b" fill="#fff"><use xlink:href="#a"/></mask><g mask="url(#b)"><path fill="url(#c)" d="M0 0H70V70H0z"/><path fill="#FFF" fill-opacity=".383" d="M4 1h61c2.667 0 4.333.667 5 2V0H0v3c.667-1.333 2-2 4-2z"/><path fill="#393939" d="M42.127 69H4c-2 0-4-1-4-4V35l15.895-17.19C25.228 8.478 38 6.334 50 15c8.415 6.077 12.076 13.466 10.984 22.165-.035.285-.1.714-.194 1.29a24.755 24.755 0 0 1-.304 1.352C60.099 41.274 58.936 44.338 57 49L42.127 69z" opacity=".324"/><path fill="#000" fill-opacity=".383" d="M4 69h61c2.667 0 4.333-1 5-3v4H0v-4c.667 2 2 3 4 3z"/><path fill="#000" d="M35.722 27L47 30.846v10.385L38.056 47 26 41.23V30.847L35.722 27zm-.381 1L28 31.111 38.045 35 45 31.5 35.34 28zM27 32v8.944L38 46v-9.722L27 32zm-.615-24l-5.9 8.058 9.51 3.036-1.28-3.953a22.208 22.208 0 0 1 7.2-1.203c11.135 0 20.316 8.182 21.904 18.866l3.228-2.94c-2.799-11.282-12.995-19.668-25.132-19.668a25.8 25.8 0 0 0-8.365 1.394L26.385 8zm-8.44 9.452C13.046 22.167 10 28.769 10 36.088c0 7.763 3.434 14.745 8.861 19.496l-2.54 2.807 9.93 1.07-2.12-9.739-2.768 3.074a22.075 22.075 0 0 1-7.6-16.708 22.073 22.073 0 0 1 8.326-17.319l-2.922-.935-1.223-.382zM60.97 32.766l-7.39 6.702 4.068.879c-1.98 10.21-10.933 17.891-21.733 17.891-2.858 0-5.591-.528-8.097-1.508l.916 4.258A25.918 25.918 0 0 0 35.914 62c12.565 0 23.05-8.988 25.4-20.87l3.686.782-4.03-9.146z" opacity=".3"/><path fill="#FFF" d="M35.722 25L47 28.846v10.385L38.056 45 26 39.23V28.847L35.722 25zm-.381 1L28 29.111 38.045 33 45 29.5 35.34 26zM27 30v8.944L38 44v-9.722L27 30zm-.615-24l-5.9 8.058 9.51 3.036-1.28-3.953a22.208 22.208 0 0 1 7.2-1.203c11.135 0 20.316 8.182 21.904 18.866l3.228-2.94C58.248 16.582 48.052 8.196 35.915 8.196A25.8 25.8 0 0 0 27.55 9.59L26.385 6zm-8.44 9.452C13.046 20.167 10 26.769 10 34.088c0 7.763 3.434 14.745 8.861 19.496l-2.54 2.807 9.93 1.07-2.12-9.739-2.768 3.074a22.075 22.075 0 0 1-7.6-16.708 22.073 22.073 0 0 1 8.326-17.319l-2.922-.935-1.223-.382zM60.97 30.766l-7.39 6.702 4.068.879c-1.98 10.21-10.933 17.891-21.733 17.891-2.858 0-5.591-.528-8.097-1.508l.916 4.258A25.918 25.918 0 0 0 35.914 60c12.565 0 23.05-8.988 25.4-20.87l3.686.782-4.03-9.146z"/></g></g></svg>

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@@ -0,0 +1,22 @@
/** @odoo-module **/
import { patch } from "@web/core/utils/patch";
import { BomOverviewComponent } from "@mrp/components/bom_overview/mrp_bom_overview";
patch(BomOverviewComponent.prototype, "mrp_plm", {
setup() {
this._super.apply();
this.state.showOptions.ecos = false;
this.state.showOptions.ecoAllowed = false;
},
async getBomData() {
const bomData = await this._super.apply();
this.state.showOptions.ecoAllowed = bomData['is_eco_applied'];
return bomData;
},
getReportName(printAll) {
return this._super.apply(this, arguments) + "&show_ecos=" + (this.state.showOptions.ecoAllowed && this.state.showOptions.ecos);
}
});

View File

@@ -0,0 +1,25 @@
/** @odoo-module **/
import { patch } from "@web/core/utils/patch";
import { BomOverviewDisplayFilter } from "@mrp/components/bom_overview_display_filter/mrp_bom_overview_display_filter";
patch(BomOverviewDisplayFilter.prototype, "mrp_plm", {
setup() {
this._super.apply();
if (this.props.showOptions.ecoAllowed) {
this.displayOptions.ecos = this.env._t('ECOs');
}
},
});
patch(BomOverviewDisplayFilter, "mrp_plm", {
props: {
...BomOverviewDisplayFilter.props,
showOptions: {
...BomOverviewDisplayFilter.showOptions,
ecos: Boolean,
ecoAllowed: Boolean,
},
},
});

View File

@@ -0,0 +1,30 @@
/** @odoo-module **/
import { patch } from "@web/core/utils/patch";
import { BomOverviewLine } from "@mrp/components/bom_overview_line/mrp_bom_overview_line";
patch(BomOverviewLine.prototype, "mrp_plm", {
//---- Handlers ----
async goToEco() {
return this.actionService.doAction({
name: this.env._t("ECOs"),
type: "ir.actions.act_window",
res_model: "mrp.eco",
domain: [["product_tmpl_id.product_variant_ids", "in", [this.data.product_id]]],
views: [[false, "kanban"], [false, "list"], [false, "form"]],
target: "current",
});
}
});
patch(BomOverviewLine, "mrp_plm", {
props: {
...BomOverviewLine.props,
showOptions: {
...BomOverviewLine.showOptions,
ecos: Boolean,
ecoAllowed: Boolean,
},
},
});

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">
<t t-name="mrp_plm.BomOverviewLine" t-inherit="mrp.BomOverviewLine" t-inherit-mode="extension" owl="1">
<xpath expr="//td[@name='td_mrp_bom']" position="after">
<td t-if="props.showOptions.ecos" class="text-end">
<span t-if="data.version" t-esc="data.version"/>
</td>
<td t-if="props.showOptions.ecos" class="text-end">
<a href="#" t-on-click.prevent="goToEco" t-esc="data.ecos"/>
</td>
</xpath>
</t>
</templates>

View File

@@ -0,0 +1,15 @@
/** @odoo-module **/
import { patch } from "@web/core/utils/patch";
import { BomOverviewSpecialLine } from "@mrp/components/bom_overview_special_line/mrp_bom_overview_special_line";
patch(BomOverviewSpecialLine, "mrp_plm", {
props: {
...BomOverviewSpecialLine.props,
showOptions: {
...BomOverviewSpecialLine.showOptions,
ecos: Boolean,
ecoAllowed: Boolean,
},
},
});

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">
<t t-name="mrp_plm.BomOverviewSpecialLine" t-inherit="mrp.BomOverviewSpecialLine" t-inherit-mode="extension" owl="1">
<xpath expr="//td[@name='td_mrp_bom']" position="after">
<td t-if="props.showOptions.ecos"/>
<td t-if="props.showOptions.ecos"/>
</xpath>
</t>
</templates>

View File

@@ -0,0 +1,23 @@
/** @odoo-module **/
import { patch } from "@web/core/utils/patch";
import { BomOverviewTable } from "@mrp/components/bom_overview_table/mrp_bom_overview_table";
patch(BomOverviewTable.prototype, "mrp_plm", {
//---- Getters ----
get showEcos() {
return this.props.showOptions.ecos;
}
});
patch(BomOverviewTable, "mrp_plm", {
props: {
...BomOverviewTable.props,
showOptions: {
...BomOverviewTable.showOptions,
ecos: Boolean,
ecoAllowed: Boolean,
},
},
});

View File

@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">
<t t-name="mrp_plm.BomOverviewTable" t-inherit="mrp.BomOverviewTable" t-inherit-mode="extension" owl="1">
<xpath expr="//th[@name='th_mrp_bom_h']" position="after">
<th t-if="showEcos" class="text-end">BoM Version</th>
<th t-if="showEcos" class="text-end">ECOs</th>
</xpath>
<xpath expr="//td[@name='td_mrp_bom_f']" position="after">
<td t-if="showEcos"/>
<td t-if="showEcos"/>
</xpath>
<xpath expr="//td[@name='td_mrp_bom_b']" position="after">
<td t-if="showEcos"/>
<td t-if="showEcos"/>
</xpath>
</t>
</templates>

View File

@@ -0,0 +1,23 @@
/** @odoo-module **/
import { registry } from '@web/core/registry';
import { useService } from "@web/core/utils/hooks";
const { Component } = owl;
export class PlmToasterButton extends Component {
setup() {
this.notification = useService("notification");
}
async onClick() {
const message = "Note that a new version of this BOM is available.";
this.notification.add(message);
}
}
PlmToasterButton.template = "mrp_plm.ToasterButton"
PlmToasterButton.displayName = "MRP_PLM Toaster Button"
registry.category("view_widgets").add("plm_toaster_button", PlmToasterButton);

View File

@@ -0,0 +1,11 @@
/** @odoo-module **/
import { FloatField } from '@web/views/fields/float/float_field';
import { registry } from '@web/core/registry';
export class MrpPlmUpdateQty extends FloatField {}
MrpPlmUpdateQty.displayName = "MRP PLM Update Quantity"
MrpPlmUpdateQty.template = "mrp_plm.UpdateQty"
registry.category('fields').add('plm_upd_qty', MrpPlmUpdateQty);

View File

@@ -0,0 +1,25 @@
.o_kanban_renderer.o_mrp_documents_kanban_view {
.ribbon {
&::before, &::after {
display: none;
}
span {
padding: 5px;
font-size: small;
z-index: unset;
height: auto;
}
}
.ribbon-top-right {
margin-top: 0px;
span {
left: 10px;
top: 10px;
bottom: 110px;
}
}
}

View File

@@ -0,0 +1,6 @@
.o_kanban_view .o_kanban_ungrouped.o_kanban_dashboard.o_mrp_plm_kanban {
.o_kanban_record {
width: 420px;
min-height: 250px;
}
}

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<template>
<t t-name="mrp_plm.ToasterButton" owl="1">
<button t-on-click="onClick" class="btn oe_inline btn-link">
<i class="fa fa-fw o_button_icon fa-info-circle"></i>
</button>
</t>
</template>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
<t t-name="mrp_plm.UpdateQty" owl="1">
<span t-if="props.value > 0">
+<t t-call="web.FloatField"/>
</span>
<t t-else="" t-call="web.FloatField"/>
</t>
</templates>