SmartERP Documentation An Ashewa Technology Solutions Platform

Automation reference

Scheduled actions, server actions, email templates, reports, public routes and the methods the schedule calls, with their XML ids, for developers and administrators.

This page is a reference for developers and administrators. For the meaning of each option, see Configuration.

Scheduled actions#

All are ir.cron records in noupdate data, active when installed, with numbercall -1, and run as code on the model.

XML idNameModel and codeInterval
smarterp_planning.ir_cron_generate_recurring_shiftsPlanning: generate recurring shiftssmarterp.planning.recurrency _cron_schedule_next()1 day
smarterp_planning.ir_cron_shift_remindersPlanning: send shift reminderssmarterp.planning.shift _cron_send_reminders()15 minutes
smarterp_planning.ir_cron_rebuild_capacityPlanning: rebuild utilisation figuressmarterp.planning.capacity _cron_rebuild()1 day
smarterp_planning_attendance.ir_cron_planning_attendancePlanning: compare shifts with attendancessmarterp.planning.shift _cron_planning_attendance()15 minutes
smarterp_planning_timesheet.ir_cron_draft_timesheetsPlanning: propose draft timesheets from finished shiftssmarterp.planning.shift _cron_create_draft_timesheets()1 hour

What each one selects:

  • Recurring shifts. Series with type forever, or until with a date in the future, whose last_generated_end_datetime is empty or before the horizon (now plus Recurring Shift Horizon months). Series of type x_times are never selected.
  • Reminders. For each company with reminders on: shifts that are published, of type planning, with a resource, starting after now and within Remind Before (hours), and whose reminder_sent_start differs from start_datetime. After sending, reminder_sent_start is set to the start.
  • Utilisation. All resources, from 62 days back to 184 days ahead; rows older than the window are removed.
  • Attendance. Published shifts of type planning with a resource that started and ended less than two days ago: refresh the attendance fields, then send missed-start alerts.
  • Draft timesheets. Up to 500 shifts that ended in the last 31 days, of type planning, with a resource, on a project that allows timesheets, not yet marked timesheet_draft_generated.

Autovacuum jobs: smarterp.planning.recurrency._gc_empty_recurrences (removes series with no shifts) and smarterp.planning.broadcast._gc_old_broadcasts (older than 30 days).

Utilisation is also refreshed at commit through a pre-commit hook: create, write and unlink of shifts, and of calendar leaves, call smarterp.planning.capacity._mark_dirty, which queues the affected resource and dates; _flush_dirty merges them and refreshes once per transaction, with one day of margin.

Server actions#

XML idNameNotes
smarterp_planning.action_server_shift_publishPublishBound to the shift list and kanban views; group Planning / Administrator; runs records.action_publish().
smarterp_planning_timesheet.action_server_unconfirmed_timesheetsTimesheets to ConfirmOpens the draft timesheets older than the company's number of days, grouped by employee.

Email templates#

XML idNameModelSubjectSent by
smarterp_planning.email_template_shift_assignedPlanning: shift publishedshiftYour shift on date has been published_send_shift_notification, from _planning_publish
smarterp_planning.email_template_planning_schedulePlanning: schedule sentsent scheduleYour planning for periodsmarterp.planning.planning._send_to_employees, from Publish and Send
smarterp_planning.email_template_shift_reminderPlanning: shift remindershiftReminder: your shift day, time_planning_send_reminder
smarterp_planning.email_template_open_shift_broadcastPlanning: open shift availableshiftOpen shift available: day, time_planning_broadcast_open_shift

The schedule and broadcast templates read the context key planning_employee_id to build the employee's link. All four use the layout mail.mail_notification_light, delete the mail after sending (auto_delete), and are noupdate.

Report#

smarterp_planning.action_report_planning_rota (QWeb PDF, model smarterp.planning.print, template report_planning_rota, paper format paperformat_planning_rota: A4 landscape, 90 dpi). The file name is Rota followed by the start date.

