diff options
| author | it-fixcomart <it@fixcomart.co.id> | 2024-11-08 13:56:37 +0700 |
|---|---|---|
| committer | it-fixcomart <it@fixcomart.co.id> | 2024-11-08 13:56:37 +0700 |
| commit | 1cf2ec912af62cca22de4c529d1bec154ca33bac (patch) | |
| tree | 14ea6e1f91df45112d3b192f2141bfe7fb111223 | |
| parent | 4f4bcf8ba7aa3f3f1b688997d9ec8b8cd913dad3 (diff) | |
<iman> update quotation website
| -rw-r--r-- | indoteknik_api/models/res_users.py | 6 | ||||
| -rw-r--r-- | indoteknik_custom/models/res_partner.py | 13 | ||||
| -rwxr-xr-x | indoteknik_custom/models/sale_order.py | 8 | ||||
| -rw-r--r-- | indoteknik_custom/models/user_company_request.py | 2 |
4 files changed, 24 insertions, 5 deletions
diff --git a/indoteknik_api/models/res_users.py b/indoteknik_api/models/res_users.py index 230707cb..52a044dc 100644 --- a/indoteknik_api/models/res_users.py +++ b/indoteknik_api/models/res_users.py @@ -14,6 +14,9 @@ class ResUsers(models.Model): 'manager': 2, 'director': 3 } + partner_tempo = False + if main_partner: + partner_tempo = main_partner.get_check_tempo_partner() data = { 'id': res_user.id, @@ -32,7 +35,8 @@ class ResUsers(models.Model): 'feature': { 'so_approval': main_partner.use_so_approval, 'only_ready_stock': main_partner.use_only_ready_stock - } + }, + 'partner_tempo': partner_tempo } return data diff --git a/indoteknik_custom/models/res_partner.py b/indoteknik_custom/models/res_partner.py index b01c7984..76fa06cd 100644 --- a/indoteknik_custom/models/res_partner.py +++ b/indoteknik_custom/models/res_partner.py @@ -1,7 +1,7 @@ from odoo import models, fields, api from odoo.exceptions import UserError, ValidationError from datetime import datetime - +from odoo.http import request class GroupPartner(models.Model): _name = 'group.partner' @@ -224,6 +224,15 @@ class ResPartner(models.Model): def _onchange_customer_type(self): if self.customer_type == 'nonpkp': self.npwp = '00.000.000.0-000.000' - + def get_check_tempo_partner(self): + self.ensure_one() + + partner = self.parent_id or self + + if not partner.property_payment_term_id or 'Tempo' not in partner.property_payment_term_id.name: + return False + + else: + return True diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index ed397301..36e60cfb 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -98,7 +98,7 @@ class SaleOrder(models.Model): helper_by_id = fields.Many2one('res.users', 'Helper By') eta_date = fields.Datetime(string='ETA Date', copy=False, compute='_compute_eta_date') flash_sale = fields.Boolean(string='Flash Sale', help='Data dari web') - is_continue_transaction = fields.Boolean(string='Button Transaction', help='Data dari web') + is_continue_transaction = fields.Boolean(string='Button Transaction', help='Data dari web', compute='_is_continue_transaction') web_approval = fields.Selection([ ('company', 'Company'), ('cust_manager', 'Customer Manager'), @@ -144,6 +144,12 @@ class SaleOrder(models.Model): ('NP', 'Non Pareto') ]) + def _is_continue_transaction(self): + if self.payment_status == 'settlement': + self.is_continue_transaction = True + else: + self.is_continue_transaction = False + def _compute_total_weight(self): total_weight = 0 missing_weight_products = [] diff --git a/indoteknik_custom/models/user_company_request.py b/indoteknik_custom/models/user_company_request.py index 86e66934..64e11700 100644 --- a/indoteknik_custom/models/user_company_request.py +++ b/indoteknik_custom/models/user_company_request.py @@ -74,7 +74,7 @@ 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.parent_id = self.user_company_id.id if self.user_company_id.id else vals.get('user_company_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 |
