odoo-addon-pms 16.0.0.15.0.10__py3-none-any.whl → 16.0.0.24.0.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -73,7 +73,7 @@ class PmsReservationLine(models.Model):
73
73
  pricelist_item_id = fields.Many2one(
74
74
  comodel_name="product.pricelist.item", compute="_compute_pricelist_item_id"
75
75
  )
76
- price = fields.Float(
76
+ price = fields.Monetary(
77
77
  help="The price in a reservation line",
78
78
  store=True,
79
79
  readonly=False,
@@ -105,7 +105,7 @@ class PmsReservationLine(models.Model):
105
105
  default=0.0,
106
106
  digits=("Discount"),
107
107
  )
108
- price_day_total = fields.Float(
108
+ price_day_total = fields.Monetary(
109
109
  string="Final price",
110
110
  help="Get the price with discount applied",
111
111
  store=True,
@@ -183,7 +183,7 @@ class PmsService(models.Model):
183
183
  store=True,
184
184
  compute="_compute_amount_service",
185
185
  )
186
- price_tax = fields.Float(
186
+ price_tax = fields.Monetary(
187
187
  string="Taxes Amount",
188
188
  help="Total of taxes in service",
189
189
  readonly=True,
@@ -191,7 +191,7 @@ class PmsService(models.Model):
191
191
  compute="_compute_amount_service",
192
192
  )
193
193
 
194
- discount = fields.Float(
194
+ discount = fields.Monetary(
195
195
  help="Discount of total price",
196
196
  readonly=False,
197
197
  store=True,
@@ -232,24 +232,16 @@ class PmsService(models.Model):
232
232
  origin = record.reservation_id if record.reservation_id else record.folio_id
233
233
  record.pricelist_id = origin.pricelist_id
234
234
 
235
- @api.depends("product_id", "folio_id.partner_id", "reservation_id.partner_id")
235
+ @api.depends("product_id", "folio_id.fiscal_position_id")
236
236
  def _compute_tax_ids(self):
237
237
  for service in self:
238
- partner = (
239
- service.reservation_id.partner_id
240
- if service.reservation_id
241
- else service.folio_id.partner_id
242
- )
243
- if (
244
- partner == service.company_id.partner_id
245
- and service.company_id.self_billed_tax_ids
246
- ):
247
- service.tax_ids = service.company_id.self_billed_tax_ids
248
- else:
249
- service.tax_ids = service.product_id.taxes_id.filtered(
238
+ fiscal_position = service.folio_id.fiscal_position_id
239
+ service.tax_ids = fiscal_position.map_tax(
240
+ service.product_id.taxes_id.filtered(
250
241
  lambda r, s=service: not s.company_id
251
242
  or r.company_id == s.company_id
252
243
  )
244
+ )
253
245
 
254
246
  @api.depends("service_line_ids", "service_line_ids.day_qty")
255
247
  def _compute_product_qty(self):
@@ -70,7 +70,7 @@ class PmsServiceLine(models.Model):
70
70
  string="Units",
71
71
  help="Amount to be consumed per day",
72
72
  )
73
- price_unit = fields.Float(
73
+ price_unit = fields.Monetary(
74
74
  string="Unit Price",
75
75
  help="Price per unit of service",
76
76
  digits=("Product Price"),
@@ -89,7 +89,7 @@ class PmsServiceLine(models.Model):
89
89
  store=True,
90
90
  compute="_compute_day_amount_service",
91
91
  )
92
- price_day_tax = fields.Float(
92
+ price_day_tax = fields.Monetary(
93
93
  string="Taxes Amount",
94
94
  help="",
95
95
  readonly=True,
@@ -56,20 +56,3 @@ class ResCompany(models.Model):
56
56
  index=True,
57
57
  ondelete="restrict",
58
58
  )
59
-
60
- self_billed_journal_id = fields.Many2one(
61
- string="Self billed journal",
62
- help="Journal used to create self billing",
63
- comodel_name="account.journal",
64
- index=True,
65
- ondelete="restrict",
66
- )
67
- self_billed_tax_ids = fields.Many2many(
68
- string="Self billed taxes",
69
- help="Taxes used to create self billing",
70
- comodel_name="account.tax",
71
- relation="company_autoinvoicing_tax_rel",
72
- column1="company_id",
73
- column2="tax_id",
74
- domain="[('company_id', '=', id)]",
75
- )
@@ -372,7 +372,7 @@ ul.auto-toc {
372
372
  !! This file is generated by oca-gen-addon-readme !!
373
373
  !! changes will be overwritten. !!
374
374
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
375
- !! source digest: sha256:1932d20cb515244c940884a7573b46a3b589228ee1ebb94ad7f300612769a869
375
+ !! source digest: sha256:88334a9c85056b26b4f5f89e9ce6f476579984c113c68111c6d106f7c2ce2903
376
376
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
377
377
  <p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/license-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/pms/tree/16.0/pms"><img alt="OCA/pms" src="https://img.shields.io/badge/github-OCA%2Fpms-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/pms-16-0/pms-16-0-pms"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/pms&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
378
378
  <p>This module is an all-in-one property management system (PMS) focused on medium-sized properties
@@ -1479,3 +1479,86 @@ class TestPmsFolio(TestPms, AccountTestInvoicingCommon):
1479
1479
  def test_pms_folio_form_creation(self):
1480
1480
  folio_form = Form(self.env["pms.folio"])
1481
1481
  self.assertFalse(folio_form.possible_existing_customer_ids)
1482
+
1483
+ def test_pms_folio_fiscal_position_id(self):
1484
+ """
1485
+ Check that the fiscal_position_id field of the folio is correctly
1486
+ set when a partner is assigned to the folio.
1487
+ """
1488
+ fiscal_position = self.env["account.fiscal.position"].create(
1489
+ {"name": "Fiscal Position Test"}
1490
+ )
1491
+ partner = (
1492
+ self.env["res.partner"]
1493
+ .with_company(self.pms_property1.company_id)
1494
+ .create(
1495
+ {
1496
+ "name": "Fiscal Partner",
1497
+ "property_account_position_id": fiscal_position.id,
1498
+ }
1499
+ )
1500
+ )
1501
+ folio = self.env["pms.folio"].create(
1502
+ {
1503
+ "pms_property_id": self.pms_property1.id,
1504
+ "partner_name": partner.name,
1505
+ "partner_id": partner.id,
1506
+ }
1507
+ )
1508
+ folio.env.invalidate_all()
1509
+ self.assertEqual(
1510
+ folio.fiscal_position_id.id,
1511
+ fiscal_position.id,
1512
+ "The fiscal_position_id of the folio was not "
1513
+ "set correctly from the partner",
1514
+ )
1515
+
1516
+ def test_pms_folio_priority_fiscal_position_property(self):
1517
+ """
1518
+ Check that the fiscal_position_id field of the folio
1519
+ takes precedence from automatic assignation.
1520
+ """
1521
+ fiscal_position_property = self.env["account.fiscal.position"].create(
1522
+ {"name": "Fiscal Position Property"}
1523
+ )
1524
+ # automatic fiscal position for US country
1525
+ self.env["account.fiscal.position"].create(
1526
+ {
1527
+ "name": "Automatic Fiscal Position",
1528
+ "auto_apply": True,
1529
+ "country_id": self.env.ref("base.us").id,
1530
+ }
1531
+ )
1532
+ pms_propert_1 = self.env["pms.property"].create(
1533
+ {
1534
+ "name": "Property with Fiscal Position",
1535
+ "company_id": self.env.ref("base.main_company").id,
1536
+ }
1537
+ )
1538
+ pms_propert_1.partner_id.property_account_position_id = (
1539
+ fiscal_position_property.id
1540
+ )
1541
+ partner = (
1542
+ self.env["res.partner"]
1543
+ .with_company(pms_propert_1.company_id)
1544
+ .create(
1545
+ {
1546
+ "name": "Fiscal Partner",
1547
+ "country_id": self.env.ref("base.us").id,
1548
+ }
1549
+ )
1550
+ )
1551
+ folio = self.env["pms.folio"].create(
1552
+ {
1553
+ "pms_property_id": pms_propert_1.id,
1554
+ "partner_name": partner.name,
1555
+ "partner_id": partner.id,
1556
+ }
1557
+ )
1558
+ folio.env.invalidate_all()
1559
+ self.assertEqual(
1560
+ folio.fiscal_position_id.id,
1561
+ fiscal_position_property.id,
1562
+ "The fiscal_position_id of the folio was not set "
1563
+ "correctly from the property",
1564
+ )
@@ -843,6 +843,64 @@ class TestRoomType(TestPms):
843
843
  }
844
844
  )
845
845
 
846
+ def test_room_type_board_service_by_default_constraint(self):
847
+ room_type = self.env["pms.room.type"].create(
848
+ {
849
+ "name": "Room Type",
850
+ "default_code": "Type1",
851
+ "pms_property_ids": self.pms_property1,
852
+ "class_id": self.room_type_class1.id,
853
+ }
854
+ )
855
+ board_service_default = self.env["pms.board.service"].create(
856
+ {
857
+ "name": "Board service 1",
858
+ "default_code": "c1",
859
+ "pms_property_ids": self.pms_property1,
860
+ }
861
+ )
862
+ board_service_not_default = self.env["pms.board.service"].create(
863
+ {
864
+ "name": "Board service 2",
865
+ "default_code": "c2",
866
+ "pms_property_ids": self.pms_property1,
867
+ }
868
+ )
869
+ board_service_second_default = self.env["pms.board.service"].create(
870
+ {
871
+ "name": "Board service 3",
872
+ "default_code": "c3",
873
+ "pms_property_ids": self.pms_property1,
874
+ }
875
+ )
876
+ self.env["pms.board.service.room.type"].create(
877
+ {
878
+ "pms_board_service_id": board_service_default.id,
879
+ "pms_room_type_id": room_type.id,
880
+ "pms_property_id": self.pms_property1.id,
881
+ "by_default": True,
882
+ }
883
+ )
884
+ self.env["pms.board.service.room.type"].create(
885
+ {
886
+ "pms_board_service_id": board_service_not_default.id,
887
+ "pms_room_type_id": room_type.id,
888
+ "pms_property_id": self.pms_property1.id,
889
+ }
890
+ )
891
+ with self.assertRaises(
892
+ UserError,
893
+ msg="Only can set one default board service",
894
+ ):
895
+ self.env["pms.board.service.room.type"].create(
896
+ {
897
+ "pms_board_service_id": board_service_second_default.id,
898
+ "pms_room_type_id": room_type.id,
899
+ "pms_property_id": self.pms_property1.id,
900
+ "by_default": True,
901
+ }
902
+ )
903
+
846
904
  def test_check_amenities_property_integrity(self):
847
905
  self.amenity1 = self.env["pms.amenity"].create(
848
906
  {"name": "Amenity", "pms_property_ids": self.pms_property1}
@@ -248,18 +248,11 @@
248
248
  <group
249
249
  class="oe_subtotal_footer oe_right oe_inline"
250
250
  name="folio_total"
251
+ widget="monetary"
251
252
  attrs="{'invisible':[('reservation_type', '!=', 'normal')]}"
252
253
  >
253
- <field
254
- name="amount_untaxed"
255
- widget="monetary"
256
- options="{'currency_field': 'currency_id'}"
257
- />
258
- <field
259
- name="amount_tax"
260
- widget="monetary"
261
- options="{'currency_field': 'currency_id'}"
262
- />
254
+ <field name="amount_untaxed" widget="monetary" />
255
+ <field name="amount_tax" widget="monetary" />
263
256
  <div
264
257
  class="oe_subtotal_footer_separator oe_inline o_td_label"
265
258
  >
@@ -270,13 +263,8 @@
270
263
  nolabel="1"
271
264
  class="oe_subtotal_footer_separator"
272
265
  widget="monetary"
273
- options="{'currency_field': 'currency_id'}"
274
- />
275
- <field
276
- name="commission"
277
- widget='monetary'
278
- options="{'currency_field': 'currency_id'}"
279
266
  />
267
+ <field name="commission" widget='monetary' />
280
268
  </group>
281
269
  </group>
282
270
  <group>
@@ -467,7 +455,7 @@
467
455
  options='{"no_open": True}'
468
456
  optional="hide"
469
457
  />
470
- <field name="price_unit" />
458
+ <field name="price_unit" widget="monetary" />
471
459
  <field
472
460
  name="tax_ids"
473
461
  widget="many2many_tags"
@@ -532,6 +520,9 @@
532
520
  string="Invoicing"
533
521
  attrs="{'invisible':[('reservation_type', '!=', 'normal')]}"
534
522
  >
523
+ <group>
524
+ <field name="fiscal_position_id" />
525
+ </group>
535
526
  <div
536
527
  class="alert alert-info"
537
528
  role="alert"
@@ -556,7 +547,7 @@
556
547
  <field name="create_uid" />
557
548
  <field name="date" />
558
549
  <field name="payment_type" />
559
- <field name="amount" />
550
+ <field name="amount" widget="monetary" />
560
551
  <field name="partner_id" invisible="1" />
561
552
  <field
562
553
  name="state"
@@ -124,6 +124,7 @@
124
124
  <field name="max_amount_simplified_invoice" />
125
125
  <field name="avoid_simplified_max_amount_downpayment" />
126
126
  <field name="invoice_reservation_note_template" />
127
+ <field name="property_account_position_id" />
127
128
  </group>
128
129
  </page>
129
130
  <page string="Email Configuration">
@@ -498,16 +498,18 @@
498
498
  </group>
499
499
  <notebook>
500
500
  <page name="detail" string="Detail">
501
+ <separator string="Nights" />
501
502
  <field name="reservation_line_ids" nolabel="1">
502
503
  <tree create="false" delete="false" editable="bottom">
504
+ <field name="currency_id" invisible="1" />
503
505
  <field
504
506
  name="room_id"
505
507
  attrs="{'column_invisible': [('parent.splitted','=', False)]}"
506
508
  />
507
509
  <field name="date" readonly="1" force_save="1" />
508
- <field name="price" />
510
+ <field name="price" widget="monetary" />
509
511
  <field name="discount" />
510
- <field name="price_day_total" />
512
+ <field name="price_day_total" widget="monetary" />
511
513
  <field name="cancel_discount" invisible="1" />
512
514
  <field name="sale_channel_id" />
513
515
  <field name="default_invoice_to" />
@@ -539,6 +541,7 @@
539
541
  invisible="1"
540
542
  readonly="1"
541
543
  />
544
+ <field name="currency_id" invisible="1" />
542
545
  <field
543
546
  name="pms_property_id"
544
547
  invisible="1"
@@ -586,24 +589,38 @@
586
589
  optional="show"
587
590
  />
588
591
  <field name="board_service_line_id" invisible="1" />
589
- <field name="price_subtotal" optional="hide" />
590
- <field name="price_tax" optional="hide" />
591
- <field name="discount" />
592
- <field name="price_total" />
592
+ <field
593
+ name="price_subtotal"
594
+ optional="hide"
595
+ widget="monetary"
596
+ />
597
+ <field
598
+ name="price_tax"
599
+ optional="hide"
600
+ widget="monetary"
601
+ />
602
+ <field name="discount" widget="monetary" />
603
+ <field name="price_total" widget="monetary" />
593
604
  <field
594
605
  name="service_line_ids"
595
606
  invisible="1"
596
607
  readonly="1"
597
608
  >
598
609
  <tree name="Days">
599
- <field name="date" />
610
+ <field name="date" widget="date" />
600
611
  <field name="day_qty" />
601
612
  <field
602
613
  name="discount"
603
614
  attrs="{'readonly':[('is_board_service','=', True)]}"
604
615
  />
605
- <field name="price_unit" />
606
- <field name="price_day_total" />
616
+ <field
617
+ name="price_unit"
618
+ widget="monetary"
619
+ />
620
+ <field
621
+ name="price_day_total"
622
+ widget="monetary"
623
+ />
607
624
  <field
608
625
  name="is_board_service"
609
626
  invisible="1"
@@ -622,25 +639,21 @@
622
639
  name="price_services"
623
640
  string="Only Services"
624
641
  widget="monetary"
625
- options="{'currency_field': 'currency_id'}"
626
642
  />
627
643
  <field
628
644
  name="price_total"
629
645
  string="Only Room"
630
646
  widget="monetary"
631
- options="{'currency_field': 'currency_id'}"
632
647
  />
633
648
  <field
634
649
  name="discount"
635
650
  string="Discount Room"
636
651
  widget="monetary"
637
- options="{'currency_field': 'currency_id'}"
638
652
  />
639
653
  <field
640
654
  name="services_discount"
641
655
  string="Discount Services"
642
656
  widget="monetary"
643
- options="{'currency_field': 'currency_id'}"
644
657
  />
645
658
  <field name="price_subtotal" invisible="1" />
646
659
  <div
@@ -656,7 +669,6 @@
656
669
  nolabel="1"
657
670
  class="oe_subtotal_footer_separator"
658
671
  widget="monetary"
659
- options="{'currency_field': 'currency_id'}"
660
672
  />
661
673
  <field
662
674
  name="commission_percent"
@@ -666,7 +678,6 @@
666
678
  name="commission_amount"
667
679
  string="Commission Amount"
668
680
  widget='monetary'
669
- options="{'currency_field': 'currency_id'}"
670
681
  />
671
682
  <field name="invoice_status" invisible="1" />
672
683
  <field name="currency_id" invisible="1" />
@@ -823,6 +834,7 @@
823
834
  <field name="splitted" invisible="1" />
824
835
  <field name="is_reselling" invisible="1" />
825
836
  <field name="pricelist_id" invisible="1" />
837
+ <field name="currency_id" invisible="1" />
826
838
  <field name="rooms" />
827
839
  <field name="checkin" />
828
840
  <field name="checkout" />
@@ -843,9 +855,23 @@
843
855
  <field name="sale_channel_origin_id" optional="show" />
844
856
  <field name="sale_channel_ids" optional="show" />
845
857
  <field name="price_subtotal" invisible="1" />
846
- <field name="price_total" optional="hide" sum="Total" />
847
- <field name="commission_amount" optional="hide" sum="Commission" />
848
- <field name="folio_pending_amount" string="Folio Pending Amount" />
858
+ <field
859
+ name="price_total"
860
+ optional="hide"
861
+ sum="Total"
862
+ widget="monetary"
863
+ />
864
+ <field
865
+ name="commission_amount"
866
+ optional="hide"
867
+ sum="Commission"
868
+ widget="monetary"
869
+ />
870
+ <field
871
+ name="folio_pending_amount"
872
+ string="Folio Pending Amount"
873
+ widget="monetary"
874
+ />
849
875
  <field
850
876
  name="state"
851
877
  decoration-success="state == 'onboard'"
@@ -5,7 +5,7 @@
5
5
  <field name="model">res.users</field>
6
6
  <field name="inherit_id" ref="base.view_users_form" />
7
7
  <field name="arch" type="xml">
8
- <xpath expr="//page[@name='access_rights']/group" position="inside">
8
+ <xpath expr="//page[@name='access_rights']/group" position="after">
9
9
  <group string="Multi Properties">
10
10
  <field
11
11
  string="Allowed Properties"
@@ -16,11 +16,6 @@
16
16
  <span t-field="docs.identifier" />
17
17
  </strong> / <span t-field="docs.reservation_id" />
18
18
  </p>
19
- <p class="amount"> Total amount
20
- (Reservation Card): <strong>
21
- <span t-field="docs.reservation_id.folio_id.amount_total" />
22
- </strong>
23
- </p>
24
19
  <div class="property amount">
25
20
  <strong>
26
21
  <span t-field="docs.pms_property_id.name" />
@@ -182,10 +177,6 @@
182
177
  <span t-field="docs.identifier" />
183
178
  </strong> / <span t-field="docs.reservation_id" />
184
179
  </p>
185
- <p class="amount"> Total amount (Reservation Card): <strong>
186
- <span t-field="docs.reservation_id.folio_id.amount_total" />
187
- </strong>
188
- </p>
189
180
  <div class="property amount">
190
181
  <strong>
191
182
  <span t-field="docs.pms_property_id.name" />
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: odoo-addon-pms
3
- Version: 16.0.0.15.0.10
3
+ Version: 16.0.0.24.0.1
4
4
  Summary: A property management system
5
5
  Home-page: https://github.com/OCA/pms
6
6
  Author: Commit [Sun], Odoo Community Association (OCA)
@@ -36,7 +36,7 @@ PMS (Property Management System)
36
36
  !! This file is generated by oca-gen-addon-readme !!
37
37
  !! changes will be overwritten. !!
38
38
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
39
- !! source digest: sha256:1932d20cb515244c940884a7573b46a3b589228ee1ebb94ad7f300612769a869
39
+ !! source digest: sha256:88334a9c85056b26b4f5f89e9ce6f476579984c113c68111c6d106f7c2ce2903
40
40
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
41
41
 
42
42
  .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png