Skip to content

Commit 18cdf11

Browse files
committed
[IMP] warranty_configuration: wizard view and action updated
Solved all error faced yesterday and completed wizard view properly. Configured it such that it adding order line. updated views as well as Transient models. Added new field in sale order line model to assign functionality such that it product get removed from order line than its warranty product also get removed. Demo data added for warranty configuration State button file path uncommented from estate_account solved error occured for agent and manger group. Image not displayed other than admin issue solved in website page of properties. added all product remove button in sale order
1 parent 6058b9a commit 18cdf11

16 files changed

+165
-78
lines changed

estate/controllers/main.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33

44
class EstatePropertyControllers(Controller):
55
@route("/active_properties", auth="public", website=True)
6-
def list_active_properties(self, page=1):
6+
def list_active_properties(self, page=1, **kw):
77
page = int(page)
88
limit = 3
9+
# if kw.get("size"):
10+
# limit = int(kw.get("size"))
911
offset = (page - 1) * limit
1012

1113
properties = (
@@ -17,11 +19,12 @@ def list_active_properties(self, page=1):
1719
("active", "=", True),
1820
("state", "in", ["new", "offer_received"]),
1921
],
20-
fields=["name", "expected_price", "description"],
22+
fields=["name", "expected_price", "description", "image"],
2123
limit=limit,
2224
offset=offset,
2325
)
2426
)
27+
2528
total_properties = (
2629
request.env["estate.property"]
2730
.sudo()
@@ -41,7 +44,7 @@ def list_active_properties(self, page=1):
4144
)
4245

4346
@route("/property/<int:property_id>", auth="public", website=True)
44-
def property_detail(self, property_id, **kw):
47+
def property_detail(self, property_id):
4548
property = request.env["estate.property"].sudo().browse(property_id)
4649
if property.exists():
4750
# print("*-*-" * 100)

estate/controllers/postreq.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,10 @@ def submit_contact_form(self, **post):
3535
cors="*",
3636
)
3737
def submit_contact_form_ext(self, **post):
38-
print("post:", post)
38+
# print("post:", post)
3939
if not post:
4040
try:
41+
## request.httprequest.data is raw data format (binary data)
4142
post = json.loads(request.httprequest.data.decode("utf-8"))
4243
except Exception as e:
4344
_logger.error(f"Fallback JSON Parsing Error: {e}")

estate/views/res_users_views.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44
<field name="model">res.users</field>
55
<field name="inherit_id" ref="base.view_users_form" />
66
<field name="arch" type="xml">
7-
<xpath expr="//page[@name='account_security']" position="after">
7+
<xpath expr="//group/field[@name='partner_id']" position="attributes">
8+
<attribute name="string">Partner Name</attribute>
9+
</xpath>
10+
<xpath expr="//notebook/page" position="after">
811
<page name="Estate Properties">
912
<field name="property_ids" />
1013
</page>

estate/views/website_properties_templates.xml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,20 @@
88
<div class="col-md-4 mb-4 d-flex">
99
<div class="card flex-fill">
1010
<div class="card-body d-flex flex-column">
11-
<img
12-
t-att-src="'/web/image/estate.property/' + str(property.get('id')) + '/image'"
13-
class="card-img-top"
14-
style="height: 300px; width: 100%; object-fit: cover;"
15-
alt="Property Image" />
11+
<t t-if="property.get('image')">
12+
<img
13+
t-att-src="image_data_uri(property.get('image'))"
14+
class="card-img-top"
15+
style="height: 300px; width: 100%; object-fit: cover;"
16+
alt="Property Image" />
17+
</t>
18+
<t t-else="">
19+
<img
20+
t-att-src="'/web/image/estate.property/' + str(property.get('id')) + '/image'"
21+
class="card-img-top"
22+
style="height: 300px; width: 100%; object-fit: cover;"
23+
alt="Property Image" />
24+
</t>
1625
<h5 class="card-title">
1726
<t t-esc="property.get('name')" />
1827
</h5>
@@ -51,4 +60,4 @@
5160
</div>
5261
</t>
5362
</template>
54-
</odoo>
63+
</odoo>

