from odoo import models, fields, api

class Sales_action_plan_report_Wizard(models.TransientModel):
    _name = 'sales_action_plan_report_wizard'
    _description = 'Action Plan Report Wizard'

    sales_person_id = fields.Many2one(
        'res.users', 
        string='Sales Executive', 
        default=lambda self: self.env.user,
        domain=lambda self: [('groups_id', 'in', self.env.ref('sos_inventory.sos_sales_user').ids + self.env.ref('sos_inventory.sos_ce_head').ids)]
    )
    from_date = fields.Date(
        string="From Date",
        default=fields.Date.today  # Default to today's date
    )
    to_date = fields.Date(
        string="To Date",
        default=fields.Date.today  # Default to today's date
    )
    def generate_report(self):
        """Trigger the report generation filtered by selected sales person."""
        return self.env['sos_case_diary'].action_report_action_plan_btn(self.sales_person_id.id,self.from_date,self.to_date)
