Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Field service _prepare_calendar_event #1189

Open
MarcosGraficon opened this issue May 9, 2024 · 0 comments
Open

Field service _prepare_calendar_event #1189

MarcosGraficon opened this issue May 9, 2024 · 0 comments
Labels

Comments

@MarcosGraficon
Copy link

MarcosGraficon commented May 9, 2024

Hey guys, im trying to make a diferent use of the event _prepare_calendar_event i want that if the field person_id that is the person assigned to do the work of that fieldservice in the clock menu should appear to him not the calendar team leader, i tried but im not able to do that any clues?

def _prepare_calendar_event(self):
    model_id = self.env.ref("fieldservice.model_fsm_order").id
    vals = {
        "name": self.name,
        "description": self.description,
        "start": self.scheduled_date_start,
        "stop": self.scheduled_date_end,
        "allday": False,
        "res_model_id": model_id,  # link back with "Document" button
        "res_id": self.id,  # link back with "Document" button
        "location": self._serialize_location(),
        "user_id": self.team_id.calendar_user_id.id,
    }
    vals["partner_ids"] = [(4, self.team_id.calendar_user_id.partner_id.id, False)]
    
    I tried this 
    if self.person_id :
        vals = {
            "name": self.name,
            "description": self.description,
            "start": self.scheduled_date_start,
            "stop": self.scheduled_date_end,
            "allday": False,
            "res_model_id": model_id,  # link back with "Document" button
            "res_id": self.id,  # link back with "Document" button
            "location": self._serialize_location(),
            "user_id": self.person_id.partner_id.id, 
        }
        vals["partner_ids"] = [(4, self.person_id.partner_id.id, False)]
        return vals          
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant