changeset 6f353b1c9990 in modules/production:default
details: 
https://hg.tryton.org/modules/production?cmd=changeset;node=6f353b1c9990
description:
        Add sale_supply_production module

        issue3257
        review256721002
diffstat:

 CHANGELOG                |   1 +
 production.py            |  20 ++++++++++++++++++++
 view/product_form.xml    |  12 +++---------
 view/production_form.xml |   3 ++-
 view/template_form.xml   |   6 ++++++
 5 files changed, 32 insertions(+), 10 deletions(-)

diffs (93 lines):

diff -r 3c79c7694822 -r 6f353b1c9990 CHANGELOG
--- a/CHANGELOG Sun Apr 12 09:00:29 2020 +0200
+++ b/CHANGELOG Mon Apr 13 14:49:07 2020 +0200
@@ -1,3 +1,4 @@
+* Add origin to production
 * Delete cancelled moves when a production is reset to draft
 * Add employee on productions for some states
 * Convert set_moves into dualmethod
diff -r 3c79c7694822 -r 6f353b1c9990 production.py
--- a/production.py     Sun Apr 12 09:00:29 2020 +0200
+++ b/production.py     Mon Apr 13 14:49:07 2020 +0200
@@ -151,6 +151,12 @@
             ('done', 'Done'),
             ('cancel', 'Canceled'),
             ], 'State', readonly=True)
+    origin = fields.Reference(
+        "Origin", selection='get_origin', select=True,
+        states={
+            'readonly': ~Eval('state').in_(['request', 'draft']),
+            },
+        depends=['state'])
 
     @classmethod
     def __setup__(cls):
@@ -293,6 +299,20 @@
                         return self.planned_date
         return self.planned_date
 
+    @classmethod
+    def _get_origin(cls):
+        'Return list of Model names for origin Reference'
+        return set()
+
+    @classmethod
+    def get_origin(cls):
+        Model = Pool().get('ir.model')
+        models = cls._get_origin()
+        models = Model.search([
+                ('model', 'in', models),
+                ])
+        return [(None, '')] + [(m.model, m.name) for m in models]
+
     def _move(self, from_location, to_location, company, product, uom,
             quantity):
         Move = Pool().get('stock.move')
diff -r 3c79c7694822 -r 6f353b1c9990 view/product_form.xml
--- a/view/product_form.xml     Sun Apr 12 09:00:29 2020 +0200
+++ b/view/product_form.xml     Mon Apr 13 14:49:07 2020 +0200
@@ -2,14 +2,8 @@
 <!-- This file is part of Tryton.  The COPYRIGHT file at the top level of
 this repository contains the full copyright notices and license terms. -->
 <data>
-    <xpath expr="/form/notebook" position="inside">
-        <page string="Production" id="production">
-            <label name="producible"/>
-            <field name="producible"/>
-            <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"/>
-        </page>
+    <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"/>
     </xpath>
 </data>
diff -r 3c79c7694822 -r 6f353b1c9990 view/production_form.xml
--- a/view/production_form.xml  Sun Apr 12 09:00:29 2020 +0200
+++ b/view/production_form.xml  Mon Apr 13 14:49:07 2020 +0200
@@ -26,7 +26,8 @@
         <page string="Other Info" id="other">
             <label name="company"/>
             <field name="company"/>
-            <newline/>
+            <label name="origin"/>
+            <field name="origin"/>
             <label name="warehouse"/>
             <field name="warehouse"/>
             <label name="location"/>
diff -r 3c79c7694822 -r 6f353b1c9990 view/template_form.xml
--- a/view/template_form.xml    Sun Apr 12 09:00:29 2020 +0200
+++ b/view/template_form.xml    Mon Apr 13 14:49:07 2020 +0200
@@ -7,4 +7,10 @@
         <label name="producible"/>
         <field name="producible" xexpand="0" width="25"/>
     </xpath>
+    <xpath expr="/form/notebook" position="inside">
+        <page string="Production" id="production">
+            <label name="producible"/>
+            <field name="producible"/>
+        </page>
+    </xpath>
 </data>

Reply via email to