summaryrefslogtreecommitdiff
path: root/indoteknik_custom
diff options
context:
space:
mode:
authorRafi Zadanly <zadanlyr@gmail.com>2023-06-07 13:58:24 +0700
committerRafi Zadanly <zadanlyr@gmail.com>2023-06-07 13:58:24 +0700
commitdb7481a490b87e3a1768112395bf096b93969562 (patch)
tree4b62a1028b3db4748245a91a033817302deb0dff /indoteknik_custom
parent06a4478d69975b8a6eb3d228fa88708448b40a0e (diff)
Add promotion program keyword and api homepage promotion
Diffstat (limited to 'indoteknik_custom')
-rwxr-xr-xindoteknik_custom/__manifest__.py1
-rwxr-xr-xindoteknik_custom/models/__init__.py1
-rw-r--r--indoteknik_custom/models/promotion_program.py9
-rw-r--r--indoteknik_custom/models/promotion_program_keyword.py8
-rw-r--r--indoteknik_custom/models/promotion_program_line.py3
-rwxr-xr-xindoteknik_custom/security/ir.model.access.csv3
-rw-r--r--indoteknik_custom/views/promotion_program.xml10
-rw-r--r--indoteknik_custom/views/promotion_program_free_item.xml1
-rw-r--r--indoteknik_custom/views/promotion_program_keyword.xml44
-rw-r--r--indoteknik_custom/views/promotion_program_line.xml1
10 files changed, 72 insertions, 9 deletions
diff --git a/indoteknik_custom/__manifest__.py b/indoteknik_custom/__manifest__.py
index 6386497b..c116ff0c 100755
--- a/indoteknik_custom/__manifest__.py
+++ b/indoteknik_custom/__manifest__.py
@@ -77,6 +77,7 @@
'views/promotion_program.xml',
'views/promotion_program_line.xml',
'views/promotion_program_free_item.xml',
+ 'views/promotion_program_keyword.xml',
'report/report.xml',
'report/report_banner_banner.xml',
'report/report_banner_banner2.xml',
diff --git a/indoteknik_custom/models/__init__.py b/indoteknik_custom/models/__init__.py
index 42f011bf..3123d608 100755
--- a/indoteknik_custom/models/__init__.py
+++ b/indoteknik_custom/models/__init__.py
@@ -18,6 +18,7 @@ from . import product_template
from . import promotion_program
from . import promotion_program_line
from . import promotion_program_free_item
+from . import promotion_program_keyword
from . import purchase_order_line
from . import purchase_order
from . import purchase_outstanding
diff --git a/indoteknik_custom/models/promotion_program.py b/indoteknik_custom/models/promotion_program.py
index 7c264b65..bc7f2c49 100644
--- a/indoteknik_custom/models/promotion_program.py
+++ b/indoteknik_custom/models/promotion_program.py
@@ -6,6 +6,9 @@ class PromotionProgram(models.Model):
name = fields.Char(string="Name")
banner = fields.Binary(string="Banner")
+ icon = fields.Binary(string="Icon", help="Image 1:1 ratio")
+ icon_top = fields.Binary(string="Icon Top", help="Icon ini ditampilkan sebagai atribut pada atas gambar di product card pada website")
+ icon_bottom = fields.Binary(string="Icon Bottom", help="Icon ini ditampilkan sebagai atribut pada bawah gambar di product card pada website")
start_time = fields.Datetime(string="Start Time")
end_time = fields.Datetime(string="End Time")
applies_to = fields.Selection(selection=[
@@ -14,6 +17,6 @@ class PromotionProgram(models.Model):
])
program_line = fields.One2many(
comodel_name="promotion.program.line", inverse_name="program_id", string="Program Line")
-
- # TODO: Add search many2many tags input untuk ditampilkan ketika ada query search
- # TODO: Add ribbon atas, ribbon bawah, image 1:1 \ No newline at end of file
+ keywords = fields.One2many(
+ comodel_name="promotion.program.keyword", inverse_name="program_id", string="Keywords"
+ )
diff --git a/indoteknik_custom/models/promotion_program_keyword.py b/indoteknik_custom/models/promotion_program_keyword.py
new file mode 100644
index 00000000..79b938e2
--- /dev/null
+++ b/indoteknik_custom/models/promotion_program_keyword.py
@@ -0,0 +1,8 @@
+from odoo import fields, models
+
+
+class PromotionProgramKeyword(models.Model):
+ _name = "promotion.program.keyword"
+
+ name = fields.Char(string="Keyword")
+ program_id = fields.Many2one(comodel_name="promotion.program")
diff --git a/indoteknik_custom/models/promotion_program_line.py b/indoteknik_custom/models/promotion_program_line.py
index 3d314f76..a8ee2c43 100644
--- a/indoteknik_custom/models/promotion_program_line.py
+++ b/indoteknik_custom/models/promotion_program_line.py
@@ -68,6 +68,3 @@ class PromotionProgramLine(models.Model):
data = {'product_id': product.id,
'qty': 1, 'line_id': program_line.id}
line_free_item.create(data)
-
- # TODO: Add show on homepage boolean untuk priority specific product
- # TODO: Discount loading otomatis membuat line dengan product_id yang sama dengan parent
diff --git a/indoteknik_custom/security/ir.model.access.csv b/indoteknik_custom/security/ir.model.access.csv
index 3b35615f..f782046d 100755
--- a/indoteknik_custom/security/ir.model.access.csv
+++ b/indoteknik_custom/security/ir.model.access.csv
@@ -51,4 +51,5 @@ access_rajaongkir_kurir,access.rajaongkir.kurir,model_rajaongkir_kurir,,1,1,1,1
access_brand_vendor,access.brand.vendor,model_brand_vendor,,1,1,1,1
access_promotion_program,access.promotion.program,model_promotion_program,,1,1,1,1
access_promotion_program_line,access.promotion.program.line,model_promotion_program_line,,1,1,1,1
-access_promotion_program_free_item,access.promotion.program.free_item,model_promotion_program_free_item,,1,1,1,1 \ No newline at end of file
+access_promotion_program_free_item,access.promotion.program.free_item,model_promotion_program_free_item,,1,1,1,1
+access_promotion_program_keyword,access.promotion.program.keyword,model_promotion_program_keyword,,1,1,1,1 \ No newline at end of file
diff --git a/indoteknik_custom/views/promotion_program.xml b/indoteknik_custom/views/promotion_program.xml
index e309cc29..5dff80e6 100644
--- a/indoteknik_custom/views/promotion_program.xml
+++ b/indoteknik_custom/views/promotion_program.xml
@@ -21,6 +21,7 @@
<group>
<group>
<field name="name" />
+ <field name="keywords" widget="many2many_tags" />
<field name="banner" widget="image" height="160" />
</group>
<group>
@@ -33,6 +34,15 @@
<page string="Program Lines" name="program_lines">
<field name="program_line" />
</page>
+ <page string="Image Properties" name="image_properties">
+ <group>
+ <group>
+ <field name="icon" widget="image" height="120" />
+ <field name="icon_top" widget="image" height="80" />
+ <field name="icon_bottom" widget="image" height="80" />
+ </group>
+ </group>
+ </page>
</notebook>
</sheet>
</form>
diff --git a/indoteknik_custom/views/promotion_program_free_item.xml b/indoteknik_custom/views/promotion_program_free_item.xml
index c17a752d..52d421fe 100644
--- a/indoteknik_custom/views/promotion_program_free_item.xml
+++ b/indoteknik_custom/views/promotion_program_free_item.xml
@@ -18,7 +18,6 @@
<sheet>
<group>
<group>
- <field name="line_id" invisible="1" />
<field name="product_id" />
<field name="qty" />
</group>
diff --git a/indoteknik_custom/views/promotion_program_keyword.xml b/indoteknik_custom/views/promotion_program_keyword.xml
new file mode 100644
index 00000000..fd279665
--- /dev/null
+++ b/indoteknik_custom/views/promotion_program_keyword.xml
@@ -0,0 +1,44 @@
+<odoo>
+ <record id="promotion_program_keyword_tree" model="ir.ui.view">
+ <field name="name">Promotion Program Keyword Tree</field>
+ <field name="model">promotion.program.keyword</field>
+ <field name="arch" type="xml">
+ <tree>
+ <field name="name" />
+ <field name="program_id" />
+ </tree>
+ </field>
+ </record>
+
+ <record id="promotion_program_keyword_form" model="ir.ui.view">
+ <field name="name">Promotion Program Keyword Form</field>
+ <field name="model">promotion.program.keyword</field>
+ <field name="arch" type="xml">
+ <form>
+ <sheet>
+ <group>
+ <group>
+ <field name="name" />
+ <field name="program_id" />
+ </group>
+ </group>
+ </sheet>
+ </form>
+ </field>
+ </record>
+
+ <record id="promotion_program_keyword_action" model="ir.actions.act_window">
+ <field name="name">Promotion Program Keyword</field>
+ <field name="type">ir.actions.act_window</field>
+ <field name="res_model">promotion.program.keyword</field>
+ <field name="view_mode">tree,form</field>
+ </record>
+
+ <menuitem
+ id="menu_promotion_program_keyword"
+ name="Program Keyword"
+ parent="indoteknik_custom.menu_promotion_program_parent"
+ sequence="4"
+ action="promotion_program_keyword_action"
+ />
+</odoo> \ No newline at end of file
diff --git a/indoteknik_custom/views/promotion_program_line.xml b/indoteknik_custom/views/promotion_program_line.xml
index 60334d6b..bb625a8f 100644
--- a/indoteknik_custom/views/promotion_program_line.xml
+++ b/indoteknik_custom/views/promotion_program_line.xml
@@ -23,7 +23,6 @@
<sheet>
<group>
<group>
- <field name="program_id" invisible="1" />
<field name="name" />
<field name="promotion_type"/>
<field name="product_id" />