From 0298853105e6ba9386b57bdfdff5c9c0cc3bc6fd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20-=20Le=20Filament?= <remi@le-filament.com>
Date: Wed, 2 Oct 2024 08:11:37 +0200
Subject: [PATCH] [MIG] version 17.0

---
 .eslintrc.yml               |  2 +-
 .gitignore                  |  9 +++++++++
 .pre-commit-config.yaml     | 17 +++++++++++++----
 .pylintrc                   | 12 ++++++------
 .pylintrc-mandatory         |  2 +-
 README.rst                  |  9 +++++----
 __manifest__.py             |  2 +-
 models/account_move.py      |  2 +-
 models/sale.py              |  2 +-
 views/account_move_view.xml |  4 ++--
 views/sales_view.xml        | 26 ++++++++++++++++++++++----
 11 files changed, 62 insertions(+), 25 deletions(-)

diff --git a/.eslintrc.yml b/.eslintrc.yml
index fed88d7..0b38203 100644
--- a/.eslintrc.yml
+++ b/.eslintrc.yml
@@ -4,7 +4,7 @@ env:
 
 # See https://github.com/OCA/odoo-community.org/issues/37#issuecomment-470686449
 parserOptions:
-  ecmaVersion: 2019
+  ecmaVersion: 2022
 
 overrides:
   - files:
diff --git a/.gitignore b/.gitignore
index d99361a..c9f4238 100644
--- a/.gitignore
+++ b/.gitignore
@@ -26,6 +26,15 @@ var/
 *.eggs
 .copier-answers.yml
 
+# Debian packages
+*.deb
+
+# Redhat packages
+*.rpm
+
+# MacOS packages
+*.dmg
+
 # Installer logs
 pip-log.txt
 pip-delete-this-directory.txt
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 3efb4d9..f58f2c6 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -16,6 +16,8 @@ exclude: |
   readme/.*\.(rst|md)$|
   # Ignore build and dist directories in addons
   /build/|/dist/|
+  # Ignore test files in addons
+  /tests/samples/.*|
   # You don't usually want a bot to modify your legal texts
   (LICENSE.*|COPYING.*)
 default_language_version:
@@ -35,9 +37,14 @@ repos:
         name: en.po files cannot exist
         entry: found a en.po file
         language: fail
-        files: '[a-zA-Z0-9_]*/i18n/en\.po$'
+        files:
+          '[a-zA-Z0-9_]*/i18n/en\.po$'
+          #  - repo: https://github.com/sbidoul/whool
+          #    rev: v0.5
+          #    hooks:
+          #      - id: whool-init
   - repo: https://github.com/oca/maintainer-tools
-    rev: f71041f22b8cd68cf7c77b73a14ca8d8cd190a60
+    rev: d5fab7ee87fceee858a3d01048c78a548974d935
     hooks:
       # update the NOT INSTALLABLE ADDONS section above
       - id: oca-update-pre-commit-excluded-addons
@@ -46,11 +53,13 @@ repos:
       - id: oca-gen-addon-readme
         args:
           - --addons-dir=.
-          - --branch=16.0
+          - --branch=17.0
           - --org-name=lefilament
           - --repo-name=template_module
           - --if-source-changed
           - --keep-source-digest
+          - --convert-fragments-to-markdown
+      # - id: oca-gen-external-dependencies
   - repo: https://github.com/OCA/odoo-pre-commit-hooks
     rev: v0.0.25
     hooks:
@@ -104,7 +113,7 @@ repos:
         args: [--fix, --exit-non-zero-on-fix]
       - id: ruff-format
   - repo: https://github.com/OCA/pylint-odoo
-    rev: v8.0.19
+    rev: v9.0.4
     hooks:
       - id: pylint_odoo
         name: pylint with optional checks
diff --git a/.pylintrc b/.pylintrc
index 71c476d..4fb9ba5 100644
--- a/.pylintrc
+++ b/.pylintrc
@@ -5,12 +5,12 @@ load-plugins=pylint_odoo
 score=n
 
 [ODOOLINT]
-readme_template_url="https://github.com/OCA/maintainer-tools/blob/master/template/module/README.rst"
-manifest_required_authors=Le Filament
-manifest_required_keys=license
-manifest_deprecated_keys=description,active
-license_allowed=AGPL-3,GPL-2,GPL-2 or any later version,GPL-3,GPL-3 or any later version,LGPL-3
-valid_odoo_versions=16.0
+readme-template-url="https://github.com/OCA/maintainer-tools/blob/master/template/module/README.rst"
+manifest-required-authors=Le Filament
+manifest-required-keys=license
+manifest-deprecated-keys=description,active
+license-allowed=AGPL-3,GPL-2,GPL-2 or any later version,GPL-3,GPL-3 or any later version,LGPL-3
+valid-odoo-versions=17.0
 
 [MESSAGES CONTROL]
 disable=all
diff --git a/.pylintrc-mandatory b/.pylintrc-mandatory
index 9906493..42885e9 100644
--- a/.pylintrc-mandatory
+++ b/.pylintrc-mandatory
@@ -9,7 +9,7 @@ manifest-required-authors=Le Filament
 manifest-required-keys=license
 manifest-deprecated-keys=description,active
 license-allowed=AGPL-3,GPL-2,GPL-2 or any later version,GPL-3,GPL-3 or any later version,LGPL-3
-valid-odoo-versions=16.0
+valid-odoo-versions=17.0
 
 [MESSAGES CONTROL]
 disable=all
