summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/stock_picking.py
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2023-03-27 15:11:47 +0700
committerstephanchrst <stephanchrst@gmail.com>2023-03-27 15:11:47 +0700
commit124aafcd00d3899eb54f9ec27556ce307c7656f4 (patch)
tree5443107aa4e08d8cd73e22afd35207f0c1306b31 /indoteknik_custom/models/stock_picking.py
parent4ab719732e495ad2eb42ee8ea1c63dc875b98f1d (diff)
custom method for create bill from stock picking or goods receipt
Diffstat (limited to 'indoteknik_custom/models/stock_picking.py')
-rw-r--r--indoteknik_custom/models/stock_picking.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py
index 77af676c..e63370f5 100644
--- a/indoteknik_custom/models/stock_picking.py
+++ b/indoteknik_custom/models/stock_picking.py
@@ -84,15 +84,17 @@ class StockPicking(models.Model):
# Invoice values.
invoice_vals = order._prepare_invoice()
# Invoice line values (keep only necessary sections).
- for line in order.order_line:
- if line.display_type == 'line_section':
+ for line in self.move_ids_without_package:
+ po_line = self.env['purchase.order.line'].search([('order_id', '=', po.id), ('product_id', '=', line.product_id.id)], limit=1)
+ qty = line.product_uom_qty
+ if po_line.display_type == 'line_section':
pending_section = line
continue
- if not float_is_zero(line.qty_to_invoice, precision_digits=precision):
+ if not float_is_zero(po_line.qty_to_invoice, precision_digits=precision):
if pending_section:
- invoice_vals['invoice_line_ids'].append((0, 0, pending_section._prepare_account_move_line()))
+ invoice_vals['invoice_line_ids'].append((0, 0, pending_section._prepare_account_move_line_from_mr(po_line, qty)))
pending_section = None
- invoice_vals['invoice_line_ids'].append((0, 0, line._prepare_account_move_line()))
+ invoice_vals['invoice_line_ids'].append((0, 0, line._prepare_account_move_line_from_mr(po_line, qty)))
invoice_vals_list.append(invoice_vals)
if not invoice_vals_list: