I'm trying to export products with diffrent prices from the PRICE lists can I get help
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Contabilidad
- Inventario
- PoS
- Project
- MRP
Se marcó esta pregunta
There’s no direct way in Odoo to export a report that shows which product has what price across different price lists. However, you can achieve this by writing a Python script that loops through all your products, checks each price list for the product, and then exports the results to an Excel file.
The script below scans all price lists for product variants, retrieves their prices, and writes them into an Excel file:
import xlsxwriter
import odoofrom odoo import api, models
def export_pricelist_data(env):
"""Exports all product prices across all price lists into an Excel file."""
# Create an Excel file
file_path = "/tmp/pricelist_export.xlsx" # Change path if needed
workbook = xlsxwriter.Workbook(file_path)
worksheet = workbook.add_worksheet("Pricelists")
# Define column headers
headers = ["Product Variant", "Product Name", "Pricelist", "Price"]
for col, header in enumerate(headers):
worksheet.write(0, col, header)
row = 1 # Start writing data from row 1
# Fetch all product variants and pricelists
product_variants = env['product.product'].search([])
pricelists = env['product.pricelist'].search([])
for product in product_variants:
for pricelist in pricelists:
price = pricelist._get_product_price(product, 1.0) # Get price for 1 unit
if price: # Only include products that exist in the pricelist
worksheet.write(row, 0, product.default_code or product.id)
worksheet.write(row, 1, product.name)
worksheet.write(row, 2, pricelist.name)
worksheet.write(row, 3, price)
row += 1
# Save and close the workbook
workbook.close()
print(f"Pricelist data exported successfully to {file_path}")
return file_path # Return file path for reference
This is a rough idea about the code and you can refine it the way you want it to be. I hope it helps.
Thanks,
Abhay
Thanks So much abahy
but what about export just one PRICE list but the PRICE is formula OR percentage I need to show the final PRICE of the PRICE list
Hi,
Please refer to the solved forums:
1. https://www.odoo.com/id_ID/forum/help-1/how-to-export-all-products-included-in-a-pricelist-198309
3. https://www.odoo.com/id_ID/forum/help-1/pricelist-export-odoo16-227660
Hope it helps.
¿Le interesa esta conversación? ¡Participe en ella!
Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.
RegistrarsePublicaciones relacionadas | Respuestas | Vistas | Actividad | |
---|---|---|---|---|
|
1
ago 25
|
144 | ||
|
2
ago 25
|
125 | ||
|
3
ago 25
|
770 | ||
|
1
ago 25
|
271 | ||
|
0
ago 25
|
435 |