first commit
This commit is contained in:
commit
49db20c6d4
14
.gitignore
vendored
Normal file
14
.gitignore
vendored
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
# Python
|
||||||
|
__pycache__/
|
||||||
|
*.py[cod]
|
||||||
|
*$py.class
|
||||||
|
|
||||||
|
# Odoo
|
||||||
|
*.pot
|
||||||
|
*.po
|
||||||
|
|
||||||
|
# IDEs
|
||||||
|
.vscode/
|
||||||
|
.idea/
|
||||||
|
*.swp
|
||||||
|
*~
|
||||||
29
README.md
Normal file
29
README.md
Normal file
@ -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
|
||||||
1
__init__.py
Normal file
1
__init__.py
Normal file
@ -0,0 +1 @@
|
|||||||
|
from . import models
|
||||||
18
__manifest__.py
Normal file
18
__manifest__.py
Normal file
@ -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',
|
||||||
|
}
|
||||||
1
models/__init__.py
Normal file
1
models/__init__.py
Normal file
@ -0,0 +1 @@
|
|||||||
|
from . import mrp_production
|
||||||
12
models/mrp_production.py
Normal file
12
models/mrp_production.py
Normal file
@ -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
|
||||||
14
views/mrp_production_views.xml
Normal file
14
views/mrp_production_views.xml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<odoo>
|
||||||
|
<record id="mrp_production_form_view_inherit_packaging" model="ir.ui.view">
|
||||||
|
<field name="name">mrp.production.form.inherit.packaging</field>
|
||||||
|
<field name="model">mrp.production</field>
|
||||||
|
<field name="inherit_id" ref="mrp.mrp_production_form_view"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<xpath expr="//field[@name='product_qty']/.." position="after">
|
||||||
|
<field name="packaging_id" groups="product.group_stock_packaging"/>
|
||||||
|
<field name="packaging_qty" groups="product.group_stock_packaging"/>
|
||||||
|
</xpath>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
</odoo>
|
||||||
Loading…
Reference in New Issue
Block a user