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 | |
| 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
| -rw-r--r-- | indoteknik_custom/models/user_company_request.py | 18 | ||||
| -rwxr-xr-x | indoteknik_custom/views/sale_order.xml | 4 | ||||
| -rw-r--r-- | indoteknik_custom/views/user_company_request.xml | 4 |
3 files changed, 24 insertions, 2 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 diff --git a/indoteknik_custom/views/sale_order.xml b/indoteknik_custom/views/sale_order.xml index 17faaa95..029c99e9 100755 --- a/indoteknik_custom/views/sale_order.xml +++ b/indoteknik_custom/views/sale_order.xml @@ -116,7 +116,7 @@ </attribute> </xpath> <xpath expr="//form/sheet/notebook/page/field[@name='order_line']/tree/field[@name='price_total']" position="after"> - <field name="vendor_id" attrs="{'readonly': [('parent.approval_status', '=', 'approved')]}" domain="[('parent_id', '=', False)]"/> + <field name="vendor_id" attrs="{'readonly': [('parent.approval_status', '=', 'approved')]}" domain="[('parent_id', '=', False)]" options="{'no_create':True}"/> <field name="purchase_price" attrs=" { 'readonly': [ @@ -126,7 +126,7 @@ ] } "/> - <field name="purchase_tax_id" attrs="{'readonly': [('parent.approval_status', '!=', False)]}" domain="[('type_tax_use','=','purchase')]"/> + <field name="purchase_tax_id" attrs="{'readonly': [('parent.approval_status', '!=', False)]}" domain="[('type_tax_use','=','purchase')]" options="{'no_create':True}"/> <field name="item_percent_margin"/> <field name="item_margin" optional="hide"/> <field name="note" optional="hide"/> diff --git a/indoteknik_custom/views/user_company_request.xml b/indoteknik_custom/views/user_company_request.xml index 38340081..1c80e923 100644 --- a/indoteknik_custom/views/user_company_request.xml +++ b/indoteknik_custom/views/user_company_request.xml @@ -14,6 +14,8 @@ decoration-success="is_approve == 'approved'" decoration-danger="is_approve == 'rejected'" /> + <field name="internal_input"/> + <field name="company_type"/> <field name="create_date"/> </tree> </field> @@ -37,6 +39,8 @@ decoration-success="is_approve == 'approved'" decoration-danger="is_approve == 'rejected'" /> + <field name="internal_input" /> + <field name="company_type" readonly="1"/> </group> </group> </sheet> |
