Enforce positive timedelta
issue11869 review421921004
This commit is contained in:
+7
-2
@@ -6,7 +6,7 @@ from trytond.model import (
|
||||
from trytond.modules.company.model import (
|
||||
CompanyMultiValueMixin, CompanyValueMixin)
|
||||
from trytond.pool import Pool
|
||||
from trytond.pyson import Eval, Id
|
||||
from trytond.pyson import Eval, Id, TimeDelta
|
||||
from trytond.tools.multivalue import migrate_property
|
||||
|
||||
purchase_invoice_method = fields.Selection(
|
||||
@@ -36,7 +36,12 @@ class Configuration(
|
||||
]))
|
||||
purchase_invoice_method = fields.MultiValue(purchase_invoice_method)
|
||||
get_purchase_invoice_method = get_purchase_methods('invoice_method')
|
||||
purchase_process_after = fields.TimeDelta("Process Purchase after",
|
||||
purchase_process_after = fields.TimeDelta(
|
||||
"Process Purchase after",
|
||||
domain=['OR',
|
||||
('purchase_process_after', '=', None),
|
||||
('purchase_process_after', '>=', TimeDelta()),
|
||||
],
|
||||
help="The grace period during which confirmed purchase "
|
||||
"can still be reset to draft.\n"
|
||||
"Applied only if a worker queue is activated.")
|
||||
|
||||
@@ -6,11 +6,20 @@ from trytond.modules.company.model import (
|
||||
CompanyMultiValueMixin, CompanyValueMixin)
|
||||
from trytond.modules.party.exceptions import EraseError
|
||||
from trytond.pool import Pool, PoolMeta
|
||||
from trytond.pyson import Eval
|
||||
from trytond.pyson import Eval, TimeDelta
|
||||
|
||||
supplier_currency = fields.Many2One(
|
||||
'currency.currency', "Supplier Currency",
|
||||
help="Default currency for purchases from this party.")
|
||||
supplier_lead_time = fields.TimeDelta(
|
||||
"Lead Time",
|
||||
domain=['OR',
|
||||
('supplier_lead_time', '=', None),
|
||||
('supplier_lead_time', '>=', TimeDelta()),
|
||||
],
|
||||
help="The time from confirming the purchase order to receiving "
|
||||
"the goods from the party when used as a supplier.\n"
|
||||
"Used if no lead time is set on the product supplier.")
|
||||
|
||||
|
||||
class Party(CompanyMultiValueMixin, metaclass=PoolMeta):
|
||||
@@ -20,10 +29,7 @@ class Party(CompanyMultiValueMixin, metaclass=PoolMeta):
|
||||
" as customer."))
|
||||
customer_codes = fields.One2Many(
|
||||
'party.party.customer_code', 'party', "Customer Codes")
|
||||
supplier_lead_time = fields.MultiValue(fields.TimeDelta("Lead Time",
|
||||
help="The time from confirming the purchase order to receiving "
|
||||
"the goods from the party when used as a supplier.\n"
|
||||
"Used if no lead time is set on the product supplier."))
|
||||
supplier_lead_time = fields.MultiValue(supplier_lead_time)
|
||||
supplier_lead_times = fields.One2Many(
|
||||
'party.party.supplier_lead_time', 'party', "Lead Times")
|
||||
supplier_currency = fields.MultiValue(supplier_currency)
|
||||
@@ -52,7 +58,7 @@ class SupplierLeadTime(ModelSQL, CompanyValueMixin):
|
||||
'company': Eval('company', -1),
|
||||
},
|
||||
depends={'company'})
|
||||
supplier_lead_time = fields.TimeDelta("Lead Time")
|
||||
supplier_lead_time = supplier_lead_time
|
||||
|
||||
|
||||
class PartySupplierCurrency(ModelSQL, ValueMixin):
|
||||
|
||||
+7
-2
@@ -12,7 +12,7 @@ from trytond.model import (
|
||||
from trytond.modules.currency.fields import Monetary
|
||||
from trytond.modules.product import price_digits
|
||||
from trytond.pool import Pool, PoolMeta
|
||||
from trytond.pyson import Bool, Eval, If
|
||||
from trytond.pyson import Bool, Eval, If, TimeDelta
|
||||
from trytond.tools import is_full_text, lstrip_wildcard
|
||||
from trytond.transaction import Transaction
|
||||
|
||||
@@ -285,7 +285,12 @@ class ProductSupplier(
|
||||
company = fields.Many2One(
|
||||
'company.company', "Company",
|
||||
required=True, ondelete='CASCADE')
|
||||
lead_time = fields.TimeDelta('Lead Time',
|
||||
lead_time = fields.TimeDelta(
|
||||
"Lead Time",
|
||||
domain=['OR',
|
||||
('lead_time', '=', None),
|
||||
('lead_time', '>=', TimeDelta()),
|
||||
],
|
||||
help="The time from confirming the purchase order to receiving the "
|
||||
"products.\n"
|
||||
"If empty the lead time of the supplier is used.")
|
||||
|
||||
Reference in New Issue
Block a user