Merge lp:~openerp-dev/openobject-addons/7.0-fix-contact-company-handling into lp:openobject-addons/7.0

Proposed by Olivier Dony (Odoo) on 2013-04-08
Status: Merged
Merged at revision: 9043
Proposed branch: lp:~openerp-dev/openobject-addons/7.0-fix-contact-company-handling
Merge into: lp:openobject-addons/7.0
Diff against target: 1086 lines (+408/-62)
48 files modified
account/account_invoice.py (+7/-7)
account/account_invoice_view.xml (+4/-3)
account/partner.py (+5/-0)
account/partner_view.xml (+6/-1)
account/project/project_view.xml (+1/-1)
account_analytic_analysis/account_analytic_analysis_view.xml (+1/-1)
account_asset/account_asset_view.xml (+1/-1)
account_asset/report/account_asset_report_view.xml (+1/-1)
account_report_company/__init__.py (+25/-0)
account_report_company/__openerp__.py (+57/-0)
account_report_company/account_invoice_view.xml (+24/-0)
account_report_company/account_report_company.py (+51/-0)
account_report_company/report/__init__.py (+24/-0)
account_report_company/report/account_invoice_report.py (+36/-0)
account_report_company/report/account_invoice_report_view.xml (+24/-0)
account_report_company/res_partner_view.xml (+24/-0)
account_voucher/account_voucher_view.xml (+1/-1)
account_voucher/voucher_payment_receipt_view.xml (+2/-2)
account_voucher/voucher_sales_purchase_view.xml (+2/-2)
base_vat/base_vat.py (+3/-0)
crm/crm_lead_view.xml (+2/-2)
crm/crm_phonecall_view.xml (+1/-1)
crm/report/crm_lead_report_view.xml (+1/-1)
crm/report/crm_phonecall_report_view.xml (+1/-1)
crm_claim/crm_claim_view.xml (+1/-1)
crm_claim/report/crm_claim_report_view.xml (+1/-1)
crm_helpdesk/crm_helpdesk_view.xml (+1/-1)
crm_helpdesk/report/crm_helpdesk_report_view.xml (+1/-0)
l10n_be_invoice_bba/partner.py (+5/-0)
l10n_ro/res_partner.py (+25/-2)
mrp_repair/mrp_repair_view.xml (+1/-1)
product/partner.py (+3/-0)
product/partner_view.xml (+4/-1)
project/project_view.xml (+1/-1)
project/report/project_report_view.xml (+1/-1)
project_issue/project_issue_view.xml (+2/-1)
project_issue/report/project_issue_report_view.xml (+1/-1)
purchase/partner.py (+3/-0)
purchase/purchase_view.xml (+3/-3)
sale/res_partner_view.xml (+28/-8)
sale/sale.py (+0/-4)
sale/sale_view.xml (+4/-4)
sale_journal/sale_journal.py (+4/-0)
sale_journal/sale_journal_view.xml (+1/-1)
sale_stock/stock.py (+1/-1)
sale_stock/test/picking_order_policy.yml (+8/-2)
stock/report/report_stock_move_view.xml (+1/-1)
stock/stock_view.xml (+4/-2)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/7.0-fix-contact-company-handling
Reviewer Review Type Date Requested Status
Nhomar - Vauxoo (community) Needs Fixing on 2013-04-20
Joël Grand-Guillaume @ camptocamp (community) test, no code review Needs Fixing on 2013-04-18
Stefan Rijnhart (Opener) (community) Disapprove on 2013-04-09
OpenERP Core Team 2013-04-08 Pending
Review via email: mp+157576@code.launchpad.net

Description of the change

This branch contains the specific addons changes that are necessary to implement all parts of the solution described on bug 1160365. It depends on the changes brought by lp:~openerp-dev/openobject-server/7.0-fix-contact-company-handling in the `base` module.

More specifically it contains:
- module-specific overrides of _commercial_fields() for all modules adding accounting/invoicing-related fields to res.partner [Part B of the solution]

- corresponding changes to inherited views of res.partner form to hide these commercial fields when they are in fact "related fields" of their parent commercial entity. This mainly concerns 2 sections of the Partner form: the whole Accounting tab, and the bottom of the Sales&Purchase tabs with the pricelists and invoicing fields. These sections are replaced by a short message and a button to open the commercial entity to view/edit the fields. [Part B of the solution]

- a few fixes to properly delegate the resolution of various contact/address types to the corrected res.partner.address_get() [Part C of the solution]

- [REVERTED on 2013-04-11] a change of the domain for the `partner_id` field on invoices so that it only allows selecting commercial entities when creating invoices manually (in addition to the `supplier` or `customer` flag depending on the invoice type)

- changes to search views of the main business documents so that searching for a company name will also match its contacts [Part E of the solution]

- a fix of the _find_accounting_partner() method that the account module uses to locate the partner to which journal entries must be linked - it will now use the same semantics for "commercial entity" as what is specified on bug 1160365 [Part F of the solution]

# UPDATE 2013-04-11:

- revert the modified domain set on the partner field of Invoices - this was inconsistent with the rest of the system: it must be possible to invoice a contact everywhere

- change inherited partner form view in sale module to hide `use_parent_address` and `type` fields in all places unless advanced address management is enabled via the "Allow a different address for delivery and invoicing" option in Sales settings.

- fix issue detected by Joël Grand-Guillaume in comment #34 of bug 1160365: when invoicing after delivery, the invoicing contact/address must be used rather than the main customer. Tests updated accordingly.

- add new 7.0 module "account_report_company": this module adds an extra stored field "parent_commercial_id" on Invoices to make reporting/aggregating by partner easier in the Invoice list and in the Invoice Analysis report. This module is expected to be merged in the main account module in the next major release. The module can be installed without any risk on any existing 7.0 database.

Note: a series of important changes were done on the server branch as well, see updated description on https://code.launchpad.net/~openerp-dev/openobject-server/7.0-fix-contact-company-handling/+merge/157577

# UPDATE 2013-04-20:

- fixed unique constraints definition on some commercial fields on res.partner (l10n_ro)

- renamed fields pointing to commercial entity to `commercial_partner_id`, so the fact that it is a FK to res.partner is clearer, and the same name can be used everywhere without confusion (it was also changed on res.partner itself)

- improve group_by issues on all models by adding a new stored function field `display_name` on res.partner that contains the name_get() result in the form "ACME, John Doe" and set it as the default _order for res.partner. This ensures that group_by entries for the same company will always be next to each other on all documents: "ACME" is directly followed by "ACME, John Doe", "ACME, John Anderson", etc. This field also replaces the `name` field in the list and kanban views of Partners, so that the display order matches the display labels.

- fixed remaining search views where Partner search should have been using the "child of" operator to match contacts (Analysis views too):
 - Analytic Accounts
 - Assets
 - CRM Leads, Opportunities, Phone Calls
 - CRM Claims
 - CRM Helpdesk
 - MRP Repairs
 - Projects
 - Project Issues
 - Stock Pickings
 - Vouchers (somes search views had not been fixed yet)

To post a comment you must log in.

Hi,

First thanks for that work Olivier! My comments are here : https://bugs.launchpad.net/openobject-addons/+bug/1160365/comments/34

Regards,

Joël

We favour the approach of having a link between business documents and both company partner (partner_id) and contact partner (contact_id), and not having to copy the financial data from company partners to its contacts. See the comments by Raphaël Valyi and others on the bug discussion thread.

review: Disapprove

Forbid to set it as "Need fixing", refer to this post for details:

https://bugs.launchpad.net/openobject-addons/+bug/1160365/comments/34

review: Needs Fixing (test, no code review)
Olivier Dony (Odoo) (odo-openerp) wrote :

Thanks everyone for the tests and feedback. The branch has just been updated with 3 main changes (see updated description):

- revert the modified domain set on the partner field of Invoices - this was inconsistent with the rest of the system: it must be possible to invoice a contact everywhere.
- fix issue detected by Joël Grand-Guillaume in comment #34 of bug 1160365: when invoicing after delivery, the invoicing contact/address must be used rather than the main customer. Tests updated accordingly.
- add new 7.0 module "account_report_company": this module adds an extra stored field "parent_commercial_id" on Invoices to make reporting/aggregating by partner easier in the Invoice list and in the Invoice Analysis report. This module is expected to be merged in the main account module in the next major release. The module can be installed without any risk on any existing 7.0 database.

Concerning the first item, please note that Fabien's explanation in comment #50 was incorrect because we want to be able to create invoices for any contact. What happens is that you can configure the contact type on your partners so that the correct "invoice contact/department" is automatically selected regardless of the contact to which you sell. But you can still manually invoice any contact and the rest of the accounting flows will still be correct (and the reporting too)

I'll try to answer other specific questions asked by people who commented on both merge proposals in further comments.

Nhomar - Vauxoo (nhomar) wrote :

Hello Oliver.

My comments about views and mixed modules like sales and purchase in this case the sale module brake what you make in accounting.

See the video for more info.

2 Main points here:

1.- The vie on create a contact is broken.
2.- One improve in term of the meaning of the is_company == True field by default and the Customer and Supplier menu.

http://www.youtube.com/watch?v=hjhsCPQn9xA

Regards.

review: Needs Information

Hi Olivier,

For what I've tested today, and from a functional point of view here, it remains one big issue (may be miss some still...) : all the group by features.

I don't know if you think about providing a new module (same feature than you did for invoice) for other objects ? At least on invoices (and accounting entries but that was already mostly ok), it works as expected.

