Merge lp:~openerp-dev/openobject-addons/trunk-bug-707359-amp into lp:openobject-addons

Proposed by Amit Parik
Status: Merged
Merged at revision: 7519
Proposed branch: lp:~openerp-dev/openobject-addons/trunk-bug-707359-amp
Merge into: lp:openobject-addons
Diff against target: 63 lines (+7/-5)
2 files modified
analytic/analytic.py (+5/-3)
product/product.py (+2/-2)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/trunk-bug-707359-amp
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+119313@code.launchpad.net

Description of the change

Hello,

Improved the Analytic Account 's copy method. Name will be add a 'copy' after this fix.

Thank you!

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 'analytic/analytic.py'
2--- analytic/analytic.py 2012-09-12 15:14:18 +0000
3+++ analytic/analytic.py 2012-09-21 13:45:31 +0000
4@@ -140,7 +140,7 @@
5 'name': fields.char('Account/Contract Name', size=128, required=True),
6 'complete_name': fields.function(_complete_name_calc, type='char', string='Full Account Name'),
7 'code': fields.char('Reference', size=24, select=True),
8- 'type': fields.selection([('view','Analytic View'), ('normal','Analytic Account'),('contract','Contract or Project'),('template','Template of Project')], 'Type of Account', required=True,
9+ 'type': fields.selection([('view','Analytic View'), ('normal','Analytic Account'),('contract','Contract or Project'),('template','Template of Project')], 'Type of Account', required=True,
10 help="If you select the View Type, it means you won\'t allow to create journal entries using that account.\n"\
11 "The type 'Analytic account' stands for usual accounts that you only want to use in accounting.\n"\
12 "If you select Contract or Project, it offers you the possibility to manage the validity and the invoicing options for this account.\n"\
13@@ -168,7 +168,7 @@
14 'res.company': (_get_analytic_account, ['currency_id'], 10),
15 }, string='Currency', type='many2one', relation='res.currency'),
16 }
17-
18+
19 def on_change_template(self, cr, uid, ids, template_id, context=None):
20 if not template_id:
21 return {}
22@@ -179,7 +179,7 @@
23 res['value']['quantity_max'] = template.quantity_max
24 res['value']['description'] = template.description
25 return res
26-
27+
28 def on_change_partner_id(self, cr, uid, ids,partner_id, name, context={}):
29 res={}
30 if partner_id:
31@@ -222,8 +222,10 @@
32 def copy(self, cr, uid, id, default=None, context=None):
33 if not default:
34 default = {}
35+ analytic = self.browse(cr, uid, id, context=context)
36 default['code'] = False
37 default['line_ids'] = []
38+ default['name'] = analytic['name'] + ' (' + _('copy') + ')'
39 return super(account_analytic_account, self).copy(cr, uid, id, default, context=context)
40
41 def on_change_company(self, cr, uid, id, company_id):
42
43=== modified file 'product/product.py'
44--- product/product.py 2012-09-21 07:49:05 +0000
45+++ product/product.py 2012-09-21 13:45:31 +0000
46@@ -511,7 +511,7 @@
47 for obj in self.browse(cr, uid, ids, context=context):
48 result[obj.id] = tools.image_get_resized_images(obj.image, avoid_resize_medium=True)
49 return result
50-
51+
52 def _set_image(self, cr, uid, id, name, value, args, context=None):
53 return self.write(cr, uid, [id], {'image': tools.image_resize_image_big(value)}, context=context)
54
55@@ -727,7 +727,7 @@
56 context_wo_lang.pop('lang', None)
57 product = self.read(cr, uid, id, ['name'], context=context_wo_lang)
58 default = default.copy()
59- default['name'] = product['name'] + ' (copy)'
60+ default['name'] = product['name'] + ' (' + _('copy') + ')'
61
62 if context.get('variant',False):
63 fields = ['product_tmpl_id', 'active', 'variants', 'default_code',

Subscribers

People subscribed via source and target branches

to all changes: