Skip to content
Draft
10 changes: 10 additions & 0 deletions .weblate.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,16 @@
"filemask": "construction/i18n/*.po",
"new_base": "construction/i18n/construction.pot"
},
{
"name": "construction_line_numbering",
"filemask": "construction_line_numbering/i18n/*.po",
"new_base": "construction_line_numbering/i18n/construction_line_numbering.pot"
},
{
"name": "construction_work_items",
"filemask": "construction_work_items/i18n/*.po",
"new_base": "construction_work_items/i18n/construction_work_items.pot"
},
{
"name": "corporate_gifts",
"filemask": "corporate_gifts/i18n/*.po",
Expand Down
2 changes: 2 additions & 0 deletions construction/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,13 @@
'demo/planning_recurrency.xml',
'demo/planning_slot.xml',
'demo/sale_order_spreadsheet.xml',
'demo/res_config_settings.xml',
],
'license': 'OPL-1',
'author': 'Odoo S.A.',
"cloc_exclude": [
"data/knowledge_article.xml",
"data/res_config_settings.xml",
],
'images': ['images/main.png'],
'url': "https://www.odoo.com/trial?industry&selected_app=construction",
Expand Down
138 changes: 119 additions & 19 deletions construction/data/res_config_settings.xml
Original file line number Diff line number Diff line change
@@ -1,23 +1,123 @@
<?xml version='1.0' encoding='UTF-8'?>
<odoo noupdate="1">
<record id="res_config_account_setting" model="res.config.settings">
<field name="group_project_stages" eval="1"/>
<field name="group_discount_per_so_line" eval="1"/>
<field name="group_product_pricelist" eval="1"/>
<field name="group_warning_sale" eval="1"/>
<field name="group_warning_purchase" eval="1"/>
<field name="invoiced_timesheet" eval="'approved'"/>
<field name="group_warning_stock" eval="1"/>
<field name="group_stock_reception_report" eval="1"/>
<field name="group_sale_delivery_address" eval="1"/>
<field name="documents_product_settings" eval="1"/>
<field name="documents_hr_settings" eval="1"/>
<field name="group_analytic_accounting" eval="1"/>
<field name="group_uom" eval="1"/>
<field name="group_sale_order_template" eval="1"/>
<odoo>
<function name="button_immediate_install" model="ir.module.module" eval="[ref('base.module_web_studio', raise_if_not_found=False)]"/>
<record id="x_setting_field_line_numbering" model="ir.model.fields">
<field name="ttype">boolean</field>
<field name="field_description">Line Numbering</field>
<field name="model_id" ref="base_setup.model_res_config_settings"/>
<field name="name">x_setting_line_numbering</field>
<field name="readonly" eval="False"/>
<field name="store" eval="True"/>
<field name="compute"><![CDATA[
self['x_setting_line_numbering'] = self.env['ir.config_parameter'].sudo().get_param('construction_configuration.enable_line_numbering') or bool(self.env['ir.module.module'].search_count([('name', '=', 'construction_line_numbering')], limit=1))
]]></field>
</record>

<function name="execute" model="res.config.settings">
<value eval="[ref('res_config_account_setting')]"/>
</function>
<record id="x_setting_field_work_items" model="ir.model.fields">
<field name="ttype">boolean</field>
<field name="field_description">Work Items</field>
<field name="model_id" ref="base_setup.model_res_config_settings"/>
<field name="name">x_setting_work_items</field>
<field name="readonly" eval="False"/>
<field name="store" eval="True"/>
<field name="compute"><![CDATA[
self['x_setting_work_items'] = self.env['ir.config_parameter'].sudo().get_param('construction_configuration.enable_work_items') or bool(self.env['ir.module.module'].search_count([('name', '=', 'construction_work_items')], limit=1))
]]></field>
</record>

<record id="res_config_settings_view_form" model="ir.ui.view">
<field name="name">res.config.settings.view.form.inherit.construction</field>
<field name="model">res.config.settings</field>
<field name="priority" eval="40"/>
<field name="active" eval="True"/>
<field name="inherit_id" ref="sale.res_config_settings_view_form" />
<field name="arch" type="xml">
<xpath expr="//form" position="inside" >
<app string="Construction" name="construction">
<block title="Quotations &amp; Orders" name="quotations_setting_container">
<setting id="custom_line_numbering" help="Display line number in sale orders and invoices for more clarity with your customers">
<field name="x_setting_line_numbering" readonly="0"/>
</setting>
<setting id="custom_work_items" help="Adjust work item pricing and secure your margin straight from quotations based on components.">
<field name="x_setting_work_items" readonly="0"/>
</setting>
</block>
</app>
</xpath>
<xpath expr="//block[@name='quotation_order_setting_container']" position="inside">
<setting id="custom_line_numbering" help="Display line number in sale orders and invoices for more clarity with your customers">
<field name="x_setting_line_numbering" readonly="0"/>
</setting>
<setting id="custom_work_items" help="Adjust work item pricing and secure your margin straight from quotations based on components.">
<field name="x_setting_work_items" readonly="0"/>
</setting>
</xpath>
</field>
</record>

<record id="x_action_activate_line_numbering" model="ir.actions.server">
<field name="code"><![CDATA[installed = env['ir.config_parameter'].sudo().get_param('construction_configuration.enable_line_numbering')
if not (module := env['ir.module.module'].search([('name', '=', 'construction_line_numbering')], limit=1)) and not installed and record.x_setting_line_numbering:
action_window = env['ir.module.module'].with_context({'module_name': 'construction_line_numbering'}).button_immediate_install_app()
env['base.import.module'].with_context(action_window.get('context')).browse(action_window['res_id']).import_module()
env['ir.config_parameter'].sudo().set_param('construction_configuration.enable_line_numbering', 1)
elif module and installed and not record.x_setting_line_numbering:
module.button_immediate_uninstall()
env['ir.config_parameter'].sudo().set_param('construction_configuration.enable_line_numbering', 0)
]]></field>
<field name="model_id" ref="base_setup.model_res_config_settings"/>
<field name="state">code</field>
<field name="name">(Un-)Install Line Numbering</field>
</record>
<record id="x_action_activate_work_items" model="ir.actions.server">
<field name="code"><![CDATA[installed = env['ir.config_parameter'].sudo().get_param('construction_configuration.enable_work_items')
if not (module := env['ir.module.module'].search([('name', '=', 'construction_work_items')], limit=1)) and not installed and record.x_setting_work_items:
action_window = env['ir.module.module'].with_context({'module_name': 'construction_work_items'}).button_immediate_install_app()
env['base.import.module'].with_context(action_window.get('context')).browse(action_window['res_id']).import_module()
env['ir.config_parameter'].sudo().set_param('construction_configuration.enable_work_items', 1)
elif module and installed and not record.x_setting_work_items:
module.button_immediate_uninstall()
env['ir.config_parameter'].sudo().set_param('construction_configuration.enable_work_items', 0)
]]></field>
<field name="model_id" ref="base_setup.model_res_config_settings"/>
<field name="state">code</field>
<field name="name">(Un-)Install Work Items</field>
</record>

<function name="button_immediate_install" model="ir.module.module" eval="[ref('base.module_web_studio', raise_if_not_found=False)]"/>
<record id="x_setting_activate_line_numbering" model="base.automation">
<field name="model_id" ref="base_setup.model_res_config_settings"/>
<field name="action_server_ids" eval="[(6, 0, [ref('x_action_activate_line_numbering')])]"/>
<field name="trigger">on_create_or_write</field>
<field name="name">Activate line numbering setting</field>
<field name="trigger_field_ids" eval="[(6, 0, [ref('x_setting_field_line_numbering')])]"/>
</record>
<record id="x_setting_activate_work_items" model="base.automation">
<field name="model_id" ref="base_setup.model_res_config_settings"/>
<field name="action_server_ids" eval="[(6, 0, [ref('x_action_activate_work_items')])]"/>
<field name="trigger">on_create_or_write</field>
<field name="name">Activate Work Items setting</field>
<field name="trigger_field_ids" eval="[(6, 0, [ref('x_setting_field_work_items')])]"/>
</record>
<function name="button_immediate_uninstall" model="ir.module.module" eval="[ref('base.module_web_studio', raise_if_not_found=False)]"/>

<data noupdate="1">
<record id="res_config_construction" model="res.config.settings">
<field name="group_project_stages" eval="1"/>
<field name="group_discount_per_so_line" eval="1"/>
<field name="group_product_pricelist" eval="1"/>
<field name="group_warning_sale" eval="1"/>
<field name="group_warning_purchase" eval="1"/>
<field name="invoiced_timesheet" eval="'approved'"/>
<field name="group_warning_stock" eval="1"/>
<field name="group_stock_reception_report" eval="1"/>
<field name="group_sale_delivery_address" eval="1"/>
<field name="documents_product_settings" eval="1"/>
<field name="documents_hr_settings" eval="1"/>
<field name="group_analytic_accounting" eval="1"/>
<field name="group_uom" eval="1"/>
<field name="group_sale_order_template" eval="1"/>
</record>
<function name="execute" model="res.config.settings" eval="[ref('res_config_construction')]"/>
</data>
</odoo>
8 changes: 8 additions & 0 deletions construction/demo/res_config_settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo noupdate="1">
<record id="res_config_construction_demo" model="res.config.settings">
<!-- <field name="x_setting_line_numbering" eval="1"/>
<field name="x_setting_work_items" eval="1"/> -->
</record>
<function name="execute" model="res.config.settings" eval="[ref('res_config_construction_demo')]"/>
</odoo>
Empty file.
20 changes: 20 additions & 0 deletions construction_line_numbering/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
'name': 'Construction Line Numbering',
'version': '1.0',
'category': 'Hidden/Tools',
'author': 'Odoo S.A.',
'depends': [
'base_industry_data',
'construction',
'sale_management',
'web_studio',
],
'data': [
'data/ir_ui_view.xml',
'data/qweb_view.xml',
],
'demo': [],
'license': 'OPL-1',
'cloc_exclude': [],
'website': "https://www.odoo.com/all-industries",
}
33 changes: 33 additions & 0 deletions construction_line_numbering/data/ir_ui_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version='1.0' encoding='UTF-8'?>
<odoo>
<record id="sale_order_form_view_inherit" model="ir.ui.view">
<field name="arch" type="xml">
<data>
<xpath expr="//list//field[@name='sequence']" position="after">
<field name="sequence" optional="show" decoration-muted="1" options="{'hide_trailing_zeros': true}" string="#"/>
</xpath>
</data>
</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="mode">extension</field>
<field name="model">sale.order</field>
<field name="name">Construction: sale.order customization</field>
<field name="priority">1600</field>
<field name="type">form</field>
</record>
<record id="account_move_form_view_inherit" model="ir.ui.view">
<field name="arch" type="xml">
<data>
<xpath expr="//field[@name='product_id']" position="before">
<field name="sequence" optional="show" decoration-muted="1" options="{'hide_trailing_zeros': true}" string="#"/>
</xpath>
</data>
</field>
<field name="inherit_id" ref="sale.account_invoice_form"/>
<field name="mode">extension</field>
<field name="model">account.move</field>
<field name="name">Construction: account.move customization</field>
<field name="priority">1600</field>
<field name="type">form</field>
</record>
</odoo>
44 changes: 44 additions & 0 deletions construction_line_numbering/data/qweb_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?xml version='1.0' encoding='UTF-8'?>
<odoo>
<template id="sale_order_portal_content_inherit" inherit_id="sale.sale_order_portal_content">
<xpath expr="//th[@id='product_name_header']" position="before">
<th class="text-start" id="product_sequence_header">#</th>
</xpath>

<xpath expr="//td[@name='td_product_name']" position="before">
<td name="td_product_sequence" t-att-class="padding_class">
<span name="span_product_sequence" t-field="line.sequence"/>
</td>
</xpath>
</template>
<template id="sale_order_report_document_inherit" inherit_id="sale.report_saleorder_document">
<xpath expr="//th[@name='th_description']" position="before">
<th name="th_sequence" class="text-start">#</th>
</xpath>
<xpath expr="//td[@name='td_product_name']" position="before">
<td name="td_product_sequence" t-att-class="padding_class">
<span t-field="line.sequence"></span>
</td>
</xpath>
</template>
<template id="account_move_portal_content_inherit" inherit_id="account.bill_preview">
<xpath expr="//th[@name='th_description']" position="before">
<th class="text-start" id="invoice_sequence_header">#</th>
</xpath>
<xpath expr="//td[@name='account_invoice_line_name']" position="before">
<td name="invoice_sequence" t-att-class="padding_class">
<span name="span_invoice_sequence" t-field="line.sequence"/>
</td>
</xpath>
</template>
<template id="account_move_report_document_inherit" inherit_id="account.report_invoice_document">
<xpath expr="//th[@name='th_description']" position="before">
<th name="th_sequence" class="text-start">#</th>
</xpath>
<xpath expr="//td[@name='account_invoice_line_name']" position="before">
<td name="account_invoice_line_sequence" t-att-class="padding_class">
<span t-field="line.sequence"></span>
</td>
</xpath>
</template>
</odoo>
Empty file.
44 changes: 44 additions & 0 deletions construction_work_items/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
'name': 'Construction Work Items',
'version': '1.0',
'category': 'Hidden/Tools',
'author': 'Odoo S.A.',
'depends': [
'base_industry_data',
'construction',
'sale_management',
'web_studio',
],
'data': [
'data/res_config_settings.xml',
'data/ir_model.xml',
'data/ir_model_access.xml',
'data/ir_model_fields.xml',
'data/ir_default.xml',
'data/ir_actions_act_window.xml',
'data/ir_actions_server.xml',
'data/base_automation.xml',
'data/ir_ui_menu.xml',
'data/ir_ui_view.xml',
'data/product_template.xml',
'data/product_product.xml',
'data/x_work_item.xml',
'data/x_work_item_line.xml',
'data/sale_order_template.xml',
'data/sale_order_template_line.xml',
],
'demo': [
'demo/res_partner.xml',
'demo/account_analytic_account.xml',
'demo/project_project.xml',
'demo/product_supplierinfo.xml',
'demo/sale_order.xml',
'demo/sale_order_line.xml',
'demo/project_task.xml',
'demo/x_work_item.xml',
'demo/sale_order_confirm.xml',
],
'license': 'OPL-1',
'cloc_exclude': [],
'website': "https://www.odoo.com/all-industries",
}
57 changes: 57 additions & 0 deletions construction_work_items/data/base_automation.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?xml version='1.0' encoding='UTF-8'?>
<odoo>
<record id="base_automation_on_x_work_item_line_change" model="base.automation">
<field name="model_id" ref="x_work_item_line_model" />
<field name="action_server_ids"
eval="[(6, 0, [ref('server_action_set_unit_cost_price_fromm_product')])]" />
<field name="trigger">on_change</field>
<field name="name">Construction: Work Item line - Component product selection</field>
<field name="on_change_field_ids"
eval="[(6, 0, [ref('x_product_product_id_field_x_work_item_line')])]" />
</record>
<record id="base_automation_x_work_item_on_product_change" model="base.automation">
<field name="model_id" ref="x_work_item_model" />
<field name="action_server_ids" eval="[(6, 0, [ref('server_action_set_work_item_name_and_ref')])]" />
<field name="trigger">on_change</field>
<field name="name">Construction: Work Item - Product selection</field>
<field name="on_change_field_ids"
eval="[(6, 0, [ref('x_product_product_id_field_x_work_item')])]" />
</record>
<record id="base_automation_sol_on_quantity_update" model="base.automation">
<field name="model_id" ref="sale.model_sale_order_line" />
<field name="action_server_ids" eval="[(6, 0, [ref('server_action_scale_associated_work_item')])]" />
<field name="trigger">on_create_or_write</field>
<field name="name">Construction: SOL - On qty update</field>
<field name="trigger_field_ids"
eval="[(6, 0, [ref('sale.field_sale_order_line__product_uom_qty')])]" />
</record>
<record id="base_automation_x_work_item_with_sol_on_write" model="base.automation">
<field name="model_id" ref="x_work_item_model" />
<field name="action_server_ids"
eval="[(6, 0, [ref('server_action_update_associated_sol')])]" />
<field name="trigger">on_create_or_write</field>
<field name="filter_pre_domain">[("x_sale_order_line_id", "!=", False)]</field>
<field name="name">Construction: Work Item - On save of non template</field>
</record>
<record id="base_automation_x_work_item_on_write" model="base.automation">
<field name="model_id" ref="x_work_item_model" />
<field name="action_server_ids"
eval="[(6, 0, [ref('server_action_update_product_cost_price')])]" />
<field name="trigger">on_create_or_write</field>
<field name="name">Construction: Work Item - On template edition</field>
</record>
<record id="base_automation_sol_on_create" model="base.automation">
<field name="model_id" ref="sale.model_sale_order_line" />
<field name="action_server_ids"
eval="[(6, 0, [ref('server_actoin_create_associated_work_item')])]" />
<field name="trigger">on_create</field>
<field name="name">Construction: SOL - On creation</field>
</record>
<record id="base_automation_product_product_on_x_work_item_ids_change" model="base.automation">
<field name="model_id" ref="x_work_item_model" />
<field name="action_server_ids"
eval="[(6, 0, [ref('server_action_assign_x_template_work_item_id')])]" />
<field name="trigger">on_create_or_write</field>
<field name="name">Construction: Work Item - On product Work Item ids change</field>
</record>
</odoo>
8 changes: 8 additions & 0 deletions construction_work_items/data/ir_actions_act_window.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version='1.0' encoding='UTF-8'?>
<odoo>
<record id="action_window_work_items" model="ir.actions.act_window">
<field name="name">Work Items</field>
<field name="domain">[('x_active', '=', True),('x_is_template', '=', True)]</field>
<field name="res_model">x_work_item</field>
</record>
</odoo>
Loading