diff --git a/bross_bank_management/__manifest__.py b/bross_bank_management/__manifest__.py index dee887e..1e96a04 100644 --- a/bross_bank_management/__manifest__.py +++ b/bross_bank_management/__manifest__.py @@ -18,6 +18,8 @@ 'views/bank_account_views.xml', 'views/bank_settings_views.xml', 'views/raw_movements.xml', + 'views/bank_deposits_views.xml', + 'views/service_payments_views.xml', ], 'installable': True, 'application': True, diff --git a/bross_bank_management/models/__init__.py b/bross_bank_management/models/__init__.py index ec25dfc..dfb6d80 100644 --- a/bross_bank_management/models/__init__.py +++ b/bross_bank_management/models/__init__.py @@ -2,3 +2,5 @@ from . import bank from . import bank_account from . import bank_settings from . import bank_models +from . import bank_deposits +from . import service_payments diff --git a/bross_bank_management/models/bank_account.py b/bross_bank_management/models/bank_account.py index 8954897..0f0b8bd 100644 --- a/bross_bank_management/models/bank_account.py +++ b/bross_bank_management/models/bank_account.py @@ -1,4 +1,5 @@ -from odoo import models, fields +from odoo import models, fields, _ + class BrosseBankAccount(models.Model): _name = 'brosse.bank.account' diff --git a/bross_bank_management/models/bank_deposits.py b/bross_bank_management/models/bank_deposits.py new file mode 100644 index 0000000..8c8f49d --- /dev/null +++ b/bross_bank_management/models/bank_deposits.py @@ -0,0 +1,9 @@ +from odoo import models, fields, _ + + +class BrosseBankDeposits(models.Model): + _name = 'brosse.bank.deposits' + _description = 'Bank Deposits' + + amount = fields.Monetary(string="Amount", currency_field='currency_id') + currency_id = fields.Many2one('res.currency', string='Account Currency') diff --git a/bross_bank_management/models/service_payments.py b/bross_bank_management/models/service_payments.py new file mode 100644 index 0000000..95c3280 --- /dev/null +++ b/bross_bank_management/models/service_payments.py @@ -0,0 +1,9 @@ +from odoo import models, fields, _ + + +class BrosseServicePayments(models.Model): + _name = 'brosse.service.payments' + _description = 'Service Payments' + + amount = fields.Monetary(string="Amount", currency_field='currency_id') + currency_id = fields.Many2one('res.currency', string='Account Currency') diff --git a/bross_bank_management/security/ir.model.access.csv b/bross_bank_management/security/ir.model.access.csv index 8e6edee..cbd67e8 100644 --- a/bross_bank_management/security/ir.model.access.csv +++ b/bross_bank_management/security/ir.model.access.csv @@ -2,4 +2,6 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink access_brosse_bank_user,access_brosse_bank,model_brosse_bank,base.group_user,1,1,1,1 access_brosse_bank_account_user,access_brosse_bank_account,model_brosse_bank_account,base.group_user,1,1,1,1 access_bank_settings_admin,access_bank_settings,model_bank_settings,base.group_system,1,1,1,1 -bross_bank_management.access_bank_raw_movements,access_bank_raw_movements,bross_bank_management.model_bank_raw_movements,base.group_user,1,1,1,1 \ No newline at end of file +bross_bank_management.access_bank_raw_movements,access_bank_raw_movements,bross_bank_management.model_bank_raw_movements,base.group_user,1,1,1,1 +bross_bank_management.access_brosse_bank_deposits,access_brosse_bank_deposits,bross_bank_management.model_brosse_bank_deposits,base.group_user,1,1,1,1 +bross_bank_management.access_brosse_service_payments,access_brosse_service_payments,bross_bank_management.model_brosse_service_payments,base.group_user,1,1,1,1 \ No newline at end of file diff --git a/bross_bank_management/views/bank_deposits_views.xml b/bross_bank_management/views/bank_deposits_views.xml new file mode 100644 index 0000000..024ba21 --- /dev/null +++ b/bross_bank_management/views/bank_deposits_views.xml @@ -0,0 +1,26 @@ + + + + Deposits + brosse.bank.deposits + + + + + + + + + + Bank Deposits + brosse.bank.deposits + list + + + + + diff --git a/bross_bank_management/views/main_menu.xml b/bross_bank_management/views/main_menu.xml index 57ad76e..1906720 100644 --- a/bross_bank_management/views/main_menu.xml +++ b/bross_bank_management/views/main_menu.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/bross_bank_management/views/service_payments_views.xml b/bross_bank_management/views/service_payments_views.xml new file mode 100644 index 0000000..a06605c --- /dev/null +++ b/bross_bank_management/views/service_payments_views.xml @@ -0,0 +1,26 @@ + + + + Service Payments + brosse.service.payments + + + + + + + + + + Service Payments + brosse.service.payments + list + + + + + diff --git a/bross_hms/__manifest__.py b/bross_hms/__manifest__.py index 7616a8b..48149a9 100644 --- a/bross_hms/__manifest__.py +++ b/bross_hms/__manifest__.py @@ -22,7 +22,12 @@ 'views/amenities.xml', 'views/roomstays.xml', 'views/bookings.xml', + 'views/status.xml', ], - # only loaded in demonstration mode + 'assets': { + 'web.assets_backend': [ + 'bross_hms/static/src/scss/required.scss', + ], + }, } diff --git a/bross_hms/models/__init__.py b/bross_hms/models/__init__.py index 59dac22..6ae3921 100644 --- a/bross_hms/models/__init__.py +++ b/bross_hms/models/__init__.py @@ -1,3 +1,3 @@ # -*- coding: utf-8 -*- -from . import exely_data +from . import hms_data diff --git a/bross_hms/models/exely_data.py b/bross_hms/models/hms_data.py similarity index 60% rename from bross_hms/models/exely_data.py rename to bross_hms/models/hms_data.py index 252f43f..dd38aac 100644 --- a/bross_hms/models/exely_data.py +++ b/bross_hms/models/hms_data.py @@ -11,25 +11,25 @@ _logger = logging.getLogger(__name__) STATES = ['Active', 'Cancelled'] -class ExelyEmail(models.Model): - _name = 'exely.email' - _description = 'Exely Email' +class HmsEmail(models.Model): + _name = 'hms.email' + _description = 'Hms Email' _rec_name = 'email' email = fields.Char(string="Email") -class ExelyPhones(models.Model): - _name = 'exely.phones' - _description = 'Exely Phones' +class HmsPhones(models.Model): + _name = 'hms.phones' + _description = 'Hms Phones' _rec_name = 'phone' phone = fields.Char(string="Phone") -class ExelyCustomer(models.Model): - _name = 'exely.customer' - _description = 'Exely Customer' +class HmsCustomer(models.Model): + _name = 'hms.customer' + _description = 'Hms Customer' _rec_name = 'bid' bid = fields.Char(string="Customer ID", index=True) @@ -39,14 +39,14 @@ class ExelyCustomer(models.Model): birthDate = fields.Char(string="Birth Date") citizenshipCode = fields.Char(string="Citizenship Code") status = fields.Json(string="Status") - emails = fields.Many2many(comodel_name="exely.email", string="Emails") - phones = fields.Many2many(comodel_name="exely.phones", string="Phones") + emails = fields.Many2many(comodel_name="hms.email", string="Emails") + phones = fields.Many2many(comodel_name="hms.phones", string="Phones") gender = fields.Char(string="Gender") -class ExelyRooms(models.Model): - _name = 'exely.rooms' - _description = 'Exely Rooms' +class HmsRooms(models.Model): + _name = 'hms.rooms' + _description = 'Hms Rooms' _rec_name = 'name' bid = fields.Char(string="Room ID", index=True) @@ -55,9 +55,9 @@ class ExelyRooms(models.Model): floorId = fields.Char(string="Floor ID") -class ExelyGuests(models.Model): - _name = 'exely.guests' - _description = 'Exely Guests' +class HmsGuests(models.Model): + _name = 'hms.guests' + _description = 'Hms Guests' _rec_name = 'bid' bid = fields.Char(string="Guest ID", index=True) @@ -67,29 +67,29 @@ class ExelyGuests(models.Model): birthDate = fields.Char(string="Birth Date") citizenshipCode = fields.Char(string="Citizenship Code") status = fields.Json(string="Status") - emails = fields.Many2many(comodel_name="exely.email", string="Emails") - phones = fields.Many2many(comodel_name="exely.phones", string="Phones") + emails = fields.Many2many(comodel_name="hms.email", string="Emails") + phones = fields.Many2many(comodel_name="hms.phones", string="Phones") gender = fields.Char(string="Gender") -class ExelyAmenities(models.Model): - _name = 'exely.amenities' - _description = 'Exely Amenities' +class HmsAmenities(models.Model): + _name = 'hms.amenities' + _description = 'Hms Amenities' _rec_name = 'name' name = fields.Char(string="Name") -class ExelyRoomStays(models.Model): - _name = 'exely.roomstays' - _description = 'Exely RoomStays' +class HmsRoomStays(models.Model): + _name = 'hms.roomstays' + _description = 'Hms RoomStays' _rec_name = 'bid' bid = fields.Char(string="Room raw ID", index=True) bookingId = fields.Char(string="Booking ID", index=True) - roomId = fields.Many2one(comodel_name="exely.rooms", string="Room ID") + roomId = fields.Many2one(comodel_name="hms.rooms", string="Room ID") roomTypeId = fields.Char(string="Room Type ID") - guestsIds = fields.Many2many(comodel_name="exely.guests", string="Guests Ids") + guestsIds = fields.Many2many(comodel_name="hms.guests", string="Guests Ids") checkInDateTime = fields.Char(string="Check In Date Time") checkOutDateTime = fields.Char(string="Check Out Date Time") actualCheckInDateTime = fields.Char(string="Actual Check In Date Time") @@ -98,16 +98,16 @@ class ExelyRoomStays(models.Model): bookingStatus = fields.Char(string="Booking Status") guestCountInfo = fields.Json(string="Guest Count Info") totalPrice = fields.Json(string="Total Price") - amenities = fields.Many2many(comodel_name="exely.amenities", string="Amenities") + amenities = fields.Many2many(comodel_name="hms.amenities", string="Amenities") - bookings_id = fields.Many2one(comodel_name="exely.bookings", string="Room Stay Id") + bookings_id = fields.Many2one(comodel_name="hms.bookings", string="Room Stay Id") -class ExcelyBookings(models.Model): - _name = 'exely.bookings' - _description = 'Exely Bookings' +class HmsBookings(models.Model): + _name = 'hms.bookings' + _description = 'Hms Bookings' _rec_name = 'bid' bid = fields.Char(string="Booking ID", index=True) @@ -118,8 +118,22 @@ class ExcelyBookings(models.Model): lastModified = fields.Char(string="Last Modified") groupName = fields.Char(string="Group Name") currencyId = fields.Char(string="Currency ID") - customer = fields.Many2one(comodel_name="exely.customer", string="Customer") - roomStays = fields.One2many(comodel_name="exely.roomstays", inverse_name="bookings_id", string="RoomStays") + customer = fields.Many2one(comodel_name="hms.customer", string="Customer") + roomStays = fields.One2many(comodel_name="hms.roomstays", inverse_name="bookings_id", string="RoomStays") customerCompany = fields.Json(string="Customer Company") source = fields.Json(string="RoomStays (Json)") sourceChannelName = fields.Char(string="Source Channel Name") + + +class HmsStatus(models.Model): + _name = 'hms.status' + _description = 'Hms Status' + + name = fields.Char(string="Status", required=True) + + +class HmsBookingStatus(models.Model): + _name = 'hms.booking.status' + _description = 'Hms Booking Status' + + name = fields.Char(string="Booking Status", required=True) \ No newline at end of file diff --git a/bross_hms/security/ir.model.access.csv b/bross_hms/security/ir.model.access.csv index 6b51651..647f342 100644 --- a/bross_hms/security/ir.model.access.csv +++ b/bross_hms/security/ir.model.access.csv @@ -1,11 +1,13 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink -bross_hms.access_exely_bookings,access_exely_bookings,bross_hms.model_exely_bookings,base.group_user,1,1,1,1 +bross_hms.access_hms_bookings,access_hms_bookings,bross_hms.model_hms_bookings,base.group_user,1,1,1,1 -bross_hms.access_exely_email,access_exely_email,bross_hms.model_exely_email,base.group_user,1,1,1,1 -bross_hms.access_exely_phones,access_exely_phones,bross_hms.model_exely_phones,base.group_user,1,1,1,1 -bross_hms.access_exely_customer,access_exely_customer,bross_hms.model_exely_customer,base.group_user,1,1,1,1 -bross_hms.access_exely_rooms,access_exely_rooms,bross_hms.model_exely_rooms,base.group_user,1,1,1,1 -bross_hms.access_exely_guests,access_exely_guests,bross_hms.model_exely_guests,base.group_user,1,1,1,1 -bross_hms.access_exely_amenities,access_exely_amenities,bross_hms.model_exely_amenities,base.group_user,1,1,1,1 -bross_hms.access_exely_roomstays,access_exely_roomstays,bross_hms.model_exely_roomstays,base.group_user,1,1,1,1 \ No newline at end of file +bross_hms.access_hms_email,access_hms_email,bross_hms.model_hms_email,base.group_user,1,1,1,1 +bross_hms.access_hms_phones,access_hms_phones,bross_hms.model_hms_phones,base.group_user,1,1,1,1 +bross_hms.access_hms_customer,access_hms_customer,bross_hms.model_hms_customer,base.group_user,1,1,1,1 +bross_hms.access_hms_rooms,access_hms_rooms,bross_hms.model_hms_rooms,base.group_user,1,1,1,1 +bross_hms.access_hms_guests,access_hms_guests,bross_hms.model_hms_guests,base.group_user,1,1,1,1 +bross_hms.access_hms_amenities,access_hms_amenities,bross_hms.model_hms_amenities,base.group_user,1,1,1,1 +bross_hms.access_hms_roomstays,access_hms_roomstays,bross_hms.model_hms_roomstays,base.group_user,1,1,1,1 +bross_hms.access_hms_status,access_hms_status,bross_hms.model_hms_status,base.group_user,1,1,1,1 +bross_hms.access_hms_booking_status,access_hms_booking_status,bross_hms.model_hms_booking_status,base.group_user,1,1,1,1 \ No newline at end of file diff --git a/bross_hms/static/src/scss/required.scss b/bross_hms/static/src/scss/required.scss new file mode 100644 index 0000000..6951246 --- /dev/null +++ b/bross_hms/static/src/scss/required.scss @@ -0,0 +1,27 @@ +.o_required_modifier { + &.o_input, .o_input { + background-color: #D2D2FF!important; + border-top-left-radius: 5px; + border-top-right-radius: 5px; + border-bottom-left-radius: 5px; + border-bottom-right-radius: 5px; + } +} + + +.o_input { + border:$input-border-width solid var(--o-input-border-color); + border-width: 100 100 $input-border-width 0; + padding: $o-input-padding-y $o-input-padding-x; + background-color: var(--o-input-background-color, #{$input-bg}); + + // -- Nested o_input(s) + .o_input { + border: 0; + padding: 0; + } +} + +.o_list_renderer .o_data_row.o_selected_row > .o_data_cell.o_required_modifier:not(.o_readonly_modifier) { + background-color: #D2D2FF!important +} diff --git a/bross_hms/views/amenities.xml b/bross_hms/views/amenities.xml index 5d52446..737b66b 100644 --- a/bross_hms/views/amenities.xml +++ b/bross_hms/views/amenities.xml @@ -1,9 +1,9 @@ - - exely.amenities.tree - exely.amenities + + Amenities + hms.amenities @@ -11,9 +11,9 @@ - - Exely Amenities - exely.amenities + + Amenities + hms.amenities list

