Repository
OCA/product-attribute · module folder · Try on Runboat
Module version
1.0.1
Category
Product
Folder size
0.06 MB
License
LGPL-3
Application
No
Auto-installable
No
Website
https://github.com/OCA/product-attribute
Last tracking update
2026-08-07 08:42:54
Authors
Camptocamp, Odoo Community Association (OCA)
Maintainers
Camptocamp, Odoo Community Association (OCA)
Committers
Víctor Martínez, Sébastien Alix, Weblate, OCA-git-bot, oca-ci
Odoo dependencies
odoo/odoo:
- web
- bus
- uom
Python dependencies
openupgradelib
System dependencies
None
Required by
product_packaging_calculator_packaging_level, product_total_weight_from_packaging, stock_packaging_calculator, stock_product_qty_by_packaging
Description
Basic module providing an helper method to calculate the quantity of
product by packaging.

Code Analysis

Views touched (0)

No views found for this module.

HTTP endpoints (0)

No HTTP endpoints found for this module.

Models touched (2)

New fields (0)

No new fields.

Public methods (2)
  • product_qty_by_packaging(self, prod_qty, with_contained=False)
    Calculate quantity by packaging. The minimal quantity is always represented by the UoM of the product. Limitation: fractional quantities are lost. :prod_qty: total qty to satisfy. :with_contained: include calculation of contained packagings. eg: 1 pallet contains 4 big boxes and 6 little boxes. :returns: list of dict in the form [{id: 1, qty: qty_per_package, name: package_name}] If `with_contained` is passed, each element will include the quantity of smaller packaging, like: {contained: [{id: 1, qty: 4, name: "Big box"}]}
  • product_qty_by_packaging_as_str(self, prod_qty, include_total_units=False, only_packaging=False)
    Return a string representing the qty of each packaging. :param prod_qty: the qty of current product to translate to pkg qty :param include_total_units: includes total qty required initially :param only_packaging: exclude units if you have only units. IOW: if the qty does not match any packaging and this flag is true you'll get an empty string instead of `N units`.

New fields (1)
  • product_qty_by_packaging_display Char
    compute='_compute_product_qty_by_packaging_display' string='Qty by packaging'
Public methods (0)

No public methods.

Status
Open migration PR — not merged yet for this version
CI status
checks failing
Open since
16 days ago
Last activity
8 days ago
Repository
OCA/product-attribute
Pull request
[19.0][MIG] product_packaging_calculator (#2363)