Merge lp:~dorian-kemps/unifield-server/US-5561 into lp:unifield-server

Proposed by jftempo
Status: Merged
Merged at revision: 5423
Proposed branch: lp:~dorian-kemps/unifield-server/US-5561
Merge into: lp:unifield-server
Diff against target: 141 lines (+33/-11)
7 files modified
bin/addons/procurement_request/procurement_request.py (+5/-1)
bin/addons/sale/sale_order.py (+13/-1)
bin/addons/sale/sale_workflow.py (+2/-1)
bin/addons/sourcing/sale_order_line.py (+9/-5)
bin/addons/sourcing/sourcing_view.xml (+1/-1)
bin/addons/sourcing/wizard/multiple_sourcing.py (+2/-1)
bin/addons/sourcing/wizard/multiple_sourcing_view.xml (+1/-1)
To merge this branch: bzr merge lp:~dorian-kemps/unifield-server/US-5561
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+368467@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/procurement_request/procurement_request.py'
2--- bin/addons/procurement_request/procurement_request.py 2019-04-02 12:44:01 +0000
3+++ bin/addons/procurement_request/procurement_request.py 2019-06-11 12:48:46 +0000
4@@ -679,7 +679,11 @@
5 product_obj = self.pool.get('product.product')
6 if product_id and type != 'make_to_stock':
7 product = product_obj.browse(cr, uid, product_id, context=context)
8- v.update({'supplier': product.seller_ids and product.seller_ids[0].name.id})
9+ if product.seller_ids and (product.seller_ids[0].name.supplier or product.seller_ids[0].name.manufacturer or
10+ product.seller_ids[0].name.transporter):
11+ v.update({'supplier': product.seller_ids[0].name.id})
12+ else:
13+ v.update({'supplier': False})
14 elif product_id and type == 'make_to_stock':
15 v.update({'supplier': False})
16 product = product_obj.browse(cr, uid, product_id, context=context)
17
18=== modified file 'bin/addons/sale/sale_order.py'
19--- bin/addons/sale/sale_order.py 2019-05-14 08:00:10 +0000
20+++ bin/addons/sale/sale_order.py 2019-06-11 12:48:46 +0000
21@@ -2252,7 +2252,19 @@
22 if x not in default:
23 default[x] = False
24
25- return super(sale_order_line, self).copy_data(cr, uid, id, default, context=context)
26+ new_data = super(sale_order_line, self).copy_data(cr, uid, id, default, context=context)
27+
28+ # Remove supplier is line is from stock or has a customer-only supplier
29+ if new_data and new_data.get('supplier'):
30+ if new_data.get('type') == 'make_to_order':
31+ ftf = ['supplier', 'manufacturer', 'transporter']
32+ supp = self.pool.get('res.partner').browse(cr, uid, new_data['supplier'], fields_to_fetch=ftf, context=context)
33+ if not (supp.supplier or supp.manufacturer or supp.transporter):
34+ new_data['supplier'] = False
35+ else:
36+ new_data['supplier'] = False
37+
38+ return new_data
39
40 def product_id_change_orig(self, cr, uid, ids, pricelist, product, qty=0,
41 uom=False, qty_uos=0, uos=False, name='', partner_id=False,
42
43=== modified file 'bin/addons/sale/sale_workflow.py'
44--- bin/addons/sale/sale_workflow.py 2019-05-14 08:00:10 +0000
45+++ bin/addons/sale/sale_workflow.py 2019-06-11 12:48:46 +0000
46@@ -575,7 +575,8 @@
47
48 # US-4576: Set supplier
49 if sol.type == 'make_to_order' and sol.order_id.order_type not in ['loan', 'donation_st', 'donation_exp']\
50- and sol.product_id and sol.product_id.seller_id:
51+ and sol.product_id and sol.product_id.seller_id and (sol.product_id.seller_id.supplier or
52+ sol.product_id.seller_id.manufacturer or sol.product_id.seller_id.transporter):
53 to_write['supplier'] = sol.product_id.seller_id.id
54
55 if sol.order_id.order_type == 'loan':
56
57=== modified file 'bin/addons/sourcing/sale_order_line.py'
58--- bin/addons/sourcing/sale_order_line.py 2019-05-10 14:38:54 +0000
59+++ bin/addons/sourcing/sale_order_line.py 2019-06-11 12:48:46 +0000
60@@ -770,7 +770,8 @@
61 vals['related_sourcing_id'] = False
62
63 if product and vals.get('type', False) == 'make_to_order' and not vals.get('supplier', False):
64- vals['supplier'] = product.seller_id and product.seller_id.id or False
65+ vals['supplier'] = product.seller_id and (product.seller_id.supplier or product.seller_id.manufacturer or
66+ product.seller_id.transporter) and product.seller_id.id or False
67
68 if product and product.type in ('consu', 'service', 'service_recep'):
69 vals['type'] = 'make_to_order'
70@@ -846,8 +847,9 @@
71 line_ids = [line_ids]
72
73 for line in self.browse(cr, uid, line_ids, context=context):
74- if line.type == 'make_to_order' and line.product_id \
75- and line.product_id.seller_id:
76+ if line.type == 'make_to_order' and line.product_id and line.product_id.seller_id and \
77+ (line.product_id.seller_id.supplier or line.product_id.seller_id.manufacturer
78+ or line.product_id.seller_id.transporter):
79 self.write(cr, uid, [line.id], {
80 'supplier': line.product_id.seller_id.id,
81 }, context=context)
82@@ -2112,7 +2114,7 @@
83
84 if product and type:
85 seller = product_obj.browse(cr, uid, product).seller_id
86- sellerId = (seller and seller.id) or False
87+ sellerId = (seller and (seller.supplier or seller.manufacturer or seller.transporter) and seller.id) or False
88
89 if l_type == 'make_to_order':
90 po_cft = 'po'
91@@ -2247,7 +2249,9 @@
92 'title': _('Warning'),
93 'message': _('You cannot choose \'from stock\' as method to source a %s product !') % product_type,
94 })
95- if l_type == 'make_to_order' and line.product_id and line.product_id.seller_id:
96+ if l_type == 'make_to_order' and line.product_id and line.product_id.seller_id and \
97+ (line.product_id.seller_id.supplier or line.product_id.seller_id.manufacturer
98+ or line.product_id.seller_id.transporter):
99 value['supplier'] = line.product_id.seller_id.id
100
101 if l_type == 'make_to_stock':
102
103=== modified file 'bin/addons/sourcing/sourcing_view.xml'
104--- bin/addons/sourcing/sourcing_view.xml 2019-05-10 14:38:54 +0000
105+++ bin/addons/sourcing/sourcing_view.xml 2019-06-11 12:48:46 +0000
106@@ -69,7 +69,7 @@
107 <field name="stock_uom_id" readonly="1" string="UoM Stock" />
108 <field name="company_id" invisible="1" />
109 <field name="supplier" colspan="2"
110- domain="[('id', '!=', company_id), ('available_for_dpo', '=', po_cft),('check_partner', '=', order_id)]"
111+ domain="[('id', '!=', company_id), ('available_for_dpo', '=', po_cft),('check_partner', '=', order_id), '|', '|', ('supplier', '=', 't'), ('manufacturer', '=', 't'), ('transporter', '=', 't')]"
112 context="{'product_id': product_id, 'choose_supplier': True, 'uom': product_uom, 'product_qty': product_uom_qty}"
113 attrs="{'readonly': ['|', ('po_cft', '=', 'cft'), ('state', '!=', 'validated')], 'invisible': [('type', '=', 'make_to_stock')]}"
114 on_change="onChangeSupplier(supplier, type)" />
115
116=== modified file 'bin/addons/sourcing/wizard/multiple_sourcing.py'
117--- bin/addons/sourcing/wizard/multiple_sourcing.py 2019-03-18 12:44:08 +0000
118+++ bin/addons/sourcing/wizard/multiple_sourcing.py 2019-06-11 12:48:46 +0000
119@@ -351,7 +351,8 @@
120
121 res = False
122 for line in self.pool.get('sale.order.line').browse(cr, uid, sols[0][2], fields_to_fetch=['product_id'], context=context):
123- if line.product_id and line.product_id.seller_id:
124+ if line.product_id and line.product_id.seller_id and (line.product_id.seller_id.supplier or
125+ line.product_id.seller_id.manufacturer or line.product_id.seller_id.transporter):
126 if res and res != line.product_id.seller_id.id:
127 res = False
128 break
129
130=== modified file 'bin/addons/sourcing/wizard/multiple_sourcing_view.xml'
131--- bin/addons/sourcing/wizard/multiple_sourcing_view.xml 2019-04-30 15:23:48 +0000
132+++ bin/addons/sourcing/wizard/multiple_sourcing_view.xml 2019-06-11 12:48:46 +0000
133@@ -24,7 +24,7 @@
134 <field name="run_scheduler" />
135 <separator colspan="4" string="Supplier selection" />
136 <field name="supplier_id"
137- domain="[('id', '!=', company_id), ('available_for_dpo', '=', po_cft), ('line_contains_fo', '=', line_ids)]"
138+ domain="[('id', '!=', company_id), ('available_for_dpo', '=', po_cft), ('line_contains_fo', '=', line_ids), '|', '|', ('supplier', '=', 't'), ('manufacturer', '=', 't'), ('transporter', '=', 't')]"
139 attrs="{'readonly': [('po_cft', '=', 'cft')], 'invisible': [('type', '=', 'make_to_stock')]}"
140 on_change="change_supplier(supplier_id, type)"
141 />

Subscribers

People subscribed via source and target branches