Skip to Content
Odoo Menu
  • Zaloguj się
  • Wypróbuj za darmo
  • Aplikacje
    Finanse
    • Księgowość
    • Fakturowanie
    • Wydatki
    • Arkusz kalkulacyjny (BI)
    • Dokumenty
    • Podpisy
    Sprzedaż
    • CRM
    • Sprzedaż
    • PoS Sklep
    • PoS Restauracja
    • Subskrypcje
    • Wypożyczalnia
    Strony Internetowe
    • Kreator Stron Internetowych
    • eCommerce
    • Blog
    • Forum
    • Czat na Żywo
    • eLearning
    Łańcuch dostaw
    • Magazyn
    • Produkcja
    • PLM
    • Zakupy
    • Konserwacja
    • Jakość
    Zasoby Ludzkie
    • Pracownicy
    • Rekrutacja
    • Urlopy
    • Ocena pracy
    • Polecenia Pracownicze
    • Flota
    Marketing
    • Marketing Społecznościowy
    • E-mail Marketing
    • SMS Marketing
    • Wydarzenia
    • Automatyzacja Marketingu
    • Ankiety
    Usługi
    • Projekt
    • Ewidencja czasu pracy
    • Usługi Terenowe
    • Helpdesk
    • Planowanie
    • Spotkania
    Produktywność
    • Dyskusje
    • Zatwierdzenia
    • IoT
    • VoIP
    • Baza wiedzy
    • WhatsApp
    Aplikacje trzecich stron Studio Odoo Odoo Cloud Platform
  • Branże
    Sprzedaż detaliczna
    • Księgarnia
    • Sklep odzieżowy
    • Sklep meblowy
    • Sklep spożywczy
    • Sklep z narzędziami
    • Sklep z zabawkami
    Żywienie i hotelarstwo
    • Bar i Pub
    • Restauracja
    • Fast Food
    • Pensjonat
    • Dystrybutor napojów
    • Hotel
    Agencja nieruchomości
    • Agencja nieruchomości
    • Biuro architektoniczne
    • Budowa
    • Zarządzanie nieruchomościami
    • Ogrodnictwo
    • Stowarzyszenie właścicieli nieruchomości
    Doradztwo
    • Biuro księgowe
    • Partner Odoo
    • Agencja marketingowa
    • Kancelaria prawna
    • Agencja rekrutacyjna
    • Audyt i certyfikacja
    Produkcja
    • Tekstylia
    • Metal
    • Meble
    • Jedzenie
    • Browar
    • Prezenty firmowe
    Zdrowie & Fitness
    • Klub sportowy
    • Salon optyczny
    • Centrum fitness
    • Praktycy Wellness
    • Apteka
    • Salon fryzjerski
    Transakcje
    • Złota rączka
    • Wsparcie Sprzętu IT
    • Systemy energii słonecznej
    • Szewc
    • Firma sprzątająca
    • Usługi HVAC
    Inne
    • Organizacja non-profit
    • Agencja Środowiskowa
    • Wynajem billboardów
    • Fotografia
    • Leasing rowerów
    • Sprzedawca oprogramowania
    Przeglądaj wszystkie branże
  • Community
    Ucz się
    • Samouczki
    • Dokumentacja
    • Certyfikacje
    • Szkolenie
    • Blog
    • Podcast
    Pomóż w nauce innym
    • Program Edukacyjny
    • Scale Up! Gra biznesowa
    • Odwiedź Odoo
    Skorzystaj z oprogramowania
    • Pobierz
    • Porównaj edycje
    • Wydania
    Współpracuj
    • Github
    • Forum
    • Wydarzenia
    • Tłumaczenia
    • Zostań partnerem
    • Usługi dla partnerów
    • Zarejestruj swoją firmę rachunkową
    Skorzystaj z usług
    • Znajdź partnera
    • Znajdź księgowego
    • Spotkaj się z doradcą
    • Usługi wdrożenia
    • Opinie klientów
    • Wsparcie
    • Aktualizacje
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Zaplanuj demo
  • Cennik
  • Pomoc

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

  • CRM
  • e-Commerce
  • Księgowość
  • Zapasy
  • PoS
  • Projekt
  • MRP
All apps
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Pomoc

Create a button to change the state of the record

Zaprenumeruj

Otrzymaj powiadomienie o aktywności w tym poście

To pytanie dostało ostrzeżenie
many2onebuttons
2 Odpowiedzi
6784 Widoki
Awatar
Nguyen Ngoc Hai

Hello everyone, I have 2 classes like in the picture.
In the overtime_detail class, I have created a list of records, all of which are defaulted in the "draft" state.


'' class overtime_detail (models.Model):
    _name = 'overtime_detail'
    _description = "More details"
    _rec_name = 'employee'

    employee = fields.Many2one (comodel_name = 'hr.employee', string = "Employee name", required = True)
    department = fields.Many2one (comodel_name = 'hr.department', string = 'Department', required = True)
    date = fields.Date (string = 'Overtime day', default = datetime.today (), required = True)
    ot_rate = fields.Float (string = 'Overtime rate')
    ot_time = fields.Integer (string = "Overtime", min = '0.5', max = '16 ', required = True)
    reason = fields.Char (string = "Reason for overtime", size = 100, required = True)
    status = fields.Selection (string = 'Status', selection = [('draft', 'Draft'),
                                                             ('wait', 'Wait for approval'),
                                                             ('done', 'Approved'),
                                                             ('reject', 'Rejected')], default = 'draft')

    management = fields.Many2one (comodel_name = 'overtime_management', string = 'Description') ''

​
In class overtime_management


class overtime_management (models.Model):
    _name = "overtime_management"
    _description = "Overtime ticket"
    _rec_name = 'department'

    subject = fields.Char (string = 'Description', required = True)
    department = fields.Many2one (comodel_name = 'hr.department', string = 'Department', required = True)
    date = fields.Date (string = 'Overtime day', required = True)
    ot_rate = fields.Float ("Overtime rate", required = True)
    ot_sum = fields.Float ("Total overtime", compute = '_ sum_ot')
    reason = fields.Char (string = 'Reason for overtime', size = 100, required = True)
    detail = fields.One2many (comodel_name = 'overtime_detail', inverse_name = 'management', string = "More details")
    status = fields.Selection (string = "Status", selection =
[('draft', 'Draft'),
                                                             ('done', 'Approved'),
                                                             ('reject', 'Rejected')], default = 'draft')

This class has a many2one relationship with overtime_detail. I want to create an "approved" button that converts the state of detail records in overtime_detail to "approved". Please help me. Thank you​

0
Awatar
Odrzuć
Sehrish

Look into odoo workflow: https://goo.gl/gYe8RL

Awatar
Niyas Raphy (Walnut Software Solutions)
Najlepsza odpowiedź

Hi,

You can define a button for this and on clicking the button , you can call a python function, you can write the function like this,

def action_approve(self):
for rec in self:
for line in rec.detail:
line.status = 'done'

1. Control States and Statusbar Using Buttons

2.Button Types

Thanks

0
Awatar
Odrzuć
Podoba Ci się ta dyskusja? Dołącz do niej!

Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!

Zarejestruj się
Powiązane posty Odpowiedzi Widoki Czynność
value not pass from many2one field to form
many2one
Awatar
Awatar
Awatar
Awatar
3
wrz 25
2487
Display values of dropdown in a many2one field Rozwiązane
many2one
Awatar
Awatar
2
lut 25
7135
Custom stat button (eo_stat_button) for a custom field on a partner
buttons
Awatar
Awatar
Awatar
2
mar 23
11335
Cacher le bouton "créer" d'une liste Rozwiązane
buttons
Awatar
Awatar
2
mar 23
3363
Set default value in object of many2one field Rozwiązane
many2one
Awatar
Awatar
1
lis 22
16893
Społeczność
  • Samouczki
  • Dokumentacja
  • Forum
Open Source
  • Pobierz
  • Github
  • Runbot
  • Tłumaczenia
Usługi
  • Hosting Odoo.sh
  • Wsparcie
  • Aktualizacja
  • Indywidualne rozwiązania
  • Edukacja
  • Znajdź księgowego
  • Znajdź partnera
  • Zostań partnerem
O nas
  • Nasza firma
  • Zasoby marki
  • Skontaktuj się z nami
  • Oferty pracy
  • Wydarzenia
  • Podcast
  • Blog
  • Klienci
  • Informacje prawne • Prywatność
  • Bezpieczeństwo Odoo
الْعَرَبيّة 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 to pakiet aplikacji biznesowych typu open source, które zaspokoją wszystkie potrzeby Twojej firmy: CRM, eCommerce, księgowość, inwentaryzacja, punkt sprzedaży, zarządzanie projektami itp.

Unikalną wartością Odoo jest to, że jest jednocześnie bardzo łatwe w użyciu i w pełni zintegrowane.

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