summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/sourcing.py
diff options
context:
space:
mode:
authorHafidBuroiroh <hafidburoiroh09@gmail.com>2025-10-24 11:24:58 +0700
committerHafidBuroiroh <hafidburoiroh09@gmail.com>2025-10-24 11:24:58 +0700
commitf4a1e2917d550eb205e33b058f07e7edbf8029c8 (patch)
tree757cef98c3c94ce7327fff3bbadd06a269f4fa88 /indoteknik_custom/models/sourcing.py
parent51ebcf6f9b57c61efabb9e4e0b4fc8d5bc058512 (diff)
<hafid> sjo half
Diffstat (limited to 'indoteknik_custom/models/sourcing.py')
-rw-r--r--indoteknik_custom/models/sourcing.py65
1 files changed, 0 insertions, 65 deletions
diff --git a/indoteknik_custom/models/sourcing.py b/indoteknik_custom/models/sourcing.py
deleted file mode 100644
index 62540700..00000000
--- a/indoteknik_custom/models/sourcing.py
+++ /dev/null
@@ -1,65 +0,0 @@
-from odoo import models, fields, api
-from odoo.exceptions import UserError
-import requests
-import json
-import logging, subprocess
-
-_logger = logging.getLogger(__name__)
-
-class SourcingOrderJob(models.Model):
- _name = 'sourcing.job.order'
- _descriptions = 'Sourcing Job Order MD'
- _rec_name = 'name'
- _inherit = ['mail.thread', 'mail.activity.mixin']
-
- name = fields.Char(string='Job Number', default='name', copy=False, readonly=True)
- leads_id = fields.Many2One('crm.lead', string='Leads Number')
- product_name = fields.Char(string='Nama Barang', required=True)
- descriptions = fields.Text(string='Deskripsi / Spesifikasi', required=True)
- quantity = fields.Float(string='Quantity Product', required=True)
- eta_sales = fiels.Date(string='Expected Ready')
- sla_product = fields.Date(string='Product Ready Date')
- price = fields.Float(string='Harga Product Vendor')
- vendor_id = fields.Many2One('res.partner', string="Vendor")
- tax_id = fields.Many2One('account.tax', string='Tax', domain=['|', ('active', '=', False), ('active', '=', True)])
- user_id = fields.Many2One('res.users', string='MD Person')
- subtotal = fields.Float(string='Total Purchase', compute='_compute_subtotal_purchase')
- state = fields.Selection([
- ('draft', 'Untaken'),
- ('taken', 'On Sourcing'),
- ('done', 'Complete'),
- ('cancel', 'Cancel')
- ], string='Status')
-
- @api.depends('quantity', 'price', 'tax_id')
- def _compute_subtotal_purchase(self):
- """Menghitung subtotal termasuk pajak."""
- for record in self:
- subtotal = (record.quantity or 0.0) * (record.price or 0.0)
- if record.tax_id:
- tax_amount = subtotal * (record.tax_id.amount / 100)
- subtotal += tax_amount
-
- record.subtotal = subtotal
-
- @api.model
- def create(self, vals):
- if not (self.env.user.has_group('indoteknik_custom.group_role_sales') or self.env.user.has_group('indoteknik_custom.group_role_merchandiser')):
- raise UserError("❌ Hanya Sales dan Merchandiser yang boleh membuat Sourcing Job.")
-
- if vals.get('name', 'New') == 'New':
- vals['name'] = self.env['ir.sequence'].next_by_code('sourcing.job.order') or 'New'
-
- if self.env.user.has_group('indoteknik_custom.group_role_merchandiser'):
- vals['user_id'] = self.env.user.id
- vals['state'] = 'taken'
-
- return super().create(vals)
-
- def write(self, vals):
- if not (self.env.user.has_group('indoteknik_custom.group_role_sales') or self.env.user.has_group('indoteknik_custom.group_role_merchandiser')):
- raise UserError("❌ Hanya Sales dan Merchandiser yang boleh membuat Sourcing Job.")
-
- return super().write(vals)
-
-