Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
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
Lukas Niegsch
erp5
Commits
307945c7
Commit
307945c7
authored
Feb 08, 2018
by
Arnaud Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_real_time_inventory_accounting: There should be no expand if PL 'price' is not set.
parent
78815680
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
113 additions
and
25 deletions
+113
-25
bt5/erp5_real_time_inventory_accounting/DocumentTemplateItem/portal_components/document.erp5.InventoryAssetPriceAccountingSimulationRule.py
...ument.erp5.InventoryAssetPriceAccountingSimulationRule.py
+3
-25
bt5/erp5_real_time_inventory_accounting/SkinTemplateItem/portal_skins/erp5_real_time_inventory_accounting/SimulationMovement_testInventoryAccountingTransactionSimulationRule.py
...ement_testInventoryAccountingTransactionSimulationRule.py
+3
-0
bt5/erp5_real_time_inventory_accounting_test/TestTemplateItem/portal_components/test.erp5.testRealTimeInventoryAccounting.py
...l_components/test.erp5.testRealTimeInventoryAccounting.py
+107
-0
No files found.
bt5/erp5_real_time_inventory_accounting/DocumentTemplateItem/portal_components/document.erp5.InventoryAssetPriceAccountingSimulationRule.py
View file @
307945c7
...
...
@@ -43,33 +43,11 @@ class InventoryAssetPriceAccountingRuleMovementGenerator(InvoiceTransactionRuleM
def
_getInputMovementList
(
self
,
movement_list
=
None
,
rounding
=
False
):
simulation_movement
=
self
.
_applied_rule
.
getParentValue
()
# ERP5 generic implementation of getPrice():
# 1. PL 'price' =>
# 2. Movement_getPriceCalculationOperandDict()
# => Supply Line...
# No expand if price is not set (already checked in 'Test Method ID' on the Rule).
# Price is automatically acquired from Supply if not set directly on PL Movement.
quantity
=
simulation_movement
.
getPrice
()
if
quantity
is
None
:
# XXX: "or fails to generate, and creates a "stock decrease" (expense)"???
raise
NotImplementedError
# use = simulation_movement.getUse()
# if use == 'trade/sale':
# portal_type = 'Sale Supply Line'
# elif use == 'trade/purchase':
# portal_type = 'Purchase Supply Line'
# else:
# raise NotImplementatedError("%s: use='%s' not handled by this Rule" %
# (simulation_movement.getPath(), use))
# domain_tool = simulation_movement.getPortalObject().portal_domains
# sale_supply_line_list = domain_tool.searchPredicateList(
# simulation_movement,
# portal_type=portal_type)
# if len(sale_supply_line_list) == 0:
# return ()
# quantity = sale_supply_line_list[0].getBasePrice()
return
[]
return
[
simulation_movement
.
asContext
(
quantity
=
quantity
)]
...
...
bt5/erp5_real_time_inventory_accounting/SkinTemplateItem/portal_skins/erp5_real_time_inventory_accounting/SimulationMovement_testInventoryAccountingTransactionSimulationRule.py
View file @
307945c7
...
...
@@ -2,6 +2,9 @@ parent = context.getParentValue()
if
parent
.
getPortalType
()
!=
'Applied Rule'
:
return
False
if
not
context
.
hasPrice
():
return
False
parent_rule
=
parent
.
getSpecialiseValue
()
if
parent_rule
.
getPortalType
()
not
in
(
'Delivery Root Simulation Rule'
,
'Delivery Simulation Rule'
):
...
...
bt5/erp5_real_time_inventory_accounting_test/TestTemplateItem/portal_components/test.erp5.testRealTimeInventoryAccounting.py
View file @
307945c7
...
...
@@ -92,6 +92,14 @@ class TestRealTimeInventoryAccountingMixin:
self
.
assertIterableLen
(
causality_related_list
,
causality_related_list_expected_len
)
return
causality_related_list
def
stepCheckAccountingTransactionNotGeneratedFromSalePackingList
(
self
,
sequence
=
None
,
sequence_list
=
None
):
packing_list
=
sequence
[
'current_sale_packing_list'
]
self
.
_checkAndGetCausalityRelated
(
packing_list
,
'Accounting Transaction'
,
0
)
def
stepCheckAccountingTransactionNotGeneratedFromPurchasePackingList
(
self
,
sequence
=
None
,
sequence_list
=
None
):
packing_list
=
sequence
[
'current_purchase_packing_list'
]
self
.
_checkAndGetCausalityRelated
(
packing_list
,
'Accounting Transaction'
,
0
)
def
stepCheckAccountingTransactionGeneratedFromSalePackingList
(
self
,
sequence
=
None
,
sequence_list
=
None
):
packing_list
=
sequence
[
'current_sale_packing_list'
]
accounting_transaction
=
self
.
_checkAndGetCausalityRelated
(
packing_list
,
'Accounting Transaction'
,
1
)[
0
]
...
...
@@ -309,6 +317,20 @@ class TestRealTimeInventoryAccounting(ERP5TypeTestCase, TestRealTimeInventoryAcc
if
product_big_b_car
.
getValidationState
()
!=
'validated'
:
product_big_b_car
.
validate
()
try
:
product_car_no_supply
=
self
.
portal
.
product_module
.
car_no_supply
except
AttributeError
:
product_car_no_supply
=
self
.
portal
.
product_module
.
newContent
(
portal_type
=
'Product'
,
id
=
'car_no_supply'
,
title
=
'Car No Supply'
,
reference
=
'843326789'
,
product_line_value
=
category_tool
.
product_line
.
component
,
use_value
=
category_tool
.
use
.
trade
.
purchase
,
quantity_unit_value
=
category_tool
.
quantity_unit
.
unit
.
piece
)
if
product_car_no_supply
.
getValidationState
()
!=
'validated'
:
product_car_no_supply
.
validate
()
try
:
product_part_1
=
self
.
portal
.
product_module
.
part_1
except
AttributeError
:
...
...
@@ -449,6 +471,49 @@ class TestRealTimeInventoryAccounting(ERP5TypeTestCase, TestRealTimeInventoryAcc
sequence_list
.
addSequenceString
(
sequence_str
)
sequence_list
.
play
(
self
,
quiet
=
0
)
def
stepTestSalePackingListNoPriceAndNoSupply_create
(
self
,
sequence
=
None
,
sequence_list
=
None
):
sale_packing_list
=
self
.
portal
.
sale_packing_list_module
.
newContent
(
portal_type
=
'Sale Packing List'
,
specialise_value
=
self
.
portal
.
sale_trade_condition_module
.
hoge
,
title
=
'Vente depuis le Prac (No Price/Supply)'
,
start_date
=
DateTime
(
'2018/01/30 00:00:00 GMT+9'
),
stop_date
=
DateTime
(
'2018/01/31 00:00:00 GMT+9'
),
source_value
=
self
.
portal
.
organisation_module
.
hoge
,
source_section_value
=
self
.
portal
.
organisation_module
.
hoge
,
destination_value
=
self
.
portal
.
organisation_module
.
client
,
destination_section_value
=
self
.
portal
.
organisation_module
.
client
,
price_currency_value
=
self
.
portal
.
currency_module
.
DOL
)
sale_packing_list
.
newContent
(
portal_type
=
'Sale Packing List Line'
,
title
=
'Vente voiture'
,
int_index
=
1
,
resource_value
=
self
.
portal
.
product_module
.
car_no_supply
,
quantity
=
1
,
quantity_unit_value
=
self
.
portal
.
portal_categories
.
quantity_unit
.
unit
.
piece
,
use_value
=
self
.
portal
.
portal_categories
.
use
.
trade
.
sale
)
sequence
.
edit
(
sale_packing_list_1
=
sale_packing_list
)
def
testSalePackingListNoPriceAndNoSupply
(
self
):
sequence_list
=
SequenceList
()
sequence_str
=
"""
TestSalePackingListNoPriceAndNoSupply_create
Tic
SelectSalePackingList1
ConfirmSalePackingList
Tic
StartSalePackingList
Tic
StopSalePackingList
Tic
CallBuilder
Tic
CheckAccountingTransactionNotGeneratedFromSalePackingList
"""
sequence_list
.
addSequenceString
(
sequence_str
)
sequence_list
.
play
(
self
,
quiet
=
0
)
def
stepTestPurchasePackingList_create
(
self
,
sequence
=
None
,
sequence_list
=
None
):
purchase_packing_list
=
self
.
portal
.
purchase_packing_list_module
.
newContent
(
portal_type
=
'Purchase Packing List'
,
...
...
@@ -524,6 +589,48 @@ class TestRealTimeInventoryAccounting(ERP5TypeTestCase, TestRealTimeInventoryAcc
sequence_list
.
addSequenceString
(
sequence_str
)
sequence_list
.
play
(
self
,
quiet
=
0
)
def
stepTestPurchasePackingListNoPriceAndNoSupply_create
(
self
,
sequence
=
None
,
sequence_list
=
None
):
purchase_packing_list
=
self
.
portal
.
purchase_packing_list_module
.
newContent
(
portal_type
=
'Purchase Packing List'
,
specialise_value
=
self
.
portal
.
purchase_trade_condition_module
.
hoge
,
title
=
'Reception Supplier (No Supply/Price)'
,
start_date
=
DateTime
(
'2018/01/09 00:00:00 GMT+9'
),
stop_date
=
DateTime
(
'2018/01/10 00:00:00 GMT+9'
),
source_value
=
self
.
portal
.
organisation_module
.
hoge
,
source_section_value
=
self
.
portal
.
organisation_module
.
supplier
,
destination_value
=
self
.
portal
.
organisation_module
.
supplier
,
destination_section_value
=
self
.
portal
.
organisation_module
.
hoge
,
price_currency_value
=
self
.
portal
.
currency_module
.
DOL
)
purchase_packing_list
.
newContent
(
portal_type
=
'Purchase Packing List Line'
,
int_index
=
1
,
resource_value
=
self
.
portal
.
product_module
.
car_no_supply
,
quantity
=
1
,
quantity_unit_value
=
self
.
portal
.
portal_categories
.
quantity_unit
.
unit
.
piece
,
use_value
=
self
.
portal
.
portal_categories
.
use
.
trade
.
purchase
)
sequence
.
edit
(
purchase_packing_list_1
=
purchase_packing_list
)
def
testPurchasePackingListNoPriceAndNoSupply
(
self
):
sequence_list
=
SequenceList
()
sequence_str
=
"""
TestPurchasePackingListNoPriceAndNoSupply_create
Tic
SelectPurchasePackingList1
ConfirmPurchasePackingList
Tic
StartPurchasePackingList
Tic
StopPurchasePackingList
Tic
CallBuilder
Tic
CheckAccountingTransactionNotGeneratedFromPurchasePackingList
"""
sequence_list
.
addSequenceString
(
sequence_str
)
sequence_list
.
play
(
self
,
quiet
=
0
)
import
unittest
def
test_suite
():
suite
=
unittest
.
TestSuite
()
...
...
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