diff options
| author | IT Fixcomart <it@fixcomart.co.id> | 2024-10-02 03:46:04 +0000 |
|---|---|---|
| committer | IT Fixcomart <it@fixcomart.co.id> | 2024-10-02 03:46:04 +0000 |
| commit | 0d9cd813de0af6a69915c35fcb2908c433c2773a (patch) | |
| tree | 96488eea983cddda6542be5bb3855b09b3e430a9 /indoteknik_custom/models | |
| parent | a2d93b35cc849d742e851f5d876557ac18c1a9e1 (diff) | |
| parent | afda28eb5bcda235c3c0b9479884894f9cd88c8c (diff) | |
Merged in iman/update-register (pull request #234)
<iman> add inrernal input
Diffstat (limited to 'indoteknik_custom/models')
| -rw-r--r-- | indoteknik_custom/models/user_company_request.py | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/indoteknik_custom/models/user_company_request.py b/indoteknik_custom/models/user_company_request.py index d540b0f6..f86f3872 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,14 +13,32 @@ 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) 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 |
