diff options
| author | Rafi Zadanly <zadanlyr@gmail.com> | 2024-02-26 14:40:23 +0700 |
|---|---|---|
| committer | Rafi Zadanly <zadanlyr@gmail.com> | 2024-02-26 14:40:23 +0700 |
| commit | 11309b5a62dfa0e75ca7a4bd0266816140465ba6 (patch) | |
| tree | c852cd3b0b68ff53ec00775d3d7377c632c74826 | |
| parent | abcaa0fc701901cf6864c2872ffb2e469d808628 (diff) | |
Add price and manufacture on promotion monitoring
| -rw-r--r-- | indoteknik_custom/models/promotion/promotion_monitoring.py | 9 | ||||
| -rw-r--r-- | indoteknik_custom/views/promotion/promotion_monitoring.xml | 16 |
2 files changed, 23 insertions, 2 deletions
diff --git a/indoteknik_custom/models/promotion/promotion_monitoring.py b/indoteknik_custom/models/promotion/promotion_monitoring.py index 3197b9ba..d8a6dd43 100644 --- a/indoteknik_custom/models/promotion/promotion_monitoring.py +++ b/indoteknik_custom/models/promotion/promotion_monitoring.py @@ -7,6 +7,8 @@ class PromotionMonitoring(models.Model): _rec_name = "product_id" product_id = fields.Many2one(comodel_name="product.product", string="Product") + manufacture_id = fields.Many2one(comodel_name="x_manufactures", string="Manufacture", related="product_id.x_manufacture") + price = fields.Float(string="Price", help="Computed Price di Product Pricelist (Tier 1 New)") has_promo = fields.Boolean(string="Has Promo") count_active = fields.Integer(string="Count Active") count_inactive = fields.Integer(string="Count Inactive") @@ -20,16 +22,19 @@ class PromotionMonitoring(models.Model): SELECT p.id as id, p.id as product_id, + ppi.computed_price as price, ({count_active_sql} > 0) as has_promo, {count_active_sql} as count_active, {count_inactive_sql} as count_inactive FROM product_product p LEFT JOIN product_template pt ON pt.id = p.product_tmpl_id - LEFT JOIN promotion_product pp ON p.id = pp.product_id + LEFT JOIN promotion_product pp ON pp.product_id = p.id LEFT JOIN promotion_program_line ppl ON ppl.id = pp.program_line_id + LEFT JOIN product_pricelist_item ppi ON ppi.product_id = p.id WHERE p.active = True AND pt.sale_ok = True - GROUP BY p.id + AND ppi.pricelist_id = 17023 + GROUP BY p.id, ppi.id ) """.format( table=self._table, diff --git a/indoteknik_custom/views/promotion/promotion_monitoring.xml b/indoteknik_custom/views/promotion/promotion_monitoring.xml index 4af4fc82..88325c52 100644 --- a/indoteknik_custom/views/promotion/promotion_monitoring.xml +++ b/indoteknik_custom/views/promotion/promotion_monitoring.xml @@ -5,6 +5,8 @@ <field name="arch" type="xml"> <tree create="0"> <field name="product_id" /> + <field name="manufacture_id" /> + <field name="price" /> <field name="has_promo" /> <field name="count_active" /> <field name="count_inactive" /> @@ -21,6 +23,8 @@ <group> <group> <field name="product_id" /> + <field name="manufacture_id" /> + <field name="price" /> <field name="has_promo" /> <field name="count_active" /> <field name="count_inactive" /> @@ -31,6 +35,18 @@ </field> </record> + <record id="promotion_monitoring_view_search" model="ir.ui.view"> + <field name="name">promotion.monitoring.search</field> + <field name="model">promotion.monitoring</field> + <field name="mode">primary</field> + <field name="arch" type="xml"> + <search string="Search"> + <field name="product_id" /> + <field name="manufacture_id" /> + </search> + </field> + </record> + <record id="promotion_monitoring_action" model="ir.actions.act_window"> <field name="name">Promotion Monitoring</field> <field name="type">ir.actions.act_window</field> |