Public routes#

All routes use auth="public", are excluded from the sitemap, and answer 404 when a lookup fails.

RouteMethodCSRFWhat it does
/planning/<planning_token>/<employee_token>GETThe employee's week. Optional week=YYYY-MM-DD (any date; the page shows its Monday), message, error.
/planning/<planning_token>/<employee_token>/assign/<int:shift_id>POSTYesTake an open shift (_planning_take).
.../unassign/<int:shift_id>POSTYesHand a shift back (_planning_release).
.../switch/<int:shift_id>POSTYesAsk to switch (sets request_to_switch).
.../cancel_switch/<int:shift_id>POSTYesCancel a switch request.
.../take/<int:shift_id>POSTYesTake over a colleague's shift (_planning_take(taking_switch=True)).
/planning/shift/<shift_token>/<employee_token>GETThe open shift page.
/planning/shift/<shift_token>/<employee_token>/takePOSTYesTake that shift.

Known issue in 17.0.3

The routes have no website=True. When the Website module is installed, rendering portal.frontend_layout raises KeyError: 'website' and the pages answer HTTP 500. See Troubleshooting.

After each action the browser is redirected to the week page with message or error in the query string. Pages set the language from the employee's user, or the contact, when installed. Templates: portal_planning_schedule, portal_planning_expired, portal_planning_broadcast_shift, with styles in portal_planning_styles.

Methods called by the front end#

These public methods are called with orm.call from the schedule and dashboard (see Data model):

planning_user_can_plan, get_planning_header_actions, get_planning_schedule_data, get_planning_card, get_planning_quick_create_defaults, get_planning_to_plan_items, planning_drop_item, planning_check_drop, planning_eligibility_map, planning_snapshot, planning_restore, action_planning_copy_to, action_planning_bulk_move, action_planning_bulk_assign, action_planning_bulk_unassign, action_planning_bulk_publish, action_publish, and get_planning_dashboard. Card buttons call the method named in the card's actions list.

Menu (XML id suffix)ActionGroups
menu_planning_root PlanningInternal User
menu_planning_dashboardaction_planning_dashboard (client action smarterp_planning.dashboard)Administrator
menu_planning_schedule Schedule..._by_resource, ..._by_role, ..._by_department, ..._by_department_role (smarterp_planning_project: ..._by_project; smarterp_planning_sale: ..._by_sale_order)Planning / User
menu_planning_my My Planningaction_planning_shift_myeveryone
menu_planning_open Open Shiftsaction_planning_shift_openPlanning / User
menu_planning_reporting ReportingAdministrator, Employees officer
menu_planning_analysis; menu_planning_capacity; menu_planning_labour_costaction_planning_shift_analysis; action_planning_capacity; action_planning_labour_costAdministrator; (parent); Administrator
menu_planning_attendance_reportsmarterp_planning_attendance.action_planning_attendance_reportAdministrator, attendance Officer
menu_planning_unconfirmed_timesheetsserver action aboveAdministrator, timesheet approver
menu_planning_configurationAdministrator
menu_planning_settings; menu_planning_roles; menu_planning_templates; menu_planning_employees; menu_planning_materialsaction_planning_config_settings; action_planning_role; action_planning_template; hr.open_view_employee_list_my; action_planning_materialsSettings admin; Administrator; Administrator; Employees officer; Administrator
smarterp_planning_project.menu_project_planning (under Project)action_planning_my_projectsproject.group_project_user

The wizards are window actions with target new: action_planning_send, action_planning_copy_previous_week, action_planning_auto_plan, action_planning_template_apply, action_planning_print, action_planning_split, action_planning_duplicate, and smarterp_planning_sale.action_planning_plan_orders.

First-use tour#

smarterp_planning_tour (web_tour.tours, sequence 90) walks a planner through creating a role and opening the schedule.

Next#

Last updated: 2026-10-16