diff --git a/quantity_on_hand/__init__.py b/quantity_on_hand/__init__.py new file mode 100644 index 00000000000..d581b39cea7 --- /dev/null +++ b/quantity_on_hand/__init__.py @@ -0,0 +1,2 @@ +# Part of Odoo. See LICENSE file for full copyright and licensing details. +from . import models diff --git a/quantity_on_hand/__manifest__.py b/quantity_on_hand/__manifest__.py new file mode 100644 index 00000000000..d837e1eaeaa --- /dev/null +++ b/quantity_on_hand/__manifest__.py @@ -0,0 +1,10 @@ +{ + 'name': 'Quantity on hand', + 'version': '1.0', + 'depends': ['stock'], + 'installable': True, + 'data': [ + 'views/product_template_views.xml', + ], + 'license': 'LGPL-3', +} diff --git a/quantity_on_hand/models/__init__.py b/quantity_on_hand/models/__init__.py new file mode 100644 index 00000000000..fedc66d3d45 --- /dev/null +++ b/quantity_on_hand/models/__init__.py @@ -0,0 +1,2 @@ +# Part of Odoo. See LICENSE file for full copyright and licensing details. +from . import product_template diff --git a/quantity_on_hand/models/product_template.py b/quantity_on_hand/models/product_template.py new file mode 100644 index 00000000000..889e51895d5 --- /dev/null +++ b/quantity_on_hand/models/product_template.py @@ -0,0 +1,12 @@ +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: + record.is_multicompany = len(self.env.user.company_ids) > 1 diff --git a/quantity_on_hand/views/product_template_views.xml b/quantity_on_hand/views/product_template_views.xml new file mode 100644 index 00000000000..f9056e0fcf8 --- /dev/null +++ b/quantity_on_hand/views/product_template_views.xml @@ -0,0 +1,68 @@ + + + + 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' + + + + + + + + + + + + +