odoo-addon-account-commission 16.0.2.4.0__py3-none-any.whl → 17.0.1.0.0.2__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.
Files changed (33) hide show
  1. odoo/addons/account_commission/README.rst +71 -63
  2. odoo/addons/account_commission/__manifest__.py +1 -1
  3. odoo/addons/account_commission/i18n/account_commission.pot +7 -17
  4. odoo/addons/account_commission/i18n/es.po +56 -63
  5. odoo/addons/account_commission/i18n/hr.po +1 -2
  6. odoo/addons/account_commission/i18n/it.po +32 -27
  7. odoo/addons/account_commission/i18n/ja.po +99 -100
  8. odoo/addons/account_commission/i18n/pt.po +53 -54
  9. odoo/addons/account_commission/i18n/pt_BR.po +53 -54
  10. odoo/addons/account_commission/models/account_move.py +2 -29
  11. odoo/addons/account_commission/models/commission.py +1 -1
  12. odoo/addons/account_commission/models/commission_settlement.py +1 -1
  13. odoo/addons/account_commission/readme/CONFIGURE.md +8 -0
  14. odoo/addons/account_commission/readme/CONTRIBUTORS.md +21 -0
  15. odoo/addons/account_commission/readme/{DESCRIPTION.rst → DESCRIPTION.md} +4 -2
  16. odoo/addons/account_commission/readme/USAGE.md +38 -0
  17. odoo/addons/account_commission/security/account_commission_security.xml +4 -0
  18. odoo/addons/account_commission/static/description/index.html +38 -29
  19. odoo/addons/account_commission/tests/test_account_commission.py +1 -163
  20. odoo/addons/account_commission/views/account_move_views.xml +19 -36
  21. odoo/addons/account_commission/views/commission_settlement_views.xml +4 -4
  22. odoo/addons/account_commission/views/commission_views.xml +1 -1
  23. odoo/addons/account_commission/views/report_settlement_templates.xml +8 -14
  24. odoo/addons/account_commission/wizards/wizard_invoice.xml +1 -4
  25. {odoo_addon_account_commission-16.0.2.4.0.dist-info → odoo_addon_account_commission-17.0.1.0.0.2.dist-info}/METADATA +78 -73
  26. odoo_addon_account_commission-17.0.1.0.0.2.dist-info/RECORD +41 -0
  27. {odoo_addon_account_commission-16.0.2.4.0.dist-info → odoo_addon_account_commission-17.0.1.0.0.2.dist-info}/WHEEL +1 -1
  28. odoo_addon_account_commission-17.0.1.0.0.2.dist-info/top_level.txt +1 -0
  29. odoo/addons/account_commission/readme/CONFIGURE.rst +0 -8
  30. odoo/addons/account_commission/readme/CONTRIBUTORS.rst +0 -25
  31. odoo/addons/account_commission/readme/USAGE.rst +0 -37
  32. odoo_addon_account_commission-16.0.2.4.0.dist-info/RECORD +0 -41
  33. odoo_addon_account_commission-16.0.2.4.0.dist-info/top_level.txt +0 -1
@@ -366,11 +366,13 @@ ul.auto-toc {
366
366
  !! This file is generated by oca-gen-addon-readme !!
367
367
  !! changes will be overwritten. !!
368
368
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
369
- !! source digest: sha256:8ba2b2321dee20dece1882cb3f664fb78a27b4fbccb785d1f5410b7d009889c6
369
+ !! source digest: sha256:0fb13edf183d9d1ecf7c4415929fabd687f91bd51e719c0e149a7148c57da4ef
370
370
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
371
- <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/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/commission/tree/16.0/account_commission"><img alt="OCA/commission" src="https://img.shields.io/badge/github-OCA%2Fcommission-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/commission-16-0/commission-16-0-account_commission"><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/commission&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
372
- <p>This module adds the function to calculate commissions in invoices (account moves).</p>
373
- <p>It also allows to create vendor bills from settlements for external agents.</p>
371
+ <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/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/commission/tree/17.0/account_commission"><img alt="OCA/commission" src="https://img.shields.io/badge/github-OCA%2Fcommission-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/commission-17-0/commission-17-0-account_commission"><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/commission&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
372
+ <p>This module adds the function to calculate commissions in invoices
373
+ (account moves).</p>
374
+ <p>It also allows to create vendor bills from settlements for external
375
+ agents.</p>
374
376
  <p>This module depends on the commission module.</p>
375
377
  <p><strong>Table of contents</strong></p>
376
378
  <div class="contents local topic" id="contents">
@@ -390,11 +392,12 @@ ul.auto-toc {
390
392
  <h1><a class="toc-backref" href="#toc-entry-1">Configuration</a></h1>
391
393
  <p>For selecting invoice status in commissions:</p>
392
394
  <ol class="arabic simple">
393
- <li>Edit or create a new record to select the invoice status for settling the commissions.<ul>
394
- <li><strong>Invoice Based</strong>: Commissions are settled when the invoice is issued.</li>
395
- <li><strong>Payment Based</strong>: Commissions are settled when the invoice is paid or refunded.
396
- Note that when refunding an invoice, the corresponding reversed commission will
397
- be settled as well, resulting in a 0 net commission between both operations.</li>
395
+ <li>Edit or create a new record to select the invoice status for settling
396
+ the commissions.<ul>
397
+ <li><strong>Invoice Based</strong>: Commissions are settled when the invoice is
398
+ issued.</li>
399
+ <li><strong>Payment Based</strong>: Commissions are settled when the invoice is
400
+ paid.</li>
398
401
  </ul>
399
402
  </li>
400
403
  </ol>
@@ -405,19 +408,20 @@ be settled as well, resulting in a 0 net commission between both operations.</li
405
408
  <ol class="arabic simple">
406
409
  <li>Go to <em>Invoicing &gt; Customers &gt; Invoices</em>.</li>
407
410
  <li>Edit or create a new record.</li>
408
- <li>When you have selected a partner, each new invoice line you add will have
409
- the agents and commissions set at customer level.</li>
411
+ <li>When you have selected a partner, each new invoice line you add will
412
+ have the agents and commissions set at customer level.</li>
410
413
  <li>You can add, modify or delete these agents discretely clicking on the
411
- icon with several persons represented, next to the “Commission” field in the
412
- list. This icon will be available only if the line hasn’t been invoiced yet.</li>
413
- <li>If you have configured your system for editing lines in a popup window,
414
- agents will appear also in this window.</li>
415
- <li>The agents icon will be in this ocassion visible when the line hasn’t been
416
- settled.</li>
414
+ icon with several persons represented, next to the “Commission” field
415
+ in the list. This icon will be available only if the line hasn’t been
416
+ invoiced yet.</li>
417
+ <li>If you have configured your system for editing lines in a popup
418
+ window, agents will appear also in this window.</li>
419
+ <li>The agents icon will be in this ocassion visible when the line hasn’t
420
+ been settled.</li>
417
421
  <li>You have a button “Regenerate agents” on the bottom of the page
418
- “Invoice Lines” for forcing a recompute of all agents from the partner setup.
419
- This is needed for example when you have changed the partner on the
420
- invoice having already inserted lines.</li>
422
+ “Invoice Lines” for forcing a recompute of all agents from the
423
+ partner setup. This is needed for example when you have changed the
424
+ partner on the invoice having already inserted lines.</li>
421
425
  </ol>
422
426
  <p>For invoicing the settlements (only for external agents):</p>
423
427
  <ol class="arabic simple">
@@ -425,10 +429,11 @@ invoice having already inserted lines.</li>
425
429
  <li>On the window that appears, you can select following data:<ul>
426
430
  <li>Product. It should be a service product for being coherent.</li>
427
431
  <li>Journal: To be selected between existing purchase journals.</li>
428
- <li>Date: If you want to choose a specific invoice date. You can leave it
429
- blank if you prefer.</li>
430
- <li>Settlements: For selecting specific settlements to invoice. You can leave
431
- it blank as well for invoicing all the pending settlements.</li>
432
+ <li>Date: If you want to choose a specific invoice date. You can leave
433
+ it blank if you prefer.</li>
434
+ <li>Settlements: For selecting specific settlements to invoice. You
435
+ can leave it blank as well for invoicing all the pending
436
+ settlements.</li>
432
437
  </ul>
433
438
  </li>
434
439
  </ol>
@@ -437,8 +442,8 @@ it blank as well for invoicing all the pending settlements.</li>
437
442
  <li>Navigate to <em>Invoicing &gt; Commissions &gt; Invoices Settlements</em>.</li>
438
443
  <li>Select it/them on the list.</li>
439
444
  <li>Click on <em>Action &gt; Create Commission Invoices</em>.</li>
440
- <li>You can as well enter in one settlement, and click on the “Make invoice”
441
- button.</li>
445
+ <li>You can as well enter in one settlement, and click on the “Make
446
+ invoice” button.</li>
442
447
  </ol>
443
448
  </div>
444
449
  <div class="section" id="bug-tracker">
@@ -446,7 +451,7 @@ button.</li>
446
451
  <p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/commission/issues">GitHub Issues</a>.
447
452
  In case of trouble, please check there if your issue has already been reported.
448
453
  If you spotted it first, help us to smash it by providing a detailed and welcomed
449
- <a class="reference external" href="https://github.com/OCA/commission/issues/new?body=module:%20account_commission%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
454
+ <a class="reference external" href="https://github.com/OCA/commission/issues/new?body=module:%20account_commission%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
450
455
  <p>Do not contact contributors directly about support or help with technical issues.</p>
451
456
  </div>
452
457
  <div class="section" id="credits">
@@ -470,10 +475,10 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
470
475
  <li>Nicola Malcontenti &lt;<a class="reference external" href="mailto:nicola.malcontenti&#64;agilebg.com">nicola.malcontenti&#64;agilebg.com</a>&gt;</li>
471
476
  <li>Aitor Bouzas &lt;<a class="reference external" href="mailto:aitor.bouzas&#64;adaptivecity.com">aitor.bouzas&#64;adaptivecity.com</a>&gt;</li>
472
477
  <li>Alexei Rivera &lt;<a class="reference external" href="mailto:arivera&#64;archeti.com">arivera&#64;archeti.com</a>&gt;</li>
478
+ <li>Mina Samir &lt;<a class="reference external" href="mailto:minaw349&#64;outlook.com">minaw349&#64;outlook.com</a>&gt;</li>
473
479
  <li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:<ul>
474
480
  <li>Pedro M. Baeza</li>
475
481
  <li>Manuel Calero</li>
476
- <li>Sergio Teruel</li>
477
482
  </ul>
478
483
  </li>
479
484
  <li><a class="reference external" href="https://www.quartile.co">Quartile</a>:<ul>
@@ -485,6 +490,10 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
485
490
  <li>Ethan Hildick</li>
486
491
  </ul>
487
492
  </li>
493
+ <li><a class="reference external" href="https://www.sygel.es">Sygel</a>:<ul>
494
+ <li>Alberto Martínez</li>
495
+ </ul>
496
+ </li>
488
497
  </ul>
489
498
  </div>
490
499
  <div class="section" id="maintainers">
@@ -496,7 +505,7 @@ mission is to support the collaborative development of Odoo features and
496
505
  promote its widespread use.</p>
497
506
  <p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
498
507
  <p><a class="reference external image-reference" href="https://github.com/pedrobaeza"><img alt="pedrobaeza" src="https://github.com/pedrobaeza.png?size=40px" /></a></p>
499
- <p>This module is part of the <a class="reference external" href="https://github.com/OCA/commission/tree/16.0/account_commission">OCA/commission</a> project on GitHub.</p>
508
+ <p>This module is part of the <a class="reference external" href="https://github.com/OCA/commission/tree/17.0/account_commission">OCA/commission</a> project on GitHub.</p>
500
509
  <p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
501
510
  </div>
502
511
  </div>
@@ -7,7 +7,7 @@ from dateutil.relativedelta import relativedelta
7
7
 
8
8
  from odoo import fields
9
9
  from odoo.exceptions import UserError, ValidationError
10
- from odoo.tests import Form, tagged
10
+ from odoo.tests import tagged
11
11
 
12
12
  from odoo.addons.commission.tests.test_commission import TestCommissionBase
13
13
 
@@ -532,165 +532,3 @@ class TestAccountCommission(TestCommissionBase):
532
532
  ]
533
533
  )
534
534
  self.assertEqual(2, len(settlements))
535
-
536
- def test_invoice_partial_refund(self):
537
- commission = self.commission_net_paid
538
- agent = self.agent_monthly
539
- today = fields.Date.today()
540
- # Create an invoice
541
- invoice = self._create_invoice(agent, commission, today, currency=None)
542
- invoice.action_post()
543
- # Register payment for invoice
544
- payment_journal = self.env["account.journal"].search(
545
- [("type", "=", "cash"), ("company_id", "=", invoice.company_id.id)],
546
- limit=1,
547
- )
548
- register_payments = (
549
- self.env["account.payment.register"]
550
- .with_context(active_ids=invoice.id, active_model="account.move")
551
- .create({"journal_id": payment_journal.id})
552
- )
553
- register_payments.action_create_payments()
554
- # Make a parcial refund for the invoice
555
- move_reversal = (
556
- self.env["account.move.reversal"]
557
- .with_context(active_model="account.move", active_ids=invoice.id)
558
- .create(
559
- {
560
- "reason": "no reason",
561
- "refund_method": "refund",
562
- "journal_id": invoice.journal_id.id,
563
- }
564
- )
565
- )
566
- refund_form = Form(
567
- self.env["account.move"].browse(move_reversal.reverse_moves()["res_id"])
568
- )
569
- with refund_form.invoice_line_ids.edit(0) as line:
570
- line.price_unit -= 2
571
- refund = refund_form.save()
572
- refund.action_post()
573
- # Register payment for the refund
574
- register_payments = (
575
- self.env["account.payment.register"]
576
- .with_context(active_ids=refund.id, active_model="account.move")
577
- .create({"journal_id": payment_journal.id})
578
- )
579
- register_payments.action_create_payments()
580
- # check settlement creation. The commission must be (5 - 3) * 0.2 = 0.4
581
- self._settle_agent_invoice(agent, 1)
582
- settlements = self.settle_model.search([("agent_id", "=", agent.id)])
583
- self.assertEqual(2, len(settlements.line_ids))
584
- self.assertEqual(0.4, sum(settlements.mapped("total")))
585
-
586
- def test_invoice_full_refund(self):
587
- commission = self.commission_net_paid
588
- agent = self.agent_monthly
589
- today = fields.Date.today()
590
- # Create an invoice and refund it
591
- invoice = self._create_invoice(agent, commission, today, currency=None)
592
- invoice.action_post()
593
- move_reversal = (
594
- self.env["account.move.reversal"]
595
- .with_context(active_model="account.move", active_ids=invoice.id)
596
- .create(
597
- {
598
- "reason": "no reason",
599
- "refund_method": "cancel",
600
- "journal_id": invoice.journal_id.id,
601
- }
602
- )
603
- )
604
- move_reversal.reverse_moves()
605
- # check settlement creation. The commission must be: (5 - 5) * 0.2 = 0
606
- self._settle_agent_invoice(agent, 1)
607
- settlements = self.settle_model.search(
608
- [
609
- ("agent_id", "=", agent.id),
610
- ]
611
- )
612
- self.assertEqual(2, len(settlements.line_ids))
613
- self.assertEqual(0, sum(settlements.mapped("total")))
614
-
615
- def test_invoice_modify_refund(self):
616
- commission = self.commission_net_paid
617
- agent = self.agent_monthly
618
- today = fields.Date.today()
619
- # Create an invoice
620
- invoice = self._create_invoice(agent, commission, today, currency=None)
621
- invoice.action_post()
622
- # Create a full refund and a new invoice
623
- move_reversal = (
624
- self.env["account.move.reversal"]
625
- .with_context(active_model="account.move", active_ids=invoice.id)
626
- .create(
627
- {
628
- "reason": "no reason",
629
- "refund_method": "modify",
630
- "journal_id": invoice.journal_id.id,
631
- }
632
- )
633
- )
634
- invoice2_form = Form(
635
- self.env["account.move"].browse(move_reversal.reverse_moves()["res_id"])
636
- )
637
- with invoice2_form.invoice_line_ids.edit(0) as line:
638
- line.price_unit -= 2
639
- invoice2 = invoice2_form.save()
640
- invoice2.action_post()
641
- # Register payment for the new invoice
642
- payment_journal = self.env["account.journal"].search(
643
- [("type", "=", "cash"), ("company_id", "=", invoice.company_id.id)],
644
- limit=1,
645
- )
646
- register_payments = (
647
- self.env["account.payment.register"]
648
- .with_context(active_ids=invoice2.id, active_model="account.move")
649
- .create({"journal_id": payment_journal.id})
650
- )
651
- register_payments.action_create_payments()
652
-
653
- # check settlement creation. The commission must be (5 - 5 + 3) * 0.2 = 0.6
654
- self._settle_agent_invoice(agent, 1)
655
- settlements = self.settle_model.search(
656
- [
657
- ("agent_id", "=", agent.id),
658
- ]
659
- )
660
- self.assertEqual(3, len(settlements.line_ids))
661
- self.assertAlmostEqual(0.6, sum(settlements.mapped("total")), 2)
662
-
663
- def _register_payment(self, invoice):
664
- payment_journal = self.env["account.journal"].search(
665
- [("type", "=", "cash"), ("company_id", "=", self.env.company.id)],
666
- limit=1,
667
- )
668
- register_payments = (
669
- self.env["account.payment.register"]
670
- .with_context(active_ids=invoice.id, active_model="account.move")
671
- .create({"journal_id": payment_journal.id})
672
- )
673
- register_payments.action_create_payments()
674
-
675
- def test_invoice_pending_settlement(self):
676
- """Make in one settlement all pending invoices to wizard date"""
677
- fields.Date.today()
678
- self.commission_net_paid.invoice_state = "paid"
679
- invoice1 = self._create_invoice(
680
- self.agent_pending, self.commission_net_paid, "2024-02-15", currency=None
681
- )
682
- # Register payment for the new invoice
683
- invoice2 = self._create_invoice(
684
- self.agent_pending, self.commission_net_paid, "2024-03-15", currency=None
685
- )
686
- invoice3 = self._create_invoice(
687
- self.agent_pending, self.commission_net_paid, "2024-04-15", currency=None
688
- )
689
- # invoice1.invoice_line_ids.agent_ids._compute_amount()
690
- (invoice1 + invoice2 + invoice3).action_post()
691
- self._register_payment(invoice1)
692
- self._register_payment(invoice2)
693
- self._register_payment(invoice3)
694
- self._settle_agent_invoice(self.agent_pending, 1)
695
- settlements = self.settle_model.search([("state", "=", "settled")])
696
- self.assertEqual(len(settlements.line_ids), 3)
@@ -15,7 +15,7 @@
15
15
  widget="monetary"
16
16
  options="{'currency_field': 'currency_id'}"
17
17
  />
18
- <field name="currency_id" invisible="1" />
18
+ <field name="currency_id" column_invisible="1" />
19
19
  </tree>
20
20
  </field>
21
21
  </record>
@@ -28,15 +28,12 @@
28
28
  <group
29
29
  string="Commissions"
30
30
  name="group_commission"
31
- attrs="{'invisible': [('agent_ids', '=', [])], 'readonly': [('any_settled', '=', True)]}"
31
+ invisible="not agent_ids"
32
+ readonly="any_settled"
32
33
  >
33
34
  <field name="any_settled" invisible="1" />
34
35
  <field name="commission_free" force_save="1" />
35
- <field
36
- name="agent_ids"
37
- attrs="{'readonly': [('commission_free', '=', True)]}"
38
- force_save="1"
39
- />
36
+ <field name="agent_ids" readonly="commission_free" force_save="1" />
40
37
  </group>
41
38
  </xpath>
42
39
  </field>
@@ -52,7 +49,7 @@
52
49
  type="object"
53
50
  class="oe_stat_button"
54
51
  icon="fa-pencil-square-o"
55
- attrs="{'invisible': [('settlement_count', '=', 0)]}"
52
+ invisible="(settlement_count == 0)"
56
53
  >
57
54
  <field
58
55
  name="settlement_count"
@@ -65,28 +62,20 @@
65
62
  expr="//field[@name='invoice_line_ids']/tree//field[@name='price_subtotal']"
66
63
  position="after"
67
64
  >
68
- <field name="settlement_id" invisible="1" />
69
- <field name="commission_free" invisible="1" />
70
- <field name="any_settled" invisible="1" />
65
+ <field name="settlement_id" column_invisible="1" />
66
+ <field name="commission_free" column_invisible="1" />
67
+ <field name="any_settled" column_invisible="1" />
71
68
  <button
72
69
  name="button_edit_agents"
73
70
  title="Edit agents"
74
71
  icon="fa-users"
75
- attrs="{'invisible': [
76
- '|',
77
- ('commission_free', '=', True),
78
- ('any_settled', '=', True),
79
- ],
80
- 'column_invisible': [
81
- ('parent.move_type', 'not in', ['out_invoice', 'out_refund'])
82
- ]}"
72
+ invisible="commission_free or any_settled"
73
+ column_invisible="(parent.move_type not in ('out_invoice', 'out_refund'))"
83
74
  type="object"
84
75
  />
85
76
  <field
86
77
  name="commission_status"
87
- attrs="{'column_invisible': [
88
- ('parent.move_type', 'not in', ['out_invoice', 'out_refund'])
89
- ]}"
78
+ column_invisible="(parent.move_type not in ('out_invoice', 'out_refund'))"
90
79
  />
91
80
  </xpath>
92
81
  <xpath expr="//field[@name='invoice_line_ids']" position="after">
@@ -94,28 +83,22 @@
94
83
  name="recompute_lines_agents"
95
84
  type="object"
96
85
  string="Regenerate agents"
97
- attrs="{'invisible': [
98
- '|',
99
- ('move_type', 'not in', ['out_invoice', 'out_refund']),
100
- ('state', '!=', 'draft')
101
- ]}"
86
+ invisible="(move_type not in ['out_invoice', 'out_refund']) or (state != 'draft')"
102
87
  />
103
88
  </xpath>
104
89
  <!-- Needed for fields in invoice lines to be saved -->
105
90
  <xpath expr="//field[@name='line_ids']/tree" position="inside">
106
- <field name="settlement_id" invisible="1" />
107
- <field name="commission_free" invisible="1" />
108
- <field name="any_settled" invisible="1" />
109
- <field name="commission_status" invisible="1" />
91
+ <field name="settlement_id" column_invisible="1" />
92
+ <field name="commission_free" column_invisible="1" />
93
+ <field name="any_settled" column_invisible="1" />
94
+ <field name="commission_status" column_invisible="1" />
110
95
  </xpath>
111
96
  <field name="tax_totals" position="after">
112
97
  <field
113
98
  name="commission_total"
114
99
  widget="monetary"
115
100
  options="{'currency_field': 'currency_id'}"
116
- attrs="{'invisible': [
117
- ('move_type', 'not in', ['out_invoice', 'out_refund'])
118
- ]}"
101
+ invisible="(move_type not in ('out_invoice', 'out_refund'))"
119
102
  />
120
103
  </field>
121
104
  </field>
@@ -132,9 +115,9 @@
132
115
  class="oe_stat_button"
133
116
  icon="fa-pencil-square-o"
134
117
  string="Settlements"
135
- attrs="{'invisible': [('settlement_count', '=', 0)]}"
118
+ invisible="(settlement_count == 0)"
136
119
  />
137
- <field name="settlement_count" invisible="1" />
120
+ <field name="settlement_count" column_invisible="1" />
138
121
  </field>
139
122
  </field>
140
123
  </record>
@@ -21,7 +21,7 @@
21
21
  <button name="action_cancel" position="before">
22
22
  <button
23
23
  string="Make invoice"
24
- attrs="{'invisible': ['|', ('state', '!=', 'settled'), ('agent_type', '!=', 'agent')]}"
24
+ invisible="(state != 'settled') or (agent_type != 'agent')"
25
25
  class="oe_highlight"
26
26
  type="object"
27
27
  name="action_invoice"
@@ -29,7 +29,7 @@
29
29
  />
30
30
  <button
31
31
  string="Reset to draft"
32
- attrs="{'invisible': [('state', '!=', 'except_invoice')]}"
32
+ invisible="(state != 'except_invoice')"
33
33
  type="object"
34
34
  name="action_draft"
35
35
  groups="account.group_account_invoice"
@@ -38,7 +38,7 @@
38
38
  <field name="settlement_type" position="after">
39
39
  <field
40
40
  name="invoice_id"
41
- attrs="{'invisible': [('state', '!=', 'invoiced')]}"
41
+ invisible="(state != 'invoiced')"
42
42
  groups="account.group_account_invoice"
43
43
  />
44
44
  </field>
@@ -48,7 +48,7 @@
48
48
  >
49
49
  <field
50
50
  name="invoice_line_id"
51
- attrs="{'column_invisible': [('parent.settlement_type', '!=', 'sale_invoice')]}"
51
+ column_invisible="(parent.settlement_type != 'sale_invoice')"
52
52
  groups="account.group_account_invoice"
53
53
  />
54
54
  </xpath>
@@ -8,7 +8,7 @@
8
8
  <xpath expr="//group[@name='commision_params']" position="inside">
9
9
  <field
10
10
  name="invoice_state"
11
- attrs="{'required': [('settlement_type', '=', 'sale_invoice')]}"
11
+ required="(settlement_type == 'sale_invoice')"
12
12
  />
13
13
  </xpath>
14
14
  </field>
@@ -12,30 +12,24 @@
12
12
  </xpath>
13
13
  <xpath expr="//th" position="after">
14
14
  <t t-if="o.settlement_type == 'sale_invoice'">
15
- <th class="text-start">Invoice</th>
16
- <th class="text-start">Customer</th>
17
- <th class="text-start">Description</th>
15
+ <th class="text-start">Invoice line</th>
18
16
  <th class="text-start">Quantity</th>
19
- <th class="text-start">Amount</th>
20
17
  </t>
21
18
  </xpath>
22
19
  <xpath expr="//table/tbody/tr/td" position="after">
23
20
  <t t-if="o.settlement_type == 'sale_invoice'">
24
21
  <td>
25
- <span t-field="l.invoice_line_id.move_id.name" />
26
- </td>
27
- <td>
28
- <span t-field="l.invoice_line_id.move_id.partner_id" />
29
- </td>
30
- <td>
31
- <span t-field="l.invoice_line_id.name" />
22
+ <span t-field="l.invoice_line_id" />
32
23
  </td>
33
24
  <td>
34
25
  <span t-field="l.invoice_line_id.quantity" />
35
26
  </td>
36
- <td>
37
- <span t-field="l.invoice_line_id.price_subtotal" />
38
- </td>
27
+ </t>
28
+ </xpath>
29
+ <xpath expr="//table/tfoot/tr/td" position="before">
30
+ <t t-if="o.settlement_type == 'sale_invoice'">
31
+ <td />
32
+ <td />
39
33
  </t>
40
34
  </xpath>
41
35
  </template>
@@ -11,10 +11,7 @@
11
11
  <field name="product_id" />
12
12
  <field name="date" />
13
13
  </group>
14
- <group
15
- string="Settlements"
16
- attrs="{'invisible': [('from_settlement', '=', True)]}"
17
- >
14
+ <group string="Settlements" invisible="from_settlement">
18
15
  <p
19
16
  colspan="4"
20
17
  >(keep empty for invoicing all the pending settlements)</p>