commit 49db20c6d4ac84d42405c2cc345ed8ef587246f1 Author: Suherdy Yacob Date: Mon Jan 12 16:53:56 2026 +0700 first commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..70fe868 --- /dev/null +++ b/.gitignore @@ -0,0 +1,14 @@ +# Python +__pycache__/ +*.py[cod] +*$py.class + +# Odoo +*.pot +*.po + +# IDEs +.vscode/ +.idea/ +*.swp +*~ diff --git a/README.md b/README.md new file mode 100644 index 0000000..87f14a2 --- /dev/null +++ b/README.md @@ -0,0 +1,29 @@ +# MRP Packaging Quantity + +This module extends the Odoo Manufacturing app to allow creating Manufacturing Orders based on product packaging. + +## Features + +- **Packaging Selection**: Adds a `Packaging` field to the Manufacturing Order form. +- **Quantity Packaging**: Adds a `Quantity Packaging` field to specify the number of packages to produce. +- **Auto-Calculation**: Automatically calculates the total `Quantity` (to produce) based on the selected packaging and the number of packages (Quantity = Packaging Size * Quantity Packaging). +- **Manual Override**: Allows users to manually adjust the Quantity if needed, or create MOs without using packaging. + +## Usage + +1. Go to **Manufacturing** > **Operations** > **Manufacturing Orders**. +2. Click **New** to create a manufacturing order. +3. Select a **Product**. +4. (Optional) Select a **Packaging** type (e.g., Box of 10). +5. Enter the **Quantity Packaging** (e.g., 5). +6. The main **Quantity** field will automatically update (e.g., 50). +7. Proceed with the manufacturing order as usual. + +## Installation + +1. Install this module in your Odoo instance. +2. Ensure the user has the "Manage Product Packaging" permission (or the setting is enabled in Inventory/Sales). + +## Authors + +- Suherdy Yacob diff --git a/__init__.py b/__init__.py new file mode 100644 index 0000000..0650744 --- /dev/null +++ b/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/__manifest__.py b/__manifest__.py new file mode 100644 index 0000000..66c6f6d --- /dev/null +++ b/__manifest__.py @@ -0,0 +1,18 @@ +{ + 'name': 'MRP Packaging Quantity', + 'version': '18.0.1.0.0', + 'category': 'Manufacturing', + 'summary': 'Add packaging fields to Manufacturing Orders', + 'description': """ + This module adds 'Packaging' and 'Quantity Packaging' fields to the Manufacturing Order form. + It allows users to define the quantity to produce based on the selected packaging and its quantity. + """, + 'author': 'Suherdy Yacob', + 'depends': ['mrp'], + 'data': [ + 'views/mrp_production_views.xml', + ], + 'installable': True, + 'application': False, + 'license': 'LGPL-3', +} diff --git a/models/__init__.py b/models/__init__.py new file mode 100644 index 0000000..a9e5f13 --- /dev/null +++ b/models/__init__.py @@ -0,0 +1 @@ +from . import mrp_production diff --git a/models/mrp_production.py b/models/mrp_production.py new file mode 100644 index 0000000..a0507b4 --- /dev/null +++ b/models/mrp_production.py @@ -0,0 +1,12 @@ +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_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 diff --git a/views/mrp_production_views.xml b/views/mrp_production_views.xml new file mode 100644 index 0000000..18a5d33 --- /dev/null +++ b/views/mrp_production_views.xml @@ -0,0 +1,14 @@ + + + + mrp.production.form.inherit.packaging + mrp.production + + + + + + + + +