Skip ke Konten
Odoo Menu
  • Login
  • Uji coba gratis
  • Aplikasi
    Keuangan
    • Akuntansi
    • Faktur
    • Pengeluaran
    • Spreadsheet (BI)
    • Dokumen
    • Tanda Tangan
    Sales
    • CRM
    • Sales
    • POS Toko
    • POS Restoran
    • Langganan
    • Rental
    Website
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Rantai Pasokan
    • Inventaris
    • Manufaktur
    • PLM
    • Purchase
    • Maintenance
    • Kualitas
    Sumber Daya Manusia
    • Karyawan
    • Rekrutmen
    • Cuti
    • Appraisal
    • Referensi
    • Armada
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Acara
    • Otomatisasi Marketing
    • Survei
    Layanan
    • Project
    • Timesheet
    • Layanan Lapangan
    • Meja Bantuan
    • Planning
    • Appointment
    Produktivitas
    • Diskusi
    • Approval
    • IoT
    • VoIP
    • Pengetahuan
    • WhatsApp
    Aplikasi pihak ketiga Odoo Studio Platform Odoo Cloud
  • Industri-Industri
    Retail
    • Toko Buku
    • Toko Baju
    • Toko Furnitur
    • Toko Kelontong
    • Toko Hardware
    • Toko Mainan
    Makanan & Hospitality
    • Bar dan Pub
    • Restoran
    • Fast Food
    • Rumah Tamu
    • Distributor Minuman
    • Hotel
    Real Estate
    • Agensi Real Estate
    • Firma Arsitektur
    • Konstruksi
    • Estate Management
    • Perkebunan
    • Asosiasi Pemilik Properti
    Konsultansi
    • Firma Akuntansi
    • Mitra Odoo
    • Agensi Marketing
    • Firma huku
    • Talent Acquisition
    • Audit & Sertifikasi
    Manufaktur
    • Tekstil
    • Logam
    • Perabotan
    • Makanan
    • Brewery
    • Corporate Gift
    Kesehatan & Fitness
    • Sports Club
    • Toko Kacamata
    • Fitness Center
    • Wellness Practitioners
    • Farmasi
    • Salon Rambut
    Perdagangan
    • Handyman
    • IT Hardware & Support
    • Sistem-Sistem Energi Surya
    • Pembuat Sepatu
    • Cleaning Service
    • Layanan HVAC
    Lainnya
    • Organisasi Nirlaba
    • Agen Lingkungan
    • Rental Billboard
    • Fotografi
    • Penyewaan Sepeda
    • Reseller Software
    Browse semua Industri
  • Komunitas
    Belajar
    • Tutorial-tutorial
    • Dokumentasi
    • Sertifikasi
    • Pelatihan
    • Blog
    • Podcast
    Empower Education
    • Program Edukasi
    • Game Bisnis 'Scale Up!'
    • Kunjungi Odoo
    Dapatkan Softwarenya
    • Download
    • Bandingkan Edisi
    • Daftar Rilis
    Kolaborasi
    • Github
    • Forum
    • Acara
    • Terjemahan
    • Menjadi Partner
    • Layanan untuk Partner
    • Daftarkan perusahaan Akuntansi Anda.
    Dapatkan Layanan
    • Temukan Mitra
    • Temukan Akuntan
    • Temui penasihat
    • Layanan Implementasi
    • Referensi Pelanggan
    • Bantuan
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dapatkan demo
  • Harga
  • Bantuan

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

  • CRM
  • e-Commerce
  • Akuntansi
  • Inventaris
  • PoS
  • Project
  • MRP
All apps
Anda harus terdaftar untuk dapat berinteraksi di komunitas.
Semua Post Orang Lencana-Lencana
Label (Lihat semua)
odoo accounting v14 pos v15
Mengenai forum ini
Anda harus terdaftar untuk dapat berinteraksi di komunitas.
Semua Post Orang Lencana-Lencana
Label (Lihat semua)
odoo accounting v14 pos v15
Mengenai forum ini
Help

Automatic action to set manufacturing order in status Done

Langganan

Dapatkan notifikasi saat terdapat aktivitas pada post ini

Pertanyaan ini telah diberikan tanda
manufacturingworkorderv14Lot/SN
6 Replies
8060 Tampilan
Avatar
Lars Aam

When we produce many lot numbers from work order tablet view, a new manufacturing order is created for every lot number when you press 'Mark As Done' in the tablet view.

The order with the lot number that is complete stays in status "To close", and you have to manually close the manufacturing order that also post product movements.

We want to avoid this extra manual step.  Create an automatic action that do this. 

I know how to create an automatic action, but I do not know coding.  So I need that line of Python code that execute this. 

