From 60abd5d10aa4f606cade5ecf7d5c271905d4a18a Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Mon, 26 Aug 2024 14:51:43 +0700 Subject: add new register to try --- indoteknik_api/controllers/api_v1/user.py | 80 ++++++++++++++++++++++++++----- 1 file changed, 67 insertions(+), 13 deletions(-) diff --git a/indoteknik_api/controllers/api_v1/user.py b/indoteknik_api/controllers/api_v1/user.py index b9fd9f56..cc97d004 100644 --- a/indoteknik_api/controllers/api_v1/user.py +++ b/indoteknik_api/controllers/api_v1/user.py @@ -104,12 +104,24 @@ class User(controller.Controller): name = kw.get('name') email = kw.get('email') password = kw.get('password') - if not name or not email or not password: - return self.response(code=400, description='email, name and password is required') - - company = kw.get('company', False) phone = kw.get('phone') + # Form Data + npwp = kw.get('npwp') # File upload for NPWP + npwp_document = kw.get('npwp_document', False) # String input for NPWP document + sppkp = kw.get('sppkp', False) # File upload for SPPKP + sppkp_document = kw.get('sppkp_document', False) # String input for SPPKP document + email_partner = kw.get('email_partner') + business_name = kw.get('business_name', False) + industry_id = int(kw.get('industry_id', '0') or 0) + company_type_id = int(kw.get('company_type_id', '0') or 0) + nama_wajib_pajak = kw.get('nama_wajib_pajak', False) + is_pkp = kw.get('is_pkp') + type_acc = kw.get('type_acc', False) + + if not name or not email or not password: + return self.response(code=400, description='email, name, and password are required') + response = { 'register': False, 'reason': None @@ -125,38 +137,80 @@ class User(controller.Controller): return self.response(response) + # Create user data user_data = { 'name': name, 'login': email, 'phone': phone, 'password': password, - 'active': False, + 'active': True, 'sel_groups_1_9_10': 9 } user = request.env['res.users'].create(user_data) user.partner_id.email = email + user.partner_id.phone = phone - if company: + if type_acc == 'business': parameter = [ ('company_type', '=', 'company'), - ('name', 'ilike', company) + ('name', 'ilike', business_name) ] match_company = request.env['res.partner'].search(parameter, limit=1) match_ratio = 0 if match_company: - match_ratio = SequenceMatcher(None, match_company.name, company).ratio() + match_ratio = SequenceMatcher(None, match_company.name, business_name).ratio() if match_ratio > 0.8: + # Set the user's partner's parent to the matched company + user.partner_id.parent_id = match_company.id + + # Create a user company request request.env['user.company.request'].create({ 'user_id': user.partner_id.id, 'user_company_id': match_company.id, - 'user_input': company + 'user_input': business_name }) else: - new_company = request.env['res.partner'].create({ - 'name': company - }) - user.parent_id = new_company.id + if not nama_wajib_pajak and not is_pkp: + nama_wajib_pajak = business_name + + new_company_data = { + 'name': business_name if business_name else business_name, + 'company_type_id': company_type_id if company_type_id else False, + 'industry_id': industry_id, + 'customer_type': 'pkp' if is_pkp else 'nonpkp', + 'npwp': npwp if is_pkp else (npwp if npwp else '0000'), + 'sppkp': sppkp if is_pkp else (sppkp if sppkp else '0000'), + 'nama_wajib_pajak': nama_wajib_pajak, + 'email': email_partner, + 'company_type': 'company' + } + new_company = request.env['res.partner'].create(new_company_data) + user.partner_id.parent_id = new_company.id + + if npwp_document: + pdf_data = base64.b64decode(npwp_document) + npwp_attachment = request.env['ir.attachment'].create({ + 'name': 'NPWP Document', + 'type': 'binary', + 'datas': pdf_data, + 'res_model': 'res.partner', + 'res_id': new_company.id, + 'mimetype': 'application/pdf' + }) + new_company.message_post(body="NPWP Uploaded", attachment_ids=[npwp_attachment.id]) + + if sppkp_document: + pdf_data = base64.b64decode(sppkp_document) + sppkp_attachment = request.env['ir.attachment'].create({ + 'name': 'SPPKP Document', + 'type': 'binary', + 'datas': pdf_data, + 'res_model': 'res.partner', + 'res_id': new_company.id, + 'mimetype': 'application/pdf' + }) + new_company.message_post(body="SPPKP Uploaded", attachment_ids=[sppkp_attachment.id]) user.send_activation_mail() -- cgit v1.2.3 From f8367ac86e743ed7c7119c9ebcadba110c115e36 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Mon, 26 Aug 2024 16:07:37 +0700 Subject: update make new company pkp --- indoteknik_api/controllers/api_v1/user.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/indoteknik_api/controllers/api_v1/user.py b/indoteknik_api/controllers/api_v1/user.py index cc97d004..bacf7009 100644 --- a/indoteknik_api/controllers/api_v1/user.py +++ b/indoteknik_api/controllers/api_v1/user.py @@ -178,9 +178,9 @@ class User(controller.Controller): 'name': business_name if business_name else business_name, 'company_type_id': company_type_id if company_type_id else False, 'industry_id': industry_id, - 'customer_type': 'pkp' if is_pkp else 'nonpkp', - 'npwp': npwp if is_pkp else (npwp if npwp else '0000'), - 'sppkp': sppkp if is_pkp else (sppkp if sppkp else '0000'), + 'customer_type': 'pkp' if is_pkp == 'true' else 'nonpkp', + 'npwp': npwp if is_pkp == 'true' else (npwp if npwp else '0000'), + 'sppkp': sppkp if is_pkp == 'true' else (sppkp if sppkp else '0000'), 'nama_wajib_pajak': nama_wajib_pajak, 'email': email_partner, 'company_type': 'company' -- cgit v1.2.3 From bee9842dda7aff8925f71f520765b0cf017e4526 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Tue, 27 Aug 2024 09:53:05 +0700 Subject: cr new register --- indoteknik_api/controllers/api_v1/user.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/indoteknik_api/controllers/api_v1/user.py b/indoteknik_api/controllers/api_v1/user.py index cc97d004..2e2a2cc6 100644 --- a/indoteknik_api/controllers/api_v1/user.py +++ b/indoteknik_api/controllers/api_v1/user.py @@ -107,10 +107,10 @@ class User(controller.Controller): phone = kw.get('phone') # Form Data - npwp = kw.get('npwp') # File upload for NPWP - npwp_document = kw.get('npwp_document', False) # String input for NPWP document - sppkp = kw.get('sppkp', False) # File upload for SPPKP - sppkp_document = kw.get('sppkp_document', False) # String input for SPPKP document + npwp = kw.get('npwp') + npwp_document = kw.get('npwp_document', False) + sppkp = kw.get('sppkp', False) + sppkp_document = kw.get('sppkp_document', False) email_partner = kw.get('email_partner') business_name = kw.get('business_name', False) industry_id = int(kw.get('industry_id', '0') or 0) @@ -179,8 +179,8 @@ class User(controller.Controller): 'company_type_id': company_type_id if company_type_id else False, 'industry_id': industry_id, 'customer_type': 'pkp' if is_pkp else 'nonpkp', - 'npwp': npwp if is_pkp else (npwp if npwp else '0000'), - 'sppkp': sppkp if is_pkp else (sppkp if sppkp else '0000'), + 'npwp': npwp if is_pkp else (npwp if npwp else '0.000.000.0-000.000'), + 'sppkp': sppkp if is_pkp else (sppkp if sppkp else ''), 'nama_wajib_pajak': nama_wajib_pajak, 'email': email_partner, 'company_type': 'company' -- cgit v1.2.3 From cda852c61878d46c14c7c04e8eaaf68a268f6149 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Tue, 27 Aug 2024 10:31:32 +0700 Subject: cr api new register --- indoteknik_api/controllers/api_v1/user.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/indoteknik_api/controllers/api_v1/user.py b/indoteknik_api/controllers/api_v1/user.py index 2e2a2cc6..a7e200cd 100644 --- a/indoteknik_api/controllers/api_v1/user.py +++ b/indoteknik_api/controllers/api_v1/user.py @@ -187,6 +187,10 @@ class User(controller.Controller): } new_company = request.env['res.partner'].create(new_company_data) user.partner_id.parent_id = new_company.id + user.partner_id.customer_type = new_company.customer_type + user.partner_id.npwp = new_company.npwp + user.partner_id.sppkp = new_company.sppkp + user.partner_id.nama_wajib_pajak = new_company.nama_wajib_pajak if npwp_document: pdf_data = base64.b64decode(npwp_document) -- cgit v1.2.3 From f7ba6f97d3367e54e3c24eaf24002ca7abbd5383 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Tue, 27 Aug 2024 14:48:37 +0700 Subject: update make attachment --- indoteknik_api/controllers/api_v1/user.py | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/indoteknik_api/controllers/api_v1/user.py b/indoteknik_api/controllers/api_v1/user.py index a7e200cd..59684b4c 100644 --- a/indoteknik_api/controllers/api_v1/user.py +++ b/indoteknik_api/controllers/api_v1/user.py @@ -9,6 +9,8 @@ import string import requests import json from difflib import SequenceMatcher +import mimetypes +import base64 class User(controller.Controller): @@ -106,15 +108,20 @@ class User(controller.Controller): password = kw.get('password') phone = kw.get('phone') + # Form Data # Form Data npwp = kw.get('npwp') npwp_document = kw.get('npwp_document', False) + npwp_filename = kw.get('npwp_filename', 'npwp_document') sppkp = kw.get('sppkp', False) sppkp_document = kw.get('sppkp_document', False) + sppkp_filename = kw.get('sppkp_filename', 'sppkp_document') email_partner = kw.get('email_partner') business_name = kw.get('business_name', False) industry_id = int(kw.get('industry_id', '0') or 0) company_type_id = int(kw.get('company_type_id', '0') or 0) + alamat_wajib_pajak = kw.get('alamat_wajib_pajak', False) + alamat_bisnis = kw.get('alamat_bisnis', False) nama_wajib_pajak = kw.get('nama_wajib_pajak', False) is_pkp = kw.get('is_pkp') type_acc = kw.get('type_acc', False) @@ -174,6 +181,9 @@ class User(controller.Controller): if not nama_wajib_pajak and not is_pkp: nama_wajib_pajak = business_name + if not alamat_wajib_pajak and not is_pkp: + alamat_wajib_pajak = alamat_bisnis + new_company_data = { 'name': business_name if business_name else business_name, 'company_type_id': company_type_id if company_type_id else False, @@ -182,7 +192,9 @@ class User(controller.Controller): 'npwp': npwp if is_pkp else (npwp if npwp else '0.000.000.0-000.000'), 'sppkp': sppkp if is_pkp else (sppkp if sppkp else ''), 'nama_wajib_pajak': nama_wajib_pajak, + 'alamat_lengkap_text': alamat_wajib_pajak, 'email': email_partner, + 'street': alamat_bisnis, 'company_type': 'company' } new_company = request.env['res.partner'].create(new_company_data) @@ -191,28 +203,33 @@ class User(controller.Controller): user.partner_id.npwp = new_company.npwp user.partner_id.sppkp = new_company.sppkp user.partner_id.nama_wajib_pajak = new_company.nama_wajib_pajak + user.partner_id.alamat_lengkap_text = new_company.alamat_lengkap_text if npwp_document: + npwp_mimetype, _ = mimetypes.guess_type(npwp_filename) + npwp_mimetype = npwp_mimetype or 'application/octet-stream' pdf_data = base64.b64decode(npwp_document) npwp_attachment = request.env['ir.attachment'].create({ 'name': 'NPWP Document', 'type': 'binary', - 'datas': pdf_data, + 'datas': base64.b64encode(pdf_data), 'res_model': 'res.partner', 'res_id': new_company.id, - 'mimetype': 'application/pdf' + 'mimetype': npwp_mimetype }) new_company.message_post(body="NPWP Uploaded", attachment_ids=[npwp_attachment.id]) if sppkp_document: + sppkp_mimetype, _ = mimetypes.guess_type(sppkp_filename) + sppkp_mimetype = sppkp_mimetype or 'application/octet-stream' pdf_data = base64.b64decode(sppkp_document) sppkp_attachment = request.env['ir.attachment'].create({ 'name': 'SPPKP Document', 'type': 'binary', - 'datas': pdf_data, + 'datas': base64.b64encode(pdf_data), 'res_model': 'res.partner', 'res_id': new_company.id, - 'mimetype': 'application/pdf' + 'mimetype': sppkp_mimetype }) new_company.message_post(body="SPPKP Uploaded", attachment_ids=[sppkp_attachment.id]) -- cgit v1.2.3 From 161d234409fa146f8bab98697f568d7a4c1348e1 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Tue, 27 Aug 2024 15:14:53 +0700 Subject: update logic code --- indoteknik_api/controllers/api_v1/user.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/indoteknik_api/controllers/api_v1/user.py b/indoteknik_api/controllers/api_v1/user.py index 59684b4c..4a61270f 100644 --- a/indoteknik_api/controllers/api_v1/user.py +++ b/indoteknik_api/controllers/api_v1/user.py @@ -178,19 +178,19 @@ class User(controller.Controller): 'user_input': business_name }) else: - if not nama_wajib_pajak and not is_pkp: + if not nama_wajib_pajak and is_pkp == 'false': nama_wajib_pajak = business_name - if not alamat_wajib_pajak and not is_pkp: + if not alamat_wajib_pajak and is_pkp == 'false': alamat_wajib_pajak = alamat_bisnis new_company_data = { 'name': business_name if business_name else business_name, 'company_type_id': company_type_id if company_type_id else False, 'industry_id': industry_id, - 'customer_type': 'pkp' if is_pkp else 'nonpkp', - 'npwp': npwp if is_pkp else (npwp if npwp else '0.000.000.0-000.000'), - 'sppkp': sppkp if is_pkp else (sppkp if sppkp else ''), + 'customer_type': 'pkp' if is_pkp == 'true' else 'nonpkp', + 'npwp': npwp if is_pkp == 'true' else (npwp if npwp else '0.000.000.0-000.000'), + 'sppkp': sppkp if is_pkp == 'true' else (sppkp if sppkp else ''), 'nama_wajib_pajak': nama_wajib_pajak, 'alamat_lengkap_text': alamat_wajib_pajak, 'email': email_partner, -- cgit v1.2.3 From 0633f4fa379370de41195e20058e6e671d27b4a9 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Wed, 28 Aug 2024 13:14:07 +0700 Subject: update make user individu data --- indoteknik_api/controllers/api_v1/user.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/indoteknik_api/controllers/api_v1/user.py b/indoteknik_api/controllers/api_v1/user.py index 4a61270f..3fb10333 100644 --- a/indoteknik_api/controllers/api_v1/user.py +++ b/indoteknik_api/controllers/api_v1/user.py @@ -108,7 +108,6 @@ class User(controller.Controller): password = kw.get('password') phone = kw.get('phone') - # Form Data # Form Data npwp = kw.get('npwp') npwp_document = kw.get('npwp_document', False) @@ -170,6 +169,11 @@ class User(controller.Controller): if match_ratio > 0.8: # Set the user's partner's parent to the matched company user.partner_id.parent_id = match_company.id + user.partner_id.customer_type = match_company.customer_type + user.partner_id.npwp = match_company.npwp + user.partner_id.sppkp = match_company.sppkp + user.partner_id.nama_wajib_pajak = match_company.nama_wajib_pajak + user.partner_id.alamat_lengkap_text = match_company.alamat_lengkap_text # Create a user company request request.env['user.company.request'].create({ @@ -233,6 +237,11 @@ class User(controller.Controller): }) new_company.message_post(body="SPPKP Uploaded", attachment_ids=[sppkp_attachment.id]) + if type_acc == 'individu': + user.partner_id.customer_type = 'nonpkp' + user.partner_id.npwp = '0.000.000.0-000.000' + user.partner_id.nama_wajib_pajak = name + user.send_activation_mail() response['register'] = True -- cgit v1.2.3 From 4aa0f2612225de32d361547f39283c1529fe955b Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Wed, 28 Aug 2024 14:09:05 +0700 Subject: update address fakture --- indoteknik_custom/models/res_partner.py | 40 +++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/indoteknik_custom/models/res_partner.py b/indoteknik_custom/models/res_partner.py index ac126337..6a1257f8 100644 --- a/indoteknik_custom/models/res_partner.py +++ b/indoteknik_custom/models/res_partner.py @@ -58,6 +58,46 @@ class ResPartner(models.Model): default=_default_payment_term ) + @api.depends("street", "street2", "city", "state_id", "country_id", "blok", "nomor", "rt", "rw", "kelurahan_id", + "kecamatan_id") + def _alamat_lengkap(self): + for partner in self: + lengkap = partner.street or "" + lengkap += " " + (partner.street2 or '') + + if partner.blok: + lengkap += " Blok: " + partner.blok + ", " + if partner.nomor: + lengkap += " Nomor: " + partner.nomor + ", " + + if partner.rt: + lengkap += " RT: " + partner.rt + if partner.rw: + lengkap += " RW: " + partner.rw + + if partner.kelurahan_id: + lengkap += " Kel: " + partner.kelurahan_id.name + "," + + if partner.kecamatan_id: + lengkap += " Kec: " + partner.kecamatan_id.name + + if partner.kota_id: + lengkap += """ + """ + partner.kota_id.name + "," + + if partner.state_id: + lengkap += " " + partner.state_id.name + + partner.alamat_lengkap = lengkap.upper() + + if partner.company_type == 'person' and not partner.parent_id: + partner.alamat_lengkap_text = partner.street + else: + partner.alamat_lengkap_text = partner.alamat_lengkap + + alamat_lengkap = fields.Char(string="Alamat Lengkap", required=False, compute="_alamat_lengkap") + alamat_lengkap_text = fields.Text(string="Alamat Lengkap", required=False) + def write(self, vals): res = super(ResPartner, self).write(vals) -- cgit v1.2.3 From cf31bebc38f23450b7c429bb4b3a567515071a40 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Wed, 28 Aug 2024 15:30:24 +0700 Subject: update to handle user company request --- indoteknik_api/controllers/api_v1/user.py | 8 -------- indoteknik_custom/models/user_company_request.py | 5 +++++ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/indoteknik_api/controllers/api_v1/user.py b/indoteknik_api/controllers/api_v1/user.py index 3fb10333..bbf1c8d1 100644 --- a/indoteknik_api/controllers/api_v1/user.py +++ b/indoteknik_api/controllers/api_v1/user.py @@ -167,14 +167,6 @@ class User(controller.Controller): if match_company: match_ratio = SequenceMatcher(None, match_company.name, business_name).ratio() if match_ratio > 0.8: - # Set the user's partner's parent to the matched company - user.partner_id.parent_id = match_company.id - user.partner_id.customer_type = match_company.customer_type - user.partner_id.npwp = match_company.npwp - user.partner_id.sppkp = match_company.sppkp - user.partner_id.nama_wajib_pajak = match_company.nama_wajib_pajak - user.partner_id.alamat_lengkap_text = match_company.alamat_lengkap_text - # Create a user company request request.env['user.company.request'].create({ 'user_id': user.partner_id.id, diff --git a/indoteknik_custom/models/user_company_request.py b/indoteknik_custom/models/user_company_request.py index 2467261a..7d28d7ed 100644 --- a/indoteknik_custom/models/user_company_request.py +++ b/indoteknik_custom/models/user_company_request.py @@ -22,6 +22,11 @@ class UserCompanyRequest(models.Model): if not self.is_approve and is_approve: if is_approve == 'approved': self.user_id.parent_id = self.user_company_id.id + self.user_id.customer_type = self.user_company_id.customer_type + self.user_id.npwp = self.user_company_id.npwp + self.user_id.sppkp = self.user_company_id.sppkp + self.user_id.nama_wajib_pajak = self.user_company_id.nama_wajib_pajak + self.user_id.alamat_lengkap_text = self.user_company_id.alamat_lengkap_text else: new_company = self.env['res.partner'].create({ 'name': self.user_input -- cgit v1.2.3 From 04a39b785c2e3feef390d46e498e27289a10ffb4 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Wed, 28 Aug 2024 15:59:17 +0700 Subject: update user active false --- indoteknik_api/controllers/api_v1/user.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indoteknik_api/controllers/api_v1/user.py b/indoteknik_api/controllers/api_v1/user.py index bbf1c8d1..13a0a293 100644 --- a/indoteknik_api/controllers/api_v1/user.py +++ b/indoteknik_api/controllers/api_v1/user.py @@ -149,7 +149,7 @@ class User(controller.Controller): 'login': email, 'phone': phone, 'password': password, - 'active': True, + 'active': False, 'sel_groups_1_9_10': 9 } -- cgit v1.2.3 From 09ff6a7ea7860698c736afd926b7d249b1509de9 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Thu, 29 Aug 2024 13:37:13 +0700 Subject: update phone number missing at web --- indoteknik_api/controllers/api_v1/user.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/indoteknik_api/controllers/api_v1/user.py b/indoteknik_api/controllers/api_v1/user.py index 13a0a293..4e20e2c8 100644 --- a/indoteknik_api/controllers/api_v1/user.py +++ b/indoteknik_api/controllers/api_v1/user.py @@ -147,7 +147,7 @@ class User(controller.Controller): user_data = { 'name': name, 'login': email, - 'phone': phone, + 'mobile': phone, 'password': password, 'active': False, 'sel_groups_1_9_10': 9 @@ -155,7 +155,7 @@ class User(controller.Controller): user = request.env['res.users'].create(user_data) user.partner_id.email = email - user.partner_id.phone = phone + user.partner_id.mobile = phone if type_acc == 'business': parameter = [ -- cgit v1.2.3 From c3d6ea4ae3ce658a2b01b3b79561d6ebf15f41ef Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Fri, 30 Aug 2024 11:05:04 +0700 Subject: ubah format npwp dan sppkp --- indoteknik_api/controllers/api_v1/user.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/indoteknik_api/controllers/api_v1/user.py b/indoteknik_api/controllers/api_v1/user.py index 4e20e2c8..61bb4425 100644 --- a/indoteknik_api/controllers/api_v1/user.py +++ b/indoteknik_api/controllers/api_v1/user.py @@ -185,8 +185,8 @@ class User(controller.Controller): 'company_type_id': company_type_id if company_type_id else False, 'industry_id': industry_id, 'customer_type': 'pkp' if is_pkp == 'true' else 'nonpkp', - 'npwp': npwp if is_pkp == 'true' else (npwp if npwp else '0.000.000.0-000.000'), - 'sppkp': sppkp if is_pkp == 'true' else (sppkp if sppkp else ''), + 'npwp': npwp if is_pkp == 'true' else (npwp if npwp else '00.000.000.0-000.000'), + 'sppkp': sppkp if is_pkp == 'true' else (sppkp if sppkp else '-'), 'nama_wajib_pajak': nama_wajib_pajak, 'alamat_lengkap_text': alamat_wajib_pajak, 'email': email_partner, -- cgit v1.2.3 From 6d90f84246b1c6ef01b3ba3f1231450b11862719 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Fri, 30 Aug 2024 11:52:21 +0700 Subject: udate new register --- indoteknik_api/controllers/api_v1/user.py | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/indoteknik_api/controllers/api_v1/user.py b/indoteknik_api/controllers/api_v1/user.py index 61bb4425..1f9c077e 100644 --- a/indoteknik_api/controllers/api_v1/user.py +++ b/indoteknik_api/controllers/api_v1/user.py @@ -191,15 +191,26 @@ class User(controller.Controller): 'alamat_lengkap_text': alamat_wajib_pajak, 'email': email_partner, 'street': alamat_bisnis, - 'company_type': 'company' + 'company_type': 'company', + 'user_id': 3222, + 'property_account_receivable_id': 395, + 'property_account_payable_id': 438, + 'active_limit': True, + 'warning_stage': 4000000, + # 'blocking_stage': 5000000, } new_company = request.env['res.partner'].create(new_company_data) - user.partner_id.parent_id = new_company.id - user.partner_id.customer_type = new_company.customer_type - user.partner_id.npwp = new_company.npwp - user.partner_id.sppkp = new_company.sppkp - user.partner_id.nama_wajib_pajak = new_company.nama_wajib_pajak - user.partner_id.alamat_lengkap_text = new_company.alamat_lengkap_text + request.env['user.company.request'].create({ + 'user_id': user.partner_id.id, + 'user_company_id': new_company.id, + 'user_input': business_name + }) + # user.partner_id.parent_id = new_company.id + # user.partner_id.customer_type = new_company.customer_type + # user.partner_id.npwp = new_company.npwp + # user.partner_id.sppkp = new_company.sppkp + # user.partner_id.nama_wajib_pajak = new_company.nama_wajib_pajak + # user.partner_id.alamat_lengkap_text = new_company.alamat_lengkap_text if npwp_document: npwp_mimetype, _ = mimetypes.guess_type(npwp_filename) @@ -232,6 +243,7 @@ class User(controller.Controller): if type_acc == 'individu': user.partner_id.customer_type = 'nonpkp' user.partner_id.npwp = '0.000.000.0-000.000' + user.partner_id.sppkp = '-' user.partner_id.nama_wajib_pajak = name user.send_activation_mail() -- cgit v1.2.3 From edafc890045d833289ad3b53ce3375625f18e54c Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Fri, 30 Aug 2024 14:59:50 +0700 Subject: update jika sppkp diganti di order, parent sppkp juga terganti --- indoteknik_api/controllers/api_v1/sale_order.py | 11 +++++--- indoteknik_custom/models/sale_order.py | 35 +++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 3 deletions(-) diff --git a/indoteknik_api/controllers/api_v1/sale_order.py b/indoteknik_api/controllers/api_v1/sale_order.py index a50cb264..7edd71f6 100644 --- a/indoteknik_api/controllers/api_v1/sale_order.py +++ b/indoteknik_api/controllers/api_v1/sale_order.py @@ -378,6 +378,9 @@ class SaleOrder(controller.Controller): if not params['valid']: return self.response(code=400, description=params) + # Fetch partner details + sales_partner = request.env['res.partner'].browse(params['value']['partner_id']) + parameters = { 'warehouse_id': 8, 'carrier_id': 1, @@ -405,9 +408,11 @@ class SaleOrder(controller.Controller): 'delivery_service_type': params['value']['delivery_service_type'], 'flash_sale': params['value']['flash_sale'], 'note_website': params['value']['note_website'], - 'customer_type': 'nonpkp', - 'npwp': '0', - 'user_id': 3222 # User ID: Nadia Rauhadatul Firdaus + 'customer_type': sales_partner.customer_type if sales_partner else 'nonpkp', # Get Customer Type from partner + 'npwp': sales_partner.npwp or '0', # Get NPWP from partner + 'sppkp': sales_partner.sppkp, # Get SPPKP from partner + 'email': sales_partner.email, # Get Email from partner + 'user_id': 3222 # User ID: Nadia Rauhadatul Firdaus } sales_partner = request.env['res.partner'].browse(parameters['partner_id']) diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index 710e99de..16a1f415 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -942,3 +942,38 @@ class SaleOrder(models.Model): order_line.tax_id = tax_id order_line.discount = discount order_line.order_id.use_button = True + + @api.model + def create(self, vals): + # Ensure partner details are updated when a sale order is created + order = super(SaleOrder, self).create(vals) + order._update_partner_details() + return order + + def write(self, vals): + # Call the super method to handle the write operation + res = super(SaleOrder, self).write(vals) + + # Check if the update is coming from a save operation + if any(field in vals for field in ['sppkp', 'npwp', 'email', 'customer_type']): + self._update_partner_details() + + return res + + def _update_partner_details(self): + for order in self: + partner = order.partner_id.parent_id or order.partner_id + if partner: + # Update partner details + partner.sppkp = order.sppkp + partner.npwp = order.npwp + partner.email = order.email + partner.customer_type = order.customer_type + + # Save changes to the partner record + partner.write({ + 'sppkp': partner.sppkp, + 'npwp': partner.npwp, + 'email': partner.email, + 'customer_type': partner.customer_type, + }) \ No newline at end of file -- cgit v1.2.3 From 0801de741384b29a01f5570f420da10953834e22 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Fri, 30 Aug 2024 16:13:46 +0700 Subject: update automatic data new register --- indoteknik_api/controllers/api_v1/user.py | 3 +++ indoteknik_custom/models/user_company_request.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/indoteknik_api/controllers/api_v1/user.py b/indoteknik_api/controllers/api_v1/user.py index 1f9c077e..a8b1a3eb 100644 --- a/indoteknik_api/controllers/api_v1/user.py +++ b/indoteknik_api/controllers/api_v1/user.py @@ -245,6 +245,9 @@ class User(controller.Controller): user.partner_id.npwp = '0.000.000.0-000.000' user.partner_id.sppkp = '-' user.partner_id.nama_wajib_pajak = name + user.partner_id.user_id = 3222 + user.partner_id.property_account_receivable_id= 395 + user.partner_id.property_account_payable_id = 438 user.send_activation_mail() diff --git a/indoteknik_custom/models/user_company_request.py b/indoteknik_custom/models/user_company_request.py index 7d28d7ed..69067e9c 100644 --- a/indoteknik_custom/models/user_company_request.py +++ b/indoteknik_custom/models/user_company_request.py @@ -27,6 +27,9 @@ class UserCompanyRequest(models.Model): self.user_id.sppkp = self.user_company_id.sppkp self.user_id.nama_wajib_pajak = self.user_company_id.nama_wajib_pajak self.user_id.alamat_lengkap_text = self.user_company_id.alamat_lengkap_text + self.user_id.user_id = self.user_company_id.user_id + self.user_id.property_account_receivable_id = self.user_company_id.property_account_receivable_id + self.user_id.property_account_payable_id = self.user_company_id.property_account_payable_id else: new_company = self.env['res.partner'].create({ 'name': self.user_input -- cgit v1.2.3 From dfc764a3f3b2adb9526740342ada58ed4ddfcb11 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Fri, 30 Aug 2024 16:41:49 +0700 Subject: update new register --- indoteknik_api/controllers/api_v1/user.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/indoteknik_api/controllers/api_v1/user.py b/indoteknik_api/controllers/api_v1/user.py index a8b1a3eb..6300eb86 100644 --- a/indoteknik_api/controllers/api_v1/user.py +++ b/indoteknik_api/controllers/api_v1/user.py @@ -195,9 +195,6 @@ class User(controller.Controller): 'user_id': 3222, 'property_account_receivable_id': 395, 'property_account_payable_id': 438, - 'active_limit': True, - 'warning_stage': 4000000, - # 'blocking_stage': 5000000, } new_company = request.env['res.partner'].create(new_company_data) request.env['user.company.request'].create({ -- cgit v1.2.3 From 1da66aee1b99ce8fc10b7a4f1c2437dfce7c9ee4 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Tue, 3 Sep 2024 15:41:30 +0700 Subject: cr register --- indoteknik_api/controllers/api_v1/user.py | 1 + indoteknik_custom/models/user_company_request.py | 1 + 2 files changed, 2 insertions(+) diff --git a/indoteknik_api/controllers/api_v1/user.py b/indoteknik_api/controllers/api_v1/user.py index 6300eb86..ea74d297 100644 --- a/indoteknik_api/controllers/api_v1/user.py +++ b/indoteknik_api/controllers/api_v1/user.py @@ -195,6 +195,7 @@ class User(controller.Controller): 'user_id': 3222, 'property_account_receivable_id': 395, 'property_account_payable_id': 438, + 'active': False, } new_company = request.env['res.partner'].create(new_company_data) request.env['user.company.request'].create({ diff --git a/indoteknik_custom/models/user_company_request.py b/indoteknik_custom/models/user_company_request.py index 69067e9c..d6134650 100644 --- a/indoteknik_custom/models/user_company_request.py +++ b/indoteknik_custom/models/user_company_request.py @@ -30,6 +30,7 @@ class UserCompanyRequest(models.Model): self.user_id.user_id = self.user_company_id.user_id self.user_id.property_account_receivable_id = self.user_company_id.property_account_receivable_id self.user_id.property_account_payable_id = self.user_company_id.property_account_payable_id + self.user_company_id.active = True else: new_company = self.env['res.partner'].create({ 'name': self.user_input -- cgit v1.2.3 From 066f8b9d9499be72cdbb4fb0a8d0e6ee766fdc4d Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Tue, 3 Sep 2024 16:07:39 +0700 Subject: cr default order --- indoteknik_custom/views/user_company_request.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indoteknik_custom/views/user_company_request.xml b/indoteknik_custom/views/user_company_request.xml index 2efc1e9b..c9edd3f8 100644 --- a/indoteknik_custom/views/user_company_request.xml +++ b/indoteknik_custom/views/user_company_request.xml @@ -4,7 +4,7 @@ user.company.request.tree user.company.request - + -- cgit v1.2.3 From 4643df754b03eb3f8ae9567bc5b5327934b6cc83 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Wed, 4 Sep 2024 17:15:20 +0700 Subject: update new register --- indoteknik_api/controllers/api_v1/partner.py | 11 +++++-- indoteknik_api/models/res_users.py | 1 + indoteknik_custom/models/res_partner.py | 46 ++++++++++++++++++++++------ 3 files changed, 45 insertions(+), 13 deletions(-) diff --git a/indoteknik_api/controllers/api_v1/partner.py b/indoteknik_api/controllers/api_v1/partner.py index 69a2f861..4716173e 100644 --- a/indoteknik_api/controllers/api_v1/partner.py +++ b/indoteknik_api/controllers/api_v1/partner.py @@ -116,20 +116,25 @@ class Partner(controller.Controller): def write_partner_by_id(self, **kw): params = self.get_request_params(kw, { 'id': ['required', 'number'], - 'name': [], 'company_type_id': ['number'], 'industry_id': ['number'], 'tax_name': ['alias:nama_wajib_pajak'], 'npwp': [], + 'alamat_lengkap_text':[], + }) + + id_user = self.get_request_params(kw, { + 'id_user': ['number'] }) if not params['valid']: return self.response(code=400, description=params) - + partner = request.env[self._name].search([('id', '=', params['value']['id'])], limit=1) if not partner: return self.response(code=404, description='User not found') - + + # Simpan perubahan data partner.write(params['value']) return self.response({ diff --git a/indoteknik_api/models/res_users.py b/indoteknik_api/models/res_users.py index d5dff876..2c0a986b 100644 --- a/indoteknik_api/models/res_users.py +++ b/indoteknik_api/models/res_users.py @@ -55,6 +55,7 @@ class ResUsers(models.Model): 'tax_name': user.nama_wajib_pajak or '', 'npwp': user.npwp or '', 'rajaongkir_city_id': user.kecamatan_id.rajaongkir_id or 0, + 'alamat_wajib_pajak': user.alamat_lengkap_text or None, } if user.kota_id: diff --git a/indoteknik_custom/models/res_partner.py b/indoteknik_custom/models/res_partner.py index 6a1257f8..9f2c82e2 100644 --- a/indoteknik_custom/models/res_partner.py +++ b/indoteknik_custom/models/res_partner.py @@ -98,20 +98,46 @@ class ResPartner(models.Model): alamat_lengkap = fields.Char(string="Alamat Lengkap", required=False, compute="_alamat_lengkap") alamat_lengkap_text = fields.Text(string="Alamat Lengkap", required=False) - def write(self, vals): - res = super(ResPartner, self).write(vals) - - # if 'property_payment_term_id' in vals: - # if not self.env.user.is_accounting and vals['property_payment_term_id'] != 26: - # raise UserError('Hanya Finance Accounting yang dapat merubah payment term') + # def write(self, vals): + # res = super(ResPartner, self).write(vals) + # + # # if 'property_payment_term_id' in vals: + # # if not self.env.user.is_accounting and vals['property_payment_term_id'] != 26: + # # raise UserError('Hanya Finance Accounting yang dapat merubah payment term') + # + # # group_id = self.env.ref('indoteknik_custom.group_role_merchandiser').id + # # users_in_group = self.env['res.users'].search([('groups_id', 'in', [group_id])]) + # # if self.env.user.id not in users_in_group.mapped('id'): + # # raise UserError('You name it') + # + # return res - # group_id = self.env.ref('indoteknik_custom.group_role_merchandiser').id - # users_in_group = self.env['res.users'].search([('groups_id', 'in', [group_id])]) - # if self.env.user.id not in users_in_group.mapped('id'): - # raise UserError('You name it') + def write(self, vals): + if self.company_type == 'person': + if self.parent_id: + parent = self.parent_id + vals['customer_type'] = parent.customer_type + vals['nama_wajib_pajak'] = parent.nama_wajib_pajak + vals['npwp'] = parent.npwp + vals['sppkp'] = parent.sppkp + vals['alamat_lengkap_text'] = parent.alamat_lengkap_text + vals['industry_id'] = parent.industry_id.id + vals['company_type_id'] = parent.company_type_id.id + res = super(ResPartner, self).write(vals) return res + @api.onchange('company_type') + def _onchange_company_type(self): + if self.company_type == 'person' and self.parent_id: + self.customer_type = self.parent_id.customer_type + self.npwp = self.parent_id.npwp + self.sppkp = self.parent_id.sppkp + self.nama_wajib_pajak = self.parent_id.nama_wajib_pajak + self.alamat_lengkap_text = self.parent_id.alamat_lengkap_text + self.industry_id = self.parent_id.industry_id.id + self.company_type_id = self.parent_id.company_type_id.id + @api.constrains('property_payment_term_id') def updated_by_payment_term(self): for rec in self: -- cgit v1.2.3 From 95d7027481595aa83d75570044391e68c11e9ce1 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Thu, 5 Sep 2024 09:41:47 +0700 Subject: update new register --- indoteknik_api/controllers/api_v1/partner.py | 8 ++------ indoteknik_custom/models/res_partner.py | 4 ++-- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/indoteknik_api/controllers/api_v1/partner.py b/indoteknik_api/controllers/api_v1/partner.py index 4716173e..f662fd79 100644 --- a/indoteknik_api/controllers/api_v1/partner.py +++ b/indoteknik_api/controllers/api_v1/partner.py @@ -116,15 +116,12 @@ class Partner(controller.Controller): def write_partner_by_id(self, **kw): params = self.get_request_params(kw, { 'id': ['required', 'number'], + 'name': [], 'company_type_id': ['number'], 'industry_id': ['number'], 'tax_name': ['alias:nama_wajib_pajak'], 'npwp': [], - 'alamat_lengkap_text':[], - }) - - id_user = self.get_request_params(kw, { - 'id_user': ['number'] + 'alamat_lengkap_text': [], }) if not params['valid']: @@ -134,7 +131,6 @@ class Partner(controller.Controller): if not partner: return self.response(code=404, description='User not found') - # Simpan perubahan data partner.write(params['value']) return self.response({ diff --git a/indoteknik_custom/models/res_partner.py b/indoteknik_custom/models/res_partner.py index 9f2c82e2..3cc1b1aa 100644 --- a/indoteknik_custom/models/res_partner.py +++ b/indoteknik_custom/models/res_partner.py @@ -92,8 +92,8 @@ class ResPartner(models.Model): if partner.company_type == 'person' and not partner.parent_id: partner.alamat_lengkap_text = partner.street - else: - partner.alamat_lengkap_text = partner.alamat_lengkap + if partner.company_type == 'person' and partner.parent_id: + partner.alamat_lengkap_text = partner.parent_id.alamat_lengkap_text alamat_lengkap = fields.Char(string="Alamat Lengkap", required=False, compute="_alamat_lengkap") alamat_lengkap_text = fields.Text(string="Alamat Lengkap", required=False) -- cgit v1.2.3 From 84cb69b4ce0a793768fbeca4367d37f21e896615 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Fri, 6 Sep 2024 16:20:11 +0700 Subject: update new register --- indoteknik_api/controllers/api_v1/partner.py | 12 +++++ indoteknik_custom/models/res_partner.py | 62 ++++++++++++------------ indoteknik_custom/models/user_company_request.py | 2 + 3 files changed, 46 insertions(+), 30 deletions(-) diff --git a/indoteknik_api/controllers/api_v1/partner.py b/indoteknik_api/controllers/api_v1/partner.py index f662fd79..b844b6ee 100644 --- a/indoteknik_api/controllers/api_v1/partner.py +++ b/indoteknik_api/controllers/api_v1/partner.py @@ -123,15 +123,27 @@ class Partner(controller.Controller): 'npwp': [], 'alamat_lengkap_text': [], }) + id_user = self.get_request_params(kw, { + 'id_user': ['number'] + }) + params_user = self.get_request_params(kw, { + 'company_type_id': ['number'], + 'industry_id': ['number'], + 'tax_name': ['alias:nama_wajib_pajak'], + 'npwp': [], + 'alamat_lengkap_text': [], + }) if not params['valid']: return self.response(code=400, description=params) partner = request.env[self._name].search([('id', '=', params['value']['id'])], limit=1) + user = request.env[self._name].search([('id', '=', id_user['value']['id_user'])], limit=1) if not partner: return self.response(code=404, description='User not found') partner.write(params['value']) + user.write(params_user['value']) return self.response({ 'id': partner.id diff --git a/indoteknik_custom/models/res_partner.py b/indoteknik_custom/models/res_partner.py index 3cc1b1aa..b8a6502c 100644 --- a/indoteknik_custom/models/res_partner.py +++ b/indoteknik_custom/models/res_partner.py @@ -92,14 +92,15 @@ class ResPartner(models.Model): if partner.company_type == 'person' and not partner.parent_id: partner.alamat_lengkap_text = partner.street - if partner.company_type == 'person' and partner.parent_id: - partner.alamat_lengkap_text = partner.parent_id.alamat_lengkap_text + # if partner.company_type == 'person' and partner.parent_id: + # partner.alamat_lengkap_text = partner.parent_id.alamat_lengkap_text + alamat_lengkap = fields.Char(string="Alamat Lengkap", required=False, compute="_alamat_lengkap") - alamat_lengkap_text = fields.Text(string="Alamat Lengkap", required=False) + alamat_lengkap_text = fields.Text(string="Alamat Lengkap", required=False , tracking=3) - # def write(self, vals): - # res = super(ResPartner, self).write(vals) + def write(self, vals): + res = super(ResPartner, self).write(vals) # # # if 'property_payment_term_id' in vals: # # if not self.env.user.is_accounting and vals['property_payment_term_id'] != 26: @@ -110,33 +111,34 @@ class ResPartner(models.Model): # # if self.env.user.id not in users_in_group.mapped('id'): # # raise UserError('You name it') # - # return res - - def write(self, vals): - if self.company_type == 'person': - if self.parent_id: - parent = self.parent_id - vals['customer_type'] = parent.customer_type - vals['nama_wajib_pajak'] = parent.nama_wajib_pajak - vals['npwp'] = parent.npwp - vals['sppkp'] = parent.sppkp - vals['alamat_lengkap_text'] = parent.alamat_lengkap_text - vals['industry_id'] = parent.industry_id.id - vals['company_type_id'] = parent.company_type_id.id - - res = super(ResPartner, self).write(vals) return res - @api.onchange('company_type') - def _onchange_company_type(self): - if self.company_type == 'person' and self.parent_id: - self.customer_type = self.parent_id.customer_type - self.npwp = self.parent_id.npwp - self.sppkp = self.parent_id.sppkp - self.nama_wajib_pajak = self.parent_id.nama_wajib_pajak - self.alamat_lengkap_text = self.parent_id.alamat_lengkap_text - self.industry_id = self.parent_id.industry_id.id - self.company_type_id = self.parent_id.company_type_id.id + # def write(self, vals): + # if self.company_type == 'person': + # if self.parent_id: + # parent = self.parent_id + # vals['customer_type'] = parent.customer_type + # vals['nama_wajib_pajak'] = parent.nama_wajib_pajak + # vals['npwp'] = parent.npwp + # vals['sppkp'] = parent.sppkp + # vals['alamat_lengkap_text'] = parent.alamat_lengkap_text + # vals['industry_id'] = parent.industry_id.id + # vals['company_type_id'] = parent.company_type_id.id + # + # res = super(ResPartner, self).write(vals) + # return res + + @api.depends('company_type', 'parent_id', 'npwp', 'sppkp', 'nama_wajib_pajak','alamat_lengkap_text', 'industry_id', 'company_type_id') + def _related_fields(self): + for partner in self: + if partner.company_type == 'person' and partner.parent_id: + partner.customer_type = partner.parent_id.customer_type + partner.npwp = partner.parent_id.npwp + partner.sppkp = partner.parent_id.sppkp + partner.nama_wajib_pajak = partner.parent_id.nama_wajib_pajak + partner.alamat_lengkap_text = partner.parent_id.alamat_lengkap_text + partner.industry_id = partner.parent_id.industry_id.id + partner.company_type_id = partner.parent_id.company_type_id.id @api.constrains('property_payment_term_id') def updated_by_payment_term(self): diff --git a/indoteknik_custom/models/user_company_request.py b/indoteknik_custom/models/user_company_request.py index d6134650..56bb8d5d 100644 --- a/indoteknik_custom/models/user_company_request.py +++ b/indoteknik_custom/models/user_company_request.py @@ -27,6 +27,8 @@ class UserCompanyRequest(models.Model): self.user_id.sppkp = self.user_company_id.sppkp self.user_id.nama_wajib_pajak = self.user_company_id.nama_wajib_pajak self.user_id.alamat_lengkap_text = self.user_company_id.alamat_lengkap_text + self.user_id.industry_id = self.user_company_id.industry_id.id + self.user_id.company_type_id = self.user_company_id.company_type_id.id self.user_id.user_id = self.user_company_id.user_id self.user_id.property_account_receivable_id = self.user_company_id.property_account_receivable_id self.user_id.property_account_payable_id = self.user_company_id.property_account_payable_id -- cgit v1.2.3 From fdd67910ef7d4dd66803d09a7c49b1c3faabdd18 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Thu, 12 Sep 2024 10:53:10 +0700 Subject: deactivate function update_purchase_price_so_line --- indoteknik_custom/models/automatic_purchase.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indoteknik_custom/models/automatic_purchase.py b/indoteknik_custom/models/automatic_purchase.py index 1d1322fa..13c83b04 100644 --- a/indoteknik_custom/models/automatic_purchase.py +++ b/indoteknik_custom/models/automatic_purchase.py @@ -262,7 +262,7 @@ class AutomaticPurchase(models.Model): new_po_line = self.env['purchase.order.line'].create([param_line]) line.current_po_id = new_po.id line.current_po_line_id = new_po_line.id - self.update_purchase_price_so_line(line) + # self.update_purchase_price_so_line(line) self.create_purchase_order_sales_match(new_po) -- cgit v1.2.3 From 33d2a0583d74182709588313ad0eae70c8569f02 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Thu, 12 Sep 2024 12:18:59 +0700 Subject: update new register --- indoteknik_api/controllers/api_v1/partner.py | 3 + indoteknik_api/controllers/api_v1/user.py | 143 ++++++++++++++++++++++++++- indoteknik_api/models/res_users.py | 2 + indoteknik_custom/models/res_partner.py | 8 +- 4 files changed, 151 insertions(+), 5 deletions(-) diff --git a/indoteknik_api/controllers/api_v1/partner.py b/indoteknik_api/controllers/api_v1/partner.py index b844b6ee..b7dcdb0d 100644 --- a/indoteknik_api/controllers/api_v1/partner.py +++ b/indoteknik_api/controllers/api_v1/partner.py @@ -66,6 +66,7 @@ class Partner(controller.Controller): 'name': ['required'], 'email': ['required'], 'mobile': ['required'], + 'phone': ['required'], 'street': ['required'], 'city_id': ['required', 'number', 'alias:kota_id'], 'district_id': ['number', 'alias:kecamatan_id'], @@ -95,6 +96,7 @@ class Partner(controller.Controller): 'name': ['required'], 'email': ['required'], 'mobile': ['required'], + 'phone': ['required'], 'street': ['required'], 'city_id': ['required', 'number', 'alias:kota_id'], 'district_id': ['number', 'alias:kecamatan_id'], @@ -122,6 +124,7 @@ class Partner(controller.Controller): 'tax_name': ['alias:nama_wajib_pajak'], 'npwp': [], 'alamat_lengkap_text': [], + 'street': [], }) id_user = self.get_request_params(kw, { 'id_user': ['number'] diff --git a/indoteknik_api/controllers/api_v1/user.py b/indoteknik_api/controllers/api_v1/user.py index ea74d297..9a15f404 100644 --- a/indoteknik_api/controllers/api_v1/user.py +++ b/indoteknik_api/controllers/api_v1/user.py @@ -149,7 +149,7 @@ class User(controller.Controller): 'login': email, 'mobile': phone, 'password': password, - 'active': False, + 'active': True, 'sel_groups_1_9_10': 9 } @@ -403,3 +403,144 @@ class User(controller.Controller): x) for x in partners] return self.response(address) + + @http.route(prefix + 'user//switch', auth='public', methods=['PUT', 'OPTIONS'], csrf=False) + @controller.Controller.must_authorized() + def switch_account(self, **kw): + id = kw.get('id') + user = request.env['res.users'].search([('id', '=', id)], limit=1) + + response = { + 'switch': False, + 'reason': None + } + + # Form Data + npwp = kw.get('npwp') + npwp_document = kw.get('npwp_document', False) + npwp_filename = kw.get('npwp_filename', 'npwp_document') + sppkp = kw.get('sppkp', False) + sppkp_document = kw.get('sppkp_document', False) + sppkp_filename = kw.get('sppkp_filename', 'sppkp_document') + email_partner = kw.get('email_partner') + business_name = kw.get('business_name', False) + industry_id = int(kw.get('industry_id', '0') or 0) + company_type_id = int(kw.get('company_type_id', '0') or 0) + alamat_wajib_pajak = kw.get('alamat_wajib_pajak', False) + alamat_bisnis = kw.get('alamat_bisnis', False) + nama_wajib_pajak = kw.get('nama_wajib_pajak', False) + is_pkp = kw.get('is_pkp') + type_acc = kw.get('type_acc', False) + + + response = { + 'switch': False, + 'reason': None + } + + if type_acc == 'business': + parameter = [ + ('company_type', '=', 'company'), + ('name', 'ilike', business_name) + ] + match_company = request.env['res.partner'].search(parameter, limit=1) + match_ratio = 0 + if match_company: + match_ratio = SequenceMatcher(None, match_company.name, business_name).ratio() + if match_ratio > 0.8: + # Create a user company request + request.env['user.company.request'].create({ + 'user_id': user.partner_id.id, + 'user_company_id': match_company.id, + 'user_input': business_name + }) + else: + if not nama_wajib_pajak and is_pkp == 'false': + nama_wajib_pajak = business_name + + if not alamat_wajib_pajak and is_pkp == 'false': + alamat_wajib_pajak = alamat_bisnis + + new_company_data = { + 'name': business_name if business_name else business_name, + 'company_type_id': company_type_id if company_type_id else False, + 'industry_id': industry_id, + 'customer_type': 'pkp' if is_pkp == 'true' else 'nonpkp', + 'npwp': npwp if is_pkp == 'true' else (npwp if npwp else '00.000.000.0-000.000'), + 'sppkp': sppkp if is_pkp == 'true' else (sppkp if sppkp else '-'), + 'nama_wajib_pajak': nama_wajib_pajak, + 'alamat_lengkap_text': alamat_wajib_pajak, + 'email': email_partner, + 'street': alamat_bisnis, + 'company_type': 'company', + 'user_id': 3222, + 'property_account_receivable_id': 395, + 'property_account_payable_id': 438, + 'active': False, + } + new_company = request.env['res.partner'].create(new_company_data) + request.env['user.company.request'].create({ + 'user_id': user.partner_id.id, + 'user_company_id': new_company.id, + 'user_input': business_name + }) + # user.partner_id.parent_id = new_company.id + # user.partner_id.customer_type = new_company.customer_type + # user.partner_id.npwp = new_company.npwp + # user.partner_id.sppkp = new_company.sppkp + # user.partner_id.nama_wajib_pajak = new_company.nama_wajib_pajak + # user.partner_id.alamat_lengkap_text = new_company.alamat_lengkap_text + + if npwp_document: + npwp_mimetype, _ = mimetypes.guess_type(npwp_filename) + npwp_mimetype = npwp_mimetype or 'application/octet-stream' + pdf_data = base64.b64decode(npwp_document) + npwp_attachment = request.env['ir.attachment'].create({ + 'name': 'NPWP Document', + 'type': 'binary', + 'datas': base64.b64encode(pdf_data), + 'res_model': 'res.partner', + 'res_id': new_company.id, + 'mimetype': npwp_mimetype + }) + new_company.message_post(body="NPWP Uploaded", attachment_ids=[npwp_attachment.id]) + + if sppkp_document: + sppkp_mimetype, _ = mimetypes.guess_type(sppkp_filename) + sppkp_mimetype = sppkp_mimetype or 'application/octet-stream' + pdf_data = base64.b64decode(sppkp_document) + sppkp_attachment = request.env['ir.attachment'].create({ + 'name': 'SPPKP Document', + 'type': 'binary', + 'datas': base64.b64encode(pdf_data), + 'res_model': 'res.partner', + 'res_id': new_company.id, + 'mimetype': sppkp_mimetype + }) + new_company.message_post(body="SPPKP Uploaded", attachment_ids=[sppkp_attachment.id]) + + response['switch'] = 'Pending' + return self.response(response) + + @http.route(prefix + 'user//switch_progres', auth='public', methods=['GET', 'OPTIONS'], csrf=False) + # @controller.Controller.must_authorized() + def switch_account_progres(self, **kw): + id = int(kw.get('id')) + user = request.env['res.users'].search([('id', '=', id)], limit=1) + response = { + 'status': '' + } + parameter = [ + ('user_id', '=', id) + ] + new_company_request = request.env['user.company.request'].search(parameter, limit=1) + is_approve = '' + if new_company_request: + # Mengambil nilai is_approve + if new_company_request.is_approve == False: + response['status'] = 'pending' + else: + response['status'] = new_company_request.is_approve + else: + response['status'] = 'unknown' + return self.response(response) \ No newline at end of file diff --git a/indoteknik_api/models/res_users.py b/indoteknik_api/models/res_users.py index 2c0a986b..b2e8acfe 100644 --- a/indoteknik_api/models/res_users.py +++ b/indoteknik_api/models/res_users.py @@ -43,6 +43,7 @@ class ResUsers(models.Model): 'type': user.type or '', 'name': user.name or '', 'mobile': user.mobile or '', + 'phone': user.phone or '', 'email': user.email or '', 'street': user.street or '', 'street2': user.street2 or '', @@ -56,6 +57,7 @@ class ResUsers(models.Model): 'npwp': user.npwp or '', 'rajaongkir_city_id': user.kecamatan_id.rajaongkir_id or 0, 'alamat_wajib_pajak': user.alamat_lengkap_text or None, + 'alamat_bisnis': user.street or None, } if user.kota_id: diff --git a/indoteknik_custom/models/res_partner.py b/indoteknik_custom/models/res_partner.py index b8a6502c..4c6621d4 100644 --- a/indoteknik_custom/models/res_partner.py +++ b/indoteknik_custom/models/res_partner.py @@ -88,7 +88,7 @@ class ResPartner(models.Model): if partner.state_id: lengkap += " " + partner.state_id.name - partner.alamat_lengkap = lengkap.upper() + # partner.alamat_lengkap = lengkap.upper() if partner.company_type == 'person' and not partner.parent_id: partner.alamat_lengkap_text = partner.street @@ -99,8 +99,8 @@ class ResPartner(models.Model): alamat_lengkap = fields.Char(string="Alamat Lengkap", required=False, compute="_alamat_lengkap") alamat_lengkap_text = fields.Text(string="Alamat Lengkap", required=False , tracking=3) - def write(self, vals): - res = super(ResPartner, self).write(vals) + # def write(self, vals): + # res = super(ResPartner, self).write(vals) # # # if 'property_payment_term_id' in vals: # # if not self.env.user.is_accounting and vals['property_payment_term_id'] != 26: @@ -111,7 +111,7 @@ class ResPartner(models.Model): # # if self.env.user.id not in users_in_group.mapped('id'): # # raise UserError('You name it') # - return res + # return res # def write(self, vals): # if self.company_type == 'person': -- cgit v1.2.3 From 9d28e451949bef17c40b1a188d4d744c17715925 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Thu, 12 Sep 2024 14:00:12 +0700 Subject: cr po --- indoteknik_custom/report/purchase_order.xml | 16 ---------------- indoteknik_custom/views/purchase_order.xml | 1 - 2 files changed, 17 deletions(-) diff --git a/indoteknik_custom/report/purchase_order.xml b/indoteknik_custom/report/purchase_order.xml index 98af3188..0f392630 100644 --- a/indoteknik_custom/report/purchase_order.xml +++ b/indoteknik_custom/report/purchase_order.xml @@ -11,21 +11,5 @@

