Skip to content

Commit ee7866e

Browse files
author
John75SunCity
committed
feat: Update pricing and add new fees for container destruction and perm-out services
1 parent 2d488fe commit ee7866e

File tree

2 files changed

+126
-50
lines changed

2 files changed

+126
-50
lines changed

records_management/data/products_data.xml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@
9595
<field name="type">service</field>
9696
<field name="categ_id" ref="product_category_paper_scrap"/>
9797
<field name="default_code">SHRED-BOX</field>
98-
<field name="list_price">10.00</field>
99-
<field name="standard_price">5.00</field>
98+
<field name="list_price">6.00</field>
99+
<field name="standard_price">3.00</field>
100100
<field name="description">Secure shredding of customer-supplied standard cardboard box of documents (banker box size)</field>
101101
</record>
102102

@@ -116,6 +116,17 @@
116116
<field name="value">NAID AAA compliant destruction with certificate generation</field>
117117
</record>
118118

119+
<!-- Perm Out Fee - Per-container fee for permanent removal from inventory -->
120+
<record id="product_perm_out_fee" model="product.product">
121+
<field name="name">Perm Out Fee</field>
122+
<field name="type">service</field>
123+
<field name="categ_id" ref="product_category_paper_scrap"/>
124+
<field name="default_code">RM-PERMOUT-FEE</field>
125+
<field name="list_price">10.00</field>
126+
<field name="standard_price">5.00</field>
127+
<field name="description">Per-container fee for permanent removal from inventory. Charged on both perm-out and destruction orders.</field>
128+
</record>
129+
119130
<!-- Container Type Specific Services (Actual Business Specifications) -->
120131
<record id="product_storage_type01" model="product.product">
121132
<field name="name">TYPE 01 Standard Box Storage</field>
@@ -194,9 +205,9 @@
194205
<field name="type">service</field>
195206
<field name="categ_id" ref="product_category_paper_scrap"/>
196207
<field name="default_code">REC-RETRIEVAL</field>
197-
<field name="list_price">35.00</field>
198-
<field name="standard_price">22.00</field>
199-
<field name="description">Individual document retrieval service (per request)</field>
208+
<field name="list_price">3.50</field>
209+
<field name="standard_price">2.00</field>
210+
<field name="description">Individual document retrieval service (per container)</field>
200211
</record>
201212

202213
<record id="product_scanning_service" model="product.product">

records_management/models/records_container.py

Lines changed: 110 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2375,11 +2375,12 @@ def _create_destruction_charges(self):
23752375
"""
23762376
Create invoice charges for container destruction.
23772377
2378-
Destruction includes:
2379-
- Per-item removal fee
2380-
- Per-item shredding fee
2378+
Destruction Bundle includes (per container):
2379+
1. Retrieval Fee - pulling from stock location
2380+
2. Perm Out Fee - removing from inventory permanently
2381+
3. Shred Box Fee - physical shredding of contents
23812382
2382-
Creates 2 invoice line items.
2383+
Creates 3 invoice line items per container.
23832384
"""
23842385
self.ensure_one()
23852386

@@ -2389,22 +2390,30 @@ def _create_destruction_charges(self):
23892390
# Get or create draft invoice for customer
23902391
invoice = self._get_or_create_draft_invoice()
23912392

2392-
# Get product for removal fee
2393-
removal_product = self._get_removal_fee_product()
2393+
# Get fee products
2394+
retrieval_product = self._get_retrieval_fee_product()
2395+
perm_out_product = self._get_perm_out_fee_product()
23942396
shredding_product = self._get_shredding_fee_product()
23952397

2396-
# Create invoice lines
2398+
# Create invoice lines (3 charges for destruction)
23972399
invoice_line_vals = [
23982400
{
2399-
'product_id': removal_product.id,
2400-
'name': _('Container Removal Fee - %s') % (self.barcode or self.name),
2401+
'product_id': retrieval_product.id,
2402+
'name': _('Retrieval Fee - %s') % (self.barcode or self.name),
24012403
'quantity': 1,
2402-
'price_unit': removal_product.list_price,
2404+
'price_unit': retrieval_product.list_price,
2405+
'move_id': invoice.id,
2406+
},
2407+
{
2408+
'product_id': perm_out_product.id,
2409+
'name': _('Perm Out Fee - %s') % (self.barcode or self.name),
2410+
'quantity': 1,
2411+
'price_unit': perm_out_product.list_price,
24032412
'move_id': invoice.id,
24042413
},
24052414
{
24062415
'product_id': shredding_product.id,
2407-
'name': _('Container Shredding Fee - %s') % (self.barcode or self.name),
2416+
'name': _('Shred Box Fee - %s') % (self.barcode or self.name),
24082417
'quantity': 1,
24092418
'price_unit': shredding_product.list_price,
24102419
'move_id': invoice.id,
@@ -2413,12 +2422,16 @@ def _create_destruction_charges(self):
24132422

24142423
self.env['account.move.line'].create(invoice_line_vals)
24152424

2425+
# Calculate total
2426+
total = retrieval_product.list_price + perm_out_product.list_price + shredding_product.list_price
2427+
24162428
# Log charge creation
24172429
self.message_post(
2418-
body=_("Destruction charges created:<br/>• Removal fee: %s<br/>• Shredding fee: %s<br/>Total: %s") % (
2419-
removal_product.list_price,
2430+
body=_("Destruction charges created:<br/>• Retrieval Fee: $%.2f<br/>• Perm Out Fee: $%.2f<br/>• Shred Box Fee: $%.2f<br/><strong>Total: $%.2f</strong>") % (
2431+
retrieval_product.list_price,
2432+
perm_out_product.list_price,
24202433
shredding_product.list_price,
2421-
removal_product.list_price + shredding_product.list_price
2434+
total
24222435
),
24232436
subject=_("Destruction Charges Created")
24242437
)
@@ -2429,10 +2442,12 @@ def _create_removal_charges(self):
24292442
"""
24302443
Create invoice charges for permanent removal (perm-out).
24312444
2432-
Perm-Out includes:
2433-
- Per-item removal fee ONLY (no shredding)
2445+
Perm-Out Bundle includes (per container):
2446+
1. Retrieval Fee - pulling from stock location
2447+
2. Perm Out Fee - removing from inventory permanently
24342448
2435-
Creates 1 invoice line item.
2449+
NO shredding fee - customer takes their boxes.
2450+
Creates 2 invoice line items per container.
24362451
"""
24372452
self.ensure_one()
24382453

@@ -2442,23 +2457,40 @@ def _create_removal_charges(self):
24422457
# Get or create draft invoice for customer
24432458
invoice = self._get_or_create_draft_invoice()
24442459

2445-
# Get product for removal fee
2446-
removal_product = self._get_removal_fee_product()
2460+
# Get fee products
2461+
retrieval_product = self._get_retrieval_fee_product()
2462+
perm_out_product = self._get_perm_out_fee_product()
24472463

2448-
# Create invoice line
2449-
invoice_line_vals = {
2450-
'product_id': removal_product.id,
2451-
'name': _('Container Removal Fee (Perm-Out) - %s') % (self.barcode or self.name),
2452-
'quantity': 1,
2453-
'price_unit': removal_product.list_price,
2454-
'move_id': invoice.id,
2455-
}
2464+
# Create invoice lines (2 charges for perm-out)
2465+
invoice_line_vals = [
2466+
{
2467+
'product_id': retrieval_product.id,
2468+
'name': _('Retrieval Fee - %s') % (self.barcode or self.name),
2469+
'quantity': 1,
2470+
'price_unit': retrieval_product.list_price,
2471+
'move_id': invoice.id,
2472+
},
2473+
{
2474+
'product_id': perm_out_product.id,
2475+
'name': _('Perm Out Fee - %s') % (self.barcode or self.name),
2476+
'quantity': 1,
2477+
'price_unit': perm_out_product.list_price,
2478+
'move_id': invoice.id,
2479+
}
2480+
]
24562481

24572482
self.env['account.move.line'].create(invoice_line_vals)
24582483

2484+
# Calculate total
2485+
total = retrieval_product.list_price + perm_out_product.list_price
2486+
24592487
# Log charge creation
24602488
self.message_post(
2461-
body=_("Removal charges created (Perm-Out):<br/>• Removal fee: %s") % removal_product.list_price,
2489+
body=_("Perm-Out charges created:<br/>• Retrieval Fee: $%.2f<br/>• Perm Out Fee: $%.2f<br/><strong>Total: $%.2f</strong>") % (
2490+
retrieval_product.list_price,
2491+
perm_out_product.list_price,
2492+
total
2493+
),
24622494
subject=_("Perm-Out Charges Created")
24632495
)
24642496

@@ -2483,38 +2515,71 @@ def _get_or_create_draft_invoice(self):
24832515

24842516
return invoice
24852517

2486-
def _get_removal_fee_product(self):
2487-
"""Get or create product for removal fees"""
2488-
product = self.env['product.product'].search([
2489-
('default_code', '=', 'RM-REMOVAL-FEE'),
2490-
], limit=1)
2518+
def _get_retrieval_fee_product(self):
2519+
"""Get or create product for retrieval fees (pulling from stock location)"""
2520+
product = self.env.ref('records_management.product_retrieval_service', raise_if_not_found=False)
2521+
2522+
if not product:
2523+
product = self.env['product.product'].search([
2524+
('default_code', 'in', ['REC-RETRIEVAL', 'RM-RETRIEVAL-FEE']),
2525+
], limit=1)
2526+
2527+
if not product:
2528+
product = self.env['product.product'].create({
2529+
'name': 'Document Retrieval Service',
2530+
'default_code': 'REC-RETRIEVAL',
2531+
'type': 'service',
2532+
'list_price': 3.50, # Default - edit in Products to change
2533+
'invoice_policy': 'order',
2534+
'description': 'Per-container retrieval fee for pulling containers from stock location',
2535+
})
2536+
2537+
return product
2538+
2539+
def _get_perm_out_fee_product(self):
2540+
"""Get or create product for perm-out fees (permanent removal from inventory)"""
2541+
product = self.env.ref('records_management.product_perm_out_fee', raise_if_not_found=False)
2542+
2543+
if not product:
2544+
product = self.env['product.product'].search([
2545+
('default_code', '=', 'RM-PERMOUT-FEE'),
2546+
], limit=1)
24912547

24922548
if not product:
24932549
product = self.env['product.product'].create({
2494-
'name': 'Container Removal Fee',
2495-
'default_code': 'RM-REMOVAL-FEE',
2550+
'name': 'Perm Out Fee',
2551+
'default_code': 'RM-PERMOUT-FEE',
24962552
'type': 'service',
2497-
'list_price': 15.00, # Default price - configurable
2553+
'list_price': 10.00, # Default - edit in Products to change
24982554
'invoice_policy': 'order',
2499-
'description': 'Per-container removal fee for destruction or perm-out services',
2555+
'description': 'Per-container fee for permanent removal from inventory (perm-out)',
25002556
})
25012557

25022558
return product
25032559

2560+
def _get_removal_fee_product(self):
2561+
"""Legacy method - redirects to perm out fee product"""
2562+
return self._get_perm_out_fee_product()
2563+
25042564
def _get_shredding_fee_product(self):
2505-
"""Get or create product for shredding fees"""
2506-
product = self.env['product.product'].search([
2507-
('default_code', '=', 'RM-SHREDDING-FEE'),
2508-
], limit=1)
2565+
"""Get or create product for shredding fees (Shred Box - per container)"""
2566+
# First try to get the Shred Box product (from XML data)
2567+
product = self.env.ref('records_management.product_shred_box', raise_if_not_found=False)
2568+
2569+
# Fallback to legacy code lookup
2570+
if not product:
2571+
product = self.env['product.product'].search([
2572+
('default_code', 'in', ['SHRED-BOX', 'RM-SHREDDING-FEE']),
2573+
], limit=1)
25092574

25102575
if not product:
25112576
product = self.env['product.product'].create({
2512-
'name': 'Container Shredding Fee',
2513-
'default_code': 'RM-SHREDDING-FEE',
2577+
'name': 'Shred Box (Standard Box)',
2578+
'default_code': 'SHRED-BOX',
25142579
'type': 'service',
2515-
'list_price': 25.00, # Default price - configurable
2580+
'list_price': 10.00, # Default price - configurable
25162581
'invoice_policy': 'order',
2517-
'description': 'Per-container shredding fee for destruction services',
2582+
'description': 'Per-container shredding fee for destruction services (standard box)',
25182583
})
25192584

25202585
return product

0 commit comments

Comments
 (0)