odoo-addon-sale-blanket-order 17.0.1.1.2__py3-none-any.whl → 18.0.1.0.0.12__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.

Potentially problematic release.


This version of odoo-addon-sale-blanket-order might be problematic. Click here for more details.

Files changed (26) hide show
  1. odoo/addons/sale_blanket_order/README.rst +15 -15
  2. odoo/addons/sale_blanket_order/__manifest__.py +7 -2
  3. odoo/addons/sale_blanket_order/data/ir_cron.xml +0 -2
  4. odoo/addons/sale_blanket_order/i18n/de.po +0 -15
  5. odoo/addons/sale_blanket_order/i18n/es.po +3 -15
  6. odoo/addons/sale_blanket_order/i18n/fr.po +3 -15
  7. odoo/addons/sale_blanket_order/i18n/fr_FR.po +3 -15
  8. odoo/addons/sale_blanket_order/i18n/it.po +32 -44
  9. odoo/addons/sale_blanket_order/i18n/pt.po +0 -15
  10. odoo/addons/sale_blanket_order/i18n/sale_blanket_order.pot +11 -58
  11. odoo/addons/sale_blanket_order/models/blanket_orders.py +35 -44
  12. odoo/addons/sale_blanket_order/models/sale_orders.py +18 -5
  13. odoo/addons/sale_blanket_order/report/report.xml +0 -2
  14. odoo/addons/sale_blanket_order/report/templates.xml +32 -35
  15. odoo/addons/sale_blanket_order/static/description/index.html +11 -11
  16. odoo/addons/sale_blanket_order/static/src/js/disable_add_order_line.esm.js +26 -0
  17. odoo/addons/sale_blanket_order/tests/test_blanket_orders.py +69 -2
  18. odoo/addons/sale_blanket_order/views/sale_blanket_order_line_views.xml +17 -28
  19. odoo/addons/sale_blanket_order/views/sale_blanket_order_views.xml +14 -25
  20. odoo/addons/sale_blanket_order/views/sale_order_views.xml +2 -14
  21. odoo/addons/sale_blanket_order/wizard/create_sale_orders.py +47 -30
  22. odoo/addons/sale_blanket_order/wizard/create_sale_orders.xml +2 -2
  23. {odoo_addon_sale_blanket_order-17.0.1.1.2.dist-info → odoo_addon_sale_blanket_order-18.0.1.0.0.12.dist-info}/METADATA +19 -19
  24. {odoo_addon_sale_blanket_order-17.0.1.1.2.dist-info → odoo_addon_sale_blanket_order-18.0.1.0.0.12.dist-info}/RECORD +26 -25
  25. {odoo_addon_sale_blanket_order-17.0.1.1.2.dist-info → odoo_addon_sale_blanket_order-18.0.1.0.0.12.dist-info}/WHEEL +1 -1
  26. {odoo_addon_sale_blanket_order-17.0.1.1.2.dist-info → odoo_addon_sale_blanket_order-18.0.1.0.0.12.dist-info}/top_level.txt +0 -0
@@ -4,7 +4,7 @@
4
4
  #
5
5
  msgid ""
6
6
  msgstr ""
7
- "Project-Id-Version: Odoo Server 17.0\n"
7
+ "Project-Id-Version: Odoo Server 18.0\n"
8
8
  "Report-Msgid-Bugs-To: \n"
9
9
  "Last-Translator: \n"
10
10
  "Language-Team: \n"
@@ -16,7 +16,6 @@ msgstr ""
16
16
  #. module: sale_blanket_order
17
17
  #. odoo-python
18
18
  #: code:addons/sale_blanket_order/models/blanket_orders.py:0
19
- #, python-format
20
19
  msgid ""
21
20
  "\n"
22
21
  " You cannot change the type of a sale order line.\n"
@@ -123,27 +122,15 @@ msgstr ""
123
122
  #. module: sale_blanket_order
124
123
  #. odoo-python
125
124
  #: code:addons/sale_blanket_order/wizard/create_sale_orders.py:0
