Skip to Content
Odoo Menu
  • Prijavi
  • Try it free
  • Aplikacije
    Finance
    • Knjigovodstvo
    • Obračun
    • Stroški
    • Spreadsheet (BI)
    • Dokumenti
    • Podpisovanje
    Prodaja
    • CRM
    • Prodaja
    • POS Shop
    • POS Restaurant
    • Naročnine
    • Najem
    Spletne strani
    • Website Builder
    • Spletna trgovina
    • Blog
    • Forum
    • Pogovor v živo
    • eUčenje
    Dobavna veriga
    • Zaloga
    • Proizvodnja
    • PLM
    • Nabava
    • Vzdrževanje
    • Kakovost
    Kadri
    • Kadri
    • Kadrovanje
    • Odsotnost
    • Ocenjevanja
    • Priporočila
    • Vozni park
    Marketing
    • Družbeno Trženje
    • Email Marketing
    • SMS Marketing
    • Dogodki
    • Avtomatizacija trženja
    • Ankete
    Storitve
    • Projekt
    • Časovnice
    • Storitve na terenu
    • Služba za pomoč
    • Načrtovanje
    • Termini
    Produktivnost
    • Razprave
    • Odobritve
    • IoT
    • Voip
    • Znanje
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industrije
    Trgovina na drobno
    • Book Store
    • Trgovina z oblačili
    • Trgovina s pohištvom
    • Grocery Store
    • Trgovina s strojno opremo računalnikov
    • Trgovina z igračami
    Food & Hospitality
    • Bar and Pub
    • Restavracija
    • Hitra hrana
    • Guest House
    • Beverage Distributor
    • Hotel
    Nepremičnine
    • Real Estate Agency
    • Arhitekturno podjetje
    • Gradbeništvo
    • Estate Management
    • Vrtnarjenje
    • Združenje lastnikov nepremičnin
    Svetovanje
    • Računovodsko podjetje
    • Odoo Partner
    • Marketinška agencija
    • Law firm
    • Pridobivanje talentov
    • Audit & Certification
    Proizvodnja
    • Tekstil
    • Metal
    • Pohištvo
    • Hrana
    • Brewery
    • Poslovna darila
    Health & Fitness
    • Športni klub
    • Trgovina z očali
    • Fitnes center
    • Wellness Practitioners
    • Lekarna
    • Frizerski salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Sistemi sončne energije
    • Izdelovalec čevljev
    • Čistilne storitve
    • HVAC Services
    Ostali
    • Neprofitna organizacija
    • Agencija za okolje
    • Najem oglasnih panojev
    • Fotografija
    • Najem koles
    • Prodajalec programske opreme
    Browse all Industries
  • Skupnost
    Learn
    • Tutorials
    • Dokumentacija
    • Certifikati
    • Šolanje
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Prenesi
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Dogodki
    • Prevodi
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Sklici kupca
    • Podpora
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Določanje cen
  • Pomoč

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

  • CRM
  • e-Commerce
  • Knjigovodstvo
  • Zaloga
  • PoS
  • Projekt
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
Pomoč

Manually create workflow

Naroči se

Get notified when there's activity on this post

This question has been flagged
workflow9.0
5 Odgovori
9163 Prikazi
Avatar
Mathieu Laflamme

Hey anyone was able to manually instantiate a new workflow in Odoo 9.0???

Where do I put the code to create the workflow instance? I tried the code below. The workitem and instance get created, and I compared it that what's created when on_create is True, and it seems the same... I don't see what I do wrong... it just doesn't register it correctly... By the way, when I use on_create = True, there is no problem... I just want to have a specific workflow for my specific item.

Any idea what I do wrong?

Thanks


@api.model    
def create(self, vals):
    res = super(SaleOrder, self).create(vals)
    
    if res.is_print:
        res.create_workflow()
    
    return res
0
Avatar
Opusti
Avatar
RCS - Richter Computer Systemhaus GmbH, Heiko Dietrich
Best Answer

You can do this:

from openerp.workflow.instance import WorkflowInstance
from openerp.workflow.helpers import Record, Session
wkf_id = self.env.ref('your_model.your_workflow_id').id
WorkflowInstance.create(Session(self.env.cr, self.env.uid), Record(self._name, res.id), wkf_id)
0
Avatar
Opusti
Avatar
Akhil P Sivan
Best Answer

Hi,

Workflows can be managed in two ways:

1. Define a state field in your model with the required states. Then the state changes can be managed by python methods in your model. For eg: by executing those methods on button click and the record state changes.

2. Create a real workflow instance, by defining a state field as usual and then create a yourmodule_workflow.xml. In that file, add the workflow instance, activities & transitions, as you need. Then you can trigger the transitions from either buttons (create button with type="workflow") or python methods (using signal_workflow())

You may refer this for more details:

https://www.odoo.com/documentation/9.0/howtos/backend.html#workflows

0
Avatar
Opusti
Mathieu Laflamme
Avtor

Again "Where do I put the code to create the workflow instance?"... I mean where to I call create_workflow() MANUALLY (I know how to create the workflow definition!). I don't want a workflow for all the records in the database, that's why I want to manage it myself.

Akhil P Sivan

Did you check the Odoo official link above? It clearly explains how to create workflow for a newly created model. I just summarized the whole idea and gave that link for you to check more details or an example. If you refer that you will surely come to know, where to put the code to create a new workflow in Odoo 9. What does this create_workflow() in your code do?

Mathieu Laflamme
Avtor

Yeah I checked it out... nowhere they are starting the workflow manually. The method create_workflow() is part of the BaseModel class of Odoo and it creates the workflow instance. I can see it in the instance and in the Workitem data... but somehow the instantiated workflow is ignored. Creating an instance of workflow doesn't seem to be supported very well!

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

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

Prijavi
Related Posts Odgovori Prikazi Aktivnost
What's the equivalent in V9 of "purchase.act_draft" (V8) ? Solved
workflow transition 9.0
Avatar
Avatar
3
mar. 16
2094
[representante de expedia]¿Cómo hablar Expedia en español?
workflow
Avatar
0
okt. 25
3
¿Cómo hablar con una persona viva en Copa? (‘_’) Hablar con el agente
workflow
Avatar
0
okt. 25
561
Como crear un canal para PQR
workflow
Avatar
Avatar
2
okt. 25
566
Odoo + amazon connector Solved
workflow
Avatar
Avatar
Avatar
2
sep. 25
917
Community
  • Tutorials
  • Dokumentacija
  • Forum
Open Source
  • Prenesi
  • Github
  • Runbot
  • Prevodi
Services
  • Odoo.sh Hosting
  • Podpora
  • Nadgradnja
  • Custom Developments
  • Izobraževanje
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Sredstva blagovne znamke
  • Kontakt
  • Zaposlitve
  • Dogodki
  • Podcast
  • Blog
  • Stranke
  • Pravno • Zasebnost
  • Varnost
الْعَرَبيّة 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 is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

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