Merge lp:~julie-w/unifield-server/US-5935 into lp:unifield-server

Proposed by jftempo
Status: Merged
Merged at revision: 5442
Proposed branch: lp:~julie-w/unifield-server/US-5935
Merge into: lp:unifield-server
Diff against target: 42 lines (+11/-4)
1 file modified
bin/addons/financing_contract/contract.py (+11/-4)
To merge this branch: bzr merge lp:~julie-w/unifield-server/US-5935
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+370819@code.launchpad.net
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/addons/financing_contract/contract.py'
2--- bin/addons/financing_contract/contract.py 2019-03-28 13:22:15 +0000
3+++ bin/addons/financing_contract/contract.py 2019-07-31 12:05:27 +0000
4@@ -22,6 +22,10 @@
5 from osv import fields, osv
6 from tools.translate import _
7
8+CONTRACT_CODE_LENGTH = 24
9+CONTRACT_NAME_LENGTH = 64
10+
11+
12 class financing_contract_funding_pool_line(osv.osv):
13 _name = "financing.contract.funding.pool.line"
14 _description = "Funding pool line"
15@@ -310,8 +314,8 @@
16 return dict((id, instance_level) for id in ids)
17
18 _columns = {
19- 'name': fields.char('Financing contract name', size=64, required=True),
20- 'code': fields.char('Financing contract code', size=16, required=True),
21+ 'name': fields.char('Financing contract name', size=CONTRACT_NAME_LENGTH, required=True),
22+ 'code': fields.char('Financing contract code', size=CONTRACT_CODE_LENGTH, required=True),
23 'donor_id': fields.many2one('financing.contract.donor', 'Donor', required=True, domain="[('active', '=', True)]"),
24 'donor_grant_reference': fields.char('Donor grant reference', size=64),
25 'hq_grant_reference': fields.char('HQ grant reference', size=64),
26@@ -356,11 +360,14 @@
27
28 def copy(self, cr, uid, id, default=None, context=None, done_list=[], local=False):
29 contract = self.browse(cr, uid, id, context=context)
30+ code = contract['code'] or ''
31+ name = contract['name'] or ''
32 if not default:
33 default = {}
34 default = default.copy()
35- default['code'] = (contract['code'] or '') + '(copy)'
36- default['name'] = (contract['name'] or '') + '(copy)'
37+ suffix = "(copy)"
38+ default['code'] = "%s%s" % (code[:CONTRACT_CODE_LENGTH - len(suffix)], suffix)
39+ default['name'] = "%s%s" % (name[:CONTRACT_NAME_LENGTH - len(suffix)], suffix)
40 # Copy lines manually but remove CCs and FPs
41 default['funding_pool_ids'] = []
42 default['cost_center_ids'] = []

Subscribers

People subscribed via source and target branches