estate_account/__manifest__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
"data": [
1010
"report/estate_estate_property_templates.xml",
1111
"security/ir.model.access.csv",
12-
# "views/actions_smart_button.xml",
13-
# "views/estate_property_views.xml",
12+
"views/actions_smart_button.xml",
13+
"views/estate_property_views.xml",
1414
],
1515
"demo": [
1616
"demo/demo_invoice_data_property.xml",

estate_account/views/estate_property_views.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
icon="fa-bars"
1313
string="offers"
1414
invisible="invoice_count == 0"
15+
groups="base.group_system"
1516
>
1617
<div class="o_stat_info">
1718
<span class="o_stat_value">

warranty_configuration/__manifest__.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "Warranty Configuration",
33
"version": "1.0",
4-
"depends": ["base", "sale_management", "stock"],
4+
"depends": ["base", "sale_management", "spreadsheet"],
55
"author": "djip-odoo",
66
"description": """
77
Part of technical training
@@ -13,7 +13,11 @@
1313
"views/sales_management_menu.xml",
1414
"views/warranty_configuration_views.xml",
1515
"views/product_views.xml",
16-
"views/so_add_warranty_button_view.xml",
16+
"views/sale_order_views.xml",
17+
],
18+
'demo':[
19+
'demo/product_demo.xml',
20+
'demo/warranty_configuration_demo.xml',
1721
],
1822
"installable": True,
1923
"application": False,
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<odoo>
3+
<record id="product_warranty_basic" model="product.product">
4+
<field name="name">Basic Warranty Service</field>
5+
<field name="type">service</field>
6+
<field name="default_code">WARRANTY_BASIC</field>
7+
<field name="list_price">50.0</field>
8+
<field name="standard_price">30.0</field>
9+
<field name="categ_id" ref="product.product_category_1" />
10+
</record>
11+
12+
<record id="product_warranty_premium" model="product.product">
13+
<field name="name">Premium Warranty Service</field>
14+
<field name="type">service</field>
15+
<field name="default_code">WARRANTY_PREMIUM</field>
16+
<field name="list_price">100.0</field>
17+
<field name="standard_price">70.0</field>
18+
<field name="categ_id" ref="product.product_category_1" />
19+
</record>
20+
21+
<record id="product_warranty_extended" model="product.product">
22+
<field name="name">Extended Warranty Service</field>
23+
<field name="type">service</field>
24+
<field name="default_code">WARRANTY_EXTENDED</field>
25+
<field name="list_price">150.0</field>
26+
<field name="standard_price">100.0</field>
27+
<field name="categ_id" ref="product.product_category_1" />
28+
</record>
29+
</odoo>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<odoo>
3+
<record id="warranty_configuration_product1" model="warranty.configuration">
4+
<field name="name">Warranty - 1 year</field>
5+
<field name="product_id" ref="warranty_configuration.product_warranty_basic" />
6+
<field name="year">1</field>
7+
<field name="percentage">10.0</field>
8+
</record>
9+
10+
<record id="warranty_configuration_product2" model="warranty.configuration">
11+
<field name="name">Warranty - 2 year</field>
12+
<field name="product_id" ref="warranty_configuration.product_warranty_premium" />
13+
<field name="year">2</field>
14+
<field name="percentage">15.0</field>
15+
</record>
16+
17+
<record id="warranty_configuration_product3" model="warranty.configuration">
18+
<field name="name">Warranty - 3 year</field>
19+
<field name="product_id" ref="warranty_configuration.product_warranty_extended" />
20+
<field name="year">3</field>
21+
<field name="percentage">20.0</field>
22+
</record>
23+
</odoo>
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
from . import warranty_configuration
22
from . import product_template
3-
from . import sale_order
43
from . import sale_order_line

0 commit comments

Comments
 (0)