diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2024-10-02 15:11:21 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2024-10-02 15:11:21 +0700 |
| commit | 0e9e9e47e92d251ee1ce6268208737c0b7aeff30 (patch) | |
| tree | 36f6ce255e8c9697a43499a81e279e21dcd4b21f /indoteknik_custom/models/user_company_request.py | |
| parent | 27a603a8bc4750dcacd295e07144c5ce2621783c (diff) | |
| parent | ac0f803ab0a68083ca0d1e540b5eb4c204c45245 (diff) | |
Merge branch 'production' of bitbucket.org:altafixco/indoteknik-addons into production
# Conflicts:
# indoteknik_custom/models/user_company_request.py
Diffstat (limited to 'indoteknik_custom/models/user_company_request.py')
| -rw-r--r-- | indoteknik_custom/models/user_company_request.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/indoteknik_custom/models/user_company_request.py b/indoteknik_custom/models/user_company_request.py index 1b3434b1..6d809385 100644 --- a/indoteknik_custom/models/user_company_request.py +++ b/indoteknik_custom/models/user_company_request.py @@ -45,14 +45,32 @@ class UserCompanyRequest(models.Model): company_ids = [row[0] for row in self.env.cr.fetchall()] return company_ids + 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) 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 is_internal_input: + if self.user_company_id.nama_wajib_pajak == self.user_company_id.name: + 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': self.user_id.parent_id = self.user_company_id.id |
