mirror of
https://github.com/bringout/oca-ocb-mrp.git
synced 2026-04-23 22:12:02 +02:00
Initial commit: Mrp packages
This commit is contained in:
commit
50d736b3bd
739 changed files with 538193 additions and 0 deletions
|
|
@ -0,0 +1,9 @@
|
|||
/** @odoo-module **/
|
||||
|
||||
import { patch } from "@web/core/utils/patch";
|
||||
import { BomOverviewComponentsBlock } from "@mrp/components/bom_overview_components_block/mrp_bom_overview_components_block";
|
||||
import { BomOverviewSpecialLine } from "@mrp/components/bom_overview_special_line/mrp_bom_overview_special_line";
|
||||
|
||||
patch(BomOverviewComponentsBlock, "mrp_subcontracting", {
|
||||
components: { ...BomOverviewComponentsBlock.components, BomOverviewSpecialLine },
|
||||
});
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<templates xml:space="preserve">
|
||||
|
||||
<t t-name="mrp_subcontracting.BomOverviewComponentsBlock" t-inherit="mrp.BomOverviewComponentsBlock" t-inherit-mode="extension" owl="1">
|
||||
<xpath expr="//t[@name='byproducts']" position="after">
|
||||
<t t-if="data.subcontracting">
|
||||
<BomOverviewSpecialLine
|
||||
type="'subcontracting'"
|
||||
showOptions="props.showOptions"
|
||||
data="props.data"
|
||||
precision="props.precision"
|
||||
/>
|
||||
</t>
|
||||
</xpath>
|
||||
</t>
|
||||
|
||||
</templates>
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
/** @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_subcontracting", {
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
async goToRoute(routeType) {
|
||||
if (routeType == "subcontract") {
|
||||
return this.goToAction(this.data.link_id, this.data.link_model);
|
||||
}
|
||||
return this._super(...arguments);
|
||||
}
|
||||
});
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
/** @odoo-module **/
|
||||
|
||||
import { patch } from "@web/core/utils/patch";
|
||||
import { useService } from "@web/core/utils/hooks";
|
||||
import { BomOverviewSpecialLine } from "@mrp/components/bom_overview_special_line/mrp_bom_overview_special_line";
|
||||
|
||||
patch(BomOverviewSpecialLine.prototype, "mrp_subcontracting", {
|
||||
setup() {
|
||||
this._super.apply();
|
||||
this.actionService = useService("action");
|
||||
},
|
||||
|
||||
//---- Handlers ----
|
||||
|
||||
async goToSubcontractor() {
|
||||
return this.actionService.doAction({
|
||||
type: "ir.actions.act_window",
|
||||
res_model: "res.partner",
|
||||
res_id: this.subcontracting.partner_id,
|
||||
views: [[false, "form"]],
|
||||
target: "current",
|
||||
context: {
|
||||
active_id: this.subcontracting.partner_id,
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
//---- Getters ----
|
||||
|
||||
get subcontracting() {
|
||||
return this.props.data.subcontracting || {};
|
||||
},
|
||||
});
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<templates xml:space="preserve">
|
||||
|
||||
<t t-name="mrp_subcontracting.BomOverviewSpecialLine" t-inherit="mrp.BomOverviewSpecialLine" t-inherit-mode="extension" owl="1">
|
||||
<xpath expr="//td[@name='td_mrp_bom']" position="inside">
|
||||
<t t-if="props.type == 'subcontracting'">Subcontracting: <a href="#" t-on-click.prevent="goToSubcontractor" t-esc="subcontracting.name"/></t>
|
||||
</xpath>
|
||||
|
||||
<xpath expr="//td[@name='quantity']" position="inside">
|
||||
<span t-if="props.type == 'subcontracting'" t-esc="formatFloat(subcontracting.quantity, {'digits': [false, precision]})"/>
|
||||
</xpath>
|
||||
|
||||
<xpath expr="//td[@name='uom']" position="inside">
|
||||
<span t-if="props.type == 'subcontracting'" t-esc="subcontracting.uom"/>
|
||||
</xpath>
|
||||
|
||||
<xpath expr="//td[@name='bom_cost']" position="inside">
|
||||
<span t-if="props.type == 'subcontracting'" t-esc="formatMonetary(subcontracting.bom_cost)"/>
|
||||
</xpath>
|
||||
|
||||
<xpath expr="//td[@name='prod_cost']" position="inside">
|
||||
<span t-if="props.type == 'subcontracting'" t-esc="formatMonetary(subcontracting.prod_cost)"/>
|
||||
</xpath>
|
||||
</t>
|
||||
|
||||
</templates>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
/** @odoo-module **/
|
||||
import { startWebClient } from '@web/start';
|
||||
import { SubcontractingPortalWebClient } from './subcontracting_portal';
|
||||
|
||||
startWebClient(SubcontractingPortalWebClient);
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
/** @odoo-module **/
|
||||
|
||||
import { registry } from "@web/core/registry";
|
||||
import { listView } from "@web/views/list/list_view";
|
||||
|
||||
const MoveListView = {
|
||||
...listView,
|
||||
searchMenuTypes: [],
|
||||
};
|
||||
|
||||
registry.category("views").add('subcontracting_portal_move_list_view', MoveListView);
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
/** @odoo-module **/
|
||||
|
||||
import { registry } from "@web/core/registry";
|
||||
import { FormController } from "@web/views/form/form_controller";
|
||||
import { formView } from "@web/views/form/form_view";
|
||||
|
||||
|
||||
class PickingFormController extends FormController {}
|
||||
PickingFormController.template = "mrp_subcontracting.PickingFormController";
|
||||
|
||||
const PickingFormView = {
|
||||
...formView,
|
||||
Controller: PickingFormController,
|
||||
};
|
||||
|
||||
registry.category("views").add("subcontracting_portal_picking_form_view", PickingFormView);
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<templates xml:space="preserve">
|
||||
|
||||
<t t-name="mrp_subcontracting.PickingFormController" t-inherit="web.FormView" t-inherit-mode="primary" owl="1">
|
||||
<xpath expr="//ActionMenus" position="replace"/>
|
||||
</t>
|
||||
|
||||
</templates>
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
/** @odoo-module **/
|
||||
|
||||
import { useService } from '@web/core/utils/hooks';
|
||||
import { ActionContainer } from '@web/webclient/actions/action_container';
|
||||
import { MainComponentsContainer } from "@web/core/main_components_container";
|
||||
import { useOwnDebugContext } from "@web/core/debug/debug_context";
|
||||
import { ErrorHandler } from "@web/core/utils/components";
|
||||
import { session } from '@web/session';
|
||||
import { LegacyComponent } from "@web/legacy/legacy_component";
|
||||
|
||||
const { useEffect} = owl;
|
||||
|
||||
export class SubcontractingPortalWebClient extends LegacyComponent {
|
||||
setup() {
|
||||
window.parent.document.body.style.margin = "0"; // remove the margin in the parent body
|
||||
this.actionService = useService('action');
|
||||
this.user = useService("user");
|
||||
useService("legacy_service_provider");
|
||||
useOwnDebugContext({ categories: ["default"] });
|
||||
useEffect(
|
||||
() => {
|
||||
this._showView();
|
||||
},
|
||||
() => []
|
||||
);
|
||||
}
|
||||
|
||||
handleComponentError(error, C) {
|
||||
// remove the faulty component
|
||||
this.Components.splice(this.Components.indexOf(C), 1);
|
||||
/**
|
||||
* we rethrow the error to notify the user something bad happened.
|
||||
* We do it after a tick to make sure owl can properly finish its
|
||||
* rendering
|
||||
*/
|
||||
Promise.resolve().then(() => {
|
||||
throw error;
|
||||
});
|
||||
}
|
||||
|
||||
async _showView() {
|
||||
const { action_name, picking_id } = session;
|
||||
await this.actionService.doAction(
|
||||
action_name,
|
||||
{
|
||||
props: {
|
||||
resId: picking_id,
|
||||
preventEdit: true,
|
||||
preventCreate: true,
|
||||
},
|
||||
additionalContext: {
|
||||
no_breadcrumbs: true,
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
SubcontractingPortalWebClient.components = { ActionContainer, ErrorHandler, MainComponentsContainer };
|
||||
SubcontractingPortalWebClient.template = 'mrp_subcontracting.SubcontractingPortalWebClient';
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<templates xml:space="preserve">
|
||||
|
||||
<t t-name="mrp_subcontracting.SubcontractingPortalWebClient" owl="1">
|
||||
<ActionContainer/>
|
||||
<MainComponentsContainer/>
|
||||
</t>
|
||||
|
||||
</templates>
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
/** @odoo-module **/
|
||||
|
||||
import tour from 'web_tour.tour';
|
||||
|
||||
const subcontractingPortalSteps = [{
|
||||
trigger: 'table > tbody > tr a:has(span:contains(WH/IN/00))',
|
||||
content: 'Select the picking to open the backend view.',
|
||||
run: 'click',
|
||||
},{
|
||||
trigger: '.o_subcontracting_portal',
|
||||
content: 'Wait the subcontracting portal to be loaded.',
|
||||
run: function () {},
|
||||
}, {
|
||||
trigger: 'button[name="action_show_details"]',
|
||||
run: 'click',
|
||||
}];
|
||||
|
||||
tour.register('subcontracting_portal_tour', {
|
||||
test: true,
|
||||
url: '/my/productions',
|
||||
}, subcontractingPortalSteps);
|
||||
Loading…
Add table
Add a link
Reference in a new issue