[IMP] construction_developer: add routes configuration#13
Conversation
a3ff425 to
bdf8f01
Compare
2ee0afc to
cee5df6
Compare
move features from data into new feature subdir remove duplicate view split work_items into new feature files
cee5df6 to
f069b16
Compare
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
…demo & move default into noupdate + fix form view fields location
Introduced fields to access the BOM instead of relying on brittle references
38f7281 to
a644b2f
Compare
| if bom.x_original_sol_id: | ||
| bom.x_original_sol_id.write({'price_unit': bom.x_unit_price, 'purchase_price': bom.x_unit_cost}) |
There was a problem hiding this comment.
the condition is in the view + write would just void if there is no x_original_sol_id
| 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) |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
probably faster
| 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"/> |
There was a problem hiding this comment.
I thought required fields for invisibility/required/... conditions were automatically added to the view since 18.0
| <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> |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
I don't remember why route_ids is here, but it's not a new code so 🙈
| 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 |
| 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 |
There was a problem hiding this comment.
this part is duplicated elsewhere, not sure if it is an issue or we should make it a server action on it's own
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
sale_id is False in the filter_domain... Do you need to remove it if sale_id is removed?
| <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> |
There was a problem hiding this comment.
why those ones. I don't get this automation n°2
| obj().env.ref('construction_developer.stock_route_warehouse_on_site_delivery').id, | ||
| obj().env.ref('purchase_stock.route_warehouse0_buy').id |
There was a problem hiding this comment.
why not coming back to those ones in the automations then? 🤔
c49f573 to
6e3cff5
Compare
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