@@ -22,6 +22,6 @@ - + diff --git a/bross_hms/views/bookings.xml b/bross_hms/views/bookings.xml index 7e4fec8..cc4d219 100644 --- a/bross_hms/views/bookings.xml +++ b/bross_hms/views/bookings.xml @@ -1,9 +1,9 @@ - - exely.bookings.tree - exely.bookings + + Reception + hms.bookings @@ -16,9 +16,9 @@ - - exely.bookings.form - exely.bookings + + Reception + hms.bookings

@@ -50,9 +50,9 @@ - - Exely Bookings - exely.bookings + + Reception + hms.bookings list,form

@@ -61,6 +61,6 @@ - + diff --git a/bross_hms/views/customers.xml b/bross_hms/views/customers.xml index 1870338..1310b5c 100644 --- a/bross_hms/views/customers.xml +++ b/bross_hms/views/customers.xml @@ -1,9 +1,9 @@ - - exely.customer.tree - exely.customer + + Customer + hms.customer @@ -17,9 +17,9 @@ - - exely.customer.form - exely.customer + + Customer + hms.customer

@@ -51,9 +51,9 @@ - - - Exely Customers - exely.customer + + Customer + hms.customer list,form,pivot,graph

@@ -73,6 +73,6 @@ - + diff --git a/bross_hms/views/emails.xml b/bross_hms/views/emails.xml index fb56277..6ad4051 100644 --- a/bross_hms/views/emails.xml +++ b/bross_hms/views/emails.xml @@ -1,9 +1,9 @@ - - exely.email.tree - exely.email + + Email + hms.email @@ -11,9 +11,9 @@ - - Exely Emails - exely.email + + Email + hms.email list

