addons-cm/product_get_price_helper
snt b10ba1fc15 [DOC] all: Reorganize and consolidate project documentation
- Create .github/copilot-instructions.md with global development guidelines
- Add comprehensive README.md at project root with quick start guide
- Create docs/ directory for technical documentation
- Move installation and linter docs to docs/
- Add docs/TRANSLATIONS.md with complete translation system guide
- Create README.md for OCA modified addons (product_origin, product_get_price_helper, product_main_seller)
- Document translation best practices (no _() in field definitions)
- Add references between all documentation files
- Clean up project root by moving technical docs to docs/

All documentation now properly references addon-specific READMEs for detailed architecture and implementation.
2026-02-12 16:25:49 +01:00
..
demo build: configurar herramientas de verificación OCA 2026-02-11 16:09:41 +01:00
i18n build: configurar herramientas de verificación OCA 2026-02-11 16:09:41 +01:00
models build: configurar herramientas de verificación OCA 2026-02-11 16:09:41 +01:00
readme build: configurar herramientas de verificación OCA 2026-02-11 16:09:41 +01:00
static/description build: configurar herramientas de verificación OCA 2026-02-11 16:09:41 +01:00
tests build: configurar herramientas de verificación OCA 2026-02-11 16:09:41 +01:00
__init__.py build: configurar herramientas de verificación OCA 2026-02-11 16:09:41 +01:00
__manifest__.py build: configurar herramientas de verificación OCA 2026-02-11 16:09:41 +01:00
pyproject.toml build: configurar herramientas de verificación OCA 2026-02-11 16:09:41 +01:00
README.md [DOC] all: Reorganize and consolidate project documentation 2026-02-12 16:25:49 +01:00
README.rst build: configurar herramientas de verificación OCA 2026-02-11 16:09:41 +01:00
utils.py build: configurar herramientas de verificación OCA 2026-02-11 16:09:41 +01:00

Product Get Price Helper

Summary

Provides a helper utility function to compute product prices with taxes, discounts, and unit of measure conversions.

Features

  • Price Calculation Utility: Helper method get_product_price_for_pricelist
  • Tax Handling: Automatically computes prices with or without taxes
  • Discount Support: Handles single and multiple discounts
  • UoM Conversion: Converts prices between different units of measure
  • Reusable: Can be used by other modules for price calculations

Technical Details

Utility Function

Located in utils.py:

def get_product_price_for_pricelist(
    product,
    qty,
    pricelist,
    partner=None,
    uom=None,
    date=None,
    include_tax=False
)

Parameters:

  • product: Product record (product.product or product.template)
  • qty: Quantity
  • pricelist: Pricelist to use for calculation
  • partner: Partner record (optional)
  • uom: Unit of measure (optional, uses product default if not provided)
  • date: Date for pricelist rules (optional, uses today if not provided)
  • include_tax: Boolean, whether to include taxes in the result

Returns: Decimal price

How It Works

  1. Gets base price from pricelist
  2. Applies any applicable discounts
  3. Converts price if different UoM is specified
  4. Adds taxes if include_tax=True

Dependencies

  • account (Odoo core)
  • product (Odoo core)

Installation

docker-compose exec odoo odoo -d odoo -u product_get_price_helper --stop-after-init

Usage

Example: Calculate Price with Tax

from odoo.addons.product_get_price_helper.utils import get_product_price_for_pricelist

price = get_product_price_for_pricelist(
    product=product_record,
    qty=10,
    pricelist=pricelist_record,
    partner=partner_record,
    include_tax=True
)

Example: Calculate Price with Different UoM

price = get_product_price_for_pricelist(
    product=product_record,
    qty=1,
    pricelist=pricelist_record,
    uom=kg_uom,  # Different from product's default UoM
    include_tax=False
)

OCA Source

Modifications for Kidekoop

None - Used as-is from OCA.

Used By

This helper is used by other modules in the project:

  • product_sale_price_from_pricelist - For automatic price calculations
  • product_price_category - For category-based pricing

Demo Data

Includes demo data with:

  • Sample accounts
  • Sample pricelists

Located in demo/ directory.

Translations

  • Spanish (es)
  • Euskera (eu)

Located in i18n/ directory.


Version: 18.0.1.1.0 License: AGPL-3