There is a button in the form view of Manufacturing order and I can see it uses method 'button_mark_done'.   How do I write the python expression that execute thios from an automatic action.

A video of how we confirm orders is found here. Jumpt to 3 minutes to see how orders are closed

https://drive.google.com/open?id=1-iuukpnL9Z1-SgjmnF4Id4AmhBzTyF2I&authuser=larsaam34%40gmail.com&usp=drive_fs

0
Avatar
Buang
Avatar
Midhun M M
Jawaban Terbai

Hello Lars,

I am not an expert in coding side, but please try the following.

model.search([('state', '=', 'to_close')]).button_mark_done()



Note: Cron will not work in case any of the records are not satisfying the condition to mark as done. For example, If lot/Serial number is enabled, but yet to generate, So in this case cron will throw a warning.. if all the to_close state records are satisfying all the condition to mark as done, then this cron will work without any issue.
0
Avatar
Buang
Lars Aam
Penulis

Thanks a lot. But I was hoping to run this as an automatic action on the current record.
My action looks like this, but does not process the current record that change status. So very to close to get what we need, but not quite there yet.

https://drive.google.com/file/d/10IUucQ0BV9VSLJnMbCnklTfQILxkSntr/view?usp=sharing

Lars Aam
Penulis

A solution might be to run the schedule action like every 5 minutes.

Avatar
Robbie
Jawaban Terbai

see below. Use this every day. Ignore the MO Type = Parent field, that's custom. 


0
Avatar
Buang
Lars Aam
Penulis

Thank you for your answer. The code you use is exact the same as we have in the server action "Button Mark Done". I am not able to get it working in a automated action. Orders remain in status "To Close". Quite frustrating. We use V14.

Avatar
Daniel Blanco
Jawaban Terbai
for r in records.filtered(lambda x: x.state == ‘to_close’):                  

r.button_mark_done()

    

0
Avatar
Buang
Daniel Blanco

I didn't check the button_mark_done() code but it seems is not calling wizards at all. So you can execute it over the record set. Nevertheless, with my approach, you can be sure that we don't call it from records of the record set that cannot be closed yet.

Lars Aam
Penulis

This must also be run as a schedule action? For a scheduled action this code also works:
model.search([('state', '=', 'to_close')]).button_mark_done().

I was thinking an automatic action would be more efficient, since it only needs to be run, when a work order for is partly confirmed. It is not so freequent. Will be hours between every event. With a scheduled action it must be run like every 5 minutes to be OK for the flow.
But with an automatic action, triggered by Update of field State(mrp.production), it do not process the order that triggered the action.

Daniel Blanco

You can run from automatic action as well. Using model directly is correct, nevertheless searching the whole model does not allow you to pre select a dataset

Avatar
Chris TRINGHAM
Jawaban Terbai

Have you tried using this Python Code:

records.action_button_mark_done()


0
Avatar
Buang
Lars Aam
Penulis

Thank you Chris. But the result was a error:

Error:
Odoo Server Error

Traceback (most recent call last):
File "/home/odoo/src/odoo/odoo/addons/base/models/ir_http.py", line 237, in _dispatch
result = request.dispatch()
File "/home/odoo/src/odoo/odoo/http.py", line 685, in dispatch
result = self._call_function(**self.params)
File "/home/odoo/src/odoo/odoo/http.py", line 361, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/home/odoo/src/odoo/odoo/service/model.py", line 94, in wrapper
return f(dbname, *args, **kwargs)
File "/home/odoo/src/odoo/odoo/http.py", line 349, in checked_call
result = self.endpoint(*a, **kw)
File "/home/odoo/src/odoo/odoo/http.py", line 914, in __call__
return self.method(*args, **kw)
File "/home/odoo/src/odoo/odoo/http.py", line 533, in response_wrap
response = f(*args, **kw)
File "/home/odoo/src/odoo/addons/web/controllers/main.py", line 1392, in call_button
action = self._call_kw(model, method, args, kwargs)
File "/home/odoo/src/user/3rdparty/printnode_base/controllers/main.py", line 50, in _call_kw
return super(DataSetProxy, self)._call_kw(model, method, args, kwargs)
File "/home/odoo/src/odoo/addons/web/controllers/main.py", line 1380, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "/home/odoo/src/odoo/odoo/api.py", line 400, in call_kw
model.flush()
File "/home/odoo/src/odoo/odoo/models.py", line 5473, in flush
self.recompute()
File "/home/odoo/src/odoo/odoo/models.py", line 5932, in recompute
process(field)
File "/home/odoo/src/odoo/odoo/models.py", line 5916, in process
field.recompute(recs)
File "/home/odoo/src/odoo/odoo/fields.py", line 1155, in recompute
self.compute_value(recs)
File "/home/odoo/src/odoo/odoo/fields.py", line 1177, in compute_value
records._compute_field_value(self)
File "/home/odoo/src/odoo/odoo/models.py", line 4080, in _compute_field_value
field.compute(self)
File "/home/odoo/src/odoo/odoo/fields.py", line 555, in _compute_related
record[self.name] = self._process_related(value[self.related_field.name])
File "/home/odoo/src/odoo/odoo/models.py", line 5712, in __setitem__
return self._fields[key].__set__(self, value)
File "/home/odoo/src/odoo/odoo/fields.py", line 1109, in __set__
self.write(protected_records, value)
File "/home/odoo/src/odoo/odoo/fields.py", line 1588, in write
records.env['ir.translation']._set_ids(
File "/home/odoo/src/odoo/odoo/addons/base/models/ir_translation.py", line 272, in _set_ids
self.sudo().create([{
File "<decorator-gen-58>", line 2, in create
File "/home/odoo/src/odoo/odoo/api.py", line 348, in _model_create_multi
return create(self, arg)
File "/home/odoo/src/odoo/odoo/addons/base/models/ir_translation.py", line 564, in create
self.flush()
File "/home/odoo/src/odoo/odoo/models.py", line 5473, in flush
self.recompute()
File "/home/odoo/src/odoo/odoo/models.py", line 5932, in recompute
process(field)
File "/home/odoo/src/odoo/odoo/models.py", line 5916, in process
field.recompute(recs)
File "/home/odoo/src/odoo/odoo/fields.py", line 1155, in recompute
self.compute_value(recs)
File "/home/odoo/src/odoo/odoo/fields.py", line 1177, in compute_value
records._compute_field_value(self)
File "/home/odoo/src/odoo/addons/base_automation/models/base_automation.py", line 378, in _compute_field_value
_compute_field_value.origin(self, field)
File "/home/odoo/src/odoo/odoo/models.py", line 4080, in _compute_field_value
field.compute(self)
File "/home/odoo/src/odoo/odoo/fields.py", line 555, in _compute_related
record[self.name] = self._process_related(value[self.related_field.name])
File "/home/odoo/src/odoo/odoo/models.py", line 5703, in __getitem__
return self._fields[key].__get__(self, type(self))
File "/home/odoo/src/odoo/odoo/fields.py", line 969, in __get__
self.recompute(record)
File "/home/odoo/src/odoo/odoo/fields.py", line 1155, in recompute
self.compute_value(recs)
File "/home/odoo/src/odoo/odoo/fields.py", line 1177, in compute_value
records._compute_field_value(self)
File "/home/odoo/src/odoo/addons/base_automation/models/base_automation.py", line 382, in _compute_field_value
action._process(records, domain_post=domain_post)
File "/home/odoo/src/odoo/addons/base_automation/models/base_automation.py", line 274, in _process
raise e
File "/home/odoo/src/odoo/addons/base_automation/models/base_automation.py", line 271, in _process
action_server.sudo().with_context(**ctx).run()
File "/home/odoo/src/odoo/odoo/addons/base/models/ir_actions.py", line 632, in run
res = runner(run_self, eval_context=eval_context)
File "/home/odoo/src/odoo/addons/website/models/ir_actions.py", line 61, in _run_action_code_multi
res = super(ServerAction, self)._run_action_code_multi(eval_context)
File "/home/odoo/src/odoo/odoo/addons/base/models/ir_actions.py", line 501, in _run_action_code_multi
safe_eval(self.code.strip(), eval_context, mode="exec", nocopy=True) # nocopy allows to return 'action'
File "/home/odoo/src/odoo/odoo/tools/safe_eval.py", line 347, in safe_eval
raise ValueError('%s: "%s" while evaluating\n%r' % (ustr(type(e)), ustr(e), expr))
Exception

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/odoo/src/odoo/odoo/http.py", line 641, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/home/odoo/src/odoo/odoo/http.py", line 317, in _handle_exception
raise exception.with_traceback(None) from new_cause
ValueError: <class 'AttributeError'>: "'mrp.production' object has no attribute 'action_button_mark_done'" while evaluating
"# Available variables:\n# - env: Odoo Environment on which the action is triggered\n# - model: Odoo Model of the record on which the action is triggered; is a void recordset\n# - record: record on which the action is triggered; may be void\n# - records: recordset of all records on which the action is triggered in multi-mode; may be void\n# - time, datetime, dateutil, timezone: useful Python libraries\n# - float_compare: Odoo function to compare floats based on specific precisions\n# - log: log(message, level='info'): logging function to record debug information in ir.logging table\n# - UserError: Warning Exception to use with raise\n# To return an action, assign: action = {...\nrecords.action_button_mark_done()"

Lars Aam
Penulis

Running a schedule action every 5 minutes works. And is also OK in our process. A short timelag is not an issue. But automatic action seems more logic.

Daniel Blanco

Chris, you cannot call action_button_mark_done because there is no python code with this method. Instead, there is a method button_mark_done() defined in the model that is callable.

Avatar
Jainesh Shah(Aktiv Software)
Jawaban Terbai

Hello Lars Aam,

You Can Create Automated Action to set manufacturing order in status Done.

Find Example in comment.

I hope you are doing well.

For Example -

- Create an Automated action by adding name, model (Production Order as per your requirement), trigger (update as per your requirement), trigger fields(Status), Before Update domain (State = "progress"), filter domain (Status = "to_close") and Action to do ( Execute several actions as per your requirement )

- In the Actions Notebook below add the server action "Mark as Done".

- So when the order will change its state from "progress" to "to_close" our server action ( Mark as Done ) will be Triggered, and your order will be in the Done State.

I hope this will help you.

Thanks & Regards,
Email: odoo@aktivsoftware.com
Skype: kalpeshmaheshwari

0
Avatar
Buang
Lars Aam
Penulis

Thank you for your answer. This was in fact the first I tried, before posting this question. It does not work. Order is not processed.
Difficuilt to understand why.

What works is a scheduled action with the code:
model.search([('state', '=', 'to_close')]).button_mark_done()

We are running this every 5 minutes, and that is OK for the business.

Avatar
MUHAMMAD Imran
Jawaban Terbai

you can use the "Workflow" feature to set up automatic actions that change the status of a manufacturing order to "Done." Here are the general steps to set this up:

  1. Go to the "Manufacturing" module in Odoo and navigate to the "Manufacturing Orders" menu.

  2. Select the manufacturing order for which you want to set up the automatic action.

  3. Click on the "More" button and select "Workflow."

  4. In the "Workflow" menu, you can create a new workflow or edit an existing one.

  5. In the workflow, you can create a new "Transition" that changes the status of the manufacturing order from "In Progress" to "Done" when certain conditions are met.

  6. You can set up conditions for the transition by clicking on the "Conditions" button.

  7. In the conditions, you can set up triggers that automatically change the status of the manufacturing order to "Done" when certain actions are performed, such as when all the products have been produced or when the production is completed.

  8. Save the workflow and activate it.

Please note that these are general steps and the exact steps may vary depending on the version of Odoo you are using.

-1
Avatar
Buang
Lars Aam
Penulis

Thank you for your answer. Cannot find button "More" and Workflow. We run V14, so maybe that is for a later version.

Lars Aam
Penulis

I cannot find a "More" button in a manufacturing order in Odoo16

Menikmati diskusi? Jangan hanya membaca, ikuti!

Buat akun sekarang untuk menikmati fitur eksklufi dan agar terlibat dengan komunitas kami!

Daftar
Post Terkait Replies Tampilan Aktivitas
Odoo Allows Multiple work orders simultaneously... But we require to run in sequence. How do I do that?
manufacturing sequence workorder v14
Avatar
0
Sep 21
4386
Odoo 17.sh = How can I create and assign a whole group of operators to a Work Order in an MO? Diselesaikan
manufacturing workorder
Avatar
Avatar
1
Sep 24
2940
V16 Work Order Cancel undo
manufacturing workorder
Avatar
Avatar
1
Agu 24
2789
Can I prevent a Work Order from starting if the materials / products are not available or have not yet been picked? Diselesaikan
manufacturing workorder starting prevent v14
Avatar
Avatar
1
Jun 23
6100
Missing finish steps (QA check) when adding components to Manufacturing order
manufacturing workorder v14 Lots QualityChecks
Avatar
0
Jun 23
2434
Komunitas
  • Tutorial-tutorial
  • Dokumentasi
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Terjemahan
Layanan
  • Odoo.sh Hosting
  • Bantuan
  • Peningkatan
  • Custom Development
  • Pendidikan
  • Temukan Akuntan
  • Temukan Mitra
  • Menjadi Partner
Tentang Kami
  • Perusahaan kami
  • Aset Merek
  • Hubungi kami
  • Tugas
  • Acara
  • Podcast
  • Blog
  • Pelanggan
  • Hukum • Privasi
  • Keamanan
الْعَرَبيّة 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 adalah rangkaian aplikasi bisnis open source yang mencakup semua kebutuhan perusahaan Anda: CRM, eCommerce, akuntansi, inventaris, point of sale, manajemen project, dan seterusnya.

Mudah digunakan dan terintegrasi penuh pada saat yang sama adalah value proposition unik Odoo.

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