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

Get the new status.

Zaprenumeruj

Otrzymaj powiadomienie o aktywności w tym poście

To pytanie dostało ostrzeżenie
developmentpythoncronormodoo
4723 Widoki
Awatar
Mostafa Mohamed Abdel Monaem

Here is my code so far i create statues field with many values the default is 'underage'and i make cron function (get_age_comp)  if the condition true the statues should be changed to ('getCard')  my challenge now to add these who their status changed to('getCard') to new model table called (' fci_military_states') and from there i can change the status to the 3rd status ('gotCard') and finally when i change the status in the this table the record must deleted automatic and the status change in the first table (fci_student)to ('gotCard').

**My student model**

    from openerp.osv import osv, fields
    from openerp import api
    from datetime import date
    from dateutil.relativedelta import relativedelta
    
    
    class fci_student(osv.osv):
        _name = 'fci.student'
        _columns = {
            'photo': fields.binary(string='Photo'),
            'name': fields.char(size=128, string='First Name', required=True),
            'middle_name': fields.char(size=128, string='Middle Name', required=True),
            'last_name': fields.char(size=128, string='Last Name', required=True),
            'status': fields.Selection([('under_Age', 'UnderAge'), ('get_card', 'GetCard'), ('got_card', 'GotCard')],
                                       'Military Status'
                                       , default='under_Age'),
            # basic details
            "birth_date": fields.date(string='Birth Date', required=True),
            'gender': fields.selection([('m', 'Male'), ('f', 'Female'), ('o', 'Other')], string='Gender', required=True),
            'Paid': fields.boolean('Paid Student'),
            'nationality': fields.many2one('res.country', string='Nationality'),
            'id_number': fields.char(size=64, string='ID Card Number', required=True),
            'phone': fields.char(string='Phone Number', size=256, required=True),
            'email_address': fields.char(string='E-mail', size=256, required=True),
            'pay_amount': fields.char(size=64, string='Payment', required=True),
            # Edictional details
            'standard_id': fields.many2one('fci.standard', string='Standard', required=True),
            'term_id': fields.many2one('fci.terms', string='Terms', required=True),
            # Parent details
            'parent_name': fields.char(size=128, string='Parent First Name', required=True),
            'parent_middle_name': fields.char(size=128, string='Parent First Name', required=True),
            'parent_last_name': fields.char(size=128, string='Parent First Name', required=True),
            'parent_phone': fields.integer(size=128, string='Parent Number', required=True),
            'parent_ids': fields.char(size=128, string='Parent E-mail', required=True),
            # Library details
            'library_card_number': fields.char(size=64, string='Library Card Number'),
            'library_card_type': fields.char(size=64, string='Library Card type'),
            'number_of_books_allow': fields.char(size=64, string='Number of books allow'),
            # Address details
            'street_name': fields.char(size=128, string='Street', required=True),
            'city_name': fields.char(size=128, string='City', required=True),
            'state_name': fields.char(size=128, string='State', required=True),
            'Zip': fields.char(size=128, string='Zip Code'),
            'country': fields.char(size=128, string='country', required=True),
    
        }
    
    
    fci_student()
    
    @api.model
    def get_age_comp(self):  # cron function
        self.search([('gender', '=', 'm'), ('status', '=', 'under_Age'),
                     ('birth_date', '>=', date.today() - relativedelta(years=20))
        ]).write({'status': 'get_card'})
    def add_another_table(self):
        to_add = {}
        for student in self.search([('gender','=','m'), ('birth_date', '<=', date.today() - relativedelta(years=20)),
                                    ('status', '=', 'get_card')]):
            to_add[student.name] = student.status
            military_model = self.pool.get('fci.military.states')
        for name, birth_date,standard_group,standard_id,status in to_add.iteritems():
            military_model.create({'name': name, 'birth_date': birth_date,'standard_group':standard_group
            ,'standard_id':standard_id,'status':status})

**My military status model**


        from openerp.osv import osv, fields
    from openerp import api
    
    class fci_military_states(osv.osv):
        _name = 'fci.military.states'
        _rec_name = 'statues'
        _columns = {
            'statues': fields.Selection([('under_Age', 'UnderAge'),('get_card', 'GetCard'),('got_card', 'GotCard')],
                                        'Military Status', default='get_card'),
            'standard_group':fields.many2one('fci.standard.group',string='Group',requierd=True),
            'standard_id': fields.many2one('fci.standard', string='Standard', required=True),
            'student_id': fields.many2one('fci.student', string='Student', required=True),
    
        }
    @api.model
    def del_reco(self):
        to_add = {}
        for student in self.search([('gender', '=', 'm'), ('status', '=', 'got_card')]):
            to_add[student.name] = student.status
            military_model = self.pool.get('fci.student')
        for status in to_add.iteritems():
            military_model.write({'status':status})
        self.search([('gender', '=', 'm'), ('status', '=', 'got_card')]).unlink()

0
Awatar
Odrzuć
Mostafa Mohamed Abdel Monaem
Autor

Edited 14-2 3:49 AM Any help ?

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ść
I can't identify which class have this errors
development modules python orm odoo
Awatar
Awatar
Awatar
2
wrz 16
7571
How to refresh form view automatic Rozwiązane
development python orm odoo odooV8
Awatar
Awatar
Awatar
3
kwi 15
10958
Military states module -- help :D Rozwiązane
development modules python orm odoo
Awatar
Awatar
1
mar 15
4972
How to add field in 2 tables same time?
python orm odoo
Awatar
0
kwi 15
4194
Can't see opportunity that created by others even i have see all leads permission?
development python domain odoo
Awatar
0
kwi 22
4216
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