diff --git a/__manifest__.py b/__manifest__.py
index 66c6f6d..d809af1 100644
--- a/__manifest__.py
+++ b/__manifest__.py
@@ -1,6 +1,6 @@
{
'name': 'MRP Packaging Quantity',
- 'version': '18.0.1.0.0',
+ 'version': '19.0.1.0.1',
'category': 'Manufacturing',
'summary': 'Add packaging fields to Manufacturing Orders',
'description': """
@@ -8,7 +8,7 @@
It allows users to define the quantity to produce based on the selected packaging and its quantity.
""",
'author': 'Suherdy Yacob',
- 'depends': ['mrp'],
+ 'depends': ['mrp', 'product'],
'data': [
'views/mrp_production_views.xml',
],
diff --git a/models/mrp_production.py b/models/mrp_production.py
index a0507b4..feb87c8 100644
--- a/models/mrp_production.py
+++ b/models/mrp_production.py
@@ -3,10 +3,10 @@ from odoo import api, fields, models
class MrpProduction(models.Model):
_inherit = 'mrp.production'
- packaging_id = fields.Many2one('product.packaging', string='Packaging', domain="[('product_id', '=', product_id)]", check_company=True)
+ packaging_id = fields.Many2one('product.uom', string='Packaging', domain="[('product_id', '=', product_id)]", check_company=True)
packaging_qty = fields.Float('Quantity Packaging', default=0.0, digits='Product Unit of Measure')
@api.onchange('packaging_id', 'packaging_qty')
def _onchange_packaging_qty(self):
if self.packaging_id and self.packaging_qty:
- self.product_qty = self.packaging_id.qty * self.packaging_qty
+ self.product_qty = self.packaging_id.uom_id._compute_quantity(self.packaging_qty, self.product_uom_id)
diff --git a/views/mrp_production_views.xml b/views/mrp_production_views.xml
index 18a5d33..e4ba039 100644
--- a/views/mrp_production_views.xml
+++ b/views/mrp_production_views.xml
@@ -6,8 +6,8 @@
-
-
+
+