Overslaan naar inhoud
Odoo Menu
  • Aanmelden
  • Probeer het gratis
  • Apps
    Financiën
    • Boekhouding
    • Facturatie
    • Onkosten
    • Spreadsheet (BI)
    • Documenten
    • Ondertekenen
    Verkoop
    • CRM
    • Verkoop
    • Kassasysteem winkel
    • Kassasysteem Restaurant
    • Abonnementen
    • Verhuur
    Websites
    • Websitebouwer
    • E-commerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Bevoorradingsketen
    • Voorraad
    • Productie
    • PLM
    • Inkoop
    • Onderhoud
    • Kwaliteit
    Personeelsbeheer
    • Werknemers
    • Werving & Selectie
    • Verlof
    • Evaluaties
    • Aanbevelingen
    • Wagenpark
    Marketing
    • Social media Marketing
    • E-mailmarketing
    • SMS Marketing
    • Evenementen
    • Marketingautomatisering
    • Enquêtes
    Diensten
    • Project
    • Urenstaten
    • Buitendienst
    • Helpdesk
    • Planning
    • Afspraken
    Productiviteit
    • Chat
    • Goedkeuringen
    • IoT
    • VoIP
    • Kennis
    • WhatsApp
    Apps van derden Odoo Studio Odoo Cloud Platform
  • Bedrijfstakken
    Detailhandel
    • Boekhandel
    • kledingwinkel
    • Meubelzaak
    • Supermarkt
    • Bouwmarkt
    • Speelgoedwinkel
    Food & Hospitality
    • Bar en Pub
    • Restaurant
    • Fastfood
    • Gastenverblijf
    • Drankenhandelaar
    • Hotel
    Vastgoed
    • Makelaarskantoor
    • Architectenbureau
    • Bouw
    • Vastgoedbeheer
    • Tuinieren
    • Vereniging van eigenaren
    Consulting
    • Accountantskantoor
    • Odoo Partner
    • Marketingbureau
    • Advocatenkantoor
    • Talentenwerving
    • Audit & Certificering
    Productie
    • Textiel
    • Metaal
    • Meubels
    • Eten
    • Brewery
    • Relatiegeschenken
    Gezondheid & Fitness
    • Sportclub
    • Opticien
    • Fitnesscentrum
    • Wellness-medewerkers
    • Apotheek
    • Kapper
    Trades
    • Klusjesman
    • IT-hardware & support
    • Zonne-energiesystemen
    • Schoenmaker
    • Schoonmaakdiensten
    • HVAC-diensten
    Andere
    • Non-profitorganisatie
    • Milieuagentschap
    • Verhuur van Billboards
    • Fotograaf
    • Fietsleasing
    • Softwareverkoper
    Browse all Industries
  • Community
    Leren
    • Tutorials
    • Documentatie
    • Certificeringen
    • Training
    • Blog
    • Podcast
    Versterk het onderwijs
    • Onderwijs- programma
    • Scale Up! Business Game
    • Bezoek Odoo
    Download de Software
    • Downloaden
    • Vergelijk edities
    • Releases
    Werk samen
    • Github
    • Forum
    • Evenementen
    • Vertalingen
    • Word een Partner
    • Services for Partners
    • Registreer je accountantskantoor
    Diensten
    • Vind een partner
    • Vind een boekhouder
    • Een adviseur ontmoeten
    • Implementatiediensten
    • Klantreferenties
    • Ondersteuning
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Vraag een demo aan
  • Prijzen
  • Help

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

  • CRM
  • e-Commerce
  • Boekhouding
  • Voorraad
  • PoS
  • Project
  • MRP
All apps
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Help

inherit create function in the new framework ?

Inschrijven

Ontvang een bericht wanneer er activiteit is op deze post

Deze vraag is gerapporteerd
orm8.0odoo
4 Antwoorden
12150 Weergaven
Avatar
Rachid

I did:

    @api.model
    def create(self, cr, uid, vals, context=None):

 

 

Traceback (most recent call last):
  File "/opt/odoo/odoo-8.0/openerp/http.py", line 476, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/opt/odoo/odoo-8.0/openerp/http.py", line 495, in dispatch
    result = self._call_function(**self.params)
  File "/opt/odoo/odoo-8.0/openerp/http.py", line 311, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/opt/odoo/odoo-8.0/openerp/service/model.py", line 113, in wrapper
    return f(dbname, *args, **kwargs)
  File "/opt/odoo/odoo-8.0/openerp/http.py", line 308, in checked_call
    return self.endpoint(*a, **kw)
  File "/opt/odoo/odoo-8.0/openerp/http.py", line 685, in __call__
    return self.method(*args, **kw)
  File "/opt/odoo/odoo-8.0/openerp/http.py", line 360, in response_wrap
    response = f(*args, **kw)
  File "/opt/odoo/odoo-8.0/addons/web/controllers/main.py", line 941, in call_kw
    return self._call_kw(model, method, args, kwargs)
  File "/opt/odoo/odoo-8.0/addons/web/controllers/main.py", line 933, in _call_kw
    return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs)
  File "/opt/odoo/odoo-8.0/openerp/api.py", line 234, in wrapper
    return old_api(self, *args, **kwargs)
  File "/opt/odoo/odoo-8.0/openerp/api.py", line 329, in old_api
    result = method(recs, *args, **kwargs)
TypeError: create() takes at least 4 arguments (2 given)

1
Avatar
Annuleer
Avatar
Emipro Technologies Pvt. Ltd.
Beste antwoord

Hi,

Just do as like below.

@api.model
def create(self, vals, context=None):

3
Avatar
Annuleer
Rachid
Auteur

then how can I call the cr and uid ?

Emipro Technologies Pvt. Ltd.

You can find the cr and uid into self.env. Because this is the new api structure.

Emipro Technologies Pvt. Ltd.

If you get this as an answer then please accept this answer. And give me up vote. Thanks.

Rachid
Auteur

I get this MissingError One of the documents you are trying to access has been deleted, please try again after refreshing. the create function has the line: new_id = super(res_partner, self).create( vals,)

Emipro Technologies Pvt. Ltd.

Hello, For the calling of the create method you have two option. 1) As like normal calling with cr and uid. for that you can call new_id = super(res_partner,self).create(self.env.cr, self.env.uid, vals, context=context) 2) As like new API. For that you can call. new_id = super(res_partner,self).create(vals, context=context) Note : You have to confirm that here self is an recordset.

Rachid
Auteur

I get the TypeError: create() takes exactly 2 arguments (5 given) when I use: new_id = super(res_partner,self).create(self.env.cr, self.env.uid, vals, context=context) AND TypeError: create() got an unexpected keyword argument 'context' WHEN USING new_id = super(res_partner,self).create(vals, context=context) I DIDN'T UNDERSTAND WHAT DO YOU MEAN WITH You have to confirm that here self is an recordset.

Emipro Technologies Pvt. Ltd.

"self" have to be recordset (as like browse record) to call the new api. From the calling just remove the context argument.

Rachid
Auteur

same problem :(

Emipro Technologies Pvt. Ltd.

May I know that you are test into fresh database ?

Rachid
Auteur

no it's not fresh I'm trying update all modules whit option -u all

Emipro Technologies Pvt. Ltd.

Can you try it in fresh database ? Might be it is an error of some other module or may be issue of some data.

Rachid
Auteur

I tryid in a different database but the same problem :(

Avatar
Anil Kesariya
Beste antwoord

Hello Rachid,

Here you go!

    @api.model
    def create(self, vals):
        cr, uid, context = self.env.args  #cursor , user and context can be fetch from env. if there is need of use.
        <Your code gose here...>
        res = super(<your model name>, self).create(vals)

      <Your code gose here...>
        return res

Hope this will helps you.

Anil.

 

2
Avatar
Annuleer
Avatar
Rachid
Auteur Beste antwoord

I copied the same code of create function in the res_partner class HIERE IS

    @api.model
    def create(self, vals):
        if vals.get('website'):
            vals['website'] = self._clean_website(vals['website'])

        print vals

        partner = super(res_partner, self).create(vals)
        self._fields_sync(partner, vals)
        self._handle_first_contact_creation(partner)
        return partner

 

I get the same error One of the documents you are trying to access has been deleted, please try again after refreshing.

0
Avatar
Annuleer
Avatar
Nikunj Nakum
Beste antwoord

@api.model
@api.returns('self', lambda value: value.id)
 def create(self, vals):

 

0
Avatar
Annuleer
Rachid
Auteur

no changes MissingError: ('MissingError', u'One of the documents you are trying to access has been deleted, please try again after refreshing.')

Geniet je van het gesprek? Blijf niet alleen lezen, doe ook mee!

Maak vandaag nog een account aan om te profiteren van exclusieve functies en deel uit te maken van onze geweldige community!

Aanmelden
Gerelateerde posts Antwoorden Weergaven Activiteit
Different between create/new, write/update Opgelost
orm odoo
Avatar
Avatar
Avatar
Avatar
3
sep. 22
19121
how to trace errors like this ? Opgelost
8.0 odoo
Avatar
Avatar
Avatar
Avatar
Avatar
6
dec. 16
12428
bug: creating product depending in product templte
8.0 odoo
Avatar
0
mrt. 15
3861
how to call a rml report from button ?
8.0 odoo
Avatar
Avatar
1
mrt. 15
6725
how to update server and DB?
8.0 odoo
Avatar
Avatar
1
mrt. 15
4251
Community
  • Tutorials
  • Documentatie
  • Forum
Open Source
  • Downloaden
  • Github
  • Runbot
  • Vertalingen
Diensten
  • Odoo.sh Hosting
  • Ondersteuning
  • Upgrade
  • Gepersonaliseerde ontwikkelingen
  • Onderwijs
  • Vind een boekhouder
  • Vind een partner
  • Word een Partner
Over ons
  • Ons bedrijf
  • Merkelementen
  • Neem contact met ons op
  • Vacatures
  • Evenementen
  • Podcast
  • Blog
  • Klanten
  • Juridisch • Privacy
  • Beveiliging
الْعَرَبيّة 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 is een suite van open source zakelijke apps die aan al je bedrijfsbehoeften voldoet: CRM, E-commerce, boekhouding, inventaris, kassasysteem, projectbeheer, enz.

Odoo's unieke waardepropositie is om tegelijkertijd zeer gebruiksvriendelijk en volledig geïntegreerd te zijn.

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