-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathaccount_payment.py
46 lines (40 loc) · 1.11 KB
/
account_payment.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# -*- coding: utf-8 -*-
from osv import osv
class PaymentLine(osv.osv):
_name = "payment.line"
_inherit = "payment.line"
def onchange_move_line(
self,
cr,
uid,
ids,
move_line_id,
payment_type,
date_prefered,
date_planned,
currency=False,
company_currency=False,
context=None,
):
# Adds account.move.line name to the payment line communication
res = super(PaymentLine, self).onchange_move_line(
cr,
uid,
ids,
move_line_id,
payment_type,
date_prefered,
date_planned,
currency,
company_currency,
context,
)
if move_line_id:
line = self.pool.get("account.move.line").browse(cr, uid, move_line_id)
if line.name != "/":
res["value"]["communication"] = (
str(res["value"]["communication"]) + ". " + str(line.name)
)
res["value"]["account_id"] = line.account_id.id
return res
PaymentLine()