Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Tryton
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tryton
Tryton
Commits
5bd2ee43
Commit
5bd2ee43
authored
2 years ago
by
Cédric Krier
Browse files
Options
Downloads
Patches
Plain Diff
Use MultiValue for product lead time
and remove CompanyValueMixin for default lead time. issue11428 review403411002
parent
bfdbf327
Loading
Loading
1 merge request
!114
Return an empty list when the treeview has no selection
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CHANGELOG
+3
-0
3 additions, 0 deletions
CHANGELOG
__init__.py
+1
-0
1 addition, 0 deletions
__init__.py
product.py
+47
-11
47 additions, 11 deletions
product.py
with
51 additions
and
11 deletions
CHANGELOG
+
3
−
0
View file @
5bd2ee43
* Use MultiValue for product lead time
* Remove CompanyValueMixin for default lead time
Version 6.4.0 - 2022-05-02
* Bug fixes (see mercurial logs for details)
* Add customer currency on party
...
...
This diff is collapsed.
Click to expand it.
__init__.py
+
1
−
0
View file @
5bd2ee43
...
...
@@ -23,6 +23,7 @@
product
.
Configuration
,
product
.
DefaultLeadTime
,
product
.
Template
,
product
.
ProductLeadTime
,
product
.
Product
,
product
.
SaleContext
,
stock
.
ShipmentOut
,
...
...
This diff is collapsed.
Click to expand it.
product.py
+
47
−
11
View file @
5bd2ee43
...
...
@@ -2,8 +2,9 @@
# this repository contains the full copyright notices and license terms.
import
datetime
from
trytond.model
import
ModelSQL
,
ModelView
,
fields
from
trytond.modules.company.model
import
CompanyValueMixin
from
sql
import
Null
from
trytond.model
import
ModelSQL
,
ModelView
,
ValueMixin
,
fields
from
trytond.modules.currency.fields
import
Monetary
from
trytond.modules.product
import
price_digits
from
trytond.pool
import
Pool
,
PoolMeta
...
...
@@ -26,7 +27,7 @@
return
datetime
.
timedelta
(
0
)
class
DefaultLeadTime
(
ModelSQL
,
Company
ValueMixin
):
class
DefaultLeadTime
(
ModelSQL
,
ValueMixin
):
"
Product Default Lead Time
"
__name__
=
'
product.configuration.default_lead_time
'
default_lead_time
=
fields
.
TimeDelta
(
"
Default Lead Time
"
)
...
...
@@ -44,14 +45,14 @@
domain
=
[
(
'
category
'
,
'
=
'
,
Eval
(
'
default_uom_category
'
)),
])
lead_time
=
fields
.
TimeDelta
(
"
Lead Time
"
,
states
=
{
'
invisible
'
:
~
Eval
(
'
salable
'
,
False
),
},
help
=
"
The time from confirming the sales order to sending the
"
"
products.
\n
"
"
If empty the default lead time from the configuration is used.
"
)
lead_time
=
fields
.
MultiValue
(
fields
.
TimeDelta
(
"
Lead Time
"
,
states
=
{
'
invisible
'
:
~
Eval
(
'
salable
'
,
False
),
},
help
=
"
The time from confirming the sales order to sending the
"
"
products.
\n
"
"
If empty the default lead time from the configuration is used.
"
)
)
@classmethod
def
__register__
(
cls
,
module_name
):
...
...
@@ -77,6 +78,13 @@
where
=
sql_table
.
id
==
id_
))
table
.
drop_column
(
'
delivery_time
'
)
@classmethod
def
multivalue_model
(
cls
,
field
):
pool
=
Pool
()
if
field
==
'
lead_time
'
:
return
pool
.
get
(
'
product.lead_time
'
)
return
super
().
multivalue_model
(
field
)
@fields.depends
(
'
default_uom
'
,
'
sale_uom
'
,
'
salable
'
)
def
on_change_default_uom
(
self
):
try
:
...
...
@@ -98,6 +106,34 @@
})]
class
ProductLeadTime
(
ModelSQL
,
ValueMixin
):
"
Product Lead Time
"
__name__
=
'
product.lead_time
'
template
=
fields
.
Many2One
(
'
product.template
'
,
"
Template
"
,
ondelete
=
'
CASCADE
'
,
select
=
True
)
lead_time
=
fields
.
TimeDelta
(
"
Lead Time
"
)
@classmethod
def
__register__
(
cls
,
module_name
):
pool
=
Pool
()
Template
=
pool
.
get
(
'
product.template
'
)
template
=
Template
.
__table__
()
table
=
cls
.
__table__
()
super
().
__register__
(
module_name
)
cursor
=
Transaction
().
connection
.
cursor
()
template_h
=
Template
.
__table_handler__
(
module_name
)
if
template_h
.
column_exist
(
'
lead_time
'
):
cursor
.
execute
(
*
table
.
insert
(
columns
=
[
table
.
template
,
table
.
lead_time
],
values
=
template
.
select
(
template
.
id
,
template
.
lead_time
,
where
=
template
.
lead_time
!=
Null
)))
template_h
.
drop_column
(
'
lead_time
'
)
class
Product
(
metaclass
=
PoolMeta
):
__name__
=
'
product.product
'
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment