Fix input of RequestedDeliveryDate in order head. Error handling in Company.get
This commit is contained in:
parent
0330e7a4bf
commit
7288e88135
2 changed files with 10 additions and 4 deletions
|
|
@ -407,7 +407,9 @@ class Order(RawBaseModel):
|
|||
'adapters': {
|
||||
**{
|
||||
'OrdDatum': lambda ord_date, *_: ord_date.strftime("%Y-%m-%d"),
|
||||
'OrdBerLevDat': lambda ord_date, *_: ord_date.strftime("%Y-%m-%d"),
|
||||
'OrdBerLevDat': lambda deliv_date, *_: (
|
||||
deliv_date.strftime("%Y-%m-%d")
|
||||
if not isinstance(deliv_date, str) else deliv_date),
|
||||
},
|
||||
**RawBaseModel.__dict_args__['adapters']
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ from pyjeeves.models.raw import Company as CompanyModel, Customer as CustomerMod
|
|||
from pyjeeves.models import db
|
||||
from sqlalchemy.sql.expression import and_
|
||||
from sqlalchemy.orm.strategy_options import Load
|
||||
from sqlalchemy.orm.exc import NoResultFound
|
||||
|
||||
from pyjeeves import logging
|
||||
logger = logging.getLogger("PyJeeves." + __name__)
|
||||
|
|
@ -16,9 +17,12 @@ class Company():
|
|||
@staticmethod
|
||||
def get(ftg_nr):
|
||||
""" Query an article by number """
|
||||
try:
|
||||
return db.raw.query(CompanyModel).filter_by(
|
||||
FtgNr=ftg_nr
|
||||
).one()
|
||||
except NoResultFound:
|
||||
raise KeyError
|
||||
|
||||
@staticmethod
|
||||
def get_all_active_customers():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue