diff --git a/modules/automation/__init__.py b/modules/automation/__init__.py index 120ea0b..5944d8f 100644 --- a/modules/automation/__init__.py +++ b/modules/automation/__init__.py @@ -1,8 +1,9 @@ from trytond.pool import Pool -from . import automation,rules #, document +from . import automation,rules,freight_booking #, document def register(): Pool.register( automation.AutomationDocument, rules.AutomationRuleSet, + freight_booking.FreightBookingInfo, module='automation', type_='model') \ No newline at end of file diff --git a/modules/automation/freight_booking.py b/modules/automation/freight_booking.py new file mode 100644 index 0000000..370b837 --- /dev/null +++ b/modules/automation/freight_booking.py @@ -0,0 +1,43 @@ +from trytond.model import ModelSQL, ModelView, fields + +class FreightBookingInfo(ModelSQL, ModelView): + "Freight Booking" + __name__ = 'freight.booking' + + booking_number = fields.Char("Booking Number") + agent = fields.Char("Agent") + customer = fields.Char("Customer") + origin = fields.Char("Origin") + destination = fields.Char("Destination") + etd = fields.Date("ETD") + eta = fields.Date("ETA") + carrier = fields.Char("Carrier") + vessel = fields.Char("Vessel") + container_count = fields.Integer("Containers") + gross_weight = fields.Float("Gross Weight") + + @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' + ) + + @classmethod + def __setup__(cls): + super().__setup__() + cls._order = [ + ('etd', 'DESC'), + ] diff --git a/modules/automation/freight_booking.xml b/modules/automation/freight_booking.xml new file mode 100644 index 0000000..8df89fb --- /dev/null +++ b/modules/automation/freight_booking.xml @@ -0,0 +1,25 @@ + + + + freight.booking + tree + freight_booking_info_tree + + + Freight Bookings + freight.booking + + + + + + + + + + diff --git a/modules/automation/tryton.cfg b/modules/automation/tryton.cfg index 5e6faab..0ddc3cc 100644 --- a/modules/automation/tryton.cfg +++ b/modules/automation/tryton.cfg @@ -5,4 +5,5 @@ depends: res document_incoming xml: - automation.xml \ No newline at end of file + automation.xml + freight_booking.xml \ No newline at end of file diff --git a/modules/automation/view/freight_booking_info_tree.xml b/modules/automation/view/freight_booking_info_tree.xml new file mode 100644 index 0000000..24a9d77 --- /dev/null +++ b/modules/automation/view/freight_booking_info_tree.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file