odoo/odoo#184131

Created by Logistics, Mohammad Abdulmoneim (abdu)
Merged at d3fa388cf7c41984b5f7cbc2a81fec3e27a00325

Statuses:

Linked pull requests
label
odoo-dev:master-merge-uom-packaging-abdu
head
e8f34044e1f768cc2eceabfe8cf61908ce4fdd70
merged
9 months ago by Logistics, Arnold Moyaux (arm)
odoo/odoo odoo/enterprise odoo/upgrade
saas-18.1 #184131 #72206 #6629
saas-18.2
saas-18.3
saas-18.4
19.0
master #193490 #77092

[IMP] *: remove uom categories and merge packaging into uom

*: account, account_edi_ubl_cii, analytic, barcodes_gs1_nomenclature, delivery, event_product, hr_expense, hr_timesheet, l10n_ar, l10n_eg_edi_eta, l10n_es_edi_facturae, l10n_hu_edi, l10n_in, l10n_it_edi, l10n_it_stock_ddt, l10n_mx, l10n_us_account, mrp, mrp_subcontracting, mrp_subcontracting_account, mrp_subcontracting_dropshipping, point_of_sale, pos_discount, pos_loyalty, pos_restaurant, pos_sale, product, product_matrix, project_mrp_account, project_purchase, purchase, purchase_mrp, purchase_requisition, purchase_requisition_stock, purchase_stock, repair, sale, sale_expense, sale_management, sale_mrp, sale_project, sale_purchase, sale_stock, sale_timesheet, sale_timesheet_margin, stock, stock_account, stock_delivery, stock_dropshipping, stock_landed_costs, stock_picking_batch, uom, web, website_sale

This commit introduces major changes to units of measurement and product
packaging features:

Removing UoM categories:

Previous to this commit, units were classified into categories such as
length, weight, etc. If the user defined a base unit for a product, any
movement on that product (stock move, order line, etc.) can be only done
in a unit in the same category of the base unit of the product. This
commit removes unit categories and the previously mentioned enforcement.
This is useful for some business cases that need more flexibility (for
example: buying from vendors in pieces and selling in kilograms, etc.).
To allow for some structure, a new field is added to uom.uom model to
define a reference unit for any unit. This will be explained further in
a later section.

Merging product.packaging model into uom.uom:

Previous to this commit, users could activate packagings setting to be
able to define packagings for specific product. This caused some
confusion as there is no intrinsic difference between a packaging and a
unit. Another source of confusion is that stock.move,
sale.order.line, purchase.order.line, etc. had two different fields
for the unit and the packaging. They also had two different fields for
the quantity, one based on the unit of the line and the other based on
the packaging. This was confusing for some users and there was also some
technical complexity to mainatain the consistency between those fields.
This commit removes product.packaging model completely and all of its
related fields. If the user wants to define some packaging, they just
need to create a new unit and define its quantity (and optionally its
package type). Then, the user can make this packaging usable on some
product by adding it to the new many2many field "Packagings" uom_ids
on product.template. Users can also define one (or more) barcode for
the packaging of a specific product.

Cleaning uom.uom model:

This commit removes some of the unnecessary fields on uom.uom model
after removing UoM categories. Category, type and color are no longer
needed. Ratio and inverse factor are also removed. Factors now are
defined a bit differently. Now, each unit can (optionally) have a
reference unit (relative_uom_id) on which the user-defined
factor (relative_factor) is based. Since the relative unit can have
another relative unit on its own, a hierarchy of units can be made.
Therefore, the absolute factor (factor) needs to be computed behind
the scenes to be used in quantity and conversion calculations. The
rounding field is also removed from uom.uom model because this
introduced some inconsistency with the decimal accuracy record "Product
Unit of Measure" defined on the system level. After this commit, all
conversions related to UoMs are rounded based on that value.

Cleaning UoM data:

This commit makes some of the data units to be archived by default when
the uom module is installed, so that the list of units is not
cluttered with a lot of units that may not be needed by users.

Misc. changes:

  • This commit removes uom_po_id field from product_template and it
    should be replaced by the unit of the vendor on making a purchase
    order.
  • qty_multiple field is removed from stock.orderpoint and replaced
    by replenishment_uom_id. The new field works in the same way, the
    generated replenishment should be in a multiple of the defined unit.
  • Package types can now have its own routes.

Enterprise PR: odoo/enterprise#72206
Upgrade PR: odoo/upgrade#6629

task-4252043


I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr