Merge lp:~julie-w/unifield-server/US-2391 into lp:unifield-server

Proposed by jftempo
Status: Merged
Merge reported by: jftempo
Merged at revision: not available
Proposed branch: lp:~julie-w/unifield-server/US-2391
Merge into: lp:unifield-server
Diff against target: 111 lines (+27/-10)
3 files modified
bin/addons/account_override/account_invoice_view.xml (+4/-1)
bin/addons/finance/stock.py (+4/-1)
bin/addons/purchase_override/purchase.py (+19/-8)
To merge this branch: bzr merge lp:~julie-w/unifield-server/US-2391
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+326756@code.launchpad.net
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/addons/account_override/account_invoice_view.xml'
2--- bin/addons/account_override/account_invoice_view.xml 2017-05-22 16:04:34 +0000
3+++ bin/addons/account_override/account_invoice_view.xml 2017-07-04 09:20:51 +0000
4@@ -362,7 +362,10 @@
5 <field name="currency_id" width="50"/>
6 <button name="%(account.action_account_change_currency)d" type="action" icon="terp-stock_effects-object-colorize" string="Change" attrs="{'invisible':[('state','!=','draft')]}" />
7 <newline/>
8- <field string="Donor" name="partner_id" domain="[('supplier', '=', True)]" on_change="onchange_partner_id(type,partner_id,date_invoice,payment_term, partner_bank_id,company_id, is_inkind_donation)" context="{'default_customer': 0, 'search_default_supplier': 1, 'default_supplier': 1}"/>
9+ <field string="Donor" name="partner_id"
10+ domain="[('supplier', '=', True), ('partner_type', 'in', ['external', 'section', 'esc'])]"
11+ on_change="onchange_partner_id(type,partner_id,date_invoice,payment_term, partner_bank_id,company_id, is_inkind_donation)"
12+ context="{'default_customer': 0, 'search_default_supplier': 1, 'default_supplier': 1}"/>
13 <field domain="[('partner_id','=',partner_id)]" name="address_invoice_id" string="Address"/>
14 <newline/>
15 <field name="document_date"/>
16
17=== modified file 'bin/addons/finance/stock.py'
18--- bin/addons/finance/stock.py 2014-03-17 10:45:24 +0000
19+++ bin/addons/finance/stock.py 2017-07-04 09:20:51 +0000
20@@ -86,7 +86,10 @@
21 invoice_vals['date_invoice'] = time.strftime('%Y-%m-%d',time.localtime())
22 journal_ids = self.pool.get('account.journal').search(cr, uid, [('type', '=', 'inkind'),
23 ('is_current_instance', '=', True)])
24- if picking and picking.purchase_id and picking.purchase_id.order_type == "in_kind":
25+ # From US-2391 Donations before expiry and Standard donations linked to an intersection partner generate a Donation
26+ donation_intersection = picking and picking.purchase_id and picking.purchase_id.order_type in ['donation_exp', 'donation_st'] \
27+ and picking.partner_id and picking.partner_id.partner_type == 'section'
28+ if picking and picking.purchase_id and picking.purchase_id.order_type == "in_kind" or donation_intersection:
29 if not journal_ids:
30 raise osv.except_osv(_('Error'), _('No In-kind donation journal found!'))
31 account_id = picking.partner_id and picking.partner_id.donation_payable_account and picking.partner_id.donation_payable_account.id or False
32
33=== modified file 'bin/addons/purchase_override/purchase.py'
34--- bin/addons/purchase_override/purchase.py 2017-06-14 12:52:39 +0000
35+++ bin/addons/purchase_override/purchase.py 2017-07-04 09:20:51 +0000
36@@ -809,7 +809,9 @@
37 for order in self.read(cr, uid, ids, ['partner_id', 'warehouse_id'], context=context):
38 partner_type = res_partner_obj.read(cr, uid, vals.get('partner_id', order['partner_id'][0]), ['partner_type'], context=context)['partner_type']
39 if vals.get('order_type'):
40- if vals.get('order_type') in ['donation_exp', 'donation_st', 'loan']:
41+ if vals.get('order_type') in ['donation_exp', 'donation_st']:
42+ vals.update({'invoice_method': partner_type == 'section' and 'picking' or 'manual'})
43+ elif vals.get('order_type') == 'loan':
44 vals.update({'invoice_method': 'manual'})
45 elif vals.get('order_type') in ['direct',] and partner_type != 'esc':
46 vals.update({'invoice_method': 'order'})
47@@ -846,6 +848,7 @@
48 # d = {'partner_id': []}
49 w = {}
50 local_market = None
51+ partner = partner_id and partner_obj.read(cr, uid, partner_id, ['partner_type']) or False
52
53 if ids:
54 order_types_dict = dict((x, y) for x, y in ORDER_TYPES_SELECTION)
55@@ -903,7 +906,9 @@
56 'warning': {'title': 'Error',
57 'message': 'The Field orders feature is not activated on your system, so, you cannot create a Loan Purchase Order !'}}
58
59- if order_type in ['donation_exp', 'donation_st', 'loan']:
60+ if order_type in ['donation_exp', 'donation_st']:
61+ v['invoice_method'] = partner and partner['partner_type'] == 'section' and 'picking' or 'manual'
62+ elif order_type == 'loan':
63 v['invoice_method'] = 'manual'
64 elif order_type in ['direct']:
65 v['invoice_method'] = 'order'
66@@ -923,8 +928,7 @@
67 cp_address_id = self.pool.get('res.partner').address_get(cr, uid, company_id, ['delivery'])['delivery']
68 v.update({'dest_address_id': cp_address_id, 'dest_partner_id': company_id})
69
70- if partner_id and partner_id != local_market:
71- partner = partner_obj.read(cr, uid, partner_id, ['partner_type'])
72+ if partner and partner_id != local_market:
73 if partner['partner_type'] in ('internal', 'esc') and order_type in ('regular', 'direct'):
74 v['invoice_method'] = 'manual'
75 elif partner['partner_type'] not in ('external', 'esc') and order_type == 'direct':
76@@ -1100,7 +1104,9 @@
77 except ValueError:
78 intermission_cc = 0
79
80- if po.order_type == 'in_kind' and not po.partner_id.donation_payable_account:
81+ donation_intersection = po.order_type in ['donation_exp', 'donation_st'] and po.partner_type \
82+ and po.partner_type == 'section'
83+ if po.order_type == 'in_kind' or donation_intersection:
84 if not po.partner_id.donation_payable_account:
85 raise osv.except_osv(_('Error'), _('No donation account on this partner: %s') % (po.partner_id.name or '',))
86
87@@ -2224,8 +2230,11 @@
88 todo3 = []
89 todo4 = {}
90 to_invoice = set()
91- if order.partner_id.partner_type in ('internal', 'esc') and order.order_type == 'regular' or \
92- order.order_type in ['donation_exp', 'donation_st', 'loan']:
93+ regular_internal_esc = order.order_type == 'regular' and order.partner_id.partner_type in ('internal', 'esc')
94+ loan = order.order_type == 'loan'
95+ donation_not_intersection = order.order_type in ['donation_exp', 'donation_st'] \
96+ and order.partner_id.partner_type != 'section'
97+ if regular_internal_esc or loan or donation_not_intersection:
98 self.write(cr, uid, [order.id], {'invoice_method': 'manual'})
99 line_obj.write(cr, uid, [x.id for x in order.order_line], {'invoiced': 1})
100
101@@ -2579,7 +2588,9 @@
102 context = {}
103
104 if vals.get('order_type'):
105- if vals.get('order_type') in ['donation_exp', 'donation_st', 'loan']:
106+ if vals.get('order_type') in ['donation_exp', 'donation_st']:
107+ vals.update({'invoice_method': vals.get('partner_type', '') == 'section' and 'picking' or 'manual'})
108+ elif vals.get('order_type') == 'loan':
109 vals.update({'invoice_method': 'manual'})
110 elif vals.get('order_type') in ['direct']:
111 vals.update({'invoice_method': 'order'})

Subscribers

People subscribed via source and target branches