diff options
| author | IT Fixcomart <it@fixcomart.co.id> | 2026-03-13 10:34:25 +0000 |
|---|---|---|
| committer | IT Fixcomart <it@fixcomart.co.id> | 2026-03-13 10:34:25 +0000 |
| commit | ae16d1d966242fb33a96619a77895839aa370622 (patch) | |
| tree | e91285244042db7820ad237542b0340376b326f7 /indoteknik_custom/models/sourcing_job_order.py | |
| parent | d75f7c11667e1aac776de1af9e6eeff90fed3c26 (diff) | |
| parent | c0b1c53322092d3f58ac93a09b969ceceddc91a1 (diff) | |
Merged in CR/Sourcing-Job (pull request #507)
CR/Sourcing Job
Diffstat (limited to 'indoteknik_custom/models/sourcing_job_order.py')
| -rw-r--r-- | indoteknik_custom/models/sourcing_job_order.py | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/indoteknik_custom/models/sourcing_job_order.py b/indoteknik_custom/models/sourcing_job_order.py index e6a177f8..1d55ae6a 100644 --- a/indoteknik_custom/models/sourcing_job_order.py +++ b/indoteknik_custom/models/sourcing_job_order.py @@ -345,6 +345,8 @@ class SourcingJobOrderLine(models.Model): last_updated_price = fields.Datetime(string='Last Update Price', readonly=True) tax_id = fields.Many2one('account.tax', string='Tax', domain=[('active', '=', True), ('type_tax_use', '=', 'purchase')]) vendor_id = fields.Many2one('res.partner', string="Vendor") + uom_id = fields.Many2one('uom.uom', string="Unit of Measure") + web_tax_id = fields.Many2one('account.tax', string="Website Tax") product_category = fields.Many2one('product.category', string="Product Category") product_class = fields.Many2many('product.public.category', string="Categories") exported_to_so = fields.Boolean(string="Exported to SO", default=False) @@ -673,6 +675,12 @@ class SourcingJobOrderLine(models.Model): if not line.product_name_md: missing_fields.append("Product Name") + if not line.web_tax_id: + missing_fields.append("Website Tax") + + if not line.uom_id: + missing_fields.append("Unit of Measure") + if not line.brand_id: missing_fields.append("Manufactures") @@ -774,8 +782,8 @@ class SourcingJobOrderLine(models.Model): for rec in self: job = rec.order_id - if job.create_uid != self.env.user: - raise UserError("❌ Hanya pembuat Sourcing Job yang bisa approve.") + if not rec.show_salesperson or rec.show_salesperson.id != self.env.uid: + raise UserError("❌ Hanya Salesperson Sale Order yang bisa approve.") rec.write({'state': 'approve'}) @@ -805,6 +813,9 @@ class SourcingJobOrderLine(models.Model): 'name': rec.product_name_md, 'default_code': rec.code or False, 'description': rec.descriptions_md or '', + 'web_tax_id': rec.web_tax_id.id or False, + 'uom_id': rec.uom_id.id or False, + 'uom_po_id': rec.uom_id.id or False, 'type': type_map.get(rec.product_type, 'product'), 'categ_id': rec.product_category.id if rec.product_category else False, 'x_manufacture': rec.brand_id.id if rec.brand_id else False, @@ -820,6 +831,9 @@ class SourcingJobOrderLine(models.Model): product.default_code = sku_auto rec.code = sku_auto + if product.categ_id and product.categ_id.id == 34: + product.unpublished = True + rec.product_id = product.id self.env.user.notify_success( @@ -847,6 +861,9 @@ class SourcingJobOrderLine(models.Model): if not purchase_price: PurchasePricelist.create(pricelist_vals) + if product.categ_id and product.categ_id.id != 34: + PurchasePricelist.create(pricelist_vals) + elif purchase_price.product_price != (rec.price or 0): purchase_price.write(pricelist_vals) |
