From f2122a77069e467628301b52ec44b9b621d65c51 Mon Sep 17 00:00:00 2001 From: git_admin Date: Fri, 1 May 2026 15:01:19 +0000 Subject: [PATCH] Tower: upload laundry_management 19.0.19.0.4 (via marketplace) --- .../models/laundry_order_line_addon.py | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 addons/laundry_management/models/laundry_order_line_addon.py diff --git a/addons/laundry_management/models/laundry_order_line_addon.py b/addons/laundry_management/models/laundry_order_line_addon.py new file mode 100644 index 0000000..d8ee954 --- /dev/null +++ b/addons/laundry_management/models/laundry_order_line_addon.py @@ -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