summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2022-10-14 21:07:48 +0700
committerstephanchrst <stephanchrst@gmail.com>2022-10-14 21:07:48 +0700
commit8e9a84acd044954189cad84200b401516427c0fb (patch)
treedda8259aebebf4f23a797187829964fc4d0618c4
parent9a57defbaf402e921ed32ceb1a7818bbaf3d4006 (diff)
add line no in purchase order
-rwxr-xr-xindoteknik_custom/models/purchase_order.py8
-rwxr-xr-xindoteknik_custom/models/purchase_order_line.py4
2 files changed, 12 insertions, 0 deletions
diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py
index 84a95f9a..6023afdd 100755
--- a/indoteknik_custom/models/purchase_order.py
+++ b/indoteknik_custom/models/purchase_order.py
@@ -38,6 +38,14 @@ class PurchaseOrder(models.Model):
summary_qty_receipt = fields.Float('Summary Qty Receipt', compute='_compute_summary_qty')
count_line_product = fields.Float('Total Item', compute='compute_count_line_product')
+ def calculate_line_no(self):
+ line_no = 0
+ for line in self.order_line:
+ if line.product_id.type == 'product':
+ line_no += 1
+ line.line_no = line_no
+ # _logger.info('Calculate PO Line No %s' % line.id)
+
def calculate_po_status_beginning(self):
purchases = self.env['purchase.order'].search([
('po_status', '=', False),
diff --git a/indoteknik_custom/models/purchase_order_line.py b/indoteknik_custom/models/purchase_order_line.py
index bd758055..85818394 100755
--- a/indoteknik_custom/models/purchase_order_line.py
+++ b/indoteknik_custom/models/purchase_order_line.py
@@ -1,6 +1,9 @@
from odoo import fields, models, api, _
from odoo.exceptions import AccessError, UserError, ValidationError
from odoo.tools import DEFAULT_SERVER_DATETIME_FORMAT
+import logging
+
+_logger = logging.getLogger(__name__)
class PurchaseOrderLine(models.Model):
@@ -18,6 +21,7 @@ class PurchaseOrderLine(models.Model):
'SO Margin%', compute='compute_item_margin',
help="Total % Margin in Sales Order Header")
delivery_amt_line = fields.Float('DeliveryAmtLine', compute='compute_delivery_amt_line')
+ line_no = fields.Integer('No', default=0)
# Override method from addons/purchase/models/purchase.py
@api.onchange('product_qty', 'product_uom')