Ir al contenido
Odoo Menú
  • Identificarse
  • Pruébalo gratis
  • Aplicaciones
    Finanzas
    • Contabilidad
    • Facturación
    • Gastos
    • Hoja de cálculo (BI)
    • Documentos
    • Firma electrónica
    Ventas
    • CRM
    • Ventas
    • TPV para tiendas
    • TPV para restaurantes
    • Suscripciones
    • Alquiler
    Sitios web
    • Creador de sitios web
    • Comercio electrónico
    • Blog
    • Foro
    • Chat en directo
    • eLearning
    Cadena de suministro
    • Inventario
    • Fabricación
    • PLM
    • Compra
    • Mantenimiento
    • Calidad
    Recursos Humanos
    • Empleados
    • Reclutamiento
    • Ausencias
    • Evaluación
    • Referencias
    • Flota
    Marketing
    • Marketing social
    • Marketing por correo electrónico
    • Marketing por SMS
    • Eventos
    • Automatización de marketing
    • Encuestas
    Servicios
    • Proyecto
    • Partes de horas
    • Servicio de campo
    • Servicio de asistencia
    • Planificación
    • Citas
    Productividad
    • Conversaciones
    • Aprobaciones
    • IoT
    • VoIP
    • Información
    • WhatsApp
    Aplicaciones de terceros Studio de Odoo Plataforma de Odoo Cloud
  • Industrias
    Comercio al por menor
    • Librería
    • Tienda de ropa
    • Tienda de muebles
    • Tienda de ultramarinos
    • Ferretería
    • Juguetería
    Alimentación y hostelería
    • Bar y taberna
    • Restaurante
    • Comida rápida
    • Casa de huéspedes
    • Distribuidor de bebidas
    • Hotel
    Inmueble
    • Agencia inmobiliaria
    • Estudio de arquitectura
    • Construcción
    • Gestión inmobiliaria
    • Jardinería
    • Asociación de propietarios
    Consultoría
    • Empresa contable
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Fabricación
    • Textil
    • Metal
    • Muebles
    • Alimentos
    • Brewery
    • Regalos de empresas
    Salud y bienestar
    • Club deportivo
    • Óptica
    • Gimnasio
    • Terapeutas
    • Farmacia
    • Peluquería
    Oficios
    • Handyman
    • Hardware y asistencia informática
    • Sistemas de energía solar
    • Zapatero
    • Servicios de limpieza
    • Servicios de calefacción, ventilación y aire acondicionado
    Otros
    • Organización sin ánimo de lucro
    • Agencia de protección del medio ambiente
    • Alquiler de paneles publicitarios
    • Estudio fotográfico
    • Alquiler de bicicletas
    • Distribuidor de software
    Browse all Industries
  • Comunidad
    Aprender
    • Tutoriales
    • Documentación
    • Certificaciones
    • Formación
    • Blog
    • Podcast
    Potenciar la educación
    • Programa de formación
    • Scale Up! El juego empresarial
    • Visita Odoo
    Obtener el software
    • Descargar
    • Comparar ediciones
    • Versiones
    Colaborar
    • GitHub
    • Foro
    • Eventos
    • Traducciones
    • Convertirse en partner
    • Services for Partners
    • Registrar tu empresa contable
    Obtener servicios
    • Encontrar un partner
    • Encontrar un asesor fiscal
    • Contacta con un experto
    • Servicios de implementación
    • Referencias de clientes
    • Ayuda
    • Actualizaciones
    GitHub YouTube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Solicitar 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
  • Proyecto
  • 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

Can I modify MPS to create draft state Manufacturing orders

Suscribirse

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

Se marcó esta pregunta
manufacturingmpsv14
4 Respuestas
11233 Vistas
Avatar
Bruno Rocha

Hello,

Someone out there that know if it is possible to change the state of the MO generated by Odoo in the MPS?

By default they are generated confirmed, can they be generated in draft?


Thnxs

1
Avatar
Descartar
Leonardo de Abreu Ladeira

How did you solve this?

Avatar
Ray Carnes (ray)
Mejor respuesta

You can do this via the Automation Framework using a custom field, an automated action, a custom view and a server action.


Consider this a proof of concept that you may need to modify based on your needs.  It has been quickly tested based on manually created, MTO created and scheduler/order point created MO's but may still need further improvements to support all workflows. Contact your Odoo Consultant or an Odoo Partner if you need more help.


1. From the Fields Menu, create a custom boolean field Released which will prevent confirmation of a manufacturing order if false (the default value) and allow it if true:



2. From the Views Menu, create a custom View to add this field to the Form View of Manufacturing Orders:



<field name="product_id" position="before">
<field name="x_released"/>
</field>


Note: you can also use Odoo Studio to both create and add the field to the UI at the same time, see the References section at the end for more information.


3. From the Automated Actions Menu, create a custom action that prevents Manufacturing Orders from being confirmed if the value of x_released is false:



for record in records:
if not record.x_released:
record['state'] = 'draft'


4. From the Server Actions Menu, create a custom action that allows Users to release Manufacturing Orders:


Note: when you create this action, look in the URL to find the ID of it as you will need it in the next step.  



5. Finally, edit the custom View made in the second step to add a button that runs the Server Action and hide the Confirm button until the MO is released:



<button name="action_confirm" position="before">
<button name="458" attrs="{'invisible': ['|',('x_released', '=', True),('state','=','cancel')]}" string="Release" type="action" class="oe_highlight"/>
</button>

<button name="action_confirm" position="attributes">
<attribute name="attrs">{'invisible': ['|',('state', '!=', 'draft'),('x_released', '!=', True)]}</attribute>
</button>


Note: the ID of the Server Action was 458 - yours will be different, so change this number to the number you found during the fourth step.




What you end up with is Manufacturing Orders that are initially created in Draft mode:



When you open each MO, you will see that the CONFIRM button is hidden until you click the new RELEASE button:



Click both buttons to confirm the Manufacturing Order.



References:

https://www.odoo.com/documentation/14.0/applications/productivity/studio/concepts/understanding_automated_actions.html

https://www.odoo.com/documentation/14.0/applications/productivity/studio/use_cases/models_fields.html


 

6
Avatar
Descartar
Leonardo de Abreu Ladeira

Ray Carnes,
Thank you this is a beautiful solution. I have one question however, if let's say a component on the bom has the routes of purchase and replenish on order, the request for quotation is still created.

Is there the possibility to block that as well, until the manufacturing order is confirmed?

Best regards,

Ray Carnes (ray)

Yes, please contact your Odoo Consultant or Odoo Partner for help with this.

Gary Baughman

I was able to make this work with a slight modification for v14. The lines from step 5, I added to the <header> section of the form. It does not create a "Release" button but does keep the Manufacturing Order in Draft mode and once the order is to your liking, you press "Confirm" to lock it.

Maurice Moretti

Hello Ray,

this sounds good for a technical guy, but for a functional one as myself it is quite weird
Why is the MO not created in Draft state by the MPS (as the PO for example)
At least it should be configurable so that the use can decide whicg behaviour best fits

Regards
Maurice

Dries Kooistra

I tested this for Odoo 14 and it works like a charm. This procedure can be followed with the same steps in Odoo 13 and the steps do not look any different to Odoo 14. However, in Odoo 13 it is not leading to a 'draft' state of the MO.

Any idea's on why the automated action does act differently in Odoo 13?

Ray Carnes (ray)

I just tested in v13 and it works the same way - please start over and check your work - you likely have missed a step or made a small mistake somewhere.

Dries Kooistra

Tried it again on v13 and seems to work indeed. Thanks for the solution in general and for checking it in v13 too!

Tim Drinkwater

I was hoping to use this modification to allow selecting the BOM. I was able to perform this modification successfully and the MO generated via automation remains in a draft state. However when I change to a different BOM and attempt to save I get an errror:
"You can only delete draft moves."
Can this method be modified/enhanced to allow selecting a different BOM prior to confirmation?

Juan P.C.

Hey,

Though the initial idea is good, I found problems when using this approach:

- You will have problems if your MO needs to launch new MOs. Let's say that you have Prod1 = Part1+Part2, all of them manufacturable. If you launch MO/1 for Prod1 when confirmed, it will launch MO/2 and MO/3 for Part1 and Part2, initially blocked. If you don't release MO/2 and 3, and in the meanwhile, you launch a new MO for Prod1, (MO/4), it won't generate new MO for Parts 1 and 2, nor add units on the existing (blocked) ones. However, it will generate new MO if MO/2 and 3 are released.

