summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2023-02-10 15:26:25 +0700
committerstephanchrst <stephanchrst@gmail.com>2023-02-10 15:26:25 +0700
commitb87787893d25f735bdf9aba164bc8b1f23e2b72f (patch)
treede41a18dd103a96225698e6a9bdb9349d80190e0
parent3de9e2a7e2b9b455fa85e33231612996538830f4 (diff)
fix line number in po/so and stock picking
-rw-r--r--indoteknik_custom/models/stock_move.py6
-rw-r--r--indoteknik_custom/models/stock_picking.py13
-rw-r--r--indoteknik_custom/views/stock_picking.xml8
3 files changed, 12 insertions, 15 deletions
diff --git a/indoteknik_custom/models/stock_move.py b/indoteknik_custom/models/stock_move.py
index 869053d7..22a73010 100644
--- a/indoteknik_custom/models/stock_move.py
+++ b/indoteknik_custom/models/stock_move.py
@@ -33,3 +33,9 @@ class StockMove(models.Model):
new_account_move._post()
return True
return super(StockMove, self)._create_account_move_line(credit_account_id, debit_account_id, journal_id, qty, description, svl_id, cost)
+
+
+class StockMoveLine(models.Model):
+ _inherit = 'stock.move.line'
+
+ line_no = fields.Integer('No', default=0)
diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py
index 4049c535..2c75ccbc 100644
--- a/indoteknik_custom/models/stock_picking.py
+++ b/indoteknik_custom/models/stock_picking.py
@@ -96,24 +96,23 @@ class StockPicking(models.Model):
def calculate_line_no(self):
for picking in self:
- for line in picking.move_ids_without_package:
- # order_lines = picking.group_id.order_line
- name = picking.group_id.name
+ name = picking.group_id.name
+ for move in picking.move_ids_without_package:
if picking.group_id.sale_id:
order = self.env['sale.order'].search([('name', '=', name)], limit=1)
else:
order = self.env['purchase.order'].search([('name', '=', name)], limit=1)
-
order_lines = order.order_line
set_line = 0
-
for order_line in order_lines:
- if line.product_id == order_line.product_id:
+ if move.product_id == order_line.product_id:
set_line = order_line.line_no
break
else:
continue
- line.line_no = set_line
+ move.line_no = set_line
+ for line in move.move_line_ids:
+ line.line_no = set_line
def _compute_summary_qty(self):
sum_qty_detail = sum_qty_operation = count_line_detail = count_line_operation = 0
diff --git a/indoteknik_custom/views/stock_picking.xml b/indoteknik_custom/views/stock_picking.xml
index 49e594b1..a189e399 100644
--- a/indoteknik_custom/views/stock_picking.xml
+++ b/indoteknik_custom/views/stock_picking.xml
@@ -31,14 +31,6 @@
attrs="{'invisible': ['|', ('state', '=', 'draft'), ('state', '=', 'cancel'), ('approval_return_status', '=', 'pengajuan1')]}"
/>
</button>
- <div class="oe_title" position="after">
- <button name="calculate_line_no"
- string="Line No"
- type="object"
- class="oe_highlight oe_edit_only"
- attrs="{'invisible': ['|', ('state', '=', 'confirmed'), ('state', '=', 'done'), ('state', '=', 'cancel')]}"
- />
- </div>
<field name="backorder_id" position="after">
<field name="is_internal_use"
string="Internal Use"