Reviewers: ,
Please review this at http://codereview.tryton.org/612004/
Affected files:
M account.xml
M invoice.py
Index: account.xml
===================================================================
--- a/account.xml
+++ b/account.xml
@@ -13,5 +13,23 @@
<field name="kind">other</field>
</record>
+ <!-- Read access to compute anglo saxon account.move lines -->
+ <record model="ir.model.access" id="access_purchase_line_account">
+ <field name="model"
search="[('model', '=', 'purchase.line')]"/>
+ <field name="group" ref="account.group_account"/>
+ <field name="perm_read" eval="True"/>
+ <field name="perm_write" eval="False"/>
+ <field name="perm_create" eval="False"/>
+ <field name="perm_delete" eval="False"/>
+ </record>
+ <record model="ir.model.access" id="access_sale_line_account">
+ <field name="model" search="[('model', '=', 'sale.line')]"/>
+ <field name="group" ref="account.group_account"/>
+ <field name="perm_read" eval="True"/>
+ <field name="perm_write" eval="False"/>
+ <field name="perm_create" eval="False"/>
+ <field name="perm_delete" eval="False"/>
+ </record>
+
</data>
</tryton>
Index: invoice.py
===================================================================
--- a/invoice.py
+++ b/invoice.py
@@ -62,15 +62,11 @@
moves = []
# other types will get current cost price
if self.invoice.type == 'in_invoice':
- with Transaction().set_user(0, set_context=True):
- purchase_lines = self.__class__(self.id).purchase_lines
- moves = [move for purchase_line in purchase_lines
+ moves = [move for purchase_line in self.purchase_lines
for move in purchase_line.moves
if move.state == 'done']
elif self.invoice.type == 'out_invoice':
- with Transaction().set_user(0, set_context=True):
- sale_lines = self.__class__(self.id).sale_lines
- moves = [move for sale_line in sale_lines
+ moves = [move for sale_line in self.sale_lines
for move in sale_line.moves
if move.state == 'done']
if self.invoice.type == 'in_invoice':
--
--
[email protected] mailing list