Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Roque
slapos.core
Commits
43b65274
Commit
43b65274
authored
Apr 11, 2016
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_accounting: migrate to new business template format
parent
6684c59f
Changes
153
Show whitespace changes
Inline
Side-by-side
Showing
153 changed files
with
1780 additions
and
2041 deletions
+1780
-2041
master/bt5/slapos_accounting/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_related_causality_payment_transaction.sql
..._mysql_innodb/z_related_causality_payment_transaction.sql
+8
-0
master/bt5/slapos_accounting/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_related_causality_payment_transaction.xml
..._mysql_innodb/z_related_causality_payment_transaction.xml
+0
-16
master/bt5/slapos_accounting/PathTemplateItem/account_module/bank.xml
...lapos_accounting/PathTemplateItem/account_module/bank.xml
+6
-0
master/bt5/slapos_accounting/PathTemplateItem/account_module/capital.xml
...os_accounting/PathTemplateItem/account_module/capital.xml
+6
-0
master/bt5/slapos_accounting/PathTemplateItem/account_module/coll_vat.xml
...s_accounting/PathTemplateItem/account_module/coll_vat.xml
+6
-0
master/bt5/slapos_accounting/PathTemplateItem/account_module/equipments.xml
...accounting/PathTemplateItem/account_module/equipments.xml
+6
-0
master/bt5/slapos_accounting/PathTemplateItem/account_module/inventories.xml
...ccounting/PathTemplateItem/account_module/inventories.xml
+6
-0
master/bt5/slapos_accounting/PathTemplateItem/account_module/payable.xml
...os_accounting/PathTemplateItem/account_module/payable.xml
+6
-0
master/bt5/slapos_accounting/PathTemplateItem/account_module/profit_loss.xml
...ccounting/PathTemplateItem/account_module/profit_loss.xml
+6
-0
master/bt5/slapos_accounting/PathTemplateItem/account_module/purchase.xml
...s_accounting/PathTemplateItem/account_module/purchase.xml
+6
-0
master/bt5/slapos_accounting/PathTemplateItem/account_module/receivable.xml
...accounting/PathTemplateItem/account_module/receivable.xml
+6
-0
master/bt5/slapos_accounting/PathTemplateItem/account_module/refundable_vat.xml
...unting/PathTemplateItem/account_module/refundable_vat.xml
+6
-0
master/bt5/slapos_accounting/PathTemplateItem/account_module/sales.xml
...apos_accounting/PathTemplateItem/account_module/sales.xml
+6
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Alarm_deliverStartedAggregatedSalePackingList.py
...counting/Alarm_deliverStartedAggregatedSalePackingList.py
+10
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Alarm_deliverStartedAggregatedSalePackingList.xml
...ounting/Alarm_deliverStartedAggregatedSalePackingList.xml
+0
-14
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Alarm_reindexOpenSaleOrderWithModifiedLine.py
..._accounting/Alarm_reindexOpenSaleOrderWithModifiedLine.py
+11
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Alarm_reindexOpenSaleOrderWithModifiedLine.xml
...accounting/Alarm_reindexOpenSaleOrderWithModifiedLine.xml
+0
-15
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Alarm_requestUpdateHostingSubscriptionOpenSaleOrder.py
...ng/Alarm_requestUpdateHostingSubscriptionOpenSaleOrder.py
+12
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Alarm_requestUpdateHostingSubscriptionOpenSaleOrder.xml
...g/Alarm_requestUpdateHostingSubscriptionOpenSaleOrder.xml
+0
-16
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Alarm_requestUpdateOpenSaleOrderPeriod.py
...apos_accounting/Alarm_requestUpdateOpenSaleOrderPeriod.py
+11
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Alarm_requestUpdateOpenSaleOrderPeriod.xml
...pos_accounting/Alarm_requestUpdateOpenSaleOrderPeriod.xml
+0
-15
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Alarm_searchDivergedInstanceList.py
...ins/slapos_accounting/Alarm_searchDivergedInstanceList.py
+12
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Alarm_searchDivergedInstanceList.xml
...ns/slapos_accounting/Alarm_searchDivergedInstanceList.xml
+0
-16
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Alarm_searchSubmittedConsumptionTioXMLFileList.py
...ounting/Alarm_searchSubmittedConsumptionTioXMLFileList.py
+12
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Alarm_searchSubmittedConsumptionTioXMLFileList.xml
...unting/Alarm_searchSubmittedConsumptionTioXMLFileList.xml
+0
-16
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Alarm_startConfirmedAggregatedSalePackingList.py
...counting/Alarm_startConfirmedAggregatedSalePackingList.py
+29
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Alarm_startConfirmedAggregatedSalePackingList.xml
...ounting/Alarm_startConfirmedAggregatedSalePackingList.xml
+0
-37
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Alarm_stopConfirmedAggregatedSaleInvoiceTransaction.py
...ng/Alarm_stopConfirmedAggregatedSaleInvoiceTransaction.py
+13
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Alarm_stopConfirmedAggregatedSaleInvoiceTransaction.xml
...g/Alarm_stopConfirmedAggregatedSaleInvoiceTransaction.xml
+0
-17
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Alarm_triggerSlapOSAggregatedDeliveryOrderBuilder.py
...ting/Alarm_triggerSlapOSAggregatedDeliveryOrderBuilder.py
+4
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Alarm_triggerSlapOSAggregatedDeliveryOrderBuilder.xml
...ing/Alarm_triggerSlapOSAggregatedDeliveryOrderBuilder.xml
+0
-8
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Delivery_deliverStartedAggregatedSalePackingList.py
...nting/Delivery_deliverStartedAggregatedSalePackingList.py
+14
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Delivery_deliverStartedAggregatedSalePackingList.xml
...ting/Delivery_deliverStartedAggregatedSalePackingList.xml
+0
-18
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Delivery_startConfirmedAggregatedSalePackingList.py
...nting/Delivery_startConfirmedAggregatedSalePackingList.py
+14
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Delivery_startConfirmedAggregatedSalePackingList.xml
...ting/Delivery_startConfirmedAggregatedSalePackingList.xml
+0
-18
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Delivery_stopConfirmedAggregatedSaleInvoiceTransaction.py
...Delivery_stopConfirmedAggregatedSaleInvoiceTransaction.py
+13
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Delivery_stopConfirmedAggregatedSaleInvoiceTransaction.xml
...elivery_stopConfirmedAggregatedSaleInvoiceTransaction.xml
+0
-17
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/HostingSubscription_calculateSubscriptionStartDate.py
...ing/HostingSubscription_calculateSubscriptionStartDate.py
+26
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/HostingSubscription_calculateSubscriptionStartDate.xml
...ng/HostingSubscription_calculateSubscriptionStartDate.xml
+0
-30
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/HostingSubscription_calculateSubscriptionStopDate.py
...ting/HostingSubscription_calculateSubscriptionStopDate.py
+25
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/HostingSubscription_calculateSubscriptionStopDate.xml
...ing/HostingSubscription_calculateSubscriptionStopDate.xml
+0
-33
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/HostingSubscription_requestUpdateOpenSaleOrder.py
...ounting/HostingSubscription_requestUpdateOpenSaleOrder.py
+12
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/HostingSubscription_requestUpdateOpenSaleOrder.xml
...unting/HostingSubscription_requestUpdateOpenSaleOrder.xml
+0
-16
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Instance_solveInvoicingGeneration.py
...ns/slapos_accounting/Instance_solveInvoicingGeneration.py
+119
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Instance_solveInvoicingGeneration.xml
...s/slapos_accounting/Instance_solveInvoicingGeneration.xml
+0
-127
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/OpenSaleOrder_reindexIfIndexedBeforeLine.py
...os_accounting/OpenSaleOrder_reindexIfIndexedBeforeLine.py
+18
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/OpenSaleOrder_reindexIfIndexedBeforeLine.xml
...s_accounting/OpenSaleOrder_reindexIfIndexedBeforeLine.xml
+0
-22
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/OpenSaleOrder_updatePeriod.py
...tal_skins/slapos_accounting/OpenSaleOrder_updatePeriod.py
+8
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/OpenSaleOrder_updatePeriod.xml
...al_skins/slapos_accounting/OpenSaleOrder_updatePeriod.xml
+0
-12
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/OrderBuilder_generateSlapOSAggregatedMovementList.py
...ting/OrderBuilder_generateSlapOSAggregatedMovementList.py
+55
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/OrderBuilder_generateSlapOSAggregatedMovementList.xml
...ing/OrderBuilder_generateSlapOSAggregatedMovementList.xml
+0
-59
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/OrderBuilder_selectSlapOSAggregatedDeliveryList.py
...unting/OrderBuilder_selectSlapOSAggregatedDeliveryList.py
+27
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/OrderBuilder_selectSlapOSAggregatedDeliveryList.xml
...nting/OrderBuilder_selectSlapOSAggregatedDeliveryList.xml
+0
-31
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/PaymentTransaction_postOrderBuild.py
...ns/slapos_accounting/PaymentTransaction_postOrderBuild.py
+5
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/PaymentTransaction_postOrderBuild.xml
...s/slapos_accounting/PaymentTransaction_postOrderBuild.xml
+0
-9
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Person_getAggregatedDelivery.py
...l_skins/slapos_accounting/Person_getAggregatedDelivery.py
+9
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Person_getAggregatedDelivery.xml
..._skins/slapos_accounting/Person_getAggregatedDelivery.xml
+0
-13
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Person_setAggregatedDelivery.py
...l_skins/slapos_accounting/Person_setAggregatedDelivery.py
+6
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Person_setAggregatedDelivery.xml
..._skins/slapos_accounting/Person_setAggregatedDelivery.xml
+0
-10
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Person_storeOpenSaleOrderJournal.py
...ins/slapos_accounting/Person_storeOpenSaleOrderJournal.py
+180
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Person_storeOpenSaleOrderJournal.xml
...ns/slapos_accounting/Person_storeOpenSaleOrderJournal.xml
+0
-188
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/SaleInvoiceTransaction_init.py
...al_skins/slapos_accounting/SaleInvoiceTransaction_init.py
+9
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/SaleInvoiceTransaction_init.xml
...l_skins/slapos_accounting/SaleInvoiceTransaction_init.xml
+0
-13
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/SaleInvoiceTransaction_isTotalPriceEqualAccounting.py
...ing/SaleInvoiceTransaction_isTotalPriceEqualAccounting.py
+6
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/SaleInvoiceTransaction_isTotalPriceEqualAccounting.xml
...ng/SaleInvoiceTransaction_isTotalPriceEqualAccounting.xml
+0
-10
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/SaleInvoiceTransaction_isTotalPriceMatchingSalePackingList.py
...InvoiceTransaction_isTotalPriceMatchingSalePackingList.py
+17
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/SaleInvoiceTransaction_isTotalPriceMatchingSalePackingList.xml
...nvoiceTransaction_isTotalPriceMatchingSalePackingList.xml
+0
-25
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/SaleInvoiceTransaction_isTradeModelCorrect.py
..._accounting/SaleInvoiceTransaction_isTradeModelCorrect.py
+17
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/SaleInvoiceTransaction_isTradeModelCorrect.xml
...accounting/SaleInvoiceTransaction_isTradeModelCorrect.xml
+0
-21
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/SalePackingList_postSlapOSAggregatedDeliveryBuilder.py
...ng/SalePackingList_postSlapOSAggregatedDeliveryBuilder.py
+15
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/SalePackingList_postSlapOSAggregatedDeliveryBuilder.xml
...g/SalePackingList_postSlapOSAggregatedDeliveryBuilder.xml
+0
-19
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Service_getPriceCalculationOperandDict.py
...apos_accounting/Service_getPriceCalculationOperandDict.py
+1
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Service_getPriceCalculationOperandDict.xml
...pos_accounting/Service_getPriceCalculationOperandDict.xml
+0
-5
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/Alarm_generateInvoiceResourceConsuptionDocument.py
...mption/Alarm_generateInvoiceResourceConsuptionDocument.py
+16
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/Alarm_generateInvoiceResourceConsuptionDocument.xml
...ption/Alarm_generateInvoiceResourceConsuptionDocument.xml
+0
-20
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/Base_getResourceServiceTitleUitList.py
...slapos_consumption/Base_getResourceServiceTitleUitList.py
+7
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/Base_getResourceServiceTitleUitList.xml
...lapos_consumption/Base_getResourceServiceTitleUitList.xml
+0
-11
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/Base_getUserConsumptionDetailList.py
...s/slapos_consumption/Base_getUserConsumptionDetailList.py
+97
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/Base_getUserConsumptionDetailList.xml
.../slapos_consumption/Base_getUserConsumptionDetailList.xml
+0
-101
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/Base_jumpToViewLatestDayConsumption.py
...slapos_consumption/Base_jumpToViewLatestDayConsumption.py
+20
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/Base_jumpToViewLatestDayConsumption.xml
...lapos_consumption/Base_jumpToViewLatestDayConsumption.xml
+0
-28
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/ComputerConsumptionTioXMLFile_solveInvoicingGeneration.py
...ComputerConsumptionTioXMLFile_solveInvoicingGeneration.py
+114
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/ComputerConsumptionTioXMLFile_solveInvoicingGeneration.xml
...omputerConsumptionTioXMLFile_solveInvoicingGeneration.xml
+0
-118
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/Computer_reportComputerConsumption.py
.../slapos_consumption/Computer_reportComputerConsumption.py
+24
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/Computer_reportComputerConsumption.xml
...slapos_consumption/Computer_reportComputerConsumption.xml
+0
-28
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/HostingSubscription_getCPUStat.py
...kins/slapos_consumption/HostingSubscription_getCPUStat.py
+3
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/HostingSubscription_getCPUStat.xml
...ins/slapos_consumption/HostingSubscription_getCPUStat.xml
+0
-7
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/HostingSubscription_getDiskStat.py
...ins/slapos_consumption/HostingSubscription_getDiskStat.py
+3
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/HostingSubscription_getDiskStat.xml
...ns/slapos_consumption/HostingSubscription_getDiskStat.xml
+0
-7
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/HostingSubscription_getMemoryStat.py
...s/slapos_consumption/HostingSubscription_getMemoryStat.py
+3
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/HostingSubscription_getMemoryStat.xml
.../slapos_consumption/HostingSubscription_getMemoryStat.xml
+0
-7
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/HostingSubscription_getResourceConsumptionDetailList.py
...n/HostingSubscription_getResourceConsumptionDetailList.py
+154
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/HostingSubscription_getResourceConsumptionDetailList.xml
.../HostingSubscription_getResourceConsumptionDetailList.xml
+0
-158
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/HostingSubscription_getStatForResource.py
...pos_consumption/HostingSubscription_getStatForResource.py
+52
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/HostingSubscription_getStatForResource.xml
...os_consumption/HostingSubscription_getStatForResource.xml
+0
-56
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/SaleInvoiceTransaction_generateResourceConsumptionDocument.py
...InvoiceTransaction_generateResourceConsumptionDocument.py
+24
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/SaleInvoiceTransaction_generateResourceConsumptionDocument.xml
...nvoiceTransaction_generateResourceConsumptionDocument.xml
+0
-28
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/SaleInvoiceTransaction_getPrintoutResourceContent.xml
...ion/SaleInvoiceTransaction_getPrintoutResourceContent.xml
+0
-40
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/SaleInvoiceTransaction_getPrintoutResourceContent.zpt
...ion/SaleInvoiceTransaction_getPrintoutResourceContent.zpt
+33
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_contract/Alarm_requestValidationPayment.py
...l_skins/slapos_contract/Alarm_requestValidationPayment.py
+15
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_contract/Alarm_requestValidationPayment.xml
..._skins/slapos_contract/Alarm_requestValidationPayment.xml
+0
-19
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_contract/Person_isAllowedToAllocate.py
...ortal_skins/slapos_contract/Person_isAllowedToAllocate.py
+14
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_contract/Person_isAllowedToAllocate.xml
...rtal_skins/slapos_contract/Person_isAllowedToAllocate.xml
+0
-18
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_contract/SoftwareInstance_requestValidationPayment.py
...pos_contract/SoftwareInstance_requestValidationPayment.py
+118
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_contract/SoftwareInstance_requestValidationPayment.xml
...os_contract/SoftwareInstance_requestValidationPayment.xml
+0
-126
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/Alarm_buildSlapOSPath.py
...m/portal_skins/slapos_simulation/Alarm_buildSlapOSPath.py
+20
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/Alarm_buildSlapOSPath.xml
.../portal_skins/slapos_simulation/Alarm_buildSlapOSPath.xml
+0
-24
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/Alarm_manageBuildingCalculatingDelivery.py
...pos_simulation/Alarm_manageBuildingCalculatingDelivery.py
+11
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/Alarm_manageBuildingCalculatingDelivery.xml
...os_simulation/Alarm_manageBuildingCalculatingDelivery.xml
+0
-15
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/Alarm_removeBogusDeliveryLink.py
..._skins/slapos_simulation/Alarm_removeBogusDeliveryLink.py
+19
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/Alarm_removeBogusDeliveryLink.xml
...skins/slapos_simulation/Alarm_removeBogusDeliveryLink.xml
+0
-23
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/DeliveryBuilder_selectSlapOSConfirmedInvoiceList.py
...ation/DeliveryBuilder_selectSlapOSConfirmedInvoiceList.py
+9
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/DeliveryBuilder_selectSlapOSConfirmedInvoiceList.xml
...tion/DeliveryBuilder_selectSlapOSConfirmedInvoiceList.xml
+0
-13
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/Delivery_manageBuildingCalculatingDelivery.py
..._simulation/Delivery_manageBuildingCalculatingDelivery.py
+10
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/Delivery_manageBuildingCalculatingDelivery.xml
...simulation/Delivery_manageBuildingCalculatingDelivery.xml
+0
-14
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/HostingSubscription_getRuleReference.py
...slapos_simulation/HostingSubscription_getRuleReference.py
+1
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/HostingSubscription_getRuleReference.xml
...lapos_simulation/HostingSubscription_getRuleReference.xml
+0
-5
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/PackingList_getRuleReference.py
...l_skins/slapos_simulation/PackingList_getRuleReference.py
+5
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/PackingList_getRuleReference.xml
..._skins/slapos_simulation/PackingList_getRuleReference.xml
+0
-9
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/PaymentTransaction_getRuleReference.py
.../slapos_simulation/PaymentTransaction_getRuleReference.py
+1
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/PaymentTransaction_getRuleReference.xml
...slapos_simulation/PaymentTransaction_getRuleReference.xml
+0
-5
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/SimulationMovement_buildSlapOS.py
...skins/slapos_simulation/SimulationMovement_buildSlapOS.py
+12
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/SimulationMovement_buildSlapOS.xml
...kins/slapos_simulation/SimulationMovement_buildSlapOS.xml
+0
-16
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/SimulationMovement_removeBogusDeliveryLink.py
..._simulation/SimulationMovement_removeBogusDeliveryLink.py
+4
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/SimulationMovement_removeBogusDeliveryLink.xml
...simulation/SimulationMovement_removeBogusDeliveryLink.xml
+0
-8
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/SimulationMovement_testCommonRule.py
...ns/slapos_simulation/SimulationMovement_testCommonRule.py
+15
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/SimulationMovement_testCommonRule.xml
...s/slapos_simulation/SimulationMovement_testCommonRule.xml
+0
-23
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/SimulationMovement_testInvoiceSimulationRule.py
...imulation/SimulationMovement_testInvoiceSimulationRule.py
+12
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/SimulationMovement_testInvoiceSimulationRule.xml
...mulation/SimulationMovement_testInvoiceSimulationRule.xml
+0
-16
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/SimulationMovement_testInvoiceTransactionSimulationRule.py
...imulationMovement_testInvoiceTransactionSimulationRule.py
+22
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/SimulationMovement_testInvoiceTransactionSimulationRule.xml
...mulationMovement_testInvoiceTransactionSimulationRule.xml
+0
-26
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/SimulationMovement_testPaymentSimulationRule.py
...imulation/SimulationMovement_testPaymentSimulationRule.py
+24
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/SimulationMovement_testPaymentSimulationRule.xml
...mulation/SimulationMovement_testPaymentSimulationRule.xml
+0
-28
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/SimulationMovement_testTradeModelSimulationRule.py
...lation/SimulationMovement_testTradeModelSimulationRule.py
+15
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/SimulationMovement_testTradeModelSimulationRule.xml
...ation/SimulationMovement_testTradeModelSimulationRule.xml
+0
-19
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/SlapOSDeliveryBuilder_selectMovement.py
...slapos_simulation/SlapOSDeliveryBuilder_selectMovement.py
+9
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/SlapOSDeliveryBuilder_selectMovement.xml
...lapos_simulation/SlapOSDeliveryBuilder_selectMovement.xml
+0
-13
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/SlapOSInvoiceTransaction_selectDelivery.py
...pos_simulation/SlapOSInvoiceTransaction_selectDelivery.py
+35
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/SlapOSInvoiceTransaction_selectDelivery.xml
...os_simulation/SlapOSInvoiceTransaction_selectDelivery.xml
+0
-39
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/SlapOSPaymentTransaction_postGeneration.py
...pos_simulation/SlapOSPaymentTransaction_postGeneration.py
+10
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/SlapOSPaymentTransaction_postGeneration.xml
...os_simulation/SlapOSPaymentTransaction_postGeneration.xml
+0
-14
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/SlapOSSaleInvoiceTransaction_postGeneration.py
...simulation/SlapOSSaleInvoiceTransaction_postGeneration.py
+20
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/SlapOSSaleInvoiceTransaction_postGeneration.xml
...imulation/SlapOSSaleInvoiceTransaction_postGeneration.xml
+0
-24
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/SlapOSSalePackingList_postGeneration.py
...slapos_simulation/SlapOSSalePackingList_postGeneration.py
+22
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/SlapOSSalePackingList_postGeneration.xml
...lapos_simulation/SlapOSSalePackingList_postGeneration.xml
+0
-26
master/bt5/slapos_accounting/WorkflowTemplateItem/portal_workflow/slapos_accounting_interaction_workflow/scripts/Base_diverge.py
...s_accounting_interaction_workflow/scripts/Base_diverge.py
+3
-0
master/bt5/slapos_accounting/WorkflowTemplateItem/portal_workflow/slapos_accounting_interaction_workflow/scripts/Base_diverge.xml
..._accounting_interaction_workflow/scripts/Base_diverge.xml
+0
-7
master/bt5/slapos_accounting/WorkflowTemplateItem/portal_workflow/slapos_accounting_interaction_workflow/scripts/Base_fixConsistency.py
...nting_interaction_workflow/scripts/Base_fixConsistency.py
+1
-0
master/bt5/slapos_accounting/WorkflowTemplateItem/portal_workflow/slapos_accounting_interaction_workflow/scripts/Base_fixConsistency.xml
...ting_interaction_workflow/scripts/Base_fixConsistency.xml
+0
-5
master/bt5/slapos_accounting/WorkflowTemplateItem/portal_workflow/slapos_accounting_interaction_workflow/scripts/Delivery_calculate.py
...unting_interaction_workflow/scripts/Delivery_calculate.py
+1
-0
master/bt5/slapos_accounting/WorkflowTemplateItem/portal_workflow/slapos_accounting_interaction_workflow/scripts/Delivery_calculate.xml
...nting_interaction_workflow/scripts/Delivery_calculate.xml
+0
-5
master/bt5/slapos_accounting/WorkflowTemplateItem/portal_workflow/slapos_accounting_interaction_workflow/scripts/HostingSubscription_fixPeriodicity.py
...on_workflow/scripts/HostingSubscription_fixPeriodicity.py
+18
-0
master/bt5/slapos_accounting/WorkflowTemplateItem/portal_workflow/slapos_accounting_interaction_workflow/scripts/HostingSubscription_fixPeriodicity.xml
...n_workflow/scripts/HostingSubscription_fixPeriodicity.xml
+0
-26
No files found.
master/bt5/slapos_accounting/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_related_causality_payment_transaction.sql
0 → 100644
View file @
43b65274
<
dtml
-
var
table_0
>
.
base_category_uid
=
<
dtml
-
var
"portal_categories.causality.getUid()"
>
AND
<
dtml
-
var
table_1
>
.
uid
=
<
dtml
-
var
table_0
>
.
uid
AND
<
dtml
-
var
table_1
>
.
portal_type
=
'Payment Transaction'
AND
<
dtml
-
var
table_1
>
.
simulation_state
not
in
(
'deleted'
,
'cancelled'
)
<
dtml
-
var
RELATED_QUERY_SEPARATOR
>
<
dtml
-
var
table_0
>
.
category_uid
=
<
dtml
-
var
query_table
>
.
uid
master/bt5/slapos_accounting/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_related_causality_payment_transaction.xml
View file @
43b65274
...
...
@@ -53,22 +53,6 @@ query_table="catalog"</string> </value>
<key>
<string>
max_rows_
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
src
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
<dtml-var table_0>
.base_category_uid =
<dtml-var
"portal_categories.causality.getUid()"
>
\n
AND
<dtml-var
table_1
>
.uid =
<dtml-var
table_0
>
.uid\n
AND
<dtml-var
table_1
>
.portal_type = \'Payment Transaction\'\n
AND
<dtml-var
table_1
>
.simulation_state not in (\'deleted\', \'cancelled\')\n
\n
<dtml-var
RELATED_QUERY_SEPARATOR
>
\n
<dtml-var
table_0
>
.category_uid =
<dtml-var
query_table
>
.uid\n
\n
]]>
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
...
...
master/bt5/slapos_accounting/PathTemplateItem/account_module/bank.xml
View file @
43b65274
...
...
@@ -54,6 +54,12 @@
</tuple>
</value>
</item>
<item>
<key>
<string>
__translation_dict
</string>
</key>
<value>
<dictionary/>
</value>
</item>
<item>
<key>
<string>
categories
</string>
</key>
<value>
...
...
master/bt5/slapos_accounting/PathTemplateItem/account_module/capital.xml
View file @
43b65274
...
...
@@ -54,6 +54,12 @@
</tuple>
</value>
</item>
<item>
<key>
<string>
__translation_dict
</string>
</key>
<value>
<dictionary/>
</value>
</item>
<item>
<key>
<string>
categories
</string>
</key>
<value>
...
...
master/bt5/slapos_accounting/PathTemplateItem/account_module/coll_vat.xml
View file @
43b65274
...
...
@@ -54,6 +54,12 @@
</tuple>
</value>
</item>
<item>
<key>
<string>
__translation_dict
</string>
</key>
<value>
<dictionary/>
</value>
</item>
<item>
<key>
<string>
categories
</string>
</key>
<value>
...
...
master/bt5/slapos_accounting/PathTemplateItem/account_module/equipments.xml
View file @
43b65274
...
...
@@ -54,6 +54,12 @@
</tuple>
</value>
</item>
<item>
<key>
<string>
__translation_dict
</string>
</key>
<value>
<dictionary/>
</value>
</item>
<item>
<key>
<string>
categories
</string>
</key>
<value>
...
...
master/bt5/slapos_accounting/PathTemplateItem/account_module/inventories.xml
View file @
43b65274
...
...
@@ -54,6 +54,12 @@
</tuple>
</value>
</item>
<item>
<key>
<string>
__translation_dict
</string>
</key>
<value>
<dictionary/>
</value>
</item>
<item>
<key>
<string>
categories
</string>
</key>
<value>
...
...
master/bt5/slapos_accounting/PathTemplateItem/account_module/payable.xml
View file @
43b65274
...
...
@@ -54,6 +54,12 @@
</tuple>
</value>
</item>
<item>
<key>
<string>
__translation_dict
</string>
</key>
<value>
<dictionary/>
</value>
</item>
<item>
<key>
<string>
categories
</string>
</key>
<value>
...
...
master/bt5/slapos_accounting/PathTemplateItem/account_module/profit_loss.xml
View file @
43b65274
...
...
@@ -54,6 +54,12 @@
</tuple>
</value>
</item>
<item>
<key>
<string>
__translation_dict
</string>
</key>
<value>
<dictionary/>
</value>
</item>
<item>
<key>
<string>
categories
</string>
</key>
<value>
...
...
master/bt5/slapos_accounting/PathTemplateItem/account_module/purchase.xml
View file @
43b65274
...
...
@@ -54,6 +54,12 @@
</tuple>
</value>
</item>
<item>
<key>
<string>
__translation_dict
</string>
</key>
<value>
<dictionary/>
</value>
</item>
<item>
<key>
<string>
categories
</string>
</key>
<value>
...
...
master/bt5/slapos_accounting/PathTemplateItem/account_module/receivable.xml
View file @
43b65274
...
...
@@ -54,6 +54,12 @@
</tuple>
</value>
</item>
<item>
<key>
<string>
__translation_dict
</string>
</key>
<value>
<dictionary/>
</value>
</item>
<item>
<key>
<string>
categories
</string>
</key>
<value>
...
...
master/bt5/slapos_accounting/PathTemplateItem/account_module/refundable_vat.xml
View file @
43b65274
...
...
@@ -54,6 +54,12 @@
</tuple>
</value>
</item>
<item>
<key>
<string>
__translation_dict
</string>
</key>
<value>
<dictionary/>
</value>
</item>
<item>
<key>
<string>
categories
</string>
</key>
<value>
...
...
master/bt5/slapos_accounting/PathTemplateItem/account_module/sales.xml
View file @
43b65274
...
...
@@ -54,6 +54,12 @@
</tuple>
</value>
</item>
<item>
<key>
<string>
__translation_dict
</string>
</key>
<value>
<dictionary/>
</value>
</item>
<item>
<key>
<string>
categories
</string>
</key>
<value>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Alarm_deliverStartedAggregatedSalePackingList.py
0 → 100644
View file @
43b65274
portal
=
context
.
getPortalObject
()
portal
.
portal_catalog
.
searchAndActivate
(
portal_type
=
'Sale Packing List'
,
simulation_state
=
'started'
,
causality_state
=
'solved'
,
specialise_uid
=
portal
.
restrictedTraverse
(
portal
.
portal_preferences
.
getPreferredAggregatedSaleTradeCondition
()).
getUid
(),
method_id
=
'Delivery_deliverStartedAggregatedSalePackingList'
,
activate_kw
=
{
'tag'
:
tag
},
)
context
.
activate
(
after_tag
=
tag
).
getId
()
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Alarm_deliverStartedAggregatedSalePackingList.xml
View file @
43b65274
...
...
@@ -48,20 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
portal = context.getPortalObject()\n
portal.portal_catalog.searchAndActivate(\n
portal_type=\'Sale Packing List\',\n
simulation_state=\'started\',\n
causality_state=\'solved\',\n
specialise_uid=portal.restrictedTraverse(portal.portal_preferences.getPreferredAggregatedSaleTradeCondition()).getUid(),\n
method_id=\'Delivery_deliverStartedAggregatedSalePackingList\',\n
activate_kw={\'tag\': tag},\n
)\n
context.activate(after_tag=tag).getId()\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
tag, fixit, params
</string>
</value>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Alarm_reindexOpenSaleOrderWithModifiedLine.py
0 → 100644
View file @
43b65274
portal
=
context
.
getPortalObject
()
portal
.
portal_catalog
.
searchAndActivate
(
# XXX Filter directly the right open sale order
method_id
=
'OpenSaleOrder_reindexIfIndexedBeforeLine'
,
portal_type
=
"Open Sale Order"
,
children_portal_type
=
"Open Sale Order Line"
,
activate_kw
=
{
'tag'
:
tag
},
)
context
.
activate
(
after_tag
=
tag
).
getId
()
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Alarm_reindexOpenSaleOrderWithModifiedLine.xml
View file @
43b65274
...
...
@@ -48,21 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
portal = context.getPortalObject()\n
\n
portal.portal_catalog.searchAndActivate(\n
# XXX Filter directly the right open sale order\n
method_id=\'OpenSaleOrder_reindexIfIndexedBeforeLine\',\n
portal_type="Open Sale Order",\n
children_portal_type="Open Sale Order Line",\n
activate_kw={\'tag\': tag},\n
)\n
\n
context.activate(after_tag=tag).getId()\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
tag, fixit, params
</string>
</value>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Alarm_requestUpdateHostingSubscriptionOpenSaleOrder.py
0 → 100644
View file @
43b65274
portal
=
context
.
getPortalObject
()
portal
.
portal_catalog
.
searchAndActivate
(
method_id
=
'HostingSubscription_requestUpdateOpenSaleOrder'
,
portal_type
=
"Hosting Subscription"
,
causality_state
=
"diverged"
,
activate_kw
=
{
'tag'
:
tag
,
'priority'
:
2
},
activity_count
=
10
,
packet_size
=
1
,
# HostingSubscription_trigger_Person_storeOpenSaleOrderJournal
)
context
.
activate
(
after_tag
=
tag
).
getId
()
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Alarm_requestUpdateHostingSubscriptionOpenSaleOrder.xml
View file @
43b65274
...
...
@@ -48,22 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
portal = context.getPortalObject()\n
\n
portal.portal_catalog.searchAndActivate(\n
method_id=\'HostingSubscription_requestUpdateOpenSaleOrder\',\n
portal_type="Hosting Subscription",\n
causality_state="diverged",\n
activate_kw={\'tag\': tag, \'priority\': 2},\n
activity_count=10,\n
packet_size=1, # HostingSubscription_trigger_Person_storeOpenSaleOrderJournal\n
)\n
\n
context.activate(after_tag=tag).getId()\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
tag, fixit, params
</string>
</value>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Alarm_requestUpdateOpenSaleOrderPeriod.py
0 → 100644
View file @
43b65274
portal
=
context
.
getPortalObject
()
portal
.
portal_catalog
.
searchAndActivate
(
portal_type
=
'Open Sale Order'
,
validation_state
=
'validated'
,
children_portal_type
=
'Open Sale Order Line'
,
method_id
=
'OpenSaleOrder_updatePeriod'
,
activate_kw
=
{
'tag'
:
tag
},
packet_size
=
1
,
activity_count
=
100
)
context
.
activate
(
after_tag
=
tag
).
getId
()
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Alarm_requestUpdateOpenSaleOrderPeriod.xml
View file @
43b65274
...
...
@@ -48,21 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
portal = context.getPortalObject()\n
portal.portal_catalog.searchAndActivate(\n
portal_type=\'Open Sale Order\',\n
validation_state=\'validated\',\n
children_portal_type=\'Open Sale Order Line\',\n
method_id=\'OpenSaleOrder_updatePeriod\',\n
activate_kw={\'tag\': tag},\n
packet_size=1,\n
activity_count=100\n
)\n
context.activate(after_tag=tag).getId()\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
tag, fixit, params
</string>
</value>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Alarm_searchDivergedInstanceList.py
0 → 100644
View file @
43b65274
portal
=
context
.
getPortalObject
()
portal
.
portal_catalog
.
searchAndActivate
(
portal_type
=
[
"Slave Instance"
,
"Software Instance"
],
causality_state
=
"diverged"
,
method_id
=
'Instance_solveInvoicingGeneration'
,
activate_kw
=
{
'tag'
:
tag
},
packet_size
=
1
,
# Separate calls to many transactions (calculation can take time)
activity_count
=
1
,
)
context
.
activate
(
after_tag
=
tag
).
getId
()
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Alarm_searchDivergedInstanceList.xml
View file @
43b65274
...
...
@@ -48,22 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
portal = context.getPortalObject()\n
\n
portal.portal_catalog.searchAndActivate(\n
portal_type=["Slave Instance", "Software Instance"],\n
causality_state="diverged",\n
method_id=\'Instance_solveInvoicingGeneration\',\n
activate_kw={\'tag\': tag},\n
packet_size=1, # Separate calls to many transactions (calculation can take time)\n
activity_count=1,\n
)\n
\n
context.activate(after_tag=tag).getId()\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
tag, fixit, params
</string>
</value>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Alarm_searchSubmittedConsumptionTioXMLFileList.py
0 → 100644
View file @
43b65274
portal
=
context
.
getPortalObject
()
portal
.
portal_catalog
.
searchAndActivate
(
portal_type
=
"Computer Consumption TioXML File"
,
validation_state
=
"submitted"
,
method_id
=
'ComputerConsumptionTioXMLFile_solveInvoicingGeneration'
,
activity_count
=
1
,
packet_size
=
1
,
activate_kw
=
{
'tag'
:
tag
,
'priority'
:
5
}
)
context
.
activate
(
after_tag
=
tag
).
getId
()
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Alarm_searchSubmittedConsumptionTioXMLFileList.xml
View file @
43b65274
...
...
@@ -48,22 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
portal = context.getPortalObject()\n
\n
portal.portal_catalog.searchAndActivate(\n
portal_type="Computer Consumption TioXML File",\n
validation_state="submitted",\n
method_id=\'ComputerConsumptionTioXMLFile_solveInvoicingGeneration\',\n
activity_count=1,\n
packet_size=1,\n
activate_kw={\'tag\': tag, \'priority\': 5}\n
)\n
\n
context.activate(after_tag=tag).getId()\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
tag, fixit, params
</string>
</value>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Alarm_startConfirmedAggregatedSalePackingList.py
0 → 100644
View file @
43b65274
if
params
is
None
:
params
=
{}
from
DateTime
import
DateTime
from
Products.ERP5Type.DateUtils
import
addToDate
from
Products.ZSQLCatalog.SQLCatalog
import
Query
def
getAccountingDate
(
accounting_date
):
accounting_day
=
25
if
accounting_date
.
day
()
<=
accounting_day
:
accounting_date
=
addToDate
(
accounting_date
,
dict
(
month
=-
1
))
diff
=
accounting_day
-
accounting_date
.
day
()
accounting_date
=
addToDate
(
accounting_date
,
dict
(
day
=
diff
))
return
accounting_date
accounting_date
=
params
.
get
(
'accounting_date'
,
DateTime
().
earliestTime
())
portal
=
context
.
getPortalObject
()
portal
.
portal_catalog
.
searchAndActivate
(
portal_type
=
'Sale Packing List'
,
simulation_state
=
'confirmed'
,
causality_state
=
'solved'
,
specialise_uid
=
portal
.
restrictedTraverse
(
portal
.
portal_preferences
.
getPreferredAggregatedSaleTradeCondition
()).
getUid
(),
method_id
=
'Delivery_startConfirmedAggregatedSalePackingList'
,
activate_kw
=
{
'tag'
:
tag
},
**
{
'delivery.start_date'
:
Query
(
range
=
"max"
,
**
{
'delivery.start_date'
:
getAccountingDate
(
accounting_date
)})}
)
context
.
activate
(
after_tag
=
tag
).
getId
()
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Alarm_startConfirmedAggregatedSalePackingList.xml
View file @
43b65274
...
...
@@ -48,43 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
if params is None:\n
params = {}\n
\n
from DateTime import DateTime\n
from Products.ERP5Type.DateUtils import addToDate\n
from Products.ZSQLCatalog.SQLCatalog import Query\n
\n
def getAccountingDate(accounting_date):\n
accounting_day = 25\n
if accounting_date.day() <= accounting_day:\n
accounting_date = addToDate(accounting_date, dict(month=-1))\n
diff = accounting_day - accounting_date.day()\n
accounting_date = addToDate(accounting_date, dict(day=diff))\n
return accounting_date\n
\n
accounting_date = params.get(\'accounting_date\', DateTime().earliestTime())\n
\n
portal = context.getPortalObject()\n
portal.portal_catalog.searchAndActivate(\n
portal_type=\'Sale Packing List\',\n
simulation_state=\'confirmed\',\n
causality_state=\'solved\',\n
specialise_uid=portal.restrictedTraverse(portal.portal_preferences.getPreferredAggregatedSaleTradeCondition()).getUid(),\n
method_id=\'Delivery_startConfirmedAggregatedSalePackingList\',\n
activate_kw={\'tag\': tag},\n
**{\'delivery.start_date\': Query(range="max",\n
**{\'delivery.start_date\': getAccountingDate(accounting_date)})}\n
)\n
context.activate(after_tag=tag).getId()\n
]]>
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
tag, fixit, params
</string>
</value>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Alarm_stopConfirmedAggregatedSaleInvoiceTransaction.py
0 → 100644
View file @
43b65274
from
DateTime
import
DateTime
from
Products.ERP5Type.DateUtils
import
getClosestDate
portal
=
context
.
getPortalObject
()
portal
.
portal_catalog
.
searchAndActivate
(
portal_type
=
'Sale Invoice Transaction'
,
simulation_state
=
'confirmed'
,
causality_state
=
'solved'
,
specialise_uid
=
portal
.
restrictedTraverse
(
portal
.
portal_preferences
.
getPreferredAggregatedSaleTradeCondition
()).
getUid
(),
method_id
=
'Delivery_stopConfirmedAggregatedSaleInvoiceTransaction'
,
activate_kw
=
{
'tag'
:
tag
}
)
context
.
activate
(
after_tag
=
tag
).
getId
()
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Alarm_stopConfirmedAggregatedSaleInvoiceTransaction.xml
View file @
43b65274
...
...
@@ -48,23 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
from DateTime import DateTime\n
from Products.ERP5Type.DateUtils import getClosestDate\n
\n
portal = context.getPortalObject()\n
portal.portal_catalog.searchAndActivate(\n
portal_type=\'Sale Invoice Transaction\',\n
simulation_state=\'confirmed\',\n
causality_state=\'solved\',\n
specialise_uid=portal.restrictedTraverse(portal.portal_preferences.getPreferredAggregatedSaleTradeCondition()).getUid(),\n
method_id=\'Delivery_stopConfirmedAggregatedSaleInvoiceTransaction\',\n
activate_kw={\'tag\': tag}\n
)\n
context.activate(after_tag=tag).getId()\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
tag, fixit, params
</string>
</value>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Alarm_triggerSlapOSAggregatedDeliveryOrderBuilder.py
0 → 100644
View file @
43b65274
context
.
getPortalObject
().
portal_orders
.
slapos_aggregated_delivery_builder
.
build
(
activate_kw
=
{
'tag'
:
tag
}
)
context
.
activate
(
after_tag
=
tag
).
getId
()
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Alarm_triggerSlapOSAggregatedDeliveryOrderBuilder.xml
View file @
43b65274
...
...
@@ -48,14 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
context.getPortalObject().portal_orders.slapos_aggregated_delivery_builder.build(\n
activate_kw={\'tag\': tag}\n
)\n
context.activate(after_tag=tag).getId()\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
tag, fixit, params
</string>
</value>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Delivery_deliverStartedAggregatedSalePackingList.py
0 → 100644
View file @
43b65274
from
DateTime
import
DateTime
portal
=
context
.
getPortalObject
()
if
context
.
getPortalType
()
!=
'Sale Packing List'
:
raise
TypeError
(
'Incorrect delivery.'
)
isTransitionPossible
=
portal
.
portal_workflow
.
isTransitionPossible
if
context
.
getSimulationState
()
==
'started'
\
and
len
(
context
.
checkConsistency
())
==
0
\
and
context
.
getCausalityState
()
==
'solved'
\
and
context
.
getSpecialise
()
==
portal
.
portal_preferences
.
getPreferredAggregatedSaleTradeCondition
():
comment
=
'Delivered by alarm as all actions in started state are ready.'
if
isTransitionPossible
(
context
,
'stop'
):
context
.
stop
(
comment
=
comment
)
if
isTransitionPossible
(
context
,
'deliver'
):
context
.
deliver
(
comment
=
comment
)
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Delivery_deliverStartedAggregatedSalePackingList.xml
View file @
43b65274
...
...
@@ -48,24 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
from DateTime import DateTime\n
portal = context.getPortalObject()\n
if context.getPortalType() != \'Sale Packing List\':\n
raise TypeError(\'Incorrect delivery.\')\n
isTransitionPossible = portal.portal_workflow.isTransitionPossible\n
if context.getSimulationState() == \'started\' \\\n
and len(context.checkConsistency()) == 0 \\\n
and context.getCausalityState() == \'solved\' \\\n
and context.getSpecialise() == portal.portal_preferences.getPreferredAggregatedSaleTradeCondition():\n
comment = \'Delivered by alarm as all actions in started state are ready.\'\n
if isTransitionPossible(context, \'stop\'):\n
context.stop(comment=comment)\n
if isTransitionPossible(context, \'deliver\'):\n
context.deliver(comment=comment)\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Delivery_startConfirmedAggregatedSalePackingList.py
0 → 100644
View file @
43b65274
from
DateTime
import
DateTime
portal
=
context
.
getPortalObject
()
if
context
.
getPortalType
()
!=
'Sale Packing List'
:
raise
TypeError
(
'Incorrect delivery.'
)
isTransitionPossible
=
portal
.
portal_workflow
.
isTransitionPossible
if
context
.
getSimulationState
()
==
'confirmed'
\
and
len
(
context
.
checkConsistency
())
==
0
\
and
context
.
getCausalityState
()
==
'solved'
\
and
context
.
getSpecialise
()
==
portal
.
portal_preferences
.
getPreferredAggregatedSaleTradeCondition
():
comment
=
'Start by alarm as all actions in confirmed state are ready.'
date
=
DateTime
().
earliestTime
()
context
.
edit
(
start_date
=
date
,
stop_date
=
date
)
if
isTransitionPossible
(
context
,
'start'
):
context
.
start
(
comment
=
comment
)
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Delivery_startConfirmedAggregatedSalePackingList.xml
View file @
43b65274
...
...
@@ -48,24 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
from DateTime import DateTime\n
portal = context.getPortalObject()\n
if context.getPortalType() != \'Sale Packing List\':\n
raise TypeError(\'Incorrect delivery.\')\n
isTransitionPossible = portal.portal_workflow.isTransitionPossible\n
if context.getSimulationState() == \'confirmed\' \\\n
and len(context.checkConsistency()) == 0 \\\n
and context.getCausalityState() == \'solved\' \\\n
and context.getSpecialise() == portal.portal_preferences.getPreferredAggregatedSaleTradeCondition():\n
comment = \'Start by alarm as all actions in confirmed state are ready.\'\n
date = DateTime().earliestTime()\n
context.edit(start_date=date, stop_date=date)\n
if isTransitionPossible(context, \'start\'):\n
context.start(comment=comment)\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Delivery_stopConfirmedAggregatedSaleInvoiceTransaction.py
0 → 100644
View file @
43b65274
portal
=
context
.
getPortalObject
()
if
context
.
getPortalType
()
!=
'Sale Invoice Transaction'
:
raise
TypeError
(
'Incorrect delivery.'
)
isTransitionPossible
=
portal
.
portal_workflow
.
isTransitionPossible
if
context
.
getSimulationState
()
==
'confirmed'
\
and
len
(
context
.
checkConsistency
())
==
0
\
and
context
.
getCausalityState
()
==
'solved'
\
and
context
.
getSpecialise
()
==
portal
.
portal_preferences
.
getPreferredAggregatedSaleTradeCondition
():
comment
=
'Stopped by alarm as all actions in confirmed state are ready.'
if
isTransitionPossible
(
context
,
'start'
):
context
.
start
(
comment
=
comment
)
if
isTransitionPossible
(
context
,
'stop'
):
context
.
stop
(
comment
=
comment
)
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Delivery_stopConfirmedAggregatedSaleInvoiceTransaction.xml
View file @
43b65274
...
...
@@ -48,23 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
portal = context.getPortalObject()\n
if context.getPortalType() != \'Sale Invoice Transaction\':\n
raise TypeError(\'Incorrect delivery.\')\n
isTransitionPossible = portal.portal_workflow.isTransitionPossible\n
if context.getSimulationState() == \'confirmed\'\\\n
and len(context.checkConsistency()) == 0\\\n
and context.getCausalityState() == \'solved\'\\\n
and context.getSpecialise() == portal.portal_preferences.getPreferredAggregatedSaleTradeCondition():\n
comment = \'Stopped by alarm as all actions in confirmed state are ready.\'\n
if isTransitionPossible(context, \'start\'):\n
context.start(comment=comment)\n
if isTransitionPossible(context, \'stop\'):\n
context.stop(comment=comment)\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/HostingSubscription_calculateSubscriptionStartDate.py
0 → 100644
View file @
43b65274
from
zExceptions
import
Unauthorized
if
REQUEST
is
not
None
:
raise
Unauthorized
from
Products.ERP5Type.DateUtils
import
addToDate
,
getClosestDate
hosting_subscription
=
context
portal
=
context
.
getPortalObject
()
workflow_item_list
=
portal
.
portal_workflow
.
getInfoFor
(
ob
=
hosting_subscription
,
name
=
'history'
,
wf_id
=
'instance_slap_interface_workflow'
)
start_date
=
None
for
item
in
workflow_item_list
:
start_date
=
item
.
get
(
'time'
)
if
start_date
:
break
if
start_date
is
None
:
# Compatibility with old Hosting subscription
start_date
=
hosting_subscription
.
getCreationDate
()
start_date
=
getClosestDate
(
target_date
=
start_date
,
precision
=
'day'
)
return
start_date
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/HostingSubscription_calculateSubscriptionStartDate.xml
View file @
43b65274
...
...
@@ -48,36 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
from zExceptions import Unauthorized\n
if REQUEST is not None:\n
raise Unauthorized\n
\n
from Products.ERP5Type.DateUtils import addToDate, getClosestDate\n
\n
hosting_subscription = context\n
portal = context.getPortalObject()\n
\n
workflow_item_list = portal.portal_workflow.getInfoFor(\n
ob=hosting_subscription,\n
name=\'history\',\n
wf_id=\'instance_slap_interface_workflow\')\n
start_date = None\n
for item in workflow_item_list:\n
start_date = item.get(\'time\')\n
if start_date:\n
break\n
\n
if start_date is None:\n
# Compatibility with old Hosting subscription\n
start_date = hosting_subscription.getCreationDate()\n
\n
start_date = getClosestDate(target_date=start_date, precision=\'day\')\n
\n
return start_date\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
REQUEST=None
</string>
</value>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/HostingSubscription_calculateSubscriptionStopDate.py
0 → 100644
View file @
43b65274
from
zExceptions
import
Unauthorized
if
REQUEST
is
not
None
:
raise
Unauthorized
from
Products.ERP5Type.DateUtils
import
addToDate
,
getClosestDate
hosting_subscription
=
context
portal
=
context
.
getPortalObject
()
start_date
=
context
.
HostingSubscription_calculateSubscriptionStartDate
()
workflow_item_list
=
portal
.
portal_workflow
.
getInfoFor
(
ob
=
hosting_subscription
,
name
=
'history'
,
wf_id
=
'instance_slap_interface_workflow'
)
result_date
=
None
for
item
in
workflow_item_list
:
if
item
.
get
(
'slap_state'
)
==
'destroy_requested'
:
end_date
=
item
.
get
(
'time'
)
result_date
=
getClosestDate
(
target_date
=
end_date
,
precision
=
'day'
)
if
result_date
<=
end_date
:
result_date
=
addToDate
(
result_date
,
to_add
=
{
'day'
:
1
})
break
return
result_date
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/HostingSubscription_calculateSubscriptionStopDate.xml
View file @
43b65274
...
...
@@ -48,39 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
from zExceptions import Unauthorized\n
if REQUEST is not None:\n
raise Unauthorized\n
\n
from Products.ERP5Type.DateUtils import addToDate, getClosestDate\n
\n
hosting_subscription = context\n
portal = context.getPortalObject()\n
\n
start_date = context.HostingSubscription_calculateSubscriptionStartDate()\n
\n
workflow_item_list = portal.portal_workflow.getInfoFor(\n
ob=hosting_subscription,\n
name=\'history\',\n
wf_id=\'instance_slap_interface_workflow\')\n
result_date = None\n
for item in workflow_item_list:\n
if item.get(\'slap_state\') == \'destroy_requested\':\n
end_date = item.get(\'time\')\n
result_date = getClosestDate(target_date=end_date, precision=\'day\')\n
if result_date <= end_date:\n
result_date = addToDate(result_date, to_add={\'day\': 1})\n
break\n
\n
return result_date\n
]]>
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
REQUEST=None
</string>
</value>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/HostingSubscription_requestUpdateOpenSaleOrder.py
0 → 100644
View file @
43b65274
from
zExceptions
import
Unauthorized
if
REQUEST
is
not
None
:
raise
Unauthorized
if
context
.
getCausalityState
()
==
'diverged'
:
person
=
context
.
getDestinationSectionValue
(
portal_type
=
"Person"
)
# Template document does not have person relation
if
person
is
not
None
:
person
.
Person_storeOpenSaleOrderJournal
()
# Person_storeOpenSaleOrderJournal should fix all divergent Hosting Subscription in one run
assert
context
.
getCausalityState
()
==
'solved'
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/HostingSubscription_requestUpdateOpenSaleOrder.xml
View file @
43b65274
...
...
@@ -48,22 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
from zExceptions import Unauthorized\n
if REQUEST is not None:\n
raise Unauthorized\n
\n
if context.getCausalityState() == \'diverged\':\n
\n
person = context.getDestinationSectionValue(portal_type="Person")\n
# Template document does not have person relation\n
if person is not None:\n
person.Person_storeOpenSaleOrderJournal()\n
# Person_storeOpenSaleOrderJournal should fix all divergent Hosting Subscription in one run\n
assert context.getCausalityState() == \'solved\'\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
REQUEST=None
</string>
</value>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Instance_solveInvoicingGeneration.py
0 → 100644
View file @
43b65274
instance
=
context
portal
=
instance
.
getPortalObject
()
portal_workflow
=
portal
.
portal_workflow
if
portal_workflow
.
isTransitionPossible
(
instance
,
'converge'
):
instance
.
converge
()
slap_state
=
instance
.
getSlapState
()
if
slap_state
==
'draft'
:
# Nothing to do except converging
pass
else
:
started
=
"start_requested"
stopped
=
"stop_requested"
destroyed
=
"destroy_requested"
assert
slap_state
in
[
started
,
stopped
,
destroyed
]
previous_length
=
instance
.
getInvoicingSynchronizationPointer
(
1
)
history_list
=
portal_workflow
.
getInfoFor
(
ob
=
instance
,
name
=
'history'
,
wf_id
=
'instance_slap_interface_workflow'
)
history_length
=
len
(
history_list
)
history_entry
=
history_list
[
previous_length
-
1
]
# no divergence if no new history entry
if
(
history_length
!=
1
):
assert
previous_length
!=
history_length
setup_quantity
=
0
update_quantity
=
0
destroy_quantity
=
0
current_delivery
=
instance
.
getCausalityValue
()
if
current_delivery
is
None
:
# No previous packing list, so, one setup should be created
# Drop all useless draft line
i_in_draft_state
=
True
i
=
0
while
i_in_draft_state
:
checking_history_entry
=
history_list
[
i
]
previous_state
=
checking_history_entry
[
'slap_state'
]
if
previous_state
!=
'draft'
:
i_in_draft_state
=
False
previous_length
=
i
else
:
setup_quantity
+=
1
i
+=
1
if
slap_state
==
destroyed
:
# Check if previous pointer was already in destroyed state
previous_state
=
history_entry
[
'slap_state'
]
if
previous_state
!=
destroyed
:
# Let's create destroyed packing list
destroy_quantity
=
1
# 1 = entry to set document in draft state
update_quantity
=
history_length
-
previous_length
-
setup_quantity
-
destroy_quantity
# Time to create the PL
delivery_template
=
portal
.
restrictedTraverse
(
portal
.
portal_preferences
.
getPreferredInstanceDeliveryTemplate
())
delivery
=
delivery_template
.
Base_createCloneDocument
(
batch_mode
=
1
)
hosting_subscription
=
instance
.
getSpecialiseValue
(
portal_type
=
"Hosting Subscription"
)
person
=
hosting_subscription
.
getDestinationSectionValue
(
portal_type
=
"Person"
)
delivery
.
edit
(
title
=
"%s API usage"
%
instance
.
getReference
(),
destination
=
person
.
getRelativeUrl
(),
destination_decision
=
person
.
getRelativeUrl
(),
start_date
=
history_entry
[
'time'
],
stop_date
=
portal_workflow
.
getInfoFor
(
ob
=
instance
,
name
=
'time'
,
wf_id
=
'instance_slap_interface_workflow'
),
)
line_edit_kw
=
{
'aggregate_value_list'
:
[
instance
,
hosting_subscription
],
}
if
setup_quantity
:
delivery_line_template
=
portal
.
restrictedTraverse
(
portal
.
portal_preferences
.
getPreferredInstanceSetupMovementTemplate
())
line
=
delivery_line_template
.
Base_createCloneDocument
(
batch_mode
=
1
,
destination
=
delivery
)
line
.
edit
(
quantity
=
1
,
title
=
"%s setup %s"
%
(
instance
.
getReference
(),
setup_quantity
),
**
line_edit_kw
)
if
update_quantity
>
0
:
delivery_line_template
=
portal
.
restrictedTraverse
(
portal
.
portal_preferences
.
getPreferredInstanceUpdateMovementTemplate
())
line
=
delivery_line_template
.
Base_createCloneDocument
(
batch_mode
=
1
,
destination
=
delivery
)
line
.
edit
(
quantity
=
update_quantity
,
title
=
"%s updated %i times"
%
(
instance
.
getReference
(),
update_quantity
),
**
line_edit_kw
)
if
destroy_quantity
:
delivery_line_template
=
portal
.
restrictedTraverse
(
portal
.
portal_preferences
.
getPreferredInstanceDestroyMovementTemplate
())
line
=
delivery_line_template
.
Base_createCloneDocument
(
batch_mode
=
1
,
destination
=
delivery
)
line
.
edit
(
quantity
=
destroy_quantity
,
title
=
"%s destroyed"
%
instance
.
getReference
(),
**
line_edit_kw
)
delivery
.
confirm
()
delivery
.
start
()
delivery
.
stop
()
delivery
.
deliver
()
delivery
.
startBuilding
()
instance
.
edit
(
invoicing_synchronization_pointer
=
history_length
,
causality_value
=
delivery
,
)
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Instance_solveInvoicingGeneration.xml
View file @
43b65274
...
...
@@ -48,133 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
instance = context\n
portal = instance.getPortalObject()\n
portal_workflow = portal.portal_workflow\n
\n
if portal_workflow.isTransitionPossible(instance, \'converge\'):\n
instance.converge()\n
\n
slap_state = instance.getSlapState()\n
\n
if slap_state == \'draft\':\n
# Nothing to do except converging\n
pass\n
else:\n
started = "start_requested"\n
stopped = "stop_requested"\n
destroyed = "destroy_requested"\n
assert slap_state in [started, stopped, destroyed]\n
\n
previous_length = instance.getInvoicingSynchronizationPointer(1)\n
history_list = portal_workflow.getInfoFor(ob=instance, name=\'history\', wf_id=\'instance_slap_interface_workflow\')\n
history_length = len(history_list)\n
history_entry = history_list[previous_length-1]\n
\n
# no divergence if no new history entry\n
if (history_length != 1):\n
assert previous_length != history_length\n
\n
setup_quantity = 0\n
update_quantity = 0\n
destroy_quantity = 0\n
\n
current_delivery = instance.getCausalityValue()\n
if current_delivery is None:\n
# No previous packing list, so, one setup should be created\n
# Drop all useless draft line\n
i_in_draft_state = True\n
i = 0\n
while i_in_draft_state:\n
checking_history_entry = history_list[i]\n
previous_state = checking_history_entry[\'slap_state\']\n
if previous_state != \'draft\':\n
i_in_draft_state = False\n
previous_length = i\n
else:\n
setup_quantity += 1\n
i += 1\n
\n
if slap_state == destroyed:\n
# Check if previous pointer was already in destroyed state\n
previous_state = history_entry[\'slap_state\']\n
if previous_state != destroyed:\n
# Let\'s create destroyed packing list\n
destroy_quantity = 1\n
\n
# 1 = entry to set document in draft state\n
update_quantity = history_length - previous_length - setup_quantity - destroy_quantity\n
\n
# Time to create the PL\n
delivery_template = portal.restrictedTraverse(\n
portal.portal_preferences.getPreferredInstanceDeliveryTemplate())\n
delivery = delivery_template.Base_createCloneDocument(batch_mode=1)\n
\n
hosting_subscription = instance.getSpecialiseValue(portal_type="Hosting Subscription")\n
person = hosting_subscription.getDestinationSectionValue(portal_type="Person")\n
\n
delivery.edit(\n
title="%s API usage" % instance.getReference(),\n
destination=person.getRelativeUrl(),\n
destination_decision=person.getRelativeUrl(),\n
start_date=history_entry[\'time\'],\n
stop_date=portal_workflow.getInfoFor(ob=instance, name=\'time\', wf_id=\'instance_slap_interface_workflow\'),\n
)\n
line_edit_kw = {\n
\'aggregate_value_list\': [instance, hosting_subscription],\n
}\n
\n
if setup_quantity:\n
delivery_line_template = portal.restrictedTraverse(\n
portal.portal_preferences.getPreferredInstanceSetupMovementTemplate())\n
line = delivery_line_template.Base_createCloneDocument(batch_mode=1,\n
destination=delivery)\n
line.edit(\n
quantity=1,\n
title="%s setup %s" % (instance.getReference(), setup_quantity),\n
**line_edit_kw\n
)\n
\n
if update_quantity >
0:\n
delivery_line_template = portal.restrictedTraverse(\n
portal.portal_preferences.getPreferredInstanceUpdateMovementTemplate())\n
line = delivery_line_template.Base_createCloneDocument(batch_mode=1,\n
destination=delivery)\n
line.edit(\n
quantity=update_quantity,\n
title="%s updated %i times" % (instance.getReference(), update_quantity),\n
**line_edit_kw\n
)\n
\n
if destroy_quantity:\n
delivery_line_template = portal.restrictedTraverse(\n
portal.portal_preferences.getPreferredInstanceDestroyMovementTemplate())\n
line = delivery_line_template.Base_createCloneDocument(batch_mode=1,\n
destination=delivery)\n
line.edit(\n
quantity=destroy_quantity,\n
title="%s destroyed" % instance.getReference(),\n
**line_edit_kw\n
)\n
\n
delivery.confirm()\n
delivery.start()\n
delivery.stop()\n
delivery.deliver()\n
delivery.startBuilding()\n
\n
instance.edit(\n
invoicing_synchronization_pointer=history_length,\n
causality_value=delivery,\n
)\n
]]>
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/OpenSaleOrder_reindexIfIndexedBeforeLine.py
0 → 100644
View file @
43b65274
from
zExceptions
import
Unauthorized
if
REQUEST
is
not
None
:
raise
Unauthorized
order
=
context
portal
=
context
.
getPortalObject
()
indexation_timestamp
=
portal
.
portal_catalog
(
uid
=
order
.
getUid
(),
select_dict
=
{
'indexation_timestamp'
:
None
})[
0
].
indexation_timestamp
line_list
=
portal
.
portal_catalog
(
portal_type
=
"Open Sale Order Line"
,
parent_uid
=
order
.
getUid
(),
indexation_timestamp
=
{
'query'
:
indexation_timestamp
,
'range'
:
'nlt'
},
limit
=
1
)
if
len
(
line_list
):
order
.
activate
().
immediateReindexObject
()
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/OpenSaleOrder_reindexIfIndexedBeforeLine.xml
View file @
43b65274
...
...
@@ -48,28 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
from zExceptions import Unauthorized\n
if REQUEST is not None:\n
raise Unauthorized\n
\n
order = context\n
portal = context.getPortalObject()\n
indexation_timestamp = portal.portal_catalog(\n
uid=order.getUid(),\n
select_dict={\'indexation_timestamp\': None})[0].indexation_timestamp\n
\n
line_list = portal.portal_catalog(\n
portal_type="Open Sale Order Line", \n
parent_uid=order.getUid(),\n
indexation_timestamp={\'query\': indexation_timestamp, \'range\': \'nlt\'},\n
limit=1)\n
\n
if len(line_list):\n
order.activate().immediateReindexObject()\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
REQUEST=None
</string>
</value>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/OpenSaleOrder_updatePeriod.py
0 → 100644
View file @
43b65274
from
zExceptions
import
Unauthorized
if
REQUEST
is
not
None
:
raise
Unauthorized
if
context
.
getValidationState
()
==
'validated'
:
person
=
context
.
getDestinationDecisionValue
(
portal_type
=
"Person"
)
if
person
is
not
None
:
person
.
Person_storeOpenSaleOrderJournal
()
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/OpenSaleOrder_updatePeriod.xml
View file @
43b65274
...
...
@@ -48,18 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
from zExceptions import Unauthorized\n
if REQUEST is not None:\n
raise Unauthorized\n
\n
if context.getValidationState() == \'validated\':\n
person = context.getDestinationDecisionValue(portal_type="Person")\n
if person is not None:\n
person.Person_storeOpenSaleOrderJournal()\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
REQUEST=None
</string>
</value>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/OrderBuilder_generateSlapOSAggregatedMovementList.py
0 → 100644
View file @
43b65274
select_kw
=
kwargs
.
copy
()
select_kw
.
pop
(
'portal_type'
,
None
)
select_kw
.
pop
(
'delivery_relative_url_list'
,
None
)
from
Products.ERP5Type.Document
import
newTempSimulationMovement
from
Products.ZSQLCatalog.SQLCatalog
import
Query
,
NegatedQuery
,
ComplexQuery
portal
=
context
.
getPortalObject
()
business_process_uid_list
=
[
portal
.
business_process_module
.
slapos_consumption_business_process
.
getUid
(),
portal
.
business_process_module
.
slapos_subscription_business_process
.
getUid
()]
specialise_reference_list
=
[
q
.
getReference
()
for
q
in
portal
.
portal_catalog
(
specialise_uid
=
business_process_uid_list
,
portal_type
=
'Sale Trade Condition'
)]
select_dict
=
{
'default_aggregate_portal_type'
:
None
}
select_kw
.
update
(
limit
=
50
,
# just take a bit
portal_type
=
'Sale Packing List Line'
,
simulation_state
=
'delivered'
,
parent_specialise_reference
=
specialise_reference_list
,
parent_specialise_portal_type
=
'Sale Trade Condition'
,
select_dict
=
select_dict
,
left_join_list
=
select_dict
.
keys
(),
default_aggregate_portal_type
=
ComplexQuery
(
NegatedQuery
(
Query
(
default_aggregate_portal_type
=
'Computer'
)),
Query
(
default_aggregate_portal_type
=
None
),
operator
=
"OR"
),
grouping_reference
=
None
,
sort_on
=
((
'modification_date'
,
'ASC'
),)
# the highest chance to find movement which can be delivered
)
movement_list
=
portal
.
portal_catalog
(
**
select_kw
)
specialise
=
portal
.
portal_preferences
.
getPreferredAggregatedSaleTradeCondition
()
temp_movement_list
=
[]
id
=
1
for
movement
in
movement_list
:
if
movement
.
getGroupingReference
()
is
not
None
:
continue
temp_movement
=
newTempSimulationMovement
(
portal
,
movement
.
getRelativeUrl
(),
quantity
=
movement
.
getQuantity
(),
resource
=
movement
.
getResource
(),
source
=
movement
.
getDestination
(),
destination
=
movement
.
getDestination
(),
source_section
=
movement
.
getSourceSection
(),
destination_section
=
movement
.
getDestination
(),
destination_decision
=
movement
.
getDestination
(),
specialise
=
specialise
,
price_currency
=
movement
.
getPriceCurrency
()
)
if
movement
.
getResource
()
==
'service_module/slapos_instance_subscription'
:
temp_movement
.
edit
(
price
=
0.83612040133800003
)
else
:
temp_movement
.
edit
(
price
=
0.0
)
temp_movement_list
.
append
(
temp_movement
)
id
+=
1
return
temp_movement_list
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/OrderBuilder_generateSlapOSAggregatedMovementList.xml
View file @
43b65274
...
...
@@ -48,65 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
select_kw = kwargs.copy()\n
select_kw.pop(\'portal_type\', None)\n
select_kw.pop(\'delivery_relative_url_list\', None)\n
from Products.ERP5Type.Document import newTempSimulationMovement\n
from Products.ZSQLCatalog.SQLCatalog import Query, NegatedQuery, ComplexQuery\n
portal = context.getPortalObject()\n
\n
business_process_uid_list = [\n
portal.business_process_module.slapos_consumption_business_process.getUid(),\n
portal.business_process_module.slapos_subscription_business_process.getUid()]\n
specialise_reference_list = [q.getReference() for q in portal.portal_catalog(specialise_uid=business_process_uid_list,\n
portal_type=\'Sale Trade Condition\')]\n
select_dict= {\'default_aggregate_portal_type\': None}\n
\n
select_kw.update(\n
limit=50, # just take a bit\n
portal_type=\'Sale Packing List Line\',\n
simulation_state=\'delivered\',\n
parent_specialise_reference=specialise_reference_list,\n
parent_specialise_portal_type=\'Sale Trade Condition\',\n
select_dict=select_dict,\n
left_join_list=select_dict.keys(),\n
default_aggregate_portal_type=ComplexQuery(NegatedQuery(Query(default_aggregate_portal_type=\'Computer\')),\n
Query(default_aggregate_portal_type=None), operator="OR"),\n
grouping_reference=None,\n
sort_on=((\'modification_date\', \'ASC\'),) # the highest chance to find movement which can be delivered\n
)\n
movement_list = portal.portal_catalog(**select_kw)\n
\n
specialise = portal.portal_preferences.getPreferredAggregatedSaleTradeCondition()\n
temp_movement_list = []\n
id = 1\n
for movement in movement_list:\n
if movement.getGroupingReference() is not None:\n
continue\n
temp_movement = newTempSimulationMovement(\n
portal, movement.getRelativeUrl(),\n
quantity=movement.getQuantity(),\n
resource=movement.getResource(),\n
source=movement.getDestination(),\n
destination=movement.getDestination(),\n
source_section=movement.getSourceSection(),\n
destination_section=movement.getDestination(),\n
destination_decision=movement.getDestination(),\n
specialise=specialise,\n
price_currency=movement.getPriceCurrency()\n
)\n
if movement.getResource() == \'service_module/slapos_instance_subscription\':\n
temp_movement.edit(price=0.83612040133800003)\n
else:\n
temp_movement.edit(price=0.0)\n
temp_movement_list.append(temp_movement)\n
id += 1\n
\n
return temp_movement_list\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
*args, **kwargs
</string>
</value>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/OrderBuilder_selectSlapOSAggregatedDeliveryList.py
0 → 100644
View file @
43b65274
# beware: the configuration of OrderBuilder_generateSlapOSAggregatedMovementList shall
# provide small amounts of movements
person_delivery_mapping
=
{}
portal
=
context
.
getPortalObject
()
specialise
=
portal
.
portal_preferences
.
getPreferredAggregatedSaleTradeCondition
()
for
movement
in
movement_list
:
person
=
movement
.
getDestinationValue
()
try
:
delivery
=
person_delivery_mapping
[
person
]
except
KeyError
:
delivery
=
person
.
Person_getAggregatedDelivery
()
if
delivery
is
None
or
delivery
.
getSimulationState
()
!=
'confirmed'
:
delivery
=
portal
.
sale_packing_list_module
.
newContent
(
portal_type
=
'Sale Packing List'
,
source
=
movement
.
getDestination
(),
destination
=
movement
.
getDestination
(),
source_section
=
movement
.
getSourceSection
(),
destination_section
=
movement
.
getDestination
(),
destination_decision
=
movement
.
getDestination
(),
specialise
=
specialise
,
price_currency
=
movement
.
getPriceCurrency
()
)
delivery
.
confirm
(
'New aggregated delivery.'
)
person
.
Person_setAggregatedDelivery
(
delivery
)
person_delivery_mapping
[
person
]
=
delivery
return
person_delivery_mapping
.
values
()
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/OrderBuilder_selectSlapOSAggregatedDeliveryList.xml
View file @
43b65274
...
...
@@ -48,37 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
# beware: the configuration of OrderBuilder_generateSlapOSAggregatedMovementList shall\n
# provide small amounts of movements\n
person_delivery_mapping = {}\n
portal = context.getPortalObject()\n
\n
specialise = portal.portal_preferences.getPreferredAggregatedSaleTradeCondition()\n
for movement in movement_list:\n
person = movement.getDestinationValue()\n
try:\n
delivery = person_delivery_mapping[person]\n
except KeyError:\n
delivery = person.Person_getAggregatedDelivery()\n
if delivery is None or delivery.getSimulationState() != \'confirmed\':\n
delivery = portal.sale_packing_list_module.newContent(\n
portal_type=\'Sale Packing List\',\n
source=movement.getDestination(),\n
destination=movement.getDestination(),\n
source_section=movement.getSourceSection(),\n
destination_section=movement.getDestination(),\n
destination_decision=movement.getDestination(),\n
specialise=specialise,\n
price_currency=movement.getPriceCurrency()\n
)\n
delivery.confirm(\'New aggregated delivery.\')\n
person.Person_setAggregatedDelivery(delivery)\n
person_delivery_mapping[person] = delivery\n
return person_delivery_mapping.values()\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
movement_list, *args, **kwargs
</string>
</value>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/PaymentTransaction_postOrderBuild.py
0 → 100644
View file @
43b65274
from
Products.ERP5Type.Message
import
translateString
payment_transaction
=
context
payment_transaction
.
immediateReindexObject
()
# in order to avoid selection in OrderBuilder_getAccountingTransactionLineListSlapOS
comment
=
translateString
(
"Initialised by Order Builder."
)
payment_transaction
.
confirm
(
comment
=
comment
)
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/PaymentTransaction_postOrderBuild.xml
View file @
43b65274
...
...
@@ -48,15 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
from Products.ERP5Type.Message import translateString\n
payment_transaction = context\n
payment_transaction.immediateReindexObject() # in order to avoid selection in OrderBuilder_getAccountingTransactionLineListSlapOS\n
comment = translateString("Initialised by Order Builder.")\n
payment_transaction.confirm(comment=comment)\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
related_simulation_movement_path_list=None, **kw
</string>
</value>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Person_getAggregatedDelivery.py
0 → 100644
View file @
43b65274
integration_site
=
context
.
getPortalObject
().
restrictedTraverse
(
'portal_integrations/slapos_aggregated_delivery_integration_site'
)
person_id
=
context
.
getId
().
replace
(
'-'
,
'_'
)
try
:
mapping
=
integration_site
.
getCategoryFromMapping
(
'Causality/%s'
%
person_id
,
create_mapping_line
=
True
,
create_mapping
=
True
)
except
ValueError
:
return
None
return
context
.
restrictedTraverse
(
mapping
)
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Person_getAggregatedDelivery.xml
View file @
43b65274
...
...
@@ -48,19 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
integration_site = context.getPortalObject().restrictedTraverse(\n
\'portal_integrations/slapos_aggregated_delivery_integration_site\')\n
\n
person_id = context.getId().replace(\'-\', \'_\')\n
try:\n
mapping = integration_site.getCategoryFromMapping(\'Causality/%s\' % person_id, create_mapping_line=True, create_mapping=True)\n
except ValueError:\n
return None\n
return context.restrictedTraverse(mapping)\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Person_setAggregatedDelivery.py
0 → 100644
View file @
43b65274
integration_site
=
context
.
getPortalObject
().
restrictedTraverse
(
'portal_integrations/slapos_aggregated_delivery_integration_site'
)
person_id
=
context
.
getId
().
replace
(
'-'
,
'_'
)
integration_site
.
Causality
[
person_id
].
setDestinationReference
(
delivery
.
getRelativeUrl
())
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Person_setAggregatedDelivery.xml
View file @
43b65274
...
...
@@ -48,16 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
integration_site = context.getPortalObject().restrictedTraverse(\n
\'portal_integrations/slapos_aggregated_delivery_integration_site\')\n
\n
\n
person_id = context.getId().replace(\'-\', \'_\')\n
integration_site.Causality[person_id].setDestinationReference(delivery.getRelativeUrl())\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
delivery
</string>
</value>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Person_storeOpenSaleOrderJournal.py
0 → 100644
View file @
43b65274
from
Products.ERP5Type.DateUtils
import
addToDate
,
getClosestDate
from
DateTime
import
DateTime
portal
=
context
.
getPortalObject
()
now
=
DateTime
()
person
=
context
tag
=
'%s_%s'
%
(
person
.
getUid
(),
script
.
id
)
activate_kw
=
{
'tag'
:
tag
}
if
portal
.
portal_activities
.
countMessageWithTag
(
tag
)
>
0
:
# nothing to do
return
def
newOpenOrder
(
open_sale_order
):
open_order_edit_kw
=
{
'effective_date'
:
DateTime
(),
'activate_kw'
:
activate_kw
,
}
if
open_sale_order
is
None
:
open_sale_order_template
=
portal
.
restrictedTraverse
(
portal
.
portal_preferences
.
getPreferredOpenSaleOrderTemplate
())
new_open_sale_order
=
open_sale_order_template
.
Base_createCloneDocument
(
batch_mode
=
1
)
open_order_edit_kw
.
update
({
'destination'
:
person
.
getRelativeUrl
(),
'destination_decision'
:
person
.
getRelativeUrl
(),
'title'
:
"%s SlapOS Subscription"
%
person
.
getTitle
(),
})
else
:
new_open_sale_order
=
open_sale_order
.
Base_createCloneDocument
(
batch_mode
=
1
)
open_sale_order
.
setExpirationDate
(
now
,
activate_kw
=
activate_kw
)
new_open_sale_order
.
edit
(
**
open_order_edit_kw
)
new_open_sale_order
.
order
(
activate_kw
=
activate_kw
)
new_open_sale_order
.
validate
(
activate_kw
=
activate_kw
)
return
new_open_sale_order
def
storeWorkflowComment
(
document
,
comment
):
portal
.
portal_workflow
.
doActionFor
(
document
,
'edit_action'
,
comment
=
comment
)
def
calculateOpenOrderLineStopDate
(
open_order_line
,
hosting_subscription
):
end_date
=
hosting_subscription
.
HostingSubscription_calculateSubscriptionStopDate
()
if
end_date
is
None
:
# Be sure that start date is different from stop date
next_stop_date
=
hosting_subscription
.
getNextPeriodicalDate
(
hosting_subscription
.
HostingSubscription_calculateSubscriptionStartDate
())
current_stop_date
=
next_stop_date
while
next_stop_date
<
now
:
# Return result should be < now, it order to provide stability in simulation (destruction if it happen should be >= now)
current_stop_date
=
next_stop_date
next_stop_date
=
\
hosting_subscription
.
getNextPeriodicalDate
(
current_stop_date
)
return
addToDate
(
current_stop_date
,
to_add
=
{
'second'
:
-
1
})
else
:
stop_date
=
end_date
return
stop_date
# Prevent concurrent transaction to update the open order
context
.
serialize
()
# First, check the existing open order. Does some lines need to be removed, updated?
open_sale_order_list
=
portal
.
portal_catalog
(
default_destination_uid
=
person
.
getUid
(),
portal_type
=
"Open Sale Order"
,
validation_state
=
"validated"
,
limit
=
2
,
)
open_sale_order_count
=
len
(
open_sale_order_list
)
if
open_sale_order_count
==
0
:
open_sale_order
=
None
elif
open_sale_order_count
==
1
:
open_sale_order
=
open_sale_order_list
[
0
].
getObject
()
else
:
raise
ValueError
,
"Too many open order '%s' found: %s"
%
(
person
.
getRelativeUrl
(),
[
x
.
path
for
x
in
open_sale_order_list
])
delete_line_list
=
[]
add_line_list
=
[]
updated_hosting_subscription_dict
=
{}
deleted_hosting_subscription_dict
=
{}
if
open_sale_order
is
not
None
:
for
open_order_line
in
open_sale_order
.
contentValues
(
portal_type
=
'Open Sale Order Line'
):
current_start_date
=
open_order_line
.
getStartDate
()
current_stop_date
=
open_order_line
.
getStopDate
()
# Prevent mistakes
assert
current_start_date
is
not
None
assert
current_stop_date
is
not
None
assert
current_start_date
<
current_stop_date
hosting_subscription
=
open_order_line
.
getAggregateValue
(
portal_type
=
'Hosting Subscription'
)
assert
current_start_date
==
hosting_subscription
.
HostingSubscription_calculateSubscriptionStartDate
()
# First check if the hosting subscription has been correctly simulated (this script may run only once per year...)
stop_date
=
calculateOpenOrderLineStopDate
(
open_order_line
,
hosting_subscription
)
if
current_stop_date
!=
stop_date
:
# Bingo, new subscription to generate
open_order_line
.
edit
(
stop_date
=
stop_date
,
activate_kw
=
activate_kw
)
storeWorkflowComment
(
open_order_line
,
'Stop date updated to %s'
%
stop_date
)
if
hosting_subscription
.
getSlapState
()
==
'destroy_requested'
:
# Line should be deleted
assert
hosting_subscription
.
getCausalityState
()
==
'diverged'
delete_line_list
.
append
(
open_order_line
.
getId
())
hosting_subscription
.
converge
(
comment
=
"Last open order: %s"
%
open_order_line
.
getRelativeUrl
())
deleted_hosting_subscription_dict
[
hosting_subscription
.
getRelativeUrl
()]
=
None
updated_hosting_subscription_dict
[
hosting_subscription
.
getRelativeUrl
()]
=
None
elif
(
hosting_subscription
.
getCausalityState
()
==
'diverged'
):
hosting_subscription
.
converge
(
comment
=
"Nothing to do on open order."
)
updated_hosting_subscription_dict
[
hosting_subscription
.
getRelativeUrl
()]
=
None
# Time to check the open order line to add (remaining diverged Hosting
# Subscription normally)
for
hosting_subscription
in
portal
.
portal_catalog
(
portal_type
=
'Hosting Subscription'
,
default_destination_section_uid
=
context
.
getUid
(),
causality_state
=
"diverged"
):
hosting_subscription
=
hosting_subscription
.
getObject
()
if
hosting_subscription
.
getCausalityState
()
==
'diverged'
:
# Simply check that it has never been simulated
assert
len
(
portal
.
portal_catalog
(
portal_type
=
'Open Sale Order Line'
,
default_aggregate_uid
=
hosting_subscription
.
getUid
(),
limit
=
1
))
==
0
# Let's add
add_line_list
.
append
(
hosting_subscription
)
else
:
# Should be in the list of lines to remove
assert
(
hosting_subscription
.
getRelativeUrl
()
in
deleted_hosting_subscription_dict
)
or
\
(
hosting_subscription
.
getRelativeUrl
()
in
updated_hosting_subscription_dict
)
manual_archive
=
False
if
(
add_line_list
):
# No need to create a new open order to add lines
if
open_sale_order
is
None
:
open_sale_order
=
newOpenOrder
(
None
)
manual_archive
=
True
open_order_explanation
=
""
# Add lines
added_line_list
=
[]
open_sale_order_line_template
=
portal
.
restrictedTraverse
(
portal
.
portal_preferences
.
getPreferredOpenSaleOrderLineTemplate
())
for
hosting_subscription
in
add_line_list
:
open_sale_order_line
=
open_sale_order_line_template
.
Base_createCloneDocument
(
batch_mode
=
1
,
destination
=
open_sale_order
)
start_date
=
hosting_subscription
.
HostingSubscription_calculateSubscriptionStartDate
()
open_sale_order_line
.
edit
(
activate_kw
=
activate_kw
,
title
=
hosting_subscription
.
getTitle
(),
start_date
=
start_date
,
stop_date
=
calculateOpenOrderLineStopDate
(
open_sale_order_line
,
hosting_subscription
),
aggregate_value
=
hosting_subscription
,
)
storeWorkflowComment
(
open_sale_order_line
,
"Created for %s"
%
hosting_subscription
.
getRelativeUrl
())
if
(
hosting_subscription
.
getSlapState
()
==
'destroy_requested'
):
# Added line to delete immediately
delete_line_list
.
append
(
open_sale_order_line
.
getId
())
hosting_subscription
.
converge
(
comment
=
"Last open order: %s"
%
open_sale_order_line
.
getRelativeUrl
())
else
:
hosting_subscription
.
converge
(
comment
=
"First open order: %s"
%
open_sale_order_line
.
getRelativeUrl
())
added_line_list
.
append
(
open_sale_order_line
.
getId
())
open_order_explanation
+=
"Added %s."
%
str
(
added_line_list
)
new_open_sale_order
=
None
if
(
delete_line_list
):
# All Verifications done. Time to clone/create open order
new_open_sale_order
=
newOpenOrder
(
open_sale_order
)
if
manual_archive
==
True
:
open_sale_order
.
archive
()
open_order_explanation
=
""
# Remove lines
new_open_sale_order
.
deleteContent
(
delete_line_list
)
open_order_explanation
+=
"Removed %s."
%
str
(
delete_line_list
)
storeWorkflowComment
(
new_open_sale_order
,
open_order_explanation
)
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Person_storeOpenSaleOrderJournal.xml
View file @
43b65274
...
...
@@ -48,194 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
from Products.ERP5Type.DateUtils import addToDate, getClosestDate\n
from DateTime import DateTime\n
\n
portal = context.getPortalObject()\n
now = DateTime()\n
person = context\n
tag = \'%s_%s\' % (person.getUid(), script.id)\n
activate_kw = {\'tag\': tag}\n
if portal.portal_activities.countMessageWithTag(tag) >
0:\n
# nothing to do\n
return\n
\n
def newOpenOrder(open_sale_order):\n
open_order_edit_kw = {\n
\'effective_date\': DateTime(),\n
\'activate_kw\': activate_kw,\n
}\n
if open_sale_order is None:\n
open_sale_order_template = portal.restrictedTraverse(\n
portal.portal_preferences.getPreferredOpenSaleOrderTemplate())\n
new_open_sale_order = open_sale_order_template.Base_createCloneDocument(batch_mode=1)\n
open_order_edit_kw.update({\n
\'destination\': person.getRelativeUrl(),\n
\'destination_decision\': person.getRelativeUrl(),\n
\'title\': "%s SlapOS Subscription" % person.getTitle(),\n
})\n
else:\n
new_open_sale_order = open_sale_order.Base_createCloneDocument(batch_mode=1)\n
open_sale_order.setExpirationDate(now, activate_kw=activate_kw)\n
new_open_sale_order.edit(**open_order_edit_kw)\n
new_open_sale_order.order(activate_kw=activate_kw)\n
new_open_sale_order.validate(activate_kw=activate_kw)\n
return new_open_sale_order\n
\n
def storeWorkflowComment(document, comment):\n
portal.portal_workflow.doActionFor(document, \'edit_action\', comment=comment)\n
\n
def calculateOpenOrderLineStopDate(open_order_line, hosting_subscription):\n
end_date = hosting_subscription.HostingSubscription_calculateSubscriptionStopDate()\n
if end_date is None: \n
# Be sure that start date is different from stop date\n
next_stop_date = hosting_subscription.getNextPeriodicalDate(hosting_subscription.HostingSubscription_calculateSubscriptionStartDate())\n
current_stop_date = next_stop_date\n
while next_stop_date
< now:
\n
#
Return
result
should
be
<
now,
it
order
to
provide
stability
in
simulation
(destruction
if
it
happen
should
be
>
= now)\n
current_stop_date = next_stop_date\n
next_stop_date = \\\n
hosting_subscription.getNextPeriodicalDate(current_stop_date)\n
return addToDate(current_stop_date, to_add={\'second\': -1})\n
else:\n
stop_date = end_date\n
return stop_date\n
\n
# Prevent concurrent transaction to update the open order\n
context.serialize()\n
\n
# First, check the existing open order. Does some lines need to be removed, updated?\n
open_sale_order_list = portal.portal_catalog(\n
default_destination_uid=person.getUid(),\n
portal_type="Open Sale Order",\n
validation_state="validated",\n
limit=2,\n
)\n
open_sale_order_count = len(open_sale_order_list)\n
if open_sale_order_count == 0:\n
open_sale_order = None\n
elif open_sale_order_count == 1:\n
open_sale_order = open_sale_order_list[0].getObject()\n
else:\n
raise ValueError, "Too many open order \'%s\' found: %s" % (person.getRelativeUrl(), [x.path for x in open_sale_order_list])\n
\n
delete_line_list = []\n
add_line_list = []\n
\n
updated_hosting_subscription_dict = {}\n
deleted_hosting_subscription_dict = {}\n
\n
if open_sale_order is not None:\n
for open_order_line in open_sale_order.contentValues(\n
portal_type=\'Open Sale Order Line\'):\n
current_start_date = open_order_line.getStartDate()\n
current_stop_date = open_order_line.getStopDate()\n
\n
# Prevent mistakes\n
assert current_start_date is not None\n
assert current_stop_date is not None\n
assert current_start_date
< current_stop_date
\n
\n
hosting_subscription =
open_order_line.getAggregateValue(portal_type=\'Hosting
Subscription\')\n
assert
current_start_date =
=
hosting_subscription.HostingSubscription_calculateSubscriptionStartDate()\n
\n
#
First
check
if
the
hosting
subscription
has
been
correctly
simulated
(this
script
may
run
only
once
per
year...)\n
stop_date =
calculateOpenOrderLineStopDate(open_order_line,
hosting_subscription)\n
if
current_stop_date
!=
stop_date:\n
#
Bingo,
new
subscription
to
generate\n
open_order_line.edit(\n
stop_date=
stop_date,\n
activate_kw=
activate_kw)\n
storeWorkflowComment(open_order_line,\n
\'Stop
date
updated
to
%s\'
%
stop_date)\n
\n
if
hosting_subscription.getSlapState()
==
\'destroy_requested\':\n
#
Line
should
be
deleted\n
assert
hosting_subscription.getCausalityState()
==
\'diverged\'\n
delete_line_list.append(open_order_line.getId())\n
hosting_subscription.converge(
comment=
"Last open order: %s"
%
open_order_line.getRelativeUrl())\n
deleted_hosting_subscription_dict[hosting_subscription.getRelativeUrl()]
=
None\n
updated_hosting_subscription_dict[hosting_subscription.getRelativeUrl()]
=
None\n
\n
elif
(hosting_subscription.getCausalityState()
==
\'diverged\'):\n
hosting_subscription.converge(
comment=
"Nothing to do on open order."
)\n
updated_hosting_subscription_dict[hosting_subscription.getRelativeUrl()]
=
None\n
\n
#
Time
to
check
the
open
order
line
to
add
(remaining
diverged
Hosting\n
#
Subscription
normally)\n
for
hosting_subscription
in
portal.portal_catalog(\n
portal_type=
\'Hosting
Subscription\',\n
default_destination_section_uid=
context.getUid(),\n
causality_state=
"diverged"
):\n
hosting_subscription =
hosting_subscription.getObject()\n
if
hosting_subscription.getCausalityState()
==
\'diverged\':\n
#
Simply
check
that
it
has
never
been
simulated\n
assert
len(portal.portal_catalog(\n
portal_type=
\'Open
Sale
Order
Line\',\n
default_aggregate_uid=
hosting_subscription.getUid(),\n
limit=
1))
==
0\n
\n
#
Let\'s
add\n
add_line_list.append(hosting_subscription)\n
else:\n
#
Should
be
in
the
list
of
lines
to
remove\n
assert
(hosting_subscription.getRelativeUrl()
in
deleted_hosting_subscription_dict)
or
\\\n
(hosting_subscription.getRelativeUrl()
in
updated_hosting_subscription_dict)\n
\n
manual_archive =
False\n
if
(add_line_list):\n
#
No
need
to
create
a
new
open
order
to
add
lines\n
if
open_sale_order
is
None:\n
open_sale_order =
newOpenOrder(None)\n
manual_archive =
True\n
\n
open_order_explanation =
""
\n
#
Add
lines\n
added_line_list =
[]\n
open_sale_order_line_template =
portal.restrictedTraverse(\n
portal.portal_preferences.getPreferredOpenSaleOrderLineTemplate())\n
for
hosting_subscription
in
add_line_list:\n
open_sale_order_line =
open_sale_order_line_template.Base_createCloneDocument(batch_mode=1,\n
destination=
open_sale_order)\n
start_date =
hosting_subscription.HostingSubscription_calculateSubscriptionStartDate()\n
open_sale_order_line.edit(\n
activate_kw=
activate_kw,\n
title=
hosting_subscription.getTitle(),\n
start_date=
start_date,\n
stop_date=
calculateOpenOrderLineStopDate(open_sale_order_line,
hosting_subscription),\n
aggregate_value=
hosting_subscription,\n
)\n
storeWorkflowComment(open_sale_order_line,
"Created
for
%s"
%
hosting_subscription.getRelativeUrl())\n
if
(hosting_subscription.getSlapState()
==
\'destroy_requested\'):\n
#
Added
line
to
delete
immediately\n
delete_line_list.append(open_sale_order_line.getId())\n
hosting_subscription.converge(
comment=
"Last open order: %s"
%
open_sale_order_line.getRelativeUrl())\n
else:\n
hosting_subscription.converge(
comment=
"First open order: %s"
%
open_sale_order_line.getRelativeUrl())\n
added_line_list.append(open_sale_order_line.getId())\n
open_order_explanation
+=
"Added
%s."
%
str(added_line_list)\n
\n
new_open_sale_order =
None\n
if
(delete_line_list):\n
#
All
Verifications
done.
Time
to
clone/create
open
order\n
new_open_sale_order =
newOpenOrder(open_sale_order)\n
if
manual_archive =
=
True:\n
open_sale_order.archive()\n
\n
open_order_explanation =
""
\n
#
Remove
lines\n
new_open_sale_order.deleteContent(delete_line_list)\n
open_order_explanation
+=
"Removed
%s."
%
str(delete_line_list)\n
\n
storeWorkflowComment(new_open_sale_order,
open_order_explanation)\n
]]
></string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/SaleInvoiceTransaction_init.py
0 → 100644
View file @
43b65274
if
kw
.
get
(
'created_by_builder'
,
0
):
return
context
.
newContent
(
portal_type
=
'Sale Invoice Transaction Line'
,
id
=
'income'
,)
context
.
newContent
(
portal_type
=
'Sale Invoice Transaction Line'
,
id
=
'receivable'
,
)
context
.
newContent
(
portal_type
=
'Sale Invoice Transaction Line'
,
id
=
'collected_vat'
,)
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/SaleInvoiceTransaction_init.xml
View file @
43b65274
...
...
@@ -48,19 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
if kw.get(\'created_by_builder\', 0): \n
return\n
\n
context.newContent(portal_type=\'Sale Invoice Transaction Line\',\n
id=\'income\',)\n
context.newContent(portal_type=\'Sale Invoice Transaction Line\',\n
id=\'receivable\', )\n
context.newContent(portal_type=\'Sale Invoice Transaction Line\',\n
id=\'collected_vat\',)\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
*args, **kw
</string>
</value>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/SaleInvoiceTransaction_isTotalPriceEqualAccounting.py
0 → 100644
View file @
43b65274
invoice
=
context
total_price
=
invoice
.
getTotalPrice
()
accounting_price
=
invoice
.
AccountingTransaction_getTotalCredit
()
precision
=
invoice
.
getPriceCurrencyValue
().
getQuantityPrecision
()
return
round
(
total_price
,
precision
)
==
round
(
accounting_price
,
precision
)
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/SaleInvoiceTransaction_isTotalPriceEqualAccounting.xml
View file @
43b65274
...
...
@@ -48,16 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
invoice = context\n
\n
total_price = invoice.getTotalPrice()\n
accounting_price = invoice.AccountingTransaction_getTotalCredit()\n
precision = invoice.getPriceCurrencyValue().getQuantityPrecision()\n
return round(total_price, precision) == round(accounting_price, precision)\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/SaleInvoiceTransaction_isTotalPriceMatchingSalePackingList.py
0 → 100644
View file @
43b65274
invoice
=
context
specialise
=
context
.
getPortalObject
().
portal_preferences
.
getPreferredAggregatedSaleTradeCondition
()
if
invoice
.
getSpecialise
()
!=
specialise
:
raise
TypeError
(
'Only invoice specialised by %s shall be checked'
%
specialise
)
if
len
(
invoice
.
getCausalityRelatedList
(
portal_type
=
'Cloud Contract'
))
>
0
:
# Nothing to compare
return
True
delivery_list
=
invoice
.
getCausalityValueList
(
portal_type
=
'Sale Packing List'
)
amount
=
len
(
delivery_list
)
if
amount
!=
1
:
raise
TypeError
(
'Wrong amount %s of related packing lists'
%
amount
)
delivery
=
delivery_list
[
0
]
return
delivery
.
getTotalPrice
(
use
=
'use/trade/sale'
)
==
context
.
getTotalPrice
(
use
=
'use/trade/sale'
)
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/SaleInvoiceTransaction_isTotalPriceMatchingSalePackingList.xml
View file @
43b65274
...
...
@@ -48,31 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
invoice = context\n
specialise = context.getPortalObject().portal_preferences.getPreferredAggregatedSaleTradeCondition()\n
if invoice.getSpecialise() != specialise:\n
raise TypeError(\'Only invoice specialised by %s shall be checked\' % specialise)\n
\n
if len(invoice.getCausalityRelatedList(portal_type=\'Cloud Contract\')) >
0:\n
# Nothing to compare\n
return True\n
\n
\n
delivery_list = invoice.getCausalityValueList(portal_type=\'Sale Packing List\')\n
amount = len(delivery_list)\n
if amount != 1:\n
raise TypeError(\'Wrong amount %s of related packing lists\' % amount)\n
delivery = delivery_list[0]\n
\n
return delivery.getTotalPrice(use=\'use/trade/sale\') == context.getTotalPrice(use=\'use/trade/sale\')\n
]]>
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/SaleInvoiceTransaction_isTradeModelCorrect.py
0 → 100644
View file @
43b65274
specialise
=
context
.
getSpecialiseValue
(
portal_type
=
'Sale Trade Condition'
)
amount_list
=
specialise
.
getAggregatedAmountList
(
context
)
if
len
(
amount_list
)
!=
1
:
return
False
precision
=
context
.
getPriceCurrencyValue
().
getQuantityPrecision
()
amount
=
amount_list
[
0
]
total_price
=
amount
.
getTotalPrice
()
invoice_tax
=
0.
for
line
in
context
.
getMovementList
(
context
.
getPortalInvoiceMovementTypeList
()):
if
line
.
getUse
()
==
'trade/tax'
:
invoice_tax
+=
line
.
getTotalPrice
()
return
round
(
total_price
,
precision
)
==
round
(
invoice_tax
,
precision
)
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/SaleInvoiceTransaction_isTradeModelCorrect.xml
View file @
43b65274
...
...
@@ -48,27 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
specialise = context.getSpecialiseValue(portal_type=\'Sale Trade Condition\')\n
amount_list = specialise.getAggregatedAmountList(context)\n
if len(amount_list) != 1:\n
return False\n
\n
precision = context.getPriceCurrencyValue().getQuantityPrecision()\n
\n
amount = amount_list[0]\n
\n
total_price = amount.getTotalPrice()\n
\n
invoice_tax = 0.\n
for line in context.getMovementList(context.getPortalInvoiceMovementTypeList()):\n
if line.getUse() == \'trade/tax\':\n
invoice_tax += line.getTotalPrice()\n
\n
return round(total_price, precision) == round(invoice_tax, precision)\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/SalePackingList_postSlapOSAggregatedDeliveryBuilder.py
0 → 100644
View file @
43b65274
from
DateTime
import
DateTime
restrictedTraverse
=
context
.
getPortalObject
().
restrictedTraverse
person
=
context
.
getDestination
()
reference
=
context
.
getReference
()
input_movement_list
=
[
restrictedTraverse
(
q
)
for
q
in
related_simulation_movement_path_list
if
restrictedTraverse
(
q
).
getDestination
()
==
person
]
for
delivery_line
in
input_movement_list
:
delivery_line
.
setGroupingReference
(
reference
)
if
context
.
getCausalityState
()
==
'draft'
:
context
.
startBuilding
()
if
context
.
getStartDate
()
is
None
:
context
.
setStartDate
(
DateTime
().
earliestTime
())
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/SalePackingList_postSlapOSAggregatedDeliveryBuilder.xml
View file @
43b65274
...
...
@@ -48,25 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
from DateTime import DateTime\n
restrictedTraverse = context.getPortalObject().restrictedTraverse\n
person = context.getDestination()\n
reference = context.getReference()\n
input_movement_list = [restrictedTraverse(q) for q in\n
related_simulation_movement_path_list\n
if restrictedTraverse(q).getDestination() == person]\n
\n
for delivery_line in input_movement_list:\n
delivery_line.setGroupingReference(reference)\n
if context.getCausalityState() == \'draft\':\n
context.startBuilding()\n
\n
if context.getStartDate() is None:\n
context.setStartDate(DateTime().earliestTime())\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
related_simulation_movement_path_list, *args, **kwargs
</string>
</value>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Service_getPriceCalculationOperandDict.py
0 → 100644
View file @
43b65274
return
{
'price'
:
0.0
}
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Service_getPriceCalculationOperandDict.xml
View file @
43b65274
...
...
@@ -48,11 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
return {\'price\': 0.0}\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
default=None, movement=None, REQUEST=None, **kw
</string>
</value>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/Alarm_generateInvoiceResourceConsuptionDocument.py
0 → 100644
View file @
43b65274
from
Products.ERP5Type.DateUtils
import
addToDate
from
Products.ZSQLCatalog.SQLCatalog
import
Query
from
DateTime
import
DateTime
portal
=
context
.
getPortalObject
()
portal
.
portal_catalog
.
searchAndActivate
(
portal_type
=
'Sale Invoice Transaction'
,
simulation_state
=
'confirmed'
,
causality_state
=
'solved'
,
creation_date
=
Query
(
creation_date
=
addToDate
(
DateTime
(),
to_add
=
{
'day'
:
-
20
}),
range
=
"min"
),
method_id
=
'SaleInvoiceTransaction_generateResourceConsumptionDocument'
,
activity_count
=
1
,
packet_size
=
1
,
activate_kw
=
{
'tag'
:
tag
}
)
context
.
activate
(
after_tag
=
tag
,
priority
=
5
).
getId
()
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/Alarm_generateInvoiceResourceConsuptionDocument.xml
View file @
43b65274
...
...
@@ -48,26 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
from Products.ERP5Type.DateUtils import addToDate\n
from Products.ZSQLCatalog.SQLCatalog import Query\n
from DateTime import DateTime\n
\n
portal = context.getPortalObject()\n
portal.portal_catalog.searchAndActivate(\n
portal_type=\'Sale Invoice Transaction\',\n
simulation_state=\'confirmed\',\n
causality_state=\'solved\',\n
creation_date=Query(creation_date=addToDate(DateTime(), to_add={\'day\': -20}), range="min"),\n
method_id=\'SaleInvoiceTransaction_generateResourceConsumptionDocument\',\n
activity_count=1,\n
packet_size=1,\n
activate_kw={\'tag\': tag}\n
)\n
context.activate(after_tag=tag, priority=5).getId()\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
tag, fixit, params
</string>
</value>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/Base_getResourceServiceTitleUitList.py
0 → 100644
View file @
43b65274
cpu_resource
=
context
.
service_module
.
cpu_load_percent
memory_resource
=
context
.
service_module
.
memory_used
disk_resource
=
context
.
service_module
.
disk_used
return
[(
cpu_resource
.
getTitle
(),
cpu_resource
.
getUid
()),
(
disk_resource
.
getTitle
(),
disk_resource
.
getUid
()),
(
memory_resource
.
getTitle
(),
memory_resource
.
getUid
())]
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/Base_getResourceServiceTitleUitList.xml
View file @
43b65274
...
...
@@ -48,17 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
cpu_resource = context.service_module.cpu_load_percent\n
memory_resource = context.service_module.memory_used\n
disk_resource = context.service_module.disk_used\n
\n
return [(cpu_resource.getTitle(), cpu_resource.getUid()),\n
(disk_resource.getTitle(), disk_resource.getUid()),\n
(memory_resource.getTitle(), memory_resource.getUid())]\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/Base_getUserConsumptionDetailList.py
0 → 100644
View file @
43b65274
from
Products.ERP5Type.DateUtils
import
addToDate
from
DateTime
import
DateTime
from
Products.ZSQLCatalog.SQLCatalog
import
Query
portal
=
context
.
getPortalObject
()
for
key
in
[
'portal_type'
,
'sort_on'
]:
if
key
in
query_kw
:
query_kw
.
pop
(
key
)
#if not 'limit' in query_kw:
# query_kw['limit'] = 31 # limit is for one month by default
if
grouping_reference
is
not
None
:
query_kw
[
'grouping_reference'
]
=
grouping_reference
sale_packing_list
=
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'Sale Packing List'
,
reference
=
grouping_reference
,
)
if
not
sale_packing_list
:
# Strange cannot find this packing list ?
return
[]
min_date
=
sale_packing_list
.
getStopDate
()
min_date
=
addToDate
(
min_date
,
dict
(
day
=-
31
))
# Get max 31 (one accounting period) latest published consumption lines
query_kw
[
'movement.start_date'
]
=
Query
(
range
=
"min"
,
**
{
'movement.start_date'
:
min_date
})
cpu_resource_uid
=
context
.
service_module
.
cpu_load_percent
.
getUid
()
memory_resource_uid
=
context
.
service_module
.
memory_used
.
getUid
()
consumption_dict
=
{}
def
getPackingListLineForResource
(
resource_uid_list
):
return
portal
.
portal_catalog
(
portal_type
=
"Sale Packing List Line"
,
default_resource_uid
=
resource_uid_list
,
**
query_kw
)
def
setDetailLine
(
packing_list_line
):
start_date
=
DateTime
(
packing_list_line
.
getStartDate
()).
strftime
(
'%Y/%m/%d'
)
hosting_reference
=
packing_list_line
.
getAggregateReference
(
portal_type
=
'Hosting Subscription'
)
hosting_title
=
packing_list_line
.
getAggregateTitle
(
portal_type
=
'Hosting Subscription'
)
software_instance
=
packing_list_line
.
getAggregateValue
(
portal_type
=
'Software Instance'
)
if
software_instance
is
None
:
# In case we found SPL line not aggregated to instance and hosting
return
instance_reference
=
software_instance
.
getReference
()
#default_line = {'date': {'hosting_ref': ['hs_title', {'instance_ref': ['inst_title', ['res1', 'res2', 'resN'] ] } ] } }
if
not
start_date
in
consumption_dict
:
# Add new date line
consumption_dict
[
start_date
]
=
{
hosting_reference
:
[
hosting_title
,
{
instance_reference
:
[
software_instance
.
getTitle
(),
[
0.0
,
0.0
]
]
}
]
}
# Add new Hosting line
if
not
hosting_reference
in
consumption_dict
[
start_date
]:
consumption_dict
[
start_date
][
hosting_reference
]
=
[
hosting_title
,
{
instance_reference
:
[
software_instance
.
getTitle
(),
[
0.0
,
0.0
]
]
}
]
# Add new instance line
if
not
instance_reference
in
consumption_dict
[
start_date
][
hosting_reference
][
1
]:
consumption_dict
[
start_date
][
hosting_reference
][
1
][
instance_reference
]
=
[
software_instance
.
getTitle
(),
[
0.0
,
0.0
]
]
if
packing_list_line
.
getResourceUid
()
==
cpu_resource_uid
:
quantity
=
round
(
float
(
packing_list_line
.
getQuantity
()),
3
)
consumption_dict
[
start_date
][
hosting_reference
][
1
][
instance_reference
][
1
][
0
]
=
quantity
elif
packing_list_line
.
getResourceUid
()
==
memory_resource_uid
:
quantity
=
round
(
(
float
(
packing_list_line
.
getQuantity
())
/
1024.0
),
3
)
consumption_dict
[
start_date
][
hosting_reference
][
1
][
instance_reference
][
1
][
1
]
=
quantity
# Add CPU_LOAD consumption details
for
packing_list_line
in
getPackingListLineForResource
([
cpu_resource_uid
,
memory_resource_uid
]):
setDetailLine
(
packing_list_line
)
consumption_list
=
[]
for
date
in
sorted
(
consumption_dict
):
for
hosting_key
in
sorted
(
consumption_dict
[
date
]):
hosting_title
,
instance_dict
=
consumption_dict
[
date
][
hosting_key
]
for
instance_value_list
in
instance_dict
.
values
():
instance_title
,
values
=
instance_value_list
consumption_list
.
append
([
date
,
hosting_title
,
instance_title
,
values
[
0
],
values
[
1
]])
return
consumption_list
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/Base_getUserConsumptionDetailList.xml
View file @
43b65274
...
...
@@ -48,107 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
from Products.ERP5Type.DateUtils import addToDate\n
from DateTime import DateTime\n
from Products.ZSQLCatalog.SQLCatalog import Query\n
\n
portal = context.getPortalObject()\n
\n
for key in [\'portal_type\', \'sort_on\']:\n
if key in query_kw:\n
query_kw.pop(key)\n
#if not \'limit\' in query_kw:\n
# query_kw[\'limit\'] = 31 # limit is for one month by default\n
if grouping_reference is not None:\n
query_kw[\'grouping_reference\'] = grouping_reference\n
\n
sale_packing_list = portal.portal_catalog.getResultValue(\n
portal_type=\'Sale Packing List\',\n
reference=grouping_reference,\n
)\n
if not sale_packing_list: # Strange cannot find this packing list ?\n
return []\n
min_date = sale_packing_list.getStopDate()\n
min_date = addToDate(min_date, dict(day=-31)) # Get max 31 (one accounting period) latest published consumption lines\n
\n
query_kw[\'movement.start_date\'] = Query(range="min",\n
**{\'movement.start_date\': min_date})\n
\n
cpu_resource_uid = context.service_module.cpu_load_percent.getUid()\n
memory_resource_uid = context.service_module.memory_used.getUid()\n
consumption_dict = {}\n
\n
def getPackingListLineForResource(resource_uid_list):\n
return portal.portal_catalog(\n
portal_type="Sale Packing List Line",\n
default_resource_uid = resource_uid_list,\n
**query_kw\n
)\n
\n
def setDetailLine(packing_list_line):\n
start_date = DateTime(packing_list_line.getStartDate()).strftime(\'%Y/%m/%d\')\n
hosting_reference = packing_list_line.getAggregateReference(\n
portal_type=\'Hosting Subscription\')\n
hosting_title = packing_list_line.getAggregateTitle(\n
portal_type=\'Hosting Subscription\')\n
software_instance = packing_list_line.getAggregateValue(\n
portal_type=\'Software Instance\')\n
if software_instance is None:\n
# In case we found SPL line not aggregated to instance and hosting\n
return\n
instance_reference = software_instance.getReference()\n
#default_line = {\'date\': {\'hosting_ref\': [\'hs_title\', {\'instance_ref\': [\'inst_title\', [\'res1\', \'res2\', \'resN\'] ] } ] } }\n
if not start_date in consumption_dict:\n
# Add new date line\n
consumption_dict[start_date] = {hosting_reference: \n
[hosting_title, \n
{instance_reference: \n
[software_instance.getTitle(), \n
[0.0, 0.0]\n
]\n
}\n
]\n
}\n
# Add new Hosting line\n
if not hosting_reference in consumption_dict[start_date]:\n
consumption_dict[start_date][hosting_reference] = [hosting_title, \n
{instance_reference: \n
[software_instance.getTitle(), \n
[0.0, 0.0]\n
]\n
}\n
]\n
# Add new instance line\n
if not instance_reference in consumption_dict[start_date][hosting_reference][1]:\n
consumption_dict[start_date][hosting_reference][1][instance_reference] = [\n
software_instance.getTitle(), [0.0, 0.0]\n
]\n
if packing_list_line.getResourceUid() == cpu_resource_uid:\n
quantity = round(float(packing_list_line.getQuantity()), 3)\n
consumption_dict[start_date][hosting_reference][1][instance_reference][1][0] = quantity\n
elif packing_list_line.getResourceUid() == memory_resource_uid:\n
quantity = round( (float(packing_list_line.getQuantity())/1024.0), 3)\n
consumption_dict[start_date][hosting_reference][1][instance_reference][1][1] = quantity\n
\n
\n
# Add CPU_LOAD consumption details\n
for packing_list_line in getPackingListLineForResource([cpu_resource_uid,\n
memory_resource_uid]):\n
setDetailLine(packing_list_line)\n
\n
consumption_list = []\n
for date in sorted(consumption_dict):\n
for hosting_key in sorted(consumption_dict[date]):\n
hosting_title, instance_dict = consumption_dict[date][hosting_key]\n
for instance_value_list in instance_dict.values():\n
instance_title, values = instance_value_list\n
consumption_list.append([date, hosting_title, instance_title, values[0], values[1]])\n
\n
return consumption_list\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
grouping_reference=None, **query_kw
</string>
</value>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/Base_jumpToViewLatestDayConsumption.py
0 → 100644
View file @
43b65274
portal
=
context
.
getPortalObject
()
if
context
.
getPortalType
()
==
"Computer"
:
# Get the Latest Sale Packing List
sale_packing_list_line
=
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'Sale Packing List Line'
,
simulation_state
=
'delivered'
,
sort_on
=
[(
'movement.start_date'
,
'DESC'
)],
aggregate_uid
=
context
.
getUid
(),
limit
=
1
)
if
sale_packing_list_line
is
not
None
:
sale_packing_list
=
sale_packing_list_line
.
getParent
()
#request = context.getPortalObject().REQUEST
return
sale_packing_list
.
Base_redirect
(
'Base_viewListMode?proxy_form_id=SalePackingList_view&proxy_field_id=listbox'
)
# Redirect to web site to hide the indexation process
context
.
Base_redirect
(
'view'
,
keep_items
=
{
'portal_status_message'
:
context
.
Base_translateString
(
'No Consumption Report for this computer.'
)})
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/Base_jumpToViewLatestDayConsumption.xml
View file @
43b65274
...
...
@@ -48,34 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
portal = context.getPortalObject()\n
\n
if context.getPortalType() == "Computer":\n
\n
# Get the Latest Sale Packing List\n
sale_packing_list_line = portal.portal_catalog.getResultValue(\n
portal_type=\'Sale Packing List Line\',\n
simulation_state=\'delivered\',\n
sort_on=[(\'movement.start_date\', \'DESC\')],\n
aggregate_uid=context.getUid(),\n
limit=1)\n
\n
if sale_packing_list_line is not None:\n
sale_packing_list = sale_packing_list_line.getParent()\n
\n
#request = context.getPortalObject().REQUEST\n
return sale_packing_list.Base_redirect(\'Base_viewListMode?proxy_form_id=SalePackingList_view&proxy_field_id=listbox\')\n
\n
# Redirect to web site to hide the indexation process\n
context.Base_redirect(\'view\', keep_items={\'portal_status_message\':context.Base_translateString(\'No Consumption Report for this computer.\')})\n
]]>
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/ComputerConsumptionTioXMLFile_solveInvoicingGeneration.py
0 → 100644
View file @
43b65274
from
zExceptions
import
Unauthorized
if
REQUEST
is
not
None
:
raise
Unauthorized
document
=
context
portal
=
document
.
getPortalObject
()
result
=
[]
if
context
.
getValidationState
()
in
[
"cancelled"
,
"shared"
]:
return
try
:
tioxml_dict
=
document
.
ComputerConsumptionTioXMLFile_parseXml
()
except
KeyError
:
document
.
reject
(
comment
=
"Fail"
)
return
if
tioxml_dict
is
None
:
document
.
reject
(
comment
=
"Not usable TioXML data"
)
else
:
computer
=
context
.
getContributorValue
(
portal_type
=
"Computer"
)
delivery_title
=
tioxml_dict
[
'title'
]
movement_list
=
[]
for
movement
in
tioxml_dict
[
"movement"
]:
reference
=
movement
[
'reference'
]
# It had been reported for the computer itself so it is pure
# informative.
if
computer
.
getReference
()
==
reference
:
aggregate_value_list
=
[
computer
]
person
=
computer
.
getSourceAdministrationValue
(
portal_type
=
"Person"
)
else
:
if
reference
.
startswith
(
"slapuser"
):
reference
=
reference
.
replace
(
"slapuser"
,
"slappart"
)
# Find the partition / software instance / user
partition
=
portal
.
portal_catalog
.
getResultValue
(
parent_uid
=
computer
.
getUid
(),
reference
=
reference
,
portal_type
=
"Computer Partition"
,
validation_state
=
"validated"
)
if
partition
.
getSlapState
()
!=
'busy'
:
continue
assert
partition
.
getSlapState
()
==
'busy'
,
"partition %s is not busy"
%
reference
instance
=
portal
.
portal_catalog
.
getResultValue
(
default_aggregate_uid
=
partition
.
getUid
(),
portal_type
=
"Software Instance"
,
validation_state
=
"validated"
)
if
instance
is
None
:
# There is no software instance for this partition anymore
# so we just skip this partial consumption.
continue
subscription
=
instance
.
getSpecialiseValue
(
portal_type
=
"Hosting Subscription"
)
try
:
person
=
subscription
.
getDestinationSectionValue
(
portal_type
=
"Person"
)
except
:
raise
ValueError
(
instance
.
getRelativeUrl
())
aggregate_value_list
=
[
partition
,
instance
,
subscription
]
movement_list
.
append
(
dict
(
title
=
movement
[
'title'
],
quantity
=
movement
[
'quantity'
],
aggregate_value_list
=
aggregate_value_list
,
resource
=
movement
[
'resource'
],
person
=
person
.
getRelativeUrl
()
)
)
# Time to create the PL
person
=
computer
.
getSourceAdministrationValue
(
portal_type
=
"Person"
)
delivery_template
=
portal
.
restrictedTraverse
(
portal
.
portal_preferences
.
getPreferredInstanceDeliveryTemplate
())
delivery
=
delivery_template
.
Base_createCloneDocument
(
batch_mode
=
1
)
delivery
.
edit
(
title
=
delivery_title
,
destination
=
person
.
getRelativeUrl
(),
destination_decision
=
person
.
getRelativeUrl
(),
start_date
=
context
.
getCreationDate
(),
)
for
movement
in
movement_list
:
service
=
portal
.
restrictedTraverse
(
movement
[
'resource'
])
delivery
.
newContent
(
portal_type
=
"Sale Packing List Line"
,
title
=
movement
[
'title'
],
quantity
=
movement
[
'quantity'
],
aggregate_value_list
=
movement
[
'aggregate_value_list'
],
destination
=
movement
[
'person'
],
destination_decision
=
movement
[
'person'
],
destination_section
=
movement
[
'person'
],
resource_value
=
service
,
quantity_unit
=
service
.
getQuantityUnit
(),
)
delivery
.
confirm
(
comment
=
"Created from %s"
%
context
.
getRelativeUrl
())
delivery
.
start
()
delivery
.
stop
()
delivery
.
deliver
()
delivery
.
startBuilding
()
result
.
append
(
delivery
.
getRelativeUrl
())
document
.
share
(
comment
=
"Created packing list: %s"
%
result
)
return
result
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/ComputerConsumptionTioXMLFile_solveInvoicingGeneration.xml
View file @
43b65274
...
...
@@ -48,124 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
from zExceptions import Unauthorized\n
if REQUEST is not None:\n
raise Unauthorized\n
\n
document = context\n
portal = document.getPortalObject()\n
result = []\n
\n
if context.getValidationState() in ["cancelled", "shared"]:\n
return\n
\n
try:\n
tioxml_dict = document.ComputerConsumptionTioXMLFile_parseXml()\n
except KeyError:\n
document.reject(comment="Fail")\n
return \n
\n
if tioxml_dict is None:\n
document.reject(comment="Not usable TioXML data")\n
else:\n
\n
computer = context.getContributorValue(portal_type="Computer")\n
delivery_title = tioxml_dict[\'title\']\n
\n
movement_list = []\n
for movement in tioxml_dict["movement"]:\n
reference = movement[\'reference\']\n
\n
# It had been reported for the computer itself so it is pure\n
# informative.\n
if computer.getReference() == reference:\n
aggregate_value_list = [computer]\n
person = computer.getSourceAdministrationValue(portal_type="Person")\n
else:\n
if reference.startswith("slapuser"):\n
reference = reference.replace("slapuser", "slappart") \n
# Find the partition / software instance / user\n
partition = portal.portal_catalog.getResultValue(\n
parent_uid=computer.getUid(),\n
reference=reference,\n
portal_type="Computer Partition",\n
validation_state="validated")\n
\n
if partition.getSlapState() != \'busy\':\n
continue\n
\n
assert partition.getSlapState() == \'busy\', "partition %s is not busy" % reference\n
\n
instance = portal.portal_catalog.getResultValue(\n
default_aggregate_uid=partition.getUid(),\n
portal_type="Software Instance",\n
validation_state="validated")\n
\n
if instance is None:\n
# There is no software instance for this partition anymore\n
# so we just skip this partial consumption.\n
continue\n
\n
subscription = instance.getSpecialiseValue(\n
portal_type="Hosting Subscription")\n
\n
try:\n
person = subscription.getDestinationSectionValue(\n
portal_type="Person")\n
except:\n
raise ValueError(instance.getRelativeUrl())\n
\n
aggregate_value_list = [partition, instance, subscription]\n
\n
movement_list.append(dict(\n
title=movement[\'title\'],\n
quantity=movement[\'quantity\'],\n
aggregate_value_list=aggregate_value_list,\n
resource=movement[\'resource\'],\n
person=person.getRelativeUrl()\n
)\n
)\n
\n
# Time to create the PL\n
person = computer.getSourceAdministrationValue(portal_type="Person")\n
delivery_template = portal.restrictedTraverse(\n
portal.portal_preferences.getPreferredInstanceDeliveryTemplate())\n
delivery = delivery_template.Base_createCloneDocument(batch_mode=1)\n
\n
delivery.edit(\n
title=delivery_title,\n
destination=person.getRelativeUrl(),\n
destination_decision=person.getRelativeUrl(),\n
start_date=context.getCreationDate(),\n
)\n
\n
for movement in movement_list:\n
service = portal.restrictedTraverse(movement[\'resource\'])\n
delivery.newContent(\n
portal_type="Sale Packing List Line",\n
title=movement[\'title\'],\n
quantity=movement[\'quantity\'],\n
aggregate_value_list=movement[\'aggregate_value_list\'],\n
destination=movement[\'person\'],\n
destination_decision=movement[\'person\'],\n
destination_section=movement[\'person\'],\n
resource_value=service,\n
quantity_unit=service.getQuantityUnit(),\n
)\n
delivery.confirm(comment="Created from %s" % context.getRelativeUrl())\n
delivery.start()\n
delivery.stop()\n
delivery.deliver()\n
delivery.startBuilding()\n
\n
result.append(delivery.getRelativeUrl())\n
document.share(comment="Created packing list: %s" % result)\n
\n
return result\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
REQUEST=None
</string>
</value>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/Computer_reportComputerConsumption.py
0 → 100644
View file @
43b65274
from
zExceptions
import
Unauthorized
if
REQUEST
is
not
None
:
raise
Unauthorized
portal
=
context
.
getPortalObject
()
computer
=
context
reference
=
"TIOCONS-%s-%s"
%
(
computer
.
getReference
(),
source_reference
)
version
=
"%s"
%
context
.
getPortalObject
().
portal_ids
.
generateNewId
(
id_group
=
(
'slap_tioxml_consumption_reference'
,
reference
),
default
=
1
)
document
=
portal
.
consumption_document_module
.
newContent
(
portal_type
=
"Computer Consumption TioXML File"
,
source_reference
=
source_reference
,
title
=
"%s consumption (%s)"
%
(
computer
.
getReference
(),
source_reference
),
reference
=
reference
,
version
=
version
,
data
=
consumption_xml
,
classification
=
"personal"
,
publication_section
=
"other"
,
contributor_value
=
computer
,
)
document
.
submit
()
return
document
.
getRelativeUrl
()
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/Computer_reportComputerConsumption.xml
View file @
43b65274
...
...
@@ -48,34 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
from zExceptions import Unauthorized\n
if REQUEST is not None:\n
raise Unauthorized\n
\n
portal = context.getPortalObject()\n
computer = context\n
\n
reference = "TIOCONS-%s-%s" % (computer.getReference(), source_reference)\n
version = "%s" % context.getPortalObject().portal_ids.generateNewId(\n
id_group=(\'slap_tioxml_consumption_reference\', reference), default=1)\n
\n
document = portal.consumption_document_module.newContent(\n
portal_type="Computer Consumption TioXML File",\n
source_reference=source_reference,\n
title="%s consumption (%s)" % (computer.getReference(), source_reference),\n
reference=reference,\n
version=version,\n
data=consumption_xml,\n
classification="personal",\n
publication_section="other",\n
contributor_value=computer,\n
)\n
document.submit()\n
return document.getRelativeUrl()\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
source_reference, consumption_xml, REQUEST=None
</string>
</value>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/HostingSubscription_getCPUStat.py
0 → 100644
View file @
43b65274
resource_uid
=
context
.
service_module
.
cpu_load_percent
.
getUid
()
return
context
.
HostingSubscription_getStatForResource
(
resource_uid
,
**
kw
)
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/HostingSubscription_getCPUStat.xml
View file @
43b65274
...
...
@@ -48,13 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
resource_uid = context.service_module.cpu_load_percent.getUid()\n
\n
return context.HostingSubscription_getStatForResource(resource_uid, **kw)\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
**kw
</string>
</value>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/HostingSubscription_getDiskStat.py
0 → 100644
View file @
43b65274
resource_uid
=
context
.
service_module
.
disk_used
.
getUid
()
return
context
.
HostingSubscription_getStatForResource
(
resource_uid
,
**
kw
)
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/HostingSubscription_getDiskStat.xml
View file @
43b65274
...
...
@@ -48,13 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
resource_uid = context.service_module.disk_used.getUid()\n
\n
return context.HostingSubscription_getStatForResource(resource_uid, **kw)\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
**kw
</string>
</value>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/HostingSubscription_getMemoryStat.py
0 → 100644
View file @
43b65274
resource_uid
=
context
.
service_module
.
memory_used
.
getUid
()
return
context
.
HostingSubscription_getStatForResource
(
resource_uid
,
**
kw
)
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/HostingSubscription_getMemoryStat.xml
View file @
43b65274
...
...
@@ -48,13 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
resource_uid = context.service_module.memory_used.getUid()\n
\n
return context.HostingSubscription_getStatForResource(resource_uid, **kw)\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
**kw
</string>
</value>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/HostingSubscription_getResourceConsumptionDetailList.py
0 → 100644
View file @
43b65274
from
DateTime
import
DateTime
from
Products.ZSQLCatalog.SQLCatalog
import
Query
from
Products.ERP5Type.Document
import
newTempDocument
portal
=
context
.
getPortalObject
()
start_date
=
query_kw
.
pop
(
'start_date'
,
None
)
stop_date
=
query_kw
.
pop
(
'stop_date'
,
None
)
software_instance_uid
=
query_kw
.
pop
(
'software_instance'
,
None
)
hosting_subscription_uid
=
query_kw
.
pop
(
'hosting_subscription_uid'
,
None
)
resource_uid
=
query_kw
.
pop
(
'resource_service'
,
None
)
comparison_operator
=
query_kw
.
pop
(
'resource_operator'
,
None
)
resource_value
=
query_kw
.
pop
(
'resource_value'
,
None
)
if
not
software_instance_uid
and
not
hosting_subscription_uid
:
return
[]
if
start_date
:
query_kw
[
'movement.start_date'
]
=
dict
(
range
=
'min'
,
query
=
start_date
)
if
stop_date
:
query_kw
[
'movement.stop_date'
]
=
dict
(
range
=
'ngt'
,
query
=
stop_date
.
latestTime
())
if
software_instance_uid
and
software_instance_uid
!=
'all'
:
query_kw
[
'aggregate_uid'
]
=
software_instance_uid
elif
hosting_subscription_uid
and
hosting_subscription_uid
!=
'all'
:
query_kw
[
'aggregate_uid'
]
=
hosting_subscription_uid
elif
context
.
getPortalType
()
==
'Person'
:
validation_state
=
query_kw
.
pop
(
'hosting_validation_state'
,
None
)
hosting_uid_list
=
[]
for
subscription
in
portal
.
portal_catalog
(
portal_type
=
'Hosting Subscription'
,
validation_state
=
validation_state
,
default_destination_section_uid
=
context
.
getUid
()):
if
validation_state
==
'validated'
and
subscription
.
getSlapState
()
==
'destroy_requested'
:
continue
if
validation_state
==
'archived'
and
subscription
.
getSlapState
()
!=
'destroy_requested'
:
continue
hosting_uid_list
.
append
(
subscription
.
getUid
())
if
hosting_uid_list
:
query_kw
[
'aggregate_uid'
]
=
hosting_uid_list
else
:
return
[]
elif
context
.
getPortalType
()
in
[
'Software Instance'
,
'Hosting Subscription'
,
'Computer'
]:
query_kw
[
'aggregate_uid'
]
=
context
.
getUid
()
else
:
return
[]
cpu_resource_uid
=
context
.
service_module
.
cpu_load_percent
.
getUid
()
memory_resource_uid
=
context
.
service_module
.
memory_used
.
getUid
()
disk_resource_uid
=
context
.
service_module
.
disk_used
.
getUid
()
resource_uid_list
=
[
cpu_resource_uid
,
memory_resource_uid
,
disk_resource_uid
]
if
resource_uid
and
comparison_operator
and
resource_value
:
resource_uid_list
=
[
resource_uid
]
query_kw
[
'quantity'
]
=
dict
(
quantity
=
resource_value
,
range
=
comparison_operator
)
consumption_dict
=
{}
def
getPackingListLineForResource
(
resource_uid_list
):
return
portal
.
portal_catalog
(
portal_type
=
"Sale Packing List Line"
,
default_resource_uid
=
resource_uid_list
,
**
query_kw
)
def
setDetailLine
(
packing_list_line
):
start_date
=
DateTime
(
packing_list_line
.
getStartDate
()).
strftime
(
'%Y/%m/%d'
)
hosting_s
=
packing_list_line
.
getAggregateValue
(
portal_type
=
'Hosting Subscription'
)
software_instance
=
packing_list_line
.
getAggregateValue
(
portal_type
=
'Software Instance'
)
computer_partition
=
packing_list_line
.
getAggregateValue
(
portal_type
=
'Computer Partition'
)
if
software_instance
is
None
:
# In case we found SPL line not aggregated to instance and hosting
return
hosting_reference
=
hosting_s
.
getReference
()
instance_reference
=
software_instance
.
getReference
()
computer_title
=
""
if
computer_partition
is
not
None
:
computer
=
computer_partition
.
getParent
()
computer_title
=
computer
.
getTitle
()
if
computer
.
getCpuCore
()
is
None
else
'%s (%s CPU Cores)'
%
(
computer
.
getTitle
(),
computer
.
getCpuCore
())
#default_line = {'date': {'hosting_ref': ['hs_title', {'instance_ref': ['inst_title', ['res1', 'res2', 'resN'] ] } ] } }
if
not
start_date
in
consumption_dict
:
# Add new date line
consumption_dict
[
start_date
]
=
{
hosting_reference
:
[
hosting_s
.
getTitle
(),
{
instance_reference
:
[
software_instance
.
getTitle
(),
[
0.0
,
0.0
,
0.0
],
software_instance
.
getRelativeUrl
(),
computer_title
]
},
hosting_s
.
getRelativeUrl
()
]
}
# Add new Hosting line
if
not
hosting_reference
in
consumption_dict
[
start_date
]:
consumption_dict
[
start_date
][
hosting_reference
]
=
[
hosting_s
.
getTitle
(),
{
instance_reference
:
[
software_instance
.
getTitle
(),
[
0.0
,
0.0
,
0.0
],
software_instance
.
getRelativeUrl
(),
computer_title
]
},
hosting_s
.
getRelativeUrl
()
]
# Add new instance line
if
not
instance_reference
in
consumption_dict
[
start_date
][
hosting_reference
][
1
]:
consumption_dict
[
start_date
][
hosting_reference
][
1
][
instance_reference
]
=
[
software_instance
.
getTitle
(),
[
0.0
,
0.0
,
0.0
],
software_instance
.
getRelativeUrl
(),
computer_title
]
if
packing_list_line
.
getResourceUid
()
==
cpu_resource_uid
:
quantity
=
round
(
float
(
packing_list_line
.
getQuantity
()),
3
)
consumption_dict
[
start_date
][
hosting_reference
][
1
][
instance_reference
][
1
][
0
]
=
quantity
elif
packing_list_line
.
getResourceUid
()
==
memory_resource_uid
:
quantity
=
round
(
float
(
packing_list_line
.
getQuantity
()),
3
)
consumption_dict
[
start_date
][
hosting_reference
][
1
][
instance_reference
][
1
][
1
]
=
quantity
elif
packing_list_line
.
getResourceUid
()
==
disk_resource_uid
:
quantity
=
round
(
float
(
packing_list_line
.
getQuantity
()),
3
)
consumption_dict
[
start_date
][
hosting_reference
][
1
][
instance_reference
][
1
][
2
]
=
quantity
# Add CPU_LOAD consumption details
for
packing_list_line
in
getPackingListLineForResource
(
resource_uid_list
):
setDetailLine
(
packing_list_line
)
consumption_list
=
[]
i
=
1
# Sort on movement.start_date in catalog doesn't work !
for
date
in
sorted
(
consumption_dict
,
reverse
=
True
):
for
hosting_key
in
sorted
(
consumption_dict
[
date
]):
hosting_title
,
instance_dict
,
hs_url
=
consumption_dict
[
date
][
hosting_key
]
for
instance_value_list
in
instance_dict
.
values
():
instance_title
,
values
,
instance_url
,
computer_title
=
instance_value_list
line
=
newTempDocument
(
portal
,
instance_url
,
uid
=
"%s_%s"
%
(
context
.
getUid
(),
i
))
line
.
edit
(
title
=
hosting_title
,
start_date
=
date
,
instance_title
=
instance_title
,
cpu_load
=
values
[
0
],
memory_used
=
values
[
1
],
disk_used
=
values
[
2
],
computer_title
=
computer_title
,
hosting_url
=
hs_url
,
instance_url
=
instance_url
)
consumption_list
.
append
(
line
)
i
+=
1
return
consumption_list
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/HostingSubscription_getResourceConsumptionDetailList.xml
View file @
43b65274
...
...
@@ -48,164 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
from DateTime import DateTime\n
from Products.ZSQLCatalog.SQLCatalog import Query\n
from Products.ERP5Type.Document import newTempDocument\n
\n
portal = context.getPortalObject()\n
\n
start_date = query_kw.pop(\'start_date\', None)\n
stop_date = query_kw.pop(\'stop_date\', None)\n
software_instance_uid = query_kw.pop(\'software_instance\', None)\n
hosting_subscription_uid = query_kw.pop(\'hosting_subscription_uid\', None)\n
resource_uid = query_kw.pop(\'resource_service\', None)\n
comparison_operator = query_kw.pop(\'resource_operator\', None)\n
resource_value = query_kw.pop(\'resource_value\', None)\n
\n
if not software_instance_uid and not hosting_subscription_uid:\n
return []\n
\n
if start_date:\n
query_kw[\'movement.start_date\'] = dict(range=\'min\', query=start_date)\n
if stop_date:\n
query_kw[\'movement.stop_date\'] = dict(range=\'ngt\', \n
query=stop_date.latestTime())\n
\n
if software_instance_uid and software_instance_uid != \'all\':\n
query_kw[\'aggregate_uid\'] = software_instance_uid\n
elif hosting_subscription_uid and hosting_subscription_uid != \'all\':\n
query_kw[\'aggregate_uid\'] = hosting_subscription_uid\n
elif context.getPortalType() == \'Person\':\n
validation_state = query_kw.pop(\'hosting_validation_state\', None)\n
hosting_uid_list = []\n
for subscription in portal.portal_catalog(\n
portal_type=\'Hosting Subscription\',\n
validation_state=validation_state,\n
default_destination_section_uid=context.getUid()):\n
if validation_state == \'validated\' and subscription.getSlapState() == \'destroy_requested\':\n
continue\n
if validation_state == \'archived\' and subscription.getSlapState() != \'destroy_requested\':\n
continue\n
hosting_uid_list.append(subscription.getUid())\n
if hosting_uid_list:\n
query_kw[\'aggregate_uid\'] = hosting_uid_list\n
else:\n
return []\n
elif context.getPortalType() in [\'Software Instance\', \'Hosting Subscription\',\n
\'Computer\']:\n
query_kw[\'aggregate_uid\'] = context.getUid()\n
else:\n
return []\n
\n
cpu_resource_uid = context.service_module.cpu_load_percent.getUid()\n
memory_resource_uid = context.service_module.memory_used.getUid()\n
disk_resource_uid = context.service_module.disk_used.getUid()\n
resource_uid_list = [cpu_resource_uid, memory_resource_uid, disk_resource_uid]\n
if resource_uid and comparison_operator and resource_value:\n
resource_uid_list = [resource_uid]\n
query_kw[\'quantity\'] = dict(quantity=resource_value, range=comparison_operator)\n
\n
consumption_dict = {}\n
\n
def getPackingListLineForResource(resource_uid_list):\n
return portal.portal_catalog(\n
portal_type="Sale Packing List Line",\n
default_resource_uid = resource_uid_list,\n
**query_kw\n
)\n
\n
def setDetailLine(packing_list_line):\n
start_date = DateTime(packing_list_line.getStartDate()).strftime(\'%Y/%m/%d\')\n
hosting_s = packing_list_line.getAggregateValue(\n
portal_type=\'Hosting Subscription\')\n
software_instance = packing_list_line.getAggregateValue(\n
portal_type=\'Software Instance\')\n
computer_partition = packing_list_line.getAggregateValue(\n
portal_type=\'Computer Partition\')\n
if software_instance is None:\n
# In case we found SPL line not aggregated to instance and hosting\n
return\n
hosting_reference = hosting_s.getReference()\n
instance_reference = software_instance.getReference()\n
computer_title = ""\n
if computer_partition is not None:\n
computer = computer_partition.getParent()\n
computer_title = computer.getTitle() if computer.getCpuCore() is None else \'%s (%s CPU Cores)\' % (computer.getTitle(), computer.getCpuCore())\n
#default_line = {\'date\': {\'hosting_ref\': [\'hs_title\', {\'instance_ref\': [\'inst_title\', [\'res1\', \'res2\', \'resN\'] ] } ] } }\n
if not start_date in consumption_dict:\n
# Add new date line\n
consumption_dict[start_date] = {hosting_reference: \n
[hosting_s.getTitle(), \n
{instance_reference: \n
[software_instance.getTitle(), \n
[0.0, 0.0, 0.0],\n
software_instance.getRelativeUrl(),\n
computer_title\n
]\n
},\n
hosting_s.getRelativeUrl()\n
]\n
}\n
# Add new Hosting line\n
if not hosting_reference in consumption_dict[start_date]:\n
consumption_dict[start_date][hosting_reference] = [hosting_s.getTitle(),\n
{instance_reference: \n
[software_instance.getTitle(), \n
[0.0, 0.0, 0.0],\n
software_instance.getRelativeUrl(),\n
computer_title\n
]\n
},\n
hosting_s.getRelativeUrl()\n
]\n
# Add new instance line\n
if not instance_reference in consumption_dict[start_date][hosting_reference][1]:\n
consumption_dict[start_date][hosting_reference][1][instance_reference] = [\n
software_instance.getTitle(), [0.0, 0.0, 0.0], software_instance.getRelativeUrl(),\n
computer_title\n
]\n
if packing_list_line.getResourceUid() == cpu_resource_uid:\n
quantity = round(float(packing_list_line.getQuantity()), 3)\n
consumption_dict[start_date][hosting_reference][1][instance_reference][1][0] = quantity\n
elif packing_list_line.getResourceUid() == memory_resource_uid:\n
quantity = round( float(packing_list_line.getQuantity()), 3)\n
consumption_dict[start_date][hosting_reference][1][instance_reference][1][1] = quantity\n
elif packing_list_line.getResourceUid() == disk_resource_uid:\n
quantity = round( float(packing_list_line.getQuantity()), 3)\n
consumption_dict[start_date][hosting_reference][1][instance_reference][1][2] = quantity\n
\n
# Add CPU_LOAD consumption details\n
for packing_list_line in getPackingListLineForResource(resource_uid_list):\n
setDetailLine(packing_list_line)\n
\n
consumption_list = []\n
i = 1\n
# Sort on movement.start_date in catalog doesn\'t work !\n
for date in sorted(consumption_dict, reverse=True):\n
for hosting_key in sorted(consumption_dict[date]):\n
hosting_title, instance_dict, hs_url = consumption_dict[date][hosting_key]\n
for instance_value_list in instance_dict.values():\n
instance_title, values, instance_url, computer_title = instance_value_list\n
line = newTempDocument(portal, instance_url, uid="%s_%s" % (context.getUid(), i))\n
line.edit(\n
title=hosting_title,\n
start_date=date,\n
instance_title=instance_title,\n
cpu_load=values[0],\n
memory_used=values[1],\n
disk_used=values[2],\n
computer_title=computer_title,\n
hosting_url=hs_url,\n
instance_url=instance_url\n
)\n
consumption_list.append(line)\n
i += 1\n
\n
return consumption_list\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
**query_kw
</string>
</value>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/HostingSubscription_getStatForResource.py
0 → 100644
View file @
43b65274
from
Products.ZSQLCatalog.SQLCatalog
import
Query
portal
=
context
.
getPortalObject
()
query_kw
.
update
(
query_kw
[
'selection'
].
getParams
())
start_date
=
query_kw
.
pop
(
'start_date'
,
None
)
stop_date
=
query_kw
.
pop
(
'stop_date'
,
None
)
software_instance_uid
=
query_kw
.
pop
(
'software_instance'
,
None
)
hosting_subscription_uid
=
query_kw
.
pop
(
'hosting_subscription_uid'
,
None
)
if
not
software_instance_uid
and
not
hosting_subscription_uid
:
return
''
if
start_date
:
query_kw
[
'movement.start_date'
]
=
dict
(
range
=
'min'
,
query
=
start_date
)
if
stop_date
:
query_kw
[
'movement.stop_date'
]
=
dict
(
range
=
'ngt'
,
query
=
stop_date
.
latestTime
())
if
software_instance_uid
and
software_instance_uid
!=
'all'
:
query_kw
[
'aggregate_uid'
]
=
software_instance_uid
elif
hosting_subscription_uid
and
hosting_subscription_uid
!=
'all'
:
query_kw
[
'aggregate_uid'
]
=
hosting_subscription_uid
elif
context
.
getPortalType
()
==
'Person'
:
validation_state
=
query_kw
.
pop
(
'hosting_validation_state'
,
'validated'
)
hosting_uid_list
=
[]
for
subscription
in
portal
.
portal_catalog
(
portal_type
=
'Hosting Subscription'
,
validation_state
=
validation_state
,
default_destination_section_uid
=
context
.
getUid
()):
if
validation_state
==
'validated'
and
subscription
.
getSlapState
()
==
'destroy_requested'
:
continue
if
validation_state
==
'archived'
and
subscription
.
getSlapState
()
!=
'destroy_requested'
:
continue
hosting_uid_list
.
append
(
subscription
.
getUid
())
if
hosting_uid_list
:
query_kw
[
'aggregate_uid'
]
=
hosting_uid_list
else
:
return
''
elif
context
.
getPortalType
()
in
[
'Software Instance'
,
'Hosting Subscription'
]:
query_kw
[
'aggregate_uid'
]
=
context
.
getUid
()
else
:
return
''
total_quantity
=
0
for
packing_list_line
in
portal
.
portal_catalog
(
portal_type
=
"Sale Packing List Line"
,
default_resource_uid
=
resource_uid
,
**
query_kw
):
total_quantity
+=
float
(
packing_list_line
.
getQuantity
())
return
round
(
total_quantity
,
3
)
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/HostingSubscription_getStatForResource.xml
View file @
43b65274
...
...
@@ -48,62 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
from Products.ZSQLCatalog.SQLCatalog import Query\n
portal = context.getPortalObject()\n
\n
query_kw.update(query_kw[\'selection\'].getParams())\n
start_date = query_kw.pop(\'start_date\', None)\n
stop_date = query_kw.pop(\'stop_date\', None)\n
software_instance_uid = query_kw.pop(\'software_instance\', None)\n
hosting_subscription_uid = query_kw.pop(\'hosting_subscription_uid\', None)\n
\n
if not software_instance_uid and not hosting_subscription_uid:\n
return \'\'\n
\n
if start_date:\n
query_kw[\'movement.start_date\'] = dict(range=\'min\', query=start_date)\n
if stop_date:\n
query_kw[\'movement.stop_date\'] = dict(range=\'ngt\', \n
query=stop_date.latestTime())\n
\n
if software_instance_uid and software_instance_uid != \'all\':\n
query_kw[\'aggregate_uid\'] = software_instance_uid\n
elif hosting_subscription_uid and hosting_subscription_uid != \'all\':\n
query_kw[\'aggregate_uid\'] = hosting_subscription_uid\n
elif context.getPortalType() == \'Person\':\n
validation_state = query_kw.pop(\'hosting_validation_state\', \'validated\')\n
hosting_uid_list = []\n
for subscription in portal.portal_catalog(\n
portal_type=\'Hosting Subscription\',\n
validation_state=validation_state,\n
default_destination_section_uid=context.getUid()):\n
if validation_state == \'validated\' and subscription.getSlapState() == \'destroy_requested\':\n
continue\n
if validation_state == \'archived\' and subscription.getSlapState() != \'destroy_requested\':\n
continue\n
hosting_uid_list.append(subscription.getUid())\n
if hosting_uid_list:\n
query_kw[\'aggregate_uid\'] = hosting_uid_list\n
else:\n
return \'\'\n
elif context.getPortalType() in [\'Software Instance\', \'Hosting Subscription\']:\n
query_kw[\'aggregate_uid\'] = context.getUid()\n
else:\n
return \'\'\n
\n
total_quantity = 0\n
for packing_list_line in portal.portal_catalog(\n
portal_type="Sale Packing List Line",\n
default_resource_uid = resource_uid,\n
**query_kw\n
):\n
total_quantity += float(packing_list_line.getQuantity())\n
\n
return round(total_quantity, 3)\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
resource_uid, **query_kw
</string>
</value>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/SaleInvoiceTransaction_generateResourceConsumptionDocument.py
0 → 100644
View file @
43b65274
portal
=
context
.
getPortalObject
()
invoice
=
context
document
=
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
"User Consumption HTML File"
,
validation_state
=
"shared"
,
follow_up_uid
=
invoice
.
getUid
()
)
if
document
is
None
:
document
=
portal
.
consumption_document_module
.
newContent
(
portal_type
=
"User Consumption HTML File"
,
title
=
"Invoice Resource Comsuption %s"
%
invoice
.
getTitle
(),
reference
=
"INVOICE-RC-%s"
%
invoice
.
getReference
(),
classification
=
"personal/private"
,
data
=
invoice
.
SaleInvoiceTransaction_getPrintoutResourceContent
(),
publication_section
=
"other"
,
contributor_value
=
invoice
.
getDestination
(),
follow_up
=
invoice
.
getRelativeUrl
()
)
document
.
submit
()
document
.
share
()
return
document
.
getRelativeUrl
()
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/SaleInvoiceTransaction_generateResourceConsumptionDocument.xml
View file @
43b65274
...
...
@@ -48,34 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
portal = context.getPortalObject()\n
invoice = context\n
document = portal.portal_catalog.getResultValue(\n
portal_type="User Consumption HTML File",\n
validation_state="shared",\n
follow_up_uid=invoice.getUid()\n
)\n
\n
if document is None:\n
document = portal.consumption_document_module.newContent(\n
portal_type="User Consumption HTML File",\n
title="Invoice Resource Comsuption %s" % invoice.getTitle(),\n
reference="INVOICE-RC-%s" % invoice.getReference(),\n
classification="personal/private",\n
data=invoice.SaleInvoiceTransaction_getPrintoutResourceContent(),\n
publication_section="other",\n
contributor_value=invoice.getDestination(),\n
follow_up=invoice.getRelativeUrl()\n
)\n
\n
document.submit()\n
document.share()\n
\n
return document.getRelativeUrl()\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/SaleInvoiceTransaction_getPrintoutResourceContent.xml
View file @
43b65274
...
...
@@ -38,46 +38,6 @@
<tuple/>
</value>
</item>
<item>
<key>
<string>
_text
</string>
</key>
<value>
<unicode
encoding=
"cdata"
>
<![CDATA[
<tal:block tal:define="aggregated_reference python: context.getCausalityReference(portal_type=\'Sale Packing List\', checked_permission=\'View\');\n
quantity_renderer nocall:here/portal_skins/erp5_trade/Base_viewTradeFieldLibrary/my_view_mode_quantity/render_pdf;\n
resource_details_list python: context.Base_getUserConsumptionDetailList(aggregated_reference)">
\n
<aside
tal:define=
"global index python: 0; page_limit python: 36;"
\n
tal:condition=
"python: aggregated_reference and resource_details_list"
class=
"ressource"
>
\n
<h1><span>
Resource Consumption Details
</span></h1>
\n
<table
class=
"resource"
>
\n
<thead>
\n
<tr>
\n
<th><span>
N
°
</span></th>
\n
<th><span>
Date
</span></th>
\n
<th><span>
Hosting Subscription
</span></th>
\n
<th><span>
Instance Name
</span></th>
\n
<th><span>
CPU Load
</span></th>
\n
<th><span>
Memory Used
</span></th>
\n
</tr>
\n
</thead>
\n
<tbody>
\n
<tal:block
tal:repeat=
"item_list python: resource_details_list"
>
\n
<tal:block
tal:define=
"global index python: index + 1"
></tal:block>
\n
<tr
tal:attributes=
"class python: \'page-break\' if (index % page_limit) == 0 else \'\'"
>
\n
<td
tal:content=
"python: index"
></td>
\n
<td
tal:content=
"python: item_list[0]"
></td>
\n
<td
tal:content=
"python: item_list[1]"
></td>
\n
<td
tal:content=
"python: item_list[2]"
></td>
\n
<td
tal:content=
"python: quantity_renderer(item_list[3]) + \' %\'"
></td>
\n
<td
tal:content=
"python: quantity_renderer(item_list[4]) + \' GB\'"
></td>
\n
</tr>
\n
</tal:block>
\n
</tbody>
\n
</table>
\n
</aside>
\n
</tal:block>
]]>
</unicode>
</value>
</item>
<item>
<key>
<string>
content_type
</string>
</key>
<value>
<string>
text/html
</string>
</value>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/SaleInvoiceTransaction_getPrintoutResourceContent.zpt
0 → 100644
View file @
43b65274
<tal:block tal:define="aggregated_reference python: context.getCausalityReference(portal_type='Sale Packing List', checked_permission='View');
quantity_renderer nocall:here/portal_skins/erp5_trade/Base_viewTradeFieldLibrary/my_view_mode_quantity/render_pdf;
resource_details_list python: context.Base_getUserConsumptionDetailList(aggregated_reference)">
<aside tal:define="global index python: 0; page_limit python: 36;"
tal:condition="python: aggregated_reference and resource_details_list" class="ressource">
<h1><span>Resource Consumption Details</span></h1>
<table class="resource">
<thead>
<tr>
<th><span>N°</span></th>
<th><span>Date</span></th>
<th><span>Hosting Subscription</span></th>
<th><span>Instance Name</span></th>
<th><span>CPU Load</span></th>
<th><span>Memory Used</span></th>
</tr>
</thead>
<tbody>
<tal:block tal:repeat="item_list python: resource_details_list">
<tal:block tal:define="global index python: index + 1"></tal:block>
<tr tal:attributes="class python: 'page-break' if (index % page_limit) == 0 else ''">
<td tal:content="python: index"></td>
<td tal:content="python: item_list[0]"></td>
<td tal:content="python: item_list[1]"></td>
<td tal:content="python: item_list[2]"></td>
<td tal:content="python: quantity_renderer(item_list[3]) + ' %'"></td>
<td tal:content="python: quantity_renderer(item_list[4]) + ' GB'"></td>
</tr>
</tal:block>
</tbody>
</table>
</aside>
</tal:block>
\ No newline at end of file
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_contract/Alarm_requestValidationPayment.py
0 → 100644
View file @
43b65274
portal
=
context
.
getPortalObject
()
select_dict
=
{
'default_aggregate_uid'
:
None
}
portal
.
portal_catalog
.
searchAndActivate
(
portal_type
=
(
'Slave Instance'
,
'Software Instance'
),
validation_state
=
'validated'
,
default_aggregate_uid
=
None
,
select_dict
=
select_dict
,
left_join_list
=
select_dict
.
keys
(),
method_id
=
'SoftwareInstance_requestValidationPayment'
,
packet_size
=
1
,
# Separate calls to many transactions
activate_kw
=
{
'tag'
:
tag
}
)
context
.
activate
(
after_tag
=
tag
).
getId
()
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_contract/Alarm_requestValidationPayment.xml
View file @
43b65274
...
...
@@ -48,25 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
portal = context.getPortalObject()\n
select_dict= {\'default_aggregate_uid\': None}\n
portal.portal_catalog.searchAndActivate(\n
portal_type=(\'Slave Instance\', \'Software Instance\'),\n
validation_state=\'validated\',\n
default_aggregate_uid=None,\n
select_dict=select_dict,\n
left_join_list=select_dict.keys(),\n
\n
method_id=\'SoftwareInstance_requestValidationPayment\',\n
packet_size=1, # Separate calls to many transactions\n
activate_kw={\'tag\': tag}\n
)\n
\n
context.activate(after_tag=tag).getId()\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
tag, fixit, params
</string>
</value>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_contract/Person_isAllowedToAllocate.py
0 → 100644
View file @
43b65274
portal
=
context
.
getPortalObject
()
person
=
context
contract_portal_type
=
"Cloud Contract"
contract
=
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
contract_portal_type
,
default_destination_section_uid
=
person
.
getUid
(),
validation_state
=
'validated'
,
)
if
(
contract
is
not
None
)
and
(
contract
.
getValidationState
()
==
"validated"
):
return
True
else
:
return
False
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_contract/Person_isAllowedToAllocate.xml
View file @
43b65274
...
...
@@ -48,24 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
portal = context.getPortalObject()\n
person = context\n
contract_portal_type = "Cloud Contract"\n
\n
contract = portal.portal_catalog.getResultValue(\n
portal_type=contract_portal_type,\n
default_destination_section_uid=person.getUid(),\n
validation_state=\'validated\',\n
)\n
\n
if (contract is not None) and (contract.getValidationState() == "validated"):\n
return True\n
else:\n
return False\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_contract/SoftwareInstance_requestValidationPayment.py
0 → 100644
View file @
43b65274
from
zExceptions
import
Unauthorized
if
REQUEST
is
not
None
:
raise
Unauthorized
portal
=
context
.
getPortalObject
()
software_instance
=
context
hosting_subscription
=
software_instance
.
getSpecialiseValue
()
person
=
hosting_subscription
.
getDestinationSectionValue
(
portal_type
=
'Person'
)
payment_portal_type
=
"Payment Transaction"
contract_portal_type
=
"Cloud Contract"
tag
=
"%s_requestValidationPayment_inProgress"
%
person
.
getUid
()
if
(
portal
.
portal_activities
.
countMessageWithTag
(
tag
)
>
0
):
# The cloud contract is already under creation but can not be fetched from catalog
# As it is not possible to fetch informations, it is better to raise an error
return
None
contract
=
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
contract_portal_type
,
default_destination_section_uid
=
person
.
getUid
(),
validation_state
=
[
'invalidated'
,
'validated'
],
)
if
(
contract
is
None
):
# Prevent concurrent transaction to create 2 contracts for the same person
person
.
serialize
()
# Time to create the contract
contract
=
portal
.
cloud_contract_module
.
newContent
(
portal_type
=
contract_portal_type
,
title
=
'Contract for "%s"'
%
person
.
getTitle
(),
destination_section_value
=
person
)
contract
.
validate
(
comment
=
'New automatic contract for %s'
%
context
.
getTitle
())
contract
.
invalidate
(
comment
=
'New automatic contract for %s'
%
context
.
getTitle
())
contract
.
reindexObject
(
activate_kw
=
{
'tag'
:
tag
})
if
(
contract
.
getValidationState
()
==
"invalidated"
):
# Prevent concurrent transaction to create 2 invoices for the same person
person
.
serialize
()
# search if the user already paid anything
payment
=
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
payment_portal_type
,
default_destination_section_uid
=
person
.
getUid
(),
simulation_state
=
[
'stopped'
],
)
if
(
payment
is
None
):
# Manually create an invoice to request payment validation
current_invoice
=
contract
.
getCausalityValue
()
if
current_invoice
is
None
:
# Create the validation invoice
# XXX Hardcoded
invoice_template
=
portal
.
restrictedTraverse
(
"accounting_module/template_contract_sale_invoice_transaction"
)
current_invoice
=
invoice_template
.
Base_createCloneDocument
(
batch_mode
=
1
)
contract
.
edit
(
causality_value
=
current_invoice
)
contract
.
reindexObject
(
activate_kw
=
{
'tag'
:
tag
})
current_invoice
.
edit
(
title
=
"Account validation"
,
source_value
=
person
,
destination_value
=
person
,
destination_section_value
=
person
,
destination_decision_value
=
person
,
start_date
=
DateTime
(),
stop_date
=
None
,
)
comment
=
"Validation invoice for contract %s"
%
contract
.
getRelativeUrl
()
current_invoice
.
plan
(
comment
=
comment
)
current_invoice
.
confirm
(
comment
=
comment
)
current_invoice
.
startBuilding
(
comment
=
comment
)
current_invoice
.
reindexObject
(
activate_kw
=
{
'tag'
:
tag
})
else
:
# Check if the invoice is still ongoing
simulation_state
=
current_invoice
.
getSimulationState
()
if
simulation_state
in
(
"planned"
,
"confirmed"
,
"ordered"
,
"started"
):
# Waiting for payment
result
=
"ongoing"
elif
simulation_state
in
(
"cancelled"
,
"deleted"
,
"draft"
):
result
=
"cancelled"
elif
simulation_state
in
(
"stopped"
,
"delivered"
):
# Invoice is in final state.
paid
=
True
for
line
in
current_invoice
.
getMovementList
(
portal
.
getPortalAccountingMovementTypeList
()):
node_value
=
line
.
getSourceValue
(
portal_type
=
'Account'
)
if
node_value
.
getAccountType
()
==
'asset/receivable'
:
if
not
line
.
hasGroupingReference
():
paid
=
False
break
if
paid
:
result
=
"paid"
else
:
result
=
"ongoing"
else
:
raise
NotImplementedError
,
"Unknow state %s"
%
simulation_state
if
result
in
(
"paid"
,
"cancelled"
):
# Maybe have been paid or not (mirror invoice may have been created)
# Check in next alarm loop for a payment
contract
.
edit
(
causality_value
=
None
)
contract
.
reindexObject
(
activate_kw
=
{
'tag'
:
tag
})
else
:
# Found one payment, the contract can be validated
comment
=
"Contract validated as paid payment %s found"
%
payment
.
getRelativeUrl
()
contract
.
validate
(
comment
=
comment
)
contract
.
reindexObject
(
activate_kw
=
{
'tag'
:
tag
})
return
contract
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_contract/SoftwareInstance_requestValidationPayment.xml
View file @
43b65274
...
...
@@ -48,132 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
from zExceptions import Unauthorized\n
if REQUEST is not None:\n
raise Unauthorized\n
\n
portal = context.getPortalObject()\n
software_instance = context\n
hosting_subscription = software_instance.getSpecialiseValue()\n
person = hosting_subscription.getDestinationSectionValue(portal_type=\'Person\')\n
payment_portal_type = "Payment Transaction"\n
contract_portal_type = "Cloud Contract"\n
\n
tag = "%s_requestValidationPayment_inProgress" % person.getUid()\n
if (portal.portal_activities.countMessageWithTag(tag) >
0):\n
# The cloud contract is already under creation but can not be fetched from catalog\n
# As it is not possible to fetch informations, it is better to raise an error\n
return None\n
\n
contract = portal.portal_catalog.getResultValue(\n
portal_type=contract_portal_type,\n
default_destination_section_uid=person.getUid(),\n
validation_state=[\'invalidated\', \'validated\'],\n
)\n
\n
if (contract is None):\n
# Prevent concurrent transaction to create 2 contracts for the same person\n
person.serialize()\n
\n
# Time to create the contract\n
contract = portal.cloud_contract_module.newContent(\n
portal_type=contract_portal_type,\n
title=\'Contract for "%s"\' % person.getTitle(),\n
destination_section_value=person\n
)\n
contract.validate(comment=\'New automatic contract for %s\' % context.getTitle())\n
contract.invalidate(comment=\'New automatic contract for %s\' % context.getTitle())\n
\n
contract.reindexObject(activate_kw={\'tag\': tag})\n
\n
if (contract.getValidationState() == "invalidated"):\n
# Prevent concurrent transaction to create 2 invoices for the same person\n
person.serialize()\n
\n
# search if the user already paid anything\n
payment = portal.portal_catalog.getResultValue(\n
portal_type=payment_portal_type,\n
default_destination_section_uid=person.getUid(),\n
simulation_state=[\'stopped\'],\n
)\n
\n
if (payment is None):\n
# Manually create an invoice to request payment validation\n
current_invoice = contract.getCausalityValue()\n
\n
if current_invoice is None:\n
# Create the validation invoice\n
# XXX Hardcoded\n
invoice_template = portal.restrictedTraverse("accounting_module/template_contract_sale_invoice_transaction")\n
current_invoice = invoice_template.Base_createCloneDocument(batch_mode=1)\n
contract.edit(causality_value=current_invoice)\n
contract.reindexObject(activate_kw={\'tag\': tag})\n
\n
current_invoice.edit(\n
title="Account validation",\n
source_value=person,\n
destination_value=person,\n
destination_section_value=person,\n
destination_decision_value=person,\n
start_date=DateTime(),\n
stop_date=None,\n
)\n
comment = "Validation invoice for contract %s" % contract.getRelativeUrl()\n
current_invoice.plan(comment=comment)\n
current_invoice.confirm(comment=comment)\n
current_invoice.startBuilding(comment=comment)\n
current_invoice.reindexObject(activate_kw={\'tag\': tag})\n
\n
\n
else:\n
# Check if the invoice is still ongoing\n
simulation_state = current_invoice.getSimulationState() \n
\n
if simulation_state in ("planned", "confirmed", "ordered", "started"):\n
# Waiting for payment\n
result = "ongoing"\n
elif simulation_state in ("cancelled", "deleted", "draft"):\n
result = "cancelled"\n
elif simulation_state in ("stopped", "delivered"):\n
# Invoice is in final state.\n
paid = True\n
for line in current_invoice.getMovementList(portal.getPortalAccountingMovementTypeList()):\n
node_value = line.getSourceValue(portal_type=\'Account\')\n
\n
if node_value.getAccountType() == \'asset/receivable\':\n
if not line.hasGroupingReference():\n
paid = False\n
break\n
\n
if paid:\n
result = "paid"\n
else:\n
result = "ongoing"\n
\n
else:\n
raise NotImplementedError, "Unknow state %s" % simulation_state\n
\n
if result in ("paid", "cancelled"):\n
# Maybe have been paid or not (mirror invoice may have been created)\n
# Check in next alarm loop for a payment\n
contract.edit(causality_value=None)\n
contract.reindexObject(activate_kw={\'tag\': tag})\n
\n
else:\n
# Found one payment, the contract can be validated\n
comment = "Contract validated as paid payment %s found" % payment.getRelativeUrl()\n
contract.validate(comment=comment)\n
contract.reindexObject(activate_kw={\'tag\': tag})\n
\n
return contract\n
]]>
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
REQUEST=None
</string>
</value>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/Alarm_buildSlapOSPath.py
0 → 100644
View file @
43b65274
kw
=
{}
select_dict
=
{
'delivery_uid'
:
None
}
kw
.
update
(
portal_type
=
'Simulation Movement'
,
select_dict
=
select_dict
,
left_join_list
=
select_dict
.
keys
(),
delivery_uid
=
None
)
context
.
getPortalObject
().
portal_catalog
.
searchAndActivate
(
method_id
=
'SimulationMovement_buildSlapOS'
,
packet_size
=
1
,
# Separate calls to many transactions
method_kw
=
{
'tag'
:
tag
},
activate_kw
=
{
'tag'
:
tag
},
**
kw
)
# register activity on alarm object waiting for own tag in order to have only one alarm
# running in same time
context
.
activate
(
after_tag
=
tag
).
getId
()
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/Alarm_buildSlapOSPath.xml
View file @
43b65274
...
...
@@ -48,30 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
kw = {}\n
select_dict= {\'delivery_uid\': None}\n
kw.update(\n
portal_type=\'Simulation Movement\',\n
select_dict=select_dict,\n
left_join_list=select_dict.keys(),\n
delivery_uid=None\n
)\n
\n
context.getPortalObject().portal_catalog.searchAndActivate(\n
method_id=\'SimulationMovement_buildSlapOS\',\n
packet_size=1, # Separate calls to many transactions\n
method_kw={\'tag\': tag},\n
activate_kw={\'tag\': tag},\n
**kw\n
)\n
\n
# register activity on alarm object waiting for own tag in order to have only one alarm\n
# running in same time\n
context.activate(after_tag=tag).getId()\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
tag, fixit, params
</string>
</value>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/Alarm_manageBuildingCalculatingDelivery.py
0 → 100644
View file @
43b65274
portal
=
context
.
getPortalObject
()
activate_kw
=
{
'tag'
:
tag
}
portal
.
portal_catalog
.
searchAndActivate
(
portal_type
=
portal
.
getPortalDeliveryTypeList
(),
causality_state
=
(
'building'
,
'calculating'
),
activate_kw
=
activate_kw
,
method_id
=
'Delivery_manageBuildingCalculatingDelivery'
)
context
.
activate
(
after_tag
=
tag
).
getId
()
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/Alarm_manageBuildingCalculatingDelivery.xml
View file @
43b65274
...
...
@@ -48,21 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
portal = context.getPortalObject()\n
activate_kw = {\n
\'tag\': tag\n
}\n
portal.portal_catalog.searchAndActivate(\n
portal_type=portal.getPortalDeliveryTypeList(),\n
causality_state=(\'building\', \'calculating\'),\n
activate_kw=activate_kw,\n
method_id=\'Delivery_manageBuildingCalculatingDelivery\'\n
)\n
context.activate(after_tag=tag).getId()\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
tag, fixit, params
</string>
</value>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/Alarm_removeBogusDeliveryLink.py
0 → 100644
View file @
43b65274
kw
=
{}
select_dict
=
{
'delivery_uid'
:
None
}
kw
.
update
(
portal_type
=
'Simulation Movement'
,
select_dict
=
select_dict
,
left_join_list
=
select_dict
.
keys
(),
delivery_uid
=
None
)
context
.
getPortalObject
().
portal_catalog
.
searchAndActivate
(
method_id
=
'SimulationMovement_removeBogusDeliveryLink'
,
method_kw
=
{
'tag'
:
tag
},
activate_kw
=
{
'tag'
:
tag
},
**
kw
)
# register activity on alarm object waiting for own tag in order to have only one alarm
# running in same time
context
.
activate
(
after_tag
=
tag
).
getId
()
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/Alarm_removeBogusDeliveryLink.xml
View file @
43b65274
...
...
@@ -48,29 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
kw = {}\n
select_dict= {\'delivery_uid\': None}\n
kw.update(\n
portal_type=\'Simulation Movement\',\n
select_dict=select_dict,\n
left_join_list=select_dict.keys(),\n
delivery_uid=None\n
)\n
\n
context.getPortalObject().portal_catalog.searchAndActivate(\n
method_id=\'SimulationMovement_removeBogusDeliveryLink\',\n
method_kw={\'tag\': tag},\n
activate_kw={\'tag\': tag},\n
**kw\n
)\n
\n
# register activity on alarm object waiting for own tag in order to have only one alarm\n
# running in same time\n
context.activate(after_tag=tag).getId()\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
tag, fixit, params
</string>
</value>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/DeliveryBuilder_selectSlapOSConfirmedInvoiceList.py
0 → 100644
View file @
43b65274
portal_type
=
context
.
getDeliveryPortalType
()
simulation_state
=
'confirmed'
# use catalog to prefetch, but check later in ZODB
return
[
x
.
getObject
()
for
x
in
context
.
getPortalObject
().
portal_catalog
(
portal_type
=
portal_type
,
# BEWARE: it works only in case of per-tree building
default_destination_section_uid
=
movement_list
[
0
].
getDestinationSectionUid
(),
simulation_state
=
simulation_state
)
if
x
.
getSimulationState
()
==
simulation_state
]
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/DeliveryBuilder_selectSlapOSConfirmedInvoiceList.xml
View file @
43b65274
...
...
@@ -48,19 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
portal_type = context.getDeliveryPortalType()\n
simulation_state = \'confirmed\'\n
\n
# use catalog to prefetch, but check later in ZODB\n
return [x.getObject() for x in context.getPortalObject().portal_catalog(\n
portal_type=portal_type,\n
# BEWARE: it works only in case of per-tree building\n
default_destination_section_uid=movement_list[0].getDestinationSectionUid(),\n
simulation_state=simulation_state) if x.getSimulationState() == simulation_state]\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
movement_list, **kw
</string>
</value>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/Delivery_manageBuildingCalculatingDelivery.py
0 → 100644
View file @
43b65274
delivery
=
context
if
delivery
.
getCausalityState
()
not
in
(
'building'
,
'calculating'
):
return
path
=
delivery
.
getPath
()
portal_activities
=
context
.
getPortalObject
().
portal_activities
if
portal_activities
.
countMessage
(
path
=
path
)
==
0
\
and
portal_activities
.
countMessageWithTag
(
'%s_solve'
%
path
)
==
0
:
delivery
.
serialize
()
delivery
.
updateCausalityState
(
solve_automatically
=
True
)
delivery
.
updateSimulation
(
expand_root
=
1
,
expand_related
=
1
)
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/Delivery_manageBuildingCalculatingDelivery.xml
View file @
43b65274
...
...
@@ -48,20 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
delivery = context\n
if delivery.getCausalityState() not in (\'building\', \'calculating\'):\n
return\n
path = delivery.getPath()\n
portal_activities = context.getPortalObject().portal_activities\n
if portal_activities.countMessage(path=path) == 0 \\\n
and portal_activities.countMessageWithTag(\'%s_solve\' % path) == 0:\n
delivery.serialize()\n
delivery.updateCausalityState(solve_automatically=True)\n
delivery.updateSimulation(expand_root=1, expand_related=1)\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/HostingSubscription_getRuleReference.py
0 → 100644
View file @
43b65274
return
'default_subscription_item_rule'
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/HostingSubscription_getRuleReference.xml
View file @
43b65274
...
...
@@ -48,11 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
return \'default_subscription_item_rule\'\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/PackingList_getRuleReference.py
0 → 100644
View file @
43b65274
if
context
.
getPortalType
()
==
'Sale Packing List'
\
and
context
.
getSpecialise
()
==
'sale_trade_condition_module/slapos_consumption_trade_condition'
:
# no rule for consumption
return
None
return
'default_delivery_rule'
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/PackingList_getRuleReference.xml
View file @
43b65274
...
...
@@ -48,15 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
if context.getPortalType() == \'Sale Packing List\' \\\n
and context.getSpecialise() == \'sale_trade_condition_module/slapos_consumption_trade_condition\':\n
# no rule for consumption\n
return None\n
return \'default_delivery_rule\'\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/PaymentTransaction_getRuleReference.py
0 → 100644
View file @
43b65274
return
None
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/PaymentTransaction_getRuleReference.xml
View file @
43b65274
...
...
@@ -48,11 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
return None\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/SimulationMovement_buildSlapOS.py
0 → 100644
View file @
43b65274
if
context
.
getDelivery
()
is
not
None
:
# movement build but not indexed, so do nothing
return
root_applied_rule
=
context
.
getRootAppliedRule
()
root_applied_rule_path
=
root_applied_rule
.
getPath
()
business_link
=
context
.
getCausalityValue
(
portal_type
=
'Business Link'
)
lock_tag
=
'build_in_progress_%s_%s'
%
(
business_link
.
getUid
(),
root_applied_rule
.
getUid
())
if
context
.
getPortalObject
().
portal_activities
.
countMessageWithTag
(
lock_tag
)
==
0
:
business_link
.
build
(
path
=
'%s/%%'
%
root_applied_rule_path
,
activate_kw
=
{
'tag'
:
tag
})
root_applied_rule
.
activate
(
activity
=
'SQLQueue'
,
after_tag
=
tag
,
tag
=
lock_tag
).
getId
()
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/SimulationMovement_buildSlapOS.xml
View file @
43b65274
...
...
@@ -48,22 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
if context.getDelivery() is not None:\n
# movement build but not indexed, so do nothing\n
return\n
\n
root_applied_rule = context.getRootAppliedRule()\n
root_applied_rule_path = root_applied_rule.getPath()\n
\n
business_link = context.getCausalityValue(portal_type=\'Business Link\')\n
lock_tag = \'build_in_progress_%s_%s\' % (business_link.getUid(), root_applied_rule.getUid())\n
if context.getPortalObject().portal_activities.countMessageWithTag(lock_tag) == 0:\n
business_link.build(path=\'%s/%%\' % root_applied_rule_path, activate_kw={\'tag\': tag})\n
root_applied_rule.activate(activity=\'SQLQueue\', after_tag=tag, tag=lock_tag).getId()\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
tag
</string>
</value>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/SimulationMovement_removeBogusDeliveryLink.py
0 → 100644
View file @
43b65274
if
context
.
getDelivery
()
is
not
None
and
context
.
getDeliveryValue
()
is
None
:
activate_kw
=
dict
(
tag
=
tag
)
context
.
edit
(
delivery
=
None
,
activate_kw
=
activate_kw
)
context
.
expand
(
expand_policy
=
'immediate'
,
activate_kw
=
activate_kw
)
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/SimulationMovement_removeBogusDeliveryLink.xml
View file @
43b65274
...
...
@@ -48,14 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
if context.getDelivery() is not None and context.getDeliveryValue() is None:\n
activate_kw=dict(tag=tag)\n
context.edit(delivery=None, activate_kw=activate_kw)\n
context.expand(expand_policy=\'immediate\', activate_kw=activate_kw)\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
tag
</string>
</value>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/SimulationMovement_testCommonRule.py
0 → 100644
View file @
43b65274
movement
=
context
business_link
=
movement
.
getCausalityValue
(
portal_type
=
'Business Link'
)
rule_trade_phase_list
=
rule
.
getTradePhaseList
()
if
len
(
rule_trade_phase_list
)
>
0
:
# if rule defines trade phase check if there is sense to apply it
if
len
(
business_link
.
getParentValue
().
getBusinessLinkValueList
(
trade_phase
=
rule_trade_phase_list
))
==
0
:
# If Business Process does not define trade phase do not apply
return
False
if
movement
.
getSimulationState
()
in
business_link
.
getCompletedStateList
():
return
True
return
False
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/SimulationMovement_testCommonRule.xml
View file @
43b65274
...
...
@@ -48,29 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
movement = context\n
\n
business_link = movement.getCausalityValue(portal_type=\'Business Link\')\n
\n
rule_trade_phase_list = rule.getTradePhaseList()\n
if len(rule_trade_phase_list) >
0:\n
# if rule defines trade phase check if there is sense to apply it\n
if len(business_link.getParentValue().getBusinessLinkValueList(trade_phase=rule_trade_phase_list)) == 0:\n
# If Business Process does not define trade phase do not apply\n
return False\n
\n
if movement.getSimulationState() in business_link.getCompletedStateList():\n
return True\n
\n
return False\n
]]>
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
rule
</string>
</value>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/SimulationMovement_testInvoiceSimulationRule.py
0 → 100644
View file @
43b65274
movement
=
context
if
not
movement
.
SimulationMovement_testCommonRule
(
rule
):
return
False
source_section
=
movement
.
getSourceSection
()
destination_section
=
movement
.
getDestinationSection
()
if
source_section
==
destination_section
or
source_section
is
None
\
or
destination_section
is
None
:
return
False
return
True
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/SimulationMovement_testInvoiceSimulationRule.xml
View file @
43b65274
...
...
@@ -48,22 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
movement = context\n
\n
if not movement.SimulationMovement_testCommonRule(rule):\n
return False\n
\n
source_section = movement.getSourceSection()\n
destination_section = movement.getDestinationSection()\n
if source_section == destination_section or source_section is None \\\n
or destination_section is None:\n
return False\n
\n
return True\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
rule
</string>
</value>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/SimulationMovement_testInvoiceTransactionSimulationRule.py
0 → 100644
View file @
43b65274
movement
=
context
if
not
movement
.
SimulationMovement_testCommonRule
(
rule
):
return
False
parent
=
movement
.
getParentValue
()
if
parent
.
getPortalType
()
!=
'Applied Rule'
:
return
False
parent_rule
=
parent
.
getSpecialiseValue
()
if
parent_rule
.
getPortalType
()
not
in
(
'Invoice Root Simulation Rule'
,
'Invoice Simulation Rule'
,
'Trade Model Simulation Rule'
):
return
False
delivery_movement
=
movement
.
getDeliveryValue
()
if
delivery_movement
is
not
None
and
(
delivery_movement
.
getPortalType
()
not
in
movement
.
getPortalInvoiceMovementTypeList
()
and
delivery_movement
.
getPortalType
()
not
in
movement
.
getPortalTaxMovementTypeList
()):
return
False
return
True
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/SimulationMovement_testInvoiceTransactionSimulationRule.xml
View file @
43b65274
...
...
@@ -48,32 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
movement = context\n
\n
if not movement.SimulationMovement_testCommonRule(rule):\n
return False\n
\n
parent = movement.getParentValue()\n
if parent.getPortalType() != \'Applied Rule\':\n
return False\n
\n
parent_rule = parent.getSpecialiseValue()\n
if parent_rule.getPortalType() not in (\'Invoice Root Simulation Rule\',\n
\'Invoice Simulation Rule\',\n
\'Trade Model Simulation Rule\'):\n
return False\n
\n
delivery_movement = movement.getDeliveryValue()\n
if delivery_movement is not None and (\n
delivery_movement.getPortalType() not in movement.getPortalInvoiceMovementTypeList()\n
and delivery_movement.getPortalType() not in movement.getPortalTaxMovementTypeList()):\n
return False\n
\n
return True\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
rule
</string>
</value>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/SimulationMovement_testPaymentSimulationRule.py
0 → 100644
View file @
43b65274
movement
=
context
movement
=
context
if
not
movement
.
SimulationMovement_testCommonRule
(
rule
):
return
False
# XXX hardcoded
receivable_account_type_list
=
(
'asset/receivable'
,)
payable_account_type_list
=
(
'liability/payable'
,)
if
movement
.
getQuantity
()
==
0
:
# do not create empty payment movements
return
False
for
account
in
(
movement
.
getSourceValue
(
portal_type
=
'Account'
),
movement
.
getDestinationValue
(
portal_type
=
'Account'
)):
if
account
is
not
None
:
account_type
=
account
.
getAccountType
()
if
account_type
in
receivable_account_type_list
or
\
account_type
in
payable_account_type_list
:
return
True
return
False
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/SimulationMovement_testPaymentSimulationRule.xml
View file @
43b65274
...
...
@@ -48,34 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
movement = context\n
\n
movement = context\n
\n
if not movement.SimulationMovement_testCommonRule(rule):\n
return False\n
\n
# XXX hardcoded\n
receivable_account_type_list = (\'asset/receivable\',)\n
payable_account_type_list = (\'liability/payable\',)\n
\n
if movement.getQuantity() == 0:\n
# do not create empty payment movements\n
return False\n
\n
for account in (movement.getSourceValue(portal_type=\'Account\'),\n
movement.getDestinationValue(portal_type=\'Account\')):\n
if account is not None:\n
account_type = account.getAccountType()\n
if account_type in receivable_account_type_list or \\\n
account_type in payable_account_type_list:\n
return True\n
\n
return False\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
rule
</string>
</value>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/SimulationMovement_testTradeModelSimulationRule.py
0 → 100644
View file @
43b65274
movement
=
context
if
not
movement
.
SimulationMovement_testCommonRule
(
rule
):
return
False
parent
=
movement
.
getParentValue
()
if
parent
.
getPortalType
()
!=
'Applied Rule'
:
return
False
parent_rule
=
parent
.
getSpecialiseValue
()
if
parent_rule
.
getPortalType
()
not
in
(
'Invoice Root Simulation Rule'
,
'Invoice Simulation Rule'
):
return
False
return
True
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/SimulationMovement_testTradeModelSimulationRule.xml
View file @
43b65274
...
...
@@ -48,25 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
movement = context\n
\n
if not movement.SimulationMovement_testCommonRule(rule):\n
return False\n
\n
parent = movement.getParentValue()\n
if parent.getPortalType() != \'Applied Rule\':\n
return False\n
\n
parent_rule = parent.getSpecialiseValue()\n
if parent_rule.getPortalType() not in (\'Invoice Root Simulation Rule\',\n
\'Invoice Simulation Rule\'):\n
return False\n
\n
return True\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
rule
</string>
</value>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/SlapOSDeliveryBuilder_selectMovement.py
0 → 100644
View file @
43b65274
select_dict
=
{
'delivery_uid'
:
None
}
kw
[
'select_dict'
]
=
select_dict
kw
[
'left_join_list'
]
=
select_dict
.
keys
()
kw
[
'delivery_uid'
]
=
None
kw
[
'group_by'
]
=
(
'uid'
,)
if
src__
==
0
:
return
context
.
portal_catalog
(
**
kw
)
else
:
return
context
.
portal_catalog
(
src__
=
1
,
**
kw
)
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/SlapOSDeliveryBuilder_selectMovement.xml
View file @
43b65274
...
...
@@ -318,19 +318,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
select_dict= {\'delivery_uid\': None}\n
kw[\'select_dict\']=select_dict\n
kw[\'left_join_list\']=select_dict.keys()\n
kw[\'delivery_uid\']=None\n
kw[\'group_by\']=(\'uid\',)\n
if src__==0:\n
return context.portal_catalog(**kw)\n
else:\n
return context.portal_catalog(src__=1, **kw)\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
src__=0, **kw
</string>
</value>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/SlapOSInvoiceTransaction_selectDelivery.py
0 → 100644
View file @
43b65274
#
# This method is used by the invoice_transaction_builder
# delivery builder to select the Invoice Transaction
# in which creating new Invoice Transaction Lines.
#
deliveries_keys
=
{}
for
movement
in
movement_list
:
ar
=
movement
.
getParentValue
()
line
=
None
# case of tax movement
if
ar
.
getSpecialiseValue
().
getPortalType
()
in
(
'Tax Rule'
,
'Tax Simulation Rule'
):
for
other_rule
in
ar
.
getParentValue
().
contentValues
():
if
other_rule
==
ar
:
continue
for
sm
in
other_rule
.
contentValues
():
line
=
sm
.
getDeliveryValue
()
# case of trade model movement
if
ar
.
getParentValue
().
getParentValue
().
getSpecialiseValue
().
getPortalType
()
in
(
'Trade Model Rule'
,
'Trade Model Simulation Rule'
):
line
=
ar
.
getParentValue
().
getParentValue
().
getParentValue
().
getDeliveryValue
()
# in case of invoice rule (ie. starting from Invoice)
if
line
is
None
:
line
=
ar
.
getParentValue
().
getOrderValue
()
# in case of invoicing rule (ie. starting from Order)
if
line
is
None
:
line
=
movement
.
getParentValue
().
getParentValue
().
getDeliveryValue
()
if
line
is
not
None
:
deliveries_keys
[
line
.
getExplanationValue
()]
=
1
return
filter
(
lambda
x
:
x
is
not
None
,
deliveries_keys
.
keys
())
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/SlapOSInvoiceTransaction_selectDelivery.xml
View file @
43b65274
...
...
@@ -48,45 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
#\n
# This method is used by the invoice_transaction_builder\n
# delivery builder to select the Invoice Transaction \n
# in which creating new Invoice Transaction Lines.\n
#\n
\n
deliveries_keys = {}\n
for movement in movement_list:\n
ar = movement.getParentValue()\n
line = None\n
\n
# case of tax movement \n
if ar.getSpecialiseValue().getPortalType() in (\'Tax Rule\', \'Tax Simulation Rule\'):\n
for other_rule in ar.getParentValue().contentValues():\n
if other_rule == ar:\n
continue\n
for sm in other_rule.contentValues():\n
line = sm.getDeliveryValue()\n
\n
# case of trade model movement\n
if ar.getParentValue().getParentValue().getSpecialiseValue().getPortalType() in (\'Trade Model Rule\', \'Trade Model Simulation Rule\'):\n
line = ar.getParentValue().getParentValue().getParentValue().getDeliveryValue()\n
\n
# in case of invoice rule (ie. starting from Invoice)\n
if line is None:\n
line = ar.getParentValue().getOrderValue()\n
\n
# in case of invoicing rule (ie. starting from Order)\n
if line is None:\n
line = movement.getParentValue().getParentValue().getDeliveryValue()\n
\n
if line is not None:\n
deliveries_keys[line.getExplanationValue()] = 1\n
\n
return filter(lambda x : x is not None, deliveries_keys.keys())\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
movement_list, **kw
</string>
</value>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/SlapOSPaymentTransaction_postGeneration.py
0 → 100644
View file @
43b65274
from
Products.ERP5Type.Message
import
translateString
from
DateTime
import
DateTime
payment_transaction
=
context
comment
=
translateString
(
"Initialised by Delivery Builder."
)
payment_transaction
.
plan
(
comment
=
comment
)
payment_transaction
.
confirm
(
comment
=
comment
)
payment_transaction
.
start
(
comment
=
comment
)
payment_transaction
.
stop
(
comment
=
comment
)
payment_transaction
.
deliver
(
comment
=
comment
)
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/SlapOSPaymentTransaction_postGeneration.xml
View file @
43b65274
...
...
@@ -48,20 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
from Products.ERP5Type.Message import translateString\n
from DateTime import DateTime\n
\n
payment_transaction = context\n
comment = translateString("Initialised by Delivery Builder.")\n
payment_transaction.plan(comment=comment)\n
payment_transaction.confirm(comment=comment)\n
payment_transaction.start(comment=comment)\n
payment_transaction.stop(comment=comment)\n
payment_transaction.deliver(comment=comment)\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
related_simulation_movement_path_list=None, **kw
</string>
</value>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/SlapOSSaleInvoiceTransaction_postGeneration.py
0 → 100644
View file @
43b65274
"""This script is called on the Invoice after the delivery builder has created
the new Invoice.
"""
from
Products.ERP5Type.Message
import
translateString
from
DateTime
import
DateTime
if
related_simulation_movement_path_list
is
None
:
raise
RuntimeError
,
'related_simulation_movement_path_list is missing. Update ERP5 Product.'
invoice
=
context
price_currency
=
invoice
.
getPriceCurrency
()
if
invoice
.
getResource
()
!=
price_currency
:
invoice
.
setResource
(
price_currency
)
if
invoice
.
getPaymentMode
(
""
)
==
""
:
invoice
.
setPaymentModeValue
(
invoice
.
getPortalObject
().
portal_categories
.
payment_mode
.
payzen
)
comment
=
translateString
(
'Initialised by Delivery Builder.'
)
if
invoice
.
portal_workflow
.
isTransitionPossible
(
invoice
,
'plan'
):
invoice
.
plan
(
comment
=
comment
)
if
invoice
.
portal_workflow
.
isTransitionPossible
(
invoice
,
'confirm'
):
invoice
.
confirm
(
comment
=
comment
)
invoice
.
startBuilding
(
comment
=
comment
)
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/SlapOSSaleInvoiceTransaction_postGeneration.xml
View file @
43b65274
...
...
@@ -48,30 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
"""This script is called on the Invoice after the delivery builder has created\n
the new Invoice.\n
"""\n
from Products.ERP5Type.Message import translateString\n
from DateTime import DateTime\n
if related_simulation_movement_path_list is None:\n
raise RuntimeError, \'related_simulation_movement_path_list is missing. Update ERP5 Product.\'\n
\n
invoice = context\n
price_currency = invoice.getPriceCurrency()\n
if invoice.getResource() != price_currency:\n
invoice.setResource(price_currency)\n
if invoice.getPaymentMode("") == "":\n
invoice.setPaymentModeValue(invoice.getPortalObject().portal_categories.payment_mode.payzen)\n
comment = translateString(\'Initialised by Delivery Builder.\')\n
if invoice.portal_workflow.isTransitionPossible(invoice, \'plan\'):\n
invoice.plan(comment=comment)\n
if invoice.portal_workflow.isTransitionPossible(invoice, \'confirm\'):\n
invoice.confirm(comment=comment)\n
invoice.startBuilding(comment=comment)\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
related_simulation_movement_path_list=None, **kw
</string>
</value>
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/SlapOSSalePackingList_postGeneration.py
0 → 100644
View file @
43b65274
if
related_simulation_movement_path_list
is
None
:
raise
RuntimeError
,
'related_simulation_movement_path_list is missing. Update ERP5 Product.'
packing_list
=
context
try
:
packing_list
.
PackingList_copyOrderProperties
()
except
AttributeError
:
# does not come from Order
pass
portal
=
packing_list
.
getPortalObject
()
comment
=
context
.
Base_translateString
(
'Automatic transition during build.'
)
if
portal
.
portal_workflow
.
isTransitionPossible
(
context
,
'confirm'
):
context
.
confirm
(
comment
=
comment
)
if
portal
.
portal_workflow
.
isTransitionPossible
(
context
,
'start'
):
context
.
start
(
comment
=
comment
)
context
.
stop
(
comment
=
comment
)
context
.
deliver
(
comment
=
comment
)
# Initialise causality workflow
packing_list
.
startBuilding
()
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/SlapOSSalePackingList_postGeneration.xml
View file @
43b65274
...
...
@@ -48,32 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
if related_simulation_movement_path_list is None:\n
raise RuntimeError, \'related_simulation_movement_path_list is missing. Update ERP5 Product.\'\n
\n
packing_list = context\n
\n
try:\n
packing_list.PackingList_copyOrderProperties()\n
except AttributeError:\n
# does not come from Order\n
pass\n
\n
portal = packing_list.getPortalObject()\n
comment = context.Base_translateString(\'Automatic transition during build.\')\n
if portal.portal_workflow.isTransitionPossible(context, \'confirm\'):\n
context.confirm(comment=comment)\n
if portal.portal_workflow.isTransitionPossible(context, \'start\'):\n
context.start(comment=comment)\n
context.stop(comment=comment)\n
context.deliver(comment=comment)\n
\n
# Initialise causality workflow\n
packing_list.startBuilding()\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
related_simulation_movement_path_list=None
</string>
</value>
...
...
master/bt5/slapos_accounting/WorkflowTemplateItem/portal_workflow/slapos_accounting_interaction_workflow/scripts/Base_diverge.py
0 → 100644
View file @
43b65274
document
=
state_change
[
"object"
]
if
document
.
getPortalObject
().
portal_workflow
.
isTransitionPossible
(
document
,
'diverge'
):
document
.
diverge
()
master/bt5/slapos_accounting/WorkflowTemplateItem/portal_workflow/slapos_accounting_interaction_workflow/scripts/Base_diverge.xml
View file @
43b65274
...
...
@@ -48,13 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
document = state_change["object"]\n
if document.getPortalObject().portal_workflow.isTransitionPossible(document, \'diverge\'):\n
document.diverge()\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
state_change
</string>
</value>
...
...
master/bt5/slapos_accounting/WorkflowTemplateItem/portal_workflow/slapos_accounting_interaction_workflow/scripts/Base_fixConsistency.py
0 → 100644
View file @
43b65274
state_change
[
'object'
].
fixConsistency
()
master/bt5/slapos_accounting/WorkflowTemplateItem/portal_workflow/slapos_accounting_interaction_workflow/scripts/Base_fixConsistency.xml
View file @
43b65274
...
...
@@ -48,11 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
state_change[\'object\'].fixConsistency()\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
state_change
</string>
</value>
...
...
master/bt5/slapos_accounting/WorkflowTemplateItem/portal_workflow/slapos_accounting_interaction_workflow/scripts/Delivery_calculate.py
0 → 100644
View file @
43b65274
state_change
[
'object'
].
Delivery_calculate
()
master/bt5/slapos_accounting/WorkflowTemplateItem/portal_workflow/slapos_accounting_interaction_workflow/scripts/Delivery_calculate.xml
View file @
43b65274
...
...
@@ -48,11 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
state_change[\'object\'].Delivery_calculate()\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
state_change
</string>
</value>
...
...
master/bt5/slapos_accounting/WorkflowTemplateItem/portal_workflow/slapos_accounting_interaction_workflow/scripts/HostingSubscription_fixPeriodicity.py
0 → 100644
View file @
43b65274
from
Products.ERP5Type.DateUtils
import
addToDate
,
getClosestDate
hosting_subscription
=
state_change
[
'object'
]
edit_kw
=
{}
if
hosting_subscription
.
getPeriodicityHour
()
is
None
:
edit_kw
[
'periodicity_hour_list'
]
=
[
0
]
if
hosting_subscription
.
getPeriodicityMinute
()
is
None
:
edit_kw
[
'periodicity_minute_list'
]
=
[
0
]
if
hosting_subscription
.
getPeriodicityMonthDay
()
is
None
:
start_date
=
hosting_subscription
.
HostingSubscription_calculateSubscriptionStartDate
()
start_date
=
getClosestDate
(
target_date
=
start_date
,
precision
=
'day'
)
while
start_date
.
day
()
>=
29
:
start_date
=
addToDate
(
start_date
,
to_add
=
{
'day'
:
-
1
})
edit_kw
[
'periodicity_month_day_list'
]
=
[
start_date
.
day
()]
if
edit_kw
:
hosting_subscription
.
edit
(
**
edit_kw
)
master/bt5/slapos_accounting/WorkflowTemplateItem/portal_workflow/slapos_accounting_interaction_workflow/scripts/HostingSubscription_fixPeriodicity.xml
View file @
43b65274
...
...
@@ -48,32 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
from Products.ERP5Type.DateUtils import addToDate, getClosestDate\n
hosting_subscription = state_change[\'object\']\n
\n
edit_kw = {}\n
\n
if hosting_subscription.getPeriodicityHour() is None:\n
edit_kw[\'periodicity_hour_list\'] = [0]\n
if hosting_subscription.getPeriodicityMinute() is None:\n
edit_kw[\'periodicity_minute_list\'] = [0]\n
if hosting_subscription.getPeriodicityMonthDay() is None:\n
start_date = hosting_subscription.HostingSubscription_calculateSubscriptionStartDate()\n
start_date = getClosestDate(target_date=start_date, precision=\'day\')\n
while start_date.day() >
= 29:\n
start_date = addToDate(start_date, to_add={\'day\': -1})\n
edit_kw[\'periodicity_month_day_list\'] = [start_date.day()]\n
\n
if edit_kw:\n
hosting_subscription.edit(**edit_kw)\n
]]>
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
state_change
</string>
</value>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment