diff --git a/update_on_hand/__init__.py b/update_on_hand/__init__.py new file mode 100644 index 00000000000..0650744f6bc --- /dev/null +++ b/update_on_hand/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/update_on_hand/__manifest__.py b/update_on_hand/__manifest__.py new file mode 100644 index 00000000000..62284fcb841 --- /dev/null +++ b/update_on_hand/__manifest__.py @@ -0,0 +1,11 @@ +{ + 'name': 'Update Quantity On Hand', + 'version': '1.0', + 'author': 'niyp', + 'depends': ['stock'], + 'data': [ + 'views/product_template_views.xml', + ], + 'installable': True, + 'license': 'LGPL-3', +} diff --git a/update_on_hand/models/__init__.py b/update_on_hand/models/__init__.py new file mode 100644 index 00000000000..e8fa8f6bf1e --- /dev/null +++ b/update_on_hand/models/__init__.py @@ -0,0 +1 @@ +from . import product_template diff --git a/update_on_hand/models/product_template.py b/update_on_hand/models/product_template.py new file mode 100644 index 00000000000..6f0be1f6851 --- /dev/null +++ b/update_on_hand/models/product_template.py @@ -0,0 +1,13 @@ +from odoo import api, fields, models + + +class ProductTemplate(models.Model): + _inherit = 'product.template' + + is_multicompany = fields.Boolean(compute="_compute_is_multicompany") + + @api.depends('company_id') + def _compute_is_multicompany(self): + for record in self: + user = self.env.user + record.is_multicompany = len(user.company_ids) > 1 diff --git a/update_on_hand/views/product_template_views.xml b/update_on_hand/views/product_template_views.xml new file mode 100644 index 00000000000..34fad5e47da --- /dev/null +++ b/update_on_hand/views/product_template_views.xml @@ -0,0 +1,78 @@ + + + + product.template.form.custom.inherit + product.template + + + + + 1 + + + + 1 + + + + virtual_available < 0 + virtual_available == 0 + + + + Forecasted + + + + + + + + + + + 1 + + + + + + + product.template.common.form.inherit + product.template + + + + + type == 'consu' + + + + + + + + + + + + + +