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
=== modified file 'bin/addons/account_override/account_invoice_view.xml'
--- bin/addons/account_override/account_invoice_view.xml 2017-05-22 16:04:34 +0000
+++ bin/addons/account_override/account_invoice_view.xml 2017-07-04 09:20:51 +0000
@@ -362,7 +362,10 @@
362 <field name="currency_id" width="50"/>362 <field name="currency_id" width="50"/>
363 <button name="%(account.action_account_change_currency)d" type="action" icon="terp-stock_effects-object-colorize" string="Change" attrs="{'invisible':[('state','!=','draft')]}" />363 <button name="%(account.action_account_change_currency)d" type="action" icon="terp-stock_effects-object-colorize" string="Change" attrs="{'invisible':[('state','!=','draft')]}" />
364 <newline/>364 <newline/>
365 <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}"/>365 <field string="Donor" name="partner_id"
366 domain="[('supplier', '=', True), ('partner_type', 'in', ['external', 'section', 'esc'])]"
367 on_change="onchange_partner_id(type,partner_id,date_invoice,payment_term, partner_bank_id,company_id, is_inkind_donation)"
368 context="{'default_customer': 0, 'search_default_supplier': 1, 'default_supplier': 1}"/>
366 <field domain="[('partner_id','=',partner_id)]" name="address_invoice_id" string="Address"/>369 <field domain="[('partner_id','=',partner_id)]" name="address_invoice_id" string="Address"/>
367 <newline/>370 <newline/>
368 <field name="document_date"/>371 <field name="document_date"/>
369372
=== modified file 'bin/addons/finance/stock.py'
--- bin/addons/finance/stock.py 2014-03-17 10:45:24 +0000
+++ bin/addons/finance/stock.py 2017-07-04 09:20:51 +0000
@@ -86,7 +86,10 @@
86 invoice_vals['date_invoice'] = time.strftime('%Y-%m-%d',time.localtime())86 invoice_vals['date_invoice'] = time.strftime('%Y-%m-%d',time.localtime())
87 journal_ids = self.pool.get('account.journal').search(cr, uid, [('type', '=', 'inkind'),87 journal_ids = self.pool.get('account.journal').search(cr, uid, [('type', '=', 'inkind'),
88 ('is_current_instance', '=', True)])88 ('is_current_instance', '=', True)])
89 if picking and picking.purchase_id and picking.purchase_id.order_type == "in_kind":89 # From US-2391 Donations before expiry and Standard donations linked to an intersection partner generate a Donation
90 donation_intersection = picking and picking.purchase_id and picking.purchase_id.order_type in ['donation_exp', 'donation_st'] \
91 and picking.partner_id and picking.partner_id.partner_type == 'section'
92 if picking and picking.purchase_id and picking.purchase_id.order_type == "in_kind" or donation_intersection:
90 if not journal_ids:93 if not journal_ids:
91 raise osv.except_osv(_('Error'), _('No In-kind donation journal found!'))94 raise osv.except_osv(_('Error'), _('No In-kind donation journal found!'))
92 account_id = picking.partner_id and picking.partner_id.donation_payable_account and picking.partner_id.donation_payable_account.id or False95 account_id = picking.partner_id and picking.partner_id.donation_payable_account and picking.partner_id.donation_payable_account.id or False
9396
=== modified file 'bin/addons/purchase_override/purchase.py'
--- bin/addons/purchase_override/purchase.py 2017-06-14 12:52:39 +0000
+++ bin/addons/purchase_override/purchase.py 2017-07-04 09:20:51 +0000
@@ -809,7 +809,9 @@
809 for order in self.read(cr, uid, ids, ['partner_id', 'warehouse_id'], context=context):809 for order in self.read(cr, uid, ids, ['partner_id', 'warehouse_id'], context=context):
810 partner_type = res_partner_obj.read(cr, uid, vals.get('partner_id', order['partner_id'][0]), ['partner_type'], context=context)['partner_type']810 partner_type = res_partner_obj.read(cr, uid, vals.get('partner_id', order['partner_id'][0]), ['partner_type'], context=context)['partner_type']
811 if vals.get('order_type'):811 if vals.get('order_type'):
812 if vals.get('order_type') in ['donation_exp', 'donation_st', 'loan']:812 if vals.get('order_type') in ['donation_exp', 'donation_st']:
813 vals.update({'invoice_method': partner_type == 'section' and 'picking' or 'manual'})
814 elif vals.get('order_type') == 'loan':
813 vals.update({'invoice_method': 'manual'})815 vals.update({'invoice_method': 'manual'})
814 elif vals.get('order_type') in ['direct',] and partner_type != 'esc':816 elif vals.get('order_type') in ['direct',] and partner_type != 'esc':
815 vals.update({'invoice_method': 'order'})817 vals.update({'invoice_method': 'order'})
@@ -846,6 +848,7 @@
846# d = {'partner_id': []}848# d = {'partner_id': []}
847 w = {}849 w = {}
848 local_market = None850 local_market = None
851 partner = partner_id and partner_obj.read(cr, uid, partner_id, ['partner_type']) or False
849852
850 if ids:853 if ids:
851 order_types_dict = dict((x, y) for x, y in ORDER_TYPES_SELECTION)854 order_types_dict = dict((x, y) for x, y in ORDER_TYPES_SELECTION)
@@ -903,7 +906,9 @@
903 'warning': {'title': 'Error',906 'warning': {'title': 'Error',
904 'message': 'The Field orders feature is not activated on your system, so, you cannot create a Loan Purchase Order !'}}907 'message': 'The Field orders feature is not activated on your system, so, you cannot create a Loan Purchase Order !'}}
905908
906 if order_type in ['donation_exp', 'donation_st', 'loan']:909 if order_type in ['donation_exp', 'donation_st']:
910 v['invoice_method'] = partner and partner['partner_type'] == 'section' and 'picking' or 'manual'
911 elif order_type == 'loan':
907 v['invoice_method'] = 'manual'912 v['invoice_method'] = 'manual'
908 elif order_type in ['direct']:913 elif order_type in ['direct']:
909 v['invoice_method'] = 'order'914 v['invoice_method'] = 'order'
@@ -923,8 +928,7 @@
923 cp_address_id = self.pool.get('res.partner').address_get(cr, uid, company_id, ['delivery'])['delivery']928 cp_address_id = self.pool.get('res.partner').address_get(cr, uid, company_id, ['delivery'])['delivery']
924 v.update({'dest_address_id': cp_address_id, 'dest_partner_id': company_id})929 v.update({'dest_address_id': cp_address_id, 'dest_partner_id': company_id})
925930
926 if partner_id and partner_id != local_market:931 if partner and partner_id != local_market:
927 partner = partner_obj.read(cr, uid, partner_id, ['partner_type'])
928 if partner['partner_type'] in ('internal', 'esc') and order_type in ('regular', 'direct'):932 if partner['partner_type'] in ('internal', 'esc') and order_type in ('regular', 'direct'):
929 v['invoice_method'] = 'manual'933 v['invoice_method'] = 'manual'
930 elif partner['partner_type'] not in ('external', 'esc') and order_type == 'direct':934 elif partner['partner_type'] not in ('external', 'esc') and order_type == 'direct':
@@ -1100,7 +1104,9 @@
1100 except ValueError:1104 except ValueError:
1101 intermission_cc = 01105 intermission_cc = 0
11021106
1103 if po.order_type == 'in_kind' and not po.partner_id.donation_payable_account:1107 donation_intersection = po.order_type in ['donation_exp', 'donation_st'] and po.partner_type \
1108 and po.partner_type == 'section'
1109 if po.order_type == 'in_kind' or donation_intersection:
1104 if not po.partner_id.donation_payable_account:1110 if not po.partner_id.donation_payable_account:
1105 raise osv.except_osv(_('Error'), _('No donation account on this partner: %s') % (po.partner_id.name or '',))1111 raise osv.except_osv(_('Error'), _('No donation account on this partner: %s') % (po.partner_id.name or '',))
11061112
@@ -2224,8 +2230,11 @@
2224 todo3 = []2230 todo3 = []
2225 todo4 = {}2231 todo4 = {}
2226 to_invoice = set()2232 to_invoice = set()
2227 if order.partner_id.partner_type in ('internal', 'esc') and order.order_type == 'regular' or \2233 regular_internal_esc = order.order_type == 'regular' and order.partner_id.partner_type in ('internal', 'esc')
2228 order.order_type in ['donation_exp', 'donation_st', 'loan']:2234 loan = order.order_type == 'loan'
2235 donation_not_intersection = order.order_type in ['donation_exp', 'donation_st'] \
2236 and order.partner_id.partner_type != 'section'
2237 if regular_internal_esc or loan or donation_not_intersection:
2229 self.write(cr, uid, [order.id], {'invoice_method': 'manual'})2238 self.write(cr, uid, [order.id], {'invoice_method': 'manual'})
2230 line_obj.write(cr, uid, [x.id for x in order.order_line], {'invoiced': 1})2239 line_obj.write(cr, uid, [x.id for x in order.order_line], {'invoiced': 1})
22312240
@@ -2579,7 +2588,9 @@
2579 context = {}2588 context = {}
25802589
2581 if vals.get('order_type'):2590 if vals.get('order_type'):
2582 if vals.get('order_type') in ['donation_exp', 'donation_st', 'loan']:2591 if vals.get('order_type') in ['donation_exp', 'donation_st']:
2592 vals.update({'invoice_method': vals.get('partner_type', '') == 'section' and 'picking' or 'manual'})
2593 elif vals.get('order_type') == 'loan':
2583 vals.update({'invoice_method': 'manual'})2594 vals.update({'invoice_method': 'manual'})
2584 elif vals.get('order_type') in ['direct']:2595 elif vals.get('order_type') in ['direct']:
2585 vals.update({'invoice_method': 'order'})2596 vals.update({'invoice_method': 'order'})

Subscribers

People subscribed via source and target branches