So I suggest that you take care of the following objects as well here (as this was the default behavior in 6.1, and we agree this wouldn't have to change for the end user):

 - PO (group by "supplier" should group on commercial entity by default here)
 - SO (group by "customer" should group on commercial entity by default here)
 - Analytic Account (group by "Associated partner" should group on commercial entity here)
 - Project (IMO here, it may be interesting to have both contact and commercial_entity_id. Main reason you labeled the existing group by "contact", so having both contact and Commercial entity sounds goods here)
 - Opportunity (group by "customer" should group on commercial entity by default here)
 - Repair order (group by "partner" should group on commercial entity by default here)

Special cases:
--------------

 - Lead :

Make a lead on Agrolait, and one on Michel Fletcher (Agrolait). On the Michel one, you see:

Company Name : Michel Fletcher
Customer : Agrolait, Michel Fletcher

Group by "Customer" show 2 occurrence: one for Agrolait, one for Michel. No way to group them all in one occurrence which will be honestly asked by everyone. I would like to see a way to group by commercial entity here as well. IMO we can fulfill "Company Name" of the lead with the commercial entity and add a "group by" on it. In any case, as it was in 6.1, I want to be able to group on the commercial entity.

 - Incomming shipment and Delivery Order : no group by here by default, but making to incoming shipment for Agrolait and one on Michel Fletcher (Agrolait), I would expect I can at least search on "Agrolait" and find all picking related to them. Not finding them is really sad...

That's all for today ;)

Regards,

Joël

review: Needs Fixing (test, no code review)
Olivier Dony (Odoo) (odo-openerp) wrote :
Download full text (3.5 KiB)

On 2013-04-16, Nhomar wrote:
> 2 Main points here:
>
> 1.- The view on create a contact is broken.

Thanks for the tests and feedback!
In your video you mention 2 issues regarding contact creation. They're not bugs but they certainly deserve an explanation:

A) The fact that 'use parent address' and 'address type' fields are hidden after installing Sales

This is the expected behavior, although I agree it needs to be improved in the future. The idea is: both the "use company address" flag and the "address type" are advanced features that are not needed by all users, and are meant to be hidden by default. The "contact/address type" only makes sense in combination with multiple partner fields on Sales Orders. The "use company address" makes the address fields readonly on contacts so it is more complicated to edit addresses, and only useful when users require strict synchronization of the addresses.

In 7.0 these features are currently enabled by checking the "Allow a different address for delivery and invoicing" option in the Sales Settings (under Quotations and Sales Orders / Customer Features), which also makes the extra partner fields visible on Sales Orders. For various reasons these features are in `base` but the option to hide/show them is in the sale (actually sale_stock) module, and it was chosen to keep them visible until `sale` is installed.

So just enable this settings and you will see what you expect when editing contacts.

B) The fact that when you create the first contact for a company, the address is copied to the company.

This is done on purpose but only when the company has *no other contact* and *no address* yet. No copy will happen later or in other cases. The goal is to be able to create a new Customer with a parent Company on-the-fly while creating a Sales Order in B2B mode. When you use the "Create and Edit..." option in the Customer field of the Sales Order you are likely to type the name of the contact's company without taking the time to fill in the whole company details, and then you'll enter the company address in the contact's details. This is OK but in most cases the address you type is also a valid address for the company, you just don't take the time to fill in all details.
So in this case (new contact with address created for a new company without address) we do 2 things:
  - set "is_company" on the company record (via context defaults)
  - copy the address fields from contact to company
because that's very likely to be what the user meant.

This avoids having a new company without address and will also mean that new contacts created later for this company will receive the same address via on_change, easing the task of filling in details (remember that the "use company address" feature is advanced and not enabled by default)

> 2.- One improve in term of the meaning of the is_company == True field by
> default and the Customer and Supplier menu.

Really we can't make the "is_company" field default to True because the meaning of "is_company" is meant to be strict: when checked it really means that this partner is a company, not an individual. For B2C the value must *not* be checked on customers, so we must n...

Read more...

Nhomar - Vauxoo (nhomar) wrote :

Oliver.

About B.

Dont you think the fact of COPY DATA brake all simple Database management rules in the world?

One of the arguments of the new model is "Avoid Data duplication and Inconsistencies".

Page 18 of the Fabiens presentation:

"We just removed redundancies in v6.1 model, e.g. on invoices:"

Do you REALLY think is different redundancy between Partner and Contacts PERFECTLY separated by a DBID than duplicate some Fields?

IMHO in any case, and I repeat, In any case data can be duplicated.

Important:

My sarcastic questions are regarding the fact you are duplicating data, no datamodel itself.

Can i offer to you a more elegant solution? and you will consider that, or you will insist at least ONE more time in duplicate fields?, I make this question my friend because i dont want waste badly my time.

About A.

I really dont understand this, in databases i shown you the hidden fields this option is already selected my friend.

But BTW....

You Install Just Accounting... Field shown.... You Installa a ore advanced module "Sales" .... Fields hidden, I think it is confusing.

Other point my friend you afirm:

=====
both the "use company address" flag and the "address type" are advanced features that are not needed by all users, and are meant to be hidden by default.
=====

At least that you use OpenERP for a .... I dont know event in a Gas Station you need say "THis is the Fiscal address for a Customer".

But the configuration is inconsistent....

Sales depends of account_voucher this of account.... then sales convert in Advanced a Basic feature of a base module :-s I am lost.

More comment comming dude.

review: Needs Information
Nhomar - Vauxoo (nhomar) wrote :

About A.

I just want to confirm, if we enable, use different addresses on config it works, it is IMHO just a problem with configuration order.

Olivier Dony (Odoo) (odo-openerp) wrote :
Download full text (3.4 KiB)

On 2013-04-18, Joël Grand-Guillaume wrote:
> For what I've tested today, and from a functional point of view here, it
> remains one big issue (may be miss some still...) : all the group by features.
>
> I don't know if you think about providing a new module (same feature than you
> did for invoice) for other objects ? At least on invoices (and accounting
> entries but that was already mostly ok), it works as expected.

Yes the group by issue is the main problem that remained, and we've now tried to find a way to improve the situation globally, via 2 changes:
 - the partner display name (name_get) was changed to "Company, Contact" to make the choice of the company very clear
 - this display name name is now also used as the default ordering for res.partner (when account_report_company) is installed

This is not a perfect solution but its mitigate the problem and will ensure that results are always consistent when searching/filtering/sorting by partners: the Company and its Contacts will always be physically grouped (as successive rows) everywhere:
 - in name_search results when trying to choose a partner
 - in the list/kanban views of partners
 - whenever any list of business documents is ordered by Customers/Supplier/Partner/Contact
 - in any view using "group by" res.partner (regular lists and analysis views)

Even if all fields are not directly summed/aggregated together in all cases like for invoices, at least the data will be impossible to miss, e.g:
  - Agrolait
  - Agrolait, Michel Fletcher
  - Agrolait, Thomas Passot
  - Axelor
  - Axelor, Laith Jubair
  - etc.

With this change I think the merge proposals are in a correct state to be merged in the 7.0 branch, and they represent quite an improvement in correctness and usability as compared to the current 7.0, thanks to all the feedback that was provided by everyone.

Then if we notice that this is *really* insufficient for a certain case, we may add another module similar to account_report_company. However this really needs to be experienced in practice with real users in their daily use, not simply compared with what was possible in 6.1. For example POs have very limited address management (no delivery/invoice address like SO), and partners are filtered by default on the "supplier" flag, so in practice users should not tend to use different contacts for different orders to the same supplier. For Deliveries/Shipments grouping by partner has little use as there's not much to aggregate in the list view except the row count.

> - Incomming shipment and Delivery Order : no group by here by default, but
> making to incoming shipment for Agrolait and one on Michel Fletcher
> (Agrolait), I would expect I can at least search on "Agrolait" and find all
> picking related to them. Not finding them is really sad...

For some reason the partner_id field was simply missing from the search view on Incoming Shipments and Delivery Orders, while it was in the one for Internal Moves as well as "Incoming/Outgoing Products".
This has been corrected and the proper field (with child_of operator to match contact) was added to these search views.
A number of remaining relevant search views were also fixed ...

Read more...

Nhomar - Vauxoo (nhomar) wrote :

About This My friend.

>>>
With this change I think the merge proposals are in a correct state to be merged in the 7.0 branch, and they represent quite an improvement in correctness and usability as compared to the current 7.0, thanks to all the feedback that was provided by everyone.
>>>

Let me tell you something.

If one Vauxoo's programmer for an error of design "Copy" Data for "Useability" Reasons, I send again to University and study DataBase Management. Even Wikipedia Knows :-( http://en.wikipedia.org/wiki/Data_redundancy

The fact that your branch has been tested is not reason enought to be merged, it is not all bad, but i think we need more feedback My friend, for first time in several years with OpenERP i think well not think I am TOTALLY sure this approach is wrong.

