From f4a1e2917d550eb205e33b058f07e7edbf8029c8 Mon Sep 17 00:00:00 2001 From: HafidBuroiroh Date: Fri, 24 Oct 2025 11:24:58 +0700 Subject: sjo half --- indoteknik_custom/models/sourcing.py | 65 ------------------------------------ 1 file changed, 65 deletions(-) delete mode 100644 indoteknik_custom/models/sourcing.py (limited to 'indoteknik_custom/models/sourcing.py') 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) - - -- cgit v1.2.3