Master construction wi bom dev#18
Conversation
586d3a2 to
25ea2db
Compare
vava-odoo
left a comment
There was a problem hiding this comment.
I skipped wbs for now
| @@ -0,0 +1,12 @@ | |||
| <?xml version='1.0' encoding='UTF-8'?> | |||
| <odoo> | |||
| <record id="access_construction_developer_x_cost_nature_analysis_report" model="ir.model.access"> | |||
There was a problem hiding this comment.
| <record id="access_construction_developer_x_cost_nature_analysis_report" model="ir.model.access"> | |
| <record id="access_construction_developer_x_cost_nature_analysis_report" model="ir.access"> |
| <record model="ir.model.fields" id="field_x_cost_nature_analysis_report_x_cost_nature"> | ||
| <field name="model_id" ref="model_x_cost_nature_analysis_report"/> | ||
| <field name="ttype">selection</field> | ||
| <field name="name">x_cost_nature</field> |
There was a problem hiding this comment.
why not a related to the category's value?
There was a problem hiding this comment.
Because we fetch everything using the SQL query, I don't know if that's possible/good practice?
| <record model="ir.model.fields" id="field_sale_order_line_x_cost_nature"> | ||
| <field name="name">x_cost_nature</field> | ||
| <field name="field_description">Cost Nature</field> | ||
| <field name="ttype">selection</field> | ||
| <field name="related">product_id.product_tmpl_id.categ_id.x_cost_nature</field> | ||
| <field name="model_id" ref="sale.model_sale_order_line"/> | ||
| <field name="store" eval="True"/> | ||
| </record> | ||
| <record model="ir.model.fields" id="field_mrp_bom_line_x_cost_nature"> | ||
| <field name="name">x_cost_nature</field> | ||
| <field name="field_description">Cost Nature</field> | ||
| <field name="ttype">selection</field> | ||
| <field name="related">product_tmpl_id.categ_id.x_cost_nature</field> | ||
| <field name="model_id" ref="mrp.model_mrp_bom_line"/> | ||
| <field name="store" eval="True"/> | ||
| </record> | ||
| <record model="ir.model.fields" id="field_mrp_bom_line_x_category_id"> | ||
| <field name="name">x_category_id</field> | ||
| <field name="field_description">Category</field> | ||
| <field name="ttype">many2one</field> | ||
| <field name="related">product_tmpl_id.categ_id</field> | ||
| <field name="model_id" ref="mrp.model_mrp_bom_line"/> | ||
| <field name="relation">product.category</field> | ||
| <field name="store" eval="True"/> | ||
| </record> | ||
| <record model="ir.model.fields" id="field_x_sale_order_line_x_category_id"> | ||
| <field name="name">x_category_id</field> | ||
| <field name="field_description">Category</field> | ||
| <field name="ttype">many2one</field> | ||
| <field name="related">product_id.product_tmpl_id.categ_id</field> | ||
| <field name="model_id" ref="sale.model_sale_order_line"/> | ||
| <field name="relation">product.category</field> | ||
| <field name="store" eval="True"/> | ||
| </record> | ||
| <record model="ir.model.fields" id="field_mrp_bom_line_x_unit_price"> | ||
| <field name="name">x_unit_price</field> | ||
| <field name="field_description">Unit Price</field> | ||
| <field name="ttype">float</field> | ||
| <field name="related">product_tmpl_id.list_price</field> | ||
| <field name="model_id" ref="mrp.model_mrp_bom_line"/> | ||
| <field name="store" eval="True"/> | ||
| </record> | ||
| <record model="ir.model.fields" id="field_mrp_bom_line_x_unit_cost"> | ||
| <field name="name">x_unit_cost</field> | ||
| <field name="field_description">Unit Cost</field> | ||
| <field name="ttype">float</field> | ||
| <field name="related">product_tmpl_id.standard_price</field> | ||
| <field name="model_id" ref="mrp.model_mrp_bom_line"/> | ||
| <field name="store" eval="True"/> | ||
| </record> |
There was a problem hiding this comment.
are those fields only defined to reduce the query?
|
|
||
| # action called from a project: fetch the records from the project | ||
| # action called from a sale order: passed in the context as active_ids | ||
| so_ids = (env.context.get('active_ids') if not (project_id := env.context.get('project_id')) else env['sale.order'].search([('project_id', '=', project_id)]).ids) or [0] |
There was a problem hiding this comment.
I find the fallback mecanism a bit weird here. For example, if project_id is not provided in the context, it seems to me you'll get all sale.order linked to no project
There was a problem hiding this comment.
If project in the context: find all sale orders with that project and use them
If not project in the context: use the current active_ids so
If none of the above: use [0]
| # e.g., [1, 2] becomes "(1, 2)" and [1] becomes "(1)" | ||
| so_ids_sql = tuple(so_ids) if len(so_ids) > 1 else f"({so_ids[0]})" | ||
|
|
||
| # Actual logic |
| <xpath expr="//group[@name='second']" position="before"> | ||
| <xpath expr="//group[@name='first']" position="move"/> |
There was a problem hiding this comment.
Move first before second? Yeah, why not?
I'd rather stick to standard here
| <xpath expr="//form/sheet/div[@name='button_box']" position="inside"> | ||
| <button class="oe_stat_button" type="action" name="%(action_compute_cost_nature_analysis_report)d" | ||
| icon="fa-indent" | ||
| context="{'active_ids': [id]}" |
There was a problem hiding this comment.
i'd say context is provided natively, no?
| # does not work if only on_create because purchase_id does not exist yet | ||
| # does not work if purchase_id is set as trigger_field_ids | ||
| # does not work if the first 2 conditions are added to the automation domain | ||
| if p.purchase_id and p.purchase_id.x_delivery_site_id and p.location_dest_id == p.picking_type_id.default_location_dest_id: |
There was a problem hiding this comment.
| if p.purchase_id and p.purchase_id.x_delivery_site_id and p.location_dest_id == p.picking_type_id.default_location_dest_id: | |
| if p.purchase_id.x_delivery_site_id and p.location_dest_id == p.picking_type_id.default_location_dest_id: |
There was a problem hiding this comment.
and so the user can't set the default location as destination? That's weird
There was a problem hiding this comment.
Only if x_delivery_site_id is set, a field that is shown only if which only happens when x_show_delivery_site, which is a related of x_select_dest_on_po which is a boolean on the picking type which allows the user to pick the delivery on the PO, which we use here. So if the user wants to deliver it to the default location, they can select it on the PO and this will work
e3f2b80 to
e6c1f83
Compare
00cbcb5 to
48c1406
Compare
e6c1f83 to
4a9707b
Compare
…iew + upgrade progress view
da42bb5 to
cdff1b4
Compare
No description provided.