Skip to Content
Odoo Menu
  • Prihlásiť sa
  • Vyskúšajte zadarmo
  • Aplikácie
    Financie
    • Účtovníctvo
    • Fakturácia
    • Výdavky
    • Tabuľka (BI)
    • Dokumenty
    • Podpis
    Predaj
    • CRM
    • Predaj
    • POS Shop
    • POS Restaurant
    • Manažment odberu
    • Požičovňa
    Webstránky
    • Tvorca webstránok
    • eShop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Supply Chain
    • Sklad
    • Výroba
    • Správa životného cyklu produktu
    • Nákup
    • Údržba
    • Manažment kvality
    Ľudské zdroje
    • Zamestnanci
    • Nábor zamestnancov
    • Voľné dni
    • Hodnotenia
    • Odporúčania
    • Vozový park
    Marketing
    • Marketing sociálnych sietí
    • Email marketing
    • SMS marketing
    • Eventy
    • Marketingová automatizácia
    • Prieskumy
    Služby
    • Projektové riadenie
    • Pracovné výkazy
    • Práca v teréne
    • Helpdesk
    • Plánovanie
    • Schôdzky
    Produktivita
    • Tímová komunikácia
    • Schvalovania
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Priemyselné odvetvia
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Reštaurácia
    • Fast Food
    • Guest House
    • Beverage distributor
    • Hotel
    Reality
    • Real Estate Agency
    • Architecture Firm
    • Konštrukcia
    • Estate Managament
    • Gardening
    • Property Owner Association
    Poradenstvo
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Výroba
    • Textile
    • Metal
    • Furnitures
    • Jedlo
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware and Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Iní
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Komunita
    Vzdelávanie
    • Tutoriály
    • Dokumentácia
    • Certifikácie
    • Školenie
    • Blog
    • Podcast
    Empower Education
    • Vzdelávací program
    • Scale Up! Business Game
    • Visit Odoo
    Softvér
    • Stiahnuť
    • Porovnanie Community a Enterprise vierzie
    • Releases
    Spolupráca
    • Github
    • Fórum
    • Eventy
    • Preklady
    • Staň sa partnerom
    • Services for Partners
    • Register your Accounting Firm
    Služby
    • Nájdite partnera
    • Nájdite účtovníka
    • Meet an advisor
    • Implementation Services
    • Zákaznícke referencie
    • Podpora
    • Upgrades
    ​Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Získajte demo
  • Cenník
  • Pomoc

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

  • CRM
  • e-Commerce
  • Účtovníctvo
  • Sklady
  • PoS
  • Projektové riadenie
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
Pomoc

Get the new status.

Odoberať

Get notified when there's activity on this post

This question has been flagged
developmentpythoncronormodoo
4743 Zobrazenia
Avatar
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
Avatar
Zrušiť
Mostafa Mohamed Abdel Monaem
Autor

Edited 14-2 3:49 AM Any help ?

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

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

Registrácia
Related Posts Replies Zobrazenia Aktivita
I can't identify which class have this errors
development modules python orm odoo
Avatar
Avatar
Avatar
2
sep 16
7581
How to refresh form view automatic Solved
development python orm odoo odooV8
Avatar
Avatar
Avatar
3
apr 15
10964
Military states module -- help :D Solved
development modules python orm odoo
Avatar
Avatar
1
mar 15
4983
How to add field in 2 tables same time?
python orm odoo
Avatar
0
apr 15
4234
Can't see opportunity that created by others even i have see all leads permission?
development python domain odoo
Avatar
0
apr 22
4227
Komunita
  • Tutoriály
  • Dokumentácia
  • Fórum
Open Source
  • Stiahnuť
  • Github
  • Runbot
  • Preklady
Služby
  • Odoo.sh hosting
  • Podpora
  • Vyššia verzia
  • Custom Developments
  • Vzdelávanie
  • Nájdite účtovníka
  • Nájdite partnera
  • Staň sa partnerom
O nás
  • Naša spoločnosť
  • Majetok značky
  • Kontaktujte nás
  • Pracovné ponuky
  • Eventy
  • Podcast
  • Blog
  • Zákazníci
  • Právne dokumenty • Súkromie
  • Bezpečnosť
الْعَرَبيّة 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 sada podnikových aplikácií s otvoreným zdrojovým kódom, ktoré pokrývajú všetky potreby vašej spoločnosti: CRM, e-shop, účtovníctvo, skladové hospodárstvo, miesto predaja, projektový manažment atď.

Odoo prináša vysokú pridanú hodnotu v jednoduchom použití a súčasne plne integrovanými biznis aplikáciami.

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