From d570fb1d7a1e5848826183dfd091c67c50607dfd Mon Sep 17 00:00:00 2001
From: Nicolas Wavrant <nicolas.wavrant@nexedi.com>
Date: Tue, 18 Jun 2019 07:29:27 +0000
Subject: [PATCH] erp5_property_sheets: add properties needed to calculate
 price per slice

---
 .../base_price_per_slice_property.xml         | 39 ++++++++++++
 .../SupplyLine/slice_base_price_property.xml  | 60 +++++++++++++++++++
 .../slice_quantity_range_property.xml         | 59 ++++++++++++++++++
 3 files changed, 158 insertions(+)
 create mode 100644 product/ERP5/bootstrap/erp5_property_sheets/PropertySheetTemplateItem/portal_property_sheets/SupplyLine/base_price_per_slice_property.xml
 create mode 100644 product/ERP5/bootstrap/erp5_property_sheets/PropertySheetTemplateItem/portal_property_sheets/SupplyLine/slice_base_price_property.xml
 create mode 100644 product/ERP5/bootstrap/erp5_property_sheets/PropertySheetTemplateItem/portal_property_sheets/SupplyLine/slice_quantity_range_property.xml

diff --git a/product/ERP5/bootstrap/erp5_property_sheets/PropertySheetTemplateItem/portal_property_sheets/SupplyLine/base_price_per_slice_property.xml b/product/ERP5/bootstrap/erp5_property_sheets/PropertySheetTemplateItem/portal_property_sheets/SupplyLine/base_price_per_slice_property.xml
new file mode 100644
index 0000000000..b8dbb2a441
--- /dev/null
+++ b/product/ERP5/bootstrap/erp5_property_sheets/PropertySheetTemplateItem/portal_property_sheets/SupplyLine/base_price_per_slice_property.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <global name="Standard Property" module="erp5.portal_type"/>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>categories</string> </key>
+            <value>
+              <tuple>
+                <string>elementary_type/boolean</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>description</string> </key>
+            <value> <string encoding="cdata"><![CDATA[
+
+Defines if the base_price of maching quantity step should be used as unit price for all items (value is False), or if it applies  only to items of the range (value is True).\n
+\n
+If this property is set to True, the base_price will be calculated as such :\n
+if 0->10 products cost 10$, and 11->infinity products cost 9$, in a command of 15 products, the unit base price is 9.6667$, as the 10 first products cost 10$, and the 5 others cost 9$ (and (10*10+5*9)/15 = 9.6667)
+
+]]></string> </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>base_price_per_slice_property</string> </value>
+        </item>
+        <item>
+            <key> <string>portal_type</string> </key>
+            <value> <string>Standard Property</string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/product/ERP5/bootstrap/erp5_property_sheets/PropertySheetTemplateItem/portal_property_sheets/SupplyLine/slice_base_price_property.xml b/product/ERP5/bootstrap/erp5_property_sheets/PropertySheetTemplateItem/portal_property_sheets/SupplyLine/slice_base_price_property.xml
new file mode 100644
index 0000000000..48cf6f4167
--- /dev/null
+++ b/product/ERP5/bootstrap/erp5_property_sheets/PropertySheetTemplateItem/portal_property_sheets/SupplyLine/slice_base_price_property.xml
@@ -0,0 +1,60 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <global name="Standard Property" module="erp5.portal_type"/>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>_local_properties</string> </key>
+            <value>
+              <tuple>
+                <dictionary>
+                  <item>
+                      <key> <string>id</string> </key>
+                      <value> <string>mode</string> </value>
+                  </item>
+                  <item>
+                      <key> <string>type</string> </key>
+                      <value> <string>string</string> </value>
+                  </item>
+                </dictionary>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>categories</string> </key>
+            <value>
+              <tuple>
+                <string>elementary_type/object</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>description</string> </key>
+            <value> <string>A per unit base price applying to the products whose quantity is in slice. This per unit base price will be weighted with the per unit base price of other slices.\n
+\n
+This property is useful for the following case :\n
+0-10 products cost 10$, and 11-inf products cost 9$. Thus in a command of 15 products, the unit base price is 9.6667$, as 10 * 10 + 5 * 9 = 145, and 145 / 15 = 9.6667</string> </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>slice_base_price_property</string> </value>
+        </item>
+        <item>
+            <key> <string>mode</string> </key>
+            <value> <string>w</string> </value>
+        </item>
+        <item>
+            <key> <string>multivalued</string> </key>
+            <value> <int>0</int> </value>
+        </item>
+        <item>
+            <key> <string>portal_type</string> </key>
+            <value> <string>Standard Property</string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/product/ERP5/bootstrap/erp5_property_sheets/PropertySheetTemplateItem/portal_property_sheets/SupplyLine/slice_quantity_range_property.xml b/product/ERP5/bootstrap/erp5_property_sheets/PropertySheetTemplateItem/portal_property_sheets/SupplyLine/slice_quantity_range_property.xml
new file mode 100644
index 0000000000..4e8b4509b0
--- /dev/null
+++ b/product/ERP5/bootstrap/erp5_property_sheets/PropertySheetTemplateItem/portal_property_sheets/SupplyLine/slice_quantity_range_property.xml
@@ -0,0 +1,59 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <global name="Standard Property" module="erp5.portal_type"/>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>_local_properties</string> </key>
+            <value>
+              <tuple>
+                <dictionary>
+                  <item>
+                      <key> <string>id</string> </key>
+                      <value> <string>mode</string> </value>
+                  </item>
+                  <item>
+                      <key> <string>type</string> </key>
+                      <value> <string>string</string> </value>
+                  </item>
+                </dictionary>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>categories</string> </key>
+            <value>
+              <tuple>
+                <string>elementary_type/object</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>description</string> </key>
+            <value> <string>quantiy range of the items for which the slice_base_price will be applied if base_price_per_slice is True.\n
+\n
+slice_quantity_range is a 2-tuple : (min_bound, max_bound)</string> </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>slice_quantity_range_property</string> </value>
+        </item>
+        <item>
+            <key> <string>mode</string> </key>
+            <value> <string>w</string> </value>
+        </item>
+        <item>
+            <key> <string>multivalued</string> </key>
+            <value> <int>0</int> </value>
+        </item>
+        <item>
+            <key> <string>portal_type</string> </key>
+            <value> <string>Standard Property</string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
-- 
2.30.9