Skip ke Konten
Odoo Menu
  • Login
  • Uji coba gratis
  • Aplikasi
    Keuangan
    • Akuntansi
    • Faktur
    • Pengeluaran
    • Spreadsheet (BI)
    • Dokumen
    • Tanda Tangan
    Sales
    • CRM
    • Sales
    • POS Toko
    • POS Restoran
    • Langganan
    • Rental
    Website
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Rantai Pasokan
    • Inventaris
    • Manufaktur
    • PLM
    • Purchase
    • Maintenance
    • Kualitas
    Sumber Daya Manusia
    • Karyawan
    • Rekrutmen
    • Cuti
    • Appraisal
    • Referensi
    • Armada
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Acara
    • Otomatisasi Marketing
    • Survei
    Layanan
    • Project
    • Timesheet
    • Layanan Lapangan
    • Meja Bantuan
    • Planning
    • Appointment
    Produktivitas
    • Diskusi
    • Approval
    • IoT
    • VoIP
    • Pengetahuan
    • WhatsApp
    Aplikasi pihak ketiga Odoo Studio Platform Odoo Cloud
  • Industri-Industri
    Retail
    • Toko Buku
    • Toko Baju
    • Toko Furnitur
    • Toko Kelontong
    • Toko Hardware
    • Toko Mainan
    Makanan & Hospitality
    • Bar dan Pub
    • Restoran
    • Fast Food
    • Rumah Tamu
    • Distributor Minuman
    • Hotel
    Real Estate
    • Agensi Real Estate
    • Firma Arsitektur
    • Konstruksi
    • Estate Management
    • Perkebunan
    • Asosiasi Pemilik Properti
    Konsultansi
    • Firma Akuntansi
    • Mitra Odoo
    • Agensi Marketing
    • Firma huku
    • Talent Acquisition
    • Audit & Sertifikasi
    Manufaktur
    • Tekstil
    • Logam
    • Perabotan
    • Makanan
    • Brewery
    • Corporate Gift
    Kesehatan & Fitness
    • Sports Club
    • Toko Kacamata
    • Fitness Center
    • Wellness Practitioners
    • Farmasi
    • Salon Rambut
    Perdagangan
    • Handyman
    • IT Hardware & Support
    • Sistem-Sistem Energi Surya
    • Pembuat Sepatu
    • Cleaning Service
    • Layanan HVAC
    Lainnya
    • Organisasi Nirlaba
    • Agen Lingkungan
    • Rental Billboard
    • Fotografi
    • Penyewaan Sepeda
    • Reseller Software
    Browse semua Industri
  • Komunitas
    Belajar
    • Tutorial-tutorial
    • Dokumentasi
    • Sertifikasi
    • Pelatihan
    • Blog
    • Podcast
    Empower Education
    • Program Edukasi
    • Game Bisnis 'Scale Up!'
    • Kunjungi Odoo
    Dapatkan Softwarenya
    • Download
    • Bandingkan Edisi
    • Daftar Rilis
    Kolaborasi
    • Github
    • Forum
    • Acara
    • Terjemahan
    • Menjadi Partner
    • Layanan untuk Partner
    • Daftarkan perusahaan Akuntansi Anda.
    Dapatkan Layanan
    • Temukan Mitra
    • Temukan Akuntan
    • Temui penasihat
    • Layanan Implementasi
    • Referensi Pelanggan
    • Bantuan
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dapatkan demo
  • Harga
  • Bantuan

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

  • CRM
  • e-Commerce
  • Akuntansi
  • Inventaris
  • PoS
  • Project
  • MRP
All apps
Anda harus terdaftar untuk dapat berinteraksi di komunitas.
Semua Post Orang Lencana-Lencana
Label (Lihat semua)
odoo accounting v14 pos v15
Mengenai forum ini
Anda harus terdaftar untuk dapat berinteraksi di komunitas.
Semua Post Orang Lencana-Lencana
Label (Lihat semua)
odoo accounting v14 pos v15
Mengenai forum ini
Help

need porting to odoo 10 please

Langganan

Dapatkan notifikasi saat terdapat aktivitas pada post ini

Pertanyaan ini telah diberikan tanda
portingodoo9odoo10
2 Replies
3492 Tampilan
Avatar
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
Avatar
Buang
Avatar
Dan Čermák
Jawaban Terbai

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
Avatar
Buang
Avatar
Alfie Qashwa
Penulis Jawaban Terbai
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
Avatar
Buang
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).

Menikmati diskusi? Jangan hanya membaca, ikuti!

Buat akun sekarang untuk menikmati fitur eksklufi dan agar terlibat dengan komunitas kami!

Daftar
Post Terkait Replies Tampilan Aktivitas
How to show informations hierarchically in views ?
odoo9 odoo10
Avatar
0
Jul 17
3429
So difficult to describe franchising situation in Odoo?
odoo9 odoo10
Avatar
0
Mar 17
3670
To show all stages in Kanban view Diselesaikan
kanban odoo9 odoo10
Avatar
Avatar
Avatar
Avatar
3
Des 23
22301
Odoo 10: Change datetime picker options for a field Diselesaikan
odoo8.0 odoo9 odoo10
Avatar
Avatar
1
Mei 21
11039
Call from one widget to another widget using odoo js. Diselesaikan
odoo9 odoo10 odoo11
Avatar
Avatar
1
Agu 18
9989
Komunitas
  • Tutorial-tutorial
  • Dokumentasi
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Terjemahan
Layanan
  • Odoo.sh Hosting
  • Bantuan
  • Peningkatan
  • Custom Development
  • Pendidikan
  • Temukan Akuntan
  • Temukan Mitra
  • Menjadi Partner
Tentang Kami
  • Perusahaan kami
  • Aset Merek
  • Hubungi kami
  • Tugas
  • Acara
  • Podcast
  • Blog
  • Pelanggan
  • Hukum • Privasi
  • Keamanan
الْعَرَبيّة 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 adalah rangkaian aplikasi bisnis open source yang mencakup semua kebutuhan perusahaan Anda: CRM, eCommerce, akuntansi, inventaris, point of sale, manajemen project, dan seterusnya.

Mudah digunakan dan terintegrasi penuh pada saat yang sama adalah value proposition unik Odoo.

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