Skip to Content
Odoo Menu
  • Prisijungti
  • Išbandykite nemokamai
  • Programėlės
    Finansai
    • Apskaita
    • Pateikimas apmokėjimui
    • Sąnaudos
    • Skaičiuoklė (BI)
    • Dokumentai
    • Pasirašymas
    Pardavimai
    • CRM
    • Pardavimai
    • Kasų sistema - Parduotuvė
    • Kasų sistema - Restoranas
    • Prenumeratos
    • Nuoma
    Svetainės
    • Svetainių kūrėjimo įrankis
    • El. Prekyba
    • Internetinis Tinklaraštis
    • Forumas
    • Tiesioginis pokalbis
    • eMokymasis
    Tiekimo grandinė
    • Atsarga
    • Gamyba
    • PLM
    • Įsigijimai
    • Priežiūra
    • Kokybė
    Žmogaus ištekliai
    • Darbuotojai
    • Įdarbinimas
    • Atostogos
    • Įvertinimai
    • Rekomendacijos
    • Transporto priemonės
    Rinkodara
    • Socialinė rinkodara
    • Rinkodara el. paštu
    • SMS rinkodara
    • Renginiai
    • Rinkodaros automatizavimas
    • Apklausos
    Paslaugos
    • Projektas
    • Darbo laiko žiniaraščiai
    • Priežiūros tarnyba
    • Pagalbos tarnyba
    • Planavimas
    • Rezervacijos
    Produktyvumas
    • Diskucija
    • Patvirtinimai
    • IoT
    • VoIP
    • Žinių biblioteka
    • WhatsApp
    Trečiųjų šalių programos Odoo Studija Odoo debesijos platforma
  • Pramonės šakos
    Mažmeninė prekyba
    • Knygynas
    • Drabužių parduotuvė
    • Baldų parduotuvė
    • Maisto prekių parduotuvė
    • Techninės įrangos parduotuvė
    • Žaislų parduotuvė
    Food & Hospitality
    • Barai ir pub'ai
    • Restoranas
    • Greitasis maistas
    • Guest House
    • Gėrimų platintojas
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architektūros įmonė
    • Konstrukcija
    • Estate Managament
    • Sodininkauti
    • Turto savininkų asociacija
    Consulting
    • Accounting Firm
    • Odoo Partneris
    • Marketing Agency
    • Teisinė firma
    • Talentų paieška
    • Auditai & sertifikavimas
    Gamyba
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Įmonių dovanos
    Sveikata & Fitnesas
    • Sporto klubas
    • Akinių parduotuvė
    • Fitneso Centras
    • Sveikatos praktikai
    • Vaistinė
    • Kirpėjas
    Trades
    • Handyman
    • IT įranga ir palaikymas
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Aplinkos agentūra
    • Reklaminių stendų nuoma
    • Fotografavimas
    • Dviračių nuoma
    • Programinės įrangos perpardavėjas
    Browse all Industries
  • Bendrija
    Mokykitės
    • Mokomosios medžiagos
    • Dokumentacija
    • Sertifikatai
    • Mokymai
    • Internetinis Tinklaraštis
    • Tinklalaidės
    Skatinkite švietinimą
    • Švietimo programa
    • Scale Up! Verslo žaidimas
    • Aplankykite Odoo
    Gaukite programinę įrangą
    • Atsisiųsti
    • Palyginkite versijas
    • Leidimai
    Bendradarbiauti
    • Github
    • Forumas
    • Renginiai
    • Vertimai
    • Tapkite partneriu
    • Services for Partners
    • Registruokite jūsų apskaitos įmonę
    Gaukite paslaugas
    • Susiraskite partnerį
    • Susirask buhalterį
    • Susitikti su konsultantu
    • Diegimo paslaugos
    • Klientų rekomendavimas
    • Palaikymas
    • Atnaujinimai
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Gaukite demo
  • Kainodara
  • Pagalba

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

  • CRM
  • e-Commerce
  • Apskaita
  • Atsarga
  • PoS
  • Projektas
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Žymos (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Žymos (View all)
odoo accounting v14 pos v15
About this forum
Pagalba

error fields.function dosen't exist

Prenumeruoti

Get notified when there's activity on this post

This question has been flagged
functionOdoo13.0
2 Replies
3811 Rodiniai
Portretas
himaOdoo

i want to declare a function


_columns = {

        'preno_emp_ar': fields.Char(

            'الاسم'),

        'nom_emp_ar': fields.Char(

            'النسب'),

        'complete_name_ar': fields.function(

            _get_full_name_ar, string='الاسم الكامل', type='char', store={

                'hr.employee': (_update_fill_name_ar, [

                    'complete_name_ar', 'preno_emp_ar', 'nom_emp_ar'],

                    50),

            }, method=True, help='Full arabic name of employee'),

    }



and i get this error module 'odoo.fields' has no attribute 'function'
is there any methode to declare the function ? 



0
Portretas
Atmesti
Portretas
himaOdoo
Autorius Best Answer

i defined the function name like this 


class Hr_Employee(osv.Model):

    _inherit = "hr.employee"


    def _get_full_name_ar(self, cr, uid, ids, fields_name, args, context=None):

        if context is None:

            context = {}

        res = {}

        for emp in self.browse(cr, uid, ids, context=context):

            res[emp.id] = (emp.preno_ar or '') + ' ' + (

                emp.nom_ar or '')

        return res


    def _update_fill_name_ar(self, cr, uid, ids, context=None):

        return ids


    _columns = {

        'preno_ar': fields.Char(

            'الاسم'),

        'nom_ar': fields.Char(

            'النسب'),

        'complete_name_ar': fields.function(

            _get_full_name_ar, string='الاسم الكامل', type='char', store={

                'hr.employee': (_update_fill_name_ar, [

                    'complete_name_ar', 'preno_ar', 'nom_ar'],

                    50),

            }, method=True),

    }


so how is the right way to declare the function inside _columns attribute ? 

0
Portretas
Atmesti
Niyas Raphy (Walnut Software Solutions)

this is the coding structure used in old versions i think, if you have time have a look at the video to see how to define a compute field and its function

himaOdoo
Autorius

based on the video i change my code to the following

class Hr_Employee(osv.Model):

_inherit = "hr.employee"

@api.depends('preno_ar', 'nom_ar')

def _get_full_name_ar(self):

self._get_full_name_ar = (self.preno_ar or '') + ' ' + (self.nom_ar or '')

_columns = {

'preno_ar': fields.Char(

'الاسم'),

'nom_ar': fields.Char(

'النسب'),

'complete_name_ar': fields.Char(

'الاسم الكامل', compute= '_get_full_name_ar', store="True")

}

but i get 'preno_ar' fields dosen't exsist

Niyas Raphy (Walnut Software Solutions)

can you define a field like this without using columns, i think you have defined fields correctly in your previous questions,

preno_ar = fields.Char(string='PreNo Ar', compute='_get_full_name_ar')

himaOdoo
Autorius

i tried this but unfortunatly the module won't be installed and the system stops 'conexion lost'

class hr_corp(models.Model):

_inherit = "hr.employee"

@api.depends('preno_emp_ar', 'nom_emp_ar')

def get_full_name_ar(self):

self._get_full_name_ar = (self.preno_emp_ar or '')+' '+(self.nom_emp_ar or '')

preno_emp_ar = fields.Char(string="الاسم")

nom_emp_ar = fields.Char(string="النسب")

complete_name_ar = fields.Char(string="الاسم الكامل", compute= 'get_full_name_ar', store="True")

Portretas
Niyas Raphy (Walnut Software Solutions)
Best Answer

Hi,

This has got removed in latest versions,

``fields.related`` and ``fields.function`` are replaced by using a normal
field type with either a ``related=`` or a ``compute=`` parameter

Try to define the compute field, for more details on how to add a compute field, see this: How to Write Compute Field and its Function


Thanks

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

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

Registracija
Related Posts Replies Rodiniai Veikla
production of not enough materials for a PO
function
Portretas
Portretas
Portretas
2
rugs. 25
1099
POS Product Category Community Edition
function
Portretas
Portretas
1
rugs. 25
1766
Options for collections management addons for museums or private collection
function
Portretas
0
liep. 25
1161
No funcionan los marcadores de posición dinámicos en las plantillas de correo.
function
Portretas
0
kov. 25
1539
Lo Nuevo Modulo de Gatos V.18
function
Portretas
0
kov. 25
1631
Bendrija
  • Mokomosios medžiagos
  • Dokumentacija
  • Forumas
Atvirasis kodas
  • Atsisiųsti
  • Github
  • Runbot
  • Vertimai
Paslaugos
  • Odoo.sh talpinimas
  • Palaikymas
  • Atnaujinti
  • Pritaikytas programavimo kūrimas
  • Švietimas
  • Susirask buhalterį
  • Susiraskite partnerį
  • Tapkite partneriu
Apie mus
  • Mūsų įmonė
  • Prekės ženklo turtas
  • Susisiekite su mumis
  • Darbo pasiūlymai
  • Renginiai
  • Tinklalaidės
  • Internetinis Tinklaraštis
  • Klientai
  • Teisinis • Privatumas
  • Saugumas
الْعَرَبيّة 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 yra atvirojo kodo verslo programų rinkinys, kuris apima visas įmonės poreikius: CRM, El. Prekybą, Apskaitą, Atsargų, Kasų sistemą, Projektų valdymą ir kt.

Unikali Odoo vertės pasiūla – būti tuo pačiu metu labai lengvai naudojama ir visiškai integruota sistema.

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