Skip to Content
Odoo Meniu
  • Autentificare
  • Try it free
  • Aplicații
    Finanțe
    • Contabilitate
    • Facturare
    • Cheltuieli
    • Spreadsheet (BI)
    • Documente
    • Semn
    Vânzări
    • CRM
    • Vânzări
    • POS Shop
    • POS Restaurant
    • Abonamente
    • Închiriere
    Site-uri web
    • Constructor de site-uri
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Lanț Aprovizionare
    • Inventar
    • Producție
    • PLM
    • Achiziție
    • Maintenance
    • Calitate
    Resurse Umane
    • Angajați
    • Recrutare
    • Time Off
    • Evaluări
    • Referințe
    • Flotă
    Marketing
    • Social Marketing
    • Marketing prin email
    • SMS Marketing
    • Evenimente
    • Automatizare marketing
    • Sondaje
    Servicii
    • Proiect
    • Foi de pontaj
    • Servicii de teren
    • Centru de asistență
    • Planificare
    • Programări
    Productivitate
    • Discuss
    • Aprobări
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Aplicații Terțe Odoo Studio Platforma Odoo Cloud
  • Industrii
    Retail
    • Book Store
    • Magazin de îmbrăcăminte
    • Magazin de Mobilă
    • Magazin alimentar
    • Magazin de materiale de construcții
    • Magazin de jucării
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Distribuitor de băuturi
    • Hotel
    Proprietate imobiliara
    • Real Estate Agency
    • Firmă de Arhitectură
    • Construcție
    • Estate Managament
    • Grădinărit
    • Asociația Proprietarilor de Proprietăți
    Consultanta
    • Firma de Contabilitate
    • Partener Odoo
    • Agenție de marketing
    • Law firm
    • Atragere de talente
    • Audit & Certification
    Producție
    • Textil
    • Metal
    • Mobilier
    • Mâncare
    • Brewery
    • Cadouri corporate
    Health & Fitness
    • Club Sportiv
    • Magazin de ochelari
    • Centru de Fitness
    • Wellness Practitioners
    • Farmacie
    • Salon de coafură
    Trades
    • Handyman
    • IT Hardware and Support
    • Asigurare socială de stat
    • Cizmar
    • Servicii de curățenie
    • HVAC Services
    Altele
    • Organizație nonprofit
    • Agenție de Mediu
    • Închiriere panouri publicitare
    • Fotografie
    • Închiriere biciclete
    • Asigurare socială
    Browse all Industries
  • Comunitate
    Învăță
    • Tutorials
    • Documentație
    • Certificări
    • Instruire
    • Blog
    • Podcast
    Empower Education
    • Program Educațional
    • Scale Up! Business Game
    • Visit Odoo
    Obține Software-ul
    • Descărcare
    • Compară Edițiile
    • Lansări
    Colaborați
    • Github
    • Forum
    • Evenimente
    • Translations
    • Devino Partener
    • Services for Partners
    • Înregistrează-ți Firma de Contabilitate
    Obține Servicii
    • Găsește un Partener
    • Găsiți un contabil
    • Meet an advisor
    • Servicii de Implementare
    • Referințe ale clienților
    • Suport
    • Actualizări
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obține un demo
  • Prețuri
  • Ajutor

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

  • CRM
  • e-Commerce
  • Contabilitate
  • Inventar
  • PoS
  • Proiect
  • MRP
All apps
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Suport

need porting to odoo 10 please

Abonare

Primiți o notificare când există activitate la acestă postare

Această întrebare a fost marcată
portingodoo9odoo10
2 Răspunsuri
3481 Vizualizări
Imagine profil
Alfie Qashwa

def get_price_by_pricelist(self, cr, uid, kwargs):

        result = {}

        all_pricelists_ids = self.pool.get('product.pricelist').search(

            cr, SUPERUSER_ID, [('currency_id', '=', kwargs['currency_id'])])

        for pricelist_obj in self.pool.get('product.pricelist').browse(cr, SUPERUSER_ID, all_pricelists_ids):

            currency_position = pricelist_obj.currency_id.position

            currency_symbol = pricelist_obj.currency_id.symbol

            values = {}

            for product_obj in self.pool.get('product.product').browse(cr, SUPERUSER_ID, kwargs['product_ids'], context={'pricelist': pricelist_obj.id}):

                if currency_position == 'after':

                    price = str(product_obj.price) + " " + currency_symbol

                else:

                    price = currency_symbol + " " + str(product_obj.price)

                if product_obj.to_weight:

                    price = price + '/Kg'

                values[product_obj.id] = [price, product_obj.price]

            result[pricelist_obj.id] = values

        return result

0
Imagine profil
Abandonează
Imagine profil
Dan Čermák
Cel mai bun răspuns

Try this:

@api.multi
def get_price_by_pricelist(self, kwargs):
        result = {}

        all_pricelists_ids = self.env['product.pricelist'].search([('currency_id', '=', kwargs['currency_id'])])
        for pricelist_obj in self.env['product.pricelist'].browse(all_pricelists_ids):

            currency_position = pricelist_obj.currency_id.position
            currency_symbol = pricelist_obj.currency_id.symbol
            values = {}

            for product_obj in self.env['product.product'].browse(kwargs['product_ids'], context={'pricelist': pricelist_obj.id}):
                if currency_position == 'after':
                    price = str(product_obj.price) + " " + currency_symbol

                else:
                    price = currency_symbol + " " + str(product_obj.price)

                if product_obj.to_weight:
                    price = price + '/Kg'

                values[product_obj.id] = [price, product_obj.price]

            result[pricelist_obj.id] = values

        return result

You might have to fix the indentation and I have not tested this, as I do not know the context in which this function is called.

Explanation of the changes:

- in odoo > 7 the old function call signature with self, cr, uid is no longer used, instead you use a function decorator (in this case I think @api.multi might be suitable, which tells python that self gets also populated with the database context)
- database searches are no longer performed via self.pool.get ... but with self.env[].search/browse etc.

For further information, see: https://www.odoo.com/documentation/10.0/reference/orm.html

0
Imagine profil
Abandonează
Imagine profil
Alfie Qashwa
Autor Cel mai bun răspuns
Hello Dan Čermák 


Thank you for your response. I really appreciate that

Well, i did edit the code and it return errors logs:


Odoo Server Error Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/odoo/http.py", line 640, in _handle_exception return super(JsonRequest, self)._handle_exception(exception) File "/usr/lib/python2.7/dist-packages/odoo/http.py", line 677, in dispatch result = self._call_function(**self.params) File "/usr/lib/python2.7/dist-packages/odoo/http.py", line 333, in _call_function return checked_call(self.db, *args, **kwargs) File "/usr/lib/python2.7/dist-packages/odoo/service/model.py", line 101, in wrapper return f(dbname, *args, **kwargs) File "/usr/lib/python2.7/dist-packages/odoo/http.py", line 326, in checked_call result = self.endpoint(*a, **kw) File "/usr/lib/python2.7/dist-packages/odoo/http.py", line 935, in __call__ return self.method(*args, **kw) File "/usr/lib/python2.7/dist-packages/odoo/http.py", line 506, in response_wrap response = f(*args, **kw) File "/usr/lib/python2.7/dist-packages/odoo/addons/web/controllers/main.py", line 885, in call_kw return self._call_kw(model, method, args, kwargs) File "/usr/lib/python2.7/dist-packages/odoo/addons/web/controllers/main.py", line 877, in _call_kw return call_kw(request.env[model], method, args, kwargs) File "/usr/lib/python2.7/dist-packages/odoo/api.py", line 681, in call_kw return call_kw_multi(method, model, args, kwargs) File "/usr/lib/python2.7/dist-packages/odoo/api.py", line 672, in call_kw_multi result = method(recs, *args, **kwargs) TypeError: get_price_by_pricelist() takes exactly 2 arguments (1 given)

This file is a part of pos_multi_pricelist odoo 9 by Webkul

If you can help me porting the module, please give me your email and i will send to you.

Thanks

0
Imagine profil
Abandonează
Dan Čermák

Well, the App claims support for odoo 10 though: https://www.odoo.com/apps/modules/10.0/pos_multi_pricelist/.

Anyway, my guess is, that you can fix the immediate error by changing the function signature from:

def get_price_by_pricelist(self, kwargs):

to:

def get_price_by_pricelist(self, **kwargs):

(This just means, that all remaining function parameters will be saved in the dictionary kwargs.)

However, I think this will not fix everything, as you are querying the dictionary at this point:

kwargs['currency_id']

But the traceback states, that only one parameter was passed (i.e. self). My guess is, that currency_id has to be obtained via different means, either from the context or from a field maybe? This depends too much on the surrounding module, so I am just guessing here.

If you need help with open source software, contact me on github or gitlab (@D4N in both cases).

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

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

Înscrie-te
Related Posts Răspunsuri Vizualizări Activitate
How to show informations hierarchically in views ?
odoo9 odoo10
Imagine profil
0
iul. 17
3424
So difficult to describe franchising situation in Odoo?
odoo9 odoo10
Imagine profil
0
mar. 17
3667
To show all stages in Kanban view Rezolvat
kanban odoo9 odoo10
Imagine profil
Imagine profil
Imagine profil
Imagine profil
3
dec. 23
22295
Odoo 10: Change datetime picker options for a field Rezolvat
odoo8.0 odoo9 odoo10
Imagine profil
Imagine profil
1
mai 21
11032
Call from one widget to another widget using odoo js. Rezolvat
odoo9 odoo10 odoo11
Imagine profil
Imagine profil
1
aug. 18
9982
Comunitate
  • Tutorials
  • Documentație
  • Forum
Open Source
  • Descărcare
  • Github
  • Runbot
  • Translations
Servicii
  • Hosting Odoo.sh
  • Suport
  • Actualizare
  • Custom Developments
  • Educație
  • Găsiți un contabil
  • Găsește un Partener
  • Devino Partener
Despre Noi
  • Compania noastră
  • Active de marcă
  • Contactați-ne
  • Locuri de muncă
  • Evenimente
  • Podcast
  • Blog
  • Clienți
  • Aspecte juridice • Confidențialitate
  • Securitate
الْعَرَبيّة 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 este o suită de aplicații de afaceri open source care acoperă toate nevoile companiei dvs.: CRM, comerț electronic, contabilitate, inventar, punct de vânzare, management de proiect etc.

Propunerea de valoare unică a Odoo este să fie în același timp foarte ușor de utilizat și complet integrat.

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