This commit is contained in:
2026-01-18 20:52:20 +01:00
parent 6b2d5aebf8
commit 178fb25a2f
2 changed files with 23 additions and 15 deletions

View File

@@ -1,4 +1,7 @@
from trytond.model import ModelSQL, ModelView, fields 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): class FreightBookingInfo(ModelSQL, ModelView):
"Freight Booking" "Freight Booking"
@@ -18,21 +21,25 @@ class FreightBookingInfo(ModelSQL, ModelView):
@classmethod @classmethod
def table_query(cls): def table_query(cls):
return ( t = Table('freight_booking_info')
'SELECT '
' ROW_NUMBER() OVER () AS id, ' return t.select(
' booking_number, ' Literal(0).as_('create_uid'),
' agent, ' CurrentTimestamp().as_('create_date'),
' customer, ' Literal(None).as_('write_uid'),
' origin, ' Literal(None).as_('write_date'),
' destination, ' t.booking_number.as_('id'),
' etd, ' t.booking_number,
' eta, ' t.agent,
' carrier, ' t.customer,
' vessel, ' t.origin,
' container_count, ' t.destination,
' gross_weight ' t.etd,
'FROM public.freight_booking_info' t.eta,
t.carrier,
t.vessel,
t.container_count,
t.gross_weight
) )
@classmethod @classmethod

View File

@@ -7,6 +7,7 @@
<field name="etd"/> <field name="etd"/>
<field name="eta"/> <field name="eta"/>
<field name="carrier"/> <field name="carrier"/>
<field name="vessel"/>
<field name="container_count"/> <field name="container_count"/>
<field name="gross_weight"/> <field name="gross_weight"/>
</tree> </tree>