diff --git a/.eslintrc.yml b/.eslintrc.yml
new file mode 100644
index 0000000000000000000000000000000000000000..fed88d70d23ecb3297ea28854b320c4d62ee3c26
--- /dev/null
+++ b/.eslintrc.yml
@@ -0,0 +1,188 @@
+env:
+  browser: true
+  es6: true
+
+# See https://github.com/OCA/odoo-community.org/issues/37#issuecomment-470686449
+parserOptions:
+  ecmaVersion: 2019
+
+overrides:
+  - files:
+      - "**/*.esm.js"
+    parserOptions:
+      sourceType: module
+
+# Globals available in Odoo that shouldn't produce errorings
+globals:
+  _: readonly
+  $: readonly
+  fuzzy: readonly
+  jQuery: readonly
+  moment: readonly
+  odoo: readonly
+  openerp: readonly
+  owl: readonly
+  luxon: readonly
+
+# Styling is handled by Prettier, so we only need to enable AST rules;
+# see https://github.com/OCA/maintainer-quality-tools/pull/618#issuecomment-558576890
+rules:
+  accessor-pairs: warn
+  array-callback-return: warn
+  callback-return: warn
+  capitalized-comments:
+    - warn
+    - always
+    - ignoreConsecutiveComments: true
+      ignoreInlineComments: true
+  complexity:
+    - warn
+    - 15
+  constructor-super: warn
+  dot-notation: warn
+  eqeqeq: warn
+  global-require: warn
+  handle-callback-err: warn
+  id-blacklist: warn
+  id-match: warn
+  init-declarations: error
+  max-depth: warn
+  max-nested-callbacks: warn
+  max-statements-per-line: warn
+  no-alert: warn
+  no-array-constructor: warn
+  no-caller: warn
+  no-case-declarations: warn
+  no-class-assign: warn
+  no-cond-assign: error
+  no-const-assign: error
+  no-constant-condition: warn
+  no-control-regex: warn
+  no-debugger: error
+  no-delete-var: warn
+  no-div-regex: warn
+  no-dupe-args: error
+  no-dupe-class-members: error
+  no-dupe-keys: error
+  no-duplicate-case: error
+  no-duplicate-imports: error
+  no-else-return: warn
+  no-empty-character-class: warn
+  no-empty-function: error
+  no-empty-pattern: error
+  no-empty: warn
+  no-eq-null: error
+  no-eval: error
+  no-ex-assign: error
+  no-extend-native: warn
+  no-extra-bind: warn
+  no-extra-boolean-cast: warn
+  no-extra-label: warn
+  no-fallthrough: warn
+  no-func-assign: error
+  no-global-assign: error
+  no-implicit-coercion:
+    - warn
+    - allow: ["~"]
+  no-implicit-globals: warn
+  no-implied-eval: warn
+  no-inline-comments: warn
+  no-inner-declarations: warn
+  no-invalid-regexp: warn
+  no-irregular-whitespace: warn
+  no-iterator: warn
+  no-label-var: warn
+  no-labels: warn
+  no-lone-blocks: warn
+  no-lonely-if: error
+  no-mixed-requires: error
+  no-multi-str: warn
+  no-native-reassign: error
+  no-negated-condition: warn
+  no-negated-in-lhs: error
+  no-new-func: warn
+  no-new-object: warn
+  no-new-require: warn
+  no-new-symbol: warn
+  no-new-wrappers: warn
+  no-new: warn
+  no-obj-calls: warn
+  no-octal-escape: warn
+  no-octal: warn
+  no-param-reassign: warn
+  no-path-concat: warn
+  no-process-env: warn
+  no-process-exit: warn
+  no-proto: warn
+  no-prototype-builtins: warn
+  no-redeclare: warn
+  no-regex-spaces: warn
+  no-restricted-globals: warn
+  no-restricted-imports: warn
+  no-restricted-modules: warn
+  no-restricted-syntax: warn
+  no-return-assign: error
+  no-script-url: warn
+  no-self-assign: warn
+  no-self-compare: warn
+  no-sequences: warn
+  no-shadow-restricted-names: warn
+  no-shadow: warn
+  no-sparse-arrays: warn
+  no-sync: warn
+  no-this-before-super: warn
+  no-throw-literal: warn
+  no-undef-init: warn
+  no-undef: error
+  no-unmodified-loop-condition: warn
+  no-unneeded-ternary: error
+  no-unreachable: error
+  no-unsafe-finally: error
+  no-unused-expressions: error
+  no-unused-labels: error
+  no-unused-vars: error
+  no-use-before-define: error
+  no-useless-call: warn
+  no-useless-computed-key: warn
+  no-useless-concat: warn
+  no-useless-constructor: warn
+  no-useless-escape: warn
+  no-useless-rename: warn
+  no-void: warn
+  no-with: warn
+  operator-assignment: [error, always]
+  prefer-const: warn
+  radix: warn
+  require-yield: warn
+  sort-imports: warn
+  spaced-comment: [error, always]
+  strict: [error, function]
+  use-isnan: error
+  valid-jsdoc:
+    - warn
+    - prefer:
+        arg: param
+        argument: param
+        augments: extends
+        constructor: class
+        exception: throws
+        func: function
+        method: function
+        prop: property
+        return: returns
+        virtual: abstract
+        yield: yields
+      preferType:
+        array: Array
+        bool: Boolean
+        boolean: Boolean
+        number: Number
+        object: Object
+        str: String
+        string: String
+      requireParamDescription: false
+      requireReturn: false
+      requireReturnDescription: false
+      requireReturnType: false
+  valid-typeof: warn
+  yoda: warn
diff --git a/models/acc_operation.py b/models/acc_operation.py
index 842dae9e7db7a45daa1a7a8ecd7d67917220999b..86b7f84301cdeca06c15c5d5ca4eab142de3e916 100644
--- a/models/acc_operation.py
+++ b/models/acc_operation.py
@@ -24,7 +24,7 @@ def get_algo_description(algo):
         "dyn_perso_compute": "",
     }
 
-    return desc.get(algo, f"Pas de descritpion associée a {algo}")
+    return desc.get(algo, f"Pas de description associée a {algo}")
 
 
 class AccOperation(models.Model):
@@ -102,9 +102,7 @@ class AccOperation(models.Model):
     def get_affect_sum(self, data_slot):
         affect_sum = 0.0
         for counter in data_slot.get("affect"):
-            affect_counter = data_slot.get("affect").get(counter)
-            if affect_counter:
-                affect_sum += affect_counter
+            affect_sum += data_slot.get("affect").get(counter, 0)
         return affect_sum
 
     def generate(self):
@@ -142,10 +140,10 @@ class AccOperation(models.Model):
             item = data.get(slot)
             affect = item.get("affect")
             if affect:
-                total_production = item.get("prod_initiale")
+                total_prod = item.get("prod_initiale")
                 remaining_prod = item.get("prod_totale")
                 affect_sum = self.get_affect_sum(item)
-                if abs(affect_sum + remaining_prod - total_production) > 1e-3:
+                if abs(affect_sum + remaining_prod - total_prod) > 1e-3:
                     raise ValidationError(
                         _(
                             "Une erreur s'est produite lors de "
@@ -158,19 +156,18 @@ class AccOperation(models.Model):
             item = data.get(slot)
             affect = item.get("affect")
             if affect:
-                total_production = item.get("prod_initiale")
+                total_prod = item.get("prod_initiale")
 
                 # calcul du pourcentage attribué à chaque
                 # compteur par rapport à la production totale
                 weights = {}
                 for counter_id in affect:
                     affecte_counter = affect.get(counter_id)
-                    if total_production == 0:
+                    if total_prod == 0:
                         weight = 0.0
                     else:
                         weight = (
-                            math.floor((affecte_counter * 100 / total_production) * 1e6)
-                            / 1e6
+                            math.floor((affecte_counter * 100 / total_prod) * 1e6) / 1e6
                         )
                     weights[counter_id] = weight
 
diff --git a/models/acc_priority_group.py b/models/acc_priority_group.py
index 32574d1e8652265df9cab76eb9e43d4f1114fa1e..191b20dce838b6f16d206cc78e0c794c43ad5a3b 100644
--- a/models/acc_priority_group.py
+++ b/models/acc_priority_group.py
@@ -33,7 +33,7 @@ class AccPriorityGroup(models.Model):
     )
 
     counter_datas = fields.Json(compute="_compute_counter_datas")
-    total_share = fields.Float(compute="_compute_total_share", store=False)
+    total_share = fields.Float(compute="_compute_total_share", store=True)
     # ------------------------------------------------------
     # SQL Constraints
     # ------------------------------------------------------
@@ -45,7 +45,10 @@ class AccPriorityGroup(models.Model):
     # ------------------------------------------------------
     # Computed fields / Search Fields
     # ------------------------------------------------------
-    @api.depends("acc_priority_group_counter_ids")
+    @api.depends(
+        "acc_priority_group_counter_ids",
+        "acc_priority_group_counter_ids.acc_counter_share",
+    )
     def _compute_total_share(self):
         for record in self:
             record.total_share = sum(
@@ -151,43 +154,40 @@ class AccPriorityGroup(models.Model):
         return d
 
     def get_conso_sum(self, data_slot):
-        conso = 0.0
+        conso_sum = 0.0
         for counter in self.acc_priority_group_counter_ids.acc_counter_id.mapped(
             "name"
         ):
-            consok = data_slot.get("conso").get(counter)
-            if consok:
-                conso += consok
-        return conso
+            conso_sum += data_slot.get("conso").get(counter, 0)
+        return conso_sum
 
     def _prorata(self, data):
         for slot in data:
             remaining_prod = data.get(slot).get("prod_totale")
-            priority_counters_conso_sum = self.get_conso_sum(data.get(slot))
+            total_conso = self.get_conso_sum(data.get(slot))
 
             total_affecte = 0.0
             if not data.get(slot).get("affect"):
                 data[slot]["affect"] = {}
 
             for counter in self.acc_priority_group_counter_ids.acc_counter_id:
+                # un compteur peut être présent dans deux groupes de priorité
+                already_affected = data.get(slot).get("affect").get(counter, 0)
                 conso_k = data.get(slot).get("conso").get(counter.name)
                 # si le compteur rentre en cours de periode il figure dans le
                 # groupe de repartition mais pas dans les données brutes conso_k = None
                 # dans ce cas on affecte 0
-                if (
-                    remaining_prod < 0
-                    or priority_counters_conso_sum == 0
-                    or conso_k is None
-                ):
-                    part_a_affecter = 0.0
+                if remaining_prod <= 0 or total_conso == 0 or conso_k is None:
+                    newly_affected = 0
+                    sum_affected = already_affected + 0.0
                 else:
-                    part_a_affecter = (
-                        remaining_prod * conso_k
-                    ) / priority_counters_conso_sum
-                    part_a_affecter = min(conso_k, part_a_affecter)
-                data[slot]["affect"][counter] = part_a_affecter
-                total_affecte += part_a_affecter
+                    part_a_affecter = (remaining_prod * conso_k) / total_conso
+                    sum_affected = min(conso_k, (already_affected + part_a_affecter))
+                    newly_affected = sum_affected - already_affected
+                data[slot]["affect"][counter] = sum_affected
+                total_affecte += newly_affected
 
+            # on met à jour la prod restant à affecter
             data[slot]["prod_totale"] = remaining_prod - total_affecte
             # possiblement on peut avoir affecté plus que la p
             # roduction total_affecte=496.00000000000006
@@ -203,19 +203,23 @@ class AccPriorityGroup(models.Model):
                 data[slot]["affect"] = {}
             for priority_group_counter in self.acc_priority_group_counter_ids:
                 counter = priority_group_counter.acc_counter_id
+                already_affected = data.get(slot).get("affect").get(counter, 0)
                 counter_share = priority_group_counter.acc_counter_share
                 conso_k = data.get(slot).get("conso").get(counter.name)
                 if (
-                    remaining_prod < 0
+                    remaining_prod <= 0
                     or total_share == 0
                     or conso_k is None
                     or counter_share == 0
                 ):
-                    part_a_affecter = 0.0
+                    newly_affected = 0
+                    sum_affected = already_affected + 0.0
                 else:
                     part_a_affecter = (remaining_prod * counter_share) / total_share
-                    part_a_affecter = min(conso_k, part_a_affecter)
-                data[slot]["affect"][counter] = part_a_affecter
-                total_affecte += part_a_affecter
+                    sum_affected = min(conso_k, (already_affected + part_a_affecter))
+                    newly_affected = sum_affected - already_affected
+
+                data[slot]["affect"][counter] = sum_affected
+                total_affecte += newly_affected
             data[slot]["prod_totale"] = remaining_prod - total_affecte
         return data
diff --git a/models/acc_priority_group_counter.py b/models/acc_priority_group_counter.py
index 61b9cc3c9d24d8395ae2b1e0974174a7b151c3bc..9e0d39bde846dc2ebb947999a7277e2719f1a468 100644
--- a/models/acc_priority_group_counter.py
+++ b/models/acc_priority_group_counter.py
@@ -41,13 +41,14 @@ class AccPriorityGroupCounter(models.Model):
 
     acc_counter_share = fields.Float(
         string="Quote-part",
-        help="Part de la production affectée à ce PRM, au prorata de l'ensemble des parts affectées aux autres PRMs",
+        help="Part de la production affectée à ce PRM, "
+        "au prorata de l'ensemble des parts affectées aux autres PRMs",
     )
     group_type_algo = fields.Selection(
         related="acc_priority_group_id.type_algo", readonly=True
     )
     acc_counter_percentage = fields.Float(
-        compute="_compute_acc_counter_percentage", store=False
+        compute="_compute_acc_counter_percentage", store=True
     )
 
     # ------------------------------------------------------
@@ -62,9 +63,7 @@ class AccPriorityGroupCounter(models.Model):
     # Computed fields / Search Fields
     # ------------------------------------------------------
 
-    @api.depends(
-        "acc_priority_group_id.acc_priority_group_counter_ids", "acc_counter_share"
-    )
+    @api.depends("acc_priority_group_id.total_share")
     def _compute_acc_counter_percentage(self):
         for record in self:
             total_share = record.acc_priority_group_id.total_share
@@ -132,7 +131,6 @@ class AccPriorityGroupCounter(models.Model):
         return group_ids
 
     def action_open_counter_share_form(self):
-        print("action_open_counter_share_form")
         return {
             "type": "ir.actions.act_window",
             "name": "Modifier la quote-part du point de soutirage",
diff --git a/models/acc_repartition_counter.py b/models/acc_repartition_counter.py
index a6d0700c223a021a752516044d5449f11990e57a..97235e5e41f8db1896280ac11541963d6125f9ea 100644
--- a/models/acc_repartition_counter.py
+++ b/models/acc_repartition_counter.py
@@ -15,7 +15,7 @@ class AccRepartitionCounter(models.Model):
     )
 
     def init(self):
-        super().init()
+        ret = super().init()
         if not index_exists(self._cr, "acc_repartition_counter_index"):
             self._cr.execute(
                 """
@@ -25,6 +25,7 @@ class AccRepartitionCounter(models.Model):
 
                 """
             )
+        return ret
 
     # ------------------------------------------------------
     # SQL Constraints