diff options
| author | Christophe Monniez <moc@odoo.com> | 2020-03-23 15:36:12 +0000 |
|---|---|---|
| committer | Xavier-Do <xdo@odoo.com> | 2020-03-30 21:30:15 +0000 |
| commit | 748cc7e501e375d3a06aedbda17eb5ee968c10df (patch) | |
| tree | 5bc17000f425cd01bd481d1275a64a18d7f7bf72 /addons/product | |
| parent | 9d1a92548e69ed5f49dffc1e2e1ab0c9299f79af (diff) | |
[IMP] base, lunch: populate res.users and lunch models
closes odoo/odoo#48636
X-original-commit: f3f2a1e4723240b6396cea943fc86291c16f4c9d
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
Diffstat (limited to 'addons/product')
| -rw-r--r-- | addons/product/__init__.py | 1 | ||||
| -rw-r--r-- | addons/product/populate/__init__.py | 4 | ||||
| -rw-r--r-- | addons/product/populate/product.py | 36 |
3 files changed, 41 insertions, 0 deletions
diff --git a/addons/product/__init__.py b/addons/product/__init__.py index 2609681a938..c072b1a6890 100644 --- a/addons/product/__init__.py +++ b/addons/product/__init__.py @@ -3,3 +3,4 @@ from . import models from . import report +from . import populate diff --git a/addons/product/populate/__init__.py b/addons/product/populate/__init__.py new file mode 100644 index 00000000000..3d587b163e9 --- /dev/null +++ b/addons/product/populate/__init__.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from . import product diff --git a/addons/product/populate/product.py b/addons/product/populate/product.py new file mode 100644 index 00000000000..7a7d2461056 --- /dev/null +++ b/addons/product/populate/product.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. +import logging + +from odoo import models +from odoo.tools import populate + +_logger = logging.getLogger(__name__) + + +class ProductCategory(models.Model): + _inherit = "product.category" + _populate_database_scales = {"low": 50, "medium": 500, "high": 30000} + + def _populate_factories(self): + def get_name(values=None, counter=0, complete=False, **kwargs): + return "%s_%s_%s" % ("product_category", int(complete), counter) + + # quid of parent_id ??? + + return [("name", populate.compute(get_name))] + + +class ProductProduct(models.Model): + _inherit = "product.product" + _populate_database_scales = {"low": 150, "medium": 5000, "high": 60000} + + def _populate_factories(self): + + return [ + ("name", populate.constant('product_template_name_{counter}')), + ("sequence", populate.randomize([False] + [i for i in range(1, 101)])), + ("description", populate.constant('product_template_description_{counter}')), + ("default_code", populate.constant('product_default_code_{counter}')), + ("active", populate.randomize([True, False], [0.8, 0.2])), + ] |