review: Needs Fixing

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account/account_invoice.py'
2--- account/account_invoice.py 2013-03-29 15:59:38 +0000
3+++ account/account_invoice.py 2013-04-20 02:28:27 +0000
4@@ -1260,9 +1260,7 @@
5 ref = invoice.reference
6 else:
7 ref = self._convert_ref(cr, uid, invoice.number)
8- partner = invoice.partner_id
9- if partner.parent_id and not partner.is_company:
10- partner = partner.parent_id
11+ partner = self.pool['res.partner']._find_accounting_partner(invoice.partner_id)
12 # Pay attention to the sign for both debit/credit AND amount_currency
13 l1 = {
14 'debit': direction * pay_amount>0 and direction * pay_amount,
15@@ -1733,15 +1731,17 @@
16 'invoice_ids': fields.one2many('account.invoice.line', 'partner_id', 'Invoices', readonly=True),
17 }
18
19- def _find_accounting_partner(self, part):
20+ def _find_accounting_partner(self, partner):
21 '''
22 Find the partner for which the accounting entries will be created
23 '''
24+ # FIXME: after 7.0, to replace by function field partner.commercial_partner_id
25+
26 #if the chosen partner is not a company and has a parent company, use the parent for the journal entries
27 #because you want to invoice 'Agrolait, accounting department' but the journal items are for 'Agrolait'
28- if part.parent_id and not part.is_company:
29- part = part.parent_id
30- return part
31+ while not partner.is_company and partner.parent_id:
32+ partner = partner.parent_id
33+ return partner
34
35 def copy(self, cr, uid, id, default=None, context=None):
36 default = default or {}
37
38=== modified file 'account/account_invoice_view.xml'
39--- account/account_invoice_view.xml 2013-03-13 12:43:17 +0000
40+++ account/account_invoice_view.xml 2013-04-20 02:28:27 +0000
41@@ -320,7 +320,8 @@
42 <field string="Customer" name="partner_id"
43 on_change="onchange_partner_id(type,partner_id,date_invoice,payment_term, partner_bank_id,company_id)"
44 groups="base.group_user" context="{'search_default_customer':1, 'show_address': 1}"
45- options='{"always_reload": True}'/>
46+ options='{"always_reload": True}'
47+ domain="[('customer', '=', True)]"/>
48 <field name="fiscal_position" widget="selection" />
49 </group>
50 <group>
51@@ -447,14 +448,14 @@
52 <field name="model">account.invoice</field>
53 <field name="arch" type="xml">
54 <search string="Search Invoice">
55- <field name="number" string="Invoice" filter_domain="['|','|','|', ('number','ilike',self), ('origin','ilike',self), ('supplier_invoice_number', 'ilike', self), ('partner_id', 'ilike', self)]"/>
56+ <field name="number" string="Invoice" filter_domain="['|','|','|', ('number','ilike',self), ('origin','ilike',self), ('supplier_invoice_number', 'ilike', self), ('partner_id', 'child_of', self)]"/>
57 <filter name="draft" string="Draft" domain="[('state','=','draft')]" help="Draft Invoices"/>
58 <filter name="proforma" string="Proforma" domain="[('state','=','proforma2')]" help="Proforma Invoices" groups="account.group_proforma_invoices"/>
59 <filter name="invoices" string="Invoices" domain="[('state','not in',['draft','cancel'])]" help="Proforma/Open/Paid Invoices"/>
60 <filter name="unpaid" string="Unpaid" domain="[('state','=','open')]" help="Unpaid Invoices"/>
61 <separator/>
62 <filter domain="[('user_id','=',uid)]" help="My Invoices" icon="terp-personal"/>
63- <field name="partner_id"/>
64+ <field name="partner_id" filter_domain="[('partner_id', 'child_of', self)]"/>
65 <field name="user_id" string="Salesperson"/>
66 <field name="period_id" string="Period"/>
67 <group expand="0" string="Group By...">
68
69=== modified file 'account/partner.py'
70--- account/partner.py 2013-03-20 13:50:52 +0000
71+++ account/partner.py 2013-04-20 02:28:27 +0000
72@@ -236,6 +236,11 @@
73 'last_reconciliation_date': fields.datetime('Latest Full Reconciliation Date', help='Date on which the partner accounting entries were fully reconciled last time. It differs from the last date where a reconciliation has been made for this partner, as here we depict the fact that nothing more was to be reconciled at this date. This can be achieved in 2 different ways: either the last unreconciled debit/credit entry of this partner was reconciled, either the user pressed the button "Nothing more to reconcile" during the manual reconciliation process.')
74 }
75
76+ def _commercial_fields(self, cr, uid, context=None):
77+ return super(res_partner, self)._commercial_fields(cr, uid, context=context) + \
78+ ['debit_limit', 'property_account_payable', 'property_account_receivable', 'property_account_position',
79+ 'property_payment_term', 'property_supplier_payment_term', 'last_reconciliation_date']
80+
81 res_partner()
82
83 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
84
85=== modified file 'account/partner_view.xml'
86--- account/partner_view.xml 2013-02-25 14:10:14 +0000
87+++ account/partner_view.xml 2013-04-20 02:28:27 +0000
88@@ -73,7 +73,7 @@
89 <field name="inherit_id" ref="base.view_partner_form"/>
90 <field name="arch" type="xml">
91 <page string="History" position="before" version="7.0">
92- <page string="Accounting" col="4">
93+ <page string="Accounting" col="4" name="accounting" attrs="{'invisible': [('is_company','=',False),('parent_id','!=',False)]}">
94 <group>
95 <group>
96 <field name="property_account_position" widget="selection"/>
97@@ -103,6 +103,11 @@
98 </tree>
99 </field>
100 </page>
101+ <page string="Accounting" name="accounting_disabled" attrs="{'invisible': ['|',('is_company','=',True),('parent_id','=',False)]}">
102+ <div>
103+ <p>Accounting-related settings are managed on <button name="open_commercial_entity" type="object" string="the parent company" class="oe_link"/></p>
104+ </div>
105+ </page>
106 </page>
107 </field>
108 </record>
109
110=== modified file 'account/project/project_view.xml'
111--- account/project/project_view.xml 2013-03-12 12:33:21 +0000
112+++ account/project/project_view.xml 2013-04-20 02:28:27 +0000
113@@ -31,7 +31,7 @@
114 <search string="Analytic Account">
115 <field name="name" filter_domain="['|', ('name','ilike',self), ('code','ilike',self)]" string="Analytic Account"/>
116 <field name="date"/>
117- <field name="partner_id"/>
118+ <field name="partner_id" filter_domain="[('partner_id','child_of',self)]"/>
119 <field name="manager_id"/>
120 <field name="parent_id"/>
121 <field name="user_id"/>
122
123=== modified file 'account_analytic_analysis/account_analytic_analysis_view.xml'
124--- account_analytic_analysis/account_analytic_analysis_view.xml 2013-03-14 16:13:27 +0000
125+++ account_analytic_analysis/account_analytic_analysis_view.xml 2013-04-20 02:28:27 +0000
126@@ -186,7 +186,7 @@
127 <search string="Contracts">
128 <field name="name" filter_domain="['|', ('name','ilike',self),('code','ilike',self)]" string="Contract"/>
129 <field name="date"/>
130- <field name="partner_id"/>
131+ <field name="partner_id" filter_domain="[('partner_id','child_of',self)]"/>
132 <field name="manager_id"/>
133 <field name="parent_id"/>
134 <filter name="open" string="In Progress" domain="[('state','in',('open','draft'))]" help="Contracts in progress (open, draft)"/>
135
136=== modified file 'account_asset/account_asset_view.xml'
137--- account_asset/account_asset_view.xml 2012-12-08 10:33:38 +0000
138+++ account_asset/account_asset_view.xml 2013-04-20 02:28:27 +0000
139@@ -223,7 +223,7 @@
140 <filter icon="terp-check" string="Current" domain="[('state','in', ('draft','open'))]" help="Assets in draft and open states"/>
141 <filter icon="terp-dialog-close" string="Closed" domain="[('state','=', 'close')]" help="Assets in closed state"/>
142 <field name="category_id"/>
143- <field name="partner_id"/>
144+ <field name="partner_id" filter_domain="[('partner_id','child_of',self)]"/>
145 </search>
146 </field>
147 </record>
148
149=== modified file 'account_asset/report/account_asset_report_view.xml'
150--- account_asset/report/account_asset_report_view.xml 2012-11-29 22:26:45 +0000
151+++ account_asset/report/account_asset_report_view.xml 2013-04-20 02:28:27 +0000
152@@ -49,7 +49,7 @@
153 <field name="asset_id"/>
154 <field name="asset_category_id"/>
155 <group expand="0" string="Extended Filters...">
156- <field name="partner_id"/>
157+ <field name="partner_id" filter_domain="[('partner_id','child_of',self)]"/>
158 <field name="company_id" groups="base.group_multi_company"/>
159 </group>
160 <group expand="1" string="Group By...">
161
162=== added directory 'account_report_company'
163=== added file 'account_report_company/__init__.py'
164--- account_report_company/__init__.py 1970-01-01 00:00:00 +0000
165+++ account_report_company/__init__.py 2013-04-20 02:28:27 +0000
166@@ -0,0 +1,25 @@
167+# -*- coding: utf-8 -*-
168+##############################################################################
169+#
170+# OpenERP, Open Source Business Applications
171+# Copyright (c) 2013 OpenERP S.A. <http://openerp.com>
172+#
173+# This program is free software: you can redistribute it and/or modify
174+# it under the terms of the GNU Affero General Public License as
175+# published by the Free Software Foundation, either version 3 of the
176+# License, or (at your option) any later version.
177+#
178+# This program is distributed in the hope that it will be useful,
179+# but WITHOUT ANY WARRANTY; without even the implied warranty of
180+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
181+# GNU Affero General Public License for more details.
182+#
183+# You should have received a copy of the GNU Affero General Public License
184+# along with this program. If not, see <http://www.gnu.org/licenses/>.
185+#
186+##############################################################################
187+
188+import account_report_company
189+import report
190+
191+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
192
193=== added file 'account_report_company/__openerp__.py'
194--- account_report_company/__openerp__.py 1970-01-01 00:00:00 +0000
195+++ account_report_company/__openerp__.py 2013-04-20 02:28:27 +0000
196@@ -0,0 +1,57 @@
197+# -*- coding: utf-8 -*-
198+##############################################################################
199+#
200+# OpenERP, Open Source Business Applications
201+# Copyright (c) 2013 OpenERP S.A. <http://openerp.com>
202+#
203+# This program is free software: you can redistribute it and/or modify
204+# it under the terms of the GNU Affero General Public License as
205+# published by the Free Software Foundation, either version 3 of the
206+# License, or (at your option) any later version.
207+#
208+# This program is distributed in the hope that it will be useful,
209+# but WITHOUT ANY WARRANTY; without even the implied warranty of
210+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
211+# GNU Affero General Public License for more details.
212+#
213+# You should have received a copy of the GNU Affero General Public License
214+# along with this program. If not, see <http://www.gnu.org/licenses/>.
215+#
216+##############################################################################
217+{
218+ 'name': 'Invoice Analysis per Company',
219+ 'version': '1.0',
220+ 'category': 'Accounting & Finance',
221+ 'description': """
222+Add an extra Company dimension on Invoices for consolidated Invoice Analysis
223+============================================================================
224+
225+By default Customer and Supplier invoices can be linked to a contact within
226+a company, but the company is not a direct reference in the database structure for
227+invoices. Journal Entries are however always linked to the company and not to
228+contacts, so that Accounts Payable and Receivable are always correct and consolidated
229+at company level.
230+
231+When many different contacts/departments need to be invoiced within the same parent company,
232+this can make reporting by Company more difficult: reports are directly based on the
233+database structure and would not provide an aggregated company dimension.
234+
235+This modules solves the problem by adding an explicit company reference on invoices,
236+automatically computed from the invoice contact, and use this new dimension
237+when grouping the list of Invoices or the Invoice Analysis report by Partner.
238+
239+Note: this module will likely be removed for the next major OpenERP version and
240+directly integrated in the core accounting.
241+""",
242+ 'author': 'OpenERP SA',
243+ 'website': 'http://www.openerp.com',
244+ 'depends': ['account'],
245+ 'data': [
246+ 'account_invoice_view.xml',
247+ 'res_partner_view.xml',
248+ 'report/account_invoice_report_view.xml',
249+ ],
250+ 'auto_install': True,
251+}
252+
253+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
254
255=== added file 'account_report_company/account_invoice_view.xml'
256--- account_report_company/account_invoice_view.xml 1970-01-01 00:00:00 +0000
257+++ account_report_company/account_invoice_view.xml 2013-04-20 02:28:27 +0000
258@@ -0,0 +1,24 @@
259+<?xml version="1.0"?>
260+<openerp>
261+ <data>
262+ <record model="ir.ui.view" id="account_report_company_tree_view">
263+ <field name="model">account.invoice</field>
264+ <field name="inherit_id" ref="account.invoice_tree"/>
265+ <field name="arch" type="xml">
266+ <field name="partner_id" position="after">
267+ <field name="commercial_partner_id" invisible="1"/>
268+ </field>
269+ </field>
270+ </record>
271+
272+ <record model="ir.ui.view" id="account_report_company_search_view">
273+ <field name="model">account.invoice</field>
274+ <field name="inherit_id" ref="account.view_account_invoice_filter"/>
275+ <field name="arch" type="xml">
276+ <filter string="Partner" position="replace">
277+ <filter name="commercial_partner_id" string="Partner" domain="[]" context="{'group_by':'commercial_partner_id'}"/>
278+ </filter>
279+ </field>
280+ </record>
281+ </data>
282+</openerp>
283\ No newline at end of file
284
285=== added file 'account_report_company/account_report_company.py'
286--- account_report_company/account_report_company.py 1970-01-01 00:00:00 +0000
287+++ account_report_company/account_report_company.py 2013-04-20 02:28:27 +0000
288@@ -0,0 +1,51 @@
289+# -*- coding: utf-8 -*-
290+##############################################################################
291+#
292+# OpenERP, Open Source Business Applications
293+# Copyright (c) 2013 S.A. <http://openerp.com>
294+#
295+# This program is free software: you can redistribute it and/or modify
296+# it under the terms of the GNU Affero General Public License as
297+# published by the Free Software Foundation, either version 3 of the
298+# License, or (at your option) any later version.
299+#
300+# This program is distributed in the hope that it will be useful,
301+# but WITHOUT ANY WARRANTY; without even the implied warranty of
302+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
303+# GNU Affero General Public License for more details.
304+#
305+# You should have received a copy of the GNU Affero General Public License
306+# along with this program. If not, see <http://www.gnu.org/licenses/>.
307+#
308+##############################################################################
309+
310+from openerp.osv import osv, fields
311+
312+class res_partner(osv.Model):
313+ _inherit = 'res.partner'
314+ _order = 'display_name'
315+
316+ def _display_name_compute(self, cr, uid, ids, name, args, context=None):
317+ return dict(self.name_get(cr, uid, ids, context=context))
318+
319+ _display_name_store_triggers = {
320+ 'res.partner': (lambda self,cr,uid,ids,context=None: self.search(cr, uid, [('id','child_of',ids)]),
321+ ['parent_id', 'is_company'], 10)
322+ }
323+
324+ # indirection to avoid passing a copy of the overridable method when declaring the function field
325+ _display_name = lambda self, *args, **kwargs: self._display_name_compute(*args, **kwargs)
326+
327+ _columns = {
328+ # extra field to allow ORDER BY to match visible names
329+ 'display_name': fields.function(_display_name, type='char', string='Name', store=_display_name_store_triggers),
330+ }
331+
332+class account_invoice(osv.Model):
333+ _inherit = 'account.invoice'
334+
335+ _columns = {
336+ 'commercial_partner_id': fields.related('partner_id', 'commercial_partner_id', string='Commercial Entity', type='many2one',
337+ relation='res.partner', store=True, readonly=True,
338+ help="The commercial entity that will be used on Journal Entries for this invoice")
339+ }
340
341=== added directory 'account_report_company/report'
342=== added file 'account_report_company/report/__init__.py'
343--- account_report_company/report/__init__.py 1970-01-01 00:00:00 +0000
344+++ account_report_company/report/__init__.py 2013-04-20 02:28:27 +0000
345@@ -0,0 +1,24 @@
346+# -*- coding: utf-8 -*-
347+##############################################################################
348+#
349+# OpenERP, Open Source Business Applications
350+# Copyright (c) 2013 OpenERP S.A. <http://openerp.com>
351+#
352+# This program is free software: you can redistribute it and/or modify
353+# it under the terms of the GNU Affero General Public License as
354+# published by the Free Software Foundation, either version 3 of the
355+# License, or (at your option) any later version.
356+#
357+# This program is distributed in the hope that it will be useful,
358+# but WITHOUT ANY WARRANTY; without even the implied warranty of
359+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
360+# GNU Affero General Public License for more details.
361+#
362+# You should have received a copy of the GNU Affero General Public License
363+# along with this program. If not, see <http://www.gnu.org/licenses/>.
364+#
365+##############################################################################
366+
367+import account_invoice_report
368+
369+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
370
371=== added file 'account_report_company/report/account_invoice_report.py'
372--- account_report_company/report/account_invoice_report.py 1970-01-01 00:00:00 +0000
373+++ account_report_company/report/account_invoice_report.py 2013-04-20 02:28:27 +0000
374@@ -0,0 +1,36 @@
375+# -*- coding: utf-8 -*-
376+##############################################################################
377+#
378+# OpenERP, Open Source Business Applications
379+# Copyright (c) 2013 OpenERP S.A. <http://openerp.com>
380+#
381+# This program is free software: you can redistribute it and/or modify
382+# it under the terms of the GNU Affero General Public License as
383+# published by the Free Software Foundation, either version 3 of the
384+# License, or (at your option) any later version.
385+#
386+# This program is distributed in the hope that it will be useful,
387+# but WITHOUT ANY WARRANTY; without even the implied warranty of
388+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
389+# GNU Affero General Public License for more details.
390+#
391+# You should have received a copy of the GNU Affero General Public License
392+# along with this program. If not, see <http://www.gnu.org/licenses/>.
393+#
394+##############################################################################
395+from openerp.osv import osv, fields
396+
397+class account_invoice_report(osv.Model):
398+ _inherit = 'account.invoice.report'
399+ _columns = {
400+ 'commercial_partner_id': fields.many2one('res.partner', 'Partner Company', help="Commercial Entity"),
401+ }
402+
403+ def _select(self):
404+ return super(account_invoice_report, self)._select() + ", sub.commercial_partner_id as commercial_partner_id"
405+
406+ def _sub_select(self):
407+ return super(account_invoice_report, self)._sub_select() + ", ai.commercial_partner_id as commercial_partner_id"
408+
409+ def _group_by(self):
410+ return super(account_invoice_report, self)._group_by() + ", ai.commercial_partner_id"
411
412=== added file 'account_report_company/report/account_invoice_report_view.xml'
413--- account_report_company/report/account_invoice_report_view.xml 1970-01-01 00:00:00 +0000
414+++ account_report_company/report/account_invoice_report_view.xml 2013-04-20 02:28:27 +0000
415@@ -0,0 +1,24 @@
416+<?xml version="1.0"?>
417+<openerp>
418+ <data>
419+ <record model="ir.ui.view" id="account_report_company_invoice_report_tree_view">
420+ <field name="model">account.invoice.report</field>
421+ <field name="inherit_id" ref="account.view_account_invoice_report_tree"/>
422+ <field name="arch" type="xml">
423+ <field name="partner_id" position="after">
424+ <field name="commercial_partner_id" invisible="1"/>
425+ </field>
426+ </field>
427+ </record>
428+
429+ <record model="ir.ui.view" id="account_report_company_invoice_report_search_view">
430+ <field name="model">account.invoice.report</field>
431+ <field name="inherit_id" ref="account.view_account_invoice_report_search"/>
432+ <field name="arch" type="xml">
433+ <filter name="partner" position="replace">
434+ <filter string="Partner" name="commercial_partner_id" context="{'group_by':'commercial_partner_id','residual_visible':True}"/>
435+ </filter>
436+ </field>
437+ </record>
438+ </data>
439+</openerp>
440\ No newline at end of file
441
442=== added file 'account_report_company/res_partner_view.xml'
443--- account_report_company/res_partner_view.xml 1970-01-01 00:00:00 +0000
444+++ account_report_company/res_partner_view.xml 2013-04-20 02:28:27 +0000
445@@ -0,0 +1,24 @@
446+<?xml version="1.0"?>
447+<openerp>
448+ <data>
449+ <record model="ir.ui.view" id="account_report_copmany_partner_tree_view">
450+ <field name="model">res.partner</field>
451+ <field name="inherit_id" ref="base.view_partner_tree"/>
452+ <field name="arch" type="xml">
453+ <field name="name" position="replace">
454+ <field name="display_name"/>
455+ </field>
456+ </field>
457+ </record>
458+
459+ <record model="ir.ui.view" id="account_report_copmany_partner_kanban_view">
460+ <field name="model">res.partner</field>
461+ <field name="inherit_id" ref="base.res_partner_kanban_view"/>
462+ <field name="arch" type="xml">
463+ <xpath expr="//templates//field[@name='name']" position="replace">
464+ <field name="display_name"/>
465+ </xpath>
466+ </field>
467+ </record>
468+ </data>
469+</openerp>
470\ No newline at end of file
471
472=== modified file 'account_voucher/account_voucher_view.xml'
473--- account_voucher/account_voucher_view.xml 2013-02-25 13:38:04 +0000
474+++ account_voucher/account_voucher_view.xml 2013-04-20 02:28:27 +0000
475@@ -129,7 +129,7 @@
476 <filter icon="terp-camera_test" string="Posted" domain="[('state','=','posted')]" help="Posted Vouchers"/>
477 <separator/>
478 <filter icon="terp-gtk-jump-to-ltr" string="To Review" domain="[('state','=','posted'), ('audit','=',False)]" help="To Review"/>
479- <field name="partner_id"/>
480+ <field name="partner_id" filter_domain="[('partner_id', 'child_of', self)]"/>
481 <field name="journal_id" context="{'journal_id': self, 'set_visible':False}" />
482 <field name="period_id"/>
483 <group expand="0" string="Group By...">
484
485=== modified file 'account_voucher/voucher_payment_receipt_view.xml'
486--- account_voucher/voucher_payment_receipt_view.xml 2013-02-25 13:38:04 +0000
487+++ account_voucher/voucher_payment_receipt_view.xml 2013-04-20 02:28:27 +0000
488@@ -11,7 +11,7 @@
489 <field name="date"/>
490 <filter icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Draft Vouchers"/>
491 <filter icon="terp-camera_test" string="Posted" domain="[('state','=','posted')]" help="Posted Vouchers"/>
492- <field name="partner_id" string="Customer"/>
493+ <field name="partner_id" string="Customer" filter_domain="[('partner_id','child_of',self)]"/>
494 <field name="journal_id" context="{'journal_id': self, 'set_visible':False}" domain="[('type','in',('bank','cash'))]"/>
495 <field name="period_id"/>
496 <group expand="0" string="Group By...">
497@@ -34,7 +34,7 @@
498 <field name="date"/>
499 <filter icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Draft Vouchers"/>
500 <filter icon="terp-camera_test" string="Posted" domain="[('state','=','posted')]" help="Posted Vouchers"/>
501- <field name="partner_id" string="Supplier"/>
502+ <field name="partner_id" string="Supplier" filter_domain="[('partner_id','child_of',self)]"/>
503 <field name="journal_id" context="{'journal_id': self, 'set_visible':False}" domain="[('type','in',('bank','cash'))]"/>
504 <field name="period_id"/>
505 <group expand="0" string="Group By...">
506
507=== modified file 'account_voucher/voucher_sales_purchase_view.xml'
508--- account_voucher/voucher_sales_purchase_view.xml 2013-02-25 14:20:35 +0000
509+++ account_voucher/voucher_sales_purchase_view.xml 2013-04-20 02:28:27 +0000
510@@ -10,7 +10,7 @@
511 <field name="date"/>
512 <filter icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Draft Vouchers"/>
513 <filter icon="terp-camera_test" string="Posted" domain="[('state','=','posted')]" help="Posted Vouchers"/>
514- <field name="partner_id" string="Supplier"/>
515+ <field name="partner_id" string="Supplier" filter_domain="[('partner_id','child_of',self)]"/>
516 <field name="journal_id" context="{'journal_id': self, 'set_visible':False}" domain="[('type','in',('purchase','purchase_refund'))]"/>
517 <field name="period_id"/>
518 <group expand="0" string="Group By...">
519@@ -32,7 +32,7 @@
520 <field name="date"/>
521 <filter icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Draft Vouchers"/>
522 <filter icon="terp-camera_test" string="Posted" domain="[('state','=','posted')]" help="Posted Vouchers"/>
523- <field name="partner_id" string="Customer"/>
524+ <field name="partner_id" string="Customer" filter_domain="[('partner_id','child_of',self)]"/>
525 <field name="journal_id" context="{'journal_id': self, 'set_visible':False}" domain="[('type','in',('sale','sale_refund'))]"/>
526 <field name="period_id"/>
527 <group expand="0" string="Group By...">
528
529=== modified file 'base_vat/base_vat.py'
530--- base_vat/base_vat.py 2012-12-18 17:55:47 +0000
531+++ base_vat/base_vat.py 2013-04-20 02:28:27 +0000
532@@ -134,6 +134,9 @@
533 'vat_subjected': fields.boolean('VAT Legal Statement', help="Check this box if the partner is subjected to the VAT. It will be used for the VAT legal statement.")
534 }
535
536+ def _commercial_fields(self, cr, uid, context=None):
537+ return super(res_partner, self)._commercial_fields(cr, uid, context=context) + ['vat_subjected']
538+
539 def _construct_constraint_msg(self, cr, uid, ids, context=None):
540 def default_vat_check(cn, vn):
541 # by default, a VAT number is valid if:
542
543=== modified file 'crm/crm_lead_view.xml'
544--- crm/crm_lead_view.xml 2013-04-11 12:33:56 +0000
545+++ crm/crm_lead_view.xml 2013-04-20 02:28:27 +0000
546@@ -328,7 +328,7 @@
547 <field name="categ_ids" string="Category" filter_domain="[('categ_ids','ilike',self)]"/>
548 <field name="section_id" context="{'invisible_section': False, 'default_section_id': self}"/>
549 <field name="user_id"/>
550- <field name="partner_id"/>
551+ <field name="partner_id" filter_domain="[('partner_id','child_of',self)]"/>
552 <field name="create_date"/>
553 <field name="country_id" context="{'invisible_country': False}"/>
554 <separator/>
555@@ -546,7 +546,7 @@
556 <field name="categ_ids" string="Category" filter_domain="[('categ_ids','ilike', self)]"/>
557 <field name="section_id" context="{'invisible_section': False, 'default_section_id': self}"/>
558 <field name="user_id"/>
559- <field name="partner_id"/>
560+ <field name="partner_id" filter_domain="[('partner_id','child_of',self)]"/>
561 <separator/>
562 <filter string="New" name="new" domain="[('state','=','draft')]" help="New Opportunities"/>
563 <filter string="In Progress" name="open" domain="[('state','=','open')]" help="Open Opportunities"/>
564
565=== modified file 'crm/crm_phonecall_view.xml'
566--- crm/crm_phonecall_view.xml 2013-03-04 18:44:31 +0000
567+++ crm/crm_phonecall_view.xml 2013-04-20 02:28:27 +0000
568@@ -185,7 +185,7 @@
569 <separator/>
570 <filter string="Phone Calls Assigned to Me or My Team(s)" icon="terp-personal+" domain="['|', ('section_id.user_id','=',uid), ('user_id', '=', uid)]"
571 help="Phone Calls Assigned to the current user or with a team having the current user as team leader"/>
572- <field name="partner_id"/>
573+ <field name="partner_id" filter_domain="[('partner_id','child_of',self)]"/>
574 <field name="user_id"/>
575 <field name="section_id" string="Sales Team"/>
576 <group expand="0" string="Group By...">
577
578=== modified file 'crm/report/crm_lead_report_view.xml'
579--- crm/report/crm_lead_report_view.xml 2012-11-29 22:26:45 +0000
580+++ crm/report/crm_lead_report_view.xml 2013-04-20 02:28:27 +0000
581@@ -80,7 +80,7 @@
582 <field name="section_id" context="{'invisible_section': False}"/>
583 <field name="user_id" string="Salesperson"/>
584 <group expand="0" string="Extended Filters...">
585- <field name="partner_id"/>
586+ <field name="partner_id" filter_domain="[('partner_id','child_of',self)]"/>
587 <field name="stage_id" domain="[('section_ids', '=', 'section_id')]" />
588 <field name="type_id"/>
589 <field name="channel_id"/>
590
591=== modified file 'crm/report/crm_phonecall_report_view.xml'
592--- crm/report/crm_phonecall_report_view.xml 2012-11-29 22:26:45 +0000
593+++ crm/report/crm_phonecall_report_view.xml 2013-04-20 02:28:27 +0000
594@@ -62,7 +62,7 @@
595 <field name="section_id" string="Sales Team" context="{'invisible_section': False}"/>
596 <field name="user_id" string="Salesperson"/>
597 <group expand="0" string="Extended Filters...">
598- <field name="partner_id"/>
599+ <field name="partner_id" filter_domain="[('partner_id','child_of',self)]"/>
600 <field name="company_id" groups="base.group_multi_company"/>
601 <field name="creation_date"/>
602 <field name="opening_date"/>
603
604=== modified file 'crm_claim/crm_claim_view.xml'
605--- crm_claim/crm_claim_view.xml 2013-03-04 12:55:34 +0000
606+++ crm_claim/crm_claim_view.xml 2013-04-20 02:28:27 +0000
607@@ -201,7 +201,7 @@
608 <filter icon="terp-gtk-media-pause" string="Pending" domain="[('state','=','pending')]"/>
609 <separator/>
610 <filter string="Unassigned Claims" icon="terp-personal-" domain="[('user_id','=', False)]" help="Unassigned Claims" />
611- <field name="partner_id"/>
612+ <field name="partner_id" filter_domain="[('partner_id','child_of',self)]"/>
613 <field name="user_id"/>
614 <group expand="0" string="Group By...">
615 <filter string="Partner" icon="terp-partner" domain="[]" help="Partner" context="{'group_by':'partner_id'}"/>
616
617=== modified file 'crm_claim/report/crm_claim_report_view.xml'
618--- crm_claim/report/crm_claim_report_view.xml 2012-11-29 22:26:45 +0000
619+++ crm_claim/report/crm_claim_report_view.xml 2013-04-20 02:28:27 +0000
620@@ -63,7 +63,7 @@
621 <field name="user_id" string="Salesperson"/>
622 <field name="section_id" string="Sales Team" context="{'invisible_section': False}"/>
623 <group expand="0" string="Extended Filters...">
624- <field name="partner_id"/>
625+ <field name="partner_id" filter_domain="[('partner_id','child_of',self)]"/>
626 <field name="stage_id" domain="[('section_ids', '=', 'section_id')]"/>
627 <field name="categ_id" domain="[('object_id.model', '=', 'crm.claim')]"/>
628 <field name="priority"/>
629
630=== modified file 'crm_helpdesk/crm_helpdesk_view.xml'
631--- crm_helpdesk/crm_helpdesk_view.xml 2013-03-04 18:44:31 +0000
632+++ crm_helpdesk/crm_helpdesk_view.xml 2013-04-20 02:28:27 +0000
633@@ -152,7 +152,7 @@
634 <separator/>
635 <filter string="Assigned to Me or My Sales Team(s)" icon="terp-personal+" domain="['|', ('section_id.user_id','=',uid), ('section_id.member_ids', 'in', [uid])]"
636 help="Helpdesk requests that are assigned to me or to one of the sale teams I manage" />
637- <field name="partner_id" />
638+ <field name="partner_id" filter_domain="[('partner_id','child_of',self)]"/>
639 <field name="user_id"/>
640 <field name="section_id" string="Sales Team"/>
641 <group expand="0" string="Group By...">
642
643=== modified file 'crm_helpdesk/report/crm_helpdesk_report_view.xml'
644--- crm_helpdesk/report/crm_helpdesk_report_view.xml 2012-11-29 22:26:45 +0000
645+++ crm_helpdesk/report/crm_helpdesk_report_view.xml 2013-04-20 02:28:27 +0000
646@@ -62,6 +62,7 @@
647 <field name="user_id" string="Salesperson"/>
648 <field name="section_id" string="Sales Team" context="{'invisible_section': False}"/>
649 <field name="company_id" groups="base.group_multi_company"/>
650+ <field name="partner_id" filter_domain="[('partner_id','child_of',self)]"/>
651 <group expand="0" string="Extended Filters..." groups="base.group_no_one">
652 <field name="priority" string="Priority"/>
653 <field name="categ_id"/>
654
655=== modified file 'l10n_be_invoice_bba/partner.py'
656--- l10n_be_invoice_bba/partner.py 2012-12-06 14:56:32 +0000
657+++ l10n_be_invoice_bba/partner.py 2013-04-20 02:28:27 +0000
658@@ -44,6 +44,11 @@
659 help='Select Algorithm to generate the Structured Communication on Outgoing Invoices.' ),
660 }
661
662+ def _commercial_fields(self, cr, uid, context=None):
663+ return super(res_partner, self)._commercial_fields(cr, uid, context=context) + \
664+ ['out_inv_comm_type', 'out_inv_comm_algorithm']
665+
666+
667 _default = {
668 'out_inv_comm_type': 'none',
669 }
670
671=== modified file 'l10n_ro/res_partner.py'
672--- l10n_ro/res_partner.py 2012-12-19 14:11:55 +0000
673+++ l10n_ro/res_partner.py 2013-04-20 02:28:27 +0000
674@@ -28,10 +28,33 @@
675 _columns = {
676 'nrc' : fields.char('NRC', size=16, help='Registration number at the Registry of Commerce'),
677 }
678+
679+ # The SQL constraints are no-ops but present only to display the right error message to the
680+ # user when the partial unique indexes defined below raise errors/
681+ # The real constraints need to be implemented with PARTIAL UNIQUE INDEXES (see auto_init),
682+ # due to the way accounting data is delegated by contacts to their companies in OpenERP 7.0.
683 _sql_constraints = [
684- ('vat_uniq', 'unique (vat)', 'The vat of the partner must be unique !'),
685- ('nrc_uniq', 'unique (nrc)', 'The code of the partner must be unique !')
686+ ('vat_uniq', 'unique (id)', 'The vat of the partner must be unique !'),
687+ ('nrc_uniq', 'unique (id)', 'The code of the partner must be unique !')
688 ]
689+
690+ def _auto_init(self, cr, context=None):
691+ result = super(res_partner, self)._auto_init(cr, context=context)
692+ # Real implementation of the vat/nrc constraints: only "commercial entities" need to have
693+ # unique numbers, and the condition for being a commercial entity is "is_company or parent_id IS NULL".
694+ # Contacts inside a company automatically have a copy of the company's commercial fields
695+ # (see _commercial_fields()), so they are automatically consistent.
696+ cr.execute("""
697+ DROP INDEX IF EXISTS res_partner_vat_uniq_for_companies;
698+ DROP INDEX IF EXISTS res_partner_nrc_uniq_for_companies;
699+ CREATE UNIQUE INDEX res_partner_vat_uniq_for_companies ON res_partner (vat) WHERE is_company OR parent_id IS NULL;
700+ CREATE UNIQUE INDEX res_partner_nrc_uniq_for_companies ON res_partner (nrc) WHERE is_company OR parent_id IS NULL;
701+ """)
702+ return result
703+
704+ def _commercial_fields(self, cr, uid, context=None):
705+ return super(res_partner, self)._commercial_fields(cr, uid, context=context) + ['nrc']
706+
707 res_partner()
708
709 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
710
711=== modified file 'mrp_repair/mrp_repair_view.xml'
712--- mrp_repair/mrp_repair_view.xml 2012-12-15 16:31:01 +0000
713+++ mrp_repair/mrp_repair_view.xml 2013-04-20 02:28:27 +0000
714@@ -210,7 +210,7 @@
715 <separator/>
716 <filter icon="terp-dolar" string="Invoiced" domain="[('invoiced','=',True)]"/>
717 <field name="product_id"/>
718- <field name="partner_id"/>
719+ <field name="partner_id" filter_domain="[('partner_id', 'child_of', self)]"/>
720 <group expand="0" string="Group By...">
721 <filter string="Partner" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/>
722 <filter string="Product" icon="terp-accessories-archiver" domain="[]" context="{'group_by':'product_id'}"/>
723
724=== modified file 'product/partner.py'
725--- product/partner.py 2012-12-06 14:56:32 +0000
726+++ product/partner.py 2013-04-20 02:28:27 +0000
727@@ -36,6 +36,9 @@
728 help="This pricelist will be used, instead of the default one, for sales to the current partner"),
729 }
730
731+ def _commercial_fields(self, cr, uid, context=None):
732+ return super(res_partner, self)._commercial_fields(cr, uid, context=context) + ['property_product_pricelist']
733+
734 res_partner()
735
736 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
737
738=== modified file 'product/partner_view.xml'
739--- product/partner_view.xml 2012-11-29 22:26:45 +0000
740+++ product/partner_view.xml 2013-04-20 02:28:27 +0000
741@@ -8,9 +8,12 @@
742 <field name="arch" type="xml">
743 <page string="Sales &amp; Purchases" position="inside">
744 <group>
745- <group name="pricelists" groups="product.group_sale_pricelist">
746+ <group name="pricelists" groups="product.group_sale_pricelist" attrs="{'invisible': [('is_company','=',False),('parent_id','!=',False)]}">
747 <field name="property_product_pricelist"/>
748 </group>
749+ <div name="parent_pricelists" groups="product.group_sale_pricelist" attrs="{'invisible': ['|',('is_company','=',True),('parent_id','=',False)]}">
750+ <p>Pricelists are managed on <button name="open_commercial_entity" type="object" string="the parent company" class="oe_link"/></p>
751+ </div>
752 </group>
753 </page>
754 </field>
755
756=== modified file 'project/project_view.xml'
757--- project/project_view.xml 2013-03-04 18:44:31 +0000
758+++ project/project_view.xml 2013-04-20 02:28:27 +0000
759@@ -182,7 +182,7 @@
760 <separator/>
761 <filter string="Project(s) Manager" domain="[('user_id','=',uid)]" help="Projects in which I am a manager" icon="terp-personal"/>
762 <field name="user_id" string="Project Manager"/>
763- <field name="partner_id" string="Contact"/>
764+ <field name="partner_id" string="Contact" filter_domain="[('partner_id', 'child_of', self)]"/>
765 <group expand="0" string="Group By...">
766 <filter string="Manager" name="Manager" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}"/>
767 <filter string="Contact" name="Partner" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/>
768
769=== modified file 'project/report/project_report_view.xml'
770--- project/report/project_report_view.xml 2012-11-29 22:26:45 +0000
771+++ project/report/project_report_view.xml 2013-04-20 02:28:27 +0000
772@@ -69,7 +69,7 @@
773 <filter icon="terp-personal-" string="Non Assigned Tasks to users" help="Non Assigned Tasks to users" domain="[('user_id','=',False)]"/>
774 <field name="project_id"/>
775 <field name="user_id"/>
776- <field name="partner_id" />
777+ <field name="partner_id" filter_domain="[('partner_id', 'child_of', self)]"/>
778 <group expand="0" string="Extended Filters...">
779 <field name="priority"/>
780 <field name="company_id" groups="base.group_multi_company"/>
781
782=== modified file 'project_issue/project_issue_view.xml'
783--- project_issue/project_issue_view.xml 2013-02-26 15:16:04 +0000
784+++ project_issue/project_issue_view.xml 2013-04-20 02:28:27 +0000
785@@ -139,7 +139,7 @@
786 <field name="model">project.issue</field>
787 <field name="arch" type="xml">
788 <search string="Issue Tracker Search">
789- <field name="name" string="Issue" filter_domain="['|', '|',('partner_id','ilike',self),('email_from','ilike',self),('name','ilike',self)]"/>
790+ <field name="name" string="Issue" filter_domain="['|', '|',('partner_id','child_of',self),('email_from','ilike',self),('name','ilike',self)]"/>
791 <field name="id"/>
792 <filter icon="terp-mail-message-new" string="Unread Messages" name="message_unread" domain="[('message_unread','=',True)]"/>
793 <separator/>
794@@ -150,6 +150,7 @@
795 <field name="user_id"/>
796 <field name="project_id"/>
797 <field name="categ_ids"/>
798+ <field name="partner_id" filter_domain="[('partner_id', 'child_of', self)]"/>
799 <group expand="0" string="Group By..." >
800 <filter string="Responsible" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}"/>
801 <filter string="Contact" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/>
802
803=== modified file 'project_issue/report/project_issue_report_view.xml'
804--- project_issue/report/project_issue_report_view.xml 2012-11-29 22:26:45 +0000
805+++ project_issue/report/project_issue_report_view.xml 2013-04-20 02:28:27 +0000
806@@ -55,7 +55,7 @@
807 <filter icon="terp-dialog-close" string="Done" domain="[('state','=','done')]"/>
808 <field name="project_id"/>
809 <field name="user_id"/>
810- <field name="partner_id"/>
811+ <field name="partner_id" filter_domain="[('partner_id', 'child_of', self)]"/>
812 <field name="version_id"/>
813 <group expand="1" string="Group By...">
814 <filter string="Assigned to" name="Responsible" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}" />
815
816=== modified file 'purchase/partner.py'
817--- purchase/partner.py 2012-12-06 14:56:32 +0000
818+++ purchase/partner.py 2013-04-20 02:28:27 +0000
819@@ -43,6 +43,9 @@
820
821 super(res_partner, self).copy(cr, uid, id, default=default, context=context)
822
823+ def _commercial_fields(self, cr, uid, context=None):
824+ return super(res_partner, self)._commercial_fields(cr, uid, context=context) + ['property_product_pricelist_purchase']
825+
826 _columns = {
827 'property_product_pricelist_purchase': fields.property(
828 'product.pricelist',
829
830=== modified file 'purchase/purchase_view.xml'
831--- purchase/purchase_view.xml 2013-04-17 10:00:49 +0000
832+++ purchase/purchase_view.xml 2013-04-20 02:28:27 +0000
833@@ -270,7 +270,7 @@
834 <filter icon="terp-emblem-important" name="exception" string="Exception" domain="[('state','in',('except_invoice','except_picking'))]" help="Purchase order which are in the exception state"/>
835 <separator/>
836 <filter icon="terp-gtk-go-back-rtl" name="not_invoiced" string="Not Invoiced" domain="[('invoice_ids','=', False)]" help="Purchase orders that include lines not invoiced."/>
837- <field name="partner_id"/>
838+ <field name="partner_id" filter_domain="[('partner_id', 'child_of', self)]"/>
839 <field name="product_id"/>
840 <field name="create_uid"/>
841 <group expand="0" string="Group By...">
842@@ -297,7 +297,7 @@
843 <filter icon="terp-emblem-important" name="exception" string="Exception" domain="[('state','in',('except_invoice','except_picking'))]" help="Purchase orders which are in exception state"/>
844 <separator/>
845 <filter icon="terp-gtk-go-back-rtl" name="not_invoiced" string="Not Invoiced" domain="[('invoice_ids','=', False)]" help="Purchase orders that include lines not invoiced."/>
846- <field name="partner_id"/>
847+ <field name="partner_id" filter_domain="[('partner_id', 'child_of', self)]"/>
848 <field name="product_id"/>
849 <field name="create_uid"/>
850 <group expand="0" string="Group By...">
851@@ -481,7 +481,7 @@
852 <search string="Search Purchase Order">
853 <field name="order_id"/>
854 <field name="product_id"/>
855- <field name="partner_id" string="Supplier"/>
856+ <field name="partner_id" string="Supplier" filter_domain="[('partner_id', 'child_of', self)]"/>
857 <group expand="0" string="Group By...">
858 <filter string="Supplier" icon="terp-partner" domain="[]" context="{'group_by' : 'partner_id'}" />
859 <filter string="Product" icon="terp-accessories-archiver" domain="[]" context="{'group_by' : 'product_id'}" />
860
861=== modified file 'sale/res_partner_view.xml'
862--- sale/res_partner_view.xml 2012-12-20 11:43:56 +0000
863+++ sale/res_partner_view.xml 2013-04-20 02:28:27 +0000
864@@ -63,14 +63,34 @@
865 <field name="arch" type="xml">
866 <xpath expr="//label[@for='type']" position="attributes">
867 <attribute name="groups">sale.group_delivery_invoice_address</attribute>
868- </xpath>
869- <xpath expr="//label[@for='type']" position="attributes">
870- <attribute name="invisible">False</attribute>
871- </xpath>
872- <xpath expr="//div[@name='div_type']" position="attributes">
873- <attribute name="invisible">False</attribute>
874- </xpath>
875- <xpath expr="//div[@name='div_type']" position="attributes">
876+ <attribute name="invisible">False</attribute>
877+ </xpath>
878+ <xpath expr="//div[@name='div_type']" position="attributes">
879+ <attribute name="invisible">False</attribute>
880+ <attribute name="groups">sale.group_delivery_invoice_address</attribute>
881+ </xpath>
882+ <xpath expr="//field[@name='use_parent_address']" position="attributes">
883+ <attribute name="invisible">False</attribute>
884+ <attribute name="groups">sale.group_delivery_invoice_address</attribute>
885+ </xpath>
886+ <xpath expr="//label[@for='use_parent_address']" position="attributes">
887+ <attribute name="invisible">False</attribute>
888+ <attribute name="groups">sale.group_delivery_invoice_address</attribute>
889+ </xpath>
890+ <xpath expr="//field[@name='child_ids']//field[@name='use_parent_address']" position="attributes">
891+ <attribute name="invisible">False</attribute>
892+ <attribute name="groups">sale.group_delivery_invoice_address</attribute>
893+ </xpath>
894+ <xpath expr="//field[@name='child_ids']//label[@for='use_parent_address']" position="attributes">
895+ <attribute name="invisible">False</attribute>
896+ <attribute name="groups">sale.group_delivery_invoice_address</attribute>
897+ </xpath>
898+ <xpath expr="//field[@name='child_ids']//div[@name='div_type']" position="attributes">
899+ <attribute name="invisible">False</attribute>
900+ <attribute name="groups">sale.group_delivery_invoice_address</attribute>
901+ </xpath>
902+ <xpath expr="//field[@name='child_ids']//label[@for='type']" position="attributes">
903+ <attribute name="invisible">False</attribute>
904 <attribute name="groups">sale.group_delivery_invoice_address</attribute>
905 </xpath>
906 </field>
907
908=== modified file 'sale/sale.py'
909--- sale/sale.py 2013-04-18 16:36:16 +0000
910+++ sale/sale.py 2013-04-20 02:28:27 +0000
911@@ -314,10 +314,6 @@
912 return {'value': {'partner_invoice_id': False, 'partner_shipping_id': False, 'payment_term': False, 'fiscal_position': False}}
913
914 part = self.pool.get('res.partner').browse(cr, uid, part, context=context)
915- #if the chosen partner is not a company and has a parent company, use the parent to choose the delivery, the
916- #invoicing addresses and all the fields related to the partner.
917- if part.parent_id and not part.is_company:
918- part = part.parent_id
919 addr = self.pool.get('res.partner').address_get(cr, uid, [part.id], ['delivery', 'invoice', 'contact'])
920 pricelist = part.property_product_pricelist and part.property_product_pricelist.id or False
921 payment_term = part.property_payment_term and part.property_payment_term.id or False
922
923=== modified file 'sale/sale_view.xml'
924--- sale/sale_view.xml 2013-04-18 17:20:22 +0000
925+++ sale/sale_view.xml 2013-04-20 02:28:27 +0000
926@@ -156,7 +156,7 @@
927 <field name="partner_id" on_change="onchange_partner_id(partner_id, context)" domain="[('customer','=',True)]" context="{'search_default_customer':1, 'show_address': 1}" options='{"always_reload": True}'/>
928 <field name="partner_invoice_id" groups="sale.group_delivery_invoice_address" context="{'default_type':'invoice'}"/>
929 <field name="partner_shipping_id" groups="sale.group_delivery_invoice_address" context="{'default_type':'delivery'}"/>
930- <field name="project_id" context="{'partner_id':partner_id, 'default_pricelist_id':pricelist_id, 'default_name':name, 'default_type': 'contract'}" groups="sale.group_analytic_accounting" domain="[('type','in',['view','normal','contract'])]"/>
931+ <field name="project_id" context="{'partner_id':partner_invoice_id, 'default_pricelist_id':pricelist_id, 'default_name':name, 'default_type': 'contract'}" groups="sale.group_analytic_accounting" domain="[('type','in',['view','normal','contract'])]"/>
932 </group>
933 <group>
934 <field name="date_order"/>
935@@ -308,7 +308,7 @@
936 <filter icon="terp-dolar_ok!" string="Done" domain="[('state','=','done')]" help="Sales Order done"/>
937 <separator/>
938 <filter string="My Sales Orders" domain="[('user_id','=',uid)]" help="My Sales Orders" icon="terp-personal" name="my_sale_orders_filter"/>
939- <field name="partner_id"/>
940+ <field name="partner_id" filter_domain="[('partner_id', 'child_of', self)]"/>
941 <field name="user_id"/>
942 <field name="project_id"/>
943 <group expand="0" string="Group By...">
944@@ -472,7 +472,7 @@
945 <separator/>
946 <filter string="My Sales Order Lines" icon="terp-personnal" domain="[('salesman_id','=',uid)]" help="Sales Order Lines related to a Sales Order of mine"/>
947 <field name="order_id"/>
948- <field name="order_partner_id"/>
949+ <field name="order_partner_id" filter_domain="[('order_partner_id', 'child_of', self)]"/>
950 <field name="product_id"/>
951 <field name="salesman_id"/>
952 <group expand="0" string="Group By...">
953@@ -498,7 +498,7 @@
954 <separator/>
955 <filter string="My Sales Order Lines" icon="terp-personal" domain="[('salesman_id','=',uid)]" help="My Sales Order Lines"/>
956 <field name="order_id"/>
957- <field name="order_partner_id"/>
958+ <field name="order_partner_id" filter_domain="[('order_partner_id', 'child_of', self)]"/>
959 <field name="product_id"/>
960 <field name="salesman_id"/>
961 <group expand="0" string="Group By...">
962
963=== modified file 'sale_journal/sale_journal.py'
964--- sale_journal/sale_journal.py 2012-12-06 14:56:32 +0000
965+++ sale_journal/sale_journal.py 2013-04-20 02:28:27 +0000
966@@ -52,6 +52,10 @@
967 group_name = "Accounting Properties",
968 help = "This invoicing type will be used, by default, to invoice the current partner."),
969 }
970+
971+ def _commercial_fields(self, cr, uid, context=None):
972+ return super(res_partner, self)._commercial_fields(cr, uid, context=context) + ['property_invoice_type']
973+
974 res_partner()
975
976 class picking(osv.osv):
977
978=== modified file 'sale_journal/sale_journal_view.xml'
979--- sale_journal/sale_journal_view.xml 2012-12-16 15:58:43 +0000
980+++ sale_journal/sale_journal_view.xml 2013-04-20 02:28:27 +0000
981@@ -146,7 +146,7 @@
982 <field name="inherit_id" ref="base.view_partner_form"/>
983 <field name="arch" type="xml">
984 <page string="Sales &amp; Purchases" position="inside">
985- <group colspan="2" col="2">
986+ <group colspan="2" col="2" attrs="{'invisible': [('is_company','=',False),('parent_id','!=',False)]}">
987 <separator string="Invoicing" colspan="2"/>
988 <field name="property_invoice_type"/>
989 </group>
990
991=== modified file 'sale_stock/stock.py'
992--- sale_stock/stock.py 2012-12-21 16:48:08 +0000
993+++ sale_stock/stock.py 2013-04-20 02:28:27 +0000
994@@ -53,7 +53,7 @@
995 We select the partner of the sales order as the partner of the customer invoice
996 """
997 if picking.sale_id:
998- return picking.sale_id.partner_id
999+ return picking.sale_id.partner_invoice_id
1000 return super(stock_picking, self)._get_partner_to_invoice(cr, uid, picking, context=context)
1001
1002 def _get_comment_invoice(self, cursor, user, picking):
1003
1004=== modified file 'sale_stock/test/picking_order_policy.yml'
1005--- sale_stock/test/picking_order_policy.yml 2013-04-04 12:31:54 +0000
1006+++ sale_stock/test/picking_order_policy.yml 2013-04-20 02:28:27 +0000
1007@@ -5,6 +5,12 @@
1008 -
1009 !assert {model: sale.order, id: sale.sale_order_6, string: The amount of the Quotation is not correctly computed}:
1010 - sum([l.price_subtotal for l in order_line]) == amount_untaxed
1011+-
1012+ I set an explicit invoicing partner that is different from the main SO Customer
1013+-
1014+ !python {model: sale.order, id: sale.sale_order_6}: |
1015+ order = self.browse(cr, uid, ref("sale.sale_order_6"))
1016+ order.write({'partner_invoice_id': ref('base.res_partner_address_29')})
1017 -
1018 I confirm the quotation with Invoice based on deliveries policy.
1019 -
1020@@ -110,13 +116,13 @@
1021 !python {model: sale.order}: |
1022 order = self.browse(cr, uid, ref("sale.sale_order_6"))
1023 assert order.invoice_ids, "Invoice is not created."
1024- ac = order.partner_id.property_account_receivable.id
1025+ ac = order.partner_invoice_id.property_account_receivable.id
1026 journal_ids = self.pool.get('account.journal').search(cr, uid, [('type', '=', 'sale'), ('company_id', '=', order.company_id.id)])
1027 for invoice in order.invoice_ids:
1028 assert invoice.type == 'out_invoice',"Invoice should be Customer Invoice."
1029 assert invoice.account_id.id == ac,"Invoice account is not correspond."
1030 assert invoice.reference == order.client_order_ref or order.name,"Reference is not correspond."
1031- assert invoice.partner_id.id == order.partner_id.id,"Customer is not correspond."
1032+ assert invoice.partner_id.id == order.partner_invoice_id.id,"Customer does not correspond."
1033 assert invoice.currency_id.id == order.pricelist_id.currency_id.id, "Currency is not correspond."
1034 assert invoice.comment == (order.note or ''),"Note is not correspond."
1035 assert invoice.journal_id.id in journal_ids,"Sales Journal is not link on Invoice."
1036
1037=== modified file 'stock/report/report_stock_move_view.xml'
1038--- stock/report/report_stock_move_view.xml 2012-11-29 22:26:45 +0000
1039+++ stock/report/report_stock_move_view.xml 2013-04-20 02:28:27 +0000
1040@@ -149,7 +149,7 @@
1041 <field name="location_id" filter_domain="[('location_id', 'child_of', self)]"/>
1042 <field name="company_id" groups="base.group_multi_company"/>
1043 <group expand="0" string="Extended Filters...">
1044- <field name="partner_id" context="{'contact_display':'partner'}"/>
1045+ <field name="partner_id" context="{'contact_display':'partner'}" filter_domain="[('partner_id', 'child_of', self)]"/>
1046 <field name="product_categ_id" />
1047 <field name="prodlot_id"/>
1048 <field name="state"/>
1049
1050=== modified file 'stock/stock_view.xml'
1051--- stock/stock_view.xml 2013-03-18 13:43:43 +0000
1052+++ stock/stock_view.xml 2013-04-20 02:28:27 +0000
1053@@ -807,7 +807,7 @@
1054 <filter icon="terp-check" name="available" string="Ready" domain="[('state','=','assigned')]" help="Assigned Internal Moves"/>
1055 <filter icon="terp-camera_test" name="confirmed" string="Waiting" domain="[('state','=','confirmed')]" help="Confirmed Internal Moves"/>
1056 <filter icon="terp-dialog-close" name="done" string="Done" domain="[('state','=','done')]" help="Pickings already processed"/>
1057- <field name="partner_id"/>
1058+ <field name="partner_id" filter_domain="[('partner_id','child_of',self)]"/>
1059 <field name="product_id"/>
1060 <field name="stock_journal_id"/>
1061 <group expand="0" string="Group By...">
1062@@ -934,6 +934,7 @@
1063 <filter icon="terp-accessories-archiver-minus" string="Back Orders" domain="[('backorder_id', '!=', False)]" help="Is a Back Order"/>
1064 <separator/>
1065 <filter icon="terp-dolar" name="to_invoice" string="To Invoice" domain="[('invoice_state','=','2binvoiced')]" help="Delivery orders to invoice"/>
1066+ <field name="partner_id" filter_domain="[('partner_id','child_of',self)]"/>
1067 <field name="stock_journal_id"/>
1068 <field name="company_id" groups="base.group_multi_company"/>
1069 <group expand="0" string="Group By...">
1070@@ -1059,6 +1060,7 @@
1071 <filter icon="terp-accessories-archiver-minus" string="Back Orders" domain="[('backorder_id', '!=', False)]" help="Is a Back Order"/>
1072 <separator/>
1073 <filter string="To Invoice" name="to_invoice" icon="terp-dolar" domain="[('invoice_state', '=', '2binvoiced')]"/>
1074+ <field name="partner_id" filter_domain="[('partner_id','child_of',self)]"/>
1075 <field name="stock_journal_id"/>
1076 <field name="product_id"/>
1077 <group expand="0" string="Group By...">
1078@@ -1370,7 +1372,7 @@
1079 <filter icon="terp-go-today" string="Today" domain="[('date','&lt;=',time.strftime('%%Y-%%m-%%d 23:59:59')),('date','&gt;=',time.strftime('%%Y-%%m-%%d 00:00:00'))]" help="Orders processed Today or planned for Today"/>
1080 <field name="product_id"/>
1081 <field name="name" string="Location" filter_domain="['|',('location_id','ilike',self),('location_dest_id','ilike',self)]"/>
1082- <field name="partner_id" string="Partner" filter_domain="[('picking_id.partner_id','ilike',self)]"/>
1083+ <field name="partner_id" string="Partner" filter_domain="[('picking_id.partner_id','child_of',self)]"/>
1084 <field name="prodlot_id"/>
1085 <group expand="0" string="Group By...">
1086 <filter string="Product" name="by_product" icon="terp-accessories-archiver" domain="[]" context="{'group_by':'product_id'}"/>