changeset 990c9d26af44 in modules/timesheet:default
details: https://hg.tryton.org/modules/timesheet?cmd=changeset&node=990c9d26af44
description:
        Remove active from timesheet work as it is not needed

        issue7223
        review287851002
diffstat:

 CHANGELOG          |   3 +++
 view/work_form.xml |   3 ---
 work.py            |  11 +++--------
 work.xml           |  15 +++++++++++++++
 4 files changed, 21 insertions(+), 11 deletions(-)

diffs (85 lines):

diff -r 6eea2f724ab2 -r 990c9d26af44 CHANGELOG
--- a/CHANGELOG Sat Apr 10 23:46:24 2021 +0200
+++ b/CHANGELOG Mon Apr 12 10:58:52 2021 +0200
@@ -1,3 +1,6 @@
+* Use window domain to show "open" and "closed" timesheet works
+* Remove active from timesheet work
+
 Version 5.8.0 - 2020-11-02
 * Bug fixes (see mercurial logs for details)
 * Remove support for Python 3.5
diff -r 6eea2f724ab2 -r 990c9d26af44 view/work_form.xml
--- a/view/work_form.xml        Sat Apr 10 23:46:24 2021 +0200
+++ b/view/work_form.xml        Mon Apr 12 10:58:52 2021 +0200
@@ -10,11 +10,8 @@
         <field name="name"/>
         <field name="origin"/>
     </group>
-    <label name="active"/>
-    <field name="active"/>
     <label name="company"/>
     <field name="company"/>
-    <newline/>
     <label name="timesheet_start_date"/>
     <field name="timesheet_start_date"/>
     <label name="timesheet_end_date"/>
diff -r 6eea2f724ab2 -r 990c9d26af44 work.py
--- a/work.py   Sat Apr 10 23:46:24 2021 +0200
+++ b/work.py   Mon Apr 12 10:58:52 2021 +0200
@@ -7,9 +7,8 @@
 from sql.aggregate import Sum
 
 from trytond.i18n import gettext
-from trytond.model import (
-    ModelView, ModelSQL, ModelStorage, DeactivableMixin, fields, Unique)
-from trytond.pyson import Not, Bool, Eval, If
+from trytond.model import ModelView, ModelSQL, ModelStorage, fields, Unique
+from trytond.pyson import Bool, Eval, If
 from trytond.transaction import Transaction
 from trytond.pool import Pool
 from trytond.tools import reduce_ids, grouped_slice
@@ -17,7 +16,7 @@
 from .exceptions import CompanyValidationError
 
 
-class Work(DeactivableMixin, ModelSQL, ModelView):
+class Work(ModelSQL, ModelView):
     'Work'
     __name__ = 'timesheet.work'
     name = fields.Char('Name',
@@ -57,10 +56,6 @@
         select=True, help="Make the work belong to the company.")
     timesheet_lines = fields.One2Many('timesheet.line', 'work',
         'Timesheet Lines',
-        depends=['active'],
-        states={
-            'readonly': Not(Bool(Eval('active'))),
-            },
         help="Spend time on this work.")
     # Self referring field to use for aggregation in graph view
     work = fields.Function(fields.Many2One('timesheet.work', 'Work'),
diff -r 6eea2f724ab2 -r 990c9d26af44 work.xml
--- a/work.xml  Sat Apr 10 23:46:24 2021 +0200
+++ b/work.xml  Mon Apr 12 10:58:52 2021 +0200
@@ -42,6 +42,21 @@
             <field name="view" ref="work_view_form"/>
             <field name="act_window" ref="act_work_list"/>
         </record>
+        <record model="ir.action.act_window.domain" 
id="act_work_list_domain_open">
+            <field name="name">Open</field>
+            <field name="sequence" eval="10"/>
+            <field name="domain"
+                eval="['OR', ('timesheet_end_date', '=', None), 
('timesheet_end_date', '&gt;', Date())]"
+                pyson="1"/>
+            <field name="count" eval="True"/>
+            <field name="act_window" ref="act_work_list"/>
+        </record>
+        <record model="ir.action.act_window.domain" 
id="act_work_list_domain_all">
+            <field name="name">All</field>
+            <field name="sequence" eval="9999"/>
+            <field name="domain"></field>
+            <field name="act_window" ref="act_work_list"/>
+        </record>
         <menuitem
             parent="menu_configuration"
             action="act_work_list"

Reply via email to