@@ -22,6 +22,6 @@ - + diff --git a/bross_hms/views/guests.xml b/bross_hms/views/guests.xml index 49f6ecd..9adf381 100644 --- a/bross_hms/views/guests.xml +++ b/bross_hms/views/guests.xml @@ -1,9 +1,9 @@ - - exely.guests.tree - exely.guests + + Guest + hms.guests @@ -20,9 +20,9 @@ - - exely.guests.form - exely.guests + + Guest + hms.guests

@@ -52,9 +52,9 @@ - - Exely Guests - exely.guests + + Guest + hms.guests list,form

@@ -63,6 +63,6 @@ - + diff --git a/bross_hms/views/main_menus.xml b/bross_hms/views/main_menus.xml index 14fdfd7..aab84a1 100644 --- a/bross_hms/views/main_menus.xml +++ b/bross_hms/views/main_menus.xml @@ -1,7 +1,13 @@ - + - + + + + + + + \ No newline at end of file diff --git a/bross_hms/views/phones.xml b/bross_hms/views/phones.xml index 579f741..a07e6b7 100644 --- a/bross_hms/views/phones.xml +++ b/bross_hms/views/phones.xml @@ -1,9 +1,9 @@ - - exely.phones.tree - exely.phones + + Phone + hms.phones @@ -11,9 +11,9 @@ - - Exely Phones - exely.phones + + Phone + hms.phones list

@@ -22,6 +22,6 @@ - + diff --git a/bross_hms/views/rooms.xml b/bross_hms/views/rooms.xml index f30fd43..e68a144 100644 --- a/bross_hms/views/rooms.xml +++ b/bross_hms/views/rooms.xml @@ -1,9 +1,9 @@ - - exely.rooms.tree - exely.rooms + + Room + hms.rooms @@ -14,9 +14,9 @@ - - Exely Rooms - exely.rooms + + Room + hms.rooms list

@@ -25,6 +25,6 @@ - + diff --git a/bross_hms/views/roomstays.xml b/bross_hms/views/roomstays.xml index 2ad4d4f..db3364a 100644 --- a/bross_hms/views/roomstays.xml +++ b/bross_hms/views/roomstays.xml @@ -1,9 +1,9 @@ - - exely.roomstays.tree - exely.roomstays + + Roomstays + hms.roomstays @@ -18,9 +18,9 @@ - - exely.roomstays.form - exely.roomstays + + Roomstays + hms.roomstays

@@ -46,9 +46,9 @@ - - Exely Room Stays - exely.roomstays + + RoomStays + hms.roomstays list,form

@@ -57,6 +57,6 @@ - + diff --git a/bross_hms/views/status.xml b/bross_hms/views/status.xml new file mode 100644 index 0000000..1e418d4 --- /dev/null +++ b/bross_hms/views/status.xml @@ -0,0 +1,52 @@ + + + + + Status + hms.status + + + + + + + + + Status + hms.status + list + +

+ Create your first status record. +

+
+
+ + + + + + + Booking Status + hms.booking.status + + + + + + + + + Booking Status + hms.booking.status + list + +

+ Create your first booking status record. +

+
+
+ + + + diff --git a/docker-compose.yml b/docker-compose.yml index 6c94c7c..1ecf99d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -20,8 +20,8 @@ services: - 5678:5678 # - 8069:8069 volumes: - - /opt/nvme_disk/docker_data/code_server/code_projects/odoo18/:/opt/odoo/ - - /opt/nvme_disk/docker_data/code_server/code_projects/odoo18/customaddons/${CUSTOMADDONS_DIR}/odoo.conf:/etc/odoo.conf + - /opt/nvme_disk/docker_data/code_server/config/workspace/odoo18/:/opt/odoo/ + - /opt/nvme_disk/docker_data/code_server/config/workspace/odoo18/customaddons/${CUSTOMADDONS_DIR}/odoo.conf:/etc/odoo.conf - /opt/nvme_disk/docker_data/code_server/code_projects_data/odoo18_odoo_filestore:/root/.local/share/Odoo/ depends_on: - db @@ -37,7 +37,7 @@ services: ports: - 80:80 volumes: - - /opt/nvme_disk/docker_data/code_server/code_projects/odoo18/customaddons/${CUSTOMADDONS_DIR}/nginx.conf:/etc/nginx/conf.d/default.conf + - /opt/nvme_disk/docker_data/code_server/config/workspace/odoo18/customaddons/${CUSTOMADDONS_DIR}/nginx.conf:/etc/nginx/conf.d/default.conf depends_on: - odoo diff --git a/exely_integration/models/exely_raw_data.py b/exely_integration/models/exely_raw_data.py index 85be3c0..7d6b75e 100644 --- a/exely_integration/models/exely_raw_data.py +++ b/exely_integration/models/exely_raw_data.py @@ -260,7 +260,7 @@ class ExelyModifiedData(models.Model): ## break def process_exely_data(self): - found_booking_record = self.env['exely.bookings'].search([], order="write_date desc", limit=1) + found_booking_record = self.env['hms.bookings'].search([], order="write_date desc", limit=1) if found_booking_record: max_date = found_booking_record.write_date else: @@ -279,22 +279,22 @@ class ExelyModifiedData(models.Model): customer['bid'] = customer.pop('id') if customer.get('emails', None): customer['emails'] = [(6, 0, [ - self.env['exely.email'].search([('email', '=', email)], limit=1).id or - self.env['exely.email'].create({'email': email}).id + self.env['hms.email'].search([('email', '=', email)], limit=1).id or + self.env['hms.email'].create({'email': email}).id for email in customer['emails'] ])] if customer.get('phones', None): customer['phones'] = [(6, 0, [ - self.env['exely.phones'].search([('phone', '=', phone)], limit=1).id or - self.env['exely.phones'].create({'phone': phone}).id + self.env['hms.phones'].search([('phone', '=', phone)], limit=1).id or + self.env['hms.phones'].create({'phone': phone}).id for phone in customer['phones'] ])] - found_customer = self.env['exely.customer'].search([('bid', '=', customer['bid'])]) + found_customer = self.env['hms.customer'].search([('bid', '=', customer['bid'])]) if found_customer: customer_id = found_customer.id else: - customer_id = self.env['exely.customer'].create(customer).id + customer_id = self.env['hms.customer'].create(customer).id data['customer'] = customer_id roomstays = data.pop('roomStays', None) @@ -304,7 +304,7 @@ class ExelyModifiedData(models.Model): roomstay['bid'] = roomstay.pop('id') if roomstay.get('roomId', None): - roomstay['roomId'] = self.env['exely.rooms'].search([('bid', '=', roomstay['roomId'])]).id + roomstay['roomId'] = self.env['hms.rooms'].search([('bid', '=', roomstay['roomId'])]).id guests = roomstay.pop('guestsIds', None) @@ -317,22 +317,22 @@ class ExelyModifiedData(models.Model): if guest_data: if guest_data.get('emails', None): guest_data['emails'] = [(6, 0, [ - self.env['exely.email'].search([('email', '=', email)], limit=1).id or - self.env['exely.email'].create({'email': email}).id + self.env['hms.email'].search([('email', '=', email)], limit=1).id or + self.env['hms.email'].create({'email': email}).id for email in guest_data['emails'] ])] if guest_data.get('phones', None): guest_data['phones'] = [(6, 0, [ - self.env['exely.phones'].search([('phone', '=', phone)], limit=1).id or - self.env['exely.phones'].create({'phone': phone}).id + self.env['hms.phones'].search([('phone', '=', phone)], limit=1).id or + self.env['hms.phones'].create({'phone': phone}).id for phone in guest_data['phones'] ])] - found_guest = self.env['exely.guests'].search([('bid', '=', guest)]) + found_guest = self.env['hms.guests'].search([('bid', '=', guest)]) if found_guest: guest_id = found_guest.id else: - guest_id = self.env['exely.guests'].create(guest_data).id + guest_id = self.env['hms.guests'].create(guest_data).id guest_ids.append(guest_id) if guest_ids: @@ -343,21 +343,21 @@ class ExelyModifiedData(models.Model): if not amenities: amenity_ids = [] for amenity in amenities: - found_amenity = self.env['exely.amenities'].search([('name', '=', amenity)]) + found_amenity = self.env['hms.amenities'].search([('name', '=', amenity)]) if found_amenity: amenity_id = found_amenity.id else: - amenity_id = self.env['exely.amenities'].create({'name': amenity}).id + amenity_id = self.env['hms.amenities'].create({'name': amenity}).id amenity_ids.append(amenity_id) if amenity_ids: roomstay['amenities'] = [(6, 0, amenity_ids)] - found_roomstay = self.env['exely.roomstays'].search([('bid', '=', roomstay['bid'])]) + found_roomstay = self.env['hms.roomstays'].search([('bid', '=', roomstay['bid'])]) if found_roomstay: roomstay_id = found_roomstay.id else: - roomstay_id = self.env['exely.roomstays'].create(roomstay).id + roomstay_id = self.env['hms.roomstays'].create(roomstay).id roomstays_ids.append(roomstay_id) if roomstays_ids: @@ -368,7 +368,7 @@ class ExelyModifiedData(models.Model): if to_create: for i in to_create: try: - self.env['exely.bookings'].create(i) + self.env['hms.bookings'].create(i) except Exception as e: _logger.warning(f"##############################: {i}") @@ -521,9 +521,9 @@ class ExelyModifiedData(models.Model): # self.env['exely.bookings'].create(to_create) -class ExcelyBookings(models.Model): - _inherit = 'exely.bookings' - _description = 'Exely Bookings' +class HmsBookings(models.Model): + _inherit = 'hms.bookings' + _description = 'Hms Bookings' _rec_name = 'bid' \ No newline at end of file diff --git a/exely_integration/views/main_menu.xml b/exely_integration/views/main_menu.xml index 6fa9ec0..6fcbd6f 100644 --- a/exely_integration/views/main_menu.xml +++ b/exely_integration/views/main_menu.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/nbg_exchange_rates/LICENSE b/nbg_exchange_rates/LICENSE new file mode 100644 index 0000000..b01eaf1 --- /dev/null +++ b/nbg_exchange_rates/LICENSE @@ -0,0 +1,27 @@ +Odoo Proprietary License v1.0 + +This software and associated files (the "Software") may only be used (executed, +modified, executed after modifications) if you have purchased a valid license +from the authors, typically via Odoo Apps, or if you have received a written +agreement from the authors of the Software (see the COPYRIGHT file). + +You may develop Odoo modules that use the Software as a library (typically +by depending on it, importing it and using its resources), but without copying +any source code or material from the Software. You may distribute those +modules under the license of your choice, provided that this license is +compatible with the terms of the Odoo Proprietary License (For example: +LGPL, MIT, or proprietary licenses similar to this one). + +It is forbidden to publish, distribute, sublicense, or sell copies of the Software +or modified copies of the Software. + +The above copyright notice and this permission notice must be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff --git a/nbg_exchange_rates/__init__.py b/nbg_exchange_rates/__init__.py new file mode 100644 index 0000000..9a7e03e --- /dev/null +++ b/nbg_exchange_rates/__init__.py @@ -0,0 +1 @@ +from . import models \ No newline at end of file diff --git a/nbg_exchange_rates/__manifest__.py b/nbg_exchange_rates/__manifest__.py new file mode 100644 index 0000000..cca80a8 --- /dev/null +++ b/nbg_exchange_rates/__manifest__.py @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- +{ + 'name': "NBG exchange rates", + 'summary': """NBG exchange rates.""", + 'description': + """ + NBG exchange rates. + """, + 'author': "mgite", + # 'website': "https://example.com", + 'price': '5.0', + 'currency': 'EUR', + 'support': 'matemana2608@gmail.com', + 'license': 'OPL-1', + 'category': 'Tools', + 'version': '18.0.1.0.0', + 'images': ['static/description/wallpaper.png'], + 'depends': [ + 'base', + ], + 'data': [ + 'cron/ir_cron.xml', + ], + 'installable': True, + 'application': True, + 'auto_install': False, +} diff --git a/nbg_exchange_rates/cron/ir_cron.xml b/nbg_exchange_rates/cron/ir_cron.xml new file mode 100644 index 0000000..a9d1e2b --- /dev/null +++ b/nbg_exchange_rates/cron/ir_cron.xml @@ -0,0 +1,17 @@ + + + + + NBG: get exchange rates + + code + model.get_exchange_rates() + 1 + days + + + + 5 + + + \ No newline at end of file diff --git a/nbg_exchange_rates/models/__init__.py b/nbg_exchange_rates/models/__init__.py new file mode 100644 index 0000000..c1eedcb --- /dev/null +++ b/nbg_exchange_rates/models/__init__.py @@ -0,0 +1 @@ +from . import res_currency \ No newline at end of file diff --git a/nbg_exchange_rates/models/res_currency.py b/nbg_exchange_rates/models/res_currency.py new file mode 100644 index 0000000..68dd6f0 --- /dev/null +++ b/nbg_exchange_rates/models/res_currency.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +from odoo import models, fields, api +from odoo.exceptions import UserError, ValidationError +from zeep import Client +import logging + +_logger = logging.getLogger(__name__) + + +class ResCurrency(models.Model): + _inherit = "res.currency" + + @api.model + def get_exchange_rates(self): + default_currency = self.env.ref('base.main_company').currency_id + active_currencies = self.env['res.currency'].search([('active','=',True)]) + WSDLFILE = 'https://services.nbg.gov.ge/Rates/Service.asmx?wsdl' + + try: + _server = Client(WSDLFILE) + if default_currency.name == 'GEL': + base_rate = 1.0 + else: + base_rate = _server.service.GetCurrentRates(default_currency.name)[0].Rate + date = _server.service.GetCurrentRates()[0].Date + + for currency in active_currencies: + if currency.rate_ids.filtered(lambda r: r.name == fields.Date.today()): + continue + if currency.name != 'GEL': + found_currency_obj = _server.service.GetCurrentRates(currency.name) + if found_currency_obj: + rate_obj = found_currency_obj[0] + rate_num = rate_obj.Rate + currency_amount = rate_obj.Quantity + if currency_amount and int(currency_amount) != 1: + rate_num = float(rate_num) / int(currency_amount) + if rate_num: + calculated_rate = float(base_rate) / float(rate_num) + calculated_rate = 1 / calculated_rate + currency.write({'rate_ids': [(0, 0, {'name': date, 'rate': calculated_rate})]}) + else: + currency.write({'rate_ids': [(0, 0, {'name': date, 'rate': float(base_rate)})]}) + except Exception as e: + _logger.error(f"Failed to get echange rates. {e}") diff --git a/nbg_exchange_rates/static/description/icon.png b/nbg_exchange_rates/static/description/icon.png new file mode 100644 index 0000000..71a4bf2 Binary files /dev/null and b/nbg_exchange_rates/static/description/icon.png differ diff --git a/nbg_exchange_rates/static/description/index.html b/nbg_exchange_rates/static/description/index.html new file mode 100644 index 0000000..bc69256 --- /dev/null +++ b/nbg_exchange_rates/static/description/index.html @@ -0,0 +1,23 @@ + + + + + + NBG exchange rates + + + + + +
+
+

+ Details +

+

+ This module leverages NBG services to fetch the latest currency exchange rates for currencies currently in use within Odoo. The retrieved rates are then seamlessly stored in the database, ensuring accurate and up-to-date financial information. +

+
+
+ + diff --git a/nbg_exchange_rates/static/description/wallpaper.png b/nbg_exchange_rates/static/description/wallpaper.png new file mode 100644 index 0000000..227b372 Binary files /dev/null and b/nbg_exchange_rates/static/description/wallpaper.png differ