Skip to content
Snippets Groups Projects
Commit 0e26ed69 authored by Pieter Claeys (clpi)'s avatar Pieter Claeys (clpi)
Browse files

[FIX] mrp_subcontracting: landed cost

When adding a landed cost and selecting Manufacturing Order, the name of the receipt of the subcontracted products is now shown as well as the MO name for subcontracting orders.

Task: 2667152
Community PR: https://github.com/odoo/odoo/pull/88199



closes odoo/odoo#88199

Signed-off-by: default avatarArnold Moyaux <arm@odoo.com>
parent 457d6169
No related branches found
No related tags found
No related merge requests found
......@@ -9,6 +9,7 @@ from odoo.tools.float_utils import float_compare, float_is_zero
class MrpProduction(models.Model):
_inherit = 'mrp.production'
_rec_names_search = ['name', 'incoming_picking.name']
move_line_raw_ids = fields.One2many(
'stock.move.line', string="Detail Component", readonly=False,
......@@ -16,6 +17,15 @@ class MrpProduction(models.Model):
)
subcontracting_has_been_recorded = fields.Boolean("Has been recorded?", copy=False)
incoming_picking = fields.Many2one(related='move_finished_ids.move_dest_ids.picking_id')
@api.depends('name')
def name_get(self):
return [
(record.id, "%s (%s)" % (record.incoming_picking.name, record.name)) if record.bom_id.type == 'subcontract'
else (record.id, record.name) for record in self
]
@api.depends('move_raw_ids.move_line_ids')
def _compute_move_line_raw_ids(self):
for production in self:
......
......@@ -54,5 +54,27 @@
</xpath>
</field>
</record>
<record id="mrp_production_subcontracting_tree_view" model="ir.ui.view">
<field name="name">mrp.production.subcontracting.tree</field>
<field name="model">mrp.production</field>
<field name="inherit_id" ref="mrp.mrp_production_tree_view" />
<field name="arch" type="xml">
<xpath expr="//field[@name='name']" position="after">
<field name="incoming_picking"/>
</xpath>
</field>
</record>
<record id="mrp_production_subcontracting_filter" model="ir.ui.view">
<field name="name">mrp.production.subcontracting.select</field>
<field name="model">mrp.production</field>
<field name="inherit_id" ref="mrp.view_mrp_production_filter" />
<field name="arch" type="xml">
<xpath expr="//field[@name='name']" position="after">
<field name="name" string="Incoming transfer" filter_domain="[('incoming_picking.name', 'ilike', self)]"/>
</xpath>
</field>
</record>
</odoo>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment