mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
[MIG] packaging_uom, purchase_packaging, sale_packaging: Migrated to 10.0
This commit is contained in:
committed by
Thomas Binsfeld
parent
7a368c40d3
commit
4e2dcba532
@@ -1,3 +1,5 @@
|
||||
# -*- 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
|
||||
|
||||
@@ -1,26 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Authors: Laetitia Gangloff
|
||||
# Copyright (c) 2015 Acsone SA/NV (http://www.acsone.eu)
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
|
||||
from openerp import api, fields, models
|
||||
# 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
|
||||
|
||||
|
||||
class ProductPackaging(models.Model):
|
||||
@@ -34,13 +15,22 @@ class ProductPackaging(models.Model):
|
||||
uom = self.env['product.uom'].browse(uom_id)
|
||||
return uom.category_id.id
|
||||
|
||||
uom_id = fields.Many2one('product.uom', 'Unit of Measure', required=True,
|
||||
help="It must be in the same category than "
|
||||
"the default unit of measure.")
|
||||
uom_id = fields.Many2one(
|
||||
'product.uom',
|
||||
'Unit of Measure',
|
||||
required=True,
|
||||
help="It must be in the same category than "
|
||||
"the default unit of measure."
|
||||
)
|
||||
uom_categ_domain_id = fields.Many2one(
|
||||
default=_default_uom_categ_domain_id,
|
||||
comodel_name='product.uom.categ')
|
||||
qty = fields.Float(compute="_compute_qty", store=True, readonly=True)
|
||||
comodel_name='product.uom.categ'
|
||||
)
|
||||
qty = fields.Float(
|
||||
compute="_compute_qty",
|
||||
store=True,
|
||||
readonly=True
|
||||
)
|
||||
|
||||
@api.one
|
||||
@api.depends('uom_id', 'product_tmpl_id.uom_id')
|
||||
@@ -49,7 +39,7 @@ class ProductPackaging(models.Model):
|
||||
Compute the quantity by package based on uom
|
||||
"""
|
||||
if self.uom_id and self.product_tmpl_id:
|
||||
self.qty = self.env['product.uom']._compute_qty_obj(
|
||||
self.uom_id, 1, self.product_tmpl_id.uom_id)
|
||||
self.qty = self.uom_id._compute_quantity(
|
||||
1, to_unit=self.product_tmpl_id.uom_id)
|
||||
else:
|
||||
self.qty = 0
|
||||
|
||||
Reference in New Issue
Block a user