diff options
| author | it-fixcomart <it@fixcomart.co.id> | 2024-07-01 09:20:09 +0700 |
|---|---|---|
| committer | it-fixcomart <it@fixcomart.co.id> | 2024-07-01 09:20:09 +0700 |
| commit | 53e3cacd7d32df44ce8637284c3ec16050e07e5b (patch) | |
| tree | fe4423f778fbe88f7cf2cbed8f761cd5766801c4 | |
| parent | 424e8a227f73ae528812c9baaa6ee6e09a181bb7 (diff) | |
<iman> add flash sale to sales order
| -rw-r--r-- | indoteknik_api/controllers/api_v1/sale_order.py | 2 | ||||
| -rwxr-xr-x | indoteknik_custom/models/sale_order.py | 12 | ||||
| -rwxr-xr-x | indoteknik_custom/views/sale_order.xml | 1 |
3 files changed, 14 insertions, 1 deletions
diff --git a/indoteknik_api/controllers/api_v1/sale_order.py b/indoteknik_api/controllers/api_v1/sale_order.py index f17e736f..5dc0f6aa 100644 --- a/indoteknik_api/controllers/api_v1/sale_order.py +++ b/indoteknik_api/controllers/api_v1/sale_order.py @@ -331,6 +331,7 @@ class SaleOrder(controller.Controller): 'delivery_amount': ['number', 'default:0'], 'carrier_id': [], 'delivery_service_type': [], + 'flash_sale': [], 'voucher': [], 'source': [], 'estimated_arrival_days': ['number', 'default:0'] @@ -364,6 +365,7 @@ class SaleOrder(controller.Controller): 'shipping_paid_by': 'customer', 'carrier_id': params['value']['carrier_id'], 'delivery_service_type': params['value']['delivery_service_type'], + 'flash_sale': params['value']['flash_sale'], 'customer_type': 'nonpkp', 'npwp': '0', 'user_id': 1180 # User ID: Ima Nurhikmah diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index 826315f2..03b37229 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -72,6 +72,8 @@ class SaleOrder(models.Model): gross_amount = fields.Float(string='Gross Amount', help='Jumlah pembayaran yang dilakukan dengan Midtrans') notification = fields.Char(string='Notification', help='Dapat membantu error dari approval') delivery_service_type = fields.Char(string='Delivery Service Type', help='data dari rajaongkir') + flash_sale = fields.Char(string='Flash Sale', help='data dari web') + flash_sale_icon = fields.Html(string='Flash Sale', compute='_compute_flash_sale_icon') grand_total = fields.Monetary(string='Grand Total', help='Amount total + amount delivery', compute='_compute_grand_total') payment_link_midtrans = fields.Char(string='Payment Link', help='Url payment yg digenerate oleh midtrans, harap diserahkan ke customer agar dapat dilakukan pembayaran secara mandiri') due_id = fields.Many2one('due.extension', string="Due Extension", readonly=True, tracking=True) @@ -99,7 +101,15 @@ class SaleOrder(models.Model): ], string='Web Approval', copy=False) compute_fullfillment = fields.Boolean(string='Compute Fullfillment', compute="_compute_fullfillment") note_ekspedisi = fields.Char(string="Note Ekspedisi") - + + @api.depends('flash_sale') + def _compute_flash_sale_icon(self): + for order in self: + if order.flash_sale and order.flash_sale.lower() == 'true': + order.flash_sale_icon = '<span style="color:black;">✔</span>' + else: + order.flash_sale_icon = '<span style="color:black;">✖</span>' + def open_form_multi_create_uang_muka(self): action = self.env['ir.actions.act_window']._for_xml_id('indoteknik_custom.action_sale_order_multi_uangmuka') action['context'] = { diff --git a/indoteknik_custom/views/sale_order.xml b/indoteknik_custom/views/sale_order.xml index d50331be..fcd83e38 100755 --- a/indoteknik_custom/views/sale_order.xml +++ b/indoteknik_custom/views/sale_order.xml @@ -73,6 +73,7 @@ <field name="sales_tax_id" domain="[('type_tax_use','=','sale'), ('active', '=', True)]" required="1"/> <field name="carrier_id" required="1"/> <field name="delivery_service_type" readonly="1"/> + <field name="flash_sale_icon" widget="html"/> </field> <field name="medium_id" position="after"> <field name="date_doc_kirim" readonly="1"/> |
