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(+) (limited to 'indoteknik_custom') 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_custom/models/user_company_request.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'indoteknik_custom') 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 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_custom/models/sale_order.py | 35 ++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'indoteknik_custom') 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_custom/models/user_company_request.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'indoteknik_custom') 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 1da66aee1b99ce8fc10b7a4f1c2437dfce7c9ee4 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Tue, 3 Sep 2024 15:41:30 +0700 Subject: cr register --- indoteknik_custom/models/user_company_request.py | 1 + 1 file changed, 1 insertion(+) (limited to 'indoteknik_custom') 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(-) (limited to 'indoteknik_custom') 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_custom/models/res_partner.py | 46 ++++++++++++++++++++++++++------- 1 file changed, 36 insertions(+), 10 deletions(-) (limited to 'indoteknik_custom') 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_custom/models/res_partner.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indoteknik_custom') 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_custom/models/res_partner.py | 62 ++++++++++++------------ indoteknik_custom/models/user_company_request.py | 2 + 2 files changed, 34 insertions(+), 30 deletions(-) (limited to 'indoteknik_custom') 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 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_custom/models/res_partner.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indoteknik_custom') 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 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(-) (limited to 'indoteknik_custom') 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 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(-) (limited to 'indoteknik_custom') 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 314125a03d680cd2da6e413200abd8eefec2b1ec Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Tue, 17 Sep 2024 17:22:50 +0700 Subject: uppdate new register --- indoteknik_custom/models/res_partner.py | 31 +------------------------------ 1 file changed, 1 insertion(+), 30 deletions(-) (limited to 'indoteknik_custom') 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 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_custom/models/res_partner.py | 3 ++- indoteknik_custom/models/user_company_request.py | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'indoteknik_custom') 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_custom/models/res_users.py | 19 ++- indoteknik_custom/models/user_company_request.py | 13 +- indoteknik_custom/views/res_users.xml | 197 ++++++++++++++++++++++- 3 files changed, 225 insertions(+), 4 deletions(-) (limited to 'indoteknik_custom') 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