Skip to content

Commit b81e599

Browse files
committed
[ADD] carpenter: Adding the module
Added a new XML template for carpentry project quotations in Odoo. The template provides a detailed structure for custom carpentry projects, including project overview, material requirements, labor breakdown, and estimated costs. It enhances user experience by automating material calculations based on project dimensions and allows for a simplified or detailed quotation view. The template is designed to streamline project management, offering automatic task and project creation upon sale of specific products, and supports flexible margin adjustments. Added the possibility to hide SO lines to the user. task-4243565
1 parent 75b0555 commit b81e599

39 files changed

+1954
-0
lines changed

carpenter/__manifest__.py

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
{
2+
'name': 'Carpenter',
3+
'version': '1.0',
4+
'category': 'Retail',
5+
'description': """
6+
""",
7+
'depends': [
8+
'base_automation',
9+
'contacts',
10+
'knowledge',
11+
'project',
12+
'purchase',
13+
'sale_management',
14+
'sale_timesheet',
15+
'stock',
16+
'web_studio',
17+
],
18+
'data': [
19+
'data/res_config_settings.xml',
20+
'data/ir_model_fields.xml',
21+
'data/report_view.xml',
22+
'data/ir_actions_report.xml',
23+
'data/mail_template.xml',
24+
'data/ir_actions_server.xml',
25+
'data/ir_ui_view.xml',
26+
'data/base_automation.xml',
27+
'data/ir_attachment_pre.xml',
28+
'data/project_task_type.xml',
29+
'data/project_tags.xml',
30+
'data/project_project.xml',
31+
'data/project_task.xml',
32+
'data/product_product.xml',
33+
'data/sale_order_spreadsheet.xml',
34+
'data/sale_order_template.xml',
35+
'data/sale_order_template_line.xml',
36+
'data/knowledge_cover.xml',
37+
'data/knowledge_article.xml',
38+
'data/knowledge_article_favorite.xml',
39+
'data/mail_message.xml',
40+
'data/knowledge_tour.xml',
41+
],
42+
'demo': [
43+
'demo/res_partner.xml',
44+
'demo/res_user.xml',
45+
'demo/product_supplierinfo.xml',
46+
'demo/sale_order.xml',
47+
'demo/sale_order_line.xml',
48+
'demo/sale_order_confirm.xml',
49+
'demo/purchase_order.xml',
50+
'demo/purchase_order_line.xml',
51+
'demo/purchase_order_confirm.xml',
52+
],
53+
'license': 'OPL-1',
54+
'assets': {
55+
'web.assets_backend': [
56+
'carpenter/static/src/js/my_tour.js',
57+
]
58+
},
59+
'author': 'Odoo S.A.',
60+
"cloc_exclude": [
61+
"data/knowledge_article.xml",
62+
"data/ir_ui_view.xml",
63+
"static/src/js/my_tour.js",
64+
],
65+
'images': ['images/main.png'],
66+
}

carpenter/data/base_automation.xml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version='1.0' encoding='UTF-8'?>
2+
<odoo>
3+
<record id="modify_portal_sale_order" model="base.automation">
4+
<field name="model_id" ref="base.model_res_config_settings"/>
5+
<field name="action_server_ids" eval="[(6, 0, [ref('replace_portal')])]"/>
6+
<field name="trigger">on_create_or_write</field>
7+
<field name="name">Modify Portal</field>
8+
</record>
9+
</odoo>

carpenter/data/ir_actions_report.xml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version='1.0' encoding='UTF-8'?>
2+
<odoo>
3+
<record id="simplified_sale_report" model="ir.actions.report">
4+
<field name="binding_model_id" ref="sale.model_sale_order"/>
5+
<field name="model">sale.order</field>
6+
<field name="name">Simplified Report</field>
7+
<field name="report_name">carpenter.simplified_sales_order</field>
8+
</record>
9+
<record id="simplified_invoice_report" model="ir.actions.report">
10+
<field name="binding_model_id" ref="account.model_account_move"/>
11+
<field name="model">account.move</field>
12+
<field name="name">Simplified Report</field>
13+
<field name="report_name">carpenter.simplified_invoice</field>
14+
<field name="is_invoice_report">True</field>
15+
</record>
16+
</odoo>

