summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2023-06-20 15:20:05 +0700
committerstephanchrst <stephanchrst@gmail.com>2023-06-20 15:20:05 +0700
commit7b5e3a665220ebdc1f4c680df2202dc4eb12f4e3 (patch)
treeca12a439790acf0191457ac591dd33d6628f5f7b
parentaa59f0f8f3edfc0aa1e257b35d5c6e83b8f6978c (diff)
parent45583fb16a83602bea6c02711bfd947f7a402265 (diff)
Merge branch 'release' into receipt-approval
-rwxr-xr-xindoteknik_custom/models/purchase_order.py31
-rw-r--r--indoteknik_custom/models/requisition.py12
-rwxr-xr-xindoteknik_custom/models/sale_monitoring_detail.py4
-rwxr-xr-xindoteknik_custom/models/sale_order.py3
-rw-r--r--indoteknik_custom/views/requisition.xml2
-rwxr-xr-xindoteknik_custom/views/sale_monitoring_detail.xml2
-rwxr-xr-xindoteknik_custom/views/sale_order.xml1
7 files changed, 35 insertions, 20 deletions
diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py
index df1ecf14..13ff2931 100755
--- a/indoteknik_custom/models/purchase_order.py
+++ b/indoteknik_custom/models/purchase_order.py
@@ -151,23 +151,20 @@ class PurchaseOrder(models.Model):
self.order_line.unlink()
for order_line in self.sale_order_id.order_line:
if order_line.product_id.id and order_line.product_id.id not in products_exception:
- for order_line in self.sale_order_id.order_line:
- if not order_line.product_id:
- continue
- qty_available = order_line.product_id.qty_onhand_bandengan + order_line.product_id.qty_incoming_bandengan - order_line.product_id.outgoing_qty
-
- suggest = 'harus beli'
- if qty_available > order_line.product_qty:
- suggest = 'masih cukup'
- values = {
- 'order_id': self.id,
- 'product_id': order_line.product_id.id,
- 'name': order_line.product_id.display_name,
- 'product_qty': order_line.product_qty,
- 'qty_available_store': qty_available,
- 'suggest': suggest,
- }
- self.env['purchase.order.line'].create(values)
+ qty_available = order_line.product_id.qty_onhand_bandengan + order_line.product_id.qty_incoming_bandengan - order_line.product_id.outgoing_qty
+
+ suggest = 'harus beli'
+ if qty_available > order_line.product_qty:
+ suggest = 'masih cukup'
+ values = {
+ 'order_id': self.id,
+ 'product_id': order_line.product_id.id,
+ 'name': order_line.product_id.display_name,
+ 'product_qty': order_line.product_qty,
+ 'qty_available_store': qty_available,
+ 'suggest': suggest,
+ }
+ self.order_line.create(values)
def compute_count_line_product(self):
for order in self:
diff --git a/indoteknik_custom/models/requisition.py b/indoteknik_custom/models/requisition.py
index c1af4784..9ae6fb3e 100644
--- a/indoteknik_custom/models/requisition.py
+++ b/indoteknik_custom/models/requisition.py
@@ -44,6 +44,12 @@ class Requisition(models.Model):
purchase_price = 0
vendor_id = 0
+ # get qty available bandengan
+ qty_available = order_line.product_id.qty_onhand_bandengan + order_line.product_id.qty_incoming_bandengan - order_line.product_id.outgoing_qty
+ suggest = 'harus beli'
+ if qty_available > order_line.product_qty:
+ suggest = 'masih cukup'
+
purchase_pricelist = self.env['purchase.pricelist'].search([
('product_id.id', '=', order_line.product_id.id),
('vendor_id.id', '=', 5571)
@@ -78,7 +84,9 @@ class Requisition(models.Model):
'tax_id': order_line.purchase_tax_id.id,
'price_unit': purchase_price,
'subtotal': purchase_price * order_line.product_uom_qty,
- 'source': source
+ 'source': source,
+ 'qty_available_store': qty_available,
+ 'suggest': suggest,
}])
count+=1
_logger.info('Create Requisition %s' % order_line.product_id.name)
@@ -171,6 +179,8 @@ class RequisitionLine(models.Model):
current_po_id = fields.Many2one('purchase.order', string='Current')
current_po_line_id = fields.Many2one('purchase.order.line', string='Current Line')
source = fields.Char(string='Source', help='data harga diambil darimana')
+ qty_available_store = fields.Float(string='Available')
+ suggest = fields.Char(string='Suggest')
class RequisitionPurchaseMatch(models.Model):
_name = 'requisition.purchase.match'
diff --git a/indoteknik_custom/models/sale_monitoring_detail.py b/indoteknik_custom/models/sale_monitoring_detail.py
index 2bcda50c..43a8aeb0 100755
--- a/indoteknik_custom/models/sale_monitoring_detail.py
+++ b/indoteknik_custom/models/sale_monitoring_detail.py
@@ -22,6 +22,7 @@ class SaleMonitoringDetail(models.Model):
date_order = fields.Datetime(string="Date Order")
status = fields.Char(string="Status")
qty_reserved = fields.Integer(string="Qty Reserved")
+ note = fields.Char(string="Note")
def init(self):
tools.drop_view_if_exists(self.env.cr, self._table)
@@ -52,7 +53,8 @@ class SaleMonitoringDetail(models.Model):
so.date_order AS date_order,
get_qty_po(so.id, sol.product_id) AS qty_po,
get_qty_received(so.id, sol.product_id) AS qty_po_received,
- get_qty_reserved(so.id, sol.product_id) as qty_reserved
+ get_qty_reserved(so.id, sol.product_id) as qty_reserved,
+ sol.note_procurement as note
FROM sale_order so
JOIN sale_order_line sol ON sol.order_id = so.id
JOIN product_product p ON p.id = sol.product_id
diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py
index 5293b0fb..0c631761 100755
--- a/indoteknik_custom/models/sale_order.py
+++ b/indoteknik_custom/models/sale_order.py
@@ -70,7 +70,7 @@ class SaleOrder(models.Model):
('partial_refund', 'Partial Refund'),
('partial_chargeback', 'Partial Chargeback'),
('authorize', 'Authorize'),
- ], string='Payment Status', help='Payment Gateway Status / Midtrans / Web, https://docs.midtrans.com/en/after-payment/status-cycle')
+ ], tracking=True, string='Payment Status', help='Payment Gateway Status / Midtrans / Web, https://docs.midtrans.com/en/after-payment/status-cycle')
date_doc_kirim = fields.Datetime(string='Tanggal Kirim di SJ', help="Tanggal Kirim di cetakan SJ yang terakhir, tidak berpengaruh ke Accounting")
payment_type = fields.Char(string='Payment Type', help='Jenis pembayaran dengan Midtrans')
gross_amount = fields.Float(string='Gross Amount', help='Jumlah pembayaran yang dilakukan dengan Midtrans')
@@ -459,6 +459,7 @@ class SaleOrderLine(models.Model):
delivery_amt_line = fields.Float('DeliveryAmtLine', compute='compute_delivery_amt_line')
fee_third_party_line = fields.Float('FeeThirdPartyLine', compute='compute_fee_third_party_line', default=0)
line_no = fields.Integer('No', default=0, copy=False)
+ note_procurement = fields.Char(string='Note', help="Harap diisi jika ada keterangan tambahan dari Procurement, agar dapat dimonitoring")
def compute_item_margin(self):
for line in self:
diff --git a/indoteknik_custom/views/requisition.xml b/indoteknik_custom/views/requisition.xml
index 29b3a852..9e9440d8 100644
--- a/indoteknik_custom/views/requisition.xml
+++ b/indoteknik_custom/views/requisition.xml
@@ -27,6 +27,8 @@
<field name="tax_id"/>
<field name="subtotal"/>
<field name="source"/>
+ <field name="qty_available_store"/>
+ <field name="suggest"/>
</tree>
</field>
</record>
diff --git a/indoteknik_custom/views/sale_monitoring_detail.xml b/indoteknik_custom/views/sale_monitoring_detail.xml
index 824e65e8..ce5b8e9b 100755
--- a/indoteknik_custom/views/sale_monitoring_detail.xml
+++ b/indoteknik_custom/views/sale_monitoring_detail.xml
@@ -23,6 +23,7 @@
decoration-success="status == 'Siap kirim'"
decoration-info="status == 'Delivered' or status == 'Invoiced'"
/>
+ <field name="note" optional="hide"/>
</tree>
</field>
</record>
@@ -46,6 +47,7 @@
decoration-success="status == 'Siap kirim'"
decoration-info="status == 'Delivered' or status == 'Invoiced'"
/>
+ <field name="note"/>
</group>
<group>
<field name="qty_so"/>
diff --git a/indoteknik_custom/views/sale_order.xml b/indoteknik_custom/views/sale_order.xml
index b160d9b1..ea84eb00 100755
--- a/indoteknik_custom/views/sale_order.xml
+++ b/indoteknik_custom/views/sale_order.xml
@@ -61,6 +61,7 @@
"/>
<field name="purchase_tax_id" attrs="{'readonly': [('parent.approval_status', '!=', False)]}" domain="[('type_tax_use','=','purchase')]"/>
<field name="item_percent_margin"/>
+ <field name="note_procurement" optional="hide"/>
</xpath>
<xpath expr="//form/sheet/notebook/page/field[@name='order_line']/tree/field[@name='product_id']" position="before">
<field name="line_no" readonly="1" optional="hide"/>