diff --git a/addons/laundry_management/models/laundry_order_attribute.py b/addons/laundry_management/models/laundry_order_attribute.py new file mode 100644 index 0000000..7a53c60 --- /dev/null +++ b/addons/laundry_management/models/laundry_order_attribute.py @@ -0,0 +1,62 @@ +from odoo import models, fields, api + + +class LaundryOrderAttribute(models.Model): + """Optional per-order badge (Urgent / Hanger / Fold / Delicate / ...). + + Multi-selectable on a laundry order. Semantic flags drive behavior + without name matching, so admins can rename freely. + """ + _name = 'laundry.order.attribute' + _inherit = ['pos.load.mixin'] + _description = 'Laundry Order Attribute' + _order = 'sequence, id' + + name = fields.Char(string='Name', required=True, translate=True) + code = fields.Char(string='Code') + sequence = fields.Integer(default=10) + active = fields.Boolean(default=True) + + color = fields.Char(string='Color') + icon_image = fields.Binary(string='Icon') + description = fields.Text(string='Description', translate=True) + + extra_price = fields.Float( + string='Extra Price', + help='Reserved for future pricing rules. Not applied automatically.', + ) + + pos_available = fields.Boolean(string='Available in POS', default=True) + company_id = fields.Many2one( + 'res.company', string='Company', + default=lambda self: self.env.company, index=True, + ) + + is_delivery_related = fields.Boolean( + string='Delivery Related', + help='Selecting this attribute marks the order as delivery and ' + 'triggers the delivery-details prompt.', + ) + is_priority_related = fields.Boolean( + string='Priority Related', + help='Selecting this attribute promotes the order to urgent priority.', + ) + + @api.model + def _load_pos_data_domain(self, data, config): + return [ + ('pos_available', '=', True), + ('active', '=', True), + '|', + ('company_id', '=', False), + ('company_id', 'in', config.company_id.ids), + ] + + @api.model + def _load_pos_data_fields(self, config): + return [ + 'id', 'name', 'code', 'sequence', + 'color', 'description', + 'extra_price', + 'is_delivery_related', 'is_priority_related', + ]