- 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. |
||
|---|---|---|
| .. | ||
| demo | ||
| i18n | ||
| models | ||
| readme | ||
| static/description | ||
| tests | ||
| __init__.py | ||
| __manifest__.py | ||
| pyproject.toml | ||
| README.md | ||
| README.rst | ||
| utils.py | ||
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: Quantitypricelist: Pricelist to use for calculationpartner: 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
- Gets base price from pricelist
- Applies any applicable discounts
- Converts price if different UoM is specified
- 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
- Repository: product-attribute
- Original Author: ACSONE SA/NV
- License: AGPL-3
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 calculationsproduct_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