53 lines
1.7 KiB
Python
53 lines
1.7 KiB
Python
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"
|
|
__name__ = 'freight.booking'
|
|
|
|
booking_number = fields.Char("Booking Number")
|
|
agent = fields.Char("Agent")
|
|
controller = fields.Char("Customer")
|
|
origin = fields.Char("Origin")
|
|
destination = fields.Char("Destination")
|
|
etd = fields.Date("ETD")
|
|
bl_date = fields.Date("BL date")
|
|
bl_number = fields.Char("BL Nb")
|
|
carrier = fields.Char("Carrier")
|
|
vessel = fields.Char("Vessel")
|
|
container_count = fields.Integer("Containers")
|
|
quantity = fields.Float("Gross Weight")
|
|
|
|
@classmethod
|
|
def table_query(cls):
|
|
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.FintradeBookingKey+t.ShippingInstructionNumber).as_('id'),
|
|
t.ShippingInstructionNumber.as_('booking_number'),
|
|
t.BookingAgent.as_('agent'),
|
|
t.ExpectedController.as_('controller'),
|
|
t.Loading.as_('origin'),
|
|
t.Destination.as_('destination'),
|
|
t.ETD_Date.as_('etd'),
|
|
t.BL_Date.as_('bl_date'),
|
|
t.BL_Number.as_('bl_number'),
|
|
t.Carrier.as_('carrier'),
|
|
t.Vessel.as_('vessel'),
|
|
t.NumberOfContainers.as_('container_count'),
|
|
t.ShippingInstructionQuantity.as_('quantity')
|
|
)
|
|
|
|
@classmethod
|
|
def __setup__(cls):
|
|
super().__setup__()
|
|
cls._order = [
|
|
('etd', 'DESC'),
|
|
]
|