Merge lp:~vauxoo/openobject-server/customization_address_field-dev-julio into lp:openobject-server

Proposed by Julio Serna-http://www.vauxoo.com
Status: Rejected
Rejected by: Vo Minh Thu
Proposed branch: lp:~vauxoo/openobject-server/customization_address_field-dev-julio
Merge into: lp:openobject-server
Diff against target: 61 lines (+16/-7)
1 file modified
openerp/addons/base/res/res_partner.py (+16/-7)
To merge this branch: bzr merge lp:~vauxoo/openobject-server/customization_address_field-dev-julio
Reviewer Review Type Date Requested Status
OpenERP R&D Team Pending
Moisés López - http://www.vauxoo.com Pending
Review via email: mp+148026@code.launchpad.net

Description of the change

add new function to customize by code the fields receives the function _display_address()

To post a comment you must log in.
4787. By Raphael Collet (OpenERP)

[MERGE] trunk-methflow-thu: add model methods to create/delete/interact with the worflow instances of records

4788. By Raphael Collet (OpenERP)

[IMP] openerp.osv.orm: add optional context in method that handles workflow signal

4789. By Vo Minh Thu

[DOC] Updated changelog.

4790. By Raphael Collet (OpenERP)

[MERGE] trunk-methflow-thu (refactor existing workflow methods in models)

4791. By Raphael Collet (OpenERP)

[IMP] doc: add missing documentation on new methods

4792. By Raphael Collet (OpenERP)

[FIX] openerp/service/report: missing import

4793. By Raphael Collet (OpenERP)

[FIX] openerp/service/report: add all missing imports!

4794. By Quentin (OpenERP) <email address hidden>

[MERGE] merged the branch with the RedirectWarnings

4795. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

4796. By Vo Minh Thu

[MERGE] merged long-polling branch:

When using --workers, an evented (for longpolling) worker is started.
When passing --gevent, all the server is evented but the cron is disabled.

4797. By Vo Minh Thu

[FIX] openerp namespace: the import hook was still inserting modules in sys.moduls at their shortname.

4798. By Vo Minh Thu

[DOC] Added section `Process model` to talk a bit about the recently merged longpolling feature.

4799. By Vo Minh Thu

[FIX] cron: push the registry signaling checks in the try/except of the job itself.

4800. By Vo Minh Thu

[FIX] oe drop: correctly call netsvc.init_logger(), and use pid instead of procpid under postgres 9.2.

4801. By Anto

[IMP] exceptions tests: use another xml_menu_id that leads directly to the tests wizard.
also use an int instead of a tuple in the exception's constructor

4802. By Olivier Dony (Odoo)

[MERGE] search: when count=True, execute main query as a subquery to avoid side effects with offset and limit

Granted, calling search() with both count=True and
offset or limit is not extremely useful, but
it is still better to accept it and apply it
to the inner query rather than have silly
errors

4803. By Anto

[MERGE] res_config: improve documentation

4804. By Fabien (Open ERP)

[FIX] write country if code is null

4805. By Fabien (Open ERP)

[iMP] error message simplified for required values

4806. By Vo Minh Thu

[FIX] Previous `[iMP]` was broken.

4807. By Vo Minh Thu

[MERGE] netrpc: support for netrpc was already removed, but command line flags and docs were not updated.

4808. By Vo Minh Thu

[MERGE] netsvc/service.model: added missing/removed unnecessary `except` clauses.

4809. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

4810. By Vo Minh Thu

[MERGE] safe_eval: do not log reported exception, instead re-raise them with a complete stacktrace and the evaluated expression.

4811. By Vo Minh Thu

[MERGE] Better exception handling in tools.convert:

- The exception is not logged in tools.convert. It is loggeg by the netsv layer anyway.
- The exception is re-raised instead, but with the full traceback available.
- A fix in openerp.service.db where the cr is closed twice.

4812. By Olivier Dony (Odoo)

[MERGE] res.config: fix incorrect assertion syntax in tests

4813. By Nicolas Vanhoren (OpenERP)

[FIX] typo that caused crash in cron only when launching server with --workers

4814. By Julio Serna-http://www.vauxoo.com

[REF] Refactory in constant fields to function get_fields

Revision history for this message
Vo Minh Thu (thu) wrote :

Olivier lets me know that equivalent changes have been made in 7.0 (and will be forward ported to trunk later). Thanks though.

Unmerged revisions

4814. By Julio Serna-http://www.vauxoo.com

[REF] Refactory in constant fields to function get_fields

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'openerp/addons/base/res/res_partner.py'
2--- openerp/addons/base/res/res_partner.py 2013-01-14 17:43:55 +0000
3+++ openerp/addons/base/res/res_partner.py 2013-02-26 18:34:20 +0000
4@@ -159,9 +159,6 @@
5 res = lang_pool.read(cr, uid, ids, ['code', 'name'], context)
6 return [(r['code'], r['name']) for r in res]
7
8-POSTAL_ADDRESS_FIELDS = ('street', 'street2', 'zip', 'city', 'state_id', 'country_id')
9-ADDRESS_FIELDS = POSTAL_ADDRESS_FIELDS + ('email', 'phone', 'fax', 'mobile', 'website', 'ref', 'lang')
10-
11 class res_partner(osv.osv, format_address):
12 _description = 'Partner'
13 _name = "res.partner"
14@@ -331,7 +328,7 @@
15
16 if use_parent_address and parent_id:
17 parent = self.browse(cr, uid, parent_id, context=context)
18- return {'value': dict((key, value_or_id(parent[key])) for key in ADDRESS_FIELDS)}
19+ return {'value': dict((key, value_or_id(parent[key])) for key in self._get_address_field())}
20 return {}
21
22 def onchange_state(self, cr, uid, ids, state_id, context=None):
23@@ -390,7 +387,7 @@
24 return super(res_partner,self).create(cr, uid, vals, context=context)
25
26 def update_address(self, cr, uid, ids, vals, context=None):
27- addr_vals = dict((key, vals[key]) for key in POSTAL_ADDRESS_FIELDS if vals.get(key))
28+ addr_vals = dict((key, vals[key]) for key in self._get_postal_address_field() if vals.get(key))
29 if addr_vals:
30 return super(res_partner, self).write(cr, uid, ids, addr_vals, context)
31
32@@ -540,6 +537,19 @@
33 ('name','=','main_partner')])[0],
34 ).res_id
35
36+ def _get_address_field(self):
37+ address_fields = self._get_postal_address_field() + ('email', 'phone', 'fax', 'mobile', 'website', 'ref', 'lang')
38+ return address_fields
39+
40+ def _get_display_address_field(self):
41+ address_display_field = ['title', 'street', 'street2', 'zip', 'city']
42+ return address_display_field
43+
44+ def _get_postal_address_field(self):
45+ postal_address_fields = ('street', 'street2', 'zip', 'city', 'state_id', 'country_id')
46+ return postal_address_fields
47+
48+
49 def _display_address(self, cr, uid, address, without_company=False, context=None):
50
51 '''
52@@ -563,8 +573,7 @@
53 'country_name': address.country_id and address.country_id.name or '',
54 'company_name': address.parent_id and address.parent_id.name or '',
55 }
56- address_field = ['title', 'street', 'street2', 'zip', 'city']
57- for field in address_field :
58+ for field in self._get_display_address_field():
59 args[field] = getattr(address, field) or ''
60 if without_company:
61 args['company_name'] = ''