diff --git a/README.rst b/README.rst
index 497909d75a574e0d753d446091f8c5fbfa5d712c..3ff58516a9dc34bd3463c807cf304f55bd08e199 100755
--- a/README.rst
+++ b/README.rst
@@ -11,6 +11,7 @@ Fumaison Occ - Vente
 - Ajout de champs venant de *fumoc_partner* sur *sale_order*
 - Ajout de la note de facturation et de la DLC des lots dans les factures pdf
 - Ajout de la DLC dans la vue détaillée des opérations sur le bon de livraison
+- Calcul la DLC des lots en fonction du numéro de lot
 
 Description
 ===========
diff --git a/__manifest__.py b/__manifest__.py
index 149488147c97557d0932ac64fc173855713e9d7f..55503856593281476731400f611be984791942c5 100755
--- a/__manifest__.py
+++ b/__manifest__.py
@@ -17,6 +17,7 @@
         # views
         'views/fumoc_lot_prefix_dlc.xml',
         'views/product_views.xml',
+        'views/res_config_settings.xml',
         'views/sale_order.xml',
         'views/stock_move_line.xml',
         'views/stock_picking.xml',
diff --git a/models/__init__.py b/models/__init__.py
index 950ea77cc4bb1ae0ae9757489bdd05d29977958c..5f0e12d26fe86835b95af3add3d99643edf0408f 100644
--- a/models/__init__.py
+++ b/models/__init__.py
@@ -4,5 +4,8 @@
 from . import account_move
 from . import fumoc_lot_prefix_dlc
 from . import product
+from . import res_company
+from . import res_config_settings
 from . import sale_order
 from . import stock_picking
+from . import stock_production_lot
diff --git a/models/res_company.py b/models/res_company.py
new file mode 100755
index 0000000000000000000000000000000000000000..dc22b7e622af1c1bbff8b0abd9b19d95c35a72d2
--- /dev/null
+++ b/models/res_company.py
@@ -0,0 +1,20 @@
+# © 2021 Le Filament (<http://www.le-filament.com>)
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
+
+from odoo import fields, models, api
+from odoo.exceptions import ValidationError
+
+
+class FumocCompany(models.Model):
+    _inherit = 'res.company'
+
+    year_reference_lot = fields.Integer(
+        string='Année de référence lot')
+
+    @api.constrains('year_reference_lot')
+    def _check_year_reference_lot(self):
+        for r in self:
+            if not 2050 < r.year_reference_lot < 2000:
+                raise ValidationError(
+                    "L'année de référence renseignée (%s) ne semble pas "
+                    "cohérente" % r.year_reference_lot)
diff --git a/models/res_config_settings.py b/models/res_config_settings.py
new file mode 100755
index 0000000000000000000000000000000000000000..45871f7f442d55e3c8c7ae0a364454f4bc911b7c
--- /dev/null
+++ b/models/res_config_settings.py
@@ -0,0 +1,13 @@
+# © 2021 Le Filament (<http://www.le-filament.com>)
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
+
+from odoo import fields, models
+
+
+class FumocConfigSettings(models.TransientModel):
+    _inherit = 'res.config.settings'
+
+    year_reference_lot = fields.Integer(
+        string='Année de référence lot',
+        related='company_id.year_reference_lot',
+        readonly=False)
diff --git a/models/stock_production_lot.py b/models/stock_production_lot.py
new file mode 100644
index 0000000000000000000000000000000000000000..def2a5de84221be3be7118a118d9accd1588ef0a
--- /dev/null
+++ b/models/stock_production_lot.py
@@ -0,0 +1,65 @@
+# Copyright 2021 Le Filament (<http://www.le-filament.com>)
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
+import datetime
+import re
+
+from odoo import models, api
+from odoo.exceptions import UserError
+
+
+class FumocStockProductionLot(models.Model):
+    _inherit = 'stock.production.lot'
+
+    # ------------------------------------------------------
+    # Business method
+    # ------------------------------------------------------
+    def compute_expiration_date(self):
+        """
+        Check if prefix is known in conf + if suffix is readable
+        -> compute expiration date and other dates if needed
+        """
+        if not self.env.user.company_id.year_reference_lot:
+            raise UserError('L\'année de référence pour les lots n\'a pas été '
+                            'configurée !')
+        prefix = re.findall('([a-zA-Z ]*)\d*.*', self.name)[0]
+        existing_prefix = self.env['fumoc.lot.prefix.dlc'].search([
+            ('prefix', '=', prefix)
+        ])
+        suffix = re.findall('([\d]+)\D*', self.name)[-1]
+        if len(suffix) >= 4:
+            readable_suffix = suffix[-4:]
+        else:
+            readable_suffix = False
+        if existing_prefix and readable_suffix:
+            dlc = existing_prefix.dlc
+            year_ref = self.env.user.company_id.year_reference_lot
+            year_index = int(readable_suffix[:1])
+            year = year_ref + year_index
+            quantieme = int(readable_suffix[1:])
+            production_date = datetime.datetime(year, 1, 1) + \
+                              datetime.timedelta(days=quantieme-1)
+            expiration_date = production_date + datetime.timedelta(days=dlc)
+            time_delta = expiration_date - self.expiration_date
+            vals = self._get_date_values(time_delta)
+            vals['expiration_date'] = expiration_date
+            self.update(vals)
+
+    # ------------------------------------------------------
+    # Onchange
+    # ------------------------------------------------------
+    @api.onchange('name')
+    def _onchange_name(self):
+        if self.create_date:
+            self.compute_expiration_date()
+
+    # ------------------------------------------------------
+    # Override parent
+    # ------------------------------------------------------
+    @api.model_create_multi
+    def create(self, vals_list):
+        """
+        Override create to call compute_expiration_date on created lot
+        """
+        res = super(FumocStockProductionLot, self).create(vals_list)
+        res.compute_expiration_date()
+        return res
diff --git a/views/res_config_settings.xml b/views/res_config_settings.xml
new file mode 100755
index 0000000000000000000000000000000000000000..7f06a29f6dff222d4232f0f726ebff5db0cbc95d
--- /dev/null
+++ b/views/res_config_settings.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<odoo>
+    <data>
+
+        <record id="fumoc_sale_res_config_settings_view_form" model="ir.ui.view">
+            <field name="name">fumoc.sale.res.config.settings.view.form</field>
+            <field name="model">res.config.settings</field>
+            <field name="inherit_id" ref="stock.res_config_settings_view_form"/>
+            <field name="arch" type="xml">
+                <xpath expr="//div[@data-key='stock']" position="inside">
+                    <h2>Numéros de lots</h2>
+                    <div class="row mt16 o_settings_container" name="lot_name">
+                        <div class="col-12 col-lg-6 o_setting_box">
+                            <div class="o_setting_left_pane"/>
+                            <div class="o_setting_right_pane">
+                                <label for="year_reference_lot"/>
+                                <div class="text-muted">
+                                    Année 0. Exemple : le lot FE561103 correspond à l'année 2021 si l'année référence est 2020.
+                                </div>
+                                <div class="content-group">
+                                    <div class="mt16">
+                                        <field name="year_reference_lot" class="oe_inline"/>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                </xpath>
+            </field>
+        </record>
+
+    </data>
+</odoo>
\ No newline at end of file