diff --git a/README.rst b/README.rst
index f08db28..a7428d8 100644
--- a/README.rst
+++ b/README.rst
@@ -11,9 +11,10 @@ This module depends upon *sale* module.
 
 This module provides:
 
-* Updated quotation tree view to display untaxed amount instead of taxed amount
-* Updated sale order tree view to display untaxed amount instead of taxed amount
-* Updated sale order tree view to display amount that remains to be invoiced
+* Updated quotation views to display untaxed amount instead of taxed amount
+* Updated sale order views to display untaxed amount instead of taxed amount
+* Updated sale order tree/form views to display untax amount that remains to be invoiced
+* beneficiary_id (initialized with partner_id) on invoices
 
 
 Credits
@@ -23,7 +24,7 @@ Contributors
 ------------
 
 * Benjamin Rivier <benjamin@le-filament.com>
-* Remi Cazenave <remi@le-filament.com>
+* Rémi Cazenave <remi@le-filament.com>
 * Juliana Poudou <juliana@le-filament.com>
 
 
diff --git a/__manifest__.py b/__manifest__.py
index 1f84bfe..abfde40 100644
--- a/__manifest__.py
+++ b/__manifest__.py
@@ -1,7 +1,7 @@
 {
     "name": "Le Filament - Sales",
     "summary": "Generic Sales views update by Le Filament",
-    "version": "16.0.1.0.0",
+    "version": "17.0.1.0.0",
     "license": "AGPL-3",
     "author": "Le Filament",
     "category": "Sales/Sales",
diff --git a/models/account_move.py b/models/account_move.py
index a5ec4af..df5ab79 100644
--- a/models/account_move.py
+++ b/models/account_move.py
@@ -1,4 +1,4 @@
-# Copyright 2018-2022 Le Filament (<https://le-filament.com>)
+# Copyright 2018- Le Filament (https://le-filament.com)
 # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
 
 from odoo import api, fields, models
diff --git a/models/sale.py b/models/sale.py
index 538b443..a8e03b1 100644
--- a/models/sale.py
+++ b/models/sale.py
@@ -1,4 +1,4 @@
-# Copyright 2018-2022 Le Filament (<https://le-filament.com>)
+# Copyright 2018- Le Filament (https://le-filament.com)
 # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
 
 from odoo import api, fields, models
diff --git a/views/account_move_view.xml b/views/account_move_view.xml
index bc2672a..a72b5a8 100644
--- a/views/account_move_view.xml
+++ b/views/account_move_view.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8" ?>
-<!-- Copyright 2022 Le Filament (<https://le-filament.com>)
+<!-- Copyright 2022- Le Filament (https://le-filament.com)
      License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
 <odoo>
     <record model="ir.ui.view" id="view_move_form_filament">
@@ -10,7 +10,7 @@
             <field name="partner_shipping_id" position="after">
                 <field
                     name="beneficiary_id"
-                    attrs="{'invisible': [('move_type', 'not in', ('out_invoice', 'out_refund'))]}"
+                    invisible="move_type not in ('out_invoice', 'out_refund')"
                 />
             </field>
         </field>
diff --git a/views/sales_view.xml b/views/sales_view.xml
index 7074016..d5322fc 100644
--- a/views/sales_view.xml
+++ b/views/sales_view.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8" ?>
-<!-- Copyright 2022- Le Filament (<https://le-filament.com>)
+<!-- Copyright 2022- Le Filament (https://le-filament.com)
      License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
 <odoo>
     <record id="lf_view_sale_order_calendar" model="ir.ui.view">
@@ -59,7 +59,7 @@
 
     <record id="lf_view_order_tree" model="ir.ui.view">
         <field name="inherit_id" ref="sale.view_order_tree" />
-        <field name="name">sale.order.tree</field>
+        <field name="name">sale.order.tree (orders)</field>
         <field name="model">sale.order</field>
         <field name="arch" type="xml">
             <field name="amount_untaxed" position="attributes">
@@ -68,7 +68,7 @@
             <field name="amount_total" position="attributes">
                 <attribute name="optional">hide</attribute>
             </field>
-            <field name="amount_total" position="after">
+            <field name="amount_to_invoice" position="after">
                 <field
                     name="untaxed_amount_to_invoice"
                     widget="monetary"
@@ -81,9 +81,12 @@
 
     <record id="lf_view_quotation_tree" model="ir.ui.view">
         <field name="inherit_id" ref="sale.view_quotation_tree" />
-        <field name="name">sale.order.tree</field>
+        <field name="name">sale.order.tree (quotes)</field>
         <field name="model">sale.order</field>
         <field name="arch" type="xml">
+            <field name="amount_to_invoice" position="attributes">
+                <attribute name="column_invisible">1</attribute>
+            </field>
             <field name="amount_untaxed" position="attributes">
                 <attribute name="optional">show</attribute>
             </field>
@@ -93,4 +96,19 @@
         </field>
     </record>
 
+    <record id="lf_view_order_form" model="ir.ui.view">
+        <field name="inherit_id" ref="sale.view_order_form" />
+        <field name="name">sale.order.form</field>
+        <field name="model">sale.order</field>
+        <field name="arch" type="xml">
+            <group name="sale_total" position="inside">
+                <field
+                    name="untaxed_amount_to_invoice"
+                    widget="monetary"
+                    invisible="state != 'sale'"
+                    readonly="1"
+                />
+            </group>
+        </field>
+    </record>
 </odoo>
-- 
GitLab