Merge lp:~laetitia-gangloff/account-invoicing/account_invoice_merge into lp:~account-core-editors/account-invoicing/7.0

Proposed by Laetitia Gangloff (Acsone)
Status: Merged
Approved by: Guewen Baconnier @ Camptocamp
Approved revision: 33
Merged at revision: 19
Proposed branch: lp:~laetitia-gangloff/account-invoicing/account_invoice_merge
Merge into: lp:~account-core-editors/account-invoicing/7.0
Diff against target: 841 lines (+794/-0)
9 files modified
account_invoice_merge/__init__.py (+25/-0)
account_invoice_merge/__openerp__.py (+47/-0)
account_invoice_merge/i18n/account_invoice_merge.pot (+136/-0)
account_invoice_merge/i18n/fr.po (+144/-0)
account_invoice_merge/i18n/zh_CN.po (+85/-0)
account_invoice_merge/invoice.py (+187/-0)
account_invoice_merge/wizard/__init__.py (+25/-0)
account_invoice_merge/wizard/invoice_merge.py (+105/-0)
account_invoice_merge/wizard/invoice_merge_view.xml (+40/-0)
To merge this branch: bzr merge lp:~laetitia-gangloff/account-invoicing/account_invoice_merge
Reviewer Review Type Date Requested Status
xrg (community) Disapprove
Guewen Baconnier @ Camptocamp Approve
Yannick Vaucher @ Camptocamp code, no test Approve
Stéphane Bidoul (Acsone) (community) Approve
Review via email: mp+171247@code.launchpad.net

Description of the change

Add (and migrate in v7.0) module account_invoice_merge from lp:~openerp-community/openobject-addons/elico-6.0.

"This module adds an action in the invoices lists to merge of invoices. Here are the condition to allow merge:
- Type should be the same (customer Invoice, supplier invoice, Customer or Supplier Refund)
- Partner should be the same
- Currency should be the same
- Account receivable account should be the same"

To post a comment you must log in.
Revision history for this message
Eric Caudal - www.elico-corp.com (elicoidal) wrote :

On my side: the copyright should be Elico Corp and not Erico-Corp
Eric CAUDAL

Eric Caudal
/CEO/
--
*Elico Corporation, Shanghai branch
/OpenERP Premium Certified Training Partner/ *
Cell: + 86 186 2136 1670
Office: + 86 21 6211 8017/27/37
Skype: elico.corp
<email address hidden> <mailto:<email address hidden>>
http://www.elico-corp.com

Elico Corp
On 06/25/2013 05:25 PM, Laetitia Gangloff (Acsone) wrote:
> Laetitia Gangloff (Acsone) has proposed merging lp:~laetitia-gangloff/account-invoicing/account_invoice_merge into lp:account-invoicing.
>
> Requested reviews:
> Acsone OpenErp Team (acsone-openerp)
>
> For more details, see:
> https://code.launchpad.net/~laetitia-gangloff/account-invoicing/account_invoice_merge/+merge/171247
>
> Add (and migrate in v7.0) module account_invoice_merge from lp:~openerp-community/openobject-addons/elico-6.0.
>
> "This module adds an action in the invoices lists to merge of invoices. Here are the condition to allow merge:
> - Type should be the same (customer Invoice, supplier invoice, Customer or Supplier Refund)
> - Partner should be the same
> - Currency should be the same
> - Account receivable account should be the same"

22. By Laetitia Gangloff (Acsone)

account_invoice_merge: in copyright replace Erico-Corp by Elico Corp.

Revision history for this message
Laetitia Gangloff (Acsone) (laetitia-gangloff) wrote :

I replaced "Copyright (C) 2011-2012 Erico-Corp (<http://www.openerp.net.cn>)." by "Copyright (c) 2010-2011 Elico Corp. All Rights Reserved."

Note that the file zh_CN.po need revision.

Revision history for this message
Eric Caudal - www.elico-corp.com (elicoidal) wrote :

Hi Laetitia,
I am not so familiar with the lp contribution process. For the zh_CN
file what shall I do:
1. Branch the lp
2. Change the po file
3. propose for merge with bzr merge

Thanks for helping...
Eric CAUDAL

Eric Caudal
/CEO/
--
*Elico Corporation, Shanghai branch
/OpenERP Premium Certified Training Partner/ *
Cell: + 86 186 2136 1670
Office: + 86 21 6211 8017/27/37
Skype: elico.corp
<email address hidden> <mailto:<email address hidden>>
http://www.elico-corp.com

Elico Corp
On 06/25/2013 06:11 PM, Laetitia Gangloff (Acsone) wrote:
> I replaced "Copyright (C) 2011-2012 Erico-Corp (<http://www.openerp.net.cn>)." by "Copyright (c) 2010-2011 Elico Corp. All Rights Reserved."
>
> Note that the file zh_CN.po need revision.

Revision history for this message
Stéphane Bidoul (Acsone) (sbi) wrote :

Hi Eric,

I think the easiest would go as follow:
- you bzr branch lp:~laetitia-gangloff/account-invoicing/account_invoice_merge
- you commit and bzr push lp:~elicoidal/account-invoicing/account_invoice_merge_zh_CN_fix
- Laetitia merges lp:~elicoidal/account-invoicing/account_invoice_merge_zh_CN_fix in her branch
- we continue the review process on this MP

-sbi

23. By Laetitia Gangloff (Acsone)

Merge from account_invoice_merge_zh_CN_fix

Revision history for this message
Laetitia Gangloff (Acsone) (laetitia-gangloff) wrote :

I merged the branch https://code.launchpad.net/~lin-yu/account-invoicing/account_invoice_merge_zh_CN_fix into this one.

I think this proposal can be review.

Thank you.

Revision history for this message
Stéphane Bidoul (Acsone) (sbi) wrote :

A few comments (code reading only, no test at this stage):
- osv.osv deprecated, use orm.Model instead
- initially I was a bit confused because the code in invoice.py uses "order" variables where it actually treats invoices, I would to rename these variables for readability

review: Needs Fixing
Revision history for this message
Niels Huylebroeck (red15) wrote :

Got some remarks on the view:
'account_invoice_merge/wizard/invoice_merge_view.xml'

You use form version 7 but still use a label with a big ugly string which contains '&#10;' characters to break lines.
I would think that using clean and simple html would be a better fit here ? Perhaps a few clean <p> tags to bundle the text.

A question about the merge key, would it not be better to use the commercial_entity instead of the regular partner_id ?
This could obviously lead to somewhat unexpected behaviour which will merge invoices that were meant for different departments within a company maybe but this itself could also be considered a desireable feature.
Perhaps the merge wizard should ask the user if it has to merge invoices for the same entity or only per "address"?

Revision history for this message
Stéphane Bidoul (Acsone) (sbi) wrote :

Bug fix: in wizard/invoice_merge.py, replace "todo_ids +=" by "todo_ids =". Otherwise the browse on po tries to browse so ids.

Also, I would move this part which reconnects the so/po to the invoices from wizard/invoice_merge.py to invoice.py/do_merge() so do_merge implements the whole algorithm and can be called from elsewhere without surprise.

review: Needs Fixing (testing)
24. By Laetitia Gangloff (Acsone)

account_invoice_merge : replace osv by orm

25. By Laetitia Gangloff (Acsone)

account_invoice_merge : replace label from invoice_merge_view.xml with html

26. By Laetitia Gangloff (Acsone)

account_invoice_merge : replace "todo_ids +=" by "todo_ids" and move it in invoice.py

Revision history for this message
Laetitia Gangloff (Acsone) (laetitia-gangloff) wrote :

Hello,

I use orm instead of osv.
I rewrite the label of the view 'account_invoice_merge/wizard/invoice_merge_view.xml'.
I replace "todo_ids +=" by "todo_ids =" and move this part in invoice.py.

27. By Laetitia Gangloff (Acsone)

account_invoice_merge : rename order to invoice

28. By Laetitia Gangloff (Acsone)

account_invoice_merge: update dependance management

29. By Laetitia Gangloff (Acsone)

account_invoice_merge: use commercial_partner_id instead of partner_id

Revision history for this message
Laetitia Gangloff (Acsone) (laetitia-gangloff) wrote :

I rename 'order' in 'invoice'.
I replace dependance on sale and purchase by checking if modules are loaded.

As you suggest, I use commercial_partner_id instead of partner_id for the merge key.

Thank you.

Revision history for this message
Stéphane Bidoul (Acsone) (sbi) wrote :

@Niels,

Now that I think of it, the merge of invoices to different partner_id would result in silently using the contact of the first invoice and dropping the others.

To solve this the wizard would need to be made more sophisticated, so we'll leave that improvement to future contributors.

-sbi

30. By Laetitia Gangloff (Acsone)

account_invoice_merge: revert last commit (use of commercial_partner_id)

Revision history for this message
Stéphane Bidoul (Acsone) (sbi) wrote :

Looks good. Approved!

review: Approve
Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :
review: Needs Information
Revision history for this message
Stéphane Bidoul (Acsone) (sbi) wrote :

Hello Guewen and community,

Y <email address hidden>es they the MP have the same goal and stem
from the same Elico module. Apparently both teams did the same work in the
exact same timeframe. Romain's branch came one day before Laetitia's.

There is a process question here: how can we (not being part of the
Community Reviewers group - yet :) receive notifications of changes and MP
to community branches? The question is even broader: how can someone
interested in doing some code review receive notifications of community
activities. Thanks in advance for hints in this area.

Now these two MP need to be merged. At first glance there is good
improvements in both. It seems Laetitia's branch got a bit more scrutiny so
far? Another way to decide which of the two goes forward could be to decide
the best project to receive it. Is it account-invoicing, or
account-financial-tools. My intuition would go to account-invoicing as this
module is exclusively about invoices.

-sbi

On Mon, Jul 22, 2013 at 10:20 AM, Guewen Baconnier @ Camptocamp <
<email address hidden>> wrote:

> Review: Needs Information
>
> Is it the same module than?
>
> https://code.launchpad.net/~camptocamp/account-financial-tools/7.0-add-account_invoice_merge/+merge/171119
>
> Can both MPs converge in an unique MP?
> --
>
> https://code.launchpad.net/~laetitia-gangloff/account-invoicing/account_invoice_merge/+merge/171247
> You are reviewing the proposed merge of
> lp:~laetitia-gangloff/account-invoicing/account_invoice_merge into
> lp:account-invoicing.
>

Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote :

About which MP should be the base to converge both in one, it seams Leatitia's MP is more advanced in the porting with details such as in views specifics to v7.0 and few more cleaning.

Furthermore, I agree with Stéphane, account-invoicing is certainly better than account-financial-tools branch

So let's keep this branch and bring what is needed from Romain's one?

Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote :

l490, fields imported but unused
l492 _ imported but unused
l538 bad indentation for comment

l500 - l629 do_merge method is too long - can be refactored using Romain's changes

l689 fields imported but unused

l760 doesn't po and so need to be rewritten with invoice ids ? (Romain's changes)

review: Needs Fixing
31. By Laetitia Gangloff (Acsone)

account_invoice_merge: refactor do_merge method and some cleanup.

Revision history for this message
Laetitia Gangloff (Acsone) (laetitia-gangloff) wrote :

Hello,

I refactor do_merge method using Romain's changes.
I remove unused import and correct the comment indentation.

doesn't po and so need to be rewritten with invoice ids ?
As suggested by Stéphane, the part which reconnects the so/po to the invoice move from wizard/invoice_merge.py to invoice.py/do_merge() so do_merge implements the whole algorithm and can be called from elsewhere without surprise.

Thank you

Revision history for this message
Stéphane Bidoul (Acsone) (sbi) wrote :

nitpicking for readability:
- L161 new_invoice should be new_invoice_id
- org_invoice is org_so/org_po in L174/L182
- pep8 whitespace in L177 & L179

A question: where is the link from so line to invoice visible for the user?

review: Needs Fixing
33. By Laetitia Gangloff (Acsone)

account_invoice_merge: update some labels

Revision history for this message
Stéphane Bidoul (Acsone) (sbi) :
review: Approve
Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) :
review: Approve (code, no test)
Revision history for this message
Stéphane Bidoul (Acsone) (sbi) wrote :

Is this one good for merging?

Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) :
review: Approve
Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

I just merged the MP. Thanks all.

Revision history for this message
xrg (xrg) wrote :

This module has clearly copied code from "account_invoice_merge" from extra-addons 6.0. Hence the copyright of Elico is false!

review: Disapprove
Revision history for this message
Eric Caudal - www.elico-corp.com (elicoidal) wrote :

I think the copyright is correct ;)

xrg <email address hidden> wrote:

>Review: Disapprove
>
>This module has clearly copied code from "account_invoice_merge" from extra-addons 6.0. Hence the copyright of Elico is false!
>
>
>--
>https://code.launchpad.net/~laetitia-gangloff/account-invoicing/account_invoice_merge/+merge/171247
>Your team Account Core Editors is subscribed to branch lp:account-invoicing.

Revision history for this message
xrg (xrg) wrote :

so, you think you can replace copyright holders?

Then s/Elico Corp/whatever/g !

Revision history for this message
Stéphane Bidoul (Acsone) (sbi) wrote :

There is still a copyright Tiny SPRL in invoice.py. This one goes back to
the original commit from Elico and is probably a mistake (Eric?).

Other than that I don't see any copyright issue. Credits are properly
attributed and commit history is prorperly preserved.

-sbi

On Fri, Aug 30, 2013 at 1:21 PM, xrg <email address hidden> wrote:

> so, you think you can replace copyright holders?
>
>
> Then s/Elico Corp/whatever/g !
>
> --
>
> https://code.launchpad.net/~laetitia-gangloff/account-invoicing/account_invoice_merge/+merge/171247
> You are reviewing the proposed merge of
> lp:~laetitia-gangloff/account-invoicing/account_invoice_merge into
> lp:account-invoicing.
>

Revision history for this message
Eric Caudal - www.elico-corp.com (elicoidal) wrote :

We probably kept the original copyright because most of the code was
copied directly from invoice.py for inheritance.
I dont know what would be the common practice in this case: add a line
with Elico Copyright + other contributors?

Eric CAUDAL

Eric Caudal
/CEO/
--
*Elico Corporation, Shanghai branch
/OpenERP Premium Certified Training Partner/ *
Cell: + 86 186 2136 1670
Office: + 86 21 6211 8017/27/37
Skype: elico.corp
<email address hidden> <mailto:<email address hidden>>
http://www.elico-corp.com

