Přejít na obsah
Odoo Menu
  • Přihlásit se
  • Vyzkoušejte zdarma
  • Aplikace
    Finance
    • Účetnictví
    • Fakturace
    • Výdaje
    • Spreadsheet (BI)
    • Dokumenty
    • Podpisy
    Prodej
    • CRM
    • Prodej
    • POS Obchod
    • POS Restaurace
    • Předplatné
    • Pronájem
    Webové stránky
    • Webové stránky
    • E-shop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Dodavatelský řetězec
    • Sklad
    • Výroba
    • PLM
    • Nákup
    • Údržba
    • Kvalita
    Lidské zdroje
    • Zaměstnanci
    • Nábor
    • Volno
    • Hodnocení zaměstnanců
    • Doporučení
    • Vozový park
    Marketing
    • Marketing sociálních sítí
    • Emailový marketing
    • SMS Marketing
    • Události
    • Marketingová automatizace
    • Dotazníky
    Služby
    • Projekt
    • Časové výkazy
    • Práce v terénu
    • Helpdesk
    • Plánování
    • Schůzky
    Produktivita
    • Diskuze
    • Schvalování
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Aplikace třetích stran Odoo Studio Odoo cloudová platforma
  • Branže
    Maloobchod
    • Knihkupectví
    • Obchod s oblečením
    • Obchod s nábytkem
    • Potraviny
    • Obchod s hardwarem
    • Hračkářství
    Jídlo a pohostinství
    • Bar a Pub
    • Restaurace
    • Fast Food
    • Penzion
    • Distributor nápojů
    • Hotel
    Nemovitost
    • Realitní kancelář
    • Architektonická firma
    • Stavba
    • Správa nemovitostí
    • Zahradnictví
    • Asociace vlastníků nemovitosti
    Poradenství
    • Účetní firma
    • Odoo Partner
    • Marketingová agentura
    • Právník
    • Akvizice talentů
    • Audit a certifikace
    Výroba
    • Textil
    • Kov
    • Nábytek
    • Jídlo
    • Pivovar
    • Korporátní dárky
    Zdraví a fitness
    • Sportovní klub
    • Prodejna brýli
    • Fitness Centrum
    • Wellness praktikové
    • Lékárna
    • Kadeřnictví
    Transakce
    • Údržbář
    • Podpora IT & hardware
    • Systémy solární energie
    • Výrobce obuvi
    • Úklidové služby
    • Služby HVAC
    Ostatní
    • Nezisková organizace
    • Agentura pro životní prostředí
    • Pronájem billboardů
    • Fotografování
    • Leasing jízdních kol
    • Prodejce softwaru
    Procházet všechna odvětví
  • Komunita
    Edukační program
    • Tutoriály
    • Dokumentace
    • Certifikace
    • Vzdělávání
    • Blog
    • Podcast
    Podpora vzdělávání
    • Vzdělávací program
    • Scale Up! Hra na firmu
    • Navštivte Odoo
    Získat software
    • Stáhnout
    • Porovnejte edice
    • Verze
    Spolupráce
    • Github
    • Fórum
    • Události
    • Překlady
    • Stát se partnerem
    • Služby pro partnery
    • Registrujte svou účetní firmu
    Získat služby
    • Najít partnera
    • Najít účetní
    • Setkejte se s poradcem
    • Implementační služby
    • Zákaznické reference
    • Podpora
    • Upgrady
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dohodnout demo
  • Ceník
  • Pomoc

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

  • CRM
  • e-Commerce
  • Účetnictví
  • Sklad
  • PoS
  • Projekty
  • MRP
All apps
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
Pomoc

Can I modify MPS to create draft state Manufacturing orders

Odebírat

Get notified when there's activity on this post

This question has been flagged
manufacturingmpsv14
4 Odpovědi
11259 Zobrazení
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
Zrušit
Leonardo de Abreu Ladeira

How did you solve this?

Avatar
Ray Carnes (ray)
Nejlepší odpověď

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
Zrušit
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)
Nejlepší odpověď

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
Zrušit
Avatar
Hayden McCarthy
Nejlepší odpověď

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
Zrušit
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!

Přihlásit se
Related Posts Odpovědi Zobrazení Aktivita
Adjust quantity of Manufacturing Order
manufacturing v14
Avatar
Avatar
2
srp 22
5749
Using same Product in the BoM of the the product Vyřešeno
manufacturing v14
Avatar
Avatar
1
bře 22
3220
Modifying Report View For Upgrades
manufacturing v14
Avatar
Avatar
1
úno 22
3057
Mass Update Manufacturing Order State Values
manufacturing v14
Avatar
Avatar
1
úno 22
3597
Forecast not showing for components of sub BOM
manufacturing v14
Avatar
0
čvn 21
2931
Komunita
  • Tutoriály
  • Dokumentace
  • Fórum
Open Source
  • Stáhnout
  • Github
  • Runbot
  • Překlady
Služby
  • Odoo.sh hostování
  • Podpora
  • Upgrade
  • Nestandardní vývoj
  • Edukační program
  • Najít účetní
  • Najít partnera
  • Stát se partnerem
O nás
  • Naše společnost
  • Podklady značky
  • Kontakujte nás
  • Práce
  • Události
  • Podcast
  • Blog
  • Zákazníci
  • Právní dokumenty • Soukromí
  • Zabezpečení
الْعَرَبيّة 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 je balíček open-source aplikací, které pokrývají všechny potřeby vaší společnosti: CRM, e-shop, účetnictví, sklady, kasy, projektové řízení a další.

Unikátní nabídka od Odoo poskytuje velmi jednoduché uživatelské rozhraní a vše je integrované na jednom místě.

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