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
Titouan Soulard
erp5
Commits
be295e92
Commit
be295e92
authored
Sep 30, 2024
by
Titouan Soulard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_core: SQUASH
parent
57e9945f
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
9 deletions
+54
-9
product/ERP5/bootstrap/erp5_core/DocumentTemplateItem/portal_components/document.erp5.InventoryCell.py
...lateItem/portal_components/document.erp5.InventoryCell.py
+30
-6
product/ERP5/bootstrap/erp5_core/DocumentTemplateItem/portal_components/document.erp5.InventoryCell.xml
...ateItem/portal_components/document.erp5.InventoryCell.xml
+1
-3
product/ERP5/bootstrap/erp5_core/DocumentTemplateItem/portal_components/document.erp5.InventoryLine.py
...lateItem/portal_components/document.erp5.InventoryLine.py
+23
-0
No files found.
product/ERP5/bootstrap/erp5_core/DocumentTemplateItem/portal_components/document.erp5.InventoryCell.py
View file @
be295e92
...
@@ -26,15 +26,14 @@
...
@@ -26,15 +26,14 @@
#
#
##############################################################################
##############################################################################
from
Acquisition
import
aq_base
from
AccessControl
import
ClassSecurityInfo
from
AccessControl
import
ClassSecurityInfo
from
Acquisition
import
aq_base
from
Products.ERP5Type
import
Permissions
,
PropertySheet
from
Products.ERP5Type
import
Permissions
,
PropertySheet
from
erp5.component.document.MappedValue
import
MappedValue
from
erp5.component.document.Amount
import
Amount
from
erp5.component.document.Amount
import
Amount
class
InventoryCell
(
MappedValue
,
Amount
):
class
InventoryCell
(
Amount
):
"""
"""
An InventoryCell allows to define specific inventory
An InventoryCell allows to define specific inventory
for each variation of a resource in an inventory line.
for each variation of a resource in an inventory line.
...
@@ -49,17 +48,42 @@ class InventoryCell(MappedValue, Amount):
...
@@ -49,17 +48,42 @@ class InventoryCell(MappedValue, Amount):
# Declarative properties
# Declarative properties
property_sheets
=
(
PropertySheet
.
Base
property_sheets
=
(
PropertySheet
.
Base
,
PropertySheet
.
XMLObject
,
PropertySheet
.
CategoryCore
,
PropertySheet
.
CategoryCore
,
PropertySheet
.
Amount
,
PropertySheet
.
Amount
,
PropertySheet
.
InventoryMovement
,
PropertySheet
.
InventoryMovement
,
PropertySheet
.
Task
,
PropertySheet
.
Task
,
PropertySheet
.
Movement
,
PropertySheet
.
Price
,
PropertySheet
.
Price
,
PropertySheet
.
Predicate
,
PropertySheet
.
MappedValue
,
PropertySheet
.
ItemAggregation
,
PropertySheet
.
ItemAggregation
)
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'hasCellContent'
)
def
hasCellContent
(
self
,
base_id
=
"movement"
):
"""
A cell cannot contain other Cells.
"""
return
False
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getQuantity'
)
def
getQuantity
(
self
):
"""
Computes a quantity which allows to reach inventory
"""
if
not
self
.
hasCellContent
():
# First check if quantity already exists
quantity
=
self
.
_baseGetQuantity
()
if
quantity
not
in
(
0.0
,
0
,
None
):
return
quantity
# Make sure inventory is defined somewhere (here or parent)
inventory
=
getattr
(
aq_base
(
self
),
'inventory'
,
None
)
if
inventory
is
not
None
:
return
inventory
return
quantity
else
:
return
None
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getTotalInventory'
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getTotalInventory'
)
def
getTotalInventory
(
self
):
def
getTotalInventory
(
self
):
"""
"""
...
...
product/ERP5/bootstrap/erp5_core/DocumentTemplateItem/portal_components/document.erp5.InventoryCell.xml
View file @
be295e92
...
@@ -43,9 +43,7 @@
...
@@ -43,9 +43,7 @@
<item>
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<value>
<tuple>
<tuple/>
<string>
W: 29, 0: Unused aq_base imported from Acquisition (unused-import)
</string>
</tuple>
</value>
</value>
</item>
</item>
<item>
<item>
...
...
product/ERP5/bootstrap/erp5_core/DocumentTemplateItem/portal_components/document.erp5.InventoryLine.py
View file @
be295e92
...
@@ -27,9 +27,11 @@
...
@@ -27,9 +27,11 @@
##############################################################################
##############################################################################
from
AccessControl
import
ClassSecurityInfo
from
AccessControl
import
ClassSecurityInfo
from
Acquisition
import
aq_base
from
Products.ERP5Type
import
Permissions
,
PropertySheet
from
Products.ERP5Type
import
Permissions
,
PropertySheet
from
Products.ERP5Type.XMLMatrix
import
XMLMatrix
from
Products.ERP5Type.XMLMatrix
import
XMLMatrix
from
erp5.component.document.Movement
import
Movement
from
erp5.component.document.Movement
import
Movement
from
erp5.component.document.Amount
import
Amount
from
erp5.component.document.Amount
import
Amount
...
@@ -50,7 +52,9 @@ class InventoryLine(XMLMatrix, Amount):
...
@@ -50,7 +52,9 @@ class InventoryLine(XMLMatrix, Amount):
,
PropertySheet
.
XMLObject
,
PropertySheet
.
XMLObject
,
PropertySheet
.
CategoryCore
,
PropertySheet
.
CategoryCore
,
PropertySheet
.
Amount
,
PropertySheet
.
Amount
,
PropertySheet
.
InventoryMovement
,
PropertySheet
.
Task
,
PropertySheet
.
Task
,
PropertySheet
.
Price
,
PropertySheet
.
Arrow
,
PropertySheet
.
Arrow
,
PropertySheet
.
VariationRange
,
PropertySheet
.
VariationRange
,
PropertySheet
.
ItemAggregation
,
PropertySheet
.
ItemAggregation
...
@@ -65,6 +69,25 @@ class InventoryLine(XMLMatrix, Amount):
...
@@ -65,6 +69,25 @@ class InventoryLine(XMLMatrix, Amount):
cell_range
=
XMLMatrix
.
getCellRange
(
self
,
base_id
=
base_id
)
cell_range
=
XMLMatrix
.
getCellRange
(
self
,
base_id
=
base_id
)
return
(
cell_range
is
not
None
and
len
(
cell_range
)
>
0
)
return
(
cell_range
is
not
None
and
len
(
cell_range
)
>
0
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getQuantity'
)
def
getQuantity
(
self
):
"""
Computes a quantity which allows to reach inventory
"""
if
not
self
.
hasCellContent
():
# First check if quantity already exists
quantity
=
self
.
_baseGetQuantity
()
if
quantity
not
in
(
0.0
,
0
,
None
):
return
quantity
# Make sure inventory is defined somewhere (here or parent)
inventory
=
getattr
(
aq_base
(
self
),
'inventory'
,
None
)
if
inventory
is
not
None
:
return
inventory
return
quantity
else
:
return
None
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getTotalInventory'
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getTotalInventory'
)
def
getTotalInventory
(
self
):
def
getTotalInventory
(
self
):
"""
"""
...
...
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