summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiqdad <ahmadmiqdad27@gmail.com>2025-07-23 14:03:51 +0700
committerMiqdad <ahmadmiqdad27@gmail.com>2025-07-23 14:03:51 +0700
commitf8b95c402ca5850448fa6fd4fd59cdd21e49850b (patch)
tree6dff6e932b61dcf77b9a147e34a9d358cf1081e4
parent2b1ee134a0465f3982692c6b8d6a8ac4f60f4487 (diff)
<miqdad> show vcm in PO
-rwxr-xr-xindoteknik_custom/models/purchase_order.py5
-rwxr-xr-xindoteknik_custom/views/purchase_order.xml7
2 files changed, 12 insertions, 0 deletions
diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py
index 5b9e1acb..d157dc30 100755
--- a/indoteknik_custom/models/purchase_order.py
+++ b/indoteknik_custom/models/purchase_order.py
@@ -17,6 +17,7 @@ _logger = logging.getLogger(__name__)
class PurchaseOrder(models.Model):
_inherit = 'purchase.order'
+ vcm_id = fields.Many2one('tukar.guling.po', string='Doc VCM', readonly=True, compute='_has_vcm', copy=False)
order_sales_match_line = fields.One2many('purchase.order.sales.match', 'purchase_order_id', string='Sales Match Lines', states={'cancel': [('readonly', True)], 'done': [('readonly', True)]}, copy=True)
sale_order_id = fields.Many2one('sale.order', string='Sale Order')
procurement_status = fields.Char(string='Procurement Status', compute='get_procurement_status', readonly=True)
@@ -99,6 +100,10 @@ class PurchaseOrder(models.Model):
)
manufacturing_id = fields.Many2one('mrp.production', string='Manufacturing Orders')
+ def _has_vcm(self):
+ if self.id:
+ self.vcm_id = self.env['tukar.guling.po'].search([('origin', '=', self.name)], limit=1)
+
@api.depends('name')
def _compute_bu_related_count(self):
StockPicking = self.env['stock.picking']
diff --git a/indoteknik_custom/views/purchase_order.xml b/indoteknik_custom/views/purchase_order.xml
index dae23eed..ff223125 100755
--- a/indoteknik_custom/views/purchase_order.xml
+++ b/indoteknik_custom/views/purchase_order.xml
@@ -189,6 +189,13 @@
<field name="order_sales_match_line"/>
</page>
</xpath>
+ <xpath expr="//form/sheet/notebook/page[@name='purchase_delivery_invoice']" position="after">
+ <page string="Other Info" name="purchase_order_sales_matches_lines">
+ <group string="Return Doc">
+ <field name="vcm_id"/>
+ </group>
+ </page>
+ </xpath>
</field>
</record>
</data>