I want to make scheduled date empty in transfer.
what all ways are there in in odoo v16 to make scheduled date false.
1 Answer
In Odoo V16, to make the scheduled date empty in a transfer, you can use the following methods:
Manually update the scheduled date: Go to Inventory > Operations > Transfers, open the specific transfer record you want to edit, and set the “Scheduled Date” field to empty or false.
Customize using automated actions: You can create an automated action in Odoo that triggers when a certain condition is met or a specific action occurs. To create an automated action, go to Settings > Technical > Automated Actions, and configure your new action with appropriate triggering conditions and Python code that sets the scheduled_date field to False.
record.scheduled_date = False
Developing a custom module: Create a custom module that inherits from stock.picking model and overrides the relevant method (e.g., action_confirm, button_validate) responsible for creating or confirming transfers. In this override method, add logic to set the scheduled_date field to False.
from odoo import models class StockPicking(models.Model): _inherit = "stock.picking" def action_confirm(self): res = super(StockPicking, self).action_confirm() for picking in self: if picking.condition_to_unset_scheduled_date: picking.scheduled_date = False return res
Don’t forget to replace condition_to_unset_scheduled_date with your desired condition.
Update via API (e.g., XML-RPC):
import xmlrpc.client url = 'https://your_odoo_instance.com' db = 'your_db_name' username = 'your_username' password = 'your_password' common_proxy = xmlrpc.client.ServerProxy(f'{url}/xmlrpc/2/common') object_proxy = xmlrpc.client.ServerProxy(f'{url}/xmlrpc/2/object') uid = common_proxy.authenticate(db, username, password, {}) picking_id = 1 # Replace with the ID of the transfer you want to update object_proxy.execute_kw( db, uid, password, 'stock.picking', 'write', [[picking_id], {"scheduled_date": False}] )
Remember to test any customization on a staging or development environment before applying it to your production environment.
By using one of these methods, you can effectively set the scheduled date in a transfer record to empty (False) in Odoo V16
But why? When you set that field empty, all Material Requirement Planning will fail. All checks for availability and reservation of stock will no longer work. I just wonder, what is you business process, that you want to disable all material planning?