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
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Cédric Le Ninivin
erp5
Commits
3518b976
Commit
3518b976
authored
May 14, 2024
by
Xiaowu Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_trade: fix DuplicateInventoryConstraint
parent
fb2d2f65
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
5 deletions
+9
-5
bt5/erp5_trade/DocumentTemplateItem/portal_components/document.erp5.DuplicateInventoryConstraint.py
..._components/document.erp5.DuplicateInventoryConstraint.py
+9
-5
No files found.
bt5/erp5_trade/DocumentTemplateItem/portal_components/document.erp5.DuplicateInventoryConstraint.py
View file @
3518b976
...
@@ -26,6 +26,8 @@
...
@@ -26,6 +26,8 @@
##############################################################################
##############################################################################
from
Products.ERP5Type.mixin.constraint
import
ConstraintMixin
from
Products.ERP5Type.mixin.constraint
import
ConstraintMixin
from
Products.ZSQLCatalog.SQLCatalog
import
SimpleQuery
,
NegatedQuery
class
DuplicateInventoryConstraint
(
ConstraintMixin
):
class
DuplicateInventoryConstraint
(
ConstraintMixin
):
"""
"""
...
@@ -61,7 +63,7 @@ class DuplicateInventoryConstraint(ConstraintMixin):
...
@@ -61,7 +63,7 @@ class DuplicateInventoryConstraint(ConstraintMixin):
def
_checkConsistency
(
self
,
obj
,
fixit
=
0
):
def
_checkConsistency
(
self
,
obj
,
fixit
=
0
):
"""
"""
Implement here the consistency checker
Implement here the consistency checker
whenever fixit is not 0, object data should be updated to
whenever fixit is not 0, object data should be updated to
-----> NON
satisfy the constraint
satisfy the constraint
"""
"""
...
@@ -105,13 +107,15 @@ class DuplicateInventoryConstraint(ConstraintMixin):
...
@@ -105,13 +107,15 @@ class DuplicateInventoryConstraint(ConstraintMixin):
variation_text
=
variation_text
,
variation_text
=
variation_text
,
from_date
=
date
,
at_date
=
date
,
from_date
=
date
,
at_date
=
date
,
default_stock_table
=
'stock'
,
default_stock_table
=
'stock'
,
uid
=
NegatedQuery
(
SimpleQuery
(
uid
=
movement
.
getUid
())),
node
=
node
)
node
=
node
)
for
inventory
in
inventory_list
:
for
inventory
in
inventory_list
:
movement
=
getObjectFromUid
(
inventory
.
stock_uid
)
other_
movement
=
getObjectFromUid
(
inventory
.
stock_uid
)
if
movement
.
getPortalType
().
find
(
'Inventory'
)
>=
0
:
if
other_
movement
.
getPortalType
().
find
(
'Inventory'
)
>=
0
:
errors
.
append
(
self
.
_generateDuplicateError
(
portal
,
obj
,
resource
,
errors
.
append
(
self
.
_generateDuplicateError
(
portal
,
obj
,
resource
,
variation_text
))
variation_text
))
# Now we must reindex with some particular tags
# Now we must reindex with some particular tags
if
fixit
:
activate_kw
=
{
'tag'
:
tag
}
activate_kw
=
{
'tag'
:
tag
}
movement
.
reindexObject
(
activate_kw
=
activate_kw
)
movement
.
reindexObject
(
activate_kw
=
activate_kw
)
...
...
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