carpenter/data/ir_actions_server.xml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?xml version='1.0' encoding='UTF-8'?>
2+
<odoo>
3+
<record id="replace_so_email" model="ir.actions.server">
4+
<field name="binding_model_id" ref="sale.model_sale_order"/>
5+
<field name="model_id" ref="sale.model_sale_order"/>
6+
<field name="state">code</field>
7+
<field name="name">Execute Code</field>
8+
<field name="code">
9+
<![CDATA[
10+
action = record.action_quotation_send()
11+
action['context']['default_template_id'] = env.ref("mail_template_24").id
12+
]]>
13+
</field>
14+
</record>
15+
<record id="replace_portal" model="ir.actions.server">
16+
<field name="code">
17+
<![CDATA[
18+
view = env.ref('portal_sale_view')
19+
view.write({'active': record.x_simplify_so})
20+
view = env.ref('portal_sale_view_2')
21+
view.write({'active': record.x_simplify_so})
22+
view = env.ref('sale_stock.sale_order_portal_content_inherit_sale_stock')
23+
view.write({'active': not record.x_simplify_so})
24+
]]>
25+
</field>
26+
<field name="model_id" ref="base.model_res_config_settings"/>
27+
<field name="state">code</field>
28+
<field name="name">Execute Code</field>
29+
<field name="usage">base_automation</field>
30+
</record>
31+
</odoo>

carpenter/data/ir_attachment_pre.xml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version='1.0' encoding='UTF-8'?>
2+
<odoo noupdate="1">
3+
<record id="ir_attachment_210" model="ir.attachment">
4+
<field name="name">unsplash_iZgQKxuMRHc_.jpg</field>
5+
<field name="datas" type="base64" file="carpenter/static/src/binary/ir_attachment/240-cover.jpg"/>
6+
</record>
7+
</odoo>

carpenter/data/ir_model_fields.xml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?xml version='1.0' encoding='UTF-8'?>
2+
<odoo>
3+
<record id="x_studio_unit_cost" model="ir.model.fields">
4+
<field name="ttype">float</field>
5+
<field name="related">product_id.standard_price</field>
6+
<field name="field_description">Unit Cost</field>
7+
<field name="model_id" ref="sale.model_sale_order_line"/>
8+
<field name="name">x_studio_unit_cost</field>
9+
<field name="on_delete" eval="False"/>
10+
<field name="readonly" eval="True"/>
11+
<field name="store" eval="False"/>
12+
</record>
13+
<record id="x_simplify_so" model="ir.model.fields">
14+
<field name="ttype">boolean</field>
15+
<field name="copied" eval="True"/>
16+
<field name="field_description">Simplified SO</field>
17+
<field name="model_id" ref="base.model_res_config_settings"/>
18+
<field name="name">x_simplify_so</field>
19+
<field name="on_delete" eval="False"/>
20+
</record>
21+
22+
<record id="x_report" model="ir.model.fields">
23+
<field name="ttype">many2one</field>
24+
<field name="related">invoice_template_pdf_report_id</field>
25+
<field name="field_description">Report</field>
26+
<field name="model_id" ref="base.model_res_partner"/>
27+
<field name="name">x_report</field>
28+
<field name="relation">ir.actions.report</field>
29+
<field name="store" eval="True"/>
30+
</record>
31+
</odoo>

carpenter/data/ir_ui_view.xml

