Tower: upload laundry_management 19.0.19.0.4 (via marketplace)

This commit is contained in:
2026-05-01 15:01:19 +00:00
parent 88f970547f
commit f2122a7706

View File

@@ -0,0 +1,53 @@
from odoo import models, fields, api
class LaundryOrderLineAddon(models.Model):
"""Optional add-on service attached to one sale.order.line.
Examples per item:
- Express handling (+10 SAR)
- Starch / تقطير (+3 SAR)
- Packaging (+2 SAR)
- Perfume scent (+5 SAR)
The parent line's subtotal does NOT automatically include add-on prices
(sale.order.line controls its own subtotal). Add-ons are tracked here for
printing and reporting purposes; staff can create a separate order line for
the add-on product if billing is required.
"""
_name = 'laundry.order.line.addon'
_description = 'Order Line Add-on'
_order = 'line_id, id'
line_id = fields.Many2one(
'sale.order.line', string='Order Line',
required=True, ondelete='cascade', index=True,
)
# Denormal for easy reporting — derived from sale.order.line.order_id
order_id = fields.Many2one(
'sale.order',
related='line_id.order_id', store=True, index=True,
)
name = fields.Char(
string='Add-on / الإضافة',
required=True,
help='Name of the additional service (e.g. Express, Starch, Packaging).',
)
price = fields.Float(
string='Price / السعر',
required=True, digits=(10, 2), default=0.0,
)
quantity = fields.Float(
string='Qty',
default=1.0, digits=(10, 2),
)
subtotal = fields.Float(
string='Subtotal',
compute='_compute_subtotal', store=True, digits=(10, 2),
)
@api.depends('price', 'quantity')
def _compute_subtotal(self):
for addon in self:
addon.subtotal = addon.price * addon.quantity