TIP: You can type at any time to perform a new search.
Calendars on Orderpoints
stock_calendar · odoo/odoo
- Repository
- odoo/odoo · module folder
- Module version
- 1.0
- Category
- Warehouse
- Folder size
- 0.25 MB
- License
- LGPL-3
- Application
- No
- Auto-installable
- No
- Website
- https://www.odoo.com/page/warehouse
- Last tracking update
- 2026-08-07 04:59:45
- Authors
- Maintainers
- None
- Committers
- Olivier Dony, Raphael Collet, Christophe Simonis, Thibault Delavallée, Martin Trigaux, Odoo Translation Bot, Denis Ledoux, Nicolas Martinelli, Julien Legros, qdp-odoo, Yannick Tivisse
- Odoo dependencies
- Python dependencies
- None
- System dependencies
- None
- Required by
- None
- Description
The stock_calendar module handles minimum stock rules (=orderpoints / reordering rules) differently by the possibility to take into account the purchase and delivery calendars. Normally, the scheduler will go through all orderpoints and will create a procurement with a quantity taking into account the current stock and all future stock moves. For companies working with fresh products, this is a problem, because if you order the products needed over 2 weeks now and they arrive tomorrow, then these products won't be fresh anymore in two weeks. To solve this, we added a delivery calendar to the orderpoint. The future stock moves (they represent the needs) taken into account will be limited to those until the second delivery according to the calendar. So if I am delivered every week on Tuesday and on Friday, when I order on Monday, I will be delivered on Tuesday with all what is needed until Friday. This however is not good enough as you want to create a purchase order only before the date of the delivery as the future needs might change. (otherwise you could have ordered too much already) For this, we added a purchase calendar and the orderpoint will only be triggered when the scheduler is run within the time specified by the purchase calendar. (a last execution date will also check if it has not already been triggered within this time) However, sometimes we have double orders: suppose we need to order twice on Friday: a purchase order for Monday and a purchase order for Tuesday. Then we need to have two orders at the same time. To handle this, we put a procurement group on the calendar line and for the purchase calendar line we need to do, we will check the corresponding delivery line. On the procurement group, we can tell to propagate itself to the purchase and this way it is possible to have an order for Monday and one for Tuesday. With normal orderpoints, the dates put on the purchase order are based on the delays in the system for the product/company. This does not correspond to what is done with the calendars, so the purchase/delivery dates will be set according to the calendars also. The calendars we use are on weekly basis. It is possible however to have a start date and end date for e.g. the Tuesday delivery. It is also possible to put exceptions for days when there is none.
Code Analysis ⓘ
Views touched (3)
| XML ID | Name | Model | Type | Status |
|---|---|---|---|---|
view_procurement_form_stock_inherit |
procurement.order.form.stock.inherit | procurement.order | form | Inherits procurement.procurement_form_view |
view_resource_calendar_attendance_tree_procurement_group |
resource.calendar.attendance.tree.procurement | resource.calendar.attendance | tree | Inherits resource.view_resource_calendar_attendance_tree |
view_warehouse_orderpoint_form_inherit |
stock.warehouse.orderpoint.form.inherit | stock.warehouse.orderpoint | form | Inherits stock.view_warehouse_orderpoint_form |
HTTP endpoints (0)
No HTTP endpoints found for this module.
Models touched (5)
New fields (2)
-
next_delivery_dateDatetimehelp='The date of the next delivery for this procurement group, when this group is on the purchase calendar of the orderpoint' args: 'Next Delivery Date' -
next_purchase_dateDatetimehelp='The date the next purchase order should be sent to the vendor' args: 'Next Purchase Date'
-
assign_group_date(self)@api.multi
New fields (0)
No new fields.
Public methods (2)-
get_leave_intervals(self, resource_id=None, start_datetime=None, end_datetime=None)@api.multiGet the leaves of the calendar. Leaves can be filtered on the resource, the start datetime or the end datetime. :param int resource_id: the id of the resource to take into account when computing the leaves. If not set, only general leaves are computed. If set, generic and specific leaves are computed. :param datetime start_datetime: if provided, do not take into account leaves ending before this date. :param datetime end_datetime: if provided, do not take into account leaves beginning after this date. :return list leaves: list of tuples (start_datetime, end_datetime) of leave intervals -
interval_remove_leaves(self, interval, leave_intervals)@api.modelUtility method that remove leave intervals from a base interval: - clean the leave intervals, to have an ordered list of not-overlapping intervals - initiate the current interval to be the base interval - for each leave interval: - finishing before the current interval: skip, go to next - beginning after the current interval: skip and get out of the loop because we are outside range (leaves are ordered) - beginning within the current interval: close the current interval and begin a new current interval that begins at the end of the leave interval - ending within the current interval: update the current interval begin to match the leave interval ending - take into account the procurement group when needed :param tuple interval: a tuple (beginning datetime, ending datetime) that is the base interval from which the leave intervals will be removed :param list leave_intervals: a list of tuples (beginning datetime, ending datetime) that are intervals to remove from the base interval :return list intervals: a list of tuples (begin datetime, end datetime) that are the remaining valid intervals
New fields (1)
-
group_idMany2one → procurement.groupargs: 'procurement.group', 'Procurement Group'
No public methods.
New fields (1)
-
group_idMany2one → procurement.groupstring='Procurement Group' args: 'procurement.group'
No public methods.
New fields (3)
-
calendar_idMany2one → resource.calendarhelp='In the calendar you can define the days that the goods will be delivered. That way the scheduler will only take into account the goods needed until the second delivery and put the procurement date as the first delivery.' args: 'resource.calendar', 'Calendar' -
last_execution_dateDatetimereadonly=True args: 'Last Execution Date' -
purchase_calendar_idMany2one → resource.calendarargs: 'resource.calendar', 'Purchase Calendar'
No public methods.
Loading…