Skip to Content
Odoo Menú
  • Registra entrada
  • Prova-ho gratis
  • Aplicacions
    Finances
    • Comptabilitat
    • Facturació
    • Despeses
    • Full de càlcul (IA)
    • Documents
    • Signatura
    Vendes
    • CRM
    • Vendes
    • Punt de venda per a botigues
    • Punt de venda per a restaurants
    • Subscripcions
    • Lloguer
    Imatges de llocs web
    • Creació de llocs web
    • Comerç electrònic
    • Blog
    • Fòrum
    • Xat en directe
    • Aprenentatge en línia
    Cadena de subministrament
    • Inventari
    • Fabricació
    • PLM
    • Compres
    • Manteniment
    • Qualitat
    Recursos humans
    • Empleats
    • Reclutament
    • Absències
    • Avaluacions
    • Recomanacions
    • Flota
    Màrqueting
    • Màrqueting Social
    • Màrqueting per correu electrònic
    • Màrqueting per SMS
    • Esdeveniments
    • Automatització del màrqueting
    • Enquestes
    Serveis
    • Projectes
    • Fulls d'hores
    • Servei de camp
    • Suport
    • Planificació
    • Cites
    Productivitat
    • Converses
    • Validacions
    • IoT
    • VoIP
    • Coneixements
    • WhatsApp
    Aplicacions de tercers Odoo Studio Plataforma d'Odoo al núvol
  • Sectors
    Comerç al detall
    • Llibreria
    • Botiga de roba
    • Botiga de mobles
    • Botiga d'ultramarins
    • Ferreteria
    • Botiga de joguines
    Food & Hospitality
    • Bar i pub
    • Restaurant
    • Menjar ràpid
    • Guest House
    • Distribuïdor de begudes
    • Hotel
    Immobiliari
    • Agència immobiliària
    • Estudi d'arquitectura
    • Construcció
    • Gestió immobiliària
    • Jardineria
    • Associació de propietaris de béns immobles
    Consultoria
    • Empresa comptable
    • Partner d'Odoo
    • Agència de màrqueting
    • Bufet d'advocats
    • Captació de talent
    • Auditoria i certificació
    Fabricació
    • Textile
    • Metal
    • Mobles
    • Menjar
    • Brewery
    • Regals corporatius
    Salut i fitness
    • Club d'esport
    • Òptica
    • Centre de fitness
    • Especialistes en benestar
    • Farmàcia
    • Perruqueria
    Trades
    • Servei de manteniment
    • Hardware i suport informàtic
    • Sistemes d'energia solar
    • Shoe Maker
    • Serveis de neteja
    • Instal·lacions HVAC
    Altres
    • Nonprofit Organization
    • Agència del medi ambient
    • Lloguer de panells publicitaris
    • Fotografia
    • Lloguer de bicicletes
    • Distribuïdors de programari
    Browse all Industries
  • Comunitat
    Aprèn
    • Tutorials
    • Documentació
    • Certificacions
    • Formació
    • Blog
    • Pòdcast
    Potenciar l'educació
    • Programa educatiu
    • Scale-Up! El joc empresarial
    • Visita Odoo
    Obtindre el programari
    • Descarregar
    • Comparar edicions
    • Novetats de les versions
    Col·laborar
    • GitHub
    • Fòrum
    • Esdeveniments
    • Traduccions
    • Converteix-te en partner
    • Services for Partners
    • Registra la teva empresa comptable
    Obtindre els serveis
    • Troba un partner
    • Troba un comptable
    • Contacta amb un expert
    • Serveis d'implementació
    • Referències del client
    • Suport
    • Actualitzacions
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Programar una demo
  • Preus
  • Ajuda

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

  • CRM
  • e-Commerce
  • Comptabilitat
  • Inventari
  • PoS
  • Projectes
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
Ajuda

Can I modify MPS to create draft state Manufacturing orders

Subscriure's

Get notified when there's activity on this post

This question has been flagged
manufacturingmpsv14
4 Respostes
11267 Vistes
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)
Best Answer

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)
Best Answer

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
Best Answer

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!

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Registrar-se
Related Posts Respostes Vistes Activitat
Adjust quantity of Manufacturing Order
manufacturing v14
Avatar
Avatar
2
d’ag. 22
5755
Using same Product in the BoM of the the product Solved
manufacturing v14
Avatar
Avatar
1
de març 22
3220
Modifying Report View For Upgrades
manufacturing v14
Avatar
Avatar
1
de febr. 22
3061
Mass Update Manufacturing Order State Values
manufacturing v14
Avatar
Avatar
1
de febr. 22
3606
Forecast not showing for components of sub BOM
manufacturing v14
Avatar
0
de juny 21
2940
Community
  • Tutorials
  • Documentació
  • Fòrum
Codi obert
  • Descarregar
  • GitHub
  • Runbot
  • Traduccions
Serveis
  • Allotjament a Odoo.sh
  • Suport
  • Actualització
  • Desenvolupaments personalitzats
  • Educació
  • Troba un comptable
  • Troba un partner
  • Converteix-te en partner
Sobre nosaltres
  • La nostra empresa
  • Actius de marca
  • Contacta amb nosaltres
  • Llocs de treball
  • Esdeveniments
  • Pòdcast
  • Blog
  • Clients
  • Informació legal • Privacitat
  • Seguretat
الْعَرَبيّة 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 és un conjunt d'aplicacions empresarials de codi obert que cobreix totes les necessitats de la teva empresa: CRM, comerç electrònic, comptabilitat, inventari, punt de venda, gestió de projectes, etc.

La proposta única de valor d'Odoo és ser molt fàcil d'utilitzar i estar totalment integrat, ambdues alhora.

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