Skip to content
Snippets Groups Projects
Commit f3aba1c1 authored by Benjamin Ulrich's avatar Benjamin Ulrich :speech_balloon:
Browse files

Merge branch '1050442_vat_price_default_value' into '2021.0'

1050442 vat price default value

See merge request xrm/basic!653
parents 28cf87d6 e387aca9
No related branches found
No related tags found
No related merge requests found
...@@ -2,14 +2,18 @@ import("Product_lib"); ...@@ -2,14 +2,18 @@ import("Product_lib");
import("system.vars"); import("system.vars");
import("system.result"); import("system.result");
import("system.neon"); import("system.neon");
import("system.project");
if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null)
{ {
var defaultVAT = project.getPreferenceValue("custom.sales.vat", "0");
if (vars.get("$field.PRODUCT_ID")) if (vars.get("$field.PRODUCT_ID"))
{ {
var price = ProductUtils.getCurrentProductPrice(vars.get("$field.PRODUCT_ID"), "SP", true); var price = ProductUtils.getCurrentProductPrice(vars.get("$field.PRODUCT_ID"), "SP", true);
result.string(price[2] || "0"); result.string(price[2] || defaultVAT);
} }
else else
result.string("0"); {
} result.string(defaultVAT);
\ No newline at end of file }
}
...@@ -163,5 +163,10 @@ ...@@ -163,5 +163,10 @@
<description>Whether the observations are enabled or not</description> <description>Whether the observations are enabled or not</description>
<property v="false" /> <property v="false" />
</customBooleanProperty> </customBooleanProperty>
<customStringProperty>
<name>sales.vat</name>
<description>Default VAT in percent</description>
<property>19</property>
</customStringProperty>
</customProperties> </customProperties>
</preferences> </preferences>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment