Merge lp:~bcim/account-invoicing/7.0-account_invoice_line_default_account into lp:~account-core-editors/account-invoicing/7.0

Proposed by Jacques-Etienne Baudoux
Status: Work in progress
Proposed branch: lp:~bcim/account-invoicing/7.0-account_invoice_line_default_account
Merge into: lp:~account-core-editors/account-invoicing/7.0
Diff against target: 482 lines (+429/-0)
10 files modified
account_invoice_line_default_account/__init__.py (+12/-0)
account_invoice_line_default_account/__openerp__.py (+51/-0)
account_invoice_line_default_account/i18n/account_invoice_line_default_account.pot (+59/-0)
account_invoice_line_default_account/i18n/fr.po (+59/-0)
account_invoice_line_default_account/i18n/nl.po (+59/-0)
account_invoice_line_default_account/model/__init__.py (+4/-0)
account_invoice_line_default_account/model/account_invoice_line.py (+67/-0)
account_invoice_line_default_account/model/res_partner.py (+48/-0)
account_invoice_line_default_account/view/account_invoice.xml (+16/-0)
account_invoice_line_default_account/view/res_partner.xml (+54/-0)
To merge this branch: bzr merge lp:~bcim/account-invoicing/7.0-account_invoice_line_default_account
Reviewer Review Type Date Requested Status
Pedro Manuel Baeza Needs Resubmitting
Maxime Chambreuil (http://www.savoirfairelinux.com) code review Needs Fixing
Joël Grand-Guillaume @ camptocamp code review, no tests Approve
Review via email: mp+186078@code.launchpad.net

Description of the change

Extracted account_invoice_line_default_account module version 6.1 from account-financial-tools project
and ported to 7.0
I'm pushing this migrated module to this account-invoicing project as this module is for invoicing and is not a financial tool

To post a comment you must log in.
Revision history for this message
Joël Grand-Guillaume @ camptocamp (jgrandguillaume-c2c) wrote :

Thanks for this port ! I'm also in favor of having this module in that project instead of financial-tools.

LGTM.

review: Approve (code review, no tests)
Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

Hi, Jacques,

Thank you very much for your contribution. Let me make some suggestions:

- In depends section, please put only top-level dependencies (account), instead of base and account.
- In version number, 7.0 it's not needed because it's added automatically by core, so please use notation x.y where x is for major revisions (db layout changes and great refactorizations), and y for minor revisions (bug fixing and so on). If there is no clear version number, let's start with 1.0.
- You can put your name in a new 'contributors' key in __openerp__.py according agreement on community.
- 'demo_xml' key is still accepted on v7, but it's better to put only 'demo'.
- Please put pot file for making translations to other languages.

On functional side, all works as expected, except one little thing:

- Fields in partner screen are not hidden when partner is not supplier.

Regards.

review: Needs Fixing (code review and test)
Revision history for this message
Ronald Portier (Therp) (rportier1962) wrote :

Just on the version numbering.

It is needed the way it is. As it is the ONLY way of knowing that this module was adapted to and tested on the specified version.

The core action of automatically adding a version number is a completely futile exercise, as it will be 7.0 on for all modules on an 7.0 installation and all 6.1 on a 6.1 installation etc.

For the rest I think Pedro made good suggestions.

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

On 09/18/2013 02:28 PM, Ronald Portier (Therp) wrote:
> Just on the version numbering.
>
> It is needed the way it is. As it is the ONLY way of knowing that this module was adapted to and tested on the specified version.
>
If a module is in a 7.0 branch and has the 'installable' flag to True,
it means that it is adapted and tested on the branch's version.

> The core action of automatically adding a version number is a completely futile exercise, as it will be 7.0 on for all modules on an 7.0 installation and all 6.1 on a 6.1 installation etc.
>

I don't agree with that. "Bumping" the version has a - not futile ̣-
meaning. It, obviously, means that a new version is available, and when
a major version is upgraded, it warns about possible issues like the
need to upgrade the schema of the database. That's even used by the new
OpenERP Apps to inform the users that a new version of their module is
available.

An example in the official addons: the version of the stock module
displayed in OpenERP is: 7.0.1.1.1. In the manifest, the version is 1.1.1.

--
Guewen Baconnier
Business Solutions Software Developer

Camptocamp SA
PSE A, CH-1015 Lausanne
Phone: +41 21 619 10 39
Office: +41 21 619 10 10
http://www.camptocamp.com/

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

My two cents on the version number: OpenERP internally disregards the major release in the version number. See adapt_version() in openerp-server/openerp/modules/module.py.

So having 7.0.1.1 in the manifest should be completely equivalent to having 1.1. AS it does not harm, I think it is informative for the version in the manifest to contain the major release version.

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

Having that said, I think 7.0.r001 does not conform to the standard which has been proposed here: https://code.launchpad.net/~openerp-community/openobject-doc/7.0-community-review/+merge/186295, instead it should be something like 7.0.1.0.

25. By Jacques-Etienne Baudoux

[FIX] __openerp__ file

26. By Jacques-Etienne Baudoux

[ADD] translations fr/nl

Revision history for this message
Jacques-Etienne Baudoux (jbaudoux) wrote :

Thanks for all your comments

> Fields in partner screen are not hidden when partner is not supplier.
I disagree with that as no fields in the accounting tab are displayed/hidden based on the customer/supplier.

For the version, I'll put "7.0.1.0"

> You can put your name in a new 'contributors' key in __openerp__.py according agreement on community.
Can you point me out where is this documented? I didn't found any example nor any mention in the contribute documentation.

Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

Hi, Jacques,

>I disagree with that as no fields in the accounting tab are displayed/hidden based on the customer/supplier.

This is why I told you that, because it would be desirable to hide "property_account_expense" and "auto_update_account_expense" fields when partner is not a supplier, because that fields don't apply. This can be done with attributes property testing "customer" field.

>Can you point me out where is this documented? I didn't found any example nor any mention in the contribute documentation.

Indeed, this is not documented yet (I mentioned about the necessity of contribution/author documentation in the draft pad, but no work has been done in this way). However, there are some comments in MPs that points to this and it's also mentioned in new apps website thread on the community list. The goal for this kind of representation is to get visibility of contributions on the app website in the future, but it's not mandatory.

Regards

27. By Jacques-Etienne Baudoux

[ADD]account_invoice_line_default_account: default income account on partner similar to default expense account

28. By Jacques-Etienne Baudoux

[FIX] account_invoice_line_default_account: Adding the partner in the context of invoice line of customer invoice. It's there in standard in supplier invoices but not in customer invoices and it's required by this module

Revision history for this message
Maxime Chambreuil (http://www.savoirfairelinux.com) (max3903) wrote :

l282,283: can you add "from . import..." ?

review: Needs Fixing (code review)
29. By Jacques-Etienne Baudoux

[FIX] from . import + contributors

Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

This project is now hosted on https://github.com/OCA/account-invoicing. Please move your proposal there. This guide may help you https://github.com/OCA/maintainers-tools/wiki/How-to-move-a-Merge-Proposal-to-GitHub

review: Needs Resubmitting

Unmerged revisions

29. By Jacques-Etienne Baudoux

[FIX] from . import + contributors

28. By Jacques-Etienne Baudoux

[FIX] account_invoice_line_default_account: Adding the partner in the context of invoice line of customer invoice. It's there in standard in supplier invoices but not in customer invoices and it's required by this module

27. By Jacques-Etienne Baudoux

[ADD]account_invoice_line_default_account: default income account on partner similar to default expense account

26. By Jacques-Etienne Baudoux

[ADD] translations fr/nl

25. By Jacques-Etienne Baudoux

[FIX] __openerp__ file

24. By Jacques-Etienne Baudoux

[IMP] look and feel

23. By Jacques-Etienne Baudoux

[FIX] pep8

22. By Jacques-Etienne Baudoux

[MIG] ported module account_invoice_line_default_account to 7.0

21. By Jacques-Etienne Baudoux

[MRG] Extracted account_invoice_line_default_account module version 6.1 from account-financial-tools project

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'account_invoice_line_default_account'
2=== added file 'account_invoice_line_default_account/__init__.py'
3--- account_invoice_line_default_account/__init__.py 1970-01-01 00:00:00 +0000
4+++ account_invoice_line_default_account/__init__.py 2014-02-14 09:13:42 +0000
5@@ -0,0 +1,12 @@
6+# -*- coding: UTF-8 -*-
7+'''
8+Created on 30 jan. 2013
9+
10+@author: Ronald Portier, Therp
11+
12+rportier@therp.nl
13+http://www.therp.nl
14+
15+Ported to 7.0 on Sept. 17, 2013 by Jacques-Etienne Baudoux, BCIM (www.bcim.be)
16+'''
17+from . import model
18
19=== added file 'account_invoice_line_default_account/__openerp__.py'
20--- account_invoice_line_default_account/__openerp__.py 1970-01-01 00:00:00 +0000
21+++ account_invoice_line_default_account/__openerp__.py 2014-02-14 09:13:42 +0000
22@@ -0,0 +1,51 @@
23+# -*- coding: utf-8 -*-
24+##############################################################################
25+#
26+# OpenERP, Open Source Management Solution
27+# This module copyright (C) 2012 Therp BV (<http://therp.nl>).
28+# This module copyright (C) 2013 BCIM SPRL (<http://www.bcim.be>).
29+#
30+# This program is free software: you can redistribute it and/or modify
31+# it under the terms of the GNU Affero General Public License as
32+# published by the Free Software Foundation, either version 3 of the
33+# License, or (at your option) any later version.
34+#
35+# This program is distributed in the hope that it will be useful,
36+# but WITHOUT ANY WARRANTY; without even the implied warranty of
37+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
38+# GNU Affero General Public License for more details.
39+#
40+# You should have received a copy of the GNU Affero General Public License
41+# along with this program. If not, see <http://www.gnu.org/licenses/>.
42+#
43+##############################################################################
44+{
45+ 'name': 'Account Invoice Line Default Account',
46+ 'version': '7.0.1.0',
47+ 'depends': [
48+ 'account'
49+ ],
50+ 'author': 'Therp BV',
51+ 'contributors': ['Jacques-Etienne Baudoux <je@bcim.be>'],
52+ 'category': 'Accounting',
53+ 'description': '''When entering sales or purchase invoices directly, the
54+user has to select an account which will be used as a counterpart in the
55+generated move lines. Each supplier will mostly be linked to one account. For
56+instance when ordering paper from a supplier that deals in paper, the
57+counterpart account will mostly be something like 'office expenses'. The sme
58+principle has been applied for customers. This module will add a default
59+counterpart expense and income account to a partner, comparable to the similiar
60+field in product. When an invoice is entered, withouth a product, the field
61+from partner will be used as default. Also when an account is entered on an
62+invoice line (not automatically selected for a product), the account will be
63+automatically linked to the partner as default expense or income account, unless
64+explicitly disabled in the partner record.''',
65+ 'data': [
66+ 'view/res_partner.xml',
67+ 'view/account_invoice.xml',
68+ ],
69+ 'demo': [],
70+ 'test': [],
71+ 'installable': True,
72+ 'active': False,
73+}
74
75=== added directory 'account_invoice_line_default_account/i18n'
76=== added file 'account_invoice_line_default_account/i18n/account_invoice_line_default_account.pot'
77--- account_invoice_line_default_account/i18n/account_invoice_line_default_account.pot 1970-01-01 00:00:00 +0000
78+++ account_invoice_line_default_account/i18n/account_invoice_line_default_account.pot 2014-02-14 09:13:42 +0000
79@@ -0,0 +1,59 @@
80+# Translation of OpenERP Server.
81+# This file contains the translation of the following modules:
82+# * account_invoice_line_default_account
83+#
84+msgid ""
85+msgstr ""
86+"Project-Id-Version: OpenERP Server 7.saas~1\n"
87+"Report-Msgid-Bugs-To: \n"
88+"POT-Creation-Date: 2013-09-18 16:01+0000\n"
89+"PO-Revision-Date: 2013-09-18 16:01+0000\n"
90+"Last-Translator: <>\n"
91+"Language-Team: \n"
92+"MIME-Version: 1.0\n"
93+"Content-Type: text/plain; charset=UTF-8\n"
94+"Content-Transfer-Encoding: \n"
95+"Plural-Forms: \n"
96+
97+#. module: account_invoice_line_default_account
98+#: field:res.partner,property_account_expense:0
99+msgid "Default Expense Account"
100+msgstr ""
101+
102+#. module: account_invoice_line_default_account
103+#: help:res.partner,property_account_expense:0
104+msgid "Default counterpart account for purchases on invoice lines"
105+msgstr ""
106+
107+#. module: account_invoice_line_default_account
108+#: help:res.partner,auto_update_account_expense:0
109+msgid "When an account is selected on an invoice line, automatically assign it as default expense account"
110+msgstr ""
111+
112+#. module: account_invoice_line_default_account
113+#: code:addons/account_invoice_line_default_account/model/account_invoice_line.py:27
114+#: code:addons/account_invoice_line_default_account/model/account_invoice_line.py:47
115+#, python-format
116+msgid "No object created for partner %d"
117+msgstr ""
118+
119+#. module: account_invoice_line_default_account
120+#: model:ir.model,name:account_invoice_line_default_account.model_account_invoice_line
121+msgid "Invoice Line"
122+msgstr ""
123+
124+#. module: account_invoice_line_default_account
125+#: view:res.partner:0
126+msgid "autosave from invoice line"
127+msgstr ""
128+
129+#. module: account_invoice_line_default_account
130+#: field:res.partner,auto_update_account_expense:0
131+msgid "Autosave Selection on Invoice Line"
132+msgstr ""
133+
134+#. module: account_invoice_line_default_account
135+#: model:ir.model,name:account_invoice_line_default_account.model_res_partner
136+msgid "Partner"
137+msgstr ""
138+
139
140=== added file 'account_invoice_line_default_account/i18n/fr.po'
141--- account_invoice_line_default_account/i18n/fr.po 1970-01-01 00:00:00 +0000
142+++ account_invoice_line_default_account/i18n/fr.po 2014-02-14 09:13:42 +0000
143@@ -0,0 +1,59 @@
144+# Translation of OpenERP Server.
145+# This file contains the translation of the following modules:
146+# * account_invoice_line_default_account
147+#
148+msgid ""
149+msgstr ""
150+"Project-Id-Version: OpenERP Server 7.saas~1\n"
151+"Report-Msgid-Bugs-To: \n"
152+"POT-Creation-Date: 2013-09-18 16:01+0000\n"
153+"PO-Revision-Date: 2013-09-18 16:01+0000\n"
154+"Last-Translator: Jacques-Etienne Baudoux <je@bcim.be>\n"
155+"Language-Team: \n"
156+"MIME-Version: 1.0\n"
157+"Content-Type: text/plain; charset=UTF-8\n"
158+"Content-Transfer-Encoding: \n"
159+"Plural-Forms: \n"
160+
161+#. module: account_invoice_line_default_account
162+#: field:res.partner,property_account_expense:0
163+msgid "Default Expense Account"
164+msgstr "Compte de charge par défaut"
165+
166+#. module: account_invoice_line_default_account
167+#: help:res.partner,property_account_expense:0
168+msgid "Default counterpart account for purchases on invoice lines"
169+msgstr "Compte de contrepartie par défaut pour les lignes de factures d'achat"
170+
171+#. module: account_invoice_line_default_account
172+#: help:res.partner,auto_update_account_expense:0
173+msgid "When an account is selected on an invoice line, automatically assign it as default expense account"
174+msgstr "Lorsqu'un compte est sélectionné sur une ligne de facture, l'assigner automatiquement comme compte de charge par défaut"
175+
176+#. module: account_invoice_line_default_account
177+#: code:addons/account_invoice_line_default_account/model/account_invoice_line.py:27
178+#: code:addons/account_invoice_line_default_account/model/account_invoice_line.py:47
179+#, python-format
180+msgid "No object created for partner %d"
181+msgstr ""
182+
183+#. module: account_invoice_line_default_account
184+#: model:ir.model,name:account_invoice_line_default_account.model_account_invoice_line
185+msgid "Invoice Line"
186+msgstr ""
187+
188+#. module: account_invoice_line_default_account
189+#: view:res.partner:0
190+msgid "autosave from invoice line"
191+msgstr "sauvegarde automatique"
192+
193+#. module: account_invoice_line_default_account
194+#: field:res.partner,auto_update_account_expense:0
195+msgid "Autosave Selection on Invoice Line"
196+msgstr ""
197+
198+#. module: account_invoice_line_default_account
199+#: model:ir.model,name:account_invoice_line_default_account.model_res_partner
200+msgid "Partner"
201+msgstr ""
202+
203
204=== added file 'account_invoice_line_default_account/i18n/nl.po'
205--- account_invoice_line_default_account/i18n/nl.po 1970-01-01 00:00:00 +0000
206+++ account_invoice_line_default_account/i18n/nl.po 2014-02-14 09:13:42 +0000
207@@ -0,0 +1,59 @@
208+# Translation of OpenERP Server.
209+# This file contains the translation of the following modules:
210+# * account_invoice_line_default_account
211+#
212+msgid ""
213+msgstr ""
214+"Project-Id-Version: OpenERP Server 7.saas~1\n"
215+"Report-Msgid-Bugs-To: \n"
216+"POT-Creation-Date: 2013-09-18 16:01+0000\n"
217+"PO-Revision-Date: 2013-09-18 16:01+0000\n"
218+"Last-Translator: Jacques-Etienne Baudoux <je@bcim.be>\n"
219+"Language-Team: \n"
220+"MIME-Version: 1.0\n"
221+"Content-Type: text/plain; charset=UTF-8\n"
222+"Content-Transfer-Encoding: \n"
223+"Plural-Forms: \n"
224+
225+#. module: account_invoice_line_default_account
226+#: field:res.partner,property_account_expense:0
227+msgid "Default Expense Account"
228+msgstr "Standaard kostenrekening"
229+
230+#. module: account_invoice_line_default_account
231+#: help:res.partner,property_account_expense:0
232+msgid "Default counterpart account for purchases on invoice lines"
233+msgstr "Standaard tegenrekening voor inkoop factuur lijnen"
234+
235+#. module: account_invoice_line_default_account
236+#: help:res.partner,auto_update_account_expense:0
237+msgid "When an account is selected on an invoice line, automatically assign it as default expense account"
238+msgstr "Wanneer een rekening op een factuur lijn is geselecteerd, automatisch toewijzen als standaard kostenrekening"
239+
240+#. module: account_invoice_line_default_account
241+#: code:addons/account_invoice_line_default_account/model/account_invoice_line.py:27
242+#: code:addons/account_invoice_line_default_account/model/account_invoice_line.py:47
243+#, python-format
244+msgid "No object created for partner %d"
245+msgstr ""
246+
247+#. module: account_invoice_line_default_account
248+#: model:ir.model,name:account_invoice_line_default_account.model_account_invoice_line
249+msgid "Invoice Line"
250+msgstr ""
251+
252+#. module: account_invoice_line_default_account
253+#: view:res.partner:0
254+msgid "autosave from invoice line"
255+msgstr "automatisch bewaren"
256+
257+#. module: account_invoice_line_default_account
258+#: field:res.partner,auto_update_account_expense:0
259+msgid "Autosave Selection on Invoice Line"
260+msgstr ""
261+
262+#. module: account_invoice_line_default_account
263+#: model:ir.model,name:account_invoice_line_default_account.model_res_partner
264+msgid "Partner"
265+msgstr ""
266+
267
268=== added directory 'account_invoice_line_default_account/model'
269=== added file 'account_invoice_line_default_account/model/__init__.py'
270--- account_invoice_line_default_account/model/__init__.py 1970-01-01 00:00:00 +0000
271+++ account_invoice_line_default_account/model/__init__.py 2014-02-14 09:13:42 +0000
272@@ -0,0 +1,4 @@
273+# -*- coding: UTF-8 -*-
274+
275+from . import res_partner
276+from . import account_invoice_line
277
278=== added file 'account_invoice_line_default_account/model/account_invoice_line.py'
279--- account_invoice_line_default_account/model/account_invoice_line.py 1970-01-01 00:00:00 +0000
280+++ account_invoice_line_default_account/model/account_invoice_line.py 2014-02-14 09:13:42 +0000
281@@ -0,0 +1,67 @@
282+# -*- coding: UTF-8 -*-
283+'''
284+Created on 30 jan. 2013
285+
286+@author: Ronald Portier, Therp
287+@contributor: Jacques-Etienne Baudoux, BCIM
288+'''
289+
290+from openerp.osv import orm
291+from openerp.tools.translate import _
292+
293+
294+class account_invoice_line(orm.Model):
295+ _inherit = 'account.invoice.line'
296+
297+ def _account_id_default(self, cr, uid, context=None):
298+ if context is None:
299+ context = {}
300+ partner_id = context.get('partner_id')
301+ if not partner_id:
302+ return False
303+ assert isinstance(partner_id, (int, long)), (
304+ _('No valid id for context partner_id %d') % partner_id)
305+ invoice_type = context.get('type')
306+ partner_model = self.pool.get('res.partner')
307+ if invoice_type in ['in_invoice', 'in_refund']:
308+ partner = partner_model.read(cr, uid, partner_id,
309+ ['property_account_expense'], context=context)
310+ return partner['property_account_expense']
311+ elif invoice_type in ['out_invoice', 'out_refund']:
312+ partner = partner_model.read(cr, uid, partner_id,
313+ ['property_account_income'], context=context)
314+ return partner['property_account_income']
315+ return False
316+
317+ _defaults = {
318+ 'account_id': _account_id_default,
319+ }
320+
321+ def onchange_account_id(
322+ self, cr, uid, ids, product_id, partner_id, inv_type,
323+ fposition_id, account_id, context=None):
324+ if account_id and partner_id and not product_id:
325+ # We have a manually entered account_id (no product_id, so the
326+ # account_id is not the result of a product selection).
327+ # Store this account_id as future default in res_partner.
328+ partner_model = self.pool.get('res.partner')
329+ partner = partner_model.read(cr, uid, partner_id,
330+ ['auto_update_account_expense', 'property_account_expense',
331+ 'auto_update_account_income', 'property_account_income'],
332+ context=context)
333+ vals = {}
334+ if (inv_type in ['in_invoice', 'in_refund'] and
335+ partner['auto_update_account_expense']):
336+ if account_id != partner['property_account_expense']:
337+ # only write when something really changed
338+ vals.update({'property_account_expense': account_id})
339+ elif (inv_type in ['out_invoice', 'out_refund'] and
340+ partner['auto_update_account_income']):
341+ if account_id != partner['property_account_income']:
342+ # only write when something really changed
343+ vals.update({'property_account_income': account_id})
344+ if vals:
345+ partner_model.write(cr, uid, partner_id, vals, context=context)
346+ return super(account_invoice_line, self).onchange_account_id(
347+ cr, uid, ids, product_id, partner_id, inv_type,
348+ fposition_id, account_id)
349
350=== added file 'account_invoice_line_default_account/model/res_partner.py'
351--- account_invoice_line_default_account/model/res_partner.py 1970-01-01 00:00:00 +0000
352+++ account_invoice_line_default_account/model/res_partner.py 2014-02-14 09:13:42 +0000
353@@ -0,0 +1,48 @@
354+# -*- coding: UTF-8 -*-
355+'''
356+Created on 30 jan. 2013
357+
358+@author: Ronald Portier, Therp
359+@contributor: Jacques-Etienne Baudoux, BCIM
360+'''
361+
362+from openerp.osv import orm
363+from openerp.osv import fields
364+
365+
366+class res_partner(orm.Model):
367+ _inherit = 'res.partner'
368+
369+ _columns = {
370+ 'property_account_income': fields.property(
371+ 'account.account',
372+ type='many2one',
373+ relation='account.account',
374+ string='Default Income Account',
375+ view_load=True,
376+ domain='''[('user_type.report_type', '=', 'income')]''',
377+ help='Default counterpart account for sales on invoice lines',
378+ required=False),
379+ 'auto_update_account_income': fields.boolean(
380+ 'Autosave Selection on Invoice Line',
381+ help='When an account is selected on an invoice line, '
382+ 'automatically assign it as default income account'),
383+ 'property_account_expense': fields.property(
384+ 'account.account',
385+ type='many2one',
386+ relation='account.account',
387+ string='Default Expense Account',
388+ view_load=True,
389+ domain='''[('user_type.report_type', '=', 'expense')]''',
390+ help='Default counterpart account for purchases on invoice lines',
391+ required=False),
392+ 'auto_update_account_expense': fields.boolean(
393+ 'Autosave Selection on Invoice Line',
394+ help='When an account is selected on an invoice line, '
395+ 'automatically assign it as default expense account'),
396+ }
397+
398+ _defaults = {
399+ 'auto_update_account_income': True,
400+ 'auto_update_account_expense': True,
401+ }
402
403=== added directory 'account_invoice_line_default_account/view'
404=== added file 'account_invoice_line_default_account/view/account_invoice.xml'
405--- account_invoice_line_default_account/view/account_invoice.xml 1970-01-01 00:00:00 +0000
406+++ account_invoice_line_default_account/view/account_invoice.xml 2014-02-14 09:13:42 +0000
407@@ -0,0 +1,16 @@
408+<?xml version="1.0" encoding="utf-8"?>
409+<openerp>
410+<data>
411+ <record id="invoice_form" model="ir.ui.view">
412+ <field name="name">account.invoice.form.inherit</field>
413+ <field name="model">account.invoice</field>
414+ <field name="type">form</field>
415+ <field name="inherit_id" ref="account.invoice_form" />
416+ <field name="arch" type="xml">
417+ <field name="invoice_line" position="attributes">
418+ <attribute name="context">{'partner_id': partner_id, 'type': type}</attribute>
419+ </field>
420+ </field>
421+ </record>
422+</data>
423+</openerp>
424
425=== added file 'account_invoice_line_default_account/view/res_partner.xml'
426--- account_invoice_line_default_account/view/res_partner.xml 1970-01-01 00:00:00 +0000
427+++ account_invoice_line_default_account/view/res_partner.xml 2014-02-14 09:13:42 +0000
428@@ -0,0 +1,54 @@
429+<?xml version="1.0" encoding="utf-8"?>
430+<openerp>
431+ <data>
432+ <record
433+ id="view_partner_expense_property_form"
434+ model="ir.ui.view">
435+ <field name="name">res.partner.property.form.inherit</field>
436+ <field name="model">res.partner</field>
437+ <field name="type">form</field>
438+ <field name="priority">2</field>
439+ <field
440+ name="inherit_id"
441+ ref="account.view_partner_property_form" />
442+ <field
443+ name="arch"
444+ type="xml">
445+ <field
446+ name="property_account_receivable"
447+ position="after">
448+ <label for="property_account_income" />
449+ <div>
450+ <field
451+ name="property_account_income"
452+ groups="account.group_account_invoice" />
453+ <div style=" white-space: nowrap; ">
454+ <field
455+ name="auto_update_account_income"
456+ nolabel="1"
457+ groups="account.group_account_invoice" />
458+ <label for="auto_update_account_income" string="autosave from invoice line"/>
459+ </div>
460+ </div>
461+ </field>
462+ <field
463+ name="property_account_payable"
464+ position="after">
465+ <label for="property_account_expense" />
466+ <div>
467+ <field
468+ name="property_account_expense"
469+ groups="account.group_account_invoice" />
470+ <div style=" white-space: nowrap; ">
471+ <field
472+ name="auto_update_account_expense"
473+ nolabel="1"
474+ groups="account.group_account_invoice" />
475+ <label for="auto_update_account_expense" string="autosave from invoice line"/>
476+ </div>
477+ </div>
478+ </field>
479+ </field>
480+ </record>
481+ </data>
482+</openerp>

Subscribers

People subscribed via source and target branches