Merge lp:~therp-nl/account-financial-tools/6.1-account-purchase-default into lp:~account-core-editors/account-financial-tools/6.1

Proposed by Ronald Portier (Therp) on 2013-02-05
Status: Merged
Merged at revision: 103
Proposed branch: lp:~therp-nl/account-financial-tools/6.1-account-purchase-default
Merge into: lp:~account-core-editors/account-financial-tools/6.1
Diff against target: 59 lines (+12/-6)
2 files modified
account_invoice_line_default_account/__openerp__.py (+2/-2)
account_invoice_line_default_account/model/account_invoice_line.py (+10/-4)
To merge this branch: bzr merge lp:~therp-nl/account-financial-tools/6.1-account-purchase-default
Reviewer Review Type Date Requested Status
Alexandre Fayolle - camptocamp code review, no test 2013-02-05 Approve on 2013-02-06
Review via email: mp+146612@code.launchpad.net

Description of the change

Merge request
- corrects author name
- applies review remarks for previous request to add asserts to test for exceptional conditions

To post a comment you must log in.

LGTM

review: Approve (code review, no test)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account_invoice_line_default_account/__openerp__.py'
2--- account_invoice_line_default_account/__openerp__.py 2013-02-01 07:59:21 +0000
3+++ account_invoice_line_default_account/__openerp__.py 2013-02-05 11:34:27 +0000
4@@ -20,12 +20,12 @@
5 ##############################################################################
6 {
7 'name': 'Account Invoice Line Default Account',
8- 'version': '6.1.r004',
9+ 'version': '6.1.r005',
10 'depends': [
11 'base',
12 'account'
13 ],
14- 'author': 'Therp B.V.',
15+ 'author': 'Therp BV',
16 'category': 'Accounting',
17 'description': '''When entering purchase invoices directly, the user has
18 to select an account which will be used as a counterpart in the generated
19
20=== modified file 'account_invoice_line_default_account/model/account_invoice_line.py'
21--- account_invoice_line_default_account/model/account_invoice_line.py 2013-02-01 09:52:23 +0000
22+++ account_invoice_line_default_account/model/account_invoice_line.py 2013-02-05 11:34:27 +0000
23@@ -8,6 +8,7 @@
24 http://www.therp.nl
25 '''
26 from openerp.osv import orm
27+from openerp.tools.translate import _
28
29
30 class account_invoice_line(orm.Model):
31@@ -22,7 +23,9 @@
32 partner_model = self.pool.get('res.partner')
33 partner_obj = partner_model.browse(
34 cr, uid, partner_id, context=context)
35- if partner_obj and partner_obj.property_account_expense:
36+ assert partner_obj, (
37+ _('No object created for partner %d') % partner_id)
38+ if partner_obj.property_account_expense:
39 return partner_obj.property_account_expense.id
40 return False
41
42@@ -35,11 +38,14 @@
43 fposition_id, account_id):
44 if (account_id and partner_id and (not product_id)
45 and inv_type in ['in_invoice', 'in_refund']):
46- # We have an account_id, and is not from a product, so
47- # store it in partner automagically:
48+ # We have a manually entered account_id (no product_id, so the
49+ # account_id is not the result of a product selection).
50+ # Store this account_id as future default in res_partner.
51 partner_model = self.pool.get('res.partner')
52 partner_obj = partner_model.browse(cr, uid, partner_id)
53- if partner_obj and partner_obj.auto_update_account_expense:
54+ assert partner_obj, (
55+ _('No object created for partner %d') % partner_id)
56+ if partner_obj.auto_update_account_expense:
57 old_account_id = (
58 partner_obj.property_account_expense
59 and partner_obj.property_account_expense.id)

Subscribers

People subscribed via source and target branches