+144
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
<?xml version='1.0' encoding='UTF-8'?>
2+
<odoo>
3+
<record id="sale_res_config_settings_inherit_view" model="ir.ui.view">
4+
<field name="name">res.config.settings.inherit.sale.view</field>
5+
<field name="model">res.config.settings</field>
6+
<field name="mode">extension</field>
7+
<field name="active" eval="True"/>
8+
<field name="inherit_id" ref="sale.res_config_settings_view_form"/>
9+
<field name="arch" type="xml">
10+
<xpath expr="//block[@name='quotation_order_setting_container']" position="inside">
11+
<div class="col-12 col-lg-6 o_setting_box" id="x_simplify_so ">
12+
<div class="o_setting_left_pane">
13+
<field name="x_simplify_so"/>
14+
</div>
15+
<div class="o_setting_right_pane">
16+
<label for="x_simplify_so" string="Simplified Sales Order"/>
17+
<div class="text-muted mb16">
18+
Simplified Sales Order
19+
</div>
20+
</div>
21+
</div>
22+
</xpath>
23+
</field>
24+
</record>
25+
<record id="contact_report_default" model="ir.ui.view">
26+
<field name="arch" type="xml">
27+
<data>
28+
<xpath expr="//field[@name='category_id']" position="after">
29+
<field name="x_report" domain="[(&quot;binding_model_id&quot;, &quot;in&quot;, [471])]"/>
30+
</xpath>
31+
</data>
32+
</field>
33+
<field name="inherit_id" ref="base.view_partner_form"/>
34+
<field name="mode">extension</field>
35+
<field name="model">res.partner</field>
36+
<field name="active" eval="True"/>
37+
<field name="name">Odoo Studio: res.partner.form customization</field>
38+
<field name="priority">360</field>
39+
<field name="type">form</field>
40+
</record>
41+
<record id="sale_order_custom_view" model="ir.ui.view" >
42+
<field name="arch" type="xml">
43+
<data>
44+
<xpath expr="//form[1]/header[1]/field[@name='state']" position="after">
45+
<button string="Send Simplified Email" name="%(replace_so_email)d" type="action"/>
46+
</xpath>
47+
<xpath expr="//form[1]/sheet[1]/notebook[1]/page[@name='order_lines']/field[@name='order_line']/list[1]/field[@name='product_uom']" position="after">
48+
<field optional="show" name="x_studio_unit_cost"/>
49+
<attribute name="column_invisible">True</attribute>
50+
</xpath>
51+
<xpath expr="//form[1]/sheet[1]/notebook[1]/page[@name='order_lines']/field[@name='order_line']/list[1]/field[@name='discount']" position="attributes">
52+
<attribute name="column_invisible">True</attribute>
53+
</xpath>
54+
</data>
55+
</field>
56+
<field name="inherit_id" ref="sale.view_order_form"/>
57+
<field name="mode">extension</field>
58+
<field name="model">sale.order</field>
59+
<field name="name">Odoo Studio: sale.order.form customization</field>
60+
<field name="priority">160</field>
61+
<field name="type">form</field>
62+
<field name="active" eval="True"/>
63+
</record>
64+
<record id="portal_sale_view_2" model="ir.ui.view">
65+
<field name="name">portal_sale_view.customization2</field>
66+
<field name="inherit_id" ref="sale.sale_order_portal_template"/>
67+
<field name="mode">extension</field>
68+
<field name="model"></field>
69+
<field name="active" eval="False"/>
70+
<field name="priority">160</field>
71+
<field name="type">qweb</field>
72+
<field name="arch" type="xml">
73+
<xpath expr="//div[hasclass('o_download_pdf', 'd-flex', 'gap-2', 'flex-lg-column', 'flex-xl-row', 'flex-wrap')]" position="replace"/>
74+
</field>
75+
</record>
76+
<record id="portal_sale_view" model="ir.ui.view">
77+
<field name="name">portal_sale_view.customization</field>
78+
<field name="inherit_id" ref="sale.sale_order_portal_content"/>
79+
<field name="mode">extension</field>
80+
<field name="model"></field>
81+
<field name="active" eval="False"/>
82+
<field name="priority">160</field>
83+
<field name="type">qweb</field>
84+
<field name="arch" type="xml">
85+
<data inherit_id="sale.sale_order_portal_content" name="Default">
86+
<xpath expr="//table[@id='sales_order_table']" position="replace">
87+
<table t-att-data-order-id="sale_order.id" t-att-data-token="sale_order.access_token" class="table table-sm" id="sales_order_table">
88+
<thead>
89+
<tr>
90+
<th class="text-start">Product</th>
91+
<th class="text-end text-nowrap">Total Amount</th>
92+
</tr>
93+
</thead>
94+
<tbody class="sale_tbody">
95+
<t t-set="current_subtotal" t-value="0"/>
96+
<t t-set="lines_to_report" t-value="sale_order._get_order_lines_to_report()"/>
97+
<t t-set="has_section" t-value="any(line.display_type == 'line_section' or line.product_type == 'combo' for line in lines_to_report)"/>
98+
99+
<t t-if="has_section">
100+
<t t-foreach="lines_to_report" t-as="line">
101+
<t t-set="current_subtotal" t-value="current_subtotal + line.price_subtotal"/>
102+
<t t-if="line.display_type == 'line_section' or line.product_type == 'combo'">
103+
<tr>
104+
<td colspan="99">
105+
<span t-field="line.name"/>
106+
</td>
107+
<t t-set="current_section" t-value="line"/>
108+
<t t-set="current_subtotal" t-value="0"/>
109+
</tr>
110+
</t>
111+
<t t-if="current_section and (line_last or lines_to_report[line_index+1].display_type == 'line_section')">
112+
<tr class="is-subtotal text-end">
113+
<td colspan="99">
114+
<strong class="mr16">Subtotal</strong>
115+
<span t-out="current_subtotal" t-options="{'widget': 'monetary', 'display_currency': sale_order.currency_id}"/>
116+
</td>
117+
</tr>
118+
<t t-set="current_section" t-value="None"/>
119+
</t>
120+
</t>
121+
</t>
122+
123+
<t t-else="">
124+
<tr>
125+
<td colspan="99">
126+
<strong>Project: </strong>
127+
<span t-field="sale_order.name"/>
128+
</td>
129+
</tr>
130+
<tr class="is-subtotal text-end">
131+
<td colspan="99">
132+
<strong class="mr16">Total</strong>
133+
<span t-out="sale_order.amount_total" t-options="{'widget': 'monetary', 'display_currency': sale_order.currency_id}"/>
134+
</td>
135+
</tr>
136+
</t>
137+
</tbody>
138+
</table>
139+
</xpath>
140+
141+
</data>
142+
</field>
143+
</record>
144+
</odoo>

0 commit comments

Comments
 (0)