Commit Graph

246 Commits

Author SHA1 Message Date
niv-openerp a94bbf8e5e [FIX] Merge fix in saas1 for the problem that made the server crash when install a db
bzr revid: nicolas.vanhoren@openerp.com-20130610144915-0nj8vpk7n84ocj3f
bzr revid: nicolas.vanhoren@openerp.com-20130610150657-3xddn91gm0iq0ubp
bzr revid: nicolas.vanhoren@openerp.com-20130610154514-oee6s4f9g17bx63z
2013-06-10 17:45:14 +02:00
Vo Minh Thu 048b365aff [FIX] renamed Partner Catgories to Partner Tags.
bzr revid: vmt@openerp.com-20130604124003-bpga8k6lq4s7qlvp
2013-06-04 14:40:03 +02:00
Vo Minh Thu 6d80cebc3d [MERGE] improved typos.
bzr revid: vmt@openerp.com-20130603134442-zeqchsvtb9bukben
2013-06-03 15:44:42 +02:00
Vo Minh Thu de673a99a9 [MERGE] res.partner: ondelete=restrict on the state and country many2one.
bzr revid: vmt@openerp.com-20130603133555-2oz1bxotnkdh7tu4
2013-06-03 15:35:55 +02:00
Amit Bhavsar (Open ERP) fac4be54cc [MERGE] merge with latest trunk
bzr revid: bde@tinyerp.com-20130522062609-f54wu6sxrx073mmi
bzr revid: amb@tinyerp.com-20130528055348-femt39yydzg5573i
2013-05-28 11:23:48 +05:30
Thibault Delavallée 1d5068b63e [FORWARD] Forward port of server 7.0 until revision 4988
bzr revid: tde@openerp.com-20130528102733-bsszxp6nvy8yws3t
2013-05-28 12:27:33 +02:00
Cedric Snauwaert 3892a9fee4 [REF]res_partner: compact code to get tz info
bzr revid: csn@openerp.com-20130515101027-4nc06nr2u41jh1wr
2013-05-15 12:10:27 +02:00
Cedric Snauwaert 1e03e6df78 [FIX]res_partner: change fields selection of tz so that timezone starting with Etc/ are at the end of the selection, that way it's less confusing for the users.
bzr revid: csn@openerp.com-20130514113100-h2oihowcplaba10j
2013-05-14 13:31:00 +02:00
Dharmraj Zala (OpenERP Trainee) 7542d8885d [FIX] set ondelete restrict on state and country.
bzr revid: nco@tinyerp.com-20130509113615-u2xedxu5ihn9lqh9
2013-05-09 17:06:15 +05:30
ggh-openerp dd7614e716 [IMP] Remove space before Exclamation marks [!] in Warning
bzr revid: ggh@tinyerp.com-20130429072938-knas9ymmny5o2z0v
2013-04-29 12:59:38 +05:30
Olivier Dony ffebb64472 [MERGE] Forward-port of 7.0 fixes up to rev. 4961
rev-id odo@openerp.com-20130425171238-dhgpqbi9nio12vxk

bzr revid: odo@openerp.com-20130424131936-5eb7omkz51arnm81
bzr revid: odo@openerp.com-20130425171444-ycu89d2393f8nnxm
2013-04-25 19:14:44 +02:00
Olivier Dony 20020a7647 [FIX] res.partner: typo would prevent contact from using company address correctly if flag changed without changing/setting company + updated tests to cover this
bzr revid: odo@openerp.com-20130425171238-dhgpqbi9nio12vxk
2013-04-25 19:12:38 +02:00
Olivier Dony 0ee404c054 [FIX] res.partner: always call write() with a list of IDs, a single ID is not valid! (even if it works sometimes)
bzr revid: odo@openerp.com-20130424131625-aeljtyo5yuiyrlcz
2013-04-24 15:16:25 +02:00
Olivier Dony 230a06dd70 [FIX] res.partner: correct store trigger for display_name, forward port of addons 7.0 fix
Corresponding addons 7.0 patch: rev. 9057
revision-id: odo@openerp.com-20130423130656-celrtr352yht19ro

bzr revid: odo@openerp.com-20130424091651-7k7x03c5xhe66zsl
2013-04-24 11:16:51 +02:00
Christophe Simonis 261dea6fec [MERGE] forward port of server v7 up to revision 4954
bzr revid: qdp-launchpad@openerp.com-20130422093655-txqmbalod6qmw1s6
bzr revid: chs@openerp.com-20130423183723-9kiexdyzdew8iuzm
2013-04-23 20:37:23 +02:00
Olivier Dony 9b9c3fa59c [FIX] res.partner.name_get: partners marked as "is_company" should appear as standalone
This is more consistent with the way we expect reporting
to work, and will also ensure that these companies
appear right above their contacts in search order
(which will match name_get)

bzr revid: odo@openerp.com-20130419164728-25312wtyzt9h6egw
2013-04-19 18:47:28 +02:00
Olivier Dony 83feb1c46f [REVERT] res.partner: undo change of ordering in name_search result, to be addressed via a stored display_name field (temporarily added by account_report_company module in 7.0)
bzr revid: odo@openerp.com-20130419164447-wrmfghxi44au3273
2013-04-19 18:44:47 +02:00
Olivier Dony cfb53f1aad [FIX] res.partner: search using 'child_of' should include inactive children
This is necessary for 2 reasons:
- when searching on Business documents the search domain will be
  [('partner_id', 'child_of', 'ACME')] in order to match all
  descendants, and it must match inactive children as well
- in other cases like for resolving IDs to update via store
  triggers, it is necessary that 'child_of' returns inactive
  children too.

The implementation is tricky because the ORM automatically 
transform 'child_of' domains into recursive searches with
[('parent_id', 'in', ids)], which is the same query that the
reverse one2many 'child_ids' will also use to find contacts.
The overridden search() therefore matches this domain pattern
only when there is one criterion (to avoid side-effects in
other cases) and a dummy extra 'domain' was added to the
definition of the 'child_ids' o2m so it won't match.
The net result is that child_ids will not return inactive
children while child_of will return all descendants when
it is the only criterion. This is the expected behavior
whenever child_of is used on res.partner, because
it's safer to always show business documents.
The only side-effects will be for custom/manual search
calls with a single criterion of the form ('parent_id','in', x)
and those can be fixed by adding an extra domain
component ('active','=',True), just like child_ids does.

bzr revid: odo@openerp.com-20130419135756-2kbhwr23lygqdoob
2013-04-19 15:57:56 +02:00
Olivier Dony 3c5559045c [FIX] res.partner: add onchange warning when changing an existing contact's company
bzr revid: odo@openerp.com-20130418153829-rmkd6xo1cajgfer5
2013-04-18 17:38:29 +02:00
Olivier Dony dfbe68e69d [IMP] res.partner: rename commercial_id to commercial_partner_id + make function field inheritable
The name `commercial_partner_id` better reflects its
purpose and the fact that it is a FK to a partner.


An extra indirection through a lambda function was
also added to the definition of the function field
to make it possible to override it in other modules
(otherwise the function is passed by copy directly
and cannot be inherited later)

bzr revid: odo@openerp.com-20130418144533-owupfwn6h83q432x
2013-04-18 16:45:33 +02:00
Olivier Dony d734bf58cc [FIX] res.partner: name_get: return "Company, Contact" rather than "Contact (Company)" to make it clearer that the company is selected as well
bzr revid: odo@openerp.com-20130416093121-t5soophs2aui8rzq
2013-04-16 11:31:21 +02:00
Olivier Dony f985391ba0 [MERGE] Sync with 7.0
bzr revid: odo@openerp.com-20130415181836-cmq936wu0w7alwky
2013-04-15 20:18:36 +02:00
Olivier Dony 8efd16f25a [FIX] res.partner, orm._check_recursion: prevent recursive partner structures + fix false positives in check_recursion()
- res.partner must prevent creating loops in partner
hierarchies, and this can be done easily with an
extra _constraint using the ORM's builtin _check_recursion

- _check_recursion's implementation incorrectly
assumed that the provided 'ids' were unrelated
(not part of a common hierarchy).

- add tests for _check_recursion via extra
tests on res.partner structure
(explains why both patches are in the same
commit)

bzr revid: odo@openerp.com-20130415171732-aj3j2e2mycvzf4kp
2013-04-15 19:17:32 +02:00
Olivier Dony c5e4faa7dc [FIX] res.partner: make the computed display_address use all address fields, including extra/custom ones
lp bug: https://launchpad.net/bugs/1122363 fixed

bzr revid: odo@openerp.com-20130411191110-5q7vd77m0e78dg8u
2013-04-11 21:11:10 +02:00
Olivier Dony e78ed60a5a [FIX] res.partner: make _address_fields method conform to its documented return type (detected by Nhomar Hernandez)
This will make overriddes more straightforward.

bzr revid: odo@openerp.com-20130411190050-8vhx9laialsyrm3r
2013-04-11 21:00:50 +02:00
Olivier Dony 8468af8606 [FIX] res.partner.name_search: make sure companies always come before contacts when both match
bzr revid: odo@openerp.com-20130410152309-u4dn8bxssvcwdc8c
2013-04-10 17:23:09 +02:00
Olivier Dony 9bec1595bd [FIX] res.partner address sync: `type` field should not be synced wih other address fields
It is valid to use the parent address but still set a different
type of address - the name, email, phone, etc. could be different.

bzr revid: odo@openerp.com-20130410123229-9l60sbcks3tpmy7x
2013-04-10 14:32:29 +02:00
Olivier Dony 9dbe29b2b5 [FIX] res.partner.address_get: default to partner being looked up rather than company when no match is found at all (and no "default" exists)
Using the commercial entity is not a very good default choice
in many cases. If a new contact is created on-the-fly for a
new document (e.g. sales order), his/her company may be an
empty shell and/or a large corporation that should not be
directly used for e.g. billing/invoicing purposed.
Once a contact/company is set to "invoicing" or "delivery"
we use it, but in other cases we stick to the provided
partner/contact as a saner default.
This should not change anything for cases where advanced
contact management is used and proper address types are
set.

bzr revid: odo@openerp.com-20130410121536-vm93o6vxhi3b8feu
2013-04-10 14:15:36 +02:00
Olivier Dony 2bf1034cd2 [FIX] res.partner: autosync of commercial fields and address fields + correct views accordingly + basic tests
* Commercial fields (bug 1160365)

Fix autosync of accounting/invoicing-related fields on contacts,
just as if they were actually modeled as fields.related to the
parent commercial entity.
This starts with the addition of the new functional field
`commercial_id`, to locate the commercial entity for any partner.
The commercial entity is defined as the first ancestor (starting
at the partner itself) that is either marked `is_company` or has
no parent. [This is Part A of the solution on bug 1160365].

Then, whenever a partner is created or modified:
- if it is a commercial entity, the commercial fields are synced
downstream to all its descendants, stopping at company boundaries.
- if is is not a commercial entity, the commercial fields are
synced from its parent commercial entity.
The list of fields to sync is determined by calling the new
res.partner method `_commercial_fields()` which can be easily
extended by any module that adds commercial fields on res.partner.
A utility method `open_commercial_entity()` was added to
res.partner to make it easy to include a button for editing the
parent commercial entity, to be displayed instead of now-hidden
commercial fields.
[This is part B of the solution on bug 1160365]

The res.partner.address_get() method (used to find child partners
of certain types, e.g. "invoice") was udpated to take the new
"commercial entity" notion into account: it will now look for
matches in children but also parents and siblings that are part
of the same "commercial entity". The default partner `type` is
now "contact" to reflect the new model ; "default" is
inappropriate because it is a wildcard and would stop the type
lookup early.
[This composes parts C and D of the solution on bug 1160365]

Note: This fix comes with a matching addons fix to implement
module-specific extensions of part B, as well as part E of the
solution.


* Address fields (bug 1160425)

Corrected autosync of address fields is also included in the
same branch, because those two mechanisms are closely related
and share some parts of the implementation.

The `use_parent_address` field now defaults to False (except
in the mini-kanban view of contacts on a partner form), and
the autosync of address fields has been modified to only work
downstream and never update a parent company if a child contact
is modified. Instead, the address fields are now displayed
readonly on contacts that use the parent address, with a button
to edit the parent address (new method open_parent(), similar
to open_commercial_entity() but opening the direct parent).

To make the initial creation of a contact + company pair,
a special case was added: when a new contact is created for
a company that has no other contact and no address, the
address of the contact is assumed to be that of the company
so it is moved to the company, then the `use_parent_address`
flag is enabled on the contact, and the `is_company` flag on
the company. This covers a use case where contact and
company are created on-the-fly when creating a new document.

Many logical flaws in the autosync of address fields have been
corrected and are now covered by unit tests.


* Misc related fixes

- checking `is_company` does not reset the parent_id field
anymore, to allow for multi-level structures. The field is
still hidden automatically because having an empty "Company"
field on the form view of a company is quite suprising), but
this UI behavior is easily customized;
- the `email`, `phone`, `fax`, `mobile`, `lang`, etc. that
were sometimes synced when changing parent company are now
properly left alone;
- the `use_parent_address` field is now always visible next
to the parent_id field when a parent is set

lp bug: https://launchpad.net/bugs/1160425 fixed
lp bug: https://launchpad.net/bugs/1160365 fixed

bzr revid: odo@openerp.com-20130408013742-tm8w0w0nmunanokk
2013-04-08 03:37:42 +02:00
Vo Minh Thu 307ca374d6 [MERGE] forward merge 7.0 until revision 4919.
bzr revid: vmt@openerp.com-20130404130704-24vsmczw34cssytd
2013-04-04 15:07:04 +02:00
Xavier ALT 43cc95ce2b [FIX] partner: fix update for company address
* when writing an empty value to ADDRESS_FIELDS, that value
    should also be propagated by update_address()

  * when creating a contact from a company form view, even with
    'use_company_address', company's contact address remains empty. We
    now force adding missing address fields uppon creation when default
    'use_company_address' is True.

