add customer name and upstream production to work orders. Add customer name to shop floor view on MOs.

This commit is contained in:
Marc Durepos 2024-07-03 08:54:16 -04:00
parent ddaee59a59
commit acf26d7c36
5 changed files with 65 additions and 1 deletions

View file

@ -27,7 +27,12 @@
"license": "LGPL-3",
"depends": ["sale_mrp"],
"data": ["views/mrp_production_views.xml"],
"assets": {},
'assets': {
'web.assets_backend': [
'improved_mo_origin/static/src/**/*.xml',
'improved_mo_origin/static/src/**/*.js',
]
},
"installable": True,
"auto_install": False,
}

View file

@ -0,0 +1,18 @@
/** @odoo-module **/
import {MrpDisplay} from "@mrp_workorder/mrp_display/mrp_display";
import {patch} from "@web/core/utils/patch";
patch(MrpDisplay.prototype, {
_makeModelParams() {
var params = super._makeModelParams();
const customerFields = this.props.models.find(
(m) => m.resModel === "res.partner"
).fields;
params.config.activeFields.customer_ids.related = {
fields: customerFields,
activeFields: customerFields,
};
return params;
},
});

View file

@ -0,0 +1,13 @@
/** @odoo-module **/
import {MrpDisplayAction} from "@mrp_workorder/mrp_display/mrp_display_action";
import {patch} from "@web/core/utils/patch";
patch(MrpDisplayAction.prototype, {
get fieldsStructure() {
const vals = super.fieldsStructure;
vals["mrp.production"].push("customer_ids", "source_sale_orders");
vals["res.partner"] = ["id", "display_name", "source_sale_orders"];
return vals;
},
});

View file

@ -0,0 +1,9 @@
/** @odoo-module **/
import {Many2ManyTagsField} from "@web/views/fields/many2many_tags/many2many_tags_field";
import {MrpDisplayRecord} from "@mrp_workorder/mrp_display/mrp_display_record";
MrpDisplayRecord.components = {
...MrpDisplayRecord.components,
Many2ManyTagsField,
};

View file

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8" ?>
<templates xml:space="preserver">
<t t-inherit="mrp_workorder.MrpDisplayRecord" t-inherit-mode="extension">
<xpath expr="//div[hasclass('card-header')]" position="inside">
<t
t-if="props.production.data.customer_ids &amp;&amp; props.production.data.customer_ids.records"
>
<Many2ManyTagsField
name="'customer_ids'"
record="props.production"
canCreate="false"
canCreateEdit="false"
canQuickCreate="false"
readonly="true"
/>
</t>
</xpath>
</t>
</templates>