- - - Delivery Amt - - - - - - Grand Total - - - - - diff --git a/indoteknik_custom/views/purchase_order.xml b/indoteknik_custom/views/purchase_order.xml index 6bc97bbf..11b42147 100755 --- a/indoteknik_custom/views/purchase_order.xml +++ b/indoteknik_custom/views/purchase_order.xml @@ -48,7 +48,6 @@ - -- cgit v1.2.3 From a37bc839612b5162b4446182ac23c1dfd1c3253e Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Thu, 12 Sep 2024 14:17:36 +0700 Subject: calculate margin after purchase delivery deduction --- indoteknik_custom/models/automatic_purchase.py | 6 ++++- indoteknik_custom/models/purchase_order.py | 11 +++++++++ .../models/purchase_order_sales_match.py | 12 +++++++++- indoteknik_custom/models/sale_order.py | 26 ++++++++++++++++++++++ indoteknik_custom/views/purchase_order.xml | 5 ++++- indoteknik_custom/views/sale_order.xml | 2 ++ 6 files changed, 59 insertions(+), 3 deletions(-) diff --git a/indoteknik_custom/models/automatic_purchase.py b/indoteknik_custom/models/automatic_purchase.py index 1d1322fa..4531cff9 100644 --- a/indoteknik_custom/models/automatic_purchase.py +++ b/indoteknik_custom/models/automatic_purchase.py @@ -293,6 +293,9 @@ class AutomaticPurchase(models.Model): sale_ids_set.add(sale_id_with_salesperson) sale_ids_name.add(sale_order.sale_id.name) + margin_item = sale_order.sale_line_id.item_margin / sale_order.qty_so if sale_order.qty_so else 0 + margin_item = margin_item * sale_order.qty_po + matches_so_line = { 'purchase_order_id': purchase_order.id, 'sale_id': sale_order.sale_id.id, @@ -305,7 +308,8 @@ class AutomaticPurchase(models.Model): 'product_id': sale_order.product_id.id, 'qty_so': sale_order.qty_so, 'qty_po': sale_order.qty_po, - 'margin_so': sale_order.sale_line_id.item_percent_margin + 'margin_so': sale_order.sale_line_id.item_percent_margin, + 'margin_item': margin_item } po_matches_so_line = self.env['purchase.order.sales.match'].create([matches_so_line]) diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index edcbbb19..afa67cf2 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -69,6 +69,17 @@ class PurchaseOrder(models.Model): date_done_picking = fields.Datetime(string='Date Done Picking', compute='get_date_done') bills_dp_id = fields.Many2one('account.move', string='Bills DP') grand_total = fields.Monetary(string='Grand Total', help='Amount total + amount delivery', compute='_compute_grand_total') + total_margin_match = fields.Float(string='Total Margin Match', compute='_compute_total_margin_match') + + def _compute_total_margin_match(self): + for purchase in self: + match = self.env['purchase.order.sales.match'] + result = match.read_group( + [('purchase_order_id.id', '=', purchase.id)], + ['margin_item'], + [] + ) + purchase.total_margin_match = result[0].get('margin_item', 0.0) def _compute_grand_total(self): for order in self: diff --git a/indoteknik_custom/models/purchase_order_sales_match.py b/indoteknik_custom/models/purchase_order_sales_match.py index 78581409..d1d929d3 100644 --- a/indoteknik_custom/models/purchase_order_sales_match.py +++ b/indoteknik_custom/models/purchase_order_sales_match.py @@ -20,7 +20,17 @@ class PurchaseOrderSalesMatch(models.Model): product_id = fields.Many2one('product.product', string='Product') qty_so = fields.Float(string='Qty SO') qty_po = fields.Float(string='Qty PO') - margin_so = fields.Float(string='Margin SO') + margin_so = fields.Float(string='Margin SO') + margin_item = fields.Float(string='Margin') + delivery_amt = fields.Float(string='Delivery Amount', compute='_compute_delivery_amt') + margin_deduct = fields.Float(string='After Deduct', compute='_compute_delivery_amt') + + def _compute_delivery_amt(self): + for line in self: + percent_margin = line.margin_item / line.purchase_order_id.total_margin_match \ + if line.purchase_order_id.total_margin_match else 0 + line.delivery_amt = line.purchase_order_id.delivery_amt * percent_margin + line.margin_deduct = line.margin_item - line.delivery_amt @api.onchange('sale_id') def onchange_sale_id(self): diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index 9506aedb..9a6dbd9e 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -112,6 +112,32 @@ class SaleOrder(models.Model): note_website = fields.Char(string="Note Website") use_button = fields.Boolean(string='Using Calculate Selling Price', copy=False) voucher_shipping_id = fields.Many2one(comodel_name='voucher', string='Voucher Shipping', copy=False) + margin_after_delivery_purchase = fields.Float(string='Margin After Delivery Purchase', compute='_compute_margin_after_delivery_purchase') + percent_margin_after_delivery_purchase = fields.Float(string='% Margin After Delivery Purchase', compute='_compute_margin_after_delivery_purchase') + purchase_delivery_amt = fields.Float(string='Purchase Delivery Amount', compute='_compute_purchase_delivery_amount') + + def _compute_purchase_delivery_amount(self): + for order in self: + match = self.env['purchase.order.sales.match'] + result2 = match.search([ + ('sale_id.id', '=', order.id) + ]) + delivery_amt = 0 + for res in result2: + delivery_amt = res.delivery_amt + order.purchase_delivery_amt = delivery_amt + + def _compute_margin_after_delivery_purchase(self): + for order in self: + order.margin_after_delivery_purchase = order.total_margin - order.purchase_delivery_amt + if order.amount_untaxed == 0: + order.total_percent_margin = 0 + continue + if order.shipping_cost_covered == 'indoteknik': + delivery_amt = order.delivery_amt + else: + delivery_amt = 0 + order.percent_margin_after_delivery_purchase = round((order.margin_after_delivery_purchase / (order.amount_untaxed-delivery_amt-order.fee_third_party)) * 100, 2) def _compute_date_kirim(self): for rec in self: diff --git a/indoteknik_custom/views/purchase_order.xml b/indoteknik_custom/views/purchase_order.xml index 6bc97bbf..346b31a5 100755 --- a/indoteknik_custom/views/purchase_order.xml +++ b/indoteknik_custom/views/purchase_order.xml @@ -34,12 +34,12 @@ - + @@ -237,6 +237,9 @@ + + + diff --git a/indoteknik_custom/views/sale_order.xml b/indoteknik_custom/views/sale_order.xml index 58b67348..e772dcae 100755 --- a/indoteknik_custom/views/sale_order.xml +++ b/indoteknik_custom/views/sale_order.xml @@ -69,6 +69,8 @@ + + -- cgit v1.2.3 From c36fb56b19bbd33e0f6a3d6f16a939f7fb6a0ead Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Thu, 12 Sep 2024 15:24:17 +0700 Subject: update new register --- indoteknik_custom/models/res_partner.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indoteknik_custom/models/res_partner.py b/indoteknik_custom/models/res_partner.py index 4c6621d4..5e1eba09 100644 --- a/indoteknik_custom/models/res_partner.py +++ b/indoteknik_custom/models/res_partner.py @@ -88,7 +88,7 @@ class ResPartner(models.Model): if partner.state_id: lengkap += " " + partner.state_id.name - # partner.alamat_lengkap = lengkap.upper() + partner.alamat_lengkap = lengkap.upper() if partner.company_type == 'person' and not partner.parent_id: partner.alamat_lengkap_text = partner.street -- cgit v1.2.3 From c81f7b9f21d5ae9c77758a67bbf961fb42697dd8 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Fri, 13 Sep 2024 10:30:15 +0700 Subject: validation product sementara --- indoteknik_custom/models/sale_order_line.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indoteknik_custom/models/sale_order_line.py b/indoteknik_custom/models/sale_order_line.py index a64a744c..50438dbe 100644 --- a/indoteknik_custom/models/sale_order_line.py +++ b/indoteknik_custom/models/sale_order_line.py @@ -348,7 +348,7 @@ class SaleOrderLine(models.Model): def validate_line(self): for line in self: - if line.product_id.id in [385544, 224484]: + if line.product_id.id in [385544, 224484, 417724]: raise UserError('Produk Sementara Tidak Bisa Di Confirm atau Ask Approval') if not line.product_id or line.product_id.type == 'service': continue -- cgit v1.2.3 From f44dc785ffcce7738c284fd40d79dbece7b2e5cb Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Fri, 13 Sep 2024 14:22:19 +0700 Subject: add validation on stock picking gudang selisih --- indoteknik_custom/models/stock_picking.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index d16d508e..3dd960e2 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -373,6 +373,9 @@ class StockPicking(models.Model): if self.picking_type_id.id == 28 and not self.env.user.is_logistic_approver: raise UserError("Harus di Approve oleh Logistik") + + if self.location_dest_id.id == 47 and not self.env.user.is_purchasing_manager: + raise UserError("Transfer ke gudang selisih harus di approve Rafly Hanggara") if self.group_id.sale_id: if self.group_id.sale_id.payment_link_midtrans: -- cgit v1.2.3 From 649a8f0d51b8fa7dc90dfbd0967e94dd586cd0aa Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Fri, 13 Sep 2024 16:21:50 +0700 Subject: bug fix sales order with amount equal zero --- 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 9a6dbd9e..6348328e 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -131,7 +131,7 @@ class SaleOrder(models.Model): for order in self: order.margin_after_delivery_purchase = order.total_margin - order.purchase_delivery_amt if order.amount_untaxed == 0: - order.total_percent_margin = 0 + order.percent_margin_after_delivery_purchase = 0 continue if order.shipping_cost_covered == 'indoteknik': delivery_amt = order.delivery_amt -- cgit v1.2.3 From 2e9f95e8201692317d1ce23f6992fdb0e37dc95c Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Fri, 13 Sep 2024 16:51:28 +0700 Subject: cr archive product --- indoteknik_custom/models/product_template.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/indoteknik_custom/models/product_template.py b/indoteknik_custom/models/product_template.py index 000ee3bf..031d1b5b 100755 --- a/indoteknik_custom/models/product_template.py +++ b/indoteknik_custom/models/product_template.py @@ -388,8 +388,16 @@ class ProductProduct(models.Model): if product_template.active and product.active: if not product.active and len(variants) == 1: product_template.with_context(skip_active_constraint=True).active = False + product_template.unpublished = True elif not product.active and len(variants) > 1: - continue + all_inactive = all(not variant.active for variant in variants) + if all_inactive: + product_template.with_context(skip_active_constraint=True).active = False + product_template.unpublished = True + else: + continue + if any(variant.active for variant in variants): + product_template.unpublished = False def update_internal_reference_variants(self, limit=100): variants = self.env['product.product'].search([ -- cgit v1.2.3 From 98bdb05daa79c46b0a1f4284d19e65ed3a7d2f48 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Sat, 14 Sep 2024 13:30:14 +0700 Subject: bug fix delete purchase order line cause of calculate margin match --- indoteknik_custom/models/purchase_order.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index afa67cf2..8a47482a 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -75,7 +75,7 @@ class PurchaseOrder(models.Model): for purchase in self: match = self.env['purchase.order.sales.match'] result = match.read_group( - [('purchase_order_id.id', '=', purchase.id)], + [('purchase_order_id', '=', purchase.id)], ['margin_item'], [] ) -- cgit v1.2.3 From b14ec46d5c0d8e75558cff9cf38cb2372b82af3b Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Tue, 17 Sep 2024 14:04:33 +0700 Subject: update new register --- indoteknik_custom/models/res_partner.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/indoteknik_custom/models/res_partner.py b/indoteknik_custom/models/res_partner.py index 5e1eba09..b8a6502c 100644 --- a/indoteknik_custom/models/res_partner.py +++ b/indoteknik_custom/models/res_partner.py @@ -99,8 +99,8 @@ class ResPartner(models.Model): alamat_lengkap = fields.Char(string="Alamat Lengkap", required=False, compute="_alamat_lengkap") alamat_lengkap_text = fields.Text(string="Alamat Lengkap", required=False , tracking=3) - # def write(self, vals): - # res = super(ResPartner, self).write(vals) + def write(self, vals): + res = super(ResPartner, self).write(vals) # # # if 'property_payment_term_id' in vals: # # if not self.env.user.is_accounting and vals['property_payment_term_id'] != 26: @@ -111,7 +111,7 @@ class ResPartner(models.Model): # # if self.env.user.id not in users_in_group.mapped('id'): # # raise UserError('You name it') # - # return res + return res # def write(self, vals): # if self.company_type == 'person': -- cgit v1.2.3 From f0aaf4476c8b92cb68503e9760216ca20fe4e34d Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Tue, 17 Sep 2024 14:05:31 +0700 Subject: api check_tempo and add type promotion on sale order --- indoteknik_api/controllers/api_v1/partner.py | 28 ++++++++++++++++++++++++++++ indoteknik_custom/models/sale_order.py | 11 +++++++++++ indoteknik_custom/views/sale_order.xml | 1 + 3 files changed, 40 insertions(+) diff --git a/indoteknik_api/controllers/api_v1/partner.py b/indoteknik_api/controllers/api_v1/partner.py index 69a2f861..83f92a19 100644 --- a/indoteknik_api/controllers/api_v1/partner.py +++ b/indoteknik_api/controllers/api_v1/partner.py @@ -164,4 +164,32 @@ class Partner(controller.Controller): }) return self.response(data) + + @http.route(prefix + 'check//tempo', auth='public', methods=['GET', 'OPTIONS']) + @controller.Controller.must_authorized() + def get_check_tempo_partner(self, **kw): + partner_id = int(kw.get('partner_id')) + + partner = request.env['res.partner'].search([('id', '=', partner_id)], limit=1) + if not partner: + return self.response(code=404, description='Partner not found') + + partner = partner.parent_id or partner + + if any(line.days == 0 for line in partner.property_payment_term_id.line_ids): + return self.response(code=402, description='Partner not tempo') + + result_tempo = sum(m.amount_total_signed for m in request.env['account.move'].search([('partner_id', '=', partner.id), ('payment_state', '=', 'not_paid'), ('state', '=', 'posted')])) + + remaining_limit = partner.blocking_stage - result_tempo if partner.active_limit else None + + data = { + 'name': partner.name, + 'amount_due': result_tempo, + 'remaining_limit': remaining_limit + } + + return self.response(data) + + diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index 6348328e..43ee3ef9 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -115,6 +115,17 @@ class SaleOrder(models.Model): margin_after_delivery_purchase = fields.Float(string='Margin After Delivery Purchase', compute='_compute_margin_after_delivery_purchase') percent_margin_after_delivery_purchase = fields.Float(string='% Margin After Delivery Purchase', compute='_compute_margin_after_delivery_purchase') purchase_delivery_amt = fields.Float(string='Purchase Delivery Amount', compute='_compute_purchase_delivery_amount') + type_promotion = fields.Char(string='Type Promotion', compute='_compute_type_promotion') + + def _compute_type_promotion(self): + for rec in self: + promotion_types = [] + for promotion in rec.order_promotion_ids: + for line_program in promotion.program_line_id: + if line_program.promotion_type: + promotion_types.append(dict(line_program._fields['promotion_type'].selection).get(line_program.promotion_type)) + + rec.type_promotion = ', '.join(promotion_types) def _compute_purchase_delivery_amount(self): for order in self: diff --git a/indoteknik_custom/views/sale_order.xml b/indoteknik_custom/views/sale_order.xml index e772dcae..f2789254 100755 --- a/indoteknik_custom/views/sale_order.xml +++ b/indoteknik_custom/views/sale_order.xml @@ -32,6 +32,7 @@ +