Elico Corp
On 30/08/2013 19:36, Stéphane Bidoul (Acsone) wrote:
> There is still a copyright Tiny SPRL in invoice.py. This one goes back to
> the original commit from Elico and is probably a mistake (Eric?).
>
> Other than that I don't see any copyright issue. Credits are properly
> attributed and commit history is prorperly preserved.
>
> -sbi
>
>
> On Fri, Aug 30, 2013 at 1:21 PM, xrg <email address hidden> wrote:
>
>> so, you think you can replace copyright holders?
>>
>>
>> Then s/Elico Corp/whatever/g !
>>
>> --
>>
>> https://code.launchpad.net/~laetitia-gangloff/account-invoicing/account_invoice_merge/+merge/171247
>> You are reviewing the proposed merge of
>> lp:~laetitia-gangloff/account-invoicing/account_invoice_merge into
>> lp:account-invoicing.
>>

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'account_invoice_merge'
2=== added file 'account_invoice_merge/__init__.py'
3--- account_invoice_merge/__init__.py 1970-01-01 00:00:00 +0000
4+++ account_invoice_merge/__init__.py 2013-08-06 10:17:31 +0000
5@@ -0,0 +1,25 @@
6+# -*- coding: utf-8 -*-
7+##############################################################################
8+#
9+# OpenERP, Open Source Management Solution
10+# Copyright (c) 2010-2011 Elico Corp. All Rights Reserved.
11+#
12+# This program is free software: you can redistribute it and/or modify
13+# it under the terms of the GNU Affero General Public License as
14+# published by the Free Software Foundation, either version 3 of the
15+# License, or (at your option) any later version.
16+#
17+# This program is distributed in the hope that it will be useful,
18+# but WITHOUT ANY WARRANTY; without even the implied warranty of
19+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20+# GNU Affero General Public License for more details.
21+#
22+# You should have received a copy of the GNU Affero General Public License
23+# along with this program. If not, see <http://www.gnu.org/licenses/>.
24+#
25+##############################################################################
26+import invoice
27+import wizard
28+
29+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
30+
31
32=== added file 'account_invoice_merge/__openerp__.py'
33--- account_invoice_merge/__openerp__.py 1970-01-01 00:00:00 +0000
34+++ account_invoice_merge/__openerp__.py 2013-08-06 10:17:31 +0000
35@@ -0,0 +1,47 @@
36+# -*- coding: utf-8 -*-
37+##############################################################################
38+#
39+# OpenERP, Open Source Management Solution
40+# Copyright (c) 2010-2011 Elico Corp. All Rights Reserved.
41+# Author: Ian Li <ian.li@elico-corp.com>
42+#
43+# This program is free software: you can redistribute it and/or modify
44+# it under the terms of the GNU Affero General Public License as
45+# published by the Free Software Foundation, either version 3 of the
46+# License, or (at your option) any later version.
47+#
48+# This program is distributed in the hope that it will be useful,
49+# but WITHOUT ANY WARRANTY; without even the implied warranty of
50+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
51+# GNU Affero General Public License for more details.
52+#
53+# You should have received a copy of the GNU Affero General Public License
54+# along with this program. If not, see <http://www.gnu.org/licenses/>.
55+#
56+##############################################################################
57+
58+{
59+ 'name': 'Account Invoice Merge Wizard',
60+ 'version': '1.1',
61+ 'category': 'Finance',
62+ 'description': """
63+This module adds an action in the invoices lists to merge of invoices. Here are the condition to allow merge:
64+- Type should be the same (customer Invoice, supplier invoice, Customer or Supplier Refund)
65+- Partner should be the same
66+- Currency should be the same
67+- Account receivable account should be the same
68+ """,
69+ 'author': 'Elico Corp',
70+ 'website': 'http://www.openerp.net.cn',
71+ 'depends': ['account'],
72+ 'data': [
73+ 'wizard/invoice_merge_view.xml',
74+ ],
75+ 'test': [
76+ ],
77+ 'demo': [],
78+ 'installable': True,
79+ 'active': False,
80+ 'certificate': False,
81+}
82+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
83
84=== added directory 'account_invoice_merge/i18n'
85=== added file 'account_invoice_merge/i18n/account_invoice_merge.pot'
86--- account_invoice_merge/i18n/account_invoice_merge.pot 1970-01-01 00:00:00 +0000
87+++ account_invoice_merge/i18n/account_invoice_merge.pot 2013-08-06 10:17:31 +0000
88@@ -0,0 +1,136 @@
89+# Translation of OpenERP Server.
90+# This file contains the translation of the following modules:
91+# * account_invoice_merge
92+#
93+msgid ""
94+msgstr ""
95+"Project-Id-Version: OpenERP Server 7.0\n"
96+"Report-Msgid-Bugs-To: \n"
97+"POT-Creation-Date: 2013-06-25 08:40+0000\n"
98+"PO-Revision-Date: 2013-06-25 08:40+0000\n"
99+"Last-Translator: <>\n"
100+"Language-Team: \n"
101+"MIME-Version: 1.0\n"
102+"Content-Type: text/plain; charset=UTF-8\n"
103+"Content-Transfer-Encoding: \n"
104+"Plural-Forms: \n"
105+
106+#. module: account_invoice_merge
107+#: code:addons/account_invoice_merge/wizard/invoice_merge.py:34
108+#, python-format
109+msgid "Please select multiple invoice to merge in the list view."
110+msgstr ""
111+
112+#. module: account_invoice_merge
113+#: code:addons/account_invoice_merge/wizard/invoice_merge.py:44
114+#, python-format
115+msgid "Not all invoices are at the same company!"
116+msgstr ""
117+
118+#. module: account_invoice_merge
119+#: code:addons/account_invoice_merge/wizard/invoice_merge.py:40
120+#, python-format
121+msgid "At least one of the selected invoices is %s!"
122+msgstr ""
123+
124+#. module: account_invoice_merge
125+#: view:invoice.merge:0
126+#: model:ir.actions.act_window,name:account_invoice_merge.action_view_invoice_merge
127+#: model:ir.model,name:account_invoice_merge.model_invoice_merge
128+msgid "Merge Partner Invoice"
129+msgstr ""
130+
131+#. module: account_invoice_merge
132+#: code:addons/account_invoice_merge/wizard/invoice_merge.py:48
133+#, python-format
134+msgid "Not all invoices are of the same type!"
135+msgstr ""
136+
137+#. module: account_invoice_merge
138+#: code:addons/account_invoice_merge/wizard/invoice_merge.py:107
139+#, python-format
140+msgid "Partner Invoice"
141+msgstr ""
142+
143+#. module: account_invoice_merge
144+#: view:invoice.merge:0
145+msgid " Please note that: \n"
146+" \n"
147+" Invoices will only be merged if: \n"
148+" * Invoices are in draft \n"
149+" * Invoices belong to the same partner \n"
150+" * Invoices are have same company, partner, address, currency, journal, salesman, account, type \n"
151+" \n"
152+" Lines will only be merged if: \n"
153+" * Invoice lines are exactly the same except for the product,quantity and unit \n"
154+" "
155+msgstr ""
156+
157+#. module: account_invoice_merge
158+#: view:invoice.merge:0
159+msgid "or"
160+msgstr ""
161+
162+#. module: account_invoice_merge
163+#: code:addons/account_invoice_merge/wizard/invoice_merge.py:42
164+#, python-format
165+msgid "Not all invoices use the same account!"
166+msgstr ""
167+
168+#. module: account_invoice_merge
169+#: view:invoice.merge:0
170+msgid "Merge Invoices"
171+msgstr ""
172+
173+#. module: account_invoice_merge
174+#: code:addons/account_invoice_merge/wizard/invoice_merge.py:40
175+#: code:addons/account_invoice_merge/wizard/invoice_merge.py:42
176+#: code:addons/account_invoice_merge/wizard/invoice_merge.py:44
177+#: code:addons/account_invoice_merge/wizard/invoice_merge.py:46
178+#: code:addons/account_invoice_merge/wizard/invoice_merge.py:48
179+#: code:addons/account_invoice_merge/wizard/invoice_merge.py:50
180+#: code:addons/account_invoice_merge/wizard/invoice_merge.py:52
181+#, python-format
182+msgid "Warning"
183+msgstr ""
184+
185+#. module: account_invoice_merge
186+#: code:addons/account_invoice_merge/wizard/invoice_merge.py:34
187+#, python-format
188+msgid "Warning!"
189+msgstr ""
190+
191+#. module: account_invoice_merge
192+#: model:ir.model,name:account_invoice_merge.model_account_invoice
193+msgid "Invoice"
194+msgstr ""
195+
196+#. module: account_invoice_merge
197+#: view:invoice.merge:0
198+msgid "Cancel"
199+msgstr ""
200+
201+#. module: account_invoice_merge
202+#: code:addons/account_invoice_merge/wizard/invoice_merge.py:52
203+#, python-format
204+msgid "Not all invoices are at the same journal!"
205+msgstr ""
206+
207+#. module: account_invoice_merge
208+#: code:addons/account_invoice_merge/wizard/invoice_merge.py:50
209+#, python-format
210+msgid "Not all invoices are at the same currency!"
211+msgstr ""
212+
213+#. module: account_invoice_merge
214+#: view:invoice.merge:0
215+msgid "Are you sure you want to merge these invoices ?"
216+msgstr ""
217+
218+#. module: account_invoice_merge
219+#: code:addons/account_invoice_merge/wizard/invoice_merge.py:46
220+#, python-format
221+msgid "Not all invoices are for the same partner!"
222+msgstr ""
223+
224+
225
226=== added file 'account_invoice_merge/i18n/fr.po'
227--- account_invoice_merge/i18n/fr.po 1970-01-01 00:00:00 +0000
228+++ account_invoice_merge/i18n/fr.po 2013-08-06 10:17:31 +0000
229@@ -0,0 +1,144 @@
230+# Translation of OpenERP Server.
231+# This file contains the translation of the following modules:
232+# * account_invoice_merge
233+#
234+msgid ""
235+msgstr ""
236+"Project-Id-Version: OpenERP Server 7.0\n"
237+"Report-Msgid-Bugs-To: \n"
238+"POT-Creation-Date: 2013-06-25 08:40+0000\n"
239+"PO-Revision-Date: 2013-06-25 08:40+0000\n"
240+"Last-Translator: <>\n"
241+"Language-Team: \n"
242+"MIME-Version: 1.0\n"
243+"Content-Type: text/plain; charset=UTF-8\n"
244+"Content-Transfer-Encoding: \n"
245+"Plural-Forms: \n"
246+
247+#. module: account_invoice_merge
248+#: code:addons/account_invoice_merge/wizard/invoice_merge.py:34
249+#, python-format
250+msgid "Please select multiple invoice to merge in the list view."
251+msgstr "Veuillez selectionner dans la liste plusieurs factures à fusionner"
252+
253+#. module: account_invoice_merge
254+#: code:addons/account_invoice_merge/wizard/invoice_merge.py:44
255+#, python-format
256+msgid "Not all invoices are at the same company!"
257+msgstr "Toutes les factures n'appartiennent pas à la même société !"
258+
259+#. module: account_invoice_merge
260+#: code:addons/account_invoice_merge/wizard/invoice_merge.py:40
261+#, python-format
262+msgid "At least one of the selected invoices is %s!"
263+msgstr "Au moins une des factures sélectionnées est %s !"
264+
265+#. module: account_invoice_merge
266+#: view:invoice.merge:0
267+#: model:ir.actions.act_window,name:account_invoice_merge.action_view_invoice_merge
268+#: model:ir.model,name:account_invoice_merge.model_invoice_merge
269+msgid "Merge Partner Invoice"
270+msgstr "Fusion de facture de patenaire"
271+
272+#. module: account_invoice_merge
273+#: code:addons/account_invoice_merge/wizard/invoice_merge.py:48
274+#, python-format
275+msgid "Not all invoices are of the same type!"
276+msgstr "Toutes les factures ne sont pas du même type !"
277+
278+#. module: account_invoice_merge
279+#: code:addons/account_invoice_merge/wizard/invoice_merge.py:107
280+#, python-format
281+msgid "Partner Invoice"
282+msgstr "Facture de patenaire"
283+
284+#. module: account_invoice_merge
285+#: view:invoice.merge:0
286+msgid " Please note that: \n"
287+" \n"
288+" Invoices will only be merged if: \n"
289+" * Invoices are in draft \n"
290+" * Invoices belong to the same partner \n"
291+" * Invoices are have same company, partner, address, currency, journal, salesman, account, type \n"
292+" \n"
293+" Lines will only be merged if: \n"
294+" * Invoice lines are exactly the same except for the product,quantity and unit \n"
295+" "
296+msgstr " Veuillez noter que :\n"
297+"\n"
298+" Les factures seront fusionnées seulement si :\n"
299+" * Les factures sont dans l'état brouillon\n"
300+" * Les factures appartiennent au même patenaire\n"
301+" * Les facture possédent les même société, partenaire, adresse, devise, journal, vendeur, compte, type\n"
302+"\n"
303+" Les lignes seront fusionnées seulement si :\n"
304+" * Les lignes de facture sont identique à l'exception de la quantité et de l'unité\n"
305+
306+#. module: account_invoice_merge
307+#: view:invoice.merge:0
308+msgid "or"
309+msgstr "ou"
310+
311+#. module: account_invoice_merge
312+#: code:addons/account_invoice_merge/wizard/invoice_merge.py:42
313+#, python-format
314+msgid "Not all invoices use the same account!"
315+msgstr "Toutes les factures n'utilisent pas le même compte !"
316+
317+#. module: account_invoice_merge
318+#: view:invoice.merge:0
319+msgid "Merge Invoices"
320+msgstr "Fusion de factures"
321+
322+#. module: account_invoice_merge
323+#: code:addons/account_invoice_merge/wizard/invoice_merge.py:40
324+#: code:addons/account_invoice_merge/wizard/invoice_merge.py:42
325+#: code:addons/account_invoice_merge/wizard/invoice_merge.py:44
326+#: code:addons/account_invoice_merge/wizard/invoice_merge.py:46
327+#: code:addons/account_invoice_merge/wizard/invoice_merge.py:48
328+#: code:addons/account_invoice_merge/wizard/invoice_merge.py:50
329+#: code:addons/account_invoice_merge/wizard/invoice_merge.py:52
330+#, python-format
331+msgid "Warning"
332+msgstr "Attention"
333+
334+#. module: account_invoice_merge
335+#: code:addons/account_invoice_merge/wizard/invoice_merge.py:34
336+#, python-format
337+msgid "Warning!"
338+msgstr "Attention !"
339+
340+#. module: account_invoice_merge
341+#: model:ir.model,name:account_invoice_merge.model_account_invoice
342+msgid "Invoice"
343+msgstr "Facture"
344+
345+#. module: account_invoice_merge
346+#: view:invoice.merge:0
347+msgid "Cancel"
348+msgstr "Annuler"
349+
350+#. module: account_invoice_merge
351+#: code:addons/account_invoice_merge/wizard/invoice_merge.py:52
352+#, python-format
353+msgid "Not all invoices are at the same journal!"
354+msgstr "Toutes les factures ne sont pas dans le même journal !"
355+
356+#. module: account_invoice_merge
357+#: code:addons/account_invoice_merge/wizard/invoice_merge.py:50
358+#, python-format
359+msgid "Not all invoices are at the same currency!"
360+msgstr "Toutes les factures ne sont pas dans la même devise !"
361+
362+#. module: account_invoice_merge
363+#: view:invoice.merge:0
364+msgid "Are you sure you want to merge these invoices ?"
365+msgstr "Êtes vous certain de vouloir fusionner ces factures ?"
366+
367+#. module: account_invoice_merge
368+#: code:addons/account_invoice_merge/wizard/invoice_merge.py:46
369+#, python-format
370+msgid "Not all invoices are for the same partner!"
371+msgstr "Toutes les factures ne sont pas du même partenaire !"
372+
373+
374
375=== added file 'account_invoice_merge/i18n/zh_CN.po'
376--- account_invoice_merge/i18n/zh_CN.po 1970-01-01 00:00:00 +0000
377+++ account_invoice_merge/i18n/zh_CN.po 2013-08-06 10:17:31 +0000
378@@ -0,0 +1,85 @@
379+# Translation of OpenERP Server.
380+# This file contains the translation of the following modules:
381+# * account_invoice_merge
382+#
383+msgid ""
384+msgstr ""
385+"Project-Id-Version: OpenERP Server 6.0.3\n"
386+"Report-Msgid-Bugs-To: support@openerp.com\n"
387+"POT-Creation-Date: 2012-05-07 02:54+0000\n"
388+"PO-Revision-Date: 2012-05-07 02:54+0000\n"
389+"Last-Translator: <>\n"
390+"Language-Team: \n"
391+"MIME-Version: 1.0\n"
392+"Content-Type: text/plain; charset=UTF-8\n"
393+"Content-Transfer-Encoding: \n"
394+"Plural-Forms: \n"
395+
396+#. module: account_invoice_merge
397+#: model:ir.model,name:account_invoice_merge.model_account_invoice
398+msgid "Invoice"
399+msgstr "发票"
400+
401+#. module: account_invoice_merge
402+#: code:addons/account_invoice_merge/wizard/invoice_merge.py:86
403+#, python-format
404+msgid "Partner Invoice"
405+msgstr "合作伙伴发票"
406+
407+#. module: account_invoice_merge
408+#: view:invoice.merge:0
409+msgid " Please note that: \n"
410+" \n"
411+" Invoices will only be merged if: \n"
412+" * Invoices are in draft \n"
413+" * Invoices belong to the same partner \n"
414+" * Invoices are have same company, partner, address, currency, journal, salesman, account, type \n"
415+" \n"
416+" Lines will only be merged if: \n"
417+" * Invoice lines are exactly the same except for the product,quantity and unit \n"
418+" "
419+msgstr " 请注意: \n"
420+" \n"
421+"符合下列条件,才会被合并: \n"
422+" * 仍在草稿状态的发票。 \n"
423+" * 属于同一合作伙伴的发票。 \n"
424+" * 属于同一公司,有相同币别,账簿,业务员,科目及类型等的发票。 \n"
425+" \n"
426+" 符合下列条件,发票明细才会被合并: \n"
427+" * 除了明细的产品,数量,价格,金额等字段外,发票明细必须一致。 \n"
428+" "
429+
430+#. module: account_invoice_merge
431+#: code:addons/account_invoice_merge/wizard/invoice_merge.py:48
432+#, python-format
433+msgid "Please select multiple invoice to merge in the list view."
434+msgstr "请在列表视图里选择多个发票来进行合并。"
435+
436+#. module: account_invoice_merge
437+#: view:invoice.merge:0
438+msgid "Merge Invoices"
439+msgstr "合并发票"
440+
441+#. module: account_invoice_merge
442+#: code:addons/account_invoice_merge/wizard/invoice_merge.py:47
443+#, python-format
444+msgid "Warning"
445+msgstr "警告"
446+
447+#. module: account_invoice_merge
448+#: view:invoice.merge:0
449+#: model:ir.actions.act_window,name:account_invoice_merge.action_view_invoice_merge
450+#: model:ir.model,name:account_invoice_merge.model_invoice_merge
451+msgid "Merge Partner Invoice"
452+msgstr "合并发票"
453+
454+#. module: account_invoice_merge
455+#: view:invoice.merge:0
456+msgid "Cancel"
457+msgstr "取消"
458+
459+#. module: account_invoice_merge
460+#: view:invoice.merge:0
461+msgid "Are you sure you want to merge these invoices ?"
462+msgstr "您确认合并这些发票?"
463+
464
465=== added file 'account_invoice_merge/invoice.py'
466--- account_invoice_merge/invoice.py 1970-01-01 00:00:00 +0000
467+++ account_invoice_merge/invoice.py 2013-08-06 10:17:31 +0000
468@@ -0,0 +1,187 @@
469+# -*- coding: utf-8 -*-
470+##############################################################################
471+#
472+# OpenERP, Open Source Management Solution
473+# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
474+#
475+# This program is free software: you can redistribute it and/or modify
476+# it under the terms of the GNU Affero General Public License as
477+# published by the Free Software Foundation, either version 3 of the
478+# License, or (at your option) any later version.
479+#
480+# This program is distributed in the hope that it will be useful,
481+# but WITHOUT ANY WARRANTY; without even the implied warranty of
482+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
483+# GNU Affero General Public License for more details.
484+#
485+# You should have received a copy of the GNU Affero General Public License
486+# along with this program. If not, see <http://www.gnu.org/licenses/>.
487+#
488+##############################################################################
489+
490+from openerp.osv import orm
491+from openerp import netsvc
492+from osv.orm import browse_record, browse_null
493+
494+
495+class account_invoice(orm.Model):
496+ _inherit = "account.invoice"
497+
498+ def _get_first_invoice_fields(self, cr, uid, invoice):
499+ return {'origin': '%s' % (invoice.origin or '',),
500+ 'partner_id': invoice.partner_id.id,
501+ 'journal_id': invoice.journal_id.id,
502+ 'user_id': invoice.user_id.id,
503+ 'currency_id': invoice.currency_id.id,
504+ 'company_id': invoice.company_id.id,
505+ 'type': invoice.type,
506+ 'account_id': invoice.account_id.id,
507+ 'state': 'draft',
508+ 'reference': '%s' % (invoice.reference or '',),
509+ 'name': '%s' % (invoice.name or '',),
510+ 'fiscal_position': invoice.fiscal_position and invoice.fiscal_position.id or False,
511+ 'payment_term': invoice.payment_term and invoice.payment_term.id or False,
512+ 'period_id': invoice.period_id and invoice.period_id.id or False,
513+ 'invoice_line': {},
514+ }
515+
516+ def _get_invoice_key_cols(self, cr, uid, invoice):
517+ return ('partner_id', 'user_id', 'type',
518+ 'account_id', 'currency_id',
519+ 'journal_id', 'company_id')
520+
521+ def _get_invoice_line_key_cols(self, cr, uid, invoice_line):
522+ return ('name', 'origin', 'discount',
523+ 'invoice_line_tax_id', 'price_unit',
524+ 'product_id', 'account_id',
525+ 'account_analytic_id')
526+
527+ def do_merge(self, cr, uid, ids, context=None):
528+ """
529+ To merge similar type of account invoices.
530+ Invoices will only be merged if:
531+ * Account invoices are in draft
532+ * Account invoices belong to the same partner
533+ * Account invoices are have same company, partner, address, currency, journal, currency, salesman, account, type
534+ Lines will only be merged if:
535+ * Invoice lines are exactly the same except for the quantity and unit
536+
537+ @param self: The object pointer.
538+ @param cr: A database cursor
539+ @param uid: ID of the user currently logged in
540+ @param ids: the ID or list of IDs
541+ @param context: A standard dictionary
542+
543+ @return: new account invoice id
544+
545+ """
546+ wf_service = netsvc.LocalService("workflow")
547+
548+ def make_key(br, fields):
549+ list_key = []
550+ for field in fields:
551+ field_val = getattr(br, field)
552+ if field in ('product_id', 'account_id'):
553+ if not field_val:
554+ field_val = False
555+ if isinstance(field_val, browse_record):
556+ field_val = field_val.id
557+ elif isinstance(field_val, browse_null):
558+ field_val = False
559+ elif isinstance(field_val, list):
560+ field_val = ((6, 0, tuple([v.id for v in field_val])),)
561+ list_key.append((field, field_val))
562+ list_key.sort()
563+ return tuple(list_key)
564+
565+ # compute what the new invoices should contain
566+
567+ new_invoices = {}
568+ draft_invoices = [invoice
569+ for invoice in self.browse(cr, uid, ids, context=context)
570+ if invoice.state == 'draft']
571+ seen_origins = {}
572+ seen_client_refs = {}
573+
574+ for account_invoice in draft_invoices:
575+ invoice_key = make_key(account_invoice, self._get_invoice_key_cols(cr, uid, account_invoice))
576+ new_invoice = new_invoices.setdefault(invoice_key, ({}, []))
577+ origins = seen_origins.setdefault(invoice_key, set())
578+ client_refs = seen_client_refs.setdefault(invoice_key, set())
579+ new_invoice[1].append(account_invoice.id)
580+ invoice_infos = new_invoice[0]
581+ if not invoice_infos:
582+ invoice_infos.update(self._get_first_invoice_fields(cr, uid, account_invoice))
583+ origins.add(account_invoice.origin)
584+ client_refs.add(account_invoice.reference)
585+ else:
586+ if account_invoice.name:
587+ invoice_infos['name'] = (invoice_infos['name'] or '') + (' %s' % (account_invoice.name,))
588+ if account_invoice.origin and account_invoice.origin not in origins:
589+ invoice_infos['origin'] = (invoice_infos['origin'] or '') + ' ' + account_invoice.origin
590+ origins.add(account_invoice.origin)
591+ if account_invoice.reference and account_invoice.reference not in client_refs:
592+ invoice_infos['reference'] = (invoice_infos['reference'] or '') + (' %s' % (account_invoice.reference,))
593+ client_refs.add(account_invoice.reference)
594+
595+ for invoice_line in account_invoice.invoice_line:
596+ line_key = make_key(invoice_line, self._get_invoice_line_key_cols(cr, uid, invoice_line))
597+ o_line = invoice_infos['invoice_line'].setdefault(line_key, {})
598+ if o_line:
599+ # merge the line with an existing line
600+ o_line['quantity'] += invoice_line.quantity * invoice_line.uos_id.factor / o_line['uom_factor']
601+ else:
602+ # append a new "standalone" line
603+ for field in ('quantity', 'uos_id'):
604+ field_val = getattr(invoice_line, field)
605+ if isinstance(field_val, browse_record):
606+ field_val = field_val.id
607+ o_line[field] = field_val
608+ o_line['uom_factor'] = invoice_line.uos_id and invoice_line.uos_id.factor or 1.0
609+
610+ allinvoices = []
611+ invoices_info = {}
612+ for invoice_key, (invoice_data, old_ids) in new_invoices.iteritems():
613+ # skip merges with only one invoice
614+ if len(old_ids) < 2:
615+ allinvoices += (old_ids or [])
616+ continue
617+
618+ # cleanup invoice line data
619+ for key, value in invoice_data['invoice_line'].iteritems():
620+ del value['uom_factor']
621+ value.update(dict(key))
622+ invoice_data['invoice_line'] = [(0, 0, value) for value in invoice_data['invoice_line'].itervalues()]
623+
624+ # create the new invoice
625+ newinvoice_id = self.create(cr, uid, invoice_data)
626+ invoices_info.update({newinvoice_id: old_ids})
627+ allinvoices.append(newinvoice_id)
628+
629+ # make triggers pointing to the old invoices point to the new invoice
630+ for old_id in old_ids:
631+ wf_service.trg_redirect(uid, 'account.invoice', old_id, newinvoice_id, cr)
632+ wf_service.trg_validate(uid, 'account.invoice', old_id, 'invoice_cancel', cr)
633+
634+ # make link between original sale order or purchase order
635+ so_obj = self.pool.get('sale.order') # None if sale is not installed
636+ order_line_obj = self.pool.get('sale.order.line')
637+ invoice_line_obj = self.pool.get('account.invoice.line')
638+ po_obj = self.pool.get('purchase.order') # None if purchase is not installed
639+ for new_invoice_id in invoices_info:
640+ if so_obj is not None:
641+ todo_ids = so_obj.search(cr, uid, [('invoice_ids', 'in', invoices_info[new_invoice_id])], context=context)
642+ for org_so in so_obj.browse(cr, uid, todo_ids, context=context):
643+ so_obj.write(cr, uid, [org_so.id], {'invoice_ids': [(4, new_invoice_id)]}, context)
644+ for so_line in org_so.order_line:
645+ invoice_line_ids = invoice_line_obj.search(cr, uid, [('product_id', '=', so_line.product_id.id), ('invoice_id', '=', new_invoice_id)])
646+ if invoice_line_ids:
647+ order_line_obj.write(cr, uid, [so_line.id], {'invoice_lines': [(6, 0, invoice_line_ids)]}, context=context)
648+ if po_obj is not None:
649+ todo_ids = po_obj.search(cr, uid, [('invoice_ids', 'in', invoices_info[new_invoice_id])], context=context)
650+ for org_po in po_obj.browse(cr, uid, todo_ids, context=context):
651+ po_obj.write(cr, uid, [org_po.id], {'invoice_ids': [(4, new_invoice_id)]}, context)
652+
653+ return invoices_info
654+
655+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
656
657=== added directory 'account_invoice_merge/wizard'
658=== added file 'account_invoice_merge/wizard/__init__.py'
659--- account_invoice_merge/wizard/__init__.py 1970-01-01 00:00:00 +0000
660+++ account_invoice_merge/wizard/__init__.py 2013-08-06 10:17:31 +0000
661@@ -0,0 +1,25 @@
662+# -*- coding: utf-8 -*-
663+##############################################################################
664+#
665+# OpenERP, Open Source Management Solution
666+# Copyright (c) 2010-2011 Elico Corp. All Rights Reserved.
667+#
668+# This program is free software: you can redistribute it and/or modify
669+# it under the terms of the GNU Affero General Public License as
670+# published by the Free Software Foundation, either version 3 of the
671+# License, or (at your option) any later version.
672+#
673+# This program is distributed in the hope that it will be useful,
674+# but WITHOUT ANY WARRANTY; without even the implied warranty of
675+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
676+# GNU Affero General Public License for more details.
677+#
678+# You should have received a copy of the GNU Affero General Public License
679+# along with this program. If not, see <http://www.gnu.org/licenses/>.
680+#
681+##############################################################################
682+
683+import invoice_merge
684+
685+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
686+
687
688=== added file 'account_invoice_merge/wizard/invoice_merge.py'
689--- account_invoice_merge/wizard/invoice_merge.py 1970-01-01 00:00:00 +0000
690+++ account_invoice_merge/wizard/invoice_merge.py 2013-08-06 10:17:31 +0000
691@@ -0,0 +1,105 @@
692+# -*- coding: utf-8 -*-
693+##############################################################################
694+#
695+# OpenERP, Open Source Management Solution
696+# Copyright (c) 2010-2011 Elico Corp. All Rights Reserved.
697+#
698+# This program is free software: you can redistribute it and/or modify
699+# it under the terms of the GNU Affero General Public License as
700+# published by the Free Software Foundation, either version 3 of the
701+# License, or (at your option) any later version.
702+#
703+# This program is distributed in the hope that it will be useful,
704+# but WITHOUT ANY WARRANTY; without even the implied warranty of
705+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
706+# GNU Affero General Public License for more details.
707+#
708+# You should have received a copy of the GNU Affero General Public License
709+# along with this program. If not, see <http://www.gnu.org/licenses/>.
710+#
711+##############################################################################
712+
713+from openerp.osv import orm
714+from openerp.tools.translate import _
715+
716+
717+class invoice_merge(orm.TransientModel):
718+ _name = "invoice.merge"
719+ _description = "Merge Partner Invoice"
720+
721+ def _dirty_check(self, cr, uid, context):
722+ if context.get('active_model', '') == 'account.invoice':
723+ ids = context['active_ids']
724+ if len(ids) < 2:
725+ raise orm.except_orm(_('Warning!'), _('Please select multiple invoice to merge in the list view.'))
726+ inv_obj = self.pool.get('account.invoice')
727+ invs = inv_obj.read(cr, uid, ids, ['account_id', 'state', 'type', 'company_id',
728+ 'partner_id', 'currency_id', 'journal_id'])
729+ for d in invs:
730+ if d['state'] != 'draft':
731+ raise orm.except_orm(_('Warning'), _('At least one of the selected invoices is %s!') % d['state'])
732+ if (d['account_id'] != invs[0]['account_id']):
733+ raise orm.except_orm(_('Warning'), _('Not all invoices use the same account!'))
734+ if (d['company_id'] != invs[0]['company_id']):
735+ raise orm.except_orm(_('Warning'), _('Not all invoices are at the same company!'))
736+ if (d['partner_id'] != invs[0]['partner_id']):
737+ raise orm.except_orm(_('Warning'), _('Not all invoices are for the same partner!'))
738+ if (d['type'] != invs[0]['type']):
739+ raise orm.except_orm(_('Warning'), _('Not all invoices are of the same type!'))
740+ if (d['currency_id'] != invs[0]['currency_id']):
741+ raise orm.except_orm(_('Warning'), _('Not all invoices are at the same currency!'))
742+ if (d['journal_id'] != invs[0]['journal_id']):
743+ raise orm.except_orm(_('Warning'), _('Not all invoices are at the same journal!'))
744+ return {}
745+
746+ def fields_view_get(self, cr, uid, view_id=None, view_type='form',
747+ context=None, toolbar=False, submenu=False):
748+ """
749+ Changes the view dynamically
750+ @param self: The object pointer.
751+ @param cr: A database cursor
752+ @param uid: ID of the user currently logged in
753+ @param context: A standard dictionary
754+ @return: New arch of view.
755+ """
756+ if context is None:
757+ context = {}
758+ res = super(invoice_merge, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=False)
759+ self._dirty_check(cr, uid, context)
760+ return res
761+
762+ def merge_invoices(self, cr, uid, ids, context=None):
763+ """
764+ To merge similar type of account invoices.
765+
766+ @param self: The object pointer.
767+ @param cr: A database cursor
768+ @param uid: ID of the user currently logged in
769+ @param ids: the ID or list of IDs
770+ @param context: A standard dictionary
771+
772+ @return: account invoice view
773+
774+ """
775+ inv_obj = self.pool.get('account.invoice')
776+ mod_obj = self.pool.get('ir.model.data')
777+
778+ if context is None:
779+ context = {}
780+ result = mod_obj._get_id(cr, uid, 'account', 'invoice_form')
781+ id = mod_obj.read(cr, uid, result, ['res_id'])
782+
783+ allinvoices = inv_obj.do_merge(cr, uid, context.get('active_ids', []), context)
784+
785+ return {
786+ 'domain': "[('id','in', [" + ','.join(map(str, allinvoices.keys())) + "])]",
787+ 'name': _('Partner Invoice'),
788+ 'view_type': 'form',
789+ 'view_mode': 'tree,form',
790+ 'res_model': 'account.invoice',
791+ 'view_id': False,
792+ 'type': 'ir.actions.act_window',
793+ 'search_view_id': id['res_id']
794+ }
795+
796+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
797
798=== added file 'account_invoice_merge/wizard/invoice_merge_view.xml'
799--- account_invoice_merge/wizard/invoice_merge_view.xml 1970-01-01 00:00:00 +0000
800+++ account_invoice_merge/wizard/invoice_merge_view.xml 2013-08-06 10:17:31 +0000
801@@ -0,0 +1,40 @@
802+<?xml version="1.0" encoding="utf-8"?>
803+<openerp>
804+ <data>
805+ <record id="view_invoice_merge" model="ir.ui.view">
806+ <field name="name">Merger Partner Invoice</field>
807+ <field name="model">invoice.merge</field>
808+ <field name="arch" type="xml">
809+ <form string="Merge Partner Invoice" version="7.0">
810+ <group>
811+ <separator
812+ string="Are you sure you want to merge these invoices ?"
813+ colspan="4" />
814+ <p>
815+Please note that:<br/><br/>
816+Invoices will only be merged if:<br/>
817+* Invoices are in draft<br/>
818+* Invoices belong to the same partner<br/>
819+* Invoices are have same company, partner, address, currency, journal, salesman, account, type<br/><br/>
820+Lines will only be merged if:<br/>
821+* Invoice lines are exactly the same except for the product,quantity and unit<br/>
822+ </p>
823+ </group>
824+ <footer>
825+ <button name="merge_invoices" string="Merge Invoices"
826+ type="object" class="oe_highlight" />
827+ or
828+ <button string="Cancel" class="oe_link"
829+ special="cancel" />
830+ </footer>
831+ </form>
832+ </field>
833+ </record>
834+
835+ <act_window name="Merge Partner Invoice" res_model="invoice.merge"
836+ src_model="account.invoice" view_mode="form" target="new"
837+ multi="True" key2="client_action_multi" id="action_view_invoice_merge" />
838+
839+ </data>
840+</openerp>
841+

Subscribers

People subscribed via source and target branches