-Additionally, it does something to the existing MO/2 and MO/3, as it modifies its last updated time. However, it does not change their due quantity.

I did not test what happens with Purchase Orders, but I can anticipate a similar behaviour.

Using Odoo 14 Online.

Nicu Constantin

Hey Ray! Thanks for sharing it with us!
I did step by step, and indead the MO are created in draft state
But if i try do edit quantity or change the bom is giving the error: "You can only delete draft moves."
The version of odoo is V16
Any help will help us (seems that others faced the same)

Ray Carnes (ray)

Many Users have found that create an empty Bill of Materials is far easier. If this is the first in the sequence of BoM's for a product (drag it to the top of the list) then the MO will always be created in draft. You can read a forum post about this approach at https://www.odoo.com/forum/help-1/how-to-generate-a-manufacturing-order-in-draft-status-from-a-sales-order-using-mto-215627

Avatar
Gastemirova Milana (mgi)
Mejor respuesta

Hello there,

An easy work around would be to add an empty BoM as the first bom to your product that is set up with MTO. That way, the MO triggered will be in Draft. Then you can select the correct bom and confirm the MO as you please. 

1
Avatar
Descartar
Avatar
Hayden McCarthy
Mejor respuesta

Posting here to bump Tim Drinkwater's comment. Has anyone been able to figure out this part?

My understanding is that the MTO rule creates stock moves in confirmed state. I am trying to create an automated action to force them into draft state, similar to Ray's solution for the production order. Here's what I have come up with for python code in an automated action targeting the stock.move model. It needs work (I think my syntax is bad) but it could help as a good starting point:

for record in self:
if self.env['mrp.production'].search('name', '=like', 'record.reference') == 'draft':
record['state'] = 'draft'

0
Avatar
Descartar
Nicu Constantin

Hey Hayden!
Did u succes to find a solution?
Ray's solution, is indead creating my MO in draft mode, but i cannot update/edit the bom , as is giving me the error "You can only delete draft moves." , why is this error, as anyway the MO is in draft mode?! Why i should not be able to delete it?

Hayden McCarthy

@Nicu Constantin The only way I have been able to do this is by first setting the associated 'Stock Moves' to draft state before changing the BOM. To do this is a bit convoluted but I will explain how:
1. Enable developer mode
2. Create a server action on the Stock.Move object called something like "Move: Force Draft". Set it to execute the following python code: 'for record in records:
record['state'] = 'draft''
3. Create a contextual action for the server action.

Now everything is set up, each time you want to change a BOM, you have to do the following (Note, you must be in developer mode to do this):
1. Go to 'Inventory > Reporting > Stock Moves'. Look for the moves with 'reference' value that matches the MO you want to change.
2. Open the stock moves and hit the action button - run the "Move: Force Draft" action. Do this for each move associated with the MO.
3. Once all moves are draft, you should be able to change the BOM on the MO.

You can try to create an automation to force stock.move to be created in draft, similar to what Ray did in point #3 of his answer, but for whatever reason I did not have any luck with this. Hope this helps!

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

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

Inscribirse
Publicaciones relacionadas Respuestas Vistas Actividad
Adjust quantity of Manufacturing Order
manufacturing v14
Avatar
Avatar
2
ago 22
5729
Using same Product in the BoM of the the product Resuelto
manufacturing v14
Avatar
Avatar
1
mar 22
3215
Modifying Report View For Upgrades
manufacturing v14
Avatar
Avatar
1
feb 22
3047
Mass Update Manufacturing Order State Values
manufacturing v14
Avatar
Avatar
1
feb 22
3575
Forecast not showing for components of sub BOM
manufacturing v14
Avatar
0
jun 21
2924
Comunidad
  • Tutoriales
  • Documentación
  • Foro
Código abierto
  • Descargar
  • GitHub
  • Runbot
  • Traducciones
Servicios
  • Alojamiento Odoo.sh
  • Ayuda
  • Actualizar
  • Desarrollos personalizados
  • Educación
  • Encontrar un asesor fiscal
  • Encontrar un partner
  • Convertirse en partner
Sobre nosotros
  • Nuestra empresa
  • Activos de marca
  • Contacta con nosotros
  • Puestos de trabajo
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • Información 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 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