summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2024-10-15 09:10:06 +0700
committerstephanchrst <stephanchrst@gmail.com>2024-10-15 09:10:06 +0700
commitd7f4569c5d2dcda1316ca4ef37fed53f467df9df (patch)
tree3512b0b51df1b45d49de9d27c319a38c338d86d3
parent24b4e09c5f77d0f6d2f179693b90d924e2107ee6 (diff)
initial commit generate url
-rwxr-xr-xindoteknik_custom/models/__init__.py1
-rw-r--r--indoteknik_custom/models/find_page.py44
-rwxr-xr-xindoteknik_custom/security/ir.model.access.csv2
3 files changed, 47 insertions, 0 deletions
diff --git a/indoteknik_custom/models/__init__.py b/indoteknik_custom/models/__init__.py
index 7b41a5fe..e62fbb4a 100755
--- a/indoteknik_custom/models/__init__.py
+++ b/indoteknik_custom/models/__init__.py
@@ -130,3 +130,4 @@ from . import account_tax
from . import approval_unreserve
from . import vendor_approval
from . import partner
+from . import find_page
diff --git a/indoteknik_custom/models/find_page.py b/indoteknik_custom/models/find_page.py
new file mode 100644
index 00000000..b81b3845
--- /dev/null
+++ b/indoteknik_custom/models/find_page.py
@@ -0,0 +1,44 @@
+from odoo import fields, models, api, tools, _
+import logging
+
+_logger = logging.getLogger(__name__)
+
+
+class BrandProductCategory(models.Model):
+ _name = 'v.brand.product.category'
+ _auto = False
+ _rec_name = 'brand_id'
+ brand_id = fields.Many2one('x_manufactures', string='Brand')
+ category_id = fields.Many2one('product.public.category', string='Category')
+
+ def init(self):
+ tools.drop_view_if_exists(self.env.cr, self._table)
+ self.env.cr.execute("""
+ CREATE OR REPLACE VIEW %s
+ AS select row_number() over(order by pt.x_manufacture) as id,
+ pt.x_manufacture as brand_id,
+ ppcptr.product_public_category_id as category_id
+ from product_template pt
+ join product_public_category_product_template_rel ppcptr on ppcptr.product_template_id = pt.id
+ join x_manufactures xm on xm.id = pt.x_manufacture
+ group by x_manufacture, ppcptr.product_public_category_id
+ """ % self._table)
+
+
+class FindPage(models.Model):
+ _name = 'web.find.page'
+
+ brand_id = fields.Many2one('x_manufactures', string='Brand')
+ category_id = fields.Many2one('product.public.category', string='Category', help='Bisa semua level Category')
+ url = fields.Char(string='Url')
+
+ def _generate_url(self):
+ categories = self.env['v.brand.product.category'].search([])
+ count = 0
+ for category in categories:
+ print(category.brand_id.x_name+' '+category.category_id.name)
+ count += 1
+ print(count)
+
+ def _generate_url_parent(self):
+ print(1)
diff --git a/indoteknik_custom/security/ir.model.access.csv b/indoteknik_custom/security/ir.model.access.csv
index 408aae55..553047e6 100755
--- a/indoteknik_custom/security/ir.model.access.csv
+++ b/indoteknik_custom/security/ir.model.access.csv
@@ -141,3 +141,5 @@ access_approval_unreserve_line,access.approval.unreserve.line,model_approval_unr
access_vendor_approval,access.vendor.approval,model_vendor_approval,,1,1,1,1
access_vendor_approval_line,access.vendor.approval.line,model_vendor_approval_line,,1,1,1,1
access_vit_kota,access.vit.kota,model_vit_kota,,1,1,1,1
+access_v_brand_product_category,access.v.brand.product.category,model_v_brand_product_category,,1,1,1,1
+access_web_find_page,access.web.find.page,model_web_find_page,,1,1,1,1