summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIT Fixcomart <it@fixcomart.co.id>2022-12-19 11:57:53 +0700
committerIT Fixcomart <it@fixcomart.co.id>2022-12-19 11:57:53 +0700
commit158f95b2f9a06c3f32bb5623992a04e846ee13a9 (patch)
tree657fed88441e2768a867852bad53222772a13358
parent7fb1392eee35b8620ef14a27640fe967be544a2d (diff)
readonly price unit and purchase price if so approved
-rwxr-xr-xindoteknik_custom/views/sale_order.xml21
1 files changed, 20 insertions, 1 deletions
diff --git a/indoteknik_custom/views/sale_order.xml b/indoteknik_custom/views/sale_order.xml
index 915b15ae..fed0b08d 100755
--- a/indoteknik_custom/views/sale_order.xml
+++ b/indoteknik_custom/views/sale_order.xml
@@ -25,9 +25,28 @@
<field name="sales_tax_id" domain="[('type_tax_use','=','sale')]" required="1"/>
<field name="carrier_id"/>
</field>
+ <xpath expr="//form/sheet/notebook/page/field[@name='order_line']/tree/field[@name='price_unit']" position="attributes">
+ <attribute name="attrs">
+ {
+ 'readonly': [
+ '|',
+ ('qty_invoiced', '>', 0),
+ ('parent.approval_status', '=', 'approved')
+ ]
+ }
+ </attribute>
+ </xpath>
<xpath expr="//form/sheet/notebook/page/field[@name='order_line']/tree/field[@name='price_total']" position="after">
<field name="vendor_id" attrs="{'readonly': [('parent.state', 'not in', ['draft', 'sent', 'sale'])]}"/>
- <field name="purchase_price" attrs="{'readonly': [('parent.state', 'not in', ['draft', 'sent', 'sale'])]}"/>
+ <field name="purchase_price" attrs="
+ {
+ 'readonly': [
+ '|',
+ ('parent.state', 'not in', ['draft', 'sent', 'sale']),
+ ('parent.approval_status', '=', 'approved')
+ ]
+ }
+ "/>
<field name="purchase_tax_id" attrs="{'readonly': [('parent.state', 'not in', ['draft', 'sent', 'sale'])]}" domain="[('type_tax_use','=','purchase')]"/>
<field name="item_percent_margin"/>
</xpath>