Skip to content

Commit

Permalink
[IMP][16.0] hotel:Implement code changes as per review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
pavan-serpentcs committed Sep 2, 2024
1 parent ece3382 commit efd6968
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion hotel/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
Services Pvt. Ltd., OpenERP SA",
"category": "Hotel Management",
"website": "https://github.com/OCA/vertical-hotel",
"depends": ["sale_stock", "account", "uom"],
"depends": ["sale_stock", "account"],
"license": "LGPL-3",
"summary": "Hotel Management to Manage Folio and Hotel Configuration",
"demo": ["demo/hotel_data.xml"],
Expand Down
18 changes: 12 additions & 6 deletions hotel/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,16 @@ class AccountMove(models.Model):

_inherit = "account.move"

@api.model
def create(self, vals):
res = super(AccountMove, self).create(vals)
if self._context.get("folio_id"):
folio = self.env["hotel.folio"].browse(self._context["folio_id"])
folio.write({"hotel_invoice_id": res.id, "invoice_status": "invoiced"})
@api.model_create_multi
def create(self, vals_list):
res = super(AccountMove, self).create(vals_list)

Check warning on line 13 in hotel/models/account_move.py

View check run for this annotation

Codecov / codecov/patch

hotel/models/account_move.py#L13

Added line #L13 was not covered by tests

folio_id = self._context.get("folio_id")

Check warning on line 15 in hotel/models/account_move.py

View check run for this annotation

Codecov / codecov/patch

hotel/models/account_move.py#L15

Added line #L15 was not covered by tests
if folio_id:
folio = self.env["hotel.folio"].browse(folio_id)
folio.write({

Check warning on line 18 in hotel/models/account_move.py

View check run for this annotation

Codecov / codecov/patch

hotel/models/account_move.py#L17-L18

Added lines #L17 - L18 were not covered by tests
"hotel_invoice_id": [(6, 0, res.ids)],
"invoice_status": "invoiced"
})

return res

Check warning on line 23 in hotel/models/account_move.py

View check run for this annotation

Codecov / codecov/patch

hotel/models/account_move.py#L23

Added line #L23 was not covered by tests
4 changes: 2 additions & 2 deletions hotel/models/hotel_folio.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def create(self, vals_list):
@return: new record set for hotel folio.
"""
for vals in vals_list:
if not "service_line_ids" and "folio_id" in vals:
if "service_line_ids" not in vals and "folio_id" in vals:
tmp_room_lines = vals.get("room_line_ids", [])
vals["order_policy"] = vals.get("hotel_policy", "manual")
vals.update({"room_line_ids": []})
Expand All @@ -192,7 +192,7 @@ def create(self, vals_list):
folio_id = super(HotelFolio, self).create(vals)
self._update_folio_line(folio_id)
return folio_id

def write(self, vals):
"""
Overrides orm write method.
Expand Down

0 comments on commit efd6968

Please sign in to comment.