From 771b68d8ece431c00e3d4b2c81be317b19ea3cba Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Mon, 31 Jul 2023 09:01:53 +0700 Subject: fix source --- indoteknik_custom/views/sale_order.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indoteknik_custom/views/sale_order.xml b/indoteknik_custom/views/sale_order.xml index f7f9c0ea..cd2b22c3 100755 --- a/indoteknik_custom/views/sale_order.xml +++ b/indoteknik_custom/views/sale_order.xml @@ -58,7 +58,7 @@ [('id', 'in', [32, 59, 60, 61])] - {'required':[('create_date', '>', '2023-07-30')]} + {'required':[('create_date', '>', '2023-08-30')]} -- cgit v1.2.3 From 2c4c5ef80fe7093c2d017802dd0713d460a5b1f7 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Mon, 31 Jul 2023 11:23:49 +0700 Subject: fix source --- indoteknik_custom/models/sale_order.py | 1 + indoteknik_custom/views/sale_order.xml | 7 +++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index 12043996..3f25b100 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -89,6 +89,7 @@ class SaleOrder(models.Model): purchase_total = fields.Monetary(string='Purchase Total', compute='_compute_purchase_total') voucher_id = fields.Many2one(comodel_name='voucher', string='Voucher') amount_voucher_disc = fields.Float(string='Voucher Discount') + source_id = fields.Many2one('utm.source', 'Source') def _compute_purchase_total(self): for order in self: diff --git a/indoteknik_custom/views/sale_order.xml b/indoteknik_custom/views/sale_order.xml index cd2b22c3..9bed5c89 100755 --- a/indoteknik_custom/views/sale_order.xml +++ b/indoteknik_custom/views/sale_order.xml @@ -41,7 +41,7 @@ - + @@ -57,9 +57,7 @@ - [('id', 'in', [32, 59, 60, 61])] - {'required':[('create_date', '>', '2023-08-30')]} - + 1 @@ -113,6 +111,7 @@ + -- cgit v1.2.3 From 2832c5fe5f96271400749022a9136a6f72b474ca Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Mon, 31 Jul 2023 11:40:38 +0700 Subject: unlink account move --- indoteknik_custom/models/account_move.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py index 4db97706..b188285d 100644 --- a/indoteknik_custom/models/account_move.py +++ b/indoteknik_custom/models/account_move.py @@ -31,8 +31,7 @@ class AccountMove(models.Model): def unlink(self): res = super(AccountMove, self).unlink() - if not self.env.user.is_accounting: - raise UserError('Hanya Accounting yang bisa delete') + raise UserError('Data Hanya Bisa Di Cancel') return res def button_cancel(self): -- cgit v1.2.3 From 763b323e98913511bb20178be2201df46545a480 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Tue, 1 Aug 2023 08:45:21 +0700 Subject: Leads bukan lagi masuk ke salesperson admin, tp ke nabila dan Tambahin 21 hari untuk pilihan due date extension --- indoteknik_api/controllers/api_v1/lead.py | 5 ++++- indoteknik_custom/models/account_move_due_extension.py | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/indoteknik_api/controllers/api_v1/lead.py b/indoteknik_api/controllers/api_v1/lead.py index df4f46bd..f0041ea0 100644 --- a/indoteknik_api/controllers/api_v1/lead.py +++ b/indoteknik_api/controllers/api_v1/lead.py @@ -20,7 +20,10 @@ class Lead(controller.Controller): if not params['valid']: return self.response(code=400, description=params) - + + # Tambahkan user_id secara statis + params['value']['user_id'] = 20 + lead = request.env['crm.lead'].create(params['value']) return self.response(True) \ No newline at end of file diff --git a/indoteknik_custom/models/account_move_due_extension.py b/indoteknik_custom/models/account_move_due_extension.py index 43207534..3824fb30 100644 --- a/indoteknik_custom/models/account_move_due_extension.py +++ b/indoteknik_custom/models/account_move_due_extension.py @@ -26,6 +26,7 @@ class DueExtension(models.Model): ('3', '3 Hari'), ('7', '7 Hari'), ('14', '14 Hari'), + ('21', '21 Hari'), ], string='Day Extension', help='Menambah Due Date yang sudah limit dari hari ini', tracking=True) counter = fields.Integer(string="Counter", compute='_compute_counter') -- cgit v1.2.3 From 8a618e118a8393e60736dffc4a02f4b3a354e914 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Tue, 1 Aug 2023 08:54:56 +0700 Subject: crm lead --- indoteknik_api/controllers/api_v1/lead.py | 1 - indoteknik_custom/models/crm_lead.py | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/indoteknik_api/controllers/api_v1/lead.py b/indoteknik_api/controllers/api_v1/lead.py index f0041ea0..23c3bf99 100644 --- a/indoteknik_api/controllers/api_v1/lead.py +++ b/indoteknik_api/controllers/api_v1/lead.py @@ -21,7 +21,6 @@ class Lead(controller.Controller): if not params['valid']: return self.response(code=400, description=params) - # Tambahkan user_id secara statis params['value']['user_id'] = 20 lead = request.env['crm.lead'].create(params['value']) diff --git a/indoteknik_custom/models/crm_lead.py b/indoteknik_custom/models/crm_lead.py index b87315ff..0cea878a 100755 --- a/indoteknik_custom/models/crm_lead.py +++ b/indoteknik_custom/models/crm_lead.py @@ -87,5 +87,5 @@ class CrmLead(models.Model): elif lead.partner_id.user_id: salesperson_id = lead.partner_id.user_id.id else: - salesperson_id = 2 + salesperson_id = 20 lead.user_id = salesperson_id -- cgit v1.2.3 From a58a6148cb903cab6f34a4b5084df98436819c85 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Tue, 1 Aug 2023 10:51:53 +0700 Subject: replace source sale order --- indoteknik_custom/views/sale_order.xml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/indoteknik_custom/views/sale_order.xml b/indoteknik_custom/views/sale_order.xml index 9bed5c89..d2a59621 100755 --- a/indoteknik_custom/views/sale_order.xml +++ b/indoteknik_custom/views/sale_order.xml @@ -28,11 +28,15 @@ + + 1 + + @@ -41,7 +45,7 @@ - + @@ -56,9 +60,6 @@ } - - 1 - - -- cgit v1.2.3 From f371d548f434fac43595dffd9125f1d63f978157 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Tue, 1 Aug 2023 16:16:24 +0700 Subject: Add sequence and for_week on banner --- indoteknik_api/controllers/api_v1/banner.py | 17 +++++++++++++---- indoteknik_custom/models/x_banner_banner.py | 9 ++++++++- indoteknik_custom/views/x_banner_banner.xml | 29 ++++++++++++++++------------- 3 files changed, 37 insertions(+), 18 deletions(-) diff --git a/indoteknik_api/controllers/api_v1/banner.py b/indoteknik_api/controllers/api_v1/banner.py index 1bd0fea6..79aa5fa5 100644 --- a/indoteknik_api/controllers/api_v1/banner.py +++ b/indoteknik_api/controllers/api_v1/banner.py @@ -1,6 +1,7 @@ from .. import controller from odoo import http from odoo.http import request +from datetime import datetime class Banner(controller.Controller): @@ -13,14 +14,17 @@ class Banner(controller.Controller): type = kw.get('type') limit = int(kw.get('limit', 0)) offset = int(kw.get('offset', 0)) - order = kw.get('order') - if not order: - order = 'write_date DESC' + order = kw.get('order', 'write_date DESC') query = [('x_status_banner', '=', 'tayang')] 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])] + if manufacture_id: query += [('x_relasi_manufacture', '=', int(manufacture_id))] @@ -35,4 +39,9 @@ class Banner(controller.Controller): 'image': request.env['ir.attachment'].api_image('x_banner.banner', 'x_banner_image', banner.id), }) - return self.response(data, headers=[('Cache-Control', 'max-age=3600, public')]) \ No newline at end of file + return self.response(data, headers=[('Cache-Control', 'max-age=3600, public')]) + + def get_week_number_of_current_month(self): + today = datetime.now().day + week_number = (today - 1) // 7 + 1 + return min(week_number, 4) \ No newline at end of file diff --git a/indoteknik_custom/models/x_banner_banner.py b/indoteknik_custom/models/x_banner_banner.py index c34b7634..a9de2067 100755 --- a/indoteknik_custom/models/x_banner_banner.py +++ b/indoteknik_custom/models/x_banner_banner.py @@ -16,4 +16,11 @@ class XBannerBanner(models.Model): x_status_banner = fields.Selection([ ('tayang', 'Tayang'), ('tidak_tayang', 'Tidak Tayang') - ], string="Status") \ No newline at end of file + ], 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 diff --git a/indoteknik_custom/views/x_banner_banner.xml b/indoteknik_custom/views/x_banner_banner.xml index 4f3f1911..10c762af 100755 --- a/indoteknik_custom/views/x_banner_banner.xml +++ b/indoteknik_custom/views/x_banner_banner.xml @@ -5,12 +5,13 @@ x_banner.banner - - - - - - + + + + + + + @@ -23,15 +24,17 @@ - - - - - + + + + + + + - - + + -- cgit v1.2.3 From 647df532baf5452c3d6d89b8acbd30dd4fb0ea11 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Wed, 2 Aug 2023 09:29:28 +0700 Subject: domain source --- indoteknik_custom/models/sale_order.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index 3f25b100..e83ded6c 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -89,7 +89,7 @@ class SaleOrder(models.Model): purchase_total = fields.Monetary(string='Purchase Total', compute='_compute_purchase_total') voucher_id = fields.Many2one(comodel_name='voucher', string='Voucher') amount_voucher_disc = fields.Float(string='Voucher Discount') - source_id = fields.Many2one('utm.source', 'Source') + source_id = fields.Many2one('utm.source', 'Source', domain="[('id', 'in', [32, 59, 60, 61])]") def _compute_purchase_total(self): for order in self: -- cgit v1.2.3 From 9287c7fffe1db2e429c7baf6e740f9dc79ec33a2 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Wed, 2 Aug 2023 09:56:31 +0700 Subject: validasi npwp so --- indoteknik_custom/models/sale_order.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index e83ded6c..d73ad28f 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -337,7 +337,9 @@ class SaleOrder(models.Model): raise UserError("Status harus draft atau sent") if not order.partner_invoice_id.npwp: raise UserError("NPWP harus diisi di master data konsumen, jika non pkp dapat diisi 00.000.000.0-000.000") - + if '-' not in order.npwp or '.' not in order.npwp: + raise UserError("Isi NPWP Dengan Benar!") + if order.partner_id.parent_id: if not order.partner_id.parent_id.property_payment_term_id: raise UserError("Payment Term pada Master Data Customer harus diisi") -- cgit v1.2.3 From 316e94f7fd4e8c065c95b800341c48d6c84263a9 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Wed, 2 Aug 2023 10:08:08 +0700 Subject: validasi npwp action confirm --- indoteknik_custom/models/sale_order.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index d73ad28f..25d28bbb 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -490,7 +490,9 @@ class SaleOrder(models.Model): raise UserError("Tax di Header harus diisi") if not order.carrier_id: raise UserError("Shipping Method harus diisi") - # approval1 = approval2 = 0 + if '-' not in order.npwp or '.' not in order.npwp: + raise UserError("Isi NPWP Dengan Benar!") + for line in order.order_line: if not line.product_id or line.product_id.type == 'service': continue -- cgit v1.2.3 From aab3d15ab71dacee885beaa05a0ca9b5c7b652dd Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Thu, 3 Aug 2023 10:25:29 +0700 Subject: Add order sequence on manufacture API --- indoteknik_api/controllers/api_v1/manufacture.py | 3 ++- indoteknik_custom/views/x_manufactures.xml | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/indoteknik_api/controllers/api_v1/manufacture.py b/indoteknik_api/controllers/api_v1/manufacture.py index 345fd660..cbee253d 100644 --- a/indoteknik_api/controllers/api_v1/manufacture.py +++ b/indoteknik_api/controllers/api_v1/manufacture.py @@ -16,6 +16,7 @@ class Manufacture(controller.Controller): level = kw.get('level') limit = int(kw.get('limit', 0)) offset = int(kw.get('offset', 0)) + order = 'sequence ASC' if name: name = '%' + name.replace(' ', '%') + '%' if '%' not in name else name @@ -26,7 +27,7 @@ class Manufacture(controller.Controller): return self.response(code=400, description='level possible value is prioritas, gold, silver') query.append(('x_manufacture_level', '=', level)) - manufactures = request.env['x_manufactures'].search(query, limit=limit, offset=offset) + manufactures = request.env['x_manufactures'].search(query, order=order, limit=limit, offset=offset) data = { 'manufacture_total': request.env['x_manufactures'].search_count(query), 'manufactures': [request.env['x_manufactures'].api_single_response(x) for x in manufactures] diff --git a/indoteknik_custom/views/x_manufactures.xml b/indoteknik_custom/views/x_manufactures.xml index a88c5d34..dd896179 100755 --- a/indoteknik_custom/views/x_manufactures.xml +++ b/indoteknik_custom/views/x_manufactures.xml @@ -16,6 +16,7 @@ x_manufactures + @@ -37,6 +38,7 @@ + -- cgit v1.2.3 From e62baea09db91741d84a2e62c5ab1db7d15cb8c2 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Thu, 3 Aug 2023 11:09:30 +0700 Subject: Add products field on categories homepage --- indoteknik_custom/models/website_categories_homepage.py | 2 ++ indoteknik_custom/views/website_categories_homepage.xml | 14 +++++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/indoteknik_custom/models/website_categories_homepage.py b/indoteknik_custom/models/website_categories_homepage.py index 612dd8a0..a0fc1011 100644 --- a/indoteknik_custom/models/website_categories_homepage.py +++ b/indoteknik_custom/models/website_categories_homepage.py @@ -3,6 +3,7 @@ from odoo import fields, models class WebsiteCategoriesHomepage(models.Model): _name = 'website.categories.homepage' + _rec_name = 'category_id' category_id = fields.Many2one('product.public.category', string='Category', help='table ecommerce category') image = fields.Binary(string='Image') @@ -12,3 +13,4 @@ class WebsiteCategoriesHomepage(models.Model): ('tayang', 'Tayang'), ('tidak_tayang', 'Tidak Tayang') ], string='Status') + product_ids = fields.Many2many('product.template', string='Product Template') diff --git a/indoteknik_custom/views/website_categories_homepage.xml b/indoteknik_custom/views/website_categories_homepage.xml index 22424280..0a7ef2c2 100644 --- a/indoteknik_custom/views/website_categories_homepage.xml +++ b/indoteknik_custom/views/website_categories_homepage.xml @@ -11,8 +11,7 @@ Website Categories Homepage website.categories.homepage - - + @@ -31,11 +30,20 @@ - + + + + + + + + + + -- cgit v1.2.3 From 4a670f1f85848ef46c605fd67ff4e3d305571522 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Thu, 3 Aug 2023 11:31:33 +0700 Subject: Fix fetch airway bill when read API response --- indoteknik_custom/models/airway_bill.py | 10 ++++--- indoteknik_custom/models/airway_bill_manifest.py | 33 +++++++++++++----------- 2 files changed, 25 insertions(+), 18 deletions(-) diff --git a/indoteknik_custom/models/airway_bill.py b/indoteknik_custom/models/airway_bill.py index 463272b4..37d2b671 100644 --- a/indoteknik_custom/models/airway_bill.py +++ b/indoteknik_custom/models/airway_bill.py @@ -41,11 +41,11 @@ class AirwayBill(models.Model): self.ensure_one() return self._json_decode(self.response) - def _fetch(self): + def _fetch(self, days_before=30): # jne, pos, tiki, wahana, jnt, rpx, sap, sicepat, jet, dse, dan first carrier_ids = [51, 53, 54, 7, 57, 55, 59, 59, 27, 60, 62, 64] - delta_time = datetime.now() - timedelta(days=30) # Last 30 days + delta_time = datetime.now() - timedelta(days=days_before) # Last 30 days delta_time = delta_time.strftime('%Y-%m-%d %H:%M:%S') query = [ '|', @@ -61,7 +61,10 @@ class AirwayBill(models.Model): history = self._get_waybill_history(out.delivery_tracking_no, rajaongkir.name) if not history: continue - delivered = history['rajaongkir']['result']['delivered'] + try: + delivered = history['rajaongkir']['result']['delivered'] + except: + delivered = False values = { 'do_id': out.id, 'so_id': out.sale_id.id, @@ -108,6 +111,7 @@ class AirwayBill(models.Model): elif response.get('rajaongkir', {}): raja_ongkir = response.get('rajaongkir', {}) result = raja_ongkir.get('result', {}) + result = result or {} # Change to empty dict when result is None return result.get(key) def _compute_way_bill(self, airway, key, attribute): diff --git a/indoteknik_custom/models/airway_bill_manifest.py b/indoteknik_custom/models/airway_bill_manifest.py index 2e16be2c..a606c2be 100644 --- a/indoteknik_custom/models/airway_bill_manifest.py +++ b/indoteknik_custom/models/airway_bill_manifest.py @@ -16,18 +16,21 @@ class AirwayBillManifest(models.Model): def generate_airway_bill_line(self, waybill): - history = waybill.decode_response() - manifests = history['rajaongkir']['result']['manifest'] or [] - for manifest in manifests: - code = manifest['manifest_code'] - description = manifest['manifest_description'] - date = manifest['manifest_date'] - time = manifest['manifest_time'] - city = manifest['city_name'] - self.create({ - 'waybill_id': waybill.id, - 'code': code, - 'description': description, - 'datetime': date+' '+time, - 'city': city, - }) \ No newline at end of file + try: + history = waybill.decode_response() + manifests = history['rajaongkir']['result']['manifest'] or [] + for manifest in manifests: + code = manifest['manifest_code'] + description = manifest['manifest_description'] + date = manifest['manifest_date'] + time = manifest['manifest_time'] + city = manifest['city_name'] + self.create({ + 'waybill_id': waybill.id, + 'code': code, + 'description': description, + 'datetime': date+' '+time, + 'city': city, + }) + except: + return \ No newline at end of file -- cgit v1.2.3