feat: add state field and reporting filters to KDS analysis views

This commit is contained in:
Suherdy Yacob 2026-05-05 15:23:51 +07:00
parent 6c6b0b3940
commit f64b3d9571
2 changed files with 31 additions and 0 deletions

View File

@ -13,6 +13,13 @@ class PosKdsReportLine(models.Model):
pos_config_id = fields.Many2one('pos.config', string='POS Shop', compute='_compute_pos_config', store=True) pos_config_id = fields.Many2one('pos.config', string='POS Shop', compute='_compute_pos_config', store=True)
prep_display_id = fields.Many2one('pos.prep.display', string='Preparation Display', required=True) prep_display_id = fields.Many2one('pos.prep.display', string='Preparation Display', required=True)
state = fields.Selection([
('in_prep', 'In Preparation'),
('ready', 'Ready'),
('done', 'Completed'),
('cancelled', 'Cancelled')
], string='Status', default='done')
preparation_time = fields.Integer('Preparation Time (s)', help="Seconds taken to prepare") preparation_time = fields.Integer('Preparation Time (s)', help="Seconds taken to prepare")
service_time = fields.Integer('Service Time (s)', help="Seconds taken to serve") service_time = fields.Integer('Service Time (s)', help="Seconds taken to serve")
completion_time = fields.Integer('Completion Time (s)', help="Total seconds taken to complete (prep + service)") completion_time = fields.Integer('Completion Time (s)', help="Total seconds taken to complete (prep + service)")
@ -45,6 +52,15 @@ class PosKdsReportOrder(models.Model):
pos_config_id = fields.Many2one('pos.config', string='POS Shop', compute='_compute_pos_config', store=True) pos_config_id = fields.Many2one('pos.config', string='POS Shop', compute='_compute_pos_config', store=True)
prep_display_id = fields.Many2one('pos.prep.display', string='Preparation Display', required=True) prep_display_id = fields.Many2one('pos.prep.display', string='Preparation Display', required=True)
state = fields.Selection([
('in_prep', 'In Preparation'),
('ready', 'Ready'),
('done', 'Completed'),
('cancelled', 'Cancelled')
], string='Status', default='done')
preparation_time = fields.Integer('Preparation Time (s)', help="Max preparation time across lines")
service_time = fields.Integer('Service Time (s)', help="Max service time across lines")
completion_time = fields.Integer('Completion Time (s)', help="Max completion time across all lines of the order on this display") completion_time = fields.Integer('Completion Time (s)', help="Max completion time across all lines of the order on this display")
completion_datetime = fields.Datetime('Completion Date', default=fields.Datetime.now) completion_datetime = fields.Datetime('Completion Date', default=fields.Datetime.now)

View File

@ -10,6 +10,7 @@
<pivot string="KDS Product Analysis" display_quantity="1" sample="1"> <pivot string="KDS Product Analysis" display_quantity="1" sample="1">
<field name="pos_category_id" type="row"/> <field name="pos_category_id" type="row"/>
<field name="product_id" type="row"/> <field name="product_id" type="row"/>
<field name="state" type="col"/>
<field name="completion_time" type="measure" operator="avg"/> <field name="completion_time" type="measure" operator="avg"/>
<field name="preparation_time" type="measure" operator="avg"/> <field name="preparation_time" type="measure" operator="avg"/>
<field name="service_time" type="measure" operator="avg"/> <field name="service_time" type="measure" operator="avg"/>
@ -39,10 +40,15 @@
<field name="pos_category_id"/> <field name="pos_category_id"/>
<field name="prep_display_id"/> <field name="prep_display_id"/>
<field name="pos_config_id"/> <field name="pos_config_id"/>
<field name="state"/>
<filter string="Completed" name="done" domain="[('state', '=', 'done')]"/>
<filter string="In Preparation" name="in_prep" domain="[('state', '=', 'in_prep')]"/>
<filter string="Ready" name="ready" domain="[('state', '=', 'ready')]"/>
<filter string="My KDS Displays" name="my_kds" domain="[('prep_display_id', '!=', False)]"/> <filter string="My KDS Displays" name="my_kds" domain="[('prep_display_id', '!=', False)]"/>
<group> <group>
<filter string="Status" name="group_by_state" domain="[]" context="{'group_by':'state'}"/>
<filter string="Date" name="group_by_date" domain="[]" context="{'group_by':'completion_datetime:day'}"/> <filter string="Date" name="group_by_date" domain="[]" context="{'group_by':'completion_datetime:day'}"/>
<filter string="Product Category" name="group_by_category" domain="[]" context="{'group_by':'pos_category_id'}"/> <filter string="Product Category" name="group_by_category" domain="[]" context="{'group_by':'pos_category_id'}"/>
<filter string="Product" name="group_by_product" domain="[]" context="{'group_by':'product_id'}"/> <filter string="Product" name="group_by_product" domain="[]" context="{'group_by':'product_id'}"/>
@ -71,7 +77,10 @@
<pivot string="KDS Order Analysis" display_quantity="1" sample="1"> <pivot string="KDS Order Analysis" display_quantity="1" sample="1">
<field name="completion_datetime" type="row" interval="day"/> <field name="completion_datetime" type="row" interval="day"/>
<field name="prep_display_id" type="row"/> <field name="prep_display_id" type="row"/>
<field name="state" type="col"/>
<field name="completion_time" type="measure" operator="avg"/> <field name="completion_time" type="measure" operator="avg"/>
<field name="preparation_time" type="measure" operator="avg"/>
<field name="service_time" type="measure" operator="avg"/>
</pivot> </pivot>
</field> </field>
</record> </record>
@ -95,8 +104,14 @@
<field name="pos_order_id"/> <field name="pos_order_id"/>
<field name="prep_display_id"/> <field name="prep_display_id"/>
<field name="pos_config_id"/> <field name="pos_config_id"/>
<field name="state"/>
<filter string="Completed" name="done" domain="[('state', '=', 'done')]"/>
<filter string="In Preparation" name="in_prep" domain="[('state', '=', 'in_prep')]"/>
<filter string="Ready" name="ready" domain="[('state', '=', 'ready')]"/>
<group> <group>
<filter string="Status" name="group_by_state" domain="[]" context="{'group_by':'state'}"/>
<filter string="Date" name="group_by_date" domain="[]" context="{'group_by':'completion_datetime:day'}"/> <filter string="Date" name="group_by_date" domain="[]" context="{'group_by':'completion_datetime:day'}"/>
<filter string="KDS Display" name="group_by_kds" domain="[]" context="{'group_by':'prep_display_id'}"/> <filter string="KDS Display" name="group_by_kds" domain="[]" context="{'group_by':'prep_display_id'}"/>
<filter string="POS Shop" name="group_by_pos" domain="[]" context="{'group_by':'pos_config_id'}"/> <filter string="POS Shop" name="group_by_pos" domain="[]" context="{'group_by':'pos_config_id'}"/>