summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indoteknik_custom/models/sourcing_job_order.py31
-rwxr-xr-xindoteknik_custom/security/ir.model.access.csv1
-rw-r--r--indoteknik_custom/views/sourcing.xml46
3 files changed, 35 insertions, 43 deletions
diff --git a/indoteknik_custom/models/sourcing_job_order.py b/indoteknik_custom/models/sourcing_job_order.py
index 0e5334a8..ce0bc4ec 100644
--- a/indoteknik_custom/models/sourcing_job_order.py
+++ b/indoteknik_custom/models/sourcing_job_order.py
@@ -269,7 +269,7 @@ class SourcingJobOrderLine(models.Model):
product_id = fields.Many2one('product.product', string='Product', ondelete='cascade')
md_person_ids = fields.Many2one('res.users', string='MD Person', ondelete='cascade')
brand_id = fields.Many2one('x_manufactures', string='Manufactures', ondelete='cascade')
- so_id = fields.Many2one('sale.order', string='SO Number', tracking=True, readonly=True)
+ so_id = fields.Many2one('sale.order', string='SO Number', tracking=True)
product_name_md = fields.Char(string='Nama Barang')
descriptions_md = fields.Text(string='Deskripsi Barang')
@@ -325,11 +325,11 @@ class SourcingJobOrderLine(models.Model):
so_state = fields.Selection(
[
- ('draft', 'Draft'),
+ ('draft', 'Quotation'),
('cancel', 'Cancel'),
- ('sale', 'Sale')
+ ('sale', 'Sale Order')
],
- string="SO State",
+ string="Status SO",
compute="_compute_so_data"
)
@@ -408,7 +408,6 @@ class SourcingJobOrderLine(models.Model):
vals['show_salesperson'] = order.so_id.user_id.id
rec = super().create(vals)
- rec._check_line_limit()
return rec
def write(self, vals):
@@ -423,30 +422,8 @@ class SourcingJobOrderLine(models.Model):
res = super().write(vals)
if 'state' in vals:
self._update_parent_state()
- self._check_line_limit()
return res
- def _check_line_limit(self):
- for rec in self:
- if not rec.order_id or not rec.order_id.so_id:
- continue
-
- so = rec.order_id.so_id
-
- so_line_count = len(so.order_line)
-
- sourcing_lines = self.search([
- ('order_id', '=', rec.order_id.id),
- ('state', '!=', 'cancel')
- ])
-
- if len(sourcing_lines) > so_line_count:
- raise UserError(
- f"Jumlah Sourcing Line tidak boleh melebihi Sales Order Line.\n\n"
- f"Sales Order Line : {so_line_count}\n"
- f"Sourcing Line : {len(sourcing_lines)}"
- )
-
def _update_parent_state(self):
for rec in self:
order = rec.order_id
diff --git a/indoteknik_custom/security/ir.model.access.csv b/indoteknik_custom/security/ir.model.access.csv
index b8a1fd6f..4776b9e8 100755
--- a/indoteknik_custom/security/ir.model.access.csv
+++ b/indoteknik_custom/security/ir.model.access.csv
@@ -232,4 +232,5 @@ access_sjo_give_wizard_user,sjo.give.wizard user,model_sjo_give_wizard,base.grou
access_sjo_reject_give_wizard_user,sjo.reject.give.wizard user,model_sjo_reject_give_wizard,base.group_user,1,1,1,1
access_token_log,access.token.log,model_token_log,,1,1,1,1
+access_reopen_cancel_line_wizard,reopen.cancel.line.wizard,model_reopen_cancel_line_wizard,base.group_user,1,1,1,1
access_account_move_change_date_wizard,access.account.move.change.date.wizard,model_account_move_change_date_wizard,,1,1,1,1
diff --git a/indoteknik_custom/views/sourcing.xml b/indoteknik_custom/views/sourcing.xml
index 006817cf..cd1de5a4 100644
--- a/indoteknik_custom/views/sourcing.xml
+++ b/indoteknik_custom/views/sourcing.xml
@@ -102,12 +102,6 @@
groups="indoteknik_custom.group_role_merchandiser"
attrs="{'invisible': [('state', 'in', ['cancel', 'done'])]}"/>
- <button name="action_open_export_wizard"
- type="object"
- string="Input to SO"
- class="btn-primary"
- attrs="{'invisible':['|', ('state','not in',('done','partial')), ('so_id', '=', False)]}"/>
-
<field name="state" widget="statusbar"
statusbar_visible="draft,taken,partial,done,cancel" attrs="{'invisible': [('state', '!=', 'cancel')]}"/>
@@ -144,7 +138,7 @@
<field name="eta_sales"/>
<field name="eta_complete" readonly="1"/>
<field name="has_price_in_lines" invisible="1"/>
- <field name="so_id" readonly="1"/>
+ <field name="so_id"/>
</group>
<group>
<field name="create_uid" readonly="1" widget="many2one_avatar_user"/>
@@ -178,15 +172,26 @@
</tree>
<form string="Product Line">
<group>
+ <field name="brand" required="1"/>
+ <small style="margin-top:-1.4rem; display:block;">*Masukkan merek produk. Jika tidak diketahui, dapat diisi dengan "No Brand".</small>
+
+ <field name="product_name" required="1"/>
+ <small style="margin-top:-1.4rem; display:block;">*Isi nama produk secara jelas untuk mempermudah proses identifikasi saat sourcing.</small>
- <field name="brand" placeholder="Jika tidak mengetahui Brandnya isi saja *No Brand" required="1"/>
- <field name="product_name"/>
<field name="descriptions" required="1"/>
+
<field name="quantity"/>
+ <small style="margin-top:-1.4rem; display:block;">*Jumlah unit produk yang dibutuhkan.</small>
+
<field name="note"/>
+ <small style="margin-top:-1.4rem; display:block;">*Catatan tambahan yang dapat membantu proses sourcing.</small>
+
<field name="budget"/>
- <field name="attachment_type"/>
+ <small style="margin-top:-1.4rem; display:block;">*Perkiraan atau batas anggaran harga yang diharapkan.</small>
+ <field name="attachment_type"/>
+ <small style="margin-top:-1.4rem; display:block;">*Lampiran referensi seperti gambar produk, katalog, atau dokumen spesifikasi yang mendukung proses sourcing.</small>
+
<field name="product_attachment_pdf"
filename="product_attachment_filename"
attrs="{'invisible':[('attachment_type','!=','pdf')]}"/>
@@ -613,10 +618,10 @@
<separator string="Sales Input"/>
<field name="create_uid" widget="many2one_avatar_user" readonly="1"/>
<field name="show_salesperson" widget="many2one_avatar_user" readonly="1"/>
- <field name="so_id" readonly="1"/>
+ <field name="so_id"/>
<field name="so_state" widget="badge" readonly="1"
decoration-success="so_state == 'sale'"
- decoration-warning="so_state == 'draft'"
+ decoration-info="so_state == 'draft'"
decoration-danger="so_state == 'cancel'"/>
<field name="brand" readonly="1"/>
<field name="product_name" readonly="1"/>
@@ -674,7 +679,12 @@
<field name="res_model">sourcing.job.order.line</field>
<field name="view_mode">tree,form</field>
<field name="search_view_id" ref="view_sourcing_job_order_line_search"/>
- <field name="context">{'search_default_untaken': 1, 'search_default_my_job': 1}</field>
+ <field name="context">{
+ 'search_default_untaken': 1,
+ 'search_default_my_job': 1,
+ 'order': "CASE state WHEN 'draft' THEN 1 WHEN 'sourcing' THEN 2 WHEN 'sent' THEN 3 WHEN 'approve' THEN 4 WHEN 'cancel' THEN 5 END, id desc"
+ }
+ </field>
<field name="groups_id" eval="[(4, ref('indoteknik_custom.group_role_merchandiser'))]"/>
</record>
@@ -731,9 +741,14 @@
decoration-warning="state in ('sourcing','sent')"
decoration-success="state == 'approve'"
decoration-danger="state == 'cancel'">
-
- <field name="so_id"/>
<field name="order_id"/>
+ <field name="md_person_ids" widget="many2one_avatar_user" readonly="1"/>
+ <field name="so_id"/>
+ <field name="show_salesperson" widget="many2one_avatar_user"/>
+ <field name="so_state" widget="badge"
+ decoration-success="so_state == 'sale'"
+ decoration-info="so_state == 'draft'"
+ decoration-danger="so_state == 'cancel'"/>
<field name="code"/>
<field name="brand"/>
<field name="product_name"/>
@@ -741,7 +756,6 @@
<field name="price"/>
<field name="vendor_id"/>
<field name="subtotal"/>
- <field name="show_salesperson" widget="many2one_avatar_user"/>
<field name="state"
widget="badge"