Skip to Content
Odoo Menu
  • Sign in
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Approvals
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Pricing
  • Help

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

  • CRM
  • e-Commerce
  • Accounting
  • Inventory
  • PoS
  • Project
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
Help

How to Import Updated Price List? v12

Subscribe

Get notified when there's activity on this post

This question has been flagged
pricelistpricelist_idodoo12
1 Reply
5048 Views
Avatar
Lindari Solutions

Our client has dynamic market pricing which changes on a weekly basis. We have two price lists: Retail and Wholesale.

When I import the updated price lists into the product.template via .csv file, it creates a duplicate entry instead of overriding the value. Is there a way to override a Price List price?

We started investigated other means of doing this and came across an app that updates the Sale Price and Cost Price, can any one give me suggestions on how I could apply this to our price lists?

class ProductPrice(models.TransientModel):

_name = 'product.price'

name = fields.Many2one('product.template', string="Product", required=True)
sale_price = fields.Integer(string="Sale Price", required=True)
cost_price = fields.Integer(string="Cost Price", required=True)
retail_price = fields.Integer(string="Retail Price", required=True)

def change_product_price(self):
prod_obj = self.env['product.template'].search([('id', '=', self.name.id)])
prod_value = {'list_price': self.sale_price, 'standard_price': self.cost_price, 'product_pricelist.id.fixed_price': self.retail_price}
prod_obj.write(prod_value)
return {
'name': _('Products'),
'view_type': 'form',
'view_mode': 'form',
'res_model': 'product.template',
'type': 'ir.actions.act_window',
'res_id': prod_obj.id,
'context': self.env.context
}

@api.onchange('name')
def get_price(self):
self.sale_price = self.name.list_price
self.cost_price = self.name.standard_price
self.retail_price = self.name.product_pricelist.id.fixed_price
0
Avatar
Discard
Avatar
Lindari Solutions
Author Best Answer

Hope this may be helpful to the community, here's how we solved it:

from odoo import models, fields, api, _
from odoo.addons import decimal_precision as dp
import logging

_logger = logging.getLogger(__name__) class ProductPrice(models.TransientModel): _name = 'product.price' name = fields.Many2one(
'product.template',
string="Product",
required=True,
)
sale_price = fields.Float( string="Sale Price", digits=dp.get_precision('Product Price'), required=True, ) does_retail_exist = fields.Boolean( string="Is there a retail price for this product", default=False, ) retail_price = fields.Float( string="Retail Price", digits=dp.get_precision('Product Price'), required=True,
) does_wholesale_exist = fields.Boolean( string="Is there a wholesale price for this product", default=False,
) wholesale_price = fields.Float( string="Wholesale Price", digits=dp.get_precision('Product Price'), required=True, )
def change_product_price(self): _logger.info('[CHANGE PRICE]') prod_obj = self.env['product.template'].search([('id', '=', self.name.id)]) # Set list price if self.does_retail_exist == False: prod_value = {'list_price': self.sale_price} prod_obj.write(prod_value) else: prod_value = {'list_price': self.retail_price} prod_obj.write(prod_value)
# Set retail and wholesale price if they exist for child in prod_obj.item_ids: _logger.info('[CHANGE PRICE] - Name: %s Value: %f', child.pricelist_id.name, child.fixed_price) if child.pricelist_id.name == 'Retail Price': 
child.write({'fixed_price': self.retail_price}) elif child.pricelist_id.name == 'Wholesale Price': 
child.write({'fixed_price': self.wholesale_price}) return { 'name': _('Products'), 'view_type': 'form', 'view_mode': 'form', 'res_model': 'product.template', 'type': 'ir.actions.act_window', 'res_id': prod_obj.id, 'context': self.env.context } @api.onchange('name') def get_price(self): _logger.info('[GET PRICE]') self.does_retail_exist = False self.does_wholesale_exist = False self.sale_price = self.name.list_price for child in self.name.item_ids: _logger.info('[PRODUCT PRICE] - Name: %s Value: %f', child.pricelist_id.name, child.fixed_price) if child.pricelist_id.name == 'Retail Price': 
self.does_retail_exist = True self.retail_price = child.fixed_price elif child.pricelist_id.name == 'Wholesale Price': 
self.does_wholesale_exist = True self.wholesale_price = child.fixed_price
0
Avatar
Discard
Enjoying the discussion? Don't just read, join in!

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

Sign up
Related Posts Replies Views Activity
Promotion program: filter based on pricelist id (V13)
filter pricelist pricelist_id
Avatar
Avatar
1
Dec 20
2327
How to have a primary price list that applies to everyone that hasn't any other price list added?
ecommerce pricelist odoo12
Avatar
0
Nov 20
2665
Odoo pricelist items - apply on product subselection Solved
community sale pricelist odoo12
Avatar
Avatar
1
Nov 19
8459
Price list update
pricelist
Avatar
Avatar
1
Jun 25
1411
'Discount' Pricelist not show up in Product detail page
pricelist
Avatar
2
Apr 25
1615
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security
الْعَرَبيّة 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