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 213f76b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 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
16 changes: 10 additions & 6 deletions hotel/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@ 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)
folio_id = self._context.get("folio_id")

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

View check run for this annotation

Codecov / codecov/patch

hotel/models/account_move.py#L13-L14

Added lines #L13 - L14 were not covered by tests
if folio_id:
folio = self.env["hotel.folio"].browse(folio_id)
folio.write(

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

View check run for this annotation

Codecov / codecov/patch

hotel/models/account_move.py#L16-L17

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

return res

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

View check run for this annotation

Codecov / codecov/patch

hotel/models/account_move.py#L21

Added line #L21 was not covered by tests
2 changes: 1 addition & 1 deletion 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 Down

0 comments on commit 213f76b

Please sign in to comment.