diff options
| author | Indoteknik . <it@fixcomart.co.id> | 2025-08-15 10:15:35 +0700 |
|---|---|---|
| committer | Indoteknik . <it@fixcomart.co.id> | 2025-08-15 10:15:35 +0700 |
| commit | 62b3f5f6aa6f6b5dfb06387487d2c1756a712778 (patch) | |
| tree | 5c95622283c25ac33a4af5c0fe56854728ba5e8f | |
| parent | 33d3124e1283778cfb957c7bb75afc6619c4dd7d (diff) | |
| parent | dc6903b175f600f01918d3d7575545e76eaef3c4 (diff) | |
Merge branch 'odoo-backup' of https://bitbucket.org/altafixco/indoteknik-addons into fix-switch-account
| -rw-r--r-- | indoteknik_api/controllers/api_v1/partner.py | 4 | ||||
| -rw-r--r-- | indoteknik_custom/models/res_partner.py | 4 | ||||
| -rw-r--r-- | indoteknik_custom/models/stock_picking.py | 2 | ||||
| -rw-r--r-- | indoteknik_custom/models/tukar_guling.py | 4 | ||||
| -rw-r--r-- | indoteknik_custom/models/tukar_guling_po.py | 9 | ||||
| -rw-r--r-- | indoteknik_custom/views/tukar_guling_po.xml | 2 |
6 files changed, 15 insertions, 10 deletions
diff --git a/indoteknik_api/controllers/api_v1/partner.py b/indoteknik_api/controllers/api_v1/partner.py index 14136ca3..acec19f7 100644 --- a/indoteknik_api/controllers/api_v1/partner.py +++ b/indoteknik_api/controllers/api_v1/partner.py @@ -150,7 +150,7 @@ class Partner(controller.Controller): partner_params = self.get_request_params(request_data, { 'tax_name': ['alias:nama_wajib_pajak'], - # 'company_type_id': ['number'], + 'company_type_id': [''], 'industry_id': ['number'], 'npwp': [], 'alamat_lengkap_text': [], @@ -170,7 +170,7 @@ class Partner(controller.Controller): if 'id_user' in request_data: user_params = self.get_request_params(request_data, { 'id_user': ['required', 'number'], - # 'company_type_id': ['number'], + 'company_type_id': [''], 'industry_id': ['number'], 'tax_name': ['alias:nama_wajib_pajak'], 'npwp': [], diff --git a/indoteknik_custom/models/res_partner.py b/indoteknik_custom/models/res_partner.py index f260f58e..cf9fbea4 100644 --- a/indoteknik_custom/models/res_partner.py +++ b/indoteknik_custom/models/res_partner.py @@ -231,7 +231,7 @@ class ResPartner(models.Model): rec.payment_difficulty = rec.parent_id.payment_difficulty return records - @api.constrains('name') + @api.constrains('email') def _check_duplicate_name(self): for record in self: if record.name: @@ -242,7 +242,7 @@ class ResPartner(models.Model): ], limit=1) if existing_partner: - raise ValidationError(f"Nama '{record.name}' sudah digunakan oleh partner lain!") + raise ValidationError(f"Nama '{record.name}' dengan email '{record.email}' sudah digunakan oleh partner lain!") @api.constrains('npwp') def _check_npwp(self): diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index eb1c7085..d63c5d4c 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -1060,7 +1060,7 @@ class StockPicking(models.Model): self.sale_id.date_doc_kirim = self.date_doc_kirim def action_assign(self): - if self.env.context.get('default_picking_type_id'): + if self.env.context.get('default_picking_type_id') and ('BU/INPUT' not in self.name or 'BU/PUT' not in self.name): pickings_to_assign = self.filtered( lambda p: not (p.sale_id and p.sale_id.hold_outgoing) ) diff --git a/indoteknik_custom/models/tukar_guling.py b/indoteknik_custom/models/tukar_guling.py index ff641f34..4b03d4b0 100644 --- a/indoteknik_custom/models/tukar_guling.py +++ b/indoteknik_custom/models/tukar_guling.py @@ -380,10 +380,6 @@ class TukarGuling(models.Model): res.message_post(body=_("CCM Created By %s") % self.env.user.name) return res - res = super(TukarGuling, self).create(vals) - res.message_post(body=_("CCM Created By %s") % self.env.user.name) - return res - def copy(self, default=None): if default is None: default = {} diff --git a/indoteknik_custom/models/tukar_guling_po.py b/indoteknik_custom/models/tukar_guling_po.py index cc1c79c0..94771f37 100644 --- a/indoteknik_custom/models/tukar_guling_po.py +++ b/indoteknik_custom/models/tukar_guling_po.py @@ -435,6 +435,15 @@ class TukarGulingPO(models.Model): if bu_put: raise UserError("❌ Tidak bisa retur BU/INPUT karena BU/PUT sudah Done!") + existing_tukar_guling = self.env['tukar.guling.po'].search([ + ('operations', '=', self.operations.id), + ('id', '!=', self.id), + ('state', '!=', 'cancel'), + ], limit=1) + + if existing_tukar_guling: + raise UserError("BU ini sudah pernah diretur oleh dokumen %s." % existing_tukar_guling.name) + picking = self.operations pick_id = self.operations.picking_type_id.id if pick_id == 75: diff --git a/indoteknik_custom/views/tukar_guling_po.xml b/indoteknik_custom/views/tukar_guling_po.xml index 1c6a86ea..548a209f 100644 --- a/indoteknik_custom/views/tukar_guling_po.xml +++ b/indoteknik_custom/views/tukar_guling_po.xml @@ -21,7 +21,7 @@ <field name="name">pengajuan.tukar.guling.po.tree</field> <field name="model">tukar.guling.po</field> <field name="arch" type="xml"> - <tree create="1" delete="1" default_order="create_date desc"> + <tree create="0" delete="1" default_order="create_date desc"> <field name="name"/> <field name="vendor_id" string="Customer"/> <field name="origin" string="PO Number"/> |
