Skip to content

Commit 1d5ff96

Browse files
author
odoo
committed
fix: Update product type fields for consistency in product templates
feat: Add XML validation script for product data integrity refactor: Change string formatting style in map_display method
1 parent 05b69a6 commit 1d5ff96

File tree

4 files changed

+30
-10
lines changed

4 files changed

+30
-10
lines changed

records_management/data/products.xml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<!-- Product Template for Document Storage Box -->
55
<record id="product_template_box" model="product.template">
66
<field name="name">Document Storage Box</field>
7-
<field name="detailed_type">product</field>
7+
<field name="type">product</field>
88
<field name="categ_id" ref="product.product_category_all"/>
99
<field name="default_code">REC-BOX</field>
1010
<field name="list_price">15.00</field>
@@ -27,8 +27,7 @@
2727
<!-- Product Template for Document File -->
2828
<record id="product_template_file" model="product.template">
2929
<field name="name">Document File</field>
30-
<field name="detailed_type">product</field>
31-
<field name="tracking">serial</field>
30+
<field name="type">product</field>
3231
<field name="categ_id" ref="product.product_category_all"/>
3332
<field name="default_code">REC-FILE</field>
3433
<field name="list_price">5.00</field>
@@ -51,7 +50,7 @@
5150
<!-- Storage Service Product -->
5251
<record id="product_template_storage_service" model="product.template">
5352
<field name="name">Document Storage Service</field>
54-
<field name="detailed_type">service</field>
53+
<field name="type">service</field>
5554
<field name="categ_id" ref="product.product_category_all"/>
5655
<field name="default_code">REC-STOR-SVC</field>
5756
<field name="list_price">25.00</field>
@@ -72,7 +71,7 @@
7271
<!-- Shredding Service Product -->
7372
<record id="product_template_shredding_service" model="product.template">
7473
<field name="name">Document Shredding Service</field>
75-
<field name="detailed_type">service</field>
74+
<field name="type">service</field>
7675
<field name="categ_id" ref="product.product_category_all"/>
7776
<field name="default_code">REC-SHRED-SVC</field>
7877
<field name="list_price">50.00</field>

records_management/data/scheduled_actions.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<data noupdate="1">
44
<record id="ir_cron_compute_monthly_storage_fees" model="ir.cron">
55
<field name="name">Compute Monthly Storage Fees</field>
6-
<field name="model_id" ref="model_stock_quant"/>
6+
<field name="model_id" ref="stock.model_stock_quant"/>
77
<field name="state">code</field>
88
<field name="code">
99
# Import defaultdict to aggregate quantities per customer
@@ -39,17 +39,17 @@ try:
3939
'order_line': [(0, 0, {
4040
'product_id': product.id,
4141
'product_uom_qty': qty,
42-
'name': f'Monthly Storage Fee for {qty} items',
42+
'name': 'Monthly Storage Fee for %s items' % qty,
4343
})],
4444
})
4545
except Exception as e:
46-
_logger.error(f'Error computing monthly storage fees: {str(e)}')
46+
_logger.error('Error computing monthly storage fees: %s' % str(e))
4747
</field>
4848
<field name="numbercall">-1</field>
4949
<field name="active">True</field>
5050
<field name="interval_number">1</field>
5151
<field name="interval_type">months</field>
52-
<field name="nextcall" eval="(DateTime.now() + relativedelta(months=1)).strftime('%Y-%m-%d 00:00:00')"/>
52+
<field name="nextcall" eval="(datetime.now() + relativedelta(months=1)).strftime('%Y-%m-%d 00:00:00')"/>
5353
</record>
5454
</data>
5555
</odoo>

records_management/models/shredding_service.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,6 @@ def _compute_total_charge(self):
5555
def _compute_map_display(self):
5656
for record in self:
5757
if record.latitude and record.longitude:
58-
record.map_display = f"{record.latitude},{record.longitude}"
58+
record.map_display = "%s,%s" % (record.latitude, record.longitude)
5959
else:
6060
record.map_display = ''

validate_xml.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env python3
2+
import xml.etree.ElementTree as ET
3+
import sys
4+
5+
def validate_xml(file_path):
6+
try:
7+
tree = ET.parse(file_path)
8+
print(f'✅ {file_path} is valid XML')
9+
return True
10+
except ET.ParseError as e:
11+
print(f'❌ {file_path} - XML Parse Error: {e}')
12+
return False
13+
except Exception as e:
14+
print(f'❌ {file_path} - Error: {e}')
15+
return False
16+
17+
# Validate products.xml
18+
if validate_xml('records_management/data/products.xml'):
19+
print('Products XML is ready for deployment!')
20+
else:
21+
sys.exit(1)

0 commit comments

Comments
 (0)