improved_mo_origin: add source SO to shop floor view
This commit is contained in:
parent
acf26d7c36
commit
ec2c328f2c
5 changed files with 27 additions and 8 deletions
|
|
@ -6,8 +6,8 @@ import {patch} from "@web/core/utils/patch";
|
||||||
patch(MrpDisplayAction.prototype, {
|
patch(MrpDisplayAction.prototype, {
|
||||||
get fieldsStructure() {
|
get fieldsStructure() {
|
||||||
const vals = super.fieldsStructure;
|
const vals = super.fieldsStructure;
|
||||||
vals["mrp.production"].push("customer_ids", "upstream_production_ids");
|
vals["mrp.production"].push("customer_ids");
|
||||||
vals["mrp.workorder"].push("customer_ids", "upstream_production_ids");
|
vals["mrp.workorder"].push("customer_ids");
|
||||||
vals["res.partner"] = ["id", "display_name"];
|
vals["res.partner"] = ["id", "display_name"];
|
||||||
return vals;
|
return vals;
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ class MrpProduction(models.Model):
|
||||||
store=True,
|
store=True,
|
||||||
compute_sudo=True,
|
compute_sudo=True,
|
||||||
)
|
)
|
||||||
source_sale_ids = fields.One2many(
|
source_sale_ids = fields.Many2many(
|
||||||
comodel_name="sale.order",
|
comodel_name="sale.order",
|
||||||
compute="_compute_source_sale_ids",
|
compute="_compute_source_sale_ids",
|
||||||
compute_sudo=True,
|
compute_sudo=True,
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,13 @@ patch(MrpDisplay.prototype, {
|
||||||
fields: customerFields,
|
fields: customerFields,
|
||||||
activeFields: customerFields,
|
activeFields: customerFields,
|
||||||
};
|
};
|
||||||
|
const saleOrderFields = this.props.models.find(
|
||||||
|
(m) => m.resModel === "sale.order"
|
||||||
|
).fields;
|
||||||
|
params.config.activeFields.source_sale_ids.related = {
|
||||||
|
fields: saleOrderFields,
|
||||||
|
activeFields: saleOrderFields,
|
||||||
|
};
|
||||||
return params;
|
return params;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,9 @@ import {patch} from "@web/core/utils/patch";
|
||||||
patch(MrpDisplayAction.prototype, {
|
patch(MrpDisplayAction.prototype, {
|
||||||
get fieldsStructure() {
|
get fieldsStructure() {
|
||||||
const vals = super.fieldsStructure;
|
const vals = super.fieldsStructure;
|
||||||
vals["mrp.production"].push("customer_ids", "source_sale_orders");
|
vals["mrp.production"].push("customer_ids", "source_sale_ids");
|
||||||
vals["res.partner"] = ["id", "display_name", "source_sale_orders"];
|
vals["res.partner"] = ["id", "display_name"];
|
||||||
|
vals["sale.order"] = ["id", "display_name"];
|
||||||
return vals;
|
return vals;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,8 @@
|
||||||
<templates xml:space="preserver">
|
<templates xml:space="preserver">
|
||||||
<t t-inherit="mrp_workorder.MrpDisplayRecord" t-inherit-mode="extension">
|
<t t-inherit="mrp_workorder.MrpDisplayRecord" t-inherit-mode="extension">
|
||||||
<xpath expr="//div[hasclass('card-header')]" position="inside">
|
<xpath expr="//div[hasclass('card-header')]" position="inside">
|
||||||
<t
|
<t t-set="customers" t-value="props.production.data.customer_ids" />
|
||||||
t-if="props.production.data.customer_ids && props.production.data.customer_ids.records"
|
<t t-if="customers && customers.records">
|
||||||
>
|
|
||||||
<Many2ManyTagsField
|
<Many2ManyTagsField
|
||||||
name="'customer_ids'"
|
name="'customer_ids'"
|
||||||
record="props.production"
|
record="props.production"
|
||||||
|
|
@ -14,6 +13,18 @@
|
||||||
readonly="true"
|
readonly="true"
|
||||||
/>
|
/>
|
||||||
</t>
|
</t>
|
||||||
|
<t t-set="sale_orders" t-value="props.production.data.source_sale_ids" />
|
||||||
|
<t t-if="sale_orders && sale_orders.records">
|
||||||
|
<Many2ManyTagsField
|
||||||
|
name="'source_sale_ids'"
|
||||||
|
record="props.production"
|
||||||
|
canCreate="false"
|
||||||
|
canCreateEdit="false"
|
||||||
|
canQuickCreate="false"
|
||||||
|
readonly="true"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</t>
|
||||||
</xpath>
|
</xpath>
|
||||||
</t>
|
</t>
|
||||||
</templates>
|
</templates>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue