Skip to Content
Odoo Menu
  • Prijavi
  • Try it free
  • Aplikacije
    Finance
    • Knjigovodstvo
    • Obračun
    • Stroški
    • Spreadsheet (BI)
    • Dokumenti
    • Podpisovanje
    Prodaja
    • CRM
    • Prodaja
    • POS Shop
    • POS Restaurant
    • Naročnine
    • Najem
    Spletne strani
    • Website Builder
    • Spletna trgovina
    • Blog
    • Forum
    • Pogovor v živo
    • eUčenje
    Dobavna veriga
    • Zaloga
    • Proizvodnja
    • PLM
    • Nabava
    • Vzdrževanje
    • Kakovost
    Kadri
    • Kadri
    • Kadrovanje
    • Odsotnost
    • Ocenjevanja
    • Priporočila
    • Vozni park
    Marketing
    • Družbeno Trženje
    • Email Marketing
    • SMS Marketing
    • Dogodki
    • Avtomatizacija trženja
    • Ankete
    Storitve
    • Projekt
    • Časovnice
    • Storitve na terenu
    • Služba za pomoč
    • Načrtovanje
    • Termini
    Produktivnost
    • Razprave
    • Odobritve
    • IoT
    • Voip
    • Znanje
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industrije
    Trgovina na drobno
    • Book Store
    • Trgovina z oblačili
    • Trgovina s pohištvom
    • Grocery Store
    • Trgovina s strojno opremo računalnikov
    • Trgovina z igračami
    Food & Hospitality
    • Bar and Pub
    • Restavracija
    • Hitra hrana
    • Guest House
    • Beverage Distributor
    • Hotel
    Nepremičnine
    • Real Estate Agency
    • Arhitekturno podjetje
    • Gradbeništvo
    • Estate Management
    • Vrtnarjenje
    • Združenje lastnikov nepremičnin
    Svetovanje
    • Računovodsko podjetje
    • Odoo Partner
    • Marketinška agencija
    • Law firm
    • Pridobivanje talentov
    • Audit & Certification
    Proizvodnja
    • Tekstil
    • Metal
    • Pohištvo
    • Hrana
    • Brewery
    • Poslovna darila
    Health & Fitness
    • Športni klub
    • Trgovina z očali
    • Fitnes center
    • Wellness Practitioners
    • Lekarna
    • Frizerski salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Sistemi sončne energije
    • Izdelovalec čevljev
    • Čistilne storitve
    • HVAC Services
    Ostali
    • Neprofitna organizacija
    • Agencija za okolje
    • Najem oglasnih panojev
    • Fotografija
    • Najem koles
    • Prodajalec programske opreme
    Browse all Industries
  • Skupnost
    Learn
    • Tutorials
    • Dokumentacija
    • Certifikati
    • Šolanje
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Prenesi
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Dogodki
    • Prevodi
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Sklici kupca
    • Podpora
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Določanje cen
  • Pomoč

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

  • CRM
  • e-Commerce
  • Knjigovodstvo
  • Zaloga
  • PoS
  • Projekt
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
Pomoč

How get supplier Price value from supplierinfo, in custom module???

Naroči se

Get notified when there's activity on this post

This question has been flagged
partnercommunitymodulecustomv13
2 Odgovori
4156 Prikazi
Avatar
Lauriola Daniele

Hi, I'm a odoo 13 user (not developer).

In a custom module which add products lines in Purchase Order, I need to add:  product_id, name, price_unit , taxes_id.

product_id, name, taxes_id  values are available in product.product and I can get its value with this code:

'product_id': product.id,
'name': product.name,
'taxes_id': product.supplier_taxes_id,

but 'price_unit' value is in product.supplierinfo (it's supplier price) and if I use code:

'price_unit':  supplierinfo.price

I have error:   NameError: name 'supplierinfo' is not defined

What's my mistake? How I can get Supplier Price value from product.supplierinfo and assign it to 'price_unit'???

I'm not developer and I don't know how create code, please any suggestion it's appreciated with code.

Thanks

Below complete code:

def _add_product(self, product, qty, price):
"""Add line or update qty and price based on barcode."""
corresponding_line = self.order_line.filtered(lambda r: r.product_id.id == product.id)
if corresponding_line:
corresponding_line[0].product_qty += float(qty)
corresponding_line[0].price_unit = float(price) or supplierinfo.price
else:
self.order_line += self.order_line.new({
'product_id': product.id,
'product_qty': qty,
'date_planned': fields.Datetime.to_string(datetime.datetime.now() - dateutil.relativedelta.relativedelta(months=1)),
'name': product.name,
'product_uom': product.uom_id.id,
'price_unit': float(price) or supplierinfo.price,
'taxes_id': product.supplier_taxes_id,
})
return True

0
Avatar
Opusti
Avatar
Lauriola Daniele
Avtor Best Answer

Hi Lee Marocs, I've try it but I have error:

AttributeError: 'purchase.order' object has no attribute 'order_id'
How can I do?

Thanks


0
Avatar
Opusti
Avatar
Anusha
Best Answer

Hi,

  Just try this 

       

def _add_product(self, product, qty, price):
"""Add line or update qty and price based on barcode."""
corresponding_line = self.order_line.filtered(lambda r: r.product_id.id == product.id)
seller_min_qty = product.seller_ids \
.filtered(
lambda r: r.name == self.order_id.partner_id and (not r.product_id or r.product_id == product)) \
.sorted(key=lambda r: r.min_qty)
if seller_min_qty:
price = seller_min_qty[0].price
if corresponding_line:
corresponding_line[0].product_qty += float(qty)
corresponding_line[0].price_unit = price
else:
self.order_line += self.order_line.new({
'product_id': product.id,
'product_qty': qty,
'price_unit': price,
'taxes_id': product.supplier_taxes_id,
})
return True

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

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

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

Prijavi
Related Posts Odgovori Prikazi Aktivnost
Display custom field value on partner kanban Solved
partner module custom kanban value
Avatar
Avatar
2
mar. 21
14370
Custom Module Not Populating in Apps List Solved
module custom
Avatar
Avatar
4
okt. 20
9979
ODOO COMMUNITY V13 - BARCODE Solved
community barcode v13
Avatar
Avatar
1
avg. 24
15633
For Odoo hosted version, how would I upload a custom module? Solved
module upload custom
Avatar
Avatar
Avatar
Avatar
3
feb. 24
11579
importing custom module
module custom importing
Avatar
Avatar
1
nov. 23
3886
Community
  • Tutorials
  • Dokumentacija
  • Forum
Open Source
  • Prenesi
  • Github
  • Runbot
  • Prevodi
Services
  • Odoo.sh Hosting
  • Podpora
  • Nadgradnja
  • Custom Developments
  • Izobraževanje
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Sredstva blagovne znamke
  • Kontakt
  • Zaposlitve
  • Dogodki
  • Podcast
  • Blog
  • Stranke
  • Pravno • Zasebnost
  • Varnost
الْعَرَبيّة 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 a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

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