bzr revid: xal@openerp.com-20130329112317-6lat4jx5x2yh18t6
2013-03-29 12:23:17 +01:00
Vo Minh Thu 1e7e2ca753 [REF] no longer use openerp.pooler.
Either use openerp.modules.registry.RegistryManager when the full
new() signature is needed, or use openerp.registry().

Replaced also some pool.get() with pool[] because KeyErrors
are better than AttributeErrors on None.

bzr revid: vmt@openerp.com-20130327111014-2i0hlvpy5y5ku7hm
2013-03-27 12:10:14 +01:00
Fabien Pinckaers 9b5db9ad9e [IMP] small code cleanup
bzr revid: fp@tinyerp.com-20130326080748-fij148wyb0tirip5
2013-03-26 09:07:48 +01:00
niv-openerp 692cea3039 Removed default image on partners, use default one in the kanban view if false
bzr revid: nicolas.vanhoren@openerp.com-20121221120631-2uugaiexqanwbi00
2012-12-21 13:06:31 +01:00
Thibault Delavallée 910f7097ba [IMP] res_partner: use tools.email_split instead of custom regex when parsing partner_name to find an email.
bzr revid: tde@openerp.com-20130313105640-r53xueaz36zw3fjd
2013-03-13 11:56:40 +01:00
Niels Huylebroeck bc4e3d00ed [FIX] base: allow searching in multicompany environment on res_partner.
bzr revid: nh@agaplan.eu-20130225135753-ryf6y5e0nhxt8zux
2013-02-25 14:57:53 +01:00
Olivier Dony 0cd22d6d4b [IMP] res.partner: name_search nows searches email as well ; name_get now supports `show_email` context
+ various minor fixes to the way operators were
(mis)handled.

bzr revid: odo@openerp.com-20121220181604-61fxnjh35amdywwx
2012-12-20 19:16:04 +01:00
Cecile Tonglet ad8b76de53 [MERGE] From trunk (second time)
bzr revid: cto@openerp.com-20121217144753-1rboqdw01h8yrehj
2012-12-17 15:47:53 +01:00
Cecile Tonglet 5f0070dcb6 [FIX] Remove unused imports and fix some imports that doesn't use the new namespace
bzr revid: cto@openerp.com-20121217143029-e9ki4ftwihq7pdme
2012-12-17 15:30:29 +01:00
Cecile Tonglet 5179507e22 [MERGE] Branch updated with trunk
bzr revid: cto@openerp.com-20121217125902-idtlh4ztyah17bdn
2012-12-17 13:59:02 +01:00
Raphael Collet 3040114651 [MERGE] trunk-style-improvements-xmo (Python stylistic improvement)
bzr revid: rco@openerp.com-20121217110150-4ijt04ic17miktq7
2012-12-17 12:01:50 +01:00
Xavier Morel c6079dd6bb [REM] unnecessary parens
bzr revid: xmo@openerp.com-20121214123803-6xu2s1ndnoyj4i3e
2012-12-14 13:38:03 +01:00
Christophe Simonis 74b431298e [FIX] remove res.partner.address model
bzr revid: chs@openerp.com-20121211182934-up3sxi0pcw20qrit
2012-12-11 19:29:34 +01:00
Vo Minh Thu 509a084e79 [IMP] use the openerp namespace.
bzr revid: vmt@openerp.com-20121210152723-mv4dykfu6ip1991h
2012-12-10 16:27:23 +01:00
Fabien Meghazi dec5b8e761 [REM] Removed tz_offset from context and remove store=True
bzr revid: fme@openerp.com-20121129210033-p687bul10jiandxt
2012-11-29 22:00:33 +01:00
Antony Lesuisse 299d98ac6e [MERGE] res.users get_context add timezone offset
bzr revid: al@openerp.com-20121128155922-ff67gskivujvx2qa
2012-11-28 16:59:22 +01:00
Fabien Pinckaers 76680074cb [IMP] removed unused code
bzr revid: fp@tinyerp.com-20121126190356-1mfgmx5r6ls6md22
2012-11-26 20:03:56 +01:00
Fabien Meghazi ee8894d509 [ADD] Add tz_offset function field in res.partner and set it in user's context
bzr revid: fme@openerp.com-20121122151458-hvtrwogldt69djss
2012-11-22 16:14:58 +01:00
Olivier Dony 4ba1696ce2 [FIX] res.partner: read image files in binary mode
lp bug: https://launchpad.net/bugs/1048040 fixed

bzr revid: odo@openerp.com-20121106181502-tzqmrhs0u8odngvz
2012-11-06 19:15:02 +01:00
Fabien Pinckaers 01cd1742cc [FIX]
bzr revid: fp@openerp.com-20121102162805-tp46s4x40dwedkij
2012-11-02 17:28:05 +01:00