summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2023-08-08 09:47:05 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2023-08-08 09:47:05 +0700
commita39466421a31d2ffd5f2252bf7aac903c4785d83 (patch)
treeafec474180897413ff61396710e49d891795df57
parente183c6bcc694810e508bb7689f1103d0e34f0527 (diff)
add field price vendor
-rwxr-xr-xindoteknik_custom/models/purchase_order_line.py12
-rwxr-xr-xindoteknik_custom/views/purchase_order.xml3
2 files changed, 15 insertions, 0 deletions
diff --git a/indoteknik_custom/models/purchase_order_line.py b/indoteknik_custom/models/purchase_order_line.py
index f255095f..1b5bba3a 100755
--- a/indoteknik_custom/models/purchase_order_line.py
+++ b/indoteknik_custom/models/purchase_order_line.py
@@ -28,6 +28,18 @@ class PurchaseOrderLine(models.Model):
qty_outgoing = fields.Float('Qty Outgoing', compute='compute_qty_stock')
qty_available_store = fields.Float(string='Available')
suggest = fields.Char(string='Suggest')
+ price_vendor = fields.Float(string='Price Vendor', compute='compute_price_vendor')
+
+
+ def compute_price_vendor(self):
+ for line in self:
+ purchase_pricelist = self.env['purchase.pricelist'].search([
+ ('product_id', '=', line.product_id.id),
+ ('vendor_id', '=', line.partner_id.id)
+ ], limit=1)
+
+ price_vendor = purchase_pricelist.product_price
+ line.price_vendor = price_vendor
def compute_qty_stock(self):
for line in self:
diff --git a/indoteknik_custom/views/purchase_order.xml b/indoteknik_custom/views/purchase_order.xml
index 2f8590f3..7d436c46 100755
--- a/indoteknik_custom/views/purchase_order.xml
+++ b/indoteknik_custom/views/purchase_order.xml
@@ -56,6 +56,9 @@
<field name="qty_available_store"/>
<field name="suggest"/>
</field>
+ <field name="price_unit" position="after">
+ <field name="price_vendor" attrs="{'readonly': 1}" optional="hide"/>
+ </field>
<page name="purchase_delivery_invoice" position="after">
<page name="purchase_vendor_bills" string="Vendor Bills" groups="indoteknik_custom.technical_administrator">
<group>