diff --git a/modules/automation/freight_booking.py b/modules/automation/freight_booking.py
index 370b837..d9b17db 100644
--- a/modules/automation/freight_booking.py
+++ b/modules/automation/freight_booking.py
@@ -1,4 +1,7 @@
from trytond.model import ModelSQL, ModelView, fields
+from sql import Table
+from sql.functions import CurrentTimestamp
+from sql import Column, Literal
class FreightBookingInfo(ModelSQL, ModelView):
"Freight Booking"
@@ -18,21 +21,25 @@ class FreightBookingInfo(ModelSQL, ModelView):
@classmethod
def table_query(cls):
- return (
- 'SELECT '
- ' ROW_NUMBER() OVER () AS id, '
- ' booking_number, '
- ' agent, '
- ' customer, '
- ' origin, '
- ' destination, '
- ' etd, '
- ' eta, '
- ' carrier, '
- ' vessel, '
- ' container_count, '
- ' gross_weight '
- 'FROM public.freight_booking_info'
+ t = Table('freight_booking_info')
+
+ return t.select(
+ Literal(0).as_('create_uid'),
+ CurrentTimestamp().as_('create_date'),
+ Literal(None).as_('write_uid'),
+ Literal(None).as_('write_date'),
+ t.booking_number.as_('id'),
+ t.booking_number,
+ t.agent,
+ t.customer,
+ t.origin,
+ t.destination,
+ t.etd,
+ t.eta,
+ t.carrier,
+ t.vessel,
+ t.container_count,
+ t.gross_weight
)
@classmethod
diff --git a/modules/automation/view/freight_booking_info_tree.xml b/modules/automation/view/freight_booking_info_tree.xml
index 24a9d77..c9ad5df 100644
--- a/modules/automation/view/freight_booking_info_tree.xml
+++ b/modules/automation/view/freight_booking_info_tree.xml
@@ -7,6 +7,7 @@
+
\ No newline at end of file