summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIT Fixcomart <it@fixcomart.co.id>2023-08-03 08:56:02 +0000
committerIT Fixcomart <it@fixcomart.co.id>2023-08-03 08:56:02 +0000
commitbcc35009da39e9ee8b5e181006d3690316b83c59 (patch)
treeb2de61846ad50de44cacc9130c8168d5f3180320
parent769ce2949ad4a3f03e0a05c6298d7299bc5b0d67 (diff)
parent46529f2657d18b6c74bd95c013f528de0f687a56 (diff)
Merged in production (pull request #81)
Production
-rw-r--r--indoteknik_api/controllers/api_v1/banner.py24
-rwxr-xr-xindoteknik_custom/__manifest__.py1
-rwxr-xr-xindoteknik_custom/models/x_banner_banner.py12
-rw-r--r--indoteknik_custom/views/product_attribute_value.xml55
-rwxr-xr-xindoteknik_custom/views/x_banner_banner.xml4
5 files changed, 81 insertions, 15 deletions
diff --git a/indoteknik_api/controllers/api_v1/banner.py b/indoteknik_api/controllers/api_v1/banner.py
index 79aa5fa5..d1ebf573 100644
--- a/indoteknik_api/controllers/api_v1/banner.py
+++ b/indoteknik_api/controllers/api_v1/banner.py
@@ -20,26 +20,36 @@ class Banner(controller.Controller):
if type:
query += [('x_banner_category.x_studio_field_KKVl4', '=', type)]
- week_number = self.get_week_number_of_current_month()
if type == 'index-a-1':
- order = 'sequence ASC'
- query += [('for_week', 'in', [week_number, False])]
+ order = 'group_by_week ASC, sequence ASC'
if manufacture_id:
query += [('x_relasi_manufacture', '=', int(manufacture_id))]
banners = request.env['x_banner.banner'].search(query, limit=limit, offset=offset, order=order)
- data = []
+ week_number = self.get_week_number_of_current_month()
+
+ end_datas = []
+ datas = []
for banner in banners:
- data.append({
+ data = {
'name': banner.x_name,
'url': banner.x_url_banner,
'background_color': banner.background_color,
+ 'sequence': banner.sequence,
+ 'group_by_week': banner.group_by_week,
'image': request.env['ir.attachment'].api_image('x_banner.banner', 'x_banner_image', banner.id),
- })
+ }
+
+ if banner.group_by_week and int(banner.group_by_week) < week_number and type == 'index-a-1':
+ end_datas.append(data)
+ continue
+
+ datas.append(data)
- return self.response(data, headers=[('Cache-Control', 'max-age=3600, public')])
+ datas += end_datas
+ return self.response(datas, headers=[('Cache-Control', 'max-age=3600, public')])
def get_week_number_of_current_month(self):
today = datetime.now().day
diff --git a/indoteknik_custom/__manifest__.py b/indoteknik_custom/__manifest__.py
index 91eb4166..b7aadbdf 100755
--- a/indoteknik_custom/__manifest__.py
+++ b/indoteknik_custom/__manifest__.py
@@ -86,6 +86,7 @@
'views/bill_receipt.xml',
'views/account_move_multi_update.xml',
'views/airway_bill.xml',
+ 'views/product_attribute_value.xml',
'report/report.xml',
'report/report_banner_banner.xml',
'report/report_banner_banner2.xml',
diff --git a/indoteknik_custom/models/x_banner_banner.py b/indoteknik_custom/models/x_banner_banner.py
index a9de2067..d6884c9b 100755
--- a/indoteknik_custom/models/x_banner_banner.py
+++ b/indoteknik_custom/models/x_banner_banner.py
@@ -18,9 +18,9 @@ class XBannerBanner(models.Model):
('tidak_tayang', 'Tidak Tayang')
], string="Status")
sequence = fields.Integer(string='Sequence')
- for_week = fields.Selection([
- ('1', 1),
- ('2', 2),
- ('3', 3),
- ('4', 4)
- ], string='For Week') \ No newline at end of file
+ group_by_week = fields.Selection([
+ ('1', '1'),
+ ('2', '2'),
+ ('3', '3'),
+ ('4', '4')
+ ], string='Group by Week') \ No newline at end of file
diff --git a/indoteknik_custom/views/product_attribute_value.xml b/indoteknik_custom/views/product_attribute_value.xml
new file mode 100644
index 00000000..7c33ba7b
--- /dev/null
+++ b/indoteknik_custom/views/product_attribute_value.xml
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<odoo>
+ <record id="product_attribute_value_tree_custom" model="ir.ui.view">
+ <field name="name">product.attribute.value.tree</field>
+ <field name="model">product.attribute.value</field>
+ <field name="arch" type="xml">
+ <tree default_order="create_date desc">
+ <field name="name"/>
+ <field name="attribute_id"/>
+ <field name="is_custom"/>
+ </tree>
+ </field>
+ </record>
+
+
+ <record id="product_attribute_value_form_custom" model="ir.ui.view">
+ <field name="name">product.attribute.value.form</field>
+ <field name="model">product.attribute.value</field>
+ <field name="arch" type="xml">
+ <form>
+ <sheet>
+ <group>
+ <group>
+ <field name="attribute_id"/>
+ <field name="display_type"/>
+ </group>
+ <group>
+ <field name="html_color"/>
+ <field name="is_custom"/>
+ <field name="is_used_on_products"/>
+ <field name="name"/>
+ </group>
+ </group>
+ <group>
+ <field name="sequence"/>
+ </group>
+ </sheet>
+ </form>
+ </field>
+ </record>
+
+ <record id="product_attribute_value_action_custom" model="ir.actions.act_window">
+ <field name="name">Product Attribute</field>
+ <field name="type">ir.actions.act_window</field>
+ <field name="res_model">product.attribute.value</field>
+ <field name="view_mode">tree,form</field>
+ </record>
+
+ <menuitem
+ id="menu_product_attribute_value"
+ name="Attribute Values"
+ action="product_attribute_value_action_custom"
+ parent="sale.prod_config_main" sequence="6" groups="uom.group_uom"
+ />
+</odoo>
diff --git a/indoteknik_custom/views/x_banner_banner.xml b/indoteknik_custom/views/x_banner_banner.xml
index 10c762af..5e6526e0 100755
--- a/indoteknik_custom/views/x_banner_banner.xml
+++ b/indoteknik_custom/views/x_banner_banner.xml
@@ -7,7 +7,7 @@
<tree>
<field name="sequence" string="Seq" />
<field name="x_name" />
- <field name="for_week" />
+ <field name="group_by_week" />
<field name="x_banner_category" />
<field name="x_relasi_manufacture" />
<field name="x_url_banner" />
@@ -30,7 +30,7 @@
<field name="x_url_banner" />
<field name="x_status_banner" />
<field name="sequence" />
- <field name="for_week" />
+ <field name="group_by_week" />
</group>
<group>
<field name="background_color" />