-
Notifications
You must be signed in to change notification settings - Fork 28
/
account_invoice.py
30 lines (27 loc) · 1.13 KB
/
account_invoice.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
from openerp import models, api
from ast import literal_eval
class AccountInvoice(models.Model):
_inherit = 'account.invoice'
@api.multi
def add_purchase_line_moves(self):
self.ensure_one()
actions = self.env.ref(
'purchase_usability.action_purchase_line_tree')
if actions:
action_read = actions.read()[0]
context = literal_eval(action_read['context'])
context['force_line_edit'] = True
context['search_default_to_invoice'] = True
context['search_default_invoice_qty'] = True
action_read['context'] = context
action_read['domain'] = [
('partner_id.commercial_partner_id', '=',
self.partner_id.commercial_partner_id.id),
('company_id', '=', self.company_id.id),
]
return action_read