@ -0,0 +1,50 @@ | 
				
			|||||
 | 
					.. image:: https://img.shields.io/badge/license-AGPL--3-blue.svg | 
				
			||||
 | 
					    :target: https://www.gnu.org/licenses/agpl-3.0-standalone.html | 
				
			||||
 | 
					    :alt: License: AGPL-3 | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					Catch Weight - Manufacturing | 
				
			||||
 | 
					============================ | 
				
			||||
 | 
					This Module Brings The Catch Weight System In the Manufacturing Module. | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					Configuration | 
				
			||||
 | 
					============= | 
				
			||||
 | 
					* No additional configuration is needed. | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					Company | 
				
			||||
 | 
					------- | 
				
			||||
 | 
					* `Cybrosys Techno Solutions <https://cybrosys.com/>`__ | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					License | 
				
			||||
 | 
					------- | 
				
			||||
 | 
					Affero General Public License, Version 3 (AGPL v3). | 
				
			||||
 | 
					(https://www.gnu.org/licenses/agpl-3.0-standalone.html) | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					Credits | 
				
			||||
 | 
					------- | 
				
			||||
 | 
					Developers: (V16) Swaroop N P, | 
				
			||||
 | 
					            (V17) Jumana Haseen, | 
				
			||||
 | 
					            (V18) Aysha Shalin | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					Contact : odoo@cybrosys.com | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					Contacts | 
				
			||||
 | 
					-------- | 
				
			||||
 | 
					* Mail Contact : odoo@cybrosys.com | 
				
			||||
 | 
					* Website : https://cybrosys.com | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					Bug Tracker | 
				
			||||
 | 
					----------- | 
				
			||||
 | 
					Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					Maintainer | 
				
			||||
 | 
					========== | 
				
			||||
 | 
					.. image:: https://cybrosys.com/images/logo.png | 
				
			||||
 | 
					   :target: https://cybrosys.com | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					This module is maintained by Cybrosys Technologies. | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					For support and more information, please visit `Our Website <https://cybrosys.com/>`__ | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					Further information | 
				
			||||
 | 
					=================== | 
				
			||||
 | 
					HTML Description: `<static/description/index.html>`__ | 
				
			||||
@ -0,0 +1,22 @@ | 
				
			|||||
 | 
					# -*- coding: utf-8 -*- | 
				
			||||
 | 
					############################################################################# | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    Cybrosys Technologies Pvt. Ltd. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) | 
				
			||||
 | 
					#    Author: Aysha Shalin (odoo@cybrosys.info) | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    You can modify it under the terms of the GNU AFFERO | 
				
			||||
 | 
					#    GENERAL PUBLIC LICENSE (AGPL v3), Version 3. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    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 (AGPL v3) for more details. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE | 
				
			||||
 | 
					#    (AGPL v3) along with this program. | 
				
			||||
 | 
					#    If not, see <http://www.gnu.org/licenses/>. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					############################################################################# | 
				
			||||
 | 
					from . import models | 
				
			||||
@ -0,0 +1,44 @@ | 
				
			|||||
 | 
					# -*- coding: utf-8 -*- | 
				
			||||
 | 
					############################################################################# | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    Cybrosys Technologies Pvt. Ltd. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) | 
				
			||||
 | 
					#    Author: Aysha Shalin (odoo@cybrosys.info) | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    You can modify it under the terms of the GNU AFFERO | 
				
			||||
 | 
					#    GENERAL PUBLIC LICENSE (AGPL v3), Version 3. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    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 (AGPL v3) for more details. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE | 
				
			||||
 | 
					#    (AGPL v3) along with this program. | 
				
			||||
 | 
					#    If not, see <http://www.gnu.org/licenses/>. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					############################################################################ | 
				
			||||
 | 
					{ | 
				
			||||
 | 
					    'name': "Catch Weight - Manufacturing", | 
				
			||||
 | 
					    'version': '18.0.1.0.0', | 
				
			||||
 | 
					    'category': 'Manufacturing', | 
				
			||||
 | 
					    'summary': """Catch Weight Management In Manufacturing Module.""", | 
				
			||||
 | 
					    'description': """This Module allows to enable Catch Weight Management | 
				
			||||
 | 
					     System in Manufacturing Module.""", | 
				
			||||
 | 
					    'author': 'Cybrosys Techno Solutions', | 
				
			||||
 | 
					    'company': 'Cybrosys Techno Solutions', | 
				
			||||
 | 
					    'maintainer': 'Cybrosys Techno Solutions', | 
				
			||||
 | 
					    'website': 'https://www.cybrosys.com', | 
				
			||||
 | 
					    'depends': ['mrp', 'mrp_subcontracting', 'stock', 'cw_stock'], | 
				
			||||
 | 
					    'data': [ | 
				
			||||
 | 
					        'views/mrp_bom_views.xml', | 
				
			||||
 | 
					        'views/mrp_production_views.xml', | 
				
			||||
 | 
					        'views/mrp_unbuild_views.xml', | 
				
			||||
 | 
					    ], | 
				
			||||
 | 
					    'images': ['static/description/banner.jpg'], | 
				
			||||
 | 
					    'license': 'AGPL-3', | 
				
			||||
 | 
					    'installable': True, | 
				
			||||
 | 
					    'auto_install': False, | 
				
			||||
 | 
					    'application': False, | 
				
			||||
 | 
					} | 
				
			||||
@ -0,0 +1,6 @@ | 
				
			|||||
 | 
					## Module <cw_mrp> | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					#### 19.04.2025 | 
				
			||||
 | 
					#### Version 18.0.1.0.0 | 
				
			||||
 | 
					##### ADD | 
				
			||||
 | 
					- Initial commit for Catch Weight - Manufacturing | 
				
			||||
@ -0,0 +1,25 @@ | 
				
			|||||
 | 
					# -*- coding: utf-8 -*- | 
				
			||||
 | 
					############################################################################# | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    Cybrosys Technologies Pvt. Ltd. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) | 
				
			||||
 | 
					#    Author: Aysha Shalin (odoo@cybrosys.info) | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    You can modify it under the terms of the GNU AFFERO | 
				
			||||
 | 
					#    GENERAL PUBLIC LICENSE (AGPL v3), Version 3. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    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 (AGPL v3) for more details. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE | 
				
			||||
 | 
					#    (AGPL v3) along with this program. | 
				
			||||
 | 
					#    If not, see <http://www.gnu.org/licenses/>. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					############################################################################# | 
				
			||||
 | 
					from . import mrp_bom | 
				
			||||
 | 
					from . import mrp_bom_line | 
				
			||||
 | 
					from . import mrp_production | 
				
			||||
 | 
					from . import mrp_unbuild | 
				
			||||
@ -0,0 +1,72 @@ | 
				
			|||||
 | 
					# -*- coding: utf-8 -*- | 
				
			||||
 | 
					############################################################################# | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    Cybrosys Technologies Pvt. Ltd. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) | 
				
			||||
 | 
					#    Author: Aysha Shalin (odoo@cybrosys.info) | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    You can modify it under the terms of the GNU AFFERO | 
				
			||||
 | 
					#    GENERAL PUBLIC LICENSE (AGPL v3), Version 3. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    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 (AGPL v3) for more details. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE | 
				
			||||
 | 
					#    (AGPL v3) along with this program. | 
				
			||||
 | 
					#    If not, see <http://www.gnu.org/licenses/>. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					############################################################################# | 
				
			||||
 | 
					from odoo import api, fields, models | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					class MrpBom(models.Model): | 
				
			||||
 | 
					    """Inherited model 'mrp.bom'""" | 
				
			||||
 | 
					    _inherit = 'mrp.bom' | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    cw_qty = fields.Float(string='CW-Qty', digits=(16, 4), | 
				
			||||
 | 
					                          help="Catch weight quantity") | 
				
			||||
 | 
					    category_id = fields.Many2one('uom.category', | 
				
			||||
 | 
					                                  default=lambda self: self.env.ref( | 
				
			||||
 | 
					                                      'uom.product_uom_categ_kgm'), | 
				
			||||
 | 
					                                  help="UOM category of product.") | 
				
			||||
 | 
					    cw_uom_id = fields.Many2one('uom.uom', string='CW-Uom', | 
				
			||||
 | 
					                                help="Catch weight unit of measure", | 
				
			||||
 | 
					                                domain="[('category_id', '=', category_id)]", | 
				
			||||
 | 
					                                store=True) | 
				
			||||
 | 
					    toggle_cw = fields.Boolean(string='is_cw_product', default=False, | 
				
			||||
 | 
					                               help="Check whether uom product or not.") | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    @api.onchange('product_tmpl_id') | 
				
			||||
 | 
					    def _onchange_product(self): | 
				
			||||
 | 
					        """Calculating cw qty and cw uom on changing the product""" | 
				
			||||
 | 
					        self.toggle_cw = bool(self.product_tmpl_id.catch_weigth_ok) | 
				
			||||
 | 
					        self.cw_uom_id = self.product_tmpl_id.cw_uom_id | 
				
			||||
 | 
					        self.cw_qty = self.product_tmpl_id.average_cw_qty | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    @api.onchange('cw_qty') | 
				
			||||
 | 
					    def _onchange_cw_qty(self): | 
				
			||||
 | 
					        """Calculating product qty on changing the cw quantity""" | 
				
			||||
 | 
					        if self.toggle_cw and self.product_tmpl_id.average_cw_qty != 0: | 
				
			||||
 | 
					            if self.cw_uom_id == self.product_uom_id: | 
				
			||||
 | 
					                self.product_qty = self.cw_qty | 
				
			||||
 | 
					            else: | 
				
			||||
 | 
					                self.product_qty = self.cw_qty / self.product_tmpl_id.average_cw_qty | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    @api.onchange('product_qty') | 
				
			||||
 | 
					    def _onchange_product_qty(self): | 
				
			||||
 | 
					        """Calculating cw qty on changing the product quantity""" | 
				
			||||
 | 
					        if self.toggle_cw: | 
				
			||||
 | 
					            if self.cw_uom_id == self.product_uom_id: | 
				
			||||
 | 
					                self.cw_qty = self.product_qty | 
				
			||||
 | 
					            else: | 
				
			||||
 | 
					                self.cw_qty = self.product_tmpl_id.average_cw_qty * self.product_qty | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    @api.onchange('product_uom_id', 'cw_uom_id') | 
				
			||||
 | 
					    def compute_weight(self): | 
				
			||||
 | 
					        """Calculating the cw qty based on product uom""" | 
				
			||||
 | 
					        if (self.product_tmpl_id.catch_weigth_ok and self.cw_uom_id and | 
				
			||||
 | 
					                self.product_uom_id.category_id == self.cw_uom_id.category_id): | 
				
			||||
 | 
					            self.cw_qty = self.cw_uom_id.factor / self.product_uom_id.factor | 
				
			||||
@ -0,0 +1,67 @@ | 
				
			|||||
 | 
					# -*- coding: utf-8 -*- | 
				
			||||
 | 
					############################################################################# | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    Cybrosys Technologies Pvt. Ltd. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) | 
				
			||||
 | 
					#    Author: Aysha Shalin (odoo@cybrosys.info) | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    You can modify it under the terms of the GNU AFFERO | 
				
			||||
 | 
					#    GENERAL PUBLIC LICENSE (AGPL v3), Version 3. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    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 (AGPL v3) for more details. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE | 
				
			||||
 | 
					#    (AGPL v3) along with this program. | 
				
			||||
 | 
					#    If not, see <http://www.gnu.org/licenses/>. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					############################################################################# | 
				
			||||
 | 
					from odoo import api, fields, models | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					class MrpBomLine(models.Model): | 
				
			||||
 | 
					    """Inherited model 'mrp.bom.line'""" | 
				
			||||
 | 
					    _inherit = 'mrp.bom.line' | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    cw_qty = fields.Float(string='CW-Qty', digits=(16, 4), | 
				
			||||
 | 
					                          help="Catch weight quantity") | 
				
			||||
 | 
					    category_id = fields.Many2one('uom.category', | 
				
			||||
 | 
					                                  default=lambda self: self.env.ref( | 
				
			||||
 | 
					                                      'uom.product_uom_categ_kgm'), | 
				
			||||
 | 
					                                  help="UOM category of product.") | 
				
			||||
 | 
					    cw_uom_id = fields.Many2one('uom.uom', string='CW-Uom', | 
				
			||||
 | 
					                                domain="[('category_id', '=', category_id)]", | 
				
			||||
 | 
					                                store=True, help="Catch Weight Uom") | 
				
			||||
 | 
					    cw_hide = fields.Boolean(string='CW-Hide', default=False, | 
				
			||||
 | 
					                             help="Check whether uom product or not.") | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    @api.onchange('product_id', 'product_qty') | 
				
			||||
 | 
					    def onchange_bom_product_id(self): | 
				
			||||
 | 
					        """Update cw qty and uom based on product and quantity changes""" | 
				
			||||
 | 
					        for rec in self: | 
				
			||||
 | 
					            rec.cw_uom_id = rec.product_id.cw_uom_id.id | 
				
			||||
 | 
					            rec.cw_hide = bool(rec.product_id.catch_weigth_ok) | 
				
			||||
 | 
					            if rec.cw_uom_id == rec.product_uom_id: | 
				
			||||
 | 
					                rec.cw_qty = rec.product_qty | 
				
			||||
 | 
					            else: | 
				
			||||
 | 
					                rec.cw_qty = rec.product_qty * rec.product_id.average_cw_qty | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    @api.onchange('cw_qty') | 
				
			||||
 | 
					    def onchange_bom_cw_qty(self): | 
				
			||||
 | 
					        """Update product qty based on cw quantity""" | 
				
			||||
 | 
					        for rec in self: | 
				
			||||
 | 
					            if rec.product_id.catch_weigth_ok and rec.product_qty and rec.cw_qty != 0 and rec.product_id.average_cw_qty != 0: | 
				
			||||
 | 
					                if rec.cw_uom_id == rec.product_uom_id: | 
				
			||||
 | 
					                    rec.product_qty = rec.cw_qty | 
				
			||||
 | 
					                else: | 
				
			||||
 | 
					                    rec.product_qty = rec.cw_qty / rec.product_id.average_cw_qty | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    @api.onchange('product_uom_id', 'cw_uom_id') | 
				
			||||
 | 
					    def compute_weight(self): | 
				
			||||
 | 
					        """Update cw qty based on product uom""" | 
				
			||||
 | 
					        for rec in self: | 
				
			||||
 | 
					            if rec.product_id.catch_weigth_ok and rec.cw_uom_id and rec.product_uom_id.category_id == rec.cw_uom_id.category_id: | 
				
			||||
 | 
					                rec.cw_qty = rec.cw_uom_id.factor / rec.product_uom_id.factor | 
				
			||||
@ -0,0 +1,59 @@ | 
				
			|||||
 | 
					# -*- coding: utf-8 -*- | 
				
			||||
 | 
					############################################################################# | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    Cybrosys Technologies Pvt. Ltd. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) | 
				
			||||
 | 
					#    Author: Aysha Shalin (odoo@cybrosys.info) | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    You can modify it under the terms of the GNU AFFERO | 
				
			||||
 | 
					#    GENERAL PUBLIC LICENSE (AGPL v3), Version 3. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    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 (AGPL v3) for more details. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE | 
				
			||||
 | 
					#    (AGPL v3) along with this program. | 
				
			||||
 | 
					#    If not, see <http://www.gnu.org/licenses/>. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					############################################################################# | 
				
			||||
 | 
					from odoo import api, fields, models | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					class MrpProduction(models.Model): | 
				
			||||
 | 
					    """Inherited model 'mrp.production'""" | 
				
			||||
 | 
					    _inherit = 'mrp.production' | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    cw_qty = fields.Float(string='CW-Qty', digits=(16, 4), | 
				
			||||
 | 
					                          help="Catch weight quantity") | 
				
			||||
 | 
					    category_id = fields.Many2one('uom.category', | 
				
			||||
 | 
					                                  default=lambda self: self.env.ref( | 
				
			||||
 | 
					                                      'uom.product_uom_categ_kgm'), | 
				
			||||
 | 
					                                  help="UOM category of product.") | 
				
			||||
 | 
					    cw_uom_id = fields.Many2one('uom.uom', string='CW-Uom', | 
				
			||||
 | 
					                                help="Catch weight unit of measure.", | 
				
			||||
 | 
					                                domain="[('category_id', '=', category_id)]", | 
				
			||||
 | 
					                                store=True) | 
				
			||||
 | 
					    toggle_cw = fields.Boolean(string='is_cw_product', default=False, | 
				
			||||
 | 
					                               help="Check whether uom product or not.") | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    @api.onchange('product_tmpl_id') | 
				
			||||
 | 
					    def _onchange_product(self): | 
				
			||||
 | 
					        """Updating the cw qty and cw uom on changing the product""" | 
				
			||||
 | 
					        self.toggle_cw = bool(self.product_tmpl_id.catch_weigth_ok) | 
				
			||||
 | 
					        self.cw_uom_id = self.product_tmpl_id.cw_uom_id | 
				
			||||
 | 
					        self.cw_qty = self.product_tmpl_id.average_cw_qty | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    @api.onchange('cw_qty') | 
				
			||||
 | 
					    def _onchange_cw_qty(self): | 
				
			||||
 | 
					        """Updating the product qty on changing the cw quantity""" | 
				
			||||
 | 
					        if self.toggle_cw and self.product_tmpl_id.average_cw_qty != 0: | 
				
			||||
 | 
					            self.product_qty = self.cw_qty / self.product_tmpl_id.average_cw_qty | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    @api.onchange('product_qty') | 
				
			||||
 | 
					    def _onchange_product_qty(self): | 
				
			||||
 | 
					        """Updating cw qty on changing the product quantity""" | 
				
			||||
 | 
					        if self.toggle_cw: | 
				
			||||
 | 
					            self.cw_qty = self.product_tmpl_id.average_cw_qty * self.product_qty | 
				
			||||
@ -0,0 +1,72 @@ | 
				
			|||||
 | 
					# -*- coding: utf-8 -*- | 
				
			||||
 | 
					############################################################################# | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    Cybrosys Technologies Pvt. Ltd. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) | 
				
			||||
 | 
					#    Author: Aysha Shalin (odoo@cybrosys.info) | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    You can modify it under the terms of the GNU AFFERO | 
				
			||||
 | 
					#    GENERAL PUBLIC LICENSE (AGPL v3), Version 3. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    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 (AGPL v3) for more details. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE | 
				
			||||
 | 
					#    (AGPL v3) along with this program. | 
				
			||||
 | 
					#    If not, see <http://www.gnu.org/licenses/>. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					############################################################################# | 
				
			||||
 | 
					from odoo import api, fields, models | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					class MrpUnbuild(models.Model): | 
				
			||||
 | 
					    """Inherited model 'mrp.unbuild'""" | 
				
			||||
 | 
					    _inherit = 'mrp.unbuild' | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    cw_qty = fields.Float(string='CW-Qty', digits=(16, 4), | 
				
			||||
 | 
					                          help="Catch weight quantity") | 
				
			||||
 | 
					    category_id = fields.Many2one('uom.category', | 
				
			||||
 | 
					                                  default=lambda self: self.env.ref( | 
				
			||||
 | 
					                                      'uom.product_uom_categ_kgm'), | 
				
			||||
 | 
					                                  help="UOM category of product.") | 
				
			||||
 | 
					    cw_uom_id = fields.Many2one('uom.uom', string='CW-Uom', | 
				
			||||
 | 
					                                help="Catch weight unit of measure.", | 
				
			||||
 | 
					                                domain="[('category_id', '=', category_id)]", | 
				
			||||
 | 
					                                store=True) | 
				
			||||
 | 
					    toggle_cw = fields.Boolean(string='is_cw_product', default=False, | 
				
			||||
 | 
					                               help="Check whether uom product or not.") | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    @api.onchange('product_id') | 
				
			||||
 | 
					    def _onchange_product(self): | 
				
			||||
 | 
					        """Updating the cw qty and cw uom on changing the product_id""" | 
				
			||||
 | 
					        self.toggle_cw = bool(self.product_id.catch_weigth_ok) | 
				
			||||
 | 
					        self.cw_uom_id = self.product_id.cw_uom_id | 
				
			||||
 | 
					        self.cw_qty = self.product_id.average_cw_qty * self.product_qty | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    @api.onchange('cw_qty') | 
				
			||||
 | 
					    def _onchange_cw_qty_unbuild(self): | 
				
			||||
 | 
					        """Updating the product quantity based on the cw quantity""" | 
				
			||||
 | 
					        if self.toggle_cw and self.product_id.average_cw_qty != 0: | 
				
			||||
 | 
					            if self.cw_uom_id == self.product_uom_id: | 
				
			||||
 | 
					                self.product_qty = self.cw_qty | 
				
			||||
 | 
					            else: | 
				
			||||
 | 
					                self.product_qty = self.cw_qty / self.product_id.average_cw_qty | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    @api.onchange('product_qty') | 
				
			||||
 | 
					    def _onchange_product_qty_unbuild(self): | 
				
			||||
 | 
					        """Updating the cw qty on changing the product quantity""" | 
				
			||||
 | 
					        if self.toggle_cw: | 
				
			||||
 | 
					            if self.cw_uom_id == self.product_uom_id: | 
				
			||||
 | 
					                self.cw_qty = self.product_qty | 
				
			||||
 | 
					            else: | 
				
			||||
 | 
					                self.cw_qty = self.product_id.average_cw_qty * self.product_qty | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    @api.onchange('product_uom_id', 'cw_uom_id') | 
				
			||||
 | 
					    def compute_weight(self): | 
				
			||||
 | 
					        """Updating the cw qty based on uom""" | 
				
			||||
 | 
					        if (self.product_id.catch_weigth_ok and self.cw_uom_id and | 
				
			||||
 | 
					                self.product_uom_id.category_id == self.cw_uom_id.category_id): | 
				
			||||
 | 
					            self.cw_qty = self.cw_uom_id.factor / self.product_uom_id.factor | 
				
			||||
| 
		 After Width: | Height: | Size: 1.1 KiB  | 
| 
		 After Width: | Height: | Size: 210 KiB  | 
| 
		 After Width: | Height: | Size: 209 KiB  | 
| 
		 After Width: | Height: | Size: 109 KiB  | 
| 
		 After Width: | Height: | Size: 495 B  | 
| 
		 After Width: | Height: | Size: 1.0 KiB  | 
| 
		 After Width: | Height: | Size: 624 B  | 
| 
		 After Width: | Height: | Size: 136 KiB  | 
| 
		 After Width: | Height: | Size: 214 KiB  | 
| 
		 After Width: | Height: | Size: 36 KiB  | 
| 
		 After Width: | Height: | Size: 3.6 KiB  | 
| 
		 After Width: | Height: | Size: 310 B  | 
| 
		 After Width: | Height: | Size: 929 B  | 
| 
		 After Width: | Height: | Size: 1.3 KiB  | 
| 
		 After Width: | Height: | Size: 3.3 KiB  | 
| 
		 After Width: | Height: | Size: 1.4 KiB  | 
| 
		 After Width: | Height: | Size: 17 KiB  | 
| 
		 After Width: | Height: | Size: 542 B  | 
| 
		 After Width: | Height: | Size: 576 B  | 
| 
		 After Width: | Height: | Size: 733 B  | 
| 
		 After Width: | Height: | Size: 4.3 KiB  | 
| 
		 After Width: | Height: | Size: 1.2 KiB  | 
| 
		 After Width: | Height: | Size: 4.0 KiB  | 
| 
		 After Width: | Height: | Size: 1.7 KiB  | 
| 
		 After Width: | Height: | Size: 738 KiB  | 
| 
		 After Width: | Height: | Size: 2.2 KiB  | 
| 
		 After Width: | Height: | Size: 911 B  | 
| 
		 After Width: | Height: | Size: 1.1 KiB  | 
| 
		 After Width: | Height: | Size: 1.2 KiB  | 
| 
		 After Width: | Height: | Size: 1.2 KiB  | 
| 
		 After Width: | Height: | Size: 600 B  | 
| 
		 After Width: | Height: | Size: 673 B  | 
| 
		 After Width: | Height: | Size: 2.0 KiB  | 
| 
		 After Width: | Height: | Size: 462 B  | 
| 
		 After Width: | Height: | Size: 2.1 KiB  | 
| 
		 After Width: | Height: | Size: 926 B  | 
| 
		 After Width: | Height: | Size: 9.0 KiB  | 
| 
		 After Width: | Height: | Size: 23 KiB  | 
| 
		 After Width: | Height: | Size: 7.0 KiB  | 
| 
		 After Width: | Height: | Size: 878 B  | 
| 
		 After Width: | Height: | Size: 1.2 KiB  | 
| 
		 After Width: | Height: | Size: 653 B  | 
| 
		 After Width: | Height: | Size: 800 B  | 
| 
		 After Width: | Height: | Size: 905 B  | 
| 
		 After Width: | Height: | Size: 189 KiB  | 
| 
		 After Width: | Height: | Size: 4.3 KiB  | 
| 
		 After Width: | Height: | Size: 839 B  | 
| 
		 After Width: | Height: | Size: 1.7 KiB  | 
| 
		 After Width: | Height: | Size: 5.9 KiB  | 
| 
		 After Width: | Height: | Size: 1.6 KiB  | 
| 
		 After Width: | Height: | Size: 34 KiB  | 
| 
		 After Width: | Height: | Size: 26 KiB  | 
| 
		 After Width: | Height: | Size: 3.8 KiB  | 
| 
		 After Width: | Height: | Size: 23 KiB  | 
| 
		 After Width: | Height: | Size: 1.9 KiB  | 
| 
		 After Width: | Height: | Size: 2.3 KiB  | 
| 
		 After Width: | Height: | Size: 427 B  | 
| 
		 After Width: | Height: | Size: 627 B  | 
| 
		 After Width: | Height: | Size: 1.1 KiB  | 
| 
		 After Width: | Height: | Size: 1.2 KiB  | 
| 
		 After Width: | Height: | Size: 988 B  | 
| 
		 After Width: | Height: | Size: 3.7 KiB  | 
| 
		 After Width: | Height: | Size: 5.0 KiB  | 
| 
		 After Width: | Height: | Size: 875 B  | 
| 
		 After Width: | Height: | Size: 1.2 KiB  | 
| 
		 After Width: | Height: | Size: 90 KiB  | 
| 
		 After Width: | Height: | Size: 716 KiB  | 
| 
		 After Width: | Height: | Size: 88 KiB  | 
| 
		 After Width: | Height: | Size: 713 KiB  | 
| 
		 After Width: | Height: | Size: 90 KiB  | 
| 
		 After Width: | Height: | Size: 770 KiB  | 
| 
		 After Width: | Height: | Size: 76 KiB  | 
| 
		 After Width: | Height: | Size: 76 KiB  | 
| 
		 After Width: | Height: | Size: 56 KiB  | 
| 
		 After Width: | Height: | Size: 67 KiB  | 
| 
		 After Width: | Height: | Size: 36 KiB  | 
| 
		 After Width: | Height: | Size: 53 KiB  | 
| 
		 After Width: | Height: | Size: 450 KiB  | 
| 
		 After Width: | Height: | Size: 751 KiB  | 
| 
		 After Width: | Height: | Size: 42 KiB  | 
@ -0,0 +1,35 @@ | 
				
			|||||
 | 
					<?xml version="1.0" encoding="utf-8"?> | 
				
			||||
 | 
					<odoo> | 
				
			||||
 | 
					    <!-- Inherited form view of BOM --> | 
				
			||||
 | 
					    <record model="ir.ui.view" id="mrp_bom_form_view"> | 
				
			||||
 | 
					        <field name="name">mrp.bom.view.form.inherit.cw.mrp</field> | 
				
			||||
 | 
					        <field name="model">mrp.bom</field> | 
				
			||||
 | 
					        <field name="inherit_id" ref="mrp.mrp_bom_form_view"/> | 
				
			||||
 | 
					        <field name="arch" type="xml"> | 
				
			||||
 | 
					            <xpath expr="//field[@name='product_id']" position="after"> | 
				
			||||
 | 
					                <field name="toggle_cw" invisible="1"/> | 
				
			||||
 | 
					                <label for="cw_qty" string="CW-Quantity" | 
				
			||||
 | 
					                       invisible="toggle_cw == False" | 
				
			||||
 | 
					                       required="toggle_cw == True"/> | 
				
			||||
 | 
					                <div class="o_row" | 
				
			||||
 | 
					                     invisible="toggle_cw == False" | 
				
			||||
 | 
					                     required="toggle_cw == True"> | 
				
			||||
 | 
					                    <field name="cw_qty"/> | 
				
			||||
 | 
					                    <field name="category_id" invisible="1"/> | 
				
			||||
 | 
					                    <field name="cw_uom_id" | 
				
			||||
 | 
					                           options="{'no_open':True,'no_create':True}"/> | 
				
			||||
 | 
					                </div> | 
				
			||||
 | 
					            </xpath> | 
				
			||||
 | 
					            <xpath expr="//field[@name='bom_line_ids']/list/field[@name='product_qty']" | 
				
			||||
 | 
					                   position="after"> | 
				
			||||
 | 
					                <field name="cw_hide" invisible="1"/> | 
				
			||||
 | 
					                <field name="category_id" invisible="1"/> | 
				
			||||
 | 
					                <field name="cw_qty" | 
				
			||||
 | 
					                       invisible="cw_hide == False"/> | 
				
			||||
 | 
					                <field name="cw_uom_id" | 
				
			||||
 | 
					                       options="{'no_open':True,'no_create':True}" | 
				
			||||
 | 
					                       invisible="cw_hide == False"/> | 
				
			||||
 | 
					            </xpath> | 
				
			||||
 | 
					        </field> | 
				
			||||
 | 
					    </record> | 
				
			||||
 | 
					</odoo> | 
				
			||||
@ -0,0 +1,43 @@ | 
				
			|||||
 | 
					<?xml version="1.0" encoding="utf-8"?> | 
				
			||||
 | 
					<odoo> | 
				
			||||
 | 
					    <!-- Inherited view form of MO --> | 
				
			||||
 | 
					    <record model="ir.ui.view" id="mrp_production_form_view"> | 
				
			||||
 | 
					        <field name="name">mrp.production.view.form.cw.mrp</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='user_id']" position="after"> | 
				
			||||
 | 
					                <field name="toggle_cw" invisible="1"/> | 
				
			||||
 | 
					                <label for="cw_qty" string="CW-Quantity" | 
				
			||||
 | 
					                       inviisible="toggle_cw == False" | 
				
			||||
 | 
					                       required="toggle_cw == True"/> | 
				
			||||
 | 
					                <div class="o_row" | 
				
			||||
 | 
					                     invisible="toggle_cw == False" | 
				
			||||
 | 
					                     required="toggle_cw == True"> | 
				
			||||
 | 
					                    <field name="cw_qty"/> | 
				
			||||
 | 
					                    <field name="category_id" invisible="1"/> | 
				
			||||
 | 
					                    <field name="cw_uom_id" | 
				
			||||
 | 
					                           options="{'no_open':True,'no_create':True}"/> | 
				
			||||
 | 
					                </div> | 
				
			||||
 | 
					            </xpath> | 
				
			||||
 | 
					            <xpath expr="//field[@name='move_raw_ids']/list/field[@name='forecast_availability']" | 
				
			||||
 | 
					                   position="after"> | 
				
			||||
 | 
					                <field name="cw_hide" invisible="1"/> | 
				
			||||
 | 
					                <field name="category_id" invisible="1"/> | 
				
			||||
 | 
					                <field name="cw_demand" string="CW Qty To Consume" | 
				
			||||
 | 
					                       invisible="cw_hide == False" | 
				
			||||
 | 
					                       readonly="parent.state != 'draft' or parent.state not in ['confirmed', 'progress', 'to_close'] or parent.is_planned != True or parent.is_locked == True"/> | 
				
			||||
 | 
					                <field name="cw_uom_id" | 
				
			||||
 | 
					                       invisible="cw_hide == False" | 
				
			||||
 | 
					                       readonly="parent.state != 'draft' or parent.state not in ['confirmed', 'progress', 'to_close'] or parent.is_planned != True or parent.is_locked == True"/> | 
				
			||||
 | 
					                <field name="cw_reserved" string="CW Qty Reserved" | 
				
			||||
 | 
					                       invisible="cw_hide == False" | 
				
			||||
 | 
					                       column_invisible="parent.state in ['draft', 'done']"/> | 
				
			||||
 | 
					                <field name="cw_done" string="CW Qty Consumed" | 
				
			||||
 | 
					                       invisible="cw_hide == False" | 
				
			||||
 | 
					                       column_invisible="parent.state == 'draft'" | 
				
			||||
 | 
					                       readonly="has_tracking != 'none'"/> | 
				
			||||
 | 
					            </xpath> | 
				
			||||
 | 
					        </field> | 
				
			||||
 | 
					    </record> | 
				
			||||
 | 
					</odoo> | 
				
			||||
@ -0,0 +1,50 @@ | 
				
			|||||
 | 
					<?xml version="1.0" encoding="utf-8"?> | 
				
			||||
 | 
					<odoo> | 
				
			||||
 | 
					    <!-- Inherited form view of Unbuild Order --> | 
				
			||||
 | 
					    <record model="ir.ui.view" id="mrp_unbuild_form_view"> | 
				
			||||
 | 
					        <field name="name">mrp.unbuild.view.form.cw.mrp</field> | 
				
			||||
 | 
					        <field name="model">mrp.unbuild</field> | 
				
			||||
 | 
					        <field name="inherit_id" ref="mrp.mrp_unbuild_form_view"/> | 
				
			||||
 | 
					        <field name="arch" type="xml"> | 
				
			||||
 | 
					            <xpath expr="//field[@name='bom_id']" | 
				
			||||
 | 
					                   position="after"> | 
				
			||||
 | 
					                <field name="toggle_cw" invisible="1"/> | 
				
			||||
 | 
					                <field name="category_id" invisible="1"/> | 
				
			||||
 | 
					                <label for="cw_qty" string="CW-Quantity" | 
				
			||||
 | 
					                       invisible="toggle_cw == False" | 
				
			||||
 | 
					                       required="toggle_cw == True"/> | 
				
			||||
 | 
					                <div class="o_row" | 
				
			||||
 | 
					                     invisible="toggle_cw == False" | 
				
			||||
 | 
					                     required="toggle_cw == True"> | 
				
			||||
 | 
					                    <field name="cw_qty"/> | 
				
			||||
 | 
					                    <field name="cw_uom_id" | 
				
			||||
 | 
					                           options="{'no_open':True,'no_create':True}"/> | 
				
			||||
 | 
					                </div> | 
				
			||||
 | 
					            </xpath> | 
				
			||||
 | 
					        </field> | 
				
			||||
 | 
					    </record> | 
				
			||||
 | 
					    <!-- Inherited form view of Unbuild Orders wizard --> | 
				
			||||
 | 
					    <record model="ir.ui.view" id="mrp_unbuild_form_view_simplified"> | 
				
			||||
 | 
					        <field name="name">mrp.unbuild.simplified.cw.inherit</field> | 
				
			||||
 | 
					        <field name="model">mrp.unbuild</field> | 
				
			||||
 | 
					        <field name="inherit_id" | 
				
			||||
 | 
					               ref="mrp.mrp_unbuild_form_view_simplified"/> | 
				
			||||
 | 
					        <field name="arch" type="xml"> | 
				
			||||
 | 
					            <xpath expr="//field[@name='bom_id']" | 
				
			||||
 | 
					                   position="after"> | 
				
			||||
 | 
					                <field name="toggle_cw" invisible="1"/> | 
				
			||||
 | 
					                <field name="category_id" invisible="1"/> | 
				
			||||
 | 
					                <label for="cw_qty" string="CW-Quantity" | 
				
			||||
 | 
					                       invisible="toggle_cw == False" | 
				
			||||
 | 
					                       required="toggle_cw == True"/> | 
				
			||||
 | 
					                <div class="o_row" | 
				
			||||
 | 
					                     invisible="toggle_cw == False" | 
				
			||||
 | 
					                     required="toggle_cw == True"> | 
				
			||||
 | 
					                    <field name="cw_qty"/> | 
				
			||||
 | 
					                    <field name="cw_uom_id" | 
				
			||||
 | 
					                           options="{'no_open':True,'no_create':True}"/> | 
				
			||||
 | 
					                </div> | 
				
			||||
 | 
					            </xpath> | 
				
			||||
 | 
					        </field> | 
				
			||||
 | 
					    </record> | 
				
			||||
 | 
					</odoo> | 
				
			||||