콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다

I want to make scheduled date empty in transfer. 
what all ways are there in in odoo v16 to make scheduled date false. 

아바타
취소

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?

베스트 답변

In Odoo V16, to make the scheduled date empty in a transfer, you can use the following methods:

  1. 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.

  2. 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
    
  3. 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.

  4. 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 

아바타
취소
관련 게시물 답글 화면 활동
1
6월 23
1425
2
11월 22
2352
3
12월 23
1116
0
9월 24
904
1
5월 24
1488