Skip to content

[IMP] construction_developer: add routes configuration#13

Draft
trcazier wants to merge 15 commits into
master-construction-wi-bom-poc-trcazfrom
master-construction-wi-bom-routes-trcaz
Draft

[IMP] construction_developer: add routes configuration#13
trcazier wants to merge 15 commits into
master-construction-wi-bom-poc-trcazfrom
master-construction-wi-bom-routes-trcaz

Conversation

@trcazier

@trcazier trcazier commented Jun 16, 2026

Copy link
Copy Markdown

This commit sets up the picking types, routes, and rules to setup the automatic MO/deliveries to use the standard stock capabilities for the reworked work items.

task-6292786

@trcazier trcazier force-pushed the master-construction-wi-bom-routes-trcaz branch from a3ff425 to bdf8f01 Compare June 16, 2026 13:37
@trcazier trcazier changed the title [IMP] construction_developer: improve routes & locations [IMP] construction_developer: add routes configuration Jun 16, 2026
@trcazier trcazier force-pushed the master-construction-wi-bom-routes-trcaz branch 2 times, most recently from 2ee0afc to cee5df6 Compare June 17, 2026 07:38
move features from data into new feature subdir

remove duplicate view

split work_items into new feature files
@trcazier trcazier force-pushed the master-construction-wi-bom-routes-trcaz branch from cee5df6 to f069b16 Compare June 17, 2026 08:00
@trcazier trcazier force-pushed the master-construction-wi-bom-routes-trcaz branch from 38f7281 to a644b2f Compare June 18, 2026 10:27

@vava-odoo vava-odoo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

first light review 👍

Comment on lines +30 to +31
if bom.x_original_sol_id:
bom.x_original_sol_id.write({'price_unit': bom.x_unit_price, 'purchase_price': bom.x_unit_cost})

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the condition is in the view + write would just void if there is no x_original_sol_id

Suggested change
if bom.x_original_sol_id:
bom.x_original_sol_id.write({'price_unit': bom.x_unit_price, 'purchase_price': bom.x_unit_cost})
bom.x_original_sol_id.write({'price_unit': bom.x_unit_price, 'purchase_price': bom.x_unit_cost})

<field name="store" eval="False"/>
<field name="depends">x_unit_price,x_original_sol_id,x_original_sol_id.price_unit</field>
<field name="compute"><![CDATA[
for bom in self: bom['x_price_different_from_so'] = round(bom.x_unit_price, 2) != round(bom.x_original_sol_id.price_unit, 2)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't float_compare available here?

<field name="readonly" eval="True"/>
<field name="depends">order_line,order_line.x_bom_id</field>
<field name="compute"><![CDATA[
for so in self: so['x_any_sol_bom'] = bool(so.order_line.x_bom_id)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably faster

Suggested change
for so in self: so['x_any_sol_bom'] = bool(so.order_line.x_bom_id)
for so in self: so['x_any_sol_bom'] = any(line.x_bom_id for line in so.order_line)

/>
</xpath>
<xpath expr="//field[@name='order_line']/list//field[@name='route_ids']" position="after">
<field name="x_product_bom_template_id" column_invisible="True"/>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought required fields for invisibility/required/... conditions were automatically added to the view since 18.0

Suggested change
<field name="x_product_bom_template_id" column_invisible="True"/>

<field name="ttype">many2one</field>
<field name="relation">mrp.bom</field>
<field name="related">product_id.product_tmpl_id.x_bom_template_id</field>
<field name="name">x_product_bom_template_id</field>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

store False? Or used elsewhere?

<field name="compute"><![CDATA[
for sol in self:
if not sol.x_bom_id and sol.product_template_id.bom_ids and sol.product_template_id.route_ids:
sol['x_bom_id'] = sol.product_template_id.bom_ids.filtered(lambda b: b.x_is_template)[0].id

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't remember why route_ids is here, but it's not a new code so 🙈

Suggested change
sol['x_bom_id'] = sol.product_template_id.bom_ids.filtered(lambda b: b.x_is_template)[0].id
sol['x_bom_id'] = sol.product_template_id.bom_ids.filtered('x_is_template')[0].id

Comment on lines +56 to +59
code = f"{so.name} - {so.partner_id.name}" + f" - {bom.code}" * bool(bom.code)

custom_bom = bom.copy({'code': code, 'x_original_sol_id': sol.id, 'x_parent_bom_id': bom.id}).id
sol['x_bom_id'] = custom_bom

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this part is duplicated elsewhere, not sure if it is an issue or we should make it a server action on it's own

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

like in the other you put a .id at the end 😇
but bigger divergences could occur

<field name="update_path">location_id</field>
<field name="update_field_id" ref="stock.field_stock_picking__location_id"/>
<field name="evaluation_type">equation</field>
<field name="value"><![CDATA[record.sale_id.partner_shipping_id.x_ws_location_id.id if record.sale_id else False]]></field>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sale_id is False in the filter_domain... Do you need to remove it if sale_id is removed?

Comment on lines +123 to +127
<field name="value"><![CDATA[[(6, 0, [
record.env.ref('purchase_stock.route_warehouse0_buy').id,
record.env.ref('construction_developer.stock_route_warehouse_on_site_delivery').id,
record.env.ref('construction_developer.stock_route_on_site_consumption_goods').id,
])]]]></field>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why those ones. I don't get this automation n°2

Comment on lines +121 to +122
obj().env.ref('construction_developer.stock_route_warehouse_on_site_delivery').id,
obj().env.ref('purchase_stock.route_warehouse0_buy').id

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not coming back to those ones in the automations then? 🤔

@trcazier trcazier force-pushed the master-construction-wi-bom-routes-trcaz branch from c49f573 to 6e3cff5 Compare June 26, 2026 10:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants