Ir al contenido
Odoo Menú
  • Iniciar sesión
  • Pruébalo gratis
  • Aplicaciones
    Finanzas
    • Contabilidad
    • Facturación
    • Gastos
    • Hoja de cálculo (BI)
    • Documentos
    • Firma electrónica
    Ventas
    • CRM
    • Ventas
    • PdV para tiendas
    • PdV para restaurantes
    • Suscripciones
    • Alquiler
    Sitios web
    • Creador de sitios web
    • Comercio electrónico
    • Blog
    • Foro
    • Chat en vivo
    • eLearning
    Cadena de suministro
    • Inventario
    • Manufactura
    • PLM
    • Compras
    • Mantenimiento
    • Calidad
    Recursos humanos
    • Empleados
    • Reclutamiento
    • Vacaciones
    • Evaluaciones
    • Referencias
    • Flotilla
    Marketing
    • Redes sociales
    • Marketing por correo
    • Marketing por SMS
    • Eventos
    • Automatización de marketing
    • Encuestas
    Servicios
    • Proyectos
    • Registro de horas
    • Servicio externo
    • Soporte al cliente
    • Planeación
    • Citas
    Productividad
    • Conversaciones
    • Aprobaciones
    • IoT
    • VoIP
    • Artículos
    • WhatsApp
    Aplicaciones externas Studio de Odoo Plataforma de Odoo en la nube
  • Industrias
    Venta minorista
    • Librería
    • Tienda de ropa
    • Mueblería
    • Tienda de abarrotes
    • Ferretería
    • Juguetería
    Alimentos y hospitalidad
    • Bar y pub
    • Restaurante
    • Comida rápida
    • Casa de huéspedes
    • Distribuidora de bebidas
    • Hotel
    Bienes inmuebles
    • Agencia inmobiliaria
    • Estudio de arquitectura
    • Construcción
    • Gestión de bienes inmuebles
    • Jardinería
    • Asociación de propietarios
    Consultoría
    • Firma contable
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Manufactura
    • Textil
    • Metal
    • Muebles
    • Comida
    • Cervecería
    • Regalos corporativos
    Salud y ejercicio
    • Club deportivo
    • Óptica
    • Gimnasio
    • Especialistas en bienestar
    • Farmacia
    • Peluquería
    Trades
    • Personal de mantenimiento
    • Hardware y soporte de TI
    • Sistemas de energía solar
    • Zapateros y fabricantes de calzado
    • Servicios de limpieza
    • Servicios de calefacción, ventilación y aire acondicionado
    Otros
    • Organización sin fines de lucro
    • Agencia para la protección del medio ambiente
    • Alquiler de anuncios publicitarios
    • Fotografía
    • Alquiler de bicicletas
    • Distribuidor de software
    Descubre todas las industrias
  • Odoo Community
    Aprende
    • Tutoriales
    • Documentación
    • Certificaciones
    • Capacitación
    • Blog
    • Podcast
    Fortalece la educación
    • Programa educativo
    • Scale Up! El juego empresarial
    • Visita Odoo
    Obtén el software
    • Descargar
    • Compara ediciones
    • Versiones
    Colabora
    • GitHub
    • Foro
    • Eventos
    • Traducciones
    • Conviértete en partner
    • Servicios para partners
    • Registra tu firma contable
    Obtén servicios
    • Encuentra un partner
    • Encuentra un contador
    • Contacta a un consultor
    • Servicios de implementación
    • Referencias de clientes
    • Soporte
    • Actualizaciones
    GitHub YouTube Twitter LinkedIn Instagram Facebook Spotify
    +1 (650) 691-3277
    Solicita una demostración
  • Precios
  • Ayuda

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Contabilidad
  • Inventario
  • PoS
  • Proyectos
  • MRP
All apps
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Ayuda

Subcontracting location doesn't unreserve stock when order is cancelled

Suscribirse

Reciba una notificación cuando haya actividad en esta publicación

Se marcó esta pregunta
stockinventoryresupplyv15
2 Respuestas
3148 Vistas
Avatar
Kacper Kucharski

I'm working with v15. When order which requires resupply order is cancelled the stock that was initially reserved from subcontracting location stay reserved (the available quantity doesn't go up) which creates an overstocking of components on the supplier side. Cancelling the PO, MO and SO doesn't change it at all. On hand quantity doesn't change. How can the stock be unreserved when order is cancelled?

0
Avatar
Descartar
Jaideep

To ensure understanding, is the reference to subcontract orders, that have been cancelled after the material has been transferred to supplier or prior to validating transfer?

Kacper Kucharski
Autor

We keep some stock in the subcontracting location, available for the supplier to use when orders come in, so when it's available the resupply order isn't raised and the stock is taken from that location. So when the order is raised that stock is reserved and when cancelled it stays reserved, but the On hand quantity stays the same. Hope this explains.

Avatar
Midhun M M
Mejor respuesta

Actually odoo have some resevation issues still they are not rectified. We are in Odoo 16 EE.

Whenever reservation issues are coming we need to run the server actions given by Odoo as temporoy solution.

There is no reply after that..!

Component Reservation Issue

------------------------------------

# Available variables:
#  - env: Odoo Environment on which the action is triggered
#  - model: Odoo Model of the record on which the action is triggered; is a void recordset
#  - record: record on which the action is triggered; may be void
#  - records: recordset of all records on which the action is triggered in multi-mode; may be void
#  - time, datetime, dateutil, timezone: useful Python libraries
#  - float_compare: Odoo function to compare floats based on specific precisions
#  - log: log(message, level='info'): logging function to record debug information in ir.logging table
#  - UserError: Warning Exception to use with raise
#  - Command: x2Many commands namespace
# To return an action, assign: action = {...}

quants = env["stock.quant"].search([])

move_line_ids = []

warning = ""

for quant in quants:

    move_lines = env["stock.move.line"].search(

        [

            ("product_id", "=", quant.product_id.id),

            ("location_id", "=", quant.location_id.id),

            ("lot_id", "=", quant.lot_id.id),

            ("package_id", "=", quant.package_id.id),

            ("owner_id", "=", quant.owner_id.id),

            ("reserved_qty", "!=", 0),

        ]

    )

    move_line_ids += move_lines.ids

    reserved_on_move_lines = sum(move_lines.mapped("reserved_qty"))

    move_line_str = str.join(

        ", ", [str(move_line_id) for move_line_id in move_lines.ids]

    )



    if quant.location_id.should_bypass_reservation():

        # If a quant is in a location that should bypass the reservation, its `reserved_quantity` field

        # should be 0.

        if quant.reserved_quantity != 0:

            quant.write({"reserved_quantity": 0})

    else:

        # If a quant is in a reservable location, its `reserved_quantity` should be exactly the sum

        # of the `reserved_qty` of all the partially_available / assigned move lines with the same

        # characteristics.

        if quant.reserved_quantity == 0:

            if move_lines:

                move_lines.with_context(bypass_reservation_update=True).write(

                    {"reserved_uom_qty": 0}

                )

        elif quant.reserved_quantity
            quant.write({"reserved_quantity": 0})

            if move_lines:

                move_lines.with_context(bypass_reservation_update=True).write(

                    {"reserved_uom_qty": 0}

                )

        else:

            if reserved_on_move_lines != quant.reserved_quantity:

                move_lines.with_context(bypass_reservation_update=True).write(

                    {"reserved_uom_qty": 0}

                )

                quant.write({"reserved_quantity": 0})

            else:

                if any(move_line.reserved_qty
                    move_lines.with_context(bypass_reservation_update=True).write(

                        {"reserved_uom_qty": 0}

                    )

                    quant.write({"reserved_quantity": 0})



move_lines = env["stock.move.line"].search(

    [

        ("product_id.type", "=", "product"),

        ("reserved_qty", "!=", 0),

        ("id", "not in", move_line_ids),

    ]

)



move_lines_to_unreserve = []



for move_line in move_lines:

    if not move_line.location_id.should_bypass_reservation():

        move_lines_to_unreserve.append(move_line.id)



if len(move_lines_to_unreserve) > 1:

    env.cr.execute(

        """

            UPDATE stock_move_line SET reserved_uom_qty = 0, reserved_qty = 0 WHERE id in %s ;

        """

        % (tuple(move_lines_to_unreserve),)

    )

elif len(move_lines_to_unreserve) == 1:

    env.cr.execute(

        """

        UPDATE stock_move_line SET reserved_uom_qty = 0, reserved_qty = 0 WHERE id = %s ;

        """

        % (move_lines_to_unreserve[0])

    )



Unreserve Quont

---------------------

# Available variables:
#  - env: Odoo Environment on which the action is triggered
#  - model: Odoo Model of the record on which the action is triggered; is a void recordset
#  - record: record on which the action is triggered; may be void
#  - records: recordset of all records on which the action is triggered in multi-mode; may be void
#  - time, datetime, dateutil, timezone: useful Python libraries
#  - float_compare: Odoo function to compare floats based on specific precisions
#  - log: log(message, level='info'): logging function to record debug information in ir.logging table
#  - UserError: Warning Exception to use with raise
#  - Command: x2Many commands namespace
# To return an action, assign: action = {...}

for record in records:
  if record.reserved_quantity > 0:
    record.write({'reserved_quantity':0})


FG Lot Generation Issue

--------------------------

# Available variables:
#  - env: Odoo Environment on which the action is triggered
#  - model: Odoo Model of the record on which the action is triggered; is a void recordset
#  - record: record on which the action is triggered; may be void
#  - records: recordset of all records on which the action is triggered in multi-mode; may be void
#  - time, datetime, dateutil, timezone: useful Python libraries
#  - float_compare: Odoo function to compare floats based on specific precisions
#  - log: log(message, level='info'): logging function to record debug information in ir.logging table
#  - UserError: Warning Exception to use with raise
#  - Command: x2Many commands namespace
# To return an action, assign: action = {...}

env.cr.execute("""UPDATE stock_move_line sml SET reserved_uom_qty = 0, reserved_qty = 0 WHERE sml.move_id in (select a.move_id from (select production_id,sm.id as move_id from stock_move sm JOIN mrp_production mp on mp.id = sm.production_id where mp.state in ('to_close','progress','confirmed'))a) ;""")



0
Avatar
Descartar
Kacper Kucharski
Autor

That's very interesting so it could not be related to our setup after all. I'll try this and see if it helps. Thanks a lot.

Avatar
Jaideep
Mejor respuesta

Did create  use case and tested, it seems to work as intended. 

Created 2 PO's for subcontract product and then validated the component transfers to subcontract location. Post that went out to cancel one of the orders (the PO and also ensured the associated Inventory receipt were cancelled). 




The products (components) in sub-contract location were no longer reserved. The on-hand qty wouldn't change as the component didn't get consumed, however the available qty were updated.


From your post it seems the expectation is for on hand Qty to increase. Could you confirm if you mean the on-hand qty in WH/Stock or Sub-contract location to increase? On cancelling an order there are no transfers generated only reservation is impacted.


Could you also confirm if you are using odoo default routes and locations or they have been modified? With default routes, the resupply route is always triggered irrespective of available component stocks in subcontract location.

0
Avatar
Descartar
Kacper Kucharski
Autor

Thank you for your answer. I'm referring to the Available qty, the On Hand qty stay the same as it should. The routes were modified quite a lot by a person who worked here before and I'm trying to bring them back to the default settings as it's causing other problems as well. It's very helpful to know that this works fine with default routes. From what I can see comparing our current setup to runbot, Resupply Subcontractor on Order supply method was changed to 'Take from Stock, if unavailable trigger another rule' and Resupply Subcontractor Source location was changed from WH/Stock to WH/Output. Possibly one of them changes is the source of the issue.

Jaideep

If the available qty does not update in subcontract location then I would look at the receipt operation (for the finished product from sub contractor), this is the operation that is reserving the components.

If the available qty does not update in WH/ Stock location (in the event order was cancelled prior to components being transferred to subcontractor) then I would look at re-supply subcontractor operation. Additionally since your modified route is output and in the event of unavailability at output location it is likely another operation is triggered Stock to Output.

Change of supply method and source location on the resupply route still doesn't explain how an operation is not triggered if components are available at subcontract location.
- The rule
>>> When products are needed in Physical Locations/Subcontracting Location, Resupply Subcontractor are created from WH/Stock to fulfill the need.
If the products are not available in WH/Stock, a rule will be triggered to bring products in this location.<<<

Each time a subcontract order is created this route would be triggered, to reserve product in WH/stock. If you wish Odoo to reserve the component already at subcontract location, then the source location needs to be Physical Locations/Subcontracting Location and if unavailable trigger another rule.

¿Le interesa esta conversación? ¡Participe en ella!

Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.

Registrarse
Publicaciones relacionadas Respuestas Vistas Actividad
Reabastecimiento de almacenes que no compran
inventory resupply v15
Avatar
0
jun 23
2749
Allocate a quantity of stock for my sellers Resuelto
stock inventory v15
Avatar
Avatar
2
dic 21
3547
Issue with quantity available - Odoo 15
stock inventory stock_picking v15
Avatar
Avatar
Avatar
2
jun 23
3515
Inventory adjustment Resuelto
stock inventory adjustment v15
Avatar
Avatar
2
ago 24
3548
How to solve this error Field `show_check_availability` does not exist ?
stock inventory
Avatar
0
jul 24
2801
Comunidad
  • Tutoriales
  • Documentación
  • Foro
Código abierto
  • Descargar
  • GitHub
  • Runbot
  • Traducciones
Servicios
  • Alojamiento en Odoo.sh
  • Soporte
  • Actualizaciones del software
  • Desarrollos personalizados
  • Educación
  • Encuentra un contador
  • Encuentra un partner
  • Conviértete en partner
Sobre nosotros
  • Nuestra empresa
  • Activos de marca
  • Contáctanos
  • Empleos
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • Legal • Privacidad
  • Seguridad
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo es un conjunto de aplicaciones de código abierto que cubren todas las necesidades de tu empresa: CRM, comercio electrónico, contabilidad, inventario, punto de venta, gestión de proyectos, etc.

La propuesta única de valor de Odoo es ser muy fácil de usar y estar totalmente integrado.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now