-- cgit v1.2.3 From 1698ec300f2e7c363e41cb51ce94a39f66d6088b Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Tue, 17 Sep 2024 14:43:22 +0700 Subject: cr type promotion --- 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 43ee3ef9..65b92601 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -125,7 +125,9 @@ class SaleOrder(models.Model): if line_program.promotion_type: promotion_types.append(dict(line_program._fields['promotion_type'].selection).get(line_program.promotion_type)) - rec.type_promotion = ', '.join(promotion_types) + # Removing duplicates by converting to a set, then back to a list + rec.type_promotion = ', '.join(sorted(set(promotion_types))) + def _compute_purchase_delivery_amount(self): for order in self: -- cgit v1.2.3 From fd66c221b48c28a3aaf45500572821aaae84c0de Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Tue, 17 Sep 2024 15:38:00 +0700 Subject: add is_efaktur_exported to tree invoices --- indoteknik_custom/models/sale_order.py | 1 - indoteknik_custom/views/account_move.xml | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index 65b92601..bd0fb75e 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -128,7 +128,6 @@ class SaleOrder(models.Model): # Removing duplicates by converting to a set, then back to a list rec.type_promotion = ', '.join(sorted(set(promotion_types))) - def _compute_purchase_delivery_amount(self): for order in self: match = self.env['purchase.order.sales.match'] diff --git a/indoteknik_custom/views/account_move.xml b/indoteknik_custom/views/account_move.xml index 93145fea..2863af57 100644 --- a/indoteknik_custom/views/account_move.xml +++ b/indoteknik_custom/views/account_move.xml @@ -85,6 +85,7 @@ + Date: Tue, 17 Sep 2024 17:22:50 +0700 Subject: uppdate new register --- indoteknik_api/controllers/api_v1/partner.py | 4 ++-- indoteknik_custom/models/res_partner.py | 31 +--------------------------- 2 files changed, 3 insertions(+), 32 deletions(-) diff --git a/indoteknik_api/controllers/api_v1/partner.py b/indoteknik_api/controllers/api_v1/partner.py index b7dcdb0d..3cc6b193 100644 --- a/indoteknik_api/controllers/api_v1/partner.py +++ b/indoteknik_api/controllers/api_v1/partner.py @@ -66,7 +66,7 @@ class Partner(controller.Controller): 'name': ['required'], 'email': ['required'], 'mobile': ['required'], - 'phone': ['required'], + 'phone': [''], 'street': ['required'], 'city_id': ['required', 'number', 'alias:kota_id'], 'district_id': ['number', 'alias:kecamatan_id'], @@ -96,7 +96,7 @@ class Partner(controller.Controller): 'name': ['required'], 'email': ['required'], 'mobile': ['required'], - 'phone': ['required'], + 'phone': [''], 'street': ['required'], 'city_id': ['required', 'number', 'alias:kota_id'], 'district_id': ['number', 'alias:kecamatan_id'], diff --git a/indoteknik_custom/models/res_partner.py b/indoteknik_custom/models/res_partner.py index b8a6502c..7392b10d 100644 --- a/indoteknik_custom/models/res_partner.py +++ b/indoteknik_custom/models/res_partner.py @@ -60,43 +60,14 @@ class ResPartner(models.Model): @api.depends("street", "street2", "city", "state_id", "country_id", "blok", "nomor", "rt", "rw", "kelurahan_id", "kecamatan_id") - def _alamat_lengkap(self): + def _alamat_lengkap_text(self): for partner in self: - lengkap = partner.street or "" - lengkap += " " + (partner.street2 or '') - - if partner.blok: - lengkap += " Blok: " + partner.blok + ", " - if partner.nomor: - lengkap += " Nomor: " + partner.nomor + ", " - - if partner.rt: - lengkap += " RT: " + partner.rt - if partner.rw: - lengkap += " RW: " + partner.rw - - if partner.kelurahan_id: - lengkap += " Kel: " + partner.kelurahan_id.name + "," - - if partner.kecamatan_id: - lengkap += " Kec: " + partner.kecamatan_id.name - - if partner.kota_id: - lengkap += """ - """ + partner.kota_id.name + "," - - if partner.state_id: - lengkap += " " + partner.state_id.name - - partner.alamat_lengkap = lengkap.upper() - if partner.company_type == 'person' and not partner.parent_id: partner.alamat_lengkap_text = partner.street # if partner.company_type == 'person' and partner.parent_id: # partner.alamat_lengkap_text = partner.parent_id.alamat_lengkap_text - alamat_lengkap = fields.Char(string="Alamat Lengkap", required=False, compute="_alamat_lengkap") alamat_lengkap_text = fields.Text(string="Alamat Lengkap", required=False , tracking=3) def write(self, vals): -- cgit v1.2.3 From aabe85f0b4fe6e88a99d4bfa946599d220a9aa9f Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Wed, 18 Sep 2024 08:49:43 +0700 Subject: testing code --- indoteknik_api/controllers/api_v1/cart.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indoteknik_api/controllers/api_v1/cart.py b/indoteknik_api/controllers/api_v1/cart.py index 6bbb812c..2a24b205 100644 --- a/indoteknik_api/controllers/api_v1/cart.py +++ b/indoteknik_api/controllers/api_v1/cart.py @@ -16,7 +16,7 @@ class Cart(controller.Controller): offset = int(kw.get('offset', 0)) query = [('user_id', '=', user_id)] carts = user_cart.search(query, limit=limit, offset=offset, order='create_date desc') - carts.write({'source': 'add_to_cart'}) + # carts.write({'source': 'add_to_cart'}) products = [] products_inactive = [] for cart in carts: -- cgit v1.2.3 From b34c5cc5d6cc3dc1e9ccf43cecc14a5a7a427992 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Wed, 18 Sep 2024 11:02:51 +0700 Subject: change condition --- indoteknik_custom/models/account_move.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py index a7010bbe..725b3c2d 100644 --- a/indoteknik_custom/models/account_move.py +++ b/indoteknik_custom/models/account_move.py @@ -174,7 +174,7 @@ class AccountMove(models.Model): def _compute_mark_upload_efaktur(self): for move in self: - if move.date_efaktur_exported or move.is_efaktur_exported or move.efaktur_document: + if move.efaktur_document: move.mark_upload_efaktur = 'sudah_upload' else: move.mark_upload_efaktur = 'belum_upload' -- cgit v1.2.3 From d299eca8138b07dcbddf540038b8deeb4fcc7c8a Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Wed, 18 Sep 2024 17:00:16 +0700 Subject: change false new register --- indoteknik_api/controllers/api_v1/user.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indoteknik_api/controllers/api_v1/user.py b/indoteknik_api/controllers/api_v1/user.py index 9a15f404..4bef2f03 100644 --- a/indoteknik_api/controllers/api_v1/user.py +++ b/indoteknik_api/controllers/api_v1/user.py @@ -149,7 +149,7 @@ class User(controller.Controller): 'login': email, 'mobile': phone, 'password': password, - 'active': True, + 'active': False, 'sel_groups_1_9_10': 9 } -- cgit v1.2.3 From 95a65f3a543ca628b16acd5bc5e28d50e7cbe24c Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Thu, 19 Sep 2024 09:16:11 +0700 Subject: push --- indoteknik_custom/models/sale_order.py | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index bd0fb75e..1e9d3992 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -430,10 +430,22 @@ class SaleOrder(models.Model): # return [('id', 'not in', order_ids)] # return ['&', ('order_line.invoice_lines.move_id.move_type', 'in', ('out_invoice', 'out_refund')), ('order_line.invoice_lines.move_id', operator, value)] - @api.onchange('partner_shipping_id') - def onchange_partner_shipping(self): - self.real_shipping_id = self.partner_shipping_id - self.real_invoice_id = self.partner_invoice_id + + def check_data_real_delivery_address(self): + real_delivery_address = self.real_shipping_id + + if not real_delivery_address.state_id: + raise UserError('State Real Delivery Address harus diisi') + if not real_delivery_address.zip: + raise UserError('Zip code Real Delivery Address harus diisi') + if not real_delivery_address.mobile: + raise UserError('Mobile Real Delivery Address harus diisi') + if not real_delivery_address.phone: + raise UserError('Phone Real Delivery Address harus diisi') + if not real_delivery_address.kecamatan_id: + raise UserError('Kecamatan Real Delivery Address harus diisi') + if not real_delivery_address.kelurahan_id: + raise UserError('Kelurahan Real Delivery Address harus diisi') @api.onchange('partner_id') def onchange_partner_contact(self): @@ -658,6 +670,7 @@ class SaleOrder(models.Model): def action_confirm(self): for order in self: + order.check_data_real_delivery_address() order.sale_order_check_approve() order._validate_order() order.order_line.validate_line() -- cgit v1.2.3 From c1d1b273e2eeb3c4713fe174846ec7687ec2026b Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Thu, 19 Sep 2024 09:57:39 +0700 Subject: update new register --- indoteknik_api/controllers/api_v1/user.py | 1 + indoteknik_custom/models/res_partner.py | 3 ++- indoteknik_custom/models/user_company_request.py | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/indoteknik_api/controllers/api_v1/user.py b/indoteknik_api/controllers/api_v1/user.py index 4bef2f03..4dfc837b 100644 --- a/indoteknik_api/controllers/api_v1/user.py +++ b/indoteknik_api/controllers/api_v1/user.py @@ -203,6 +203,7 @@ class User(controller.Controller): 'user_company_id': new_company.id, 'user_input': business_name }) + # tambahkan send email ke user untuk kasi notifikasi akun bisnis ini dalam review # user.partner_id.parent_id = new_company.id # user.partner_id.customer_type = new_company.customer_type # user.partner_id.npwp = new_company.npwp diff --git a/indoteknik_custom/models/res_partner.py b/indoteknik_custom/models/res_partner.py index 7392b10d..ef857c55 100644 --- a/indoteknik_custom/models/res_partner.py +++ b/indoteknik_custom/models/res_partner.py @@ -18,7 +18,8 @@ class ResPartner(models.Model): ('pkp', 'PKP'), ('nonpkp', 'Non PKP') ]) - sppkp = fields.Char(string="SPPKP") + sppkp = fields.Char(string="SPPKP", tracking=3) + npwp = fields.Char(string="NPWP", tracking=3) counter = fields.Integer(string="Counter", default=0) leadtime = fields.Integer(string="Leadtime", default=0) digital_invoice_tax = fields.Boolean(string="Digital Invoice & Faktur Pajak") diff --git a/indoteknik_custom/models/user_company_request.py b/indoteknik_custom/models/user_company_request.py index 56bb8d5d..40ac4446 100644 --- a/indoteknik_custom/models/user_company_request.py +++ b/indoteknik_custom/models/user_company_request.py @@ -33,10 +33,12 @@ class UserCompanyRequest(models.Model): self.user_id.property_account_receivable_id = self.user_company_id.property_account_receivable_id self.user_id.property_account_payable_id = self.user_company_id.property_account_payable_id self.user_company_id.active = True + # tambahkan send email kalau bisnis berhsil di buat else: new_company = self.env['res.partner'].create({ 'name': self.user_input }) self.user_id.parent_id = new_company.id + # tambahkan send email kalau bisnis ditolak di buat return super(UserCompanyRequest, self).write(vals) \ No newline at end of file -- cgit v1.2.3 From eb7661705303a64c97e84061b53d48d5c46f6293 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Thu, 19 Sep 2024 15:08:15 +0700 Subject: add email user company request status --- indoteknik_api/controllers/api_v1/user.py | 9 ++ indoteknik_custom/models/res_users.py | 19 ++- indoteknik_custom/models/user_company_request.py | 13 +- indoteknik_custom/views/res_users.xml | 197 ++++++++++++++++++++++- 4 files changed, 234 insertions(+), 4 deletions(-) diff --git a/indoteknik_api/controllers/api_v1/user.py b/indoteknik_api/controllers/api_v1/user.py index 4dfc837b..87d6cafc 100644 --- a/indoteknik_api/controllers/api_v1/user.py +++ b/indoteknik_api/controllers/api_v1/user.py @@ -329,6 +329,15 @@ class User(controller.Controller): 'activation': True, 'user': self.response_with_token(user) }) + # tambahkan send email ke user untuk kasi notifikasi akun bisnis ini dalam review + parameter = [ + ('user_id', '=', user.partner_id.id) + ] + company_request = request.env['user.company.request'].search(parameter, limit=1) + if company_request: + user.user_company_name = company_request.user_input + if company_request.is_approve == False: + user.send_company_request_mail() return self.response(response) @http.route(prefix + 'user/forgot-password', auth='public', methods=['POST'], csrf=False) diff --git a/indoteknik_custom/models/res_users.py b/indoteknik_custom/models/res_users.py index 33f64ce3..cedf19bd 100755 --- a/indoteknik_custom/models/res_users.py +++ b/indoteknik_custom/models/res_users.py @@ -11,6 +11,8 @@ class ResUsers(models.Model): activation_token = fields.Char(string="Activation Token") otp_code = fields.Char(string='OTP Code') otp_create_date = fields.Datetime(string='OTP Create Date') + user_company_name = fields.Char(string="User Company Name") + def _generate_otp(self): for user in self: @@ -28,7 +30,22 @@ class ResUsers(models.Model): user._generate_otp() user._generate_activation_token() template.send_mail(user.id, force_send=True) - + + def send_company_request_mail(self): + template = self.env.ref('indoteknik_custom.mail_template_res_user_company_request') + for user in self: + template.send_mail(user.id, force_send=True) + + def send_company_request_approve_mail(self): + template = self.env.ref('indoteknik_custom.mail_template_res_user_company_request_approve') + for user in self: + template.send_mail(user.id, force_send=True) + + def send_company_request_reject_mail(self): + template = self.env.ref('indoteknik_custom.mail_template_res_user_company_request_reject') + for user in self: + template.send_mail(user.id, force_send=True) + def get_activation_token_url(self): base_url = self.env['ir.config_parameter'].get_param('site.base.url') return f'{base_url}/register?activation=token&token={self.activation_token}' diff --git a/indoteknik_custom/models/user_company_request.py b/indoteknik_custom/models/user_company_request.py index 40ac4446..8122c6a0 100644 --- a/indoteknik_custom/models/user_company_request.py +++ b/indoteknik_custom/models/user_company_request.py @@ -1,6 +1,6 @@ from odoo import models, fields from odoo.exceptions import UserError - +from odoo.http import request class UserCompanyRequest(models.Model): _name = 'user.company.request' @@ -15,6 +15,8 @@ class UserCompanyRequest(models.Model): ], string='Approval') def write(self, vals): + user = self.get_user_by_email(self.user_id.email) + user.user_company_name = self.user_input is_approve = vals.get('is_approve') if self.is_approve and is_approve: raise UserError('Tidak dapat mengubah approval yang sudah diisi') @@ -34,11 +36,18 @@ class UserCompanyRequest(models.Model): self.user_id.property_account_payable_id = self.user_company_id.property_account_payable_id self.user_company_id.active = True # tambahkan send email kalau bisnis berhsil di buat + user.send_company_request_approve_mail() else: new_company = self.env['res.partner'].create({ 'name': self.user_input }) self.user_id.parent_id = new_company.id # tambahkan send email kalau bisnis ditolak di buat + user.send_company_request_reject_mail() return super(UserCompanyRequest, self).write(vals) - \ No newline at end of file + + def get_user_by_email(self, email): + return request.env['res.users'].search([ + ('login', '=', email), + ('active', 'in', [True, False]) + ]) \ No newline at end of file diff --git a/indoteknik_custom/views/res_users.xml b/indoteknik_custom/views/res_users.xml index 976f46c9..8ced0e82 100644 --- a/indoteknik_custom/views/res_users.xml +++ b/indoteknik_custom/views/res_users.xml @@ -4,7 +4,8 @@ Users: Activation Request Aktivasi Akun - Indoteknik.com - sales@indoteknik.com + "Indoteknik.com" <noreply@indoteknik.com> + noreply@indoteknik.com ${object.login | safe} @@ -59,5 +60,199 @@
+ + Users: Company Request + + Email Pendaftaran Bisnis dalam Proses Review + "Indoteknik.com" <noreply@indoteknik.com> + noreply@indoteknik.com + ${object.login | safe} + + + +
+ + + + + + + + + + + + +
+ + + + + + + + +
+ +
+
+
+
+ + + + + + + + + + + + + + +
Halo ${object.user_company_name},
Terima kasih atas kepercayaan Anda dengan mendaftarkan bisnis Anda di Indoteknik.com. Permohonan Anda saat ini sedang dalam proses review oleh tim kami.
Saat ini, kami sedang melakukan pengecekan akhir pada data yang Anda berikan. Proses ini biasanya memakan waktu sekitar 2 x 24 jam.
Setelah proses review selesai, kami akan segera menginformasikan status akun bisnis Anda melalui email.
Jika ada pertanyaan lebih lanjut, jangan ragu untuk menghubungi kami di sales@indoteknik.com atau hubungi whatsapp kami di 0817-1718-1922
Terima kasih atas perhatiannya.
Hormat kami,
Indoteknik.com
+
+
+
+
+
+
+ + Users: Company Request Approve + + Email Pendaftaran Bisnis Berhasil + "Indoteknik.com" <noreply@indoteknik.com> + noreply@indoteknik.com + ${object.login | safe} + + + +
+ + + + + + + + + + + + +
+ + + + + + + + +
+ +
+
+
+
+ + + + + + + + + + + + + + + +
Yth. ${object.user_company_name},
Selamat! Pendaftaran akun bisnis Anda di indoteknik.com telah berhasil diverifikasi & sudah aktif. kini anda dapat menikmati berbagai kemudahan dalam berbelanja, antara lain:
Fitur Faktur Pajak & Invoice: Dengan mudah download faktur pajak & Invoice Anda secara digital.
Pembayaran Lengkap: Pilih metode pembayaran yang sesuai dengan kebutuhan Anda, baik transfer bank, VA, kartu kredit, atau pembayaran tempo.
Pelacakan Pengiriman: Lacak status pengiriman pesanan Anda secara real-time.
Untuk memulai transaksi, silakan login Kembali menggunakan akun Anda di Indoteknik.com
Kami sangat senang dapat melayani Anda. Jika ada pertanyaan atau membutuhkan bantuan, jangan ragu untuk menghubungi tim layanan Customer kami di Whatsapp 0817-1718-1922 atau sales@indoteknik.com
Hormat kami,
Indoteknik.com
+
+
+
+
+
+
+ + Users: Company Request Reject + + Email Pendaftaran Bisnis Tidak Berhasil + "Indoteknik.com" <noreply@indoteknik.com> + noreply@indoteknik.com + ${object.login | safe} + + + +
+ + + + + + + + + + + + +
+ + + + + + + + +
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + +
Yth. ${object.user_company_name},
Terima kasih atas minat Anda untuk mendaftar akun bisnis di Indoteknik.com. Kami telah menerima permohonan pendaftaran Anda dan saat ini sedang dalam proses review.
Namun, setelah kami lakukan pengecekan, kami menemukan bahwa beberapa informasi yang Anda berikan masih belum lengkap. Untuk dapat melanjutkan proses pendaftaran, mohon kiranya Anda dapat melengkapi data-data berikut:
Informasi yang kami butuhkan saat ini adalah:
+
    +
  1. Detail Nama Bisnis
  2. +
  3. Dokumen NPWP
  4. +
  5. Dokumen SPPKP/Surat Pengukuhan Kena Pajak
  6. +
+
Anda dapat mengirimkan informasi yang kurang tersebut melalui email ini atau dengan menghubungi tim layanan pelanggan kami di 0817-1718-1922 atau sales@indoteknik.com.
Kami mohon maaf atas ketidaknyamanan ini dan berharap dapat segera menyelesaikan proses pendaftaran akun bisnis Anda.
Terima kasih atas perhatiannya.
Hormat kami,
Indoteknik.com
+
+
+
+
+
+
\ No newline at end of file -- cgit v1.2.3 From d2bb21ae878db2a3b77dbb3341046c9d12ba1de5 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Fri, 20 Sep 2024 14:12:00 +0700 Subject: add grand total on dunning run and bill receipt --- indoteknik_custom/models/bill_receipt.py | 10 +++++++++- indoteknik_custom/models/dunning_run.py | 9 ++++++++- indoteknik_custom/views/bill_receipt.xml | 2 ++ indoteknik_custom/views/dunning_run.xml | 2 ++ 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/indoteknik_custom/models/bill_receipt.py b/indoteknik_custom/models/bill_receipt.py index 76449c1f..7d38d5ad 100644 --- a/indoteknik_custom/models/bill_receipt.py +++ b/indoteknik_custom/models/bill_receipt.py @@ -22,8 +22,16 @@ class BillReceipt(models.Model): resi_tukar_faktur = fields.Char(string='Resi Faktur') date_terima_tukar_faktur = fields.Date(string='Terima Faktur') shipper_faktur_id = fields.Many2one('delivery.carrier', string='Shipper Faktur') - is_validated = fields.Boolean(string='Validated') + is_validated = fields.Boolean(string='Validated') notification = fields.Char(string='Notification') + grand_total = fields.Float(string='Grand Total', compute="_compute_grand_total") + + def _compute_grand_total(self): + for record in self: + grand_total = 0 + for line in record.bill_line: + grand_total += line.total_amt + record.grand_total = grand_total def copy_date_faktur(self): if not self.is_validated: diff --git a/indoteknik_custom/models/dunning_run.py b/indoteknik_custom/models/dunning_run.py index 90159cd0..c167aab7 100644 --- a/indoteknik_custom/models/dunning_run.py +++ b/indoteknik_custom/models/dunning_run.py @@ -30,7 +30,14 @@ class DunningRun(models.Model): is_paid = fields.Boolean(string='Paid') description = fields.Char(string='Description') comment = fields.Char(string='Comment') - + grand_total = fields.Float(string='Grand Total', compute="_compute_grand_total") + + def _compute_grand_total(self): + for record in self: + grand_total = 0 + for line in record.dunning_line: + grand_total += line.total_amt + record.grand_total = grand_total def copy_date_faktur(self): if not self.is_validated: diff --git a/indoteknik_custom/views/bill_receipt.xml b/indoteknik_custom/views/bill_receipt.xml index 15d82e7b..02b28ddf 100644 --- a/indoteknik_custom/views/bill_receipt.xml +++ b/indoteknik_custom/views/bill_receipt.xml @@ -13,6 +13,7 @@ + @@ -69,6 +70,7 @@ + diff --git a/indoteknik_custom/views/dunning_run.xml b/indoteknik_custom/views/dunning_run.xml index dd5bb120..522be8c9 100644 --- a/indoteknik_custom/views/dunning_run.xml +++ b/indoteknik_custom/views/dunning_run.xml @@ -13,6 +13,7 @@ + @@ -71,6 +72,7 @@ + -- cgit v1.2.3 From f2d741e65ada3ff3ec9717eb4fdbbe81e09fa801 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Fri, 20 Sep 2024 15:15:06 +0700 Subject: delete coment --- indoteknik_api/controllers/api_v1/user.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/indoteknik_api/controllers/api_v1/user.py b/indoteknik_api/controllers/api_v1/user.py index 87d6cafc..49a3e914 100644 --- a/indoteknik_api/controllers/api_v1/user.py +++ b/indoteknik_api/controllers/api_v1/user.py @@ -203,13 +203,6 @@ class User(controller.Controller): 'user_company_id': new_company.id, 'user_input': business_name }) - # tambahkan send email ke user untuk kasi notifikasi akun bisnis ini dalam review - # user.partner_id.parent_id = new_company.id - # user.partner_id.customer_type = new_company.customer_type - # user.partner_id.npwp = new_company.npwp - # user.partner_id.sppkp = new_company.sppkp - # user.partner_id.nama_wajib_pajak = new_company.nama_wajib_pajak - # user.partner_id.alamat_lengkap_text = new_company.alamat_lengkap_text if npwp_document: npwp_mimetype, _ = mimetypes.guess_type(npwp_filename) -- cgit v1.2.3 From a31294c9d1b66f3b63275c1ef20e0a068d6a1af0 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Fri, 20 Sep 2024 15:33:51 +0700 Subject: update --- indoteknik_custom/models/res_users.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indoteknik_custom/models/res_users.py b/indoteknik_custom/models/res_users.py index d8eb348a..e339049d 100755 --- a/indoteknik_custom/models/res_users.py +++ b/indoteknik_custom/models/res_users.py @@ -12,7 +12,7 @@ class ResUsers(models.Model): otp_code = fields.Char(string='OTP Code') otp_create_date = fields.Datetime(string='OTP Create Date') payment_terms_id = fields.Many2one('account.payment.term', related='partner_id.property_payment_term_id', string='Payment Terms') - user_company_name = fields.Char(string="User Company Name") + user_company_name = fields.Char(string="User Company Name ") def _generate_otp(self): -- cgit v1.2.3 From cabac3c1d89beb6a86e58be820a06d85607c8313 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Fri, 20 Sep 2024 15:42:00 +0700 Subject: update new register --- indoteknik_api/controllers/api_v1/user.py | 1 - indoteknik_custom/models/res_users.py | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/indoteknik_api/controllers/api_v1/user.py b/indoteknik_api/controllers/api_v1/user.py index 49a3e914..669da281 100644 --- a/indoteknik_api/controllers/api_v1/user.py +++ b/indoteknik_api/controllers/api_v1/user.py @@ -322,7 +322,6 @@ class User(controller.Controller): 'activation': True, 'user': self.response_with_token(user) }) - # tambahkan send email ke user untuk kasi notifikasi akun bisnis ini dalam review parameter = [ ('user_id', '=', user.partner_id.id) ] diff --git a/indoteknik_custom/models/res_users.py b/indoteknik_custom/models/res_users.py index e339049d..d8eb348a 100755 --- a/indoteknik_custom/models/res_users.py +++ b/indoteknik_custom/models/res_users.py @@ -12,7 +12,7 @@ class ResUsers(models.Model): otp_code = fields.Char(string='OTP Code') otp_create_date = fields.Datetime(string='OTP Create Date') payment_terms_id = fields.Many2one('account.payment.term', related='partner_id.property_payment_term_id', string='Payment Terms') - user_company_name = fields.Char(string="User Company Name ") + user_company_name = fields.Char(string="User Company Name") def _generate_otp(self): -- cgit v1.2.3 From 3f8fd250ee63ad4db48d45284f055bda641fec08 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Fri, 20 Sep 2024 16:40:24 +0700 Subject: update new register user company namer --- indoteknik_custom/models/res_users.py | 1 - indoteknik_custom/models/users.py | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/indoteknik_custom/models/res_users.py b/indoteknik_custom/models/res_users.py index d8eb348a..5e16aad1 100755 --- a/indoteknik_custom/models/res_users.py +++ b/indoteknik_custom/models/res_users.py @@ -12,7 +12,6 @@ class ResUsers(models.Model): otp_code = fields.Char(string='OTP Code') otp_create_date = fields.Datetime(string='OTP Create Date') payment_terms_id = fields.Many2one('account.payment.term', related='partner_id.property_payment_term_id', string='Payment Terms') - user_company_name = fields.Char(string="User Company Name") def _generate_otp(self): diff --git a/indoteknik_custom/models/users.py b/indoteknik_custom/models/users.py index d95b56e7..981d787f 100644 --- a/indoteknik_custom/models/users.py +++ b/indoteknik_custom/models/users.py @@ -14,6 +14,7 @@ class Users(models.Model): is_admin_reconcile = fields.Boolean(string='Admin Reconcile', help='Berhak Mengedit Journal Reconcile') is_inbound = fields.Boolean(string='Operator Inbound') is_outbound = fields.Boolean(string='Operator Outbound') + user_company_name = fields.Char(string="User Company Name") def notify_internal_users(self, message, title): users = self.search([('share', '=', False)]) -- cgit v1.2.3 From 6c5d45e9062c6d5b2c3c3070a3d4eaead923c101 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Fri, 20 Sep 2024 16:47:24 +0700 Subject: delete user company name --- indoteknik_api/controllers/api_v1/user.py | 2 +- indoteknik_custom/models/users.py | 1 - indoteknik_custom/views/res_users.xml | 6 +++--- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/indoteknik_api/controllers/api_v1/user.py b/indoteknik_api/controllers/api_v1/user.py index 669da281..7166bd79 100644 --- a/indoteknik_api/controllers/api_v1/user.py +++ b/indoteknik_api/controllers/api_v1/user.py @@ -327,7 +327,7 @@ class User(controller.Controller): ] company_request = request.env['user.company.request'].search(parameter, limit=1) if company_request: - user.user_company_name = company_request.user_input + user.parent_name = company_request.user_input if company_request.is_approve == False: user.send_company_request_mail() return self.response(response) diff --git a/indoteknik_custom/models/users.py b/indoteknik_custom/models/users.py index 981d787f..d95b56e7 100644 --- a/indoteknik_custom/models/users.py +++ b/indoteknik_custom/models/users.py @@ -14,7 +14,6 @@ class Users(models.Model): is_admin_reconcile = fields.Boolean(string='Admin Reconcile', help='Berhak Mengedit Journal Reconcile') is_inbound = fields.Boolean(string='Operator Inbound') is_outbound = fields.Boolean(string='Operator Outbound') - user_company_name = fields.Char(string="User Company Name") def notify_internal_users(self, message, title): users = self.search([('share', '=', False)]) diff --git a/indoteknik_custom/views/res_users.xml b/indoteknik_custom/views/res_users.xml index 8ced0e82..39b9d43e 100644 --- a/indoteknik_custom/views/res_users.xml +++ b/indoteknik_custom/views/res_users.xml @@ -94,7 +94,7 @@ - + @@ -154,7 +154,7 @@
Halo ${object.user_company_name},
Halo ${object.parent_name},
Terima kasih atas kepercayaan Anda dengan mendaftarkan bisnis Anda di Indoteknik.com. Permohonan Anda saat ini sedang dalam proses review oleh tim kami.
Saat ini, kami sedang melakukan pengecekan akhir pada data yang Anda berikan. Proses ini biasanya memakan waktu sekitar 2 x 24 jam.
- + @@ -215,7 +215,7 @@
Yth. ${object.user_company_name},
Yth. ${object.parent_name},
Selamat! Pendaftaran akun bisnis Anda di indoteknik.com telah berhasil diverifikasi & sudah aktif. kini anda dapat menikmati berbagai kemudahan dalam berbelanja, antara lain:
Fitur Faktur Pajak & Invoice: Dengan mudah download faktur pajak & Invoice Anda secara digital.
- + -- cgit v1.2.3 From 8da0163ea3fdc87eff8214a9fda4f2594404b4e3 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Sat, 21 Sep 2024 13:21:36 +0700 Subject: cr bill dp --- indoteknik_custom/views/purchase_order.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indoteknik_custom/views/purchase_order.xml b/indoteknik_custom/views/purchase_order.xml index ce127fdd..80c0ebf5 100755 --- a/indoteknik_custom/views/purchase_order.xml +++ b/indoteknik_custom/views/purchase_order.xml @@ -27,7 +27,7 @@ -- cgit v1.2.3 From 24d8b692fe8f85d638da0c9d4fbc22a860464ed9 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Sat, 21 Sep 2024 13:23:39 +0700 Subject: fix error --- indoteknik_custom/views/purchase_order.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indoteknik_custom/views/purchase_order.xml b/indoteknik_custom/views/purchase_order.xml index 80c0ebf5..0ef0aa7f 100755 --- a/indoteknik_custom/views/purchase_order.xml +++ b/indoteknik_custom/views/purchase_order.xml @@ -27,7 +27,7 @@ -- cgit v1.2.3 From 3bb987d6dad51fb2b40d0ebec42c1143e8ee36ad Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Mon, 23 Sep 2024 09:28:45 +0700 Subject: update bug --- indoteknik_custom/models/user_company_request.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indoteknik_custom/models/user_company_request.py b/indoteknik_custom/models/user_company_request.py index 8122c6a0..b02830bd 100644 --- a/indoteknik_custom/models/user_company_request.py +++ b/indoteknik_custom/models/user_company_request.py @@ -16,7 +16,7 @@ class UserCompanyRequest(models.Model): def write(self, vals): user = self.get_user_by_email(self.user_id.email) - user.user_company_name = self.user_input + user.parent_name = self.user_input is_approve = vals.get('is_approve') if self.is_approve and is_approve: raise UserError('Tidak dapat mengubah approval yang sudah diisi') -- cgit v1.2.3 From 5abf0ad2fb38fc2777fe04ab35bde1e81e0c6d38 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Mon, 23 Sep 2024 10:10:57 +0700 Subject: update contact to not connect to child --- indoteknik_custom/models/user_company_request.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/indoteknik_custom/models/user_company_request.py b/indoteknik_custom/models/user_company_request.py index b02830bd..d540b0f6 100644 --- a/indoteknik_custom/models/user_company_request.py +++ b/indoteknik_custom/models/user_company_request.py @@ -35,14 +35,12 @@ class UserCompanyRequest(models.Model): self.user_id.property_account_receivable_id = self.user_company_id.property_account_receivable_id self.user_id.property_account_payable_id = self.user_company_id.property_account_payable_id self.user_company_id.active = True - # tambahkan send email kalau bisnis berhsil di buat user.send_company_request_approve_mail() else: new_company = self.env['res.partner'].create({ 'name': self.user_input }) - self.user_id.parent_id = new_company.id - # tambahkan send email kalau bisnis ditolak di buat + # self.user_id.parent_id = new_company.id user.send_company_request_reject_mail() return super(UserCompanyRequest, self).write(vals) -- cgit v1.2.3 From fb3ed255759edcbe8dfbdcedf0fb1f803aae2e4f Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Mon, 23 Sep 2024 15:31:38 +0700 Subject: cr sale order --- indoteknik_custom/models/sale_order.py | 1 - 1 file changed, 1 deletion(-) diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index 86b3d50d..610d5126 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -670,7 +670,6 @@ class SaleOrder(models.Model): def action_confirm(self): for order in self: - order.check_data_real_delivery_address() order.sale_order_check_approve() order._validate_order() order.order_line.validate_line() -- cgit v1.2.3 From 649f3037e4357dab42d1a8d799e5f2a2f1fd2e52 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Mon, 23 Sep 2024 16:03:38 +0700 Subject: add tracking --- indoteknik_custom/models/sale_order.py | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index 610d5126..3a28bc54 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -38,14 +38,14 @@ class SaleOrder(models.Model): have_outstanding_po = fields.Boolean('Have Outstanding PO', compute='_have_outstanding_po') purchase_ids = fields.Many2many('purchase.order', string='Purchases', compute='_get_purchases') real_shipping_id = fields.Many2one( - 'res.partner', string='Real Delivery Address', readonly=True, required=True, + 'res.partner', string='Real Delivery Address', readonly=True, states={'draft': [('readonly', False)], 'sent': [('readonly', False)], 'sale': [('readonly', False)]}, domain="['|', ('company_id', '=', False), ('company_id', '=', company_id)]", - help="Dipakai untuk alamat tempel") + help="Dipakai untuk alamat tempel", tracking=True) real_invoice_id = fields.Many2one( 'res.partner', string='Delivery Invoice Address', required=True, domain="['|', ('company_id', '=', False), ('company_id', '=', company_id)]", - help="Dipakai untuk alamat tempel") + help="Dipakai untuk alamat tempel", tracking=True) fee_third_party = fields.Float('Fee Pihak Ketiga') so_status = fields.Selection([ ('terproses', 'Terproses'), @@ -116,6 +116,21 @@ class SaleOrder(models.Model): percent_margin_after_delivery_purchase = fields.Float(string='% Margin After Delivery Purchase', compute='_compute_margin_after_delivery_purchase') purchase_delivery_amt = fields.Float(string='Purchase Delivery Amount', compute='_compute_purchase_delivery_amount') type_promotion = fields.Char(string='Type Promotion', compute='_compute_type_promotion') + partner_invoice_id = fields.Many2one( + 'res.partner', string='Invoice Address', + readonly=True, required=True, + states={'draft': [('readonly', False)], 'sent': [('readonly', False)], 'sale': [('readonly', False)]}, + domain="['|', ('company_id', '=', False), ('company_id', '=', company_id)]", + tracking=True, # Menambahkan tracking=True + ) + partner_shipping_id = fields.Many2one( + 'res.partner', string='Delivery Address', readonly=True, required=True, + states={'draft': [('readonly', False)], 'sent': [('readonly', False)], 'sale': [('readonly', False)]}, + domain="['|', ('company_id', '=', False), ('company_id', '=', company_id)]", tracking=True) + + payment_term_id = fields.Many2one( + 'account.payment.term', string='Payment Terms', check_company=True, # Unrequired company + domain="['|', ('company_id', '=', False), ('company_id', '=', company_id)]", tracking=True) def _compute_type_promotion(self): for rec in self: @@ -687,6 +702,9 @@ class SaleOrder(models.Model): if not order.commitment_date and order.create_date > datetime(2024, 9, 12): raise UserError("Expected Delivery Date kosong, wajib diisi") + if not order.real_shipping_id: + UserError('Real Delivery Address harus di isi') + if order.validate_partner_invoice_due(): return self._create_notification_action('Notification', 'Terdapat invoice yang telah melewati batas waktu, mohon perbarui pada dokumen Due Extension') -- cgit v1.2.3
Yth. ${object.user_company_name},
Yth. ${object.parent_name},
Terima kasih atas minat Anda untuk mendaftar akun bisnis di Indoteknik.com. Kami telah menerima permohonan pendaftaran Anda dan saat ini sedang dalam proses review.
Namun, setelah kami lakukan pengecekan, kami menemukan bahwa beberapa informasi yang Anda berikan masih belum lengkap. Untuk dapat melanjutkan proses pendaftaran, mohon kiranya Anda dapat melengkapi data-data berikut: