Cédric Krier pushed to branch branch/default at Tryton / Tryton


Commits:
efe04317 by Cédric Krier at 2023-03-13T22:53:44+01:00
Rename product lead times to production lead times

#12133
- - - - -
4955ef6c by Cédric Krier at 2023-03-13T23:00:02+01:00
Add One2Many lead times to product template

The One2Many can be used by the MultiValue field to speed up computation.

Closes #12133
- - - - -


6 changed files:

- modules/production/CHANGELOG
- modules/production/product.py
- modules/production/production.py
- modules/production/tests/test_module.py
- modules/production/view/product_form.xml
- modules/sale/product.py


Changes:

=====================================
modules/production/CHANGELOG
=====================================
@@ -1,3 +1,4 @@
+* Rename product lead times to production lead times
 * Remove support for Python 3.7
 * Add support for Python 3.11
 * Create lot for output product when needed


=====================================
modules/production/product.py
=====================================
@@ -39,7 +39,7 @@
         states={
             'invisible': ~Eval('producible')
             })
-    lead_times = fields.One2Many('production.lead_time',
+    production_lead_times = fields.One2Many('production.lead_time',
         'product', 'Lead Times', order=[('sequence', 'ASC'), ('id', 'ASC')],
         states={
             'invisible': ~Eval('producible'),
@@ -73,7 +73,7 @@
         else:
             default = default.copy()
         default.setdefault('boms', None)
-        default.setdefault('lead_times', None)
+        default.setdefault('production_lead_times', None)
         return super(Product, cls).copy(products, default=default)
 
 


=====================================
modules/production/production.py
=====================================
@@ -322,7 +322,7 @@
             pattern = {}
         if self.product:
             pattern.setdefault('bom', self.bom.id if self.bom else None)
-            for line in self.product.lead_times:
+            for line in self.product.production_lead_times:
                 if line.match(pattern):
                     return line.lead_time or timedelta()
         return timedelta()


=====================================
modules/production/tests/test_module.py
=====================================
@@ -21,7 +21,7 @@
 
         date = datetime.date(2016, 11, 26)
         product = Product()
-        product.lead_times = []
+        product.production_lead_times = []
         production = Production()
         production.planned_date = date
         production.product = product
@@ -29,7 +29,7 @@
         self.assertEqual(production.on_change_with_planned_start_date(), date)
 
         lead_time = LeadTime(bom=None, lead_time=None)
-        product.lead_times = [lead_time]
+        product.production_lead_times = [lead_time]
         self.assertEqual(production.on_change_with_planned_start_date(), date)
 
         lead_time.lead_time = datetime.timedelta(1)


=====================================
modules/production/view/product_form.xml
=====================================
@@ -4,6 +4,6 @@
 <data>
     <xpath expr="//page[@id='production']" position="inside">
         <field name="boms" colspan="4" 
view_ids="production.product-bom_view_list_sequence"/>
-        <field name="lead_times" colspan="4" 
view_ids="production.production_lead_time_view_list_sequence"/>
+        <field name="production_lead_times" colspan="4" 
view_ids="production.production_lead_time_view_list_sequence"/>
     </xpath>
 </data>


=====================================
modules/sale/product.py
=====================================
@@ -58,6 +58,8 @@
             help="The time from confirming the sales order to sending the "
             "products.\n"
             "If empty the default lead time from the configuration is used."))
+    lead_times = fields.One2Many(
+        'product.lead_time', 'template', "Lead Times")
 
     @classmethod
     def __register__(cls, module_name):



View it on Heptapod: 
https://foss.heptapod.net/tryton/tryton/-/compare/ac845d4d67364a54692d528466826151fab41723...4955ef6c70ea197115598efc4d95c8dcd232c1a1

-- 
View it on Heptapod: 
https://foss.heptapod.net/tryton/tryton/-/compare/ac845d4d67364a54692d528466826151fab41723...4955ef6c70ea197115598efc4d95c8dcd232c1a1
You're receiving this email because of your account on foss.heptapod.net.


Reply via email to