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

Proposed by Olivier Dony (Odoo)
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
Joël Grand-Guillaume @ camptocamp (community) test, no code review Needs Fixing
Stefan Rijnhart (Opener) (community) Disapprove
OpenERP Core Team 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.
Revision history for this message
Joël Grand-Guillaume @ camptocamp (jgrandguillaume-c2c) wrote :

Hi,

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

Regards,

Joël

Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote :

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
Revision history for this message
Joël Grand-Guillaume @ camptocamp (jgrandguillaume-c2c) wrote :

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)
Revision history for this message
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.

Revision history for this message
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
Revision history for this message
Joël Grand-Guillaume @ camptocamp (jgrandguillaume-c2c) wrote :

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)
Revision history for this message
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...

Revision history for this message
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
Revision history for this message
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.

Revision history for this message
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...

Revision history for this message
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
=== modified file 'account/account_invoice.py'
--- account/account_invoice.py 2013-03-29 15:59:38 +0000
+++ account/account_invoice.py 2013-04-20 02:28:27 +0000
@@ -1260,9 +1260,7 @@
1260 ref = invoice.reference1260 ref = invoice.reference
1261 else:1261 else:
1262 ref = self._convert_ref(cr, uid, invoice.number)1262 ref = self._convert_ref(cr, uid, invoice.number)
1263 partner = invoice.partner_id1263 partner = self.pool['res.partner']._find_accounting_partner(invoice.partner_id)
1264 if partner.parent_id and not partner.is_company:
1265 partner = partner.parent_id
1266 # Pay attention to the sign for both debit/credit AND amount_currency1264 # Pay attention to the sign for both debit/credit AND amount_currency
1267 l1 = {1265 l1 = {
1268 'debit': direction * pay_amount>0 and direction * pay_amount,1266 'debit': direction * pay_amount>0 and direction * pay_amount,
@@ -1733,15 +1731,17 @@
1733 'invoice_ids': fields.one2many('account.invoice.line', 'partner_id', 'Invoices', readonly=True),1731 'invoice_ids': fields.one2many('account.invoice.line', 'partner_id', 'Invoices', readonly=True),
1734 }1732 }
17351733
1736 def _find_accounting_partner(self, part):1734 def _find_accounting_partner(self, partner):
1737 '''1735 '''
1738 Find the partner for which the accounting entries will be created1736 Find the partner for which the accounting entries will be created
1739 '''1737 '''
1738 # FIXME: after 7.0, to replace by function field partner.commercial_partner_id
1739
1740 #if the chosen partner is not a company and has a parent company, use the parent for the journal entries1740 #if the chosen partner is not a company and has a parent company, use the parent for the journal entries
1741 #because you want to invoice 'Agrolait, accounting department' but the journal items are for 'Agrolait'1741 #because you want to invoice 'Agrolait, accounting department' but the journal items are for 'Agrolait'
1742 if part.parent_id and not part.is_company:1742 while not partner.is_company and partner.parent_id:
1743 part = part.parent_id1743 partner = partner.parent_id
1744 return part1744 return partner
17451745
1746 def copy(self, cr, uid, id, default=None, context=None):1746 def copy(self, cr, uid, id, default=None, context=None):
1747 default = default or {}1747 default = default or {}
17481748
=== modified file 'account/account_invoice_view.xml'
--- account/account_invoice_view.xml 2013-03-13 12:43:17 +0000
+++ account/account_invoice_view.xml 2013-04-20 02:28:27 +0000
@@ -320,7 +320,8 @@
320 <field string="Customer" name="partner_id"320 <field string="Customer" name="partner_id"
321 on_change="onchange_partner_id(type,partner_id,date_invoice,payment_term, partner_bank_id,company_id)"321 on_change="onchange_partner_id(type,partner_id,date_invoice,payment_term, partner_bank_id,company_id)"
322 groups="base.group_user" context="{'search_default_customer':1, 'show_address': 1}"322 groups="base.group_user" context="{'search_default_customer':1, 'show_address': 1}"
323 options='{"always_reload": True}'/>323 options='{"always_reload": True}'
324 domain="[('customer', '=', True)]"/>
324 <field name="fiscal_position" widget="selection" />325 <field name="fiscal_position" widget="selection" />
325 </group>326 </group>
326 <group>327 <group>
@@ -447,14 +448,14 @@
447 <field name="model">account.invoice</field>448 <field name="model">account.invoice</field>
448 <field name="arch" type="xml">449 <field name="arch" type="xml">
449 <search string="Search Invoice">450 <search string="Search Invoice">
450 <field name="number" string="Invoice" filter_domain="['|','|','|', ('number','ilike',self), ('origin','ilike',self), ('supplier_invoice_number', 'ilike', self), ('partner_id', 'ilike', self)]"/>451 <field name="number" string="Invoice" filter_domain="['|','|','|', ('number','ilike',self), ('origin','ilike',self), ('supplier_invoice_number', 'ilike', self), ('partner_id', 'child_of', self)]"/>
451 <filter name="draft" string="Draft" domain="[('state','=','draft')]" help="Draft Invoices"/>452 <filter name="draft" string="Draft" domain="[('state','=','draft')]" help="Draft Invoices"/>
452 <filter name="proforma" string="Proforma" domain="[('state','=','proforma2')]" help="Proforma Invoices" groups="account.group_proforma_invoices"/>453 <filter name="proforma" string="Proforma" domain="[('state','=','proforma2')]" help="Proforma Invoices" groups="account.group_proforma_invoices"/>
453 <filter name="invoices" string="Invoices" domain="[('state','not in',['draft','cancel'])]" help="Proforma/Open/Paid Invoices"/>454 <filter name="invoices" string="Invoices" domain="[('state','not in',['draft','cancel'])]" help="Proforma/Open/Paid Invoices"/>
454 <filter name="unpaid" string="Unpaid" domain="[('state','=','open')]" help="Unpaid Invoices"/>455 <filter name="unpaid" string="Unpaid" domain="[('state','=','open')]" help="Unpaid Invoices"/>
455 <separator/>456 <separator/>
456 <filter domain="[('user_id','=',uid)]" help="My Invoices" icon="terp-personal"/>457 <filter domain="[('user_id','=',uid)]" help="My Invoices" icon="terp-personal"/>
457 <field name="partner_id"/>458 <field name="partner_id" filter_domain="[('partner_id', 'child_of', self)]"/>
458 <field name="user_id" string="Salesperson"/>459 <field name="user_id" string="Salesperson"/>
459 <field name="period_id" string="Period"/>460 <field name="period_id" string="Period"/>
460 <group expand="0" string="Group By...">461 <group expand="0" string="Group By...">
461462
=== modified file 'account/partner.py'
--- account/partner.py 2013-03-20 13:50:52 +0000
+++ account/partner.py 2013-04-20 02:28:27 +0000
@@ -236,6 +236,11 @@
236 '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.')236 '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.')
237 }237 }
238238
239 def _commercial_fields(self, cr, uid, context=None):
240 return super(res_partner, self)._commercial_fields(cr, uid, context=context) + \
241 ['debit_limit', 'property_account_payable', 'property_account_receivable', 'property_account_position',
242 'property_payment_term', 'property_supplier_payment_term', 'last_reconciliation_date']
243
239res_partner()244res_partner()
240245
241# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:246# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
242247
=== modified file 'account/partner_view.xml'
--- account/partner_view.xml 2013-02-25 14:10:14 +0000
+++ account/partner_view.xml 2013-04-20 02:28:27 +0000
@@ -73,7 +73,7 @@
73 <field name="inherit_id" ref="base.view_partner_form"/>73 <field name="inherit_id" ref="base.view_partner_form"/>
74 <field name="arch" type="xml">74 <field name="arch" type="xml">
75 <page string="History" position="before" version="7.0">75 <page string="History" position="before" version="7.0">
76 <page string="Accounting" col="4">76 <page string="Accounting" col="4" name="accounting" attrs="{'invisible': [('is_company','=',False),('parent_id','!=',False)]}">
77 <group>77 <group>
78 <group>78 <group>
79 <field name="property_account_position" widget="selection"/>79 <field name="property_account_position" widget="selection"/>
@@ -103,6 +103,11 @@
103 </tree>103 </tree>
104 </field>104 </field>
105 </page>105 </page>
106 <page string="Accounting" name="accounting_disabled" attrs="{'invisible': ['|',('is_company','=',True),('parent_id','=',False)]}">
107 <div>
108 <p>Accounting-related settings are managed on <button name="open_commercial_entity" type="object" string="the parent company" class="oe_link"/></p>
109 </div>
110 </page>
106 </page>111 </page>
107 </field>112 </field>
108 </record>113 </record>
109114
=== modified file 'account/project/project_view.xml'
--- account/project/project_view.xml 2013-03-12 12:33:21 +0000
+++ account/project/project_view.xml 2013-04-20 02:28:27 +0000
@@ -31,7 +31,7 @@
31 <search string="Analytic Account">31 <search string="Analytic Account">
32 <field name="name" filter_domain="['|', ('name','ilike',self), ('code','ilike',self)]" string="Analytic Account"/>32 <field name="name" filter_domain="['|', ('name','ilike',self), ('code','ilike',self)]" string="Analytic Account"/>
33 <field name="date"/>33 <field name="date"/>
34 <field name="partner_id"/>34 <field name="partner_id" filter_domain="[('partner_id','child_of',self)]"/>
35 <field name="manager_id"/>35 <field name="manager_id"/>
36 <field name="parent_id"/>36 <field name="parent_id"/>
37 <field name="user_id"/>37 <field name="user_id"/>
3838
=== modified file 'account_analytic_analysis/account_analytic_analysis_view.xml'
--- account_analytic_analysis/account_analytic_analysis_view.xml 2013-03-14 16:13:27 +0000
+++ account_analytic_analysis/account_analytic_analysis_view.xml 2013-04-20 02:28:27 +0000
@@ -186,7 +186,7 @@
186 <search string="Contracts">186 <search string="Contracts">
187 <field name="name" filter_domain="['|', ('name','ilike',self),('code','ilike',self)]" string="Contract"/>187 <field name="name" filter_domain="['|', ('name','ilike',self),('code','ilike',self)]" string="Contract"/>
188 <field name="date"/>188 <field name="date"/>
189 <field name="partner_id"/>189 <field name="partner_id" filter_domain="[('partner_id','child_of',self)]"/>
190 <field name="manager_id"/>190 <field name="manager_id"/>
191 <field name="parent_id"/>191 <field name="parent_id"/>
192 <filter name="open" string="In Progress" domain="[('state','in',('open','draft'))]" help="Contracts in progress (open, draft)"/>192 <filter name="open" string="In Progress" domain="[('state','in',('open','draft'))]" help="Contracts in progress (open, draft)"/>
193193
=== modified file 'account_asset/account_asset_view.xml'
--- account_asset/account_asset_view.xml 2012-12-08 10:33:38 +0000
+++ account_asset/account_asset_view.xml 2013-04-20 02:28:27 +0000
@@ -223,7 +223,7 @@
223 <filter icon="terp-check" string="Current" domain="[('state','in', ('draft','open'))]" help="Assets in draft and open states"/>223 <filter icon="terp-check" string="Current" domain="[('state','in', ('draft','open'))]" help="Assets in draft and open states"/>
224 <filter icon="terp-dialog-close" string="Closed" domain="[('state','=', 'close')]" help="Assets in closed state"/>224 <filter icon="terp-dialog-close" string="Closed" domain="[('state','=', 'close')]" help="Assets in closed state"/>
225 <field name="category_id"/>225 <field name="category_id"/>
226 <field name="partner_id"/>226 <field name="partner_id" filter_domain="[('partner_id','child_of',self)]"/>
227 </search>227 </search>
228 </field>228 </field>
229 </record>229 </record>
230230
=== modified file 'account_asset/report/account_asset_report_view.xml'
--- account_asset/report/account_asset_report_view.xml 2012-11-29 22:26:45 +0000
+++ account_asset/report/account_asset_report_view.xml 2013-04-20 02:28:27 +0000
@@ -49,7 +49,7 @@
49 <field name="asset_id"/>49 <field name="asset_id"/>
50 <field name="asset_category_id"/>50 <field name="asset_category_id"/>
51 <group expand="0" string="Extended Filters...">51 <group expand="0" string="Extended Filters...">
52 <field name="partner_id"/>52 <field name="partner_id" filter_domain="[('partner_id','child_of',self)]"/>
53 <field name="company_id" groups="base.group_multi_company"/>53 <field name="company_id" groups="base.group_multi_company"/>
54 </group>54 </group>
55 <group expand="1" string="Group By...">55 <group expand="1" string="Group By...">
5656
=== added directory 'account_report_company'
=== added file 'account_report_company/__init__.py'
--- account_report_company/__init__.py 1970-01-01 00:00:00 +0000
+++ account_report_company/__init__.py 2013-04-20 02:28:27 +0000
@@ -0,0 +1,25 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Business Applications
5# Copyright (c) 2013 OpenERP S.A. <http://openerp.com>
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22import account_report_company
23import report
24
25# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
026
=== added file 'account_report_company/__openerp__.py'
--- account_report_company/__openerp__.py 1970-01-01 00:00:00 +0000
+++ account_report_company/__openerp__.py 2013-04-20 02:28:27 +0000
@@ -0,0 +1,57 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Business Applications
5# Copyright (c) 2013 OpenERP S.A. <http://openerp.com>
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21{
22 'name': 'Invoice Analysis per Company',
23 'version': '1.0',
24 'category': 'Accounting & Finance',
25 'description': """
26Add an extra Company dimension on Invoices for consolidated Invoice Analysis
27============================================================================
28
29By default Customer and Supplier invoices can be linked to a contact within
30a company, but the company is not a direct reference in the database structure for
31invoices. Journal Entries are however always linked to the company and not to
32contacts, so that Accounts Payable and Receivable are always correct and consolidated
33at company level.
34
35When many different contacts/departments need to be invoiced within the same parent company,
36this can make reporting by Company more difficult: reports are directly based on the
37database structure and would not provide an aggregated company dimension.
38
39This modules solves the problem by adding an explicit company reference on invoices,
40automatically computed from the invoice contact, and use this new dimension
41when grouping the list of Invoices or the Invoice Analysis report by Partner.
42
43Note: this module will likely be removed for the next major OpenERP version and
44directly integrated in the core accounting.
45""",
46 'author': 'OpenERP SA',
47 'website': 'http://www.openerp.com',
48 'depends': ['account'],
49 'data': [
50 'account_invoice_view.xml',
51 'res_partner_view.xml',
52 'report/account_invoice_report_view.xml',
53 ],
54 'auto_install': True,
55}
56
57# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
058
=== added file 'account_report_company/account_invoice_view.xml'
--- account_report_company/account_invoice_view.xml 1970-01-01 00:00:00 +0000
+++ account_report_company/account_invoice_view.xml 2013-04-20 02:28:27 +0000
@@ -0,0 +1,24 @@
1<?xml version="1.0"?>
2<openerp>
3 <data>
4 <record model="ir.ui.view" id="account_report_company_tree_view">
5 <field name="model">account.invoice</field>
6 <field name="inherit_id" ref="account.invoice_tree"/>
7 <field name="arch" type="xml">
8 <field name="partner_id" position="after">
9 <field name="commercial_partner_id" invisible="1"/>
10 </field>
11 </field>
12 </record>
13
14 <record model="ir.ui.view" id="account_report_company_search_view">
15 <field name="model">account.invoice</field>
16 <field name="inherit_id" ref="account.view_account_invoice_filter"/>
17 <field name="arch" type="xml">
18 <filter string="Partner" position="replace">
19 <filter name="commercial_partner_id" string="Partner" domain="[]" context="{'group_by':'commercial_partner_id'}"/>
20 </filter>
21 </field>
22 </record>
23 </data>
24</openerp>
0\ No newline at end of file25\ No newline at end of file
126
=== added file 'account_report_company/account_report_company.py'
--- account_report_company/account_report_company.py 1970-01-01 00:00:00 +0000
+++ account_report_company/account_report_company.py 2013-04-20 02:28:27 +0000
@@ -0,0 +1,51 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Business Applications
5# Copyright (c) 2013 S.A. <http://openerp.com>
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22from openerp.osv import osv, fields
23
24class res_partner(osv.Model):
25 _inherit = 'res.partner'
26 _order = 'display_name'
27
28 def _display_name_compute(self, cr, uid, ids, name, args, context=None):
29 return dict(self.name_get(cr, uid, ids, context=context))
30
31 _display_name_store_triggers = {
32 'res.partner': (lambda self,cr,uid,ids,context=None: self.search(cr, uid, [('id','child_of',ids)]),
33 ['parent_id', 'is_company'], 10)
34 }
35
36 # indirection to avoid passing a copy of the overridable method when declaring the function field
37 _display_name = lambda self, *args, **kwargs: self._display_name_compute(*args, **kwargs)
38
39 _columns = {
40 # extra field to allow ORDER BY to match visible names
41 'display_name': fields.function(_display_name, type='char', string='Name', store=_display_name_store_triggers),
42 }
43
44class account_invoice(osv.Model):
45 _inherit = 'account.invoice'
46
47 _columns = {
48 'commercial_partner_id': fields.related('partner_id', 'commercial_partner_id', string='Commercial Entity', type='many2one',
49 relation='res.partner', store=True, readonly=True,
50 help="The commercial entity that will be used on Journal Entries for this invoice")
51 }
052
=== added directory 'account_report_company/report'
=== added file 'account_report_company/report/__init__.py'
--- account_report_company/report/__init__.py 1970-01-01 00:00:00 +0000
+++ account_report_company/report/__init__.py 2013-04-20 02:28:27 +0000
@@ -0,0 +1,24 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Business Applications
5# Copyright (c) 2013 OpenERP S.A. <http://openerp.com>
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22import account_invoice_report
23
24# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
025
=== added file 'account_report_company/report/account_invoice_report.py'
--- account_report_company/report/account_invoice_report.py 1970-01-01 00:00:00 +0000
+++ account_report_company/report/account_invoice_report.py 2013-04-20 02:28:27 +0000
@@ -0,0 +1,36 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Business Applications
5# Copyright (c) 2013 OpenERP S.A. <http://openerp.com>
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21from openerp.osv import osv, fields
22
23class account_invoice_report(osv.Model):
24 _inherit = 'account.invoice.report'
25 _columns = {
26 'commercial_partner_id': fields.many2one('res.partner', 'Partner Company', help="Commercial Entity"),
27 }
28
29 def _select(self):
30 return super(account_invoice_report, self)._select() + ", sub.commercial_partner_id as commercial_partner_id"
31
32 def _sub_select(self):
33 return super(account_invoice_report, self)._sub_select() + ", ai.commercial_partner_id as commercial_partner_id"
34
35 def _group_by(self):
36 return super(account_invoice_report, self)._group_by() + ", ai.commercial_partner_id"
037
=== added file 'account_report_company/report/account_invoice_report_view.xml'
--- account_report_company/report/account_invoice_report_view.xml 1970-01-01 00:00:00 +0000
+++ account_report_company/report/account_invoice_report_view.xml 2013-04-20 02:28:27 +0000
@@ -0,0 +1,24 @@
1<?xml version="1.0"?>
2<openerp>
3 <data>
4 <record model="ir.ui.view" id="account_report_company_invoice_report_tree_view">
5 <field name="model">account.invoice.report</field>
6 <field name="inherit_id" ref="account.view_account_invoice_report_tree"/>
7 <field name="arch" type="xml">
8 <field name="partner_id" position="after">
9 <field name="commercial_partner_id" invisible="1"/>
10 </field>
11 </field>
12 </record>
13
14 <record model="ir.ui.view" id="account_report_company_invoice_report_search_view">
15 <field name="model">account.invoice.report</field>
16 <field name="inherit_id" ref="account.view_account_invoice_report_search"/>
17 <field name="arch" type="xml">
18 <filter name="partner" position="replace">
19 <filter string="Partner" name="commercial_partner_id" context="{'group_by':'commercial_partner_id','residual_visible':True}"/>
20 </filter>
21 </field>
22 </record>
23 </data>
24</openerp>
0\ No newline at end of file25\ No newline at end of file
126
=== added file 'account_report_company/res_partner_view.xml'
--- account_report_company/res_partner_view.xml 1970-01-01 00:00:00 +0000
+++ account_report_company/res_partner_view.xml 2013-04-20 02:28:27 +0000
@@ -0,0 +1,24 @@
1<?xml version="1.0"?>
2<openerp>
3 <data>
4 <record model="ir.ui.view" id="account_report_copmany_partner_tree_view">
5 <field name="model">res.partner</field>
6 <field name="inherit_id" ref="base.view_partner_tree"/>
7 <field name="arch" type="xml">
8 <field name="name" position="replace">
9 <field name="display_name"/>
10 </field>
11 </field>
12 </record>
13
14 <record model="ir.ui.view" id="account_report_copmany_partner_kanban_view">
15 <field name="model">res.partner</field>
16 <field name="inherit_id" ref="base.res_partner_kanban_view"/>
17 <field name="arch" type="xml">
18 <xpath expr="//templates//field[@name='name']" position="replace">
19 <field name="display_name"/>
20 </xpath>
21 </field>
22 </record>
23 </data>
24</openerp>
0\ No newline at end of file25\ No newline at end of file
126
=== modified file 'account_voucher/account_voucher_view.xml'
--- account_voucher/account_voucher_view.xml 2013-02-25 13:38:04 +0000
+++ account_voucher/account_voucher_view.xml 2013-04-20 02:28:27 +0000
@@ -129,7 +129,7 @@
129 <filter icon="terp-camera_test" string="Posted" domain="[('state','=','posted')]" help="Posted Vouchers"/>129 <filter icon="terp-camera_test" string="Posted" domain="[('state','=','posted')]" help="Posted Vouchers"/>
130 <separator/>130 <separator/>
131 <filter icon="terp-gtk-jump-to-ltr" string="To Review" domain="[('state','=','posted'), ('audit','=',False)]" help="To Review"/>131 <filter icon="terp-gtk-jump-to-ltr" string="To Review" domain="[('state','=','posted'), ('audit','=',False)]" help="To Review"/>
132 <field name="partner_id"/>132 <field name="partner_id" filter_domain="[('partner_id', 'child_of', self)]"/>
133 <field name="journal_id" context="{'journal_id': self, 'set_visible':False}" />133 <field name="journal_id" context="{'journal_id': self, 'set_visible':False}" />
134 <field name="period_id"/>134 <field name="period_id"/>
135 <group expand="0" string="Group By...">135 <group expand="0" string="Group By...">
136136
=== modified file 'account_voucher/voucher_payment_receipt_view.xml'
--- account_voucher/voucher_payment_receipt_view.xml 2013-02-25 13:38:04 +0000
+++ account_voucher/voucher_payment_receipt_view.xml 2013-04-20 02:28:27 +0000
@@ -11,7 +11,7 @@
11 <field name="date"/>11 <field name="date"/>
12 <filter icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Draft Vouchers"/>12 <filter icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Draft Vouchers"/>
13 <filter icon="terp-camera_test" string="Posted" domain="[('state','=','posted')]" help="Posted Vouchers"/>13 <filter icon="terp-camera_test" string="Posted" domain="[('state','=','posted')]" help="Posted Vouchers"/>
14 <field name="partner_id" string="Customer"/>14 <field name="partner_id" string="Customer" filter_domain="[('partner_id','child_of',self)]"/>
15 <field name="journal_id" context="{'journal_id': self, 'set_visible':False}" domain="[('type','in',('bank','cash'))]"/>15 <field name="journal_id" context="{'journal_id': self, 'set_visible':False}" domain="[('type','in',('bank','cash'))]"/>
16 <field name="period_id"/>16 <field name="period_id"/>
17 <group expand="0" string="Group By...">17 <group expand="0" string="Group By...">
@@ -34,7 +34,7 @@
34 <field name="date"/>34 <field name="date"/>
35 <filter icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Draft Vouchers"/>35 <filter icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Draft Vouchers"/>
36 <filter icon="terp-camera_test" string="Posted" domain="[('state','=','posted')]" help="Posted Vouchers"/>36 <filter icon="terp-camera_test" string="Posted" domain="[('state','=','posted')]" help="Posted Vouchers"/>
37 <field name="partner_id" string="Supplier"/>37 <field name="partner_id" string="Supplier" filter_domain="[('partner_id','child_of',self)]"/>
38 <field name="journal_id" context="{'journal_id': self, 'set_visible':False}" domain="[('type','in',('bank','cash'))]"/>38 <field name="journal_id" context="{'journal_id': self, 'set_visible':False}" domain="[('type','in',('bank','cash'))]"/>
39 <field name="period_id"/>39 <field name="period_id"/>
40 <group expand="0" string="Group By...">40 <group expand="0" string="Group By...">
4141
=== modified file 'account_voucher/voucher_sales_purchase_view.xml'
--- account_voucher/voucher_sales_purchase_view.xml 2013-02-25 14:20:35 +0000
+++ account_voucher/voucher_sales_purchase_view.xml 2013-04-20 02:28:27 +0000
@@ -10,7 +10,7 @@
10 <field name="date"/>10 <field name="date"/>
11 <filter icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Draft Vouchers"/>11 <filter icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Draft Vouchers"/>
12 <filter icon="terp-camera_test" string="Posted" domain="[('state','=','posted')]" help="Posted Vouchers"/>12 <filter icon="terp-camera_test" string="Posted" domain="[('state','=','posted')]" help="Posted Vouchers"/>
13 <field name="partner_id" string="Supplier"/>13 <field name="partner_id" string="Supplier" filter_domain="[('partner_id','child_of',self)]"/>
14 <field name="journal_id" context="{'journal_id': self, 'set_visible':False}" domain="[('type','in',('purchase','purchase_refund'))]"/>14 <field name="journal_id" context="{'journal_id': self, 'set_visible':False}" domain="[('type','in',('purchase','purchase_refund'))]"/>
15 <field name="period_id"/>15 <field name="period_id"/>
16 <group expand="0" string="Group By...">16 <group expand="0" string="Group By...">
@@ -32,7 +32,7 @@
32 <field name="date"/>32 <field name="date"/>
33 <filter icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Draft Vouchers"/>33 <filter icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Draft Vouchers"/>
34 <filter icon="terp-camera_test" string="Posted" domain="[('state','=','posted')]" help="Posted Vouchers"/>34 <filter icon="terp-camera_test" string="Posted" domain="[('state','=','posted')]" help="Posted Vouchers"/>
35 <field name="partner_id" string="Customer"/>35 <field name="partner_id" string="Customer" filter_domain="[('partner_id','child_of',self)]"/>
36 <field name="journal_id" context="{'journal_id': self, 'set_visible':False}" domain="[('type','in',('sale','sale_refund'))]"/>36 <field name="journal_id" context="{'journal_id': self, 'set_visible':False}" domain="[('type','in',('sale','sale_refund'))]"/>
37 <field name="period_id"/>37 <field name="period_id"/>
38 <group expand="0" string="Group By...">38 <group expand="0" string="Group By...">
3939
=== modified file 'base_vat/base_vat.py'
--- base_vat/base_vat.py 2012-12-18 17:55:47 +0000
+++ base_vat/base_vat.py 2013-04-20 02:28:27 +0000
@@ -134,6 +134,9 @@
134 '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.")134 '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.")
135 }135 }
136136
137 def _commercial_fields(self, cr, uid, context=None):
138 return super(res_partner, self)._commercial_fields(cr, uid, context=context) + ['vat_subjected']
139
137 def _construct_constraint_msg(self, cr, uid, ids, context=None):140 def _construct_constraint_msg(self, cr, uid, ids, context=None):
138 def default_vat_check(cn, vn):141 def default_vat_check(cn, vn):
139 # by default, a VAT number is valid if:142 # by default, a VAT number is valid if:
140143
=== modified file 'crm/crm_lead_view.xml'
--- crm/crm_lead_view.xml 2013-04-11 12:33:56 +0000
+++ crm/crm_lead_view.xml 2013-04-20 02:28:27 +0000
@@ -328,7 +328,7 @@
328 <field name="categ_ids" string="Category" filter_domain="[('categ_ids','ilike',self)]"/>328 <field name="categ_ids" string="Category" filter_domain="[('categ_ids','ilike',self)]"/>
329 <field name="section_id" context="{'invisible_section': False, 'default_section_id': self}"/>329 <field name="section_id" context="{'invisible_section': False, 'default_section_id': self}"/>
330 <field name="user_id"/>330 <field name="user_id"/>
331 <field name="partner_id"/>331 <field name="partner_id" filter_domain="[('partner_id','child_of',self)]"/>
332 <field name="create_date"/>332 <field name="create_date"/>
333 <field name="country_id" context="{'invisible_country': False}"/>333 <field name="country_id" context="{'invisible_country': False}"/>
334 <separator/>334 <separator/>
@@ -546,7 +546,7 @@
546 <field name="categ_ids" string="Category" filter_domain="[('categ_ids','ilike', self)]"/>546 <field name="categ_ids" string="Category" filter_domain="[('categ_ids','ilike', self)]"/>
547 <field name="section_id" context="{'invisible_section': False, 'default_section_id': self}"/>547 <field name="section_id" context="{'invisible_section': False, 'default_section_id': self}"/>
548 <field name="user_id"/>548 <field name="user_id"/>
549 <field name="partner_id"/>549 <field name="partner_id" filter_domain="[('partner_id','child_of',self)]"/>
550 <separator/>550 <separator/>
551 <filter string="New" name="new" domain="[('state','=','draft')]" help="New Opportunities"/>551 <filter string="New" name="new" domain="[('state','=','draft')]" help="New Opportunities"/>
552 <filter string="In Progress" name="open" domain="[('state','=','open')]" help="Open Opportunities"/>552 <filter string="In Progress" name="open" domain="[('state','=','open')]" help="Open Opportunities"/>
553553
=== modified file 'crm/crm_phonecall_view.xml'
--- crm/crm_phonecall_view.xml 2013-03-04 18:44:31 +0000
+++ crm/crm_phonecall_view.xml 2013-04-20 02:28:27 +0000
@@ -185,7 +185,7 @@
185 <separator/>185 <separator/>
186 <filter string="Phone Calls Assigned to Me or My Team(s)" icon="terp-personal+" domain="['|', ('section_id.user_id','=',uid), ('user_id', '=', uid)]"186 <filter string="Phone Calls Assigned to Me or My Team(s)" icon="terp-personal+" domain="['|', ('section_id.user_id','=',uid), ('user_id', '=', uid)]"
187 help="Phone Calls Assigned to the current user or with a team having the current user as team leader"/>187 help="Phone Calls Assigned to the current user or with a team having the current user as team leader"/>
188 <field name="partner_id"/>188 <field name="partner_id" filter_domain="[('partner_id','child_of',self)]"/>
189 <field name="user_id"/>189 <field name="user_id"/>
190 <field name="section_id" string="Sales Team"/>190 <field name="section_id" string="Sales Team"/>
191 <group expand="0" string="Group By...">191 <group expand="0" string="Group By...">
192192
=== modified file 'crm/report/crm_lead_report_view.xml'
--- crm/report/crm_lead_report_view.xml 2012-11-29 22:26:45 +0000
+++ crm/report/crm_lead_report_view.xml 2013-04-20 02:28:27 +0000
@@ -80,7 +80,7 @@
80 <field name="section_id" context="{'invisible_section': False}"/>80 <field name="section_id" context="{'invisible_section': False}"/>
81 <field name="user_id" string="Salesperson"/>81 <field name="user_id" string="Salesperson"/>
82 <group expand="0" string="Extended Filters...">82 <group expand="0" string="Extended Filters...">
83 <field name="partner_id"/>83 <field name="partner_id" filter_domain="[('partner_id','child_of',self)]"/>
84 <field name="stage_id" domain="[('section_ids', '=', 'section_id')]" />84 <field name="stage_id" domain="[('section_ids', '=', 'section_id')]" />
85 <field name="type_id"/>85 <field name="type_id"/>
86 <field name="channel_id"/>86 <field name="channel_id"/>
8787
=== modified file 'crm/report/crm_phonecall_report_view.xml'
--- crm/report/crm_phonecall_report_view.xml 2012-11-29 22:26:45 +0000
+++ crm/report/crm_phonecall_report_view.xml 2013-04-20 02:28:27 +0000
@@ -62,7 +62,7 @@
62 <field name="section_id" string="Sales Team" context="{'invisible_section': False}"/>62 <field name="section_id" string="Sales Team" context="{'invisible_section': False}"/>
63 <field name="user_id" string="Salesperson"/>63 <field name="user_id" string="Salesperson"/>
64 <group expand="0" string="Extended Filters...">64 <group expand="0" string="Extended Filters...">
65 <field name="partner_id"/>65 <field name="partner_id" filter_domain="[('partner_id','child_of',self)]"/>
66 <field name="company_id" groups="base.group_multi_company"/>66 <field name="company_id" groups="base.group_multi_company"/>
67 <field name="creation_date"/>67 <field name="creation_date"/>
68 <field name="opening_date"/>68 <field name="opening_date"/>
6969
=== modified file 'crm_claim/crm_claim_view.xml'
--- crm_claim/crm_claim_view.xml 2013-03-04 12:55:34 +0000
+++ crm_claim/crm_claim_view.xml 2013-04-20 02:28:27 +0000
@@ -201,7 +201,7 @@
201 <filter icon="terp-gtk-media-pause" string="Pending" domain="[('state','=','pending')]"/>201 <filter icon="terp-gtk-media-pause" string="Pending" domain="[('state','=','pending')]"/>
202 <separator/>202 <separator/>
203 <filter string="Unassigned Claims" icon="terp-personal-" domain="[('user_id','=', False)]" help="Unassigned Claims" />203 <filter string="Unassigned Claims" icon="terp-personal-" domain="[('user_id','=', False)]" help="Unassigned Claims" />
204 <field name="partner_id"/>204 <field name="partner_id" filter_domain="[('partner_id','child_of',self)]"/>
205 <field name="user_id"/>205 <field name="user_id"/>
206 <group expand="0" string="Group By...">206 <group expand="0" string="Group By...">
207 <filter string="Partner" icon="terp-partner" domain="[]" help="Partner" context="{'group_by':'partner_id'}"/>207 <filter string="Partner" icon="terp-partner" domain="[]" help="Partner" context="{'group_by':'partner_id'}"/>
208208
=== modified file 'crm_claim/report/crm_claim_report_view.xml'
--- crm_claim/report/crm_claim_report_view.xml 2012-11-29 22:26:45 +0000
+++ crm_claim/report/crm_claim_report_view.xml 2013-04-20 02:28:27 +0000
@@ -63,7 +63,7 @@
63 <field name="user_id" string="Salesperson"/>63 <field name="user_id" string="Salesperson"/>
64 <field name="section_id" string="Sales Team" context="{'invisible_section': False}"/>64 <field name="section_id" string="Sales Team" context="{'invisible_section': False}"/>
65 <group expand="0" string="Extended Filters...">65 <group expand="0" string="Extended Filters...">
66 <field name="partner_id"/>66 <field name="partner_id" filter_domain="[('partner_id','child_of',self)]"/>
67 <field name="stage_id" domain="[('section_ids', '=', 'section_id')]"/>67 <field name="stage_id" domain="[('section_ids', '=', 'section_id')]"/>
68 <field name="categ_id" domain="[('object_id.model', '=', 'crm.claim')]"/>68 <field name="categ_id" domain="[('object_id.model', '=', 'crm.claim')]"/>
69 <field name="priority"/>69 <field name="priority"/>
7070
=== modified file 'crm_helpdesk/crm_helpdesk_view.xml'
--- crm_helpdesk/crm_helpdesk_view.xml 2013-03-04 18:44:31 +0000
+++ crm_helpdesk/crm_helpdesk_view.xml 2013-04-20 02:28:27 +0000
@@ -152,7 +152,7 @@
152 <separator/>152 <separator/>
153 <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])]"153 <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])]"
154 help="Helpdesk requests that are assigned to me or to one of the sale teams I manage" />154 help="Helpdesk requests that are assigned to me or to one of the sale teams I manage" />
155 <field name="partner_id" />155 <field name="partner_id" filter_domain="[('partner_id','child_of',self)]"/>
156 <field name="user_id"/>156 <field name="user_id"/>
157 <field name="section_id" string="Sales Team"/>157 <field name="section_id" string="Sales Team"/>
158 <group expand="0" string="Group By...">158 <group expand="0" string="Group By...">
159159
=== modified file 'crm_helpdesk/report/crm_helpdesk_report_view.xml'
--- crm_helpdesk/report/crm_helpdesk_report_view.xml 2012-11-29 22:26:45 +0000
+++ crm_helpdesk/report/crm_helpdesk_report_view.xml 2013-04-20 02:28:27 +0000
@@ -62,6 +62,7 @@
62 <field name="user_id" string="Salesperson"/>62 <field name="user_id" string="Salesperson"/>
63 <field name="section_id" string="Sales Team" context="{'invisible_section': False}"/> 63 <field name="section_id" string="Sales Team" context="{'invisible_section': False}"/>
64 <field name="company_id" groups="base.group_multi_company"/>64 <field name="company_id" groups="base.group_multi_company"/>
65 <field name="partner_id" filter_domain="[('partner_id','child_of',self)]"/>
65 <group expand="0" string="Extended Filters..." groups="base.group_no_one">66 <group expand="0" string="Extended Filters..." groups="base.group_no_one">
66 <field name="priority" string="Priority"/>67 <field name="priority" string="Priority"/>
67 <field name="categ_id"/>68 <field name="categ_id"/>
6869
=== modified file 'l10n_be_invoice_bba/partner.py'
--- l10n_be_invoice_bba/partner.py 2012-12-06 14:56:32 +0000
+++ l10n_be_invoice_bba/partner.py 2013-04-20 02:28:27 +0000
@@ -44,6 +44,11 @@
44 help='Select Algorithm to generate the Structured Communication on Outgoing Invoices.' ),44 help='Select Algorithm to generate the Structured Communication on Outgoing Invoices.' ),
45 }45 }
4646
47 def _commercial_fields(self, cr, uid, context=None):
48 return super(res_partner, self)._commercial_fields(cr, uid, context=context) + \
49 ['out_inv_comm_type', 'out_inv_comm_algorithm']
50
51
47 _default = {52 _default = {
48 'out_inv_comm_type': 'none',53 'out_inv_comm_type': 'none',
49 }54 }
5055
=== modified file 'l10n_ro/res_partner.py'
--- l10n_ro/res_partner.py 2012-12-19 14:11:55 +0000
+++ l10n_ro/res_partner.py 2013-04-20 02:28:27 +0000
@@ -28,10 +28,33 @@
28 _columns = {28 _columns = {
29 'nrc' : fields.char('NRC', size=16, help='Registration number at the Registry of Commerce'),29 'nrc' : fields.char('NRC', size=16, help='Registration number at the Registry of Commerce'),
30 }30 }
31
32 # The SQL constraints are no-ops but present only to display the right error message to the
33 # user when the partial unique indexes defined below raise errors/
34 # The real constraints need to be implemented with PARTIAL UNIQUE INDEXES (see auto_init),
35 # due to the way accounting data is delegated by contacts to their companies in OpenERP 7.0.
31 _sql_constraints = [36 _sql_constraints = [
32 ('vat_uniq', 'unique (vat)', 'The vat of the partner must be unique !'),37 ('vat_uniq', 'unique (id)', 'The vat of the partner must be unique !'),
33 ('nrc_uniq', 'unique (nrc)', 'The code of the partner must be unique !')38 ('nrc_uniq', 'unique (id)', 'The code of the partner must be unique !')
34 ]39 ]
40
41 def _auto_init(self, cr, context=None):
42 result = super(res_partner, self)._auto_init(cr, context=context)
43 # Real implementation of the vat/nrc constraints: only "commercial entities" need to have
44 # unique numbers, and the condition for being a commercial entity is "is_company or parent_id IS NULL".
45 # Contacts inside a company automatically have a copy of the company's commercial fields
46 # (see _commercial_fields()), so they are automatically consistent.
47 cr.execute("""
48 DROP INDEX IF EXISTS res_partner_vat_uniq_for_companies;
49 DROP INDEX IF EXISTS res_partner_nrc_uniq_for_companies;
50 CREATE UNIQUE INDEX res_partner_vat_uniq_for_companies ON res_partner (vat) WHERE is_company OR parent_id IS NULL;
51 CREATE UNIQUE INDEX res_partner_nrc_uniq_for_companies ON res_partner (nrc) WHERE is_company OR parent_id IS NULL;
52 """)
53 return result
54
55 def _commercial_fields(self, cr, uid, context=None):
56 return super(res_partner, self)._commercial_fields(cr, uid, context=context) + ['nrc']
57
35res_partner()58res_partner()
3659
37# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:60# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
3861
=== modified file 'mrp_repair/mrp_repair_view.xml'
--- mrp_repair/mrp_repair_view.xml 2012-12-15 16:31:01 +0000
+++ mrp_repair/mrp_repair_view.xml 2013-04-20 02:28:27 +0000
@@ -210,7 +210,7 @@
210 <separator/>210 <separator/>
211 <filter icon="terp-dolar" string="Invoiced" domain="[('invoiced','=',True)]"/>211 <filter icon="terp-dolar" string="Invoiced" domain="[('invoiced','=',True)]"/>
212 <field name="product_id"/>212 <field name="product_id"/>
213 <field name="partner_id"/>213 <field name="partner_id" filter_domain="[('partner_id', 'child_of', self)]"/>
214 <group expand="0" string="Group By...">214 <group expand="0" string="Group By...">
215 <filter string="Partner" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/>215 <filter string="Partner" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/>
216 <filter string="Product" icon="terp-accessories-archiver" domain="[]" context="{'group_by':'product_id'}"/>216 <filter string="Product" icon="terp-accessories-archiver" domain="[]" context="{'group_by':'product_id'}"/>
217217
=== modified file 'product/partner.py'
--- product/partner.py 2012-12-06 14:56:32 +0000
+++ product/partner.py 2013-04-20 02:28:27 +0000
@@ -36,6 +36,9 @@
36 help="This pricelist will be used, instead of the default one, for sales to the current partner"),36 help="This pricelist will be used, instead of the default one, for sales to the current partner"),
37 }37 }
3838
39 def _commercial_fields(self, cr, uid, context=None):
40 return super(res_partner, self)._commercial_fields(cr, uid, context=context) + ['property_product_pricelist']
41
39res_partner()42res_partner()
4043
41# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:44# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
4245
=== modified file 'product/partner_view.xml'
--- product/partner_view.xml 2012-11-29 22:26:45 +0000
+++ product/partner_view.xml 2013-04-20 02:28:27 +0000
@@ -8,9 +8,12 @@
8 <field name="arch" type="xml">8 <field name="arch" type="xml">
9 <page string="Sales &amp; Purchases" position="inside">9 <page string="Sales &amp; Purchases" position="inside">
10 <group>10 <group>
11 <group name="pricelists" groups="product.group_sale_pricelist">11 <group name="pricelists" groups="product.group_sale_pricelist" attrs="{'invisible': [('is_company','=',False),('parent_id','!=',False)]}">
12 <field name="property_product_pricelist"/>12 <field name="property_product_pricelist"/>
13 </group>13 </group>
14 <div name="parent_pricelists" groups="product.group_sale_pricelist" attrs="{'invisible': ['|',('is_company','=',True),('parent_id','=',False)]}">
15 <p>Pricelists are managed on <button name="open_commercial_entity" type="object" string="the parent company" class="oe_link"/></p>
16 </div>
14 </group>17 </group>
15 </page>18 </page>
16 </field>19 </field>
1720
=== modified file 'project/project_view.xml'
--- project/project_view.xml 2013-03-04 18:44:31 +0000
+++ project/project_view.xml 2013-04-20 02:28:27 +0000
@@ -182,7 +182,7 @@
182 <separator/>182 <separator/>
183 <filter string="Project(s) Manager" domain="[('user_id','=',uid)]" help="Projects in which I am a manager" icon="terp-personal"/>183 <filter string="Project(s) Manager" domain="[('user_id','=',uid)]" help="Projects in which I am a manager" icon="terp-personal"/>
184 <field name="user_id" string="Project Manager"/>184 <field name="user_id" string="Project Manager"/>
185 <field name="partner_id" string="Contact"/>185 <field name="partner_id" string="Contact" filter_domain="[('partner_id', 'child_of', self)]"/>
186 <group expand="0" string="Group By...">186 <group expand="0" string="Group By...">
187 <filter string="Manager" name="Manager" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}"/>187 <filter string="Manager" name="Manager" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}"/>
188 <filter string="Contact" name="Partner" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/>188 <filter string="Contact" name="Partner" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/>
189189
=== modified file 'project/report/project_report_view.xml'
--- project/report/project_report_view.xml 2012-11-29 22:26:45 +0000
+++ project/report/project_report_view.xml 2013-04-20 02:28:27 +0000
@@ -69,7 +69,7 @@
69 <filter icon="terp-personal-" string="Non Assigned Tasks to users" help="Non Assigned Tasks to users" domain="[('user_id','=',False)]"/>69 <filter icon="terp-personal-" string="Non Assigned Tasks to users" help="Non Assigned Tasks to users" domain="[('user_id','=',False)]"/>
70 <field name="project_id"/>70 <field name="project_id"/>
71 <field name="user_id"/>71 <field name="user_id"/>
72 <field name="partner_id" />72 <field name="partner_id" filter_domain="[('partner_id', 'child_of', self)]"/>
73 <group expand="0" string="Extended Filters...">73 <group expand="0" string="Extended Filters...">
74 <field name="priority"/>74 <field name="priority"/>
75 <field name="company_id" groups="base.group_multi_company"/>75 <field name="company_id" groups="base.group_multi_company"/>
7676
=== modified file 'project_issue/project_issue_view.xml'
--- project_issue/project_issue_view.xml 2013-02-26 15:16:04 +0000
+++ project_issue/project_issue_view.xml 2013-04-20 02:28:27 +0000
@@ -139,7 +139,7 @@
139 <field name="model">project.issue</field>139 <field name="model">project.issue</field>
140 <field name="arch" type="xml">140 <field name="arch" type="xml">
141 <search string="Issue Tracker Search">141 <search string="Issue Tracker Search">
142 <field name="name" string="Issue" filter_domain="['|', '|',('partner_id','ilike',self),('email_from','ilike',self),('name','ilike',self)]"/>142 <field name="name" string="Issue" filter_domain="['|', '|',('partner_id','child_of',self),('email_from','ilike',self),('name','ilike',self)]"/>
143 <field name="id"/>143 <field name="id"/>
144 <filter icon="terp-mail-message-new" string="Unread Messages" name="message_unread" domain="[('message_unread','=',True)]"/>144 <filter icon="terp-mail-message-new" string="Unread Messages" name="message_unread" domain="[('message_unread','=',True)]"/>
145 <separator/>145 <separator/>
@@ -150,6 +150,7 @@
150 <field name="user_id"/>150 <field name="user_id"/>
151 <field name="project_id"/>151 <field name="project_id"/>
152 <field name="categ_ids"/>152 <field name="categ_ids"/>
153 <field name="partner_id" filter_domain="[('partner_id', 'child_of', self)]"/>
153 <group expand="0" string="Group By..." >154 <group expand="0" string="Group By..." >
154 <filter string="Responsible" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}"/>155 <filter string="Responsible" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}"/>
155 <filter string="Contact" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/>156 <filter string="Contact" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/>
156157
=== modified file 'project_issue/report/project_issue_report_view.xml'
--- project_issue/report/project_issue_report_view.xml 2012-11-29 22:26:45 +0000
+++ project_issue/report/project_issue_report_view.xml 2013-04-20 02:28:27 +0000
@@ -55,7 +55,7 @@
55 <filter icon="terp-dialog-close" string="Done" domain="[('state','=','done')]"/>55 <filter icon="terp-dialog-close" string="Done" domain="[('state','=','done')]"/>
56 <field name="project_id"/>56 <field name="project_id"/>
57 <field name="user_id"/>57 <field name="user_id"/>
58 <field name="partner_id"/>58 <field name="partner_id" filter_domain="[('partner_id', 'child_of', self)]"/>
59 <field name="version_id"/>59 <field name="version_id"/>
60 <group expand="1" string="Group By...">60 <group expand="1" string="Group By...">
61 <filter string="Assigned to" name="Responsible" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}" />61 <filter string="Assigned to" name="Responsible" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}" />
6262
=== modified file 'purchase/partner.py'
--- purchase/partner.py 2012-12-06 14:56:32 +0000
+++ purchase/partner.py 2013-04-20 02:28:27 +0000
@@ -43,6 +43,9 @@
4343
44 super(res_partner, self).copy(cr, uid, id, default=default, context=context)44 super(res_partner, self).copy(cr, uid, id, default=default, context=context)
4545
46 def _commercial_fields(self, cr, uid, context=None):
47 return super(res_partner, self)._commercial_fields(cr, uid, context=context) + ['property_product_pricelist_purchase']
48
46 _columns = {49 _columns = {
47 'property_product_pricelist_purchase': fields.property(50 'property_product_pricelist_purchase': fields.property(
48 'product.pricelist',51 'product.pricelist',
4952
=== modified file 'purchase/purchase_view.xml'
--- purchase/purchase_view.xml 2013-04-17 10:00:49 +0000
+++ purchase/purchase_view.xml 2013-04-20 02:28:27 +0000
@@ -270,7 +270,7 @@
270 <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"/>270 <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"/>
271 <separator/>271 <separator/>
272 <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."/>272 <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."/>
273 <field name="partner_id"/>273 <field name="partner_id" filter_domain="[('partner_id', 'child_of', self)]"/>
274 <field name="product_id"/>274 <field name="product_id"/>
275 <field name="create_uid"/>275 <field name="create_uid"/>
276 <group expand="0" string="Group By...">276 <group expand="0" string="Group By...">
@@ -297,7 +297,7 @@
297 <filter icon="terp-emblem-important" name="exception" string="Exception" domain="[('state','in',('except_invoice','except_picking'))]" help="Purchase orders which are in exception state"/>297 <filter icon="terp-emblem-important" name="exception" string="Exception" domain="[('state','in',('except_invoice','except_picking'))]" help="Purchase orders which are in exception state"/>
298 <separator/>298 <separator/>
299 <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."/>299 <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."/>
300 <field name="partner_id"/>300 <field name="partner_id" filter_domain="[('partner_id', 'child_of', self)]"/>
301 <field name="product_id"/>301 <field name="product_id"/>
302 <field name="create_uid"/>302 <field name="create_uid"/>
303 <group expand="0" string="Group By...">303 <group expand="0" string="Group By...">
@@ -481,7 +481,7 @@
481 <search string="Search Purchase Order">481 <search string="Search Purchase Order">
482 <field name="order_id"/>482 <field name="order_id"/>
483 <field name="product_id"/>483 <field name="product_id"/>
484 <field name="partner_id" string="Supplier"/>484 <field name="partner_id" string="Supplier" filter_domain="[('partner_id', 'child_of', self)]"/>
485 <group expand="0" string="Group By...">485 <group expand="0" string="Group By...">
486 <filter string="Supplier" icon="terp-partner" domain="[]" context="{'group_by' : 'partner_id'}" />486 <filter string="Supplier" icon="terp-partner" domain="[]" context="{'group_by' : 'partner_id'}" />
487 <filter string="Product" icon="terp-accessories-archiver" domain="[]" context="{'group_by' : 'product_id'}" />487 <filter string="Product" icon="terp-accessories-archiver" domain="[]" context="{'group_by' : 'product_id'}" />
488488
=== modified file 'sale/res_partner_view.xml'
--- sale/res_partner_view.xml 2012-12-20 11:43:56 +0000
+++ sale/res_partner_view.xml 2013-04-20 02:28:27 +0000
@@ -63,14 +63,34 @@
63 <field name="arch" type="xml">63 <field name="arch" type="xml">
64 <xpath expr="//label[@for='type']" position="attributes">64 <xpath expr="//label[@for='type']" position="attributes">
65 <attribute name="groups">sale.group_delivery_invoice_address</attribute>65 <attribute name="groups">sale.group_delivery_invoice_address</attribute>
66 </xpath>66 <attribute name="invisible">False</attribute>
67 <xpath expr="//label[@for='type']" position="attributes">67 </xpath>
68 <attribute name="invisible">False</attribute>68 <xpath expr="//div[@name='div_type']" position="attributes">
69 </xpath>69 <attribute name="invisible">False</attribute>
70 <xpath expr="//div[@name='div_type']" position="attributes">70 <attribute name="groups">sale.group_delivery_invoice_address</attribute>
71 <attribute name="invisible">False</attribute>71 </xpath>
72 </xpath>72 <xpath expr="//field[@name='use_parent_address']" position="attributes">
73 <xpath expr="//div[@name='div_type']" position="attributes">73 <attribute name="invisible">False</attribute>
74 <attribute name="groups">sale.group_delivery_invoice_address</attribute>
75 </xpath>
76 <xpath expr="//label[@for='use_parent_address']" position="attributes">
77 <attribute name="invisible">False</attribute>
78 <attribute name="groups">sale.group_delivery_invoice_address</attribute>
79 </xpath>
80 <xpath expr="//field[@name='child_ids']//field[@name='use_parent_address']" position="attributes">
81 <attribute name="invisible">False</attribute>
82 <attribute name="groups">sale.group_delivery_invoice_address</attribute>
83 </xpath>
84 <xpath expr="//field[@name='child_ids']//label[@for='use_parent_address']" position="attributes">
85 <attribute name="invisible">False</attribute>
86 <attribute name="groups">sale.group_delivery_invoice_address</attribute>
87 </xpath>
88 <xpath expr="//field[@name='child_ids']//div[@name='div_type']" position="attributes">
89 <attribute name="invisible">False</attribute>
90 <attribute name="groups">sale.group_delivery_invoice_address</attribute>
91 </xpath>
92 <xpath expr="//field[@name='child_ids']//label[@for='type']" position="attributes">
93 <attribute name="invisible">False</attribute>
74 <attribute name="groups">sale.group_delivery_invoice_address</attribute>94 <attribute name="groups">sale.group_delivery_invoice_address</attribute>
75 </xpath>95 </xpath>
76 </field>96 </field>
7797
=== modified file 'sale/sale.py'
--- sale/sale.py 2013-04-18 16:36:16 +0000
+++ sale/sale.py 2013-04-20 02:28:27 +0000
@@ -314,10 +314,6 @@
314 return {'value': {'partner_invoice_id': False, 'partner_shipping_id': False, 'payment_term': False, 'fiscal_position': False}}314 return {'value': {'partner_invoice_id': False, 'partner_shipping_id': False, 'payment_term': False, 'fiscal_position': False}}
315315
316 part = self.pool.get('res.partner').browse(cr, uid, part, context=context)316 part = self.pool.get('res.partner').browse(cr, uid, part, context=context)
317 #if the chosen partner is not a company and has a parent company, use the parent to choose the delivery, the
318 #invoicing addresses and all the fields related to the partner.
319 if part.parent_id and not part.is_company:
320 part = part.parent_id
321 addr = self.pool.get('res.partner').address_get(cr, uid, [part.id], ['delivery', 'invoice', 'contact'])317 addr = self.pool.get('res.partner').address_get(cr, uid, [part.id], ['delivery', 'invoice', 'contact'])
322 pricelist = part.property_product_pricelist and part.property_product_pricelist.id or False318 pricelist = part.property_product_pricelist and part.property_product_pricelist.id or False
323 payment_term = part.property_payment_term and part.property_payment_term.id or False319 payment_term = part.property_payment_term and part.property_payment_term.id or False
324320
=== modified file 'sale/sale_view.xml'
--- sale/sale_view.xml 2013-04-18 17:20:22 +0000
+++ sale/sale_view.xml 2013-04-20 02:28:27 +0000
@@ -156,7 +156,7 @@
156 <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}'/>156 <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}'/>
157 <field name="partner_invoice_id" groups="sale.group_delivery_invoice_address" context="{'default_type':'invoice'}"/>157 <field name="partner_invoice_id" groups="sale.group_delivery_invoice_address" context="{'default_type':'invoice'}"/>
158 <field name="partner_shipping_id" groups="sale.group_delivery_invoice_address" context="{'default_type':'delivery'}"/>158 <field name="partner_shipping_id" groups="sale.group_delivery_invoice_address" context="{'default_type':'delivery'}"/>
159 <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'])]"/>159 <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'])]"/>
160 </group>160 </group>
161 <group>161 <group>
162 <field name="date_order"/>162 <field name="date_order"/>
@@ -308,7 +308,7 @@
308 <filter icon="terp-dolar_ok!" string="Done" domain="[('state','=','done')]" help="Sales Order done"/>308 <filter icon="terp-dolar_ok!" string="Done" domain="[('state','=','done')]" help="Sales Order done"/>
309 <separator/>309 <separator/>
310 <filter string="My Sales Orders" domain="[('user_id','=',uid)]" help="My Sales Orders" icon="terp-personal" name="my_sale_orders_filter"/>310 <filter string="My Sales Orders" domain="[('user_id','=',uid)]" help="My Sales Orders" icon="terp-personal" name="my_sale_orders_filter"/>
311 <field name="partner_id"/>311 <field name="partner_id" filter_domain="[('partner_id', 'child_of', self)]"/>
312 <field name="user_id"/>312 <field name="user_id"/>
313 <field name="project_id"/>313 <field name="project_id"/>
314 <group expand="0" string="Group By...">314 <group expand="0" string="Group By...">
@@ -472,7 +472,7 @@
472 <separator/>472 <separator/>
473 <filter string="My Sales Order Lines" icon="terp-personnal" domain="[('salesman_id','=',uid)]" help="Sales Order Lines related to a Sales Order of mine"/>473 <filter string="My Sales Order Lines" icon="terp-personnal" domain="[('salesman_id','=',uid)]" help="Sales Order Lines related to a Sales Order of mine"/>
474 <field name="order_id"/>474 <field name="order_id"/>
475 <field name="order_partner_id"/>475 <field name="order_partner_id" filter_domain="[('order_partner_id', 'child_of', self)]"/>
476 <field name="product_id"/>476 <field name="product_id"/>
477 <field name="salesman_id"/>477 <field name="salesman_id"/>
478 <group expand="0" string="Group By...">478 <group expand="0" string="Group By...">
@@ -498,7 +498,7 @@
498 <separator/>498 <separator/>
499 <filter string="My Sales Order Lines" icon="terp-personal" domain="[('salesman_id','=',uid)]" help="My Sales Order Lines"/>499 <filter string="My Sales Order Lines" icon="terp-personal" domain="[('salesman_id','=',uid)]" help="My Sales Order Lines"/>
500 <field name="order_id"/>500 <field name="order_id"/>
501 <field name="order_partner_id"/>501 <field name="order_partner_id" filter_domain="[('order_partner_id', 'child_of', self)]"/>
502 <field name="product_id"/>502 <field name="product_id"/>
503 <field name="salesman_id"/>503 <field name="salesman_id"/>
504 <group expand="0" string="Group By...">504 <group expand="0" string="Group By...">
505505
=== modified file 'sale_journal/sale_journal.py'
--- sale_journal/sale_journal.py 2012-12-06 14:56:32 +0000
+++ sale_journal/sale_journal.py 2013-04-20 02:28:27 +0000
@@ -52,6 +52,10 @@
52 group_name = "Accounting Properties",52 group_name = "Accounting Properties",
53 help = "This invoicing type will be used, by default, to invoice the current partner."),53 help = "This invoicing type will be used, by default, to invoice the current partner."),
54 }54 }
55
56 def _commercial_fields(self, cr, uid, context=None):
57 return super(res_partner, self)._commercial_fields(cr, uid, context=context) + ['property_invoice_type']
58
55res_partner()59res_partner()
5660
57class picking(osv.osv):61class picking(osv.osv):
5862
=== modified file 'sale_journal/sale_journal_view.xml'
--- sale_journal/sale_journal_view.xml 2012-12-16 15:58:43 +0000
+++ sale_journal/sale_journal_view.xml 2013-04-20 02:28:27 +0000
@@ -146,7 +146,7 @@
146 <field name="inherit_id" ref="base.view_partner_form"/>146 <field name="inherit_id" ref="base.view_partner_form"/>
147 <field name="arch" type="xml">147 <field name="arch" type="xml">
148 <page string="Sales &amp; Purchases" position="inside">148 <page string="Sales &amp; Purchases" position="inside">
149 <group colspan="2" col="2">149 <group colspan="2" col="2" attrs="{'invisible': [('is_company','=',False),('parent_id','!=',False)]}">
150 <separator string="Invoicing" colspan="2"/>150 <separator string="Invoicing" colspan="2"/>
151 <field name="property_invoice_type"/>151 <field name="property_invoice_type"/>
152 </group>152 </group>
153153
=== modified file 'sale_stock/stock.py'
--- sale_stock/stock.py 2012-12-21 16:48:08 +0000
+++ sale_stock/stock.py 2013-04-20 02:28:27 +0000
@@ -53,7 +53,7 @@
53 We select the partner of the sales order as the partner of the customer invoice53 We select the partner of the sales order as the partner of the customer invoice
54 """54 """
55 if picking.sale_id:55 if picking.sale_id:
56 return picking.sale_id.partner_id56 return picking.sale_id.partner_invoice_id
57 return super(stock_picking, self)._get_partner_to_invoice(cr, uid, picking, context=context)57 return super(stock_picking, self)._get_partner_to_invoice(cr, uid, picking, context=context)
5858
59 def _get_comment_invoice(self, cursor, user, picking):59 def _get_comment_invoice(self, cursor, user, picking):
6060
=== modified file 'sale_stock/test/picking_order_policy.yml'
--- sale_stock/test/picking_order_policy.yml 2013-04-04 12:31:54 +0000
+++ sale_stock/test/picking_order_policy.yml 2013-04-20 02:28:27 +0000
@@ -5,6 +5,12 @@
5-5-
6 !assert {model: sale.order, id: sale.sale_order_6, string: The amount of the Quotation is not correctly computed}:6 !assert {model: sale.order, id: sale.sale_order_6, string: The amount of the Quotation is not correctly computed}:
7 - sum([l.price_subtotal for l in order_line]) == amount_untaxed7 - sum([l.price_subtotal for l in order_line]) == amount_untaxed
8-
9 I set an explicit invoicing partner that is different from the main SO Customer
10-
11 !python {model: sale.order, id: sale.sale_order_6}: |
12 order = self.browse(cr, uid, ref("sale.sale_order_6"))
13 order.write({'partner_invoice_id': ref('base.res_partner_address_29')})
8-14-
9 I confirm the quotation with Invoice based on deliveries policy.15 I confirm the quotation with Invoice based on deliveries policy.
10-16-
@@ -110,13 +116,13 @@
110 !python {model: sale.order}: |116 !python {model: sale.order}: |
111 order = self.browse(cr, uid, ref("sale.sale_order_6"))117 order = self.browse(cr, uid, ref("sale.sale_order_6"))
112 assert order.invoice_ids, "Invoice is not created."118 assert order.invoice_ids, "Invoice is not created."
113 ac = order.partner_id.property_account_receivable.id119 ac = order.partner_invoice_id.property_account_receivable.id
114 journal_ids = self.pool.get('account.journal').search(cr, uid, [('type', '=', 'sale'), ('company_id', '=', order.company_id.id)])120 journal_ids = self.pool.get('account.journal').search(cr, uid, [('type', '=', 'sale'), ('company_id', '=', order.company_id.id)])
115 for invoice in order.invoice_ids:121 for invoice in order.invoice_ids:
116 assert invoice.type == 'out_invoice',"Invoice should be Customer Invoice."122 assert invoice.type == 'out_invoice',"Invoice should be Customer Invoice."
117 assert invoice.account_id.id == ac,"Invoice account is not correspond."123 assert invoice.account_id.id == ac,"Invoice account is not correspond."
118 assert invoice.reference == order.client_order_ref or order.name,"Reference is not correspond."124 assert invoice.reference == order.client_order_ref or order.name,"Reference is not correspond."
119 assert invoice.partner_id.id == order.partner_id.id,"Customer is not correspond."125 assert invoice.partner_id.id == order.partner_invoice_id.id,"Customer does not correspond."
120 assert invoice.currency_id.id == order.pricelist_id.currency_id.id, "Currency is not correspond."126 assert invoice.currency_id.id == order.pricelist_id.currency_id.id, "Currency is not correspond."
121 assert invoice.comment == (order.note or ''),"Note is not correspond."127 assert invoice.comment == (order.note or ''),"Note is not correspond."
122 assert invoice.journal_id.id in journal_ids,"Sales Journal is not link on Invoice."128 assert invoice.journal_id.id in journal_ids,"Sales Journal is not link on Invoice."
123129
=== modified file 'stock/report/report_stock_move_view.xml'
--- stock/report/report_stock_move_view.xml 2012-11-29 22:26:45 +0000
+++ stock/report/report_stock_move_view.xml 2013-04-20 02:28:27 +0000
@@ -149,7 +149,7 @@
149 <field name="location_id" filter_domain="[('location_id', 'child_of', self)]"/>149 <field name="location_id" filter_domain="[('location_id', 'child_of', self)]"/>
150 <field name="company_id" groups="base.group_multi_company"/>150 <field name="company_id" groups="base.group_multi_company"/>
151 <group expand="0" string="Extended Filters...">151 <group expand="0" string="Extended Filters...">
152 <field name="partner_id" context="{'contact_display':'partner'}"/>152 <field name="partner_id" context="{'contact_display':'partner'}" filter_domain="[('partner_id', 'child_of', self)]"/>
153 <field name="product_categ_id" />153 <field name="product_categ_id" />
154 <field name="prodlot_id"/>154 <field name="prodlot_id"/>
155 <field name="state"/>155 <field name="state"/>
156156
=== modified file 'stock/stock_view.xml'
--- stock/stock_view.xml 2013-03-18 13:43:43 +0000
+++ stock/stock_view.xml 2013-04-20 02:28:27 +0000
@@ -807,7 +807,7 @@
807 <filter icon="terp-check" name="available" string="Ready" domain="[('state','=','assigned')]" help="Assigned Internal Moves"/>807 <filter icon="terp-check" name="available" string="Ready" domain="[('state','=','assigned')]" help="Assigned Internal Moves"/>
808 <filter icon="terp-camera_test" name="confirmed" string="Waiting" domain="[('state','=','confirmed')]" help="Confirmed Internal Moves"/>808 <filter icon="terp-camera_test" name="confirmed" string="Waiting" domain="[('state','=','confirmed')]" help="Confirmed Internal Moves"/>
809 <filter icon="terp-dialog-close" name="done" string="Done" domain="[('state','=','done')]" help="Pickings already processed"/>809 <filter icon="terp-dialog-close" name="done" string="Done" domain="[('state','=','done')]" help="Pickings already processed"/>
810 <field name="partner_id"/>810 <field name="partner_id" filter_domain="[('partner_id','child_of',self)]"/>
811 <field name="product_id"/>811 <field name="product_id"/>
812 <field name="stock_journal_id"/>812 <field name="stock_journal_id"/>
813 <group expand="0" string="Group By...">813 <group expand="0" string="Group By...">
@@ -934,6 +934,7 @@
934 <filter icon="terp-accessories-archiver-minus" string="Back Orders" domain="[('backorder_id', '!=', False)]" help="Is a Back Order"/>934 <filter icon="terp-accessories-archiver-minus" string="Back Orders" domain="[('backorder_id', '!=', False)]" help="Is a Back Order"/>
935 <separator/>935 <separator/>
936 <filter icon="terp-dolar" name="to_invoice" string="To Invoice" domain="[('invoice_state','=','2binvoiced')]" help="Delivery orders to invoice"/>936 <filter icon="terp-dolar" name="to_invoice" string="To Invoice" domain="[('invoice_state','=','2binvoiced')]" help="Delivery orders to invoice"/>
937 <field name="partner_id" filter_domain="[('partner_id','child_of',self)]"/>
937 <field name="stock_journal_id"/>938 <field name="stock_journal_id"/>
938 <field name="company_id" groups="base.group_multi_company"/>939 <field name="company_id" groups="base.group_multi_company"/>
939 <group expand="0" string="Group By...">940 <group expand="0" string="Group By...">
@@ -1059,6 +1060,7 @@
1059 <filter icon="terp-accessories-archiver-minus" string="Back Orders" domain="[('backorder_id', '!=', False)]" help="Is a Back Order"/>1060 <filter icon="terp-accessories-archiver-minus" string="Back Orders" domain="[('backorder_id', '!=', False)]" help="Is a Back Order"/>
1060 <separator/>1061 <separator/>
1061 <filter string="To Invoice" name="to_invoice" icon="terp-dolar" domain="[('invoice_state', '=', '2binvoiced')]"/>1062 <filter string="To Invoice" name="to_invoice" icon="terp-dolar" domain="[('invoice_state', '=', '2binvoiced')]"/>
1063 <field name="partner_id" filter_domain="[('partner_id','child_of',self)]"/>
1062 <field name="stock_journal_id"/>1064 <field name="stock_journal_id"/>
1063 <field name="product_id"/>1065 <field name="product_id"/>
1064 <group expand="0" string="Group By...">1066 <group expand="0" string="Group By...">
@@ -1370,7 +1372,7 @@
1370 <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"/>1372 <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"/>
1371 <field name="product_id"/>1373 <field name="product_id"/>
1372 <field name="name" string="Location" filter_domain="['|',('location_id','ilike',self),('location_dest_id','ilike',self)]"/>1374 <field name="name" string="Location" filter_domain="['|',('location_id','ilike',self),('location_dest_id','ilike',self)]"/>
1373 <field name="partner_id" string="Partner" filter_domain="[('picking_id.partner_id','ilike',self)]"/>1375 <field name="partner_id" string="Partner" filter_domain="[('picking_id.partner_id','child_of',self)]"/>
1374 <field name="prodlot_id"/>1376 <field name="prodlot_id"/>
1375 <group expand="0" string="Group By...">1377 <group expand="0" string="Group By...">
1376 <filter string="Product" name="by_product" icon="terp-accessories-archiver" domain="[]" context="{'group_by':'product_id'}"/>1378 <filter string="Product" name="by_product" icon="terp-accessories-archiver" domain="[]" context="{'group_by':'product_id'}"/>