126
- #, python-format
127
125
  msgid "An order can't be empty"
128
126
  msgstr ""
129
127
 
130
- #. module: sale_blanket_order
131
- #: model:ir.model.fields,field_description:sale_blanket_order.field_sale_blanket_order__analytic_account_id
132
- msgid "Analytic Account"
133
- msgstr ""
134
-
135
128
  #. module: sale_blanket_order
136
129
  #: model:ir.model.fields,field_description:sale_blanket_order.field_sale_blanket_order_line__analytic_distribution
137
130
  #: model:ir.model.fields,field_description:sale_blanket_order.field_sale_blanket_order_wizard_line__analytic_distribution
138
131
  msgid "Analytic Distribution"
139
132
  msgstr ""
140
133
 
141
- #. module: sale_blanket_order
142
- #: model:ir.model.fields,field_description:sale_blanket_order.field_sale_blanket_order_line__analytic_distribution_search
143
- #: model:ir.model.fields,field_description:sale_blanket_order.field_sale_blanket_order_wizard_line__analytic_distribution_search
144
- msgid "Analytic Distribution Search"
145
- msgstr ""
146
-
147
134
  #. module: sale_blanket_order
148
135
  #: model:ir.model.fields,field_description:sale_blanket_order.field_sale_blanket_order_line__analytic_precision
149
136
  #: model:ir.model.fields,field_description:sale_blanket_order.field_sale_blanket_order_wizard_line__analytic_precision
@@ -205,7 +192,6 @@ msgstr ""
205
192
  #. module: sale_blanket_order
206
193
  #. odoo-python
207
194
  #: code:addons/sale_blanket_order/wizard/create_sale_orders.py:0
208
- #, python-format
209
195
  msgid ""
210
196
  "Can not create Sale Order from Blanket Order lines with different currencies"
211
197
  msgstr ""
@@ -219,7 +205,6 @@ msgstr ""
219
205
  #. module: sale_blanket_order
220
206
  #. odoo-python
221
207
  #: code:addons/sale_blanket_order/models/sale_orders.py:0
222
- #, python-format
223
208
  msgid ""
224
209
  "Cannot confirm order %s as one of the lines refers to a blanket order that "
225
210
  "has no remaining quantity."
@@ -300,7 +285,6 @@ msgstr ""
300
285
  #. module: sale_blanket_order
301
286
  #. odoo-python
302
287
  #: code:addons/sale_blanket_order/models/blanket_orders.py:0
303
- #, python-format
304
288
  msgid "Date Scheduled"
305
289
  msgstr ""
306
290
 
@@ -320,6 +304,11 @@ msgstr ""
320
304
  msgid "Description"
321
305
  msgstr ""
322
306
 
307
+ #. module: sale_blanket_order
308
+ #: model:ir.model.fields,field_description:sale_blanket_order.field_sale_order__disable_adding_lines
309
+ msgid "Disable Adding Lines"
310
+ msgstr ""
311
+
323
312
  #. module: sale_blanket_order
324
313
  #: model:ir.model.fields,field_description:sale_blanket_order.field_res_config_settings__group_blanket_disable_adding_lines
325
314
  msgid "Disable adding more lines to SOs"
@@ -447,11 +436,6 @@ msgstr ""
447
436
  msgid "Invoiced quantity"
448
437
  msgstr ""
449
438
 
450
- #. module: sale_blanket_order
451
- #: model_terms:ir.ui.view,arch_db:sale_blanket_order.view_blanket_order_form
452
- msgid "Invoicing"
453
- msgstr ""
454
-
455
439
  #. module: sale_blanket_order
456
440
  #: model:ir.model.fields,field_description:sale_blanket_order.field_sale_blanket_order__message_is_follower
457
441
  #: model:ir.model.fields,field_description:sale_blanket_order.field_sale_blanket_order_line__message_is_follower
@@ -500,7 +484,6 @@ msgstr ""
500
484
  #. module: sale_blanket_order
501
485
  #. odoo-python
502
486
  #: code:addons/sale_blanket_order/models/blanket_orders.py:0
503
- #, python-format
504
487
  msgid "Must have some lines"
505
488
  msgstr ""
506
489
 
@@ -515,12 +498,6 @@ msgstr ""
515
498
  msgid "Name"
516
499
  msgstr ""
517
500
 
518
- #. module: sale_blanket_order
519
- #: model:ir.model.fields,field_description:sale_blanket_order.field_sale_blanket_order__activity_calendar_event_id
520
- #: model:ir.model.fields,field_description:sale_blanket_order.field_sale_blanket_order_line__activity_calendar_event_id
521
- msgid "Next Activity Calendar Event"
522
- msgstr ""
523
-
524
501
  #. module: sale_blanket_order
525
502
  #: model:ir.model.fields,field_description:sale_blanket_order.field_sale_blanket_order__activity_date_deadline
526
503
  #: model:ir.model.fields,field_description:sale_blanket_order.field_sale_blanket_order_line__activity_date_deadline
@@ -633,7 +610,6 @@ msgstr ""
633
610
  #. module: sale_blanket_order
634
611
  #. odoo-python
635
612
  #: code:addons/sale_blanket_order/models/blanket_orders.py:0
636
- #, python-format
637
613
  msgid "Partner is mandatory"
638
614
  msgstr ""
639
615
 
@@ -649,13 +625,6 @@ msgstr ""
649
625
  msgid "Price"
650
626
  msgstr ""
651
627
 
652
- #. module: sale_blanket_order
653
- #. odoo-python
654
- #: code:addons/sale_blanket_order/models/blanket_orders.py:0
655
- #, python-format
656
- msgid "Price must be greater than zero"
657
- msgstr ""
658
-
659
628
  #. module: sale_blanket_order
660
629
  #: model:ir.model.fields,field_description:sale_blanket_order.field_sale_blanket_order__pricelist_id
661
630
  #: model:ir.model.fields,field_description:sale_blanket_order.field_sale_blanket_order_line__pricelist_id
@@ -683,7 +652,6 @@ msgstr ""
683
652
  #. module: sale_blanket_order
684
653
  #. odoo-python
685
654
  #: code:addons/sale_blanket_order/models/blanket_orders.py:0
686
- #, python-format
687
655
  msgid "Quantity must be greater than zero"
688
656
  msgstr ""
689
657
 
@@ -692,12 +660,6 @@ msgstr ""
692
660
  msgid "Quantity to Order"
693
661
  msgstr ""
694
662
 
695
- #. module: sale_blanket_order
696
- #: model:ir.model.fields,field_description:sale_blanket_order.field_sale_blanket_order__rating_ids
697
- #: model:ir.model.fields,field_description:sale_blanket_order.field_sale_blanket_order_line__rating_ids
698
- msgid "Ratings"
699
- msgstr ""
700
-
701
663
  #. module: sale_blanket_order
702
664
  #: model_terms:ir.ui.view,arch_db:sale_blanket_order.view_blanket_order_search
703
665
  msgid "Remaining Qty"
@@ -729,7 +691,6 @@ msgstr ""
729
691
  #. module: sale_blanket_order
730
692
  #. odoo-python
731
693
  #: code:addons/sale_blanket_order/wizard/create_sale_orders.py:0
732
- #, python-format
733
694
  msgid "Sale Blanket Order %s is not open"
734
695
  msgstr ""
735
696
 
@@ -781,7 +742,6 @@ msgstr ""
781
742
  #. module: sale_blanket_order
782
743
  #. odoo-python
783
744
  #: code:addons/sale_blanket_order/wizard/create_sale_orders.py:0
784
- #, python-format
785
745
  msgid "Sales Orders"
786
746
  msgstr ""
787
747
 
@@ -842,6 +802,11 @@ msgstr ""
842
802
  msgid "Subtotal"
843
803
  msgstr ""
844
804
 
805
+ #. module: sale_blanket_order
806
+ #: model:ir.model.fields,field_description:sale_blanket_order.field_sale_blanket_order__tag_ids
807
+ msgid "Tags"
808
+ msgstr ""
809
+
845
810
  #. module: sale_blanket_order
846
811
  #: model:ir.model.fields,field_description:sale_blanket_order.field_sale_blanket_order_line__price_tax
847
812
  msgid "Tax"
@@ -868,7 +833,6 @@ msgstr ""
868
833
  #. module: sale_blanket_order
869
834
  #. odoo-python
870
835
  #: code:addons/sale_blanket_order/models/sale_orders.py:0
871
- #, python-format
872
836
  msgid ""
873
837
  "The currency of the blanket order must match with that of the sale order."
874
838
  msgstr ""
@@ -876,21 +840,18 @@ msgstr ""
876
840
  #. module: sale_blanket_order
877
841
  #. odoo-python
878
842
  #: code:addons/sale_blanket_order/models/sale_orders.py:0
879
- #, python-format
880
843
  msgid "The customer must be equal to the blanket order lines customer"
881
844
  msgstr ""
882
845
 
883
846
  #. module: sale_blanket_order
884
847
  #. odoo-python
885
848
  #: code:addons/sale_blanket_order/models/sale_orders.py:0
886
- #, python-format
887
849
  msgid "The product in the blanket order and in the sales order must match"
888
850
  msgstr ""
889
851
 
890
852
  #. module: sale_blanket_order
891
853
  #. odoo-python
892
854
  #: code:addons/sale_blanket_order/wizard/create_sale_orders.py:0
893
- #, python-format
894
855
  msgid "The sale has already been completed."
895
856
  msgstr ""
896
857
 
@@ -948,14 +909,12 @@ msgstr ""
948
909
  #. module: sale_blanket_order
949
910
  #. odoo-python
950
911
  #: code:addons/sale_blanket_order/models/blanket_orders.py:0
951
- #, python-format
952
912
  msgid "Validity date is mandatory"
953
913
  msgstr ""
954
914
 
955
915
  #. module: sale_blanket_order
956
916
  #. odoo-python
957
917
  #: code:addons/sale_blanket_order/models/blanket_orders.py:0
958
- #, python-format
959
918
  msgid "Validity date must be in the future"
960
919
  msgstr ""
961
920
 
@@ -984,7 +943,6 @@ msgstr ""
984
943
  #. module: sale_blanket_order
985
944
  #. odoo-python
986
945
  #: code:addons/sale_blanket_order/models/blanket_orders.py:0
987
- #, python-format
988
946
  msgid ""
989
947
  "You can not delete a blanket order with opened sale orders! Try to cancel "
990
948
  "them before."
@@ -993,7 +951,6 @@ msgstr ""
993
951
  #. module: sale_blanket_order
994
952
  #. odoo-python
995
953
  #: code:addons/sale_blanket_order/models/blanket_orders.py:0
996
- #, python-format
997
954
  msgid ""
998
955
  "You can not delete an open blanket or with active sale orders! Try to cancel"
999
956
  " it before."
@@ -1002,27 +959,23 @@ msgstr ""
1002
959
  #. module: sale_blanket_order
1003
960
  #. odoo-python
1004
961
  #: code:addons/sale_blanket_order/wizard/create_sale_orders.py:0
1005
- #, python-format
1006
962
  msgid "You can't create a sale order from an expired blanket order!"
1007
963
  msgstr ""
1008
964
 
1009
965
  #. module: sale_blanket_order
1010
966
  #. odoo-python
1011
967
  #: code:addons/sale_blanket_order/wizard/create_sale_orders.py:0
1012
- #, python-format
1013
968
  msgid "You can't order more than the remaining quantities"
1014
969
  msgstr ""
1015
970
 
1016
971
  #. module: sale_blanket_order
1017
972
  #. odoo-python
1018
973
  #: code:addons/sale_blanket_order/wizard/create_sale_orders.py:0
1019
- #, python-format
1020
974
  msgid "You have to select lines from the same company."
1021
975
  msgstr ""
1022
976
 
1023
977
  #. module: sale_blanket_order
1024
978
  #. odoo-python
1025
979
  #: code:addons/sale_blanket_order/models/blanket_orders.py:0
1026
- #, python-format
1027
980
  msgid "remaining"
1028
981
  msgstr ""
@@ -1,7 +1,7 @@
1
1
  # Copyright 2018 ACSONE SA/NV
2
2
  # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
3
3
 
4
- from odoo import SUPERUSER_ID, _, api, fields, models
4
+ from odoo import api, fields, models
5
5
  from odoo.exceptions import UserError
6
6
  from odoo.tools import float_is_zero
7
7
  from odoo.tools.misc import format_date
@@ -62,13 +62,6 @@ class BlanketOrder(models.Model):
62
62
  required=True,
63
63
  )
64
64
  currency_id = fields.Many2one("res.currency", related="pricelist_id.currency_id")
65
- analytic_account_id = fields.Many2one(
66
- comodel_name="account.analytic.account",
67
- string="Analytic Account",
68
- copy=False,
69
- check_company=True,
70
- domain="['|', ('company_id', '=', False), ('company_id', '=', company_id)]",
71
- )
72
65
  payment_term_id = fields.Many2one(
73
66
  "account.payment.term",
74
67
  string="Payment Terms",
@@ -101,6 +94,13 @@ class BlanketOrder(models.Model):
101
94
  change_default=True,
102
95
  default=lambda self: self.env["crm.team"]._get_default_team_id(),
103
96
  )
97
+ tag_ids = fields.Many2many(
98
+ comodel_name="crm.tag",
99
+ relation="sale_blanket_order_tag_rel",
100
+ column1="blanket_order_id",
101
+ column2="tag_id",
102
+ string="Tags",
103
+ )
104
104
  company_id = fields.Many2one(
105
105
  comodel_name="res.company",
106
106
  required=True,
@@ -110,7 +110,9 @@ class BlanketOrder(models.Model):
110
110
  sale_count = fields.Integer(compute="_compute_sale_count")
111
111
 
112
112
  fiscal_position_id = fields.Many2one(
113
- "account.fiscal.position", string="Fiscal Position"
113
+ "account.fiscal.position",
114
+ string="Fiscal Position",
115
+ check_company=True,
114
116
  )
115
117
 
116
118
  amount_untaxed = fields.Monetary(
@@ -236,15 +238,15 @@ class BlanketOrder(models.Model):
236
238
 
237
239
  if self.partner_id.user_id:
238
240
  values["user_id"] = self.partner_id.user_id.id
239
- if self.partner_id.team_id:
240
- values["team_id"] = self.partner_id.team_id.id
241
+ if self.partner_id.user_id.sale_team_id:
242
+ values["team_id"] = self.partner_id.user_id.sale_team_id.id
241
243
  self.update(values)
242
244
 
243
245
  def unlink(self):
244
246
  for order in self:
245
247
  if order.state not in ("draft", "expired") or order._check_active_orders():
246
248
  raise UserError(
247
- _(
249
+ self.env._(
248
250
  "You can not delete an open blanket or "
249
251
  "with active sale orders! "
250
252
  "Try to cancel it before."
@@ -256,12 +258,12 @@ class BlanketOrder(models.Model):
256
258
  try:
257
259
  today = fields.Date.today()
258
260
  for order in self:
259
- assert order.validity_date, _("Validity date is mandatory")
260
- assert order.validity_date > today, _(
261
+ assert order.validity_date, self.env._("Validity date is mandatory")
262
+ assert order.validity_date > today, self.env._(
261
263
  "Validity date must be in the future"
262
264
  )
263
- assert order.partner_id, _("Partner is mandatory")
264
- assert len(order.line_ids) > 0, _("Must have some lines")
265
+ assert order.partner_id, self.env._("Partner is mandatory")
266
+ assert len(order.line_ids) > 0, self.env._("Must have some lines")
265
267
  order.line_ids._validate()
266
268
  except AssertionError as e:
267
269
  raise UserError(e) from e
@@ -292,7 +294,7 @@ class BlanketOrder(models.Model):
292
294
  for order in self:
293
295
  if order._check_active_orders():
294
296
  raise UserError(
295
- _(
297
+ self.env._(
296
298
  "You can not delete a blanket order with opened "
297
299
  "sale orders! "
298
300
  "Try to cancel them before."
@@ -419,9 +421,9 @@ class BlanketOrderLine(models.Model):
419
421
  product_uom = fields.Many2one("uom.uom", string="Unit of Measure")
420
422
  price_unit = fields.Float(string="Price", digits="Product Price")
421
423
  taxes_id = fields.Many2many(
422
- "account.tax",
423
- string="Taxes",
424
- domain=["|", ("active", "=", False), ("active", "=", True)],
424
+ comodel_name="account.tax",
425
+ context={"active_test": False},
426
+ check_company=True,
425
427
  )
426
428
  date_schedule = fields.Date(string="Scheduled Date")
427
429
  original_uom_qty = fields.Float(
@@ -483,12 +485,14 @@ class BlanketOrderLine(models.Model):
483
485
  def _compute_display_name(self):
484
486
  if self.env.context.get("from_sale_order"):
485
487
  for record in self:
486
- name = "[%s]" % record.order_id.name
488
+ name = f"[{record.order_id.name}]"
487
489
  if record.date_schedule:
488
490
  formatted_date = format_date(record.env, record.date_schedule)
489
- name += " - {}: {}".format(_("Date Scheduled"), formatted_date)
491
+ name += " - {}: {}".format(
492
+ self.env._("Date Scheduled"), formatted_date
493
+ )
490
494
  name += " ({}: {} {})".format(
491
- _("remaining"),
495
+ self.env._("remaining"),
492
496
  record.remaining_uom_qty,
493
497
  record.product_uom.name,
494
498
  )
@@ -511,12 +515,11 @@ class BlanketOrderLine(models.Model):
511
515
  product_currency = None
512
516
  if rule_id:
513
517
  pricelist_item = PricelistItem.browse(rule_id)
514
- if pricelist_item.pricelist_id.discount_policy == "without_discount":
518
+ if pricelist_item._show_discount():
515
519
  while (
516
520
  pricelist_item.base == "pricelist"
517
521
  and pricelist_item.base_pricelist_id
518
- and pricelist_item.base_pricelist_id.discount_policy
519
- == "without_discount"
522
+ and pricelist_item._show_discount()
520
523
  ):
521
524
  price, rule_id = pricelist_item.base_pricelist_id.with_context(
522
525
  uom=uom.id
@@ -571,9 +574,6 @@ class BlanketOrderLine(models.Model):
571
574
  currency=self.currency_id,
572
575
  )
573
576
 
574
- if self.order_id.pricelist_id.discount_policy == "with_discount":
575
- return pricelist_price
576
-
577
577
  if not self.pricelist_item_id:
578
578
  # No pricelist rule found => no discount from pricelist
579
579
  return pricelist_price
@@ -590,7 +590,7 @@ class BlanketOrderLine(models.Model):
590
590
 
591
591
  return self.pricelist_item_id._compute_price_before_discount(
592
592
  product=self.product_id,
593
- quantity=self.product_uom_qty or 1.0,
593
+ quantity=self.original_uom_qty or 1.0,
594
594
  uom=self.product_uom,
595
595
  date=fields.Date.today(),
596
596
  currency=self.currency_id,
@@ -616,15 +616,9 @@ class BlanketOrderLine(models.Model):
616
616
  self.name = name
617
617
 
618
618
  fpos = self.order_id.fiscal_position_id
619
- if self.env.uid == SUPERUSER_ID:
620
- company_id = self.env.company.id
621
- self.taxes_id = fpos.map_tax(
622
- self.product_id.taxes_id.filtered(
623
- lambda r: r.company_id.id == company_id
624
- )
625
- )
626
- else:
627
- self.taxes_id = fpos.map_tax(self.product_id.taxes_id)
619
+ self.taxes_id = fpos.map_tax(
620
+ self.product_id.taxes_id._filter_taxes_by_company(self.company_id)
621
+ )
628
622
 
629
623
  @api.depends(
630
624
  "sale_lines.order_id.state",
@@ -680,12 +674,9 @@ class BlanketOrderLine(models.Model):
680
674
  def _validate(self):
681
675
  try:
682
676
  for line in self:
683
- assert (
684
- not line.display_type and line.price_unit > 0.0
685
- ) or line.display_type, _("Price must be greater than zero")
686
677
  assert (
687
678
  not line.display_type and line.original_uom_qty > 0.0
688
- ) or line.display_type, _("Quantity must be greater than zero")
679
+ ) or line.display_type, self.env._("Quantity must be greater than zero")
689
680
  except AssertionError as e:
690
681
  raise UserError(e) from e
691
682
 
@@ -729,7 +720,7 @@ class BlanketOrderLine(models.Model):
729
720
  lambda line: line.display_type != values.get("display_type")
730
721
  ):
731
722
  raise UserError(
732
- _(
723
+ self.env._(
733
724
  """
734
725
  You cannot change the type of a sale order line.
735
726
  Instead you should delete the current line and create a new line
@@ -3,7 +3,7 @@
3
3
  # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
4
4
  from datetime import date, timedelta
5
5
 
6
- from odoo import _, api, fields, models
6
+ from odoo import api, fields, models
7
7
  from odoo.exceptions import ValidationError
8
8
 
9
9
 
@@ -15,6 +15,9 @@ class SaleOrder(models.Model):
15
15
  string="Origin blanket order",
16
16
  related="order_line.blanket_order_line.order_id",
17
17
  )
18
+ disable_adding_lines = fields.Boolean(
19
+ compute="_compute_disable_adding_lines",
20
+ )
18
21
 
19
22
  @api.model
20
23
  def _check_exchausted_blanket_order_line(self):
@@ -27,7 +30,7 @@ class SaleOrder(models.Model):
27
30
  for order in self:
28
31
  if order._check_exchausted_blanket_order_line():
29
32
  raise ValidationError(
30
- _(
33
+ self.env._(
31
34
  "Cannot confirm order %s as one of the lines refers "
32
35
  "to a blanket order that has no remaining quantity."
33
36
  )
@@ -41,12 +44,22 @@ class SaleOrder(models.Model):
41
44
  if line.blanket_order_line:
42
45
  if line.blanket_order_line.partner_id != self.partner_id:
43
46
  raise ValidationError(
44
- _(
47
+ self.env._(
45
48
  "The customer must be equal to the "
46
49
  "blanket order lines customer"
47
50
  )
48
51
  )
49
52
 
53
+ @api.depends("blanket_order_id")
54
+ @api.depends_context("uid")
55
+ def _compute_disable_adding_lines(self):
56
+ self.disable_adding_lines = False
57
+ if self.env.user.has_group(
58
+ "sale_blanket_order.blanket_orders_disable_adding_lines"
59
+ ):
60
+ for order in self:
61
+ order.disable_adding_lines = order.blanket_order_id
62
+
50
63
 
51
64
  class SaleOrderLine(models.Model):
52
65
  _inherit = "sale.order.line"
@@ -166,7 +179,7 @@ class SaleOrderLine(models.Model):
166
179
  and line.product_id != line.blanket_order_line.product_id
167
180
  ):
168
181
  raise ValidationError(
169
- _(
182
+ self.env._(
170
183
  "The product in the blanket order and in the "
171
184
  "sales order must match"
172
185
  )
@@ -178,7 +191,7 @@ class SaleOrderLine(models.Model):
178
191
  if line.blanket_order_line:
179
192
  if line.currency_id != line.blanket_order_line.order_id.currency_id:
180
193
  raise ValidationError(
181
- _(
194
+ self.env._(
182
195
  "The currency of the blanket order must match with "
183
196
  "that of the sale order."
184
197
  )
@@ -1,6 +1,5 @@
1
1
  <?xml version="1.0" encoding="utf-8" ?>
2
2
  <odoo>
3
-
4
3
  <record id="report_blanket_order" model="ir.actions.report">
5
4
  <field name="name">Blanket Order</field>
6
5
  <field name="model">sale.blanket.order</field>
@@ -14,5 +13,4 @@
14
13
  />
15
14
  <field name="binding_type">report</field>
16
15
  </record>
17
-
18
16
  </odoo>
@@ -4,7 +4,7 @@
4
4
  <t t-call="web.external_layout">
5
5
  <t t-set="doc" t-value="doc.with_context({'lang':doc.partner_id.lang})" />
6
6
  <div class="page">
7
- <div class="oe_structure" />
7
+ <div id="oe_structure_div_01" class="oe_structure" />
8
8
  <div class="row">
9
9
  <div class="col-xs-6">
10
10
  <div
@@ -12,8 +12,8 @@
12
12
  t-options='{"widget": "contact", "fields": ["address", "name", "phone", "fax"], "no_marker": True, "phone_icons": True}'
13
13
  />
14
14
  <p t-if="doc.partner_id.vat">VAT: <span
15
- t-field="doc.partner_id.vat"
16
- /></p>
15
+ t-field="doc.partner_id.vat"
16
+ /></p>
17
17
  </div>
18
18
  </div>
19
19
  <h2>
@@ -118,52 +118,49 @@
118
118
  </tbody>
119
119
  </table>
120
120
  <div class="clearfix">
121
- <div class="row">
122
- <div
121
+ <div class="row">
122
+ <div
123
123
  t-attf-class="#{'col-6' if report_type != 'html' else 'col-sm-7 col-md-6'} ms-auto"
124
124
  >
125
-
126
-
127
- <table class="table table-sm">
128
- <tr class="border-black">
129
- <td>
130
- <strong>Subtotal</strong>
131
- </td>
132
- <td class="text-end">
133
- <span
125
+ <table class="table table-sm">
126
+ <tr class="border-black">
127
+ <td>
128
+ <strong>Subtotal</strong>
129
+ </td>
130
+ <td class="text-end">
131
+ <span
134
132
  t-field="doc.amount_untaxed"
135
133
  t-options='{"widget": "monetary", "display_currency": doc.currency_id}'
136
134
  />
137
- </td>
138
- </tr>
139
- <tr>
140
- <td>Taxes</td>
141
- <td class="text-end">
142
- <span
135
+ </td>
136
+ </tr>
137
+ <tr>
138
+ <td>Taxes</td>
139
+ <td class="text-end">
140
+ <span
143
141
  t-field="doc.amount_tax"
144
142
  t-options='{"widget": "monetary", "display_currency": doc.currency_id}'
145
143
  />
146
- </td>
147
- </tr>
148
- <tr class="border-black">
149
- <td>
150
- <strong>Total</strong>
151
- </td>
152
- <td class="text-end">
153
- <span
144
+ </td>
145
+ </tr>
146
+ <tr class="border-black">
147
+ <td>
148
+ <strong>Total</strong>
149
+ </td>
150
+ <td class="text-end">
151
+ <span
154
152
  t-field="doc.amount_total"
155
153
  t-options='{"widget": "monetary", "display_currency": doc.currency_id}'
156
154
  />
157
- </td>
158
- </tr>
159
- </table>
160
-
161
- </div>
162
- </div>
155
+ </td>
156
+ </tr>
157
+ </table>
158
+ </div>
159
+ </div>
163
160
  </div>
164
161
 
165
162
  <p t-field="doc.note" />
166
- <div class="oe_structure" />
163
+ <div id="oe_structure_div_02" class="oe_structure" />
167
164
  </div>
168
165
  </t>
169
166
  </template>