From 95d1133be1710dee7a526c5c98f4f318a3e7c24d Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Wed, 25 Sep 2024 16:25:30 +0700 Subject: ubah noreply to sales --- indoteknik_custom/views/res_users.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indoteknik_custom') diff --git a/indoteknik_custom/views/res_users.xml b/indoteknik_custom/views/res_users.xml index 39b9d43e..41c74d72 100644 --- a/indoteknik_custom/views/res_users.xml +++ b/indoteknik_custom/views/res_users.xml @@ -5,7 +5,7 @@ Aktivasi Akun - Indoteknik.com "Indoteknik.com" <noreply@indoteknik.com> - noreply@indoteknik.com + sales@indoteknik.com ${object.login | safe} @@ -65,7 +65,7 @@ Email Pendaftaran Bisnis dalam Proses Review "Indoteknik.com" <noreply@indoteknik.com> - noreply@indoteknik.com + sales@indoteknik.com ${object.login | safe}
@@ -125,7 +125,7 @@ Email Pendaftaran Bisnis Berhasil "Indoteknik.com" <noreply@indoteknik.com> - noreply@indoteknik.com + sales@indoteknik.com ${object.login | safe}
@@ -186,7 +186,7 @@ Email Pendaftaran Bisnis Tidak Berhasil "Indoteknik.com" <noreply@indoteknik.com> - noreply@indoteknik.com + sales@indoteknik.com ${object.login | safe}
-- cgit v1.2.3 From 7909b937bf9484b38f16be1f4be955094e0c25ab Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Sat, 28 Sep 2024 10:55:56 +0700 Subject: aupdate company request --- indoteknik_custom/models/user_company_request.py | 19 ++++++++++++++++++- indoteknik_custom/views/user_company_request.xml | 10 +++++++--- 2 files changed, 25 insertions(+), 4 deletions(-) (limited to 'indoteknik_custom') diff --git a/indoteknik_custom/models/user_company_request.py b/indoteknik_custom/models/user_company_request.py index d540b0f6..706bb245 100644 --- a/indoteknik_custom/models/user_company_request.py +++ b/indoteknik_custom/models/user_company_request.py @@ -1,4 +1,4 @@ -from odoo import models, fields +from odoo import models, fields, api from odoo.exceptions import UserError from odoo.http import request @@ -13,6 +13,18 @@ class UserCompanyRequest(models.Model): ('approved', 'Approve'), ('rejected', 'Reject'), ], string='Approval') + internal_input = fields.Char(string='Internal Input') + company_type = fields.Char(string='Company Type', compute='_compute_company_type') + + @api.depends('user_company_id.customer_type') + def _compute_company_type(self): + for record in self: + if record.user_company_id.customer_type == 'nonpkp': + record.company_type = 'Non PKP' + elif record.user_company_id.customer_type == 'pkp': + record.company_type = 'PKP' + else: + record.company_type = 'company type belum di set' def write(self, vals): user = self.get_user_by_email(self.user_id.email) @@ -21,6 +33,11 @@ class UserCompanyRequest(models.Model): if self.is_approve and is_approve: raise UserError('Tidak dapat mengubah approval yang sudah diisi') + if self.internal_input: + if self.user_company_id.nama_wajib_pajak == self.user_company_id.name: + self.user_company_id.nama_wajib_pajak = self.internal_input + self.user_company_id.name = self.internal_input + if not self.is_approve and is_approve: if is_approve == 'approved': self.user_id.parent_id = self.user_company_id.id diff --git a/indoteknik_custom/views/user_company_request.xml b/indoteknik_custom/views/user_company_request.xml index c9edd3f8..ad121a89 100644 --- a/indoteknik_custom/views/user_company_request.xml +++ b/indoteknik_custom/views/user_company_request.xml @@ -8,12 +8,14 @@ - + + @@ -30,12 +32,14 @@ - + + -- cgit v1.2.3 From 600d990fd866d8b729267c10f7e73a78d8b60f2d Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Sat, 28 Sep 2024 11:23:40 +0700 Subject: add internal user di user comany request --- indoteknik_custom/models/user_company_request.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'indoteknik_custom') diff --git a/indoteknik_custom/models/user_company_request.py b/indoteknik_custom/models/user_company_request.py index 706bb245..f86f3872 100644 --- a/indoteknik_custom/models/user_company_request.py +++ b/indoteknik_custom/models/user_company_request.py @@ -30,13 +30,14 @@ class UserCompanyRequest(models.Model): user = self.get_user_by_email(self.user_id.email) user.parent_name = self.user_input is_approve = vals.get('is_approve') + is_internal_input = vals.get('internal_input') if self.is_approve and is_approve: raise UserError('Tidak dapat mengubah approval yang sudah diisi') - if self.internal_input: + if is_internal_input: if self.user_company_id.nama_wajib_pajak == self.user_company_id.name: - self.user_company_id.nama_wajib_pajak = self.internal_input - self.user_company_id.name = self.internal_input + self.user_company_id.nama_wajib_pajak = is_internal_input + self.user_company_id.name = is_internal_input if not self.is_approve and is_approve: if is_approve == 'approved': -- cgit v1.2.3 From 795af0a07c28d5d407070734ef94b4838d05f793 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Wed, 2 Oct 2024 11:48:15 +0700 Subject: update switch account --- indoteknik_custom/models/res_users.py | 5 +++ indoteknik_custom/views/res_users.xml | 61 +++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+) (limited to 'indoteknik_custom') diff --git a/indoteknik_custom/models/res_users.py b/indoteknik_custom/models/res_users.py index 5e16aad1..16f94b37 100755 --- a/indoteknik_custom/models/res_users.py +++ b/indoteknik_custom/models/res_users.py @@ -41,6 +41,11 @@ class ResUsers(models.Model): for user in self: template.send_mail(user.id, force_send=True) + def send_company_switch_approve_mail(self): + template = self.env.ref('indoteknik_custom.mail_template_res_user_company_switch_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: diff --git a/indoteknik_custom/views/res_users.xml b/indoteknik_custom/views/res_users.xml index 41c74d72..b93ae012 100644 --- a/indoteknik_custom/views/res_users.xml +++ b/indoteknik_custom/views/res_users.xml @@ -181,6 +181,67 @@
+ + Users: Switch Account Success + + Email Switch Account Berhasil + "Indoteknik.com" <noreply@indoteknik.com> + sales@indoteknik.com + ${object.login | safe} + + + +
+ + + + + + + + + + + + +
+ + + + + + + + +
+ +
+
+
+
+ + + + + + + + + + + + + + + +
Yth. ${object.parent_name},
Selamat! Perpindahan akun bisnis Anda menjadi PKP di indoteknik.com telah berhasil 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 -- cgit v1.2.3 From cc862f2bb8a6a751612bab7fb2d07f7306f9a4fd Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Fri, 4 Oct 2024 12:28:29 +0700 Subject: add telegram --- indoteknik_custom/__manifest__.py | 1 + indoteknik_custom/models/__init__.py | 1 + indoteknik_custom/models/website_telegram.py | 63 ++++++++++++++++++++++++++ indoteknik_custom/security/ir.model.access.csv | 1 + indoteknik_custom/views/website_telegram.xml | 62 +++++++++++++++++++++++++ 5 files changed, 128 insertions(+) create mode 100644 indoteknik_custom/models/website_telegram.py create mode 100644 indoteknik_custom/views/website_telegram.xml (limited to 'indoteknik_custom') diff --git a/indoteknik_custom/__manifest__.py b/indoteknik_custom/__manifest__.py index e1a67592..3104b9a3 100755 --- a/indoteknik_custom/__manifest__.py +++ b/indoteknik_custom/__manifest__.py @@ -59,6 +59,7 @@ 'views/website_brand_homepage.xml', 'views/website_categories_homepage.xml', 'views/website_categories_management.xml', + 'views/website_telegram.xml', 'views/website_categories_lob.xml', 'views/sales_target.xml', 'views/purchase_outstanding.xml', diff --git a/indoteknik_custom/models/__init__.py b/indoteknik_custom/models/__init__.py index 3d700ce0..1620c82e 100755 --- a/indoteknik_custom/models/__init__.py +++ b/indoteknik_custom/models/__init__.py @@ -128,3 +128,4 @@ from . import sales_order_reject from . import approval_date_doc from . import account_tax from . import approval_unreserve +from . import website_telegram diff --git a/indoteknik_custom/models/website_telegram.py b/indoteknik_custom/models/website_telegram.py new file mode 100644 index 00000000..8fc6a8ea --- /dev/null +++ b/indoteknik_custom/models/website_telegram.py @@ -0,0 +1,63 @@ +import requests + +import clipboard + +from odoo import models, fields, api + +class WebsiteTelegram(models.Model): + _name = 'website.telegram' + _description = 'Telegram Channel' + + name = fields.Char(string='Bot Name', required=True) + bot_name = fields.Char(string='Bot Token', help="Create your bot from Bot Father form Telegram App", required=True, ) + python_code = fields.Char(compute="_calc_python_code") + chatID = fields.Char(string='Channel Name', required=True, help="Create yor channel , Add members , Add Bot As an Admin") + + test_message = fields.Char(string='Test Message', required=False, default='Test') + + def send_to_telegram(self, message): + # if self.env.all.registry.db_name == 'odoo016':return + + # message = self.env.all.registry.db_name + " : " + message + message = self.test_message + + apiURL = f'https://api.telegram.org/bot{self.bot_name}/sendMessage' + try: + requests.post(apiURL, json={'chat_id': self.chatID, 'text': message}) + except Exception as e: + print(e) + + def test_send(self): + try: + self.env.cr.savepoint() + + self.env['website.telegram'].search([('name', '=', self.name)])[0].send_to_telegram(self.test_message) + except Exception as e: + print(e) + + @api.depends('name', 'chatID', 'bot_name') + def _calc_python_code(self): + for record in self: + if not record.name: + record.python_code = "pleas put a name" + elif not record.test_message: + record.test_message = "test" + else: + record.python_code = "self.env['website.telegram'].search([('name', '=', '" + record.name + "')])[0].send_to_telegram('" + record.test_message + "')" + + def copy_chat_id(self): + record = self.browse(self.id) + clipboard.copy(record.python_code) + + def paste_chat_id(self): + record = self.browse(self.id) + chat_id = clipboard.paste() + record.write({'chatID': chat_id}) + + def paste_bot_name(self): + record = self.browse(self.id) + bot_name = clipboard.paste() + record.write({'bot_name': bot_name}) + + + diff --git a/indoteknik_custom/security/ir.model.access.csv b/indoteknik_custom/security/ir.model.access.csv index 19e3bdca..84147e04 100755 --- a/indoteknik_custom/security/ir.model.access.csv +++ b/indoteknik_custom/security/ir.model.access.csv @@ -24,6 +24,7 @@ access_website_categories_homepage,access.website.categories.homepage,model_webs access_website_categories_lob,access.website.categories.lob,model_website_categories_lob,,1,1,1,1 access_website_categories_management,access.website.categories.management,model_website_categories_management,,1,1,1,1 access_website_categories_management_line,access.website.categories.management.line,model_website_categories_management_line,,1,1,1,1 +access_website_telegram,access.website.telegram,model_website_telegram,,1,1,1,1 access_sales_target,access.sales.target,model_sales_target,,1,1,1,1 access_purchase_outstanding,access.purchase.outstanding,model_purchase_outstanding,,1,1,1,1 access_sales_outstanding,access.sales.outstanding,model_sales_outstanding,,1,1,1,1 diff --git a/indoteknik_custom/views/website_telegram.xml b/indoteknik_custom/views/website_telegram.xml new file mode 100644 index 00000000..9698bfc4 --- /dev/null +++ b/indoteknik_custom/views/website_telegram.xml @@ -0,0 +1,62 @@ + + + + + Channel Telegram + website.telegram + tree,form + + + + Channel Telegram + website.telegram + + + + +