[BACKPORT] Packaging UOM from 10.0 to 9.0

This commit is contained in:
Thomas Binsfeld
2019-04-17 15:10:10 +02:00
parent cfd1c74bf4
commit b2deac9acf
26 changed files with 526 additions and 75 deletions

View File

@@ -1,5 +1 @@
# -*- coding: utf-8 -*-
# Copyright 2015-2017 ACSONE SA/NV (<http://acsone.eu>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import product_packaging

View File

@@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-
# Copyright 2015-2017 ACSONE SA/NV (<http://acsone.eu>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, fields, models, _
from odoo.exceptions import ValidationError
from openerp import api, fields, models, _
from openerp.exceptions import ValidationError
class ProductPackaging(models.Model):
@@ -42,8 +42,10 @@ class ProductPackaging(models.Model):
"""
for packaging in self:
if packaging.uom_id and packaging.product_tmpl_id:
packaging.qty = packaging.uom_id._compute_quantity(
1, to_unit=packaging.product_tmpl_id.uom_id)
packaging.qty = self.env['product.uom']._compute_qty_obj(
packaging.uom_id,
1,
to_unit=packaging.product_tmpl_id.uom_id)
else:
packaging.qty = 0