Commit 1bbea36a authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_accounting: Adjust chinese taxation for 1%

parent cf069086
......@@ -212,11 +212,17 @@
<value>
<dictionary>
<item>
<key> <string>validation_workflow</string> </key>
<key> <string>edit_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAg=</string> </persistent>
</value>
</item>
<item>
<key> <string>validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAk=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
......@@ -224,6 +230,69 @@
</pickle>
</record>
<record id="8" aka="AAAAAAAAAAg=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>edit</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>991.53635.62912.26897</string> </value>
</item>
<item>
<key> <string>state</string> </key>
<value> <string>current</string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1620318646.43</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="9" aka="AAAAAAAAAAk=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
......
......@@ -30,7 +30,7 @@
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>VAT_EUR</string> </value>
<value> <string>VAT</string> </value>
</item>
<item>
<key> <string>description</string> </key>
......@@ -188,7 +188,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>991.53633.45708.36590</string> </value>
<value> <string>991.53633.57403.44373</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -206,7 +206,7 @@
</tuple>
<state>
<tuple>
<float>1620065392.55</float>
<float>1620318646.42</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -30,7 +30,7 @@
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>VAT_CNY</string> </value>
<value> <string>VAT</string> </value>
</item>
<item>
<key> <string>description</string> </key>
......@@ -53,7 +53,6 @@
<value>
<tuple>
<string>price_currency</string>
<string>resource</string>
</tuple>
</value>
</item>
......@@ -62,7 +61,6 @@
<value>
<tuple>
<string>price_currency/currency_module/CNY</string>
<string>resource/service_module/slapos_instance_subscription</string>
</tuple>
</value>
</item>
......@@ -72,7 +70,7 @@
</item>
<item>
<key> <string>price</string> </key>
<value> <float>0.2</float> </value>
<value> <float>0.01</float> </value>
</item>
<item>
<key> <string>quantity</string> </key>
......@@ -190,7 +188,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>991.53652.31735.11434</string> </value>
<value> <string>991.57855.43043.56797</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -208,7 +206,7 @@
</tuple>
<state>
<tuple>
<float>1620066600.95</float>
<float>1620326231.38</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -280,9 +280,7 @@
</item>
<item>
<key> <string>comment</string> </key>
<value>
<none/>
</value>
<value> <string>Deleted objects: [\'1\', \'2\']</string> </value>
</item>
<item>
<key> <string>error_message</string> </key>
......@@ -290,7 +288,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>990.36941.15111.50278</string> </value>
<value> <string>991.57853.29905.57463</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -308,7 +306,7 @@
</tuple>
<state>
<tuple>
<float>1615227411.66</float>
<float>1620318739.43</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -42,6 +42,28 @@
<key> <string>id</string> </key>
<value> <string>1</string> </value>
</item>
<item>
<key> <string>int_index</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>membership_criterion_base_category</string> </key>
<value>
<tuple>
<string>price_currency</string>
</tuple>
</value>
</item>
<item>
<key> <string>membership_criterion_category</string> </key>
<value>
<tuple>
<string>price_currency/currency_module/EUR</string>
</tuple>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Trade Model Line</string> </value>
......@@ -54,13 +76,31 @@
<key> <string>quantity</string> </key>
<value> <float>1.0</float> </value>
</item>
<item>
<key> <string>string_index</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>target_delivery</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>test_method_id</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>VAT</string> </value>
<value> <string>VAT (EURO)</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
......@@ -95,4 +135,121 @@
</dictionary>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>edit_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAU=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="5" aka="AAAAAAAAAAU=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>edit</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAY=</string> </persistent>
</value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>0.0.0.0</string> </value>
</item>
<item>
<key> <string>state</string> </key>
<value> <string>current</string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1620318743.66</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="6" aka="AAAAAAAAAAY=">
<pickle>
<global name="Message" module="Products.ERP5Type.Message"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default</string> </key>
<value> <string>Object copied from ${source_item}</string> </value>
</item>
<item>
<key> <string>domain</string> </key>
<value> <string>erp5_ui</string> </value>
</item>
<item>
<key> <string>mapping</string> </key>
<value>
<dictionary>
<item>
<key> <string>source_item</string> </key>
<value> <string>/erp5/sale_trade_condition_module/slapos_aggregated_subscription_trade_condition/1</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>message</string> </key>
<value> <string>Object copied from ${source_item}</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Trade Model Line" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_identity_criterion</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>_range_criterion</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>resource/service_module/slapos_tax</string>
<string>base_application/base_amount/invoicing/taxable</string>
<string>trade_phase/slapos/tax</string>
</tuple>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>VAT</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>5</string> </value>
</item>
<item>
<key> <string>int_index</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>membership_criterion_base_category</string> </key>
<value>
<tuple>
<string>price_currency</string>
<string>resource</string>
</tuple>
</value>
</item>
<item>
<key> <string>membership_criterion_category</string> </key>
<value>
<tuple>
<string>price_currency/currency_module/CNY</string>
</tuple>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Trade Model Line</string> </value>
</item>
<item>
<key> <string>price</string> </key>
<value> <float>0.01</float> </value>
</item>
<item>
<key> <string>quantity</string> </key>
<value> <float>1.0</float> </value>
</item>
<item>
<key> <string>string_index</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>target_delivery</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>test_method_id</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>VAT (CNY)</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>edit_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAU=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="5" aka="AAAAAAAAAAU=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>edit</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAY=</string> </persistent>
</value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>0.0.0.0</string> </value>
</item>
<item>
<key> <string>state</string> </key>
<value> <string>current</string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1620318743.66</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="6" aka="AAAAAAAAAAY=">
<pickle>
<global name="Message" module="Products.ERP5Type.Message"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default</string> </key>
<value> <string>Object copied from ${source_item}</string> </value>
</item>
<item>
<key> <string>domain</string> </key>
<value> <string>erp5_ui</string> </value>
</item>
<item>
<key> <string>mapping</string> </key>
<value>
<dictionary>
<item>
<key> <string>source_item</string> </key>
<value> <string>/erp5/sale_trade_condition_module/slapos_aggregated_subscription_trade_condition/3</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>message</string> </key>
<value> <string>Object copied from ${source_item}</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -66,6 +66,10 @@ for movement in movement_list:
# XXX Shamefully hardcoded values
if movement.getResource() == 'service_module/slapos_instance_subscription':
if movement.getPriceCurrency() == "currency_module/CNY":
# reduce tax from there directly
temp_movement.edit(price=movement.getPrice(0.0)/1.01)
else:
# reduce tax from there directly
temp_movement.edit(price=movement.getPrice(0.0)/1.2)
elif movement.getResource() == 'service_module/slapos_reservation_refund':
......
......@@ -35,8 +35,8 @@
<string>use/trade/sale</string>
<string>resource/service_module/slapos_reservation_fee</string>
<string>quantity_unit/unit/piece</string>
<string>base_contribution/base_amount/invoicing</string>
<string>variation/service_module/slapos_reservation_fee/default</string>
<string>base_contribution/base_amount/invoicing/taxable</string>
</tuple>
</value>
</item>
......
......@@ -48,7 +48,12 @@ if current_invoice is None:
# with taxes, but for now it is hardcoded.
tax = 0
if 'base_amount/invoicing/taxable' in invoice_line.getBaseContributionList():
tax = 0.2
specialise = invoice_line.getSpecialiseValue(portal_type='Sale Trade Condition')
if specialise is not None:
for trade_model_line in specialise.getAggregatedAmountList(invoice_line):
tax = trade_model_line.getPrice()
# For simplification consider tax is a single value.
break
for line in current_payment.contentValues():
if line.getSource() == "account_module/payment_to_encash":
......
......@@ -33,12 +33,12 @@ class TestSlapOSSubscriptionCDNScenarioMixin(TestSlapOSSubscriptionScenarioMixin
self.expected_reservation_tax = 0.166666666666667
self.expected_price_currency = "currency_module/EUR"
self.expected_zh_individual_price_without_tax = 33.333333333333333
self.expected_zh_individual_price_with_tax = 40.0
self.expected_zh_reservation_fee = 8.0
self.expected_zh_individual_price_without_tax = 40
self.expected_zh_individual_price_with_tax = 40.4
self.expected_zh_reservation_fee = 8.08
self.expected_zh_reservation_fee_without_tax = 8.0
self.expected_zh_reservation_quantity_tax = 0
self.expected_zh_reservation_tax = 0
self.expected_zh_reservation_quantity_tax = 8.08
self.expected_zh_reservation_tax = 0.08
self.resource_variation_reference = "CDN"
......
......@@ -29,7 +29,7 @@ class testSlapOSSubscriptionDualOrganisationScenario(TestSlapOSSubscriptionScena
self.expected_source = fr_organisation.getRelativeUrl()
self.expected_source_section = fr_organisation.getRelativeUrl()
self.expected_zh_reservation_fee = 188.00
self.expected_zh_reservation_fee = 189.88
self.subscription_condition.edit(
source=self.expected_source,
......
......@@ -40,12 +40,12 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
self.expected_price_currency = "currency_module/EUR"
self.expected_zh_individual_price_without_tax = 1573.3333333333335
self.expected_zh_individual_price_with_tax = 1888.00
self.expected_zh_reservation_fee = 188.00
self.expected_zh_individual_price_without_tax = 1888
self.expected_zh_individual_price_with_tax = 1906.88
self.expected_zh_reservation_fee = 189.88
self.expected_zh_reservation_fee_without_tax = 188
self.expected_zh_reservation_quantity_tax = 0
self.expected_zh_reservation_tax = 0
self.expected_zh_reservation_quantity_tax = 188
self.expected_zh_reservation_tax = 1.88
self.expected_notification_language = "en"
self.expected_source = self.expected_slapos_organisation
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment