changeset 03e1b2950de9 in modules/project_invoice:default
details: 
https://hg.tryton.org/modules/project_invoice?cmd=changeset;node=03e1b2950de9
description:
        Do not give timesheet line access to project invoice group

        We should avoid giving too much right by default.

        issue8822
        review272441002
diffstat:

 timesheet.xml |  12 ------------
 work.py       |  12 +++++++-----
 2 files changed, 7 insertions(+), 17 deletions(-)

diffs (44 lines):

diff -r 6b9805eadf7b -r 03e1b2950de9 timesheet.xml
--- a/timesheet.xml     Wed Dec 04 11:09:36 2019 +0100
+++ b/timesheet.xml     Sat Dec 07 15:07:58 2019 +0100
@@ -3,18 +3,6 @@
 this repository contains the full copyright notices and license terms. -->
 <tryton>
     <data>
-        <record model="ir.rule.group" id="rule_group_line_project_invoice">
-            <field name="name">Any timesheet line</field>
-            <field name="model" search="[('model', '=', 'timesheet.line')]"/>
-            <field name="global_p" eval="False"/>
-            <field name="default_p" eval="False"/>
-        </record>
-        <record model="ir.rule.group-res.group"
-            id="rule_group_line_project_invoice_group_project_invoice">
-            <field name="rule_group" ref="rule_group_line_project_invoice"/>
-            <field name="group" ref="group_project_invoice"/>
-        </record>
-
         <record model="ir.action.act_window" 
id="act_timesheet_line_form_invoice">
             <field name="name">Timesheet Lines</field>
             <field name="res_model">timesheet.line</field>
diff -r 6b9805eadf7b -r 03e1b2950de9 work.py
--- a/work.py   Wed Dec 04 11:09:36 2019 +0100
+++ b/work.py   Sat Dec 07 15:07:58 2019 +0100
@@ -383,11 +383,13 @@
                 for line in lines:
                     origin = line['origin']
                     origins.setdefault(origin.__class__, []).append(origin)
-                for klass, records in origins.items():
-                    klass.save(records)  # Store first new origins
-                    klass.write(records, {
-                            'invoice_line': invoice_line.id,
-                            })
+                # TODO: remove when _check_access ignores record rule
+                with Transaction().set_user(0):
+                    for klass, records in origins.items():
+                        klass.save(records)  # Store first new origins
+                        klass.write(records, {
+                                'invoice_line': invoice_line.id,
+                                })
         Invoice.update_taxes(invoices)
 
     def _get_invoice(self):

Reply via email to