11.02.26
This commit is contained in:
@@ -2,6 +2,9 @@ from trytond.model import ModelSQL, ModelView, fields
|
|||||||
from trytond.pool import Pool
|
from trytond.pool import Pool
|
||||||
from decimal import Decimal, ROUND_HALF_UP
|
from decimal import Decimal, ROUND_HALF_UP
|
||||||
from datetime import datetime as dt
|
from datetime import datetime as dt
|
||||||
|
import logging
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
class WeightReport(ModelSQL, ModelView):
|
class WeightReport(ModelSQL, ModelView):
|
||||||
'Weight Report'
|
'Weight Report'
|
||||||
@@ -93,6 +96,7 @@ class WeightReport(ModelSQL, ModelView):
|
|||||||
# Conversion de la date (format: "28 October 2025")
|
# Conversion de la date (format: "28 October 2025")
|
||||||
|
|
||||||
def parse_date(date_str):
|
def parse_date(date_str):
|
||||||
|
logger.info("TRY_TO_PARSE:%s",date_str)
|
||||||
for fmt in ('%d %B %Y', '%d %b %Y'):
|
for fmt in ('%d %B %Y', '%d %b %Y'):
|
||||||
try:
|
try:
|
||||||
return dt.strptime(date_str, fmt).date()
|
return dt.strptime(date_str, fmt).date()
|
||||||
@@ -102,6 +106,7 @@ class WeightReport(ModelSQL, ModelView):
|
|||||||
|
|
||||||
report['report_date'] = parse_date(report_data.get('date', ''))
|
report['report_date'] = parse_date(report_data.get('date', ''))
|
||||||
report['weight_date'] = parse_date(report_data.get('weight_date', ''))
|
report['weight_date'] = parse_date(report_data.get('weight_date', ''))
|
||||||
|
logger.info("RETRUN_DATE:%s",report['weight_date'])
|
||||||
# 3. Contract Information
|
# 3. Contract Information
|
||||||
contract_data = json_data.get('contract', {})
|
contract_data = json_data.get('contract', {})
|
||||||
report['contract_no'] = contract_data.get('contract_no', '')
|
report['contract_no'] = contract_data.get('contract_no', '')
|
||||||
|
|||||||
Reference in New Issue
Block a user