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
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Managament
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Výroba
    • Textile
    • Metal
    • Furnitures
    • Food
    • 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
    Others
    • 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
  • Help

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

How can I create Employee Code in a sequence field

Odoberať

Get notified when there's activity on this post

This question has been flagged
v6.1hremployee
14 Replies
32824 Zobrazenia
Avatar
Debashis Das

I want to create Employee Code in a sequence field. Please suggest.

0
Avatar
Zrušiť
Abhishek

HI just go for various examples( like in sale ) module and look for sample reference field hope it will help

Sehrish

this will get into detail: https://learnopenerp.blogspot.com/2020/08/generate-create-sequence-number-odoo.html

Avatar
Borni DHIFI
Best Answer

Hi,

create a new sequence :

Settings>>Technical>> Sequences & Identifiers>>Sequence Codes. image description then

Settings>>Technical>> Sequences & Identifiers>>Sequences. image description

then create a new module to add a Employee Code

class hr_employee(osv.osv):
    _inherit = "hr.employee"

    def _get_code(self, cr, uid,context, *args):
        obj_sequence = self.pool.get('ir.sequence')    
        return obj_sequence.next_by_code(cr, uid, 'hr.employee.sequence', context=context)

    _columns = { 'code' : fields.char('Code', size=64), }

    _defaults = { 'code': _get_code, }

 hr_employee()

you can define this sequence in your module :

my_module_data.xml :

<?xml version="1.0" encoding="UTF-8"?>
<openerp>
    <data noupdate="0">
        <record model="ir.sequence.type" id="hr_employee_code_sequence">
            <field name="name">Code sequence hr employee</field>
            <field name="code">hr.employee.sequence</field>
        </record>
        <record model="ir.sequence" id="hr_employee_sequence">
            <field name="name">Sequence For employee</field>
            <field name="code">hr.employee.sequence</field>
            <field name="active">TRUE</field>
            <field name="prefix">EMP</field>
            <field name="number_increment">1</field>
            <field name="number_next">1000</field>
            <field name="implementation">standard</field>
        </record>       
    </data>
</openerp>

and in __openerp__.py:

"init_xml": ["my_module_data.xml"],
6
Avatar
Zrušiť
Urpit Timbadiya

I have an error Constraint Error

code must be unique

Borni DHIFI

you can define a another sequence just replace <field name="code">hr.employee.sequence</field> to <field name="code">hr.employee.sequence2</field>

Urpit Timbadiya

It works now.:) Thank you...

Sam path

Hi, i tried your answer but i'm getting following error {Validate Error The value "crm.helpesk.sequence2" for the field "ir_sequence.code" is not in the selection }

Remya

@Borni This code is absolutely working. I want little different configuration. I have three companies-Software,Hardware,Factory. if employee 1 is in Software then employee id should be SOF001,...if employee 1 is in Hardware then employee id should be HAR001,...if employee 1 is in Factory then employee id should be FAC001,... how it generate automatically?

Remya

@Borni. Did you have any solution for my question?

Remya

@Borni, I have already wrote code this, but its not working. Can you please help me?

Avatar
Kirubanidhi Rajarathinam
Best Answer

In odoo9 we can create a sequence code:

Create a new module name prod_quantity

 class prod_quantity(models.Model):     
  _name = 'products.car'

q_serial_no=fields.Char('Quantity Serial Number',default=lambda obj:

obj.env['ir.sequence'].next_by_code('products.car'))
View:

<form>

     <field name="q_serial_no"/>

</form>


 Create a new view file :

<openerp>

<data noupdate="0">

<record model="ir.sequence" id="product_sequence">

<field name="name">Sequence For Product</field>

<field name="code">products.car</field>

<field name="implementation">standard</field>

<field name="active">TRUE</field>

<field name="prefix">QTY</field>

<field name="padding">3</field>

<field name="number_increment">1</field>

<field name="number_next_actual">1000</field>

</record>

</data>

</openerp>

Apply view file in openerp:

'data': [

'views/sequence.xml',

],

3
Avatar
Zrušiť
Seguridad y Halogenados

It creates a sequence, but will advance the number even if you discard the new records, so it will skip numbers, how can that be fixed?

Avatar
Seguridad y Halogenados
Best Answer

It creates a sequence, but will advance the number even if you discard the new records,  so it will skip numbers, how can that be fixed?

0
Avatar
Zrušiť
Seguridad y Halogenados

please someone delete this post, I added my comment here by mistake

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
How to create an auto increment ID Number field in HR Employee? Solved
hr employee
Avatar
Avatar
Avatar
Avatar
Avatar
7
nov 20
25993
I want create menu that show list of employee birthday in current month. Solved
hr employee
Avatar
Avatar
Avatar
Avatar
Avatar
11
jan 19
10716
Employee Resume - Department Changes (V17)
hr employee department
Avatar
Avatar
1
jún 24
2278
[Odoo 16] How to end collaboration with / separate / offboard an employee Solved
hr employee quickstart
Avatar
1
dec 22
4986
How to manage employee training ?
hr employee training
Avatar
Avatar
Avatar
3
feb 19
10802
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