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

Proposed by jftempo
Status: Merged
Merged at revision: 5996
Proposed branch: lp:~dorian-kemps/unifield-server/US-8320
Merge into: lp:unifield-server
Diff against target: 161 lines (+39/-30)
5 files modified
bin/addons/order_nomenclature/order_nomenclature.py (+9/-6)
bin/addons/product_attributes/product_attributes.py (+2/-1)
bin/addons/sale/sale_order.py (+10/-11)
bin/addons/sourcing/sale_order_line.py (+9/-7)
bin/addons/specific_rules/specific_rules.py (+9/-5)
To merge this branch: bzr merge lp:~dorian-kemps/unifield-server/US-8320
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+400175@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/order_nomenclature/order_nomenclature.py'
2--- bin/addons/order_nomenclature/order_nomenclature.py 2020-06-08 14:18:17 +0000
3+++ bin/addons/order_nomenclature/order_nomenclature.py 2021-05-12 07:52:00 +0000
4@@ -324,15 +324,18 @@
5 - nomenclature_code : contains the corresponding code
6 - nomenclature_description : contains the corresponding description
7 '''
8- def product_id_change(self, cr, uid, ids, pricelist, product, qty=0,
9- uom=False, qty_uos=0, uos=False, name='', partner_id=False,
10- lang=False, update_tax=True, date_order=False, packaging=False, fiscal_position=False, flag=False):
11+ def product_id_change(self, cr, uid, ids, pricelist, product, qty=0, uom=False, qty_uos=0, uos=False, name='',
12+ partner_id=False, lang=False, update_tax=True, date_order=False, packaging=False,
13+ fiscal_position=False, flag=False, context=None):
14 '''
15 overriden on_change function
16 '''
17- result = super(sale_order_line, self).product_id_change(cr, uid, ids, pricelist, product, qty,
18- uom, qty_uos, uos, name, partner_id,
19- lang, update_tax, date_order, packaging, fiscal_position, flag)
20+ if context is None:
21+ context = {}
22+
23+ result = super(sale_order_line, self).product_id_change(cr, uid, ids, pricelist, product, qty, uom, qty_uos, uos,
24+ name, partner_id, lang, update_tax, date_order, packaging,
25+ fiscal_position, flag, context=context)
26
27 # comment is cleared
28 result['value'].update({'comment':False})
29
30=== modified file 'bin/addons/product_attributes/product_attributes.py'
31--- bin/addons/product_attributes/product_attributes.py 2021-05-10 07:52:29 +0000
32+++ bin/addons/product_attributes/product_attributes.py 2021-05-12 07:52:00 +0000
33@@ -1259,7 +1259,8 @@
34 error = True
35 msg = _('be exchanged')
36 st_cond = product.state.no_external or product.state.no_esc or product.state.no_internal
37- elif product.no_external and 'external' in constraints:
38+ elif product.no_external and 'external' in constraints and \
39+ (not sale_obj or (sale_obj and product.state and product.state.code != 'phase_out')):
40 error = True
41 msg = _('be %s externally') % (sale_obj and _('shipped') or _('purchased'))
42 st_cond = product.state.no_external
43
44=== modified file 'bin/addons/sale/sale_order.py'
45--- bin/addons/sale/sale_order.py 2021-04-06 16:19:48 +0000
46+++ bin/addons/sale/sale_order.py 2021-05-12 07:52:00 +0000
47@@ -2383,10 +2383,10 @@
48
49 return new_data
50
51- def product_id_change_orig(self, cr, uid, ids, pricelist, product, qty=0,
52- uom=False, qty_uos=0, uos=False, name='', partner_id=False,
53- lang=False, update_tax=True, date_order=False, packaging=False, fiscal_position=False, flag=False):
54- if not partner_id:
55+ def product_id_change_orig(self, cr, uid, ids, pricelist, product, qty=0, uom=False, qty_uos=0, uos=False, name='',
56+ partner_id=False, lang=False, update_tax=True, date_order=False, packaging=False,
57+ fiscal_position=False, flag=False):
58+ if not partner_id:
59 raise osv.except_osv(_('No Customer Defined !'), _('You have to select a customer in the sales form !\nPlease set one customer before choosing a product.'))
60 warning = {}
61 product_uom_obj = self.pool.get('product.uom')
62@@ -2510,10 +2510,9 @@
63 result.update({'price_unit': price})
64 return {'value': result, 'domain': domain, 'warning': warning}
65
66-
67- def product_id_change(self, cr, uid, ids, pricelist, product, qty=0,
68- uom=False, qty_uos=0, uos=False, name='', partner_id=False,
69- lang=False, update_tax=True, date_order=False, packaging=False, fiscal_position=False, flag=False, context=None):
70+ def product_id_change(self, cr, uid, ids, pricelist, product, qty=0, uom=False, qty_uos=0, uos=False, name='',
71+ partner_id=False, lang=False, update_tax=True, date_order=False, packaging=False,
72+ fiscal_position=False, flag=False, context=None):
73 """
74 If we select a product we change the procurement type to its own procurement method (procure_method).
75 If there isn't product, the default procurement method is 'From Order' (make_to_order).
76@@ -2524,8 +2523,7 @@
77 if context is None:
78 context = {}
79
80- res = self.product_id_change_orig(cr, uid, ids, pricelist, product, qty,
81- uom, qty_uos, uos, name, partner_id,
82+ res = self.product_id_change_orig(cr, uid, ids, pricelist, product, qty, uom, qty_uos, uos, name, partner_id,
83 lang, update_tax, date_order, packaging, fiscal_position, flag)
84
85 if 'domain' in res:
86@@ -2926,7 +2924,8 @@
87 date_order=date_order,
88 packaging=packaging,
89 fiscal_position=fiscal_position,
90- flag=flag)
91+ flag=flag,
92+ context=context)
93
94 if context and context.get('categ') and product:
95 # Check consistency of product
96
97=== modified file 'bin/addons/sourcing/sale_order_line.py'
98--- bin/addons/sourcing/sale_order_line.py 2021-02-02 10:20:51 +0000
99+++ bin/addons/sourcing/sale_order_line.py 2021-05-12 07:52:00 +0000
100@@ -2000,10 +2000,9 @@
101
102 return res
103
104- def product_id_change(self, cr, uid, ids, pricelist, product, qty=0,
105- uom=False, qty_uos=0, uos=False, name='', partner_id=False,
106- lang=False, update_tax=True, date_order=False, packaging=False,
107- fiscal_position=False, flag=False):
108+ def product_id_change(self, cr, uid, ids, pricelist, product, qty=0, uom=False, qty_uos=0, uos=False, name='',
109+ partner_id=False, lang=False, update_tax=True, date_order=False, packaging=False,
110+ fiscal_position=False, flag=False, context=None):
111 """
112 When the product is changed on the line, looking for the
113 best supplier for the new product.
114@@ -2030,12 +2029,15 @@
115 :return A dictionary with the new values
116 :rtype dict
117 """
118+ if context is None:
119+ context = {}
120+
121 # Objects
122 product_obj = self.pool.get('product.product')
123
124- result = super(sale_order_line, self).product_id_change(cr, uid, ids, pricelist, product, qty,
125- uom, qty_uos, uos, name, partner_id,
126- lang, update_tax, date_order, packaging, fiscal_position, flag)
127+ result = super(sale_order_line, self).product_id_change(cr, uid, ids, pricelist, product, qty, uom, qty_uos,
128+ uos, name, partner_id, lang, update_tax, date_order,
129+ packaging, fiscal_position, flag, context=context)
130
131 # Add supplier
132 sellerId = False
133
134=== modified file 'bin/addons/specific_rules/specific_rules.py'
135--- bin/addons/specific_rules/specific_rules.py 2020-11-30 15:46:46 +0000
136+++ bin/addons/specific_rules/specific_rules.py 2021-05-12 07:52:00 +0000
137@@ -57,15 +57,19 @@
138
139 _columns = {'kc_dg': fields.function(_kc_dg, method=True, string='CC/DG', type='char'),}
140
141- def product_id_change(self, cr, uid, ids, pricelist, product, qty=0,
142- uom=False, qty_uos=0, uos=False, name='', partner_id=False,
143- lang=False, update_tax=True, date_order=False, packaging=False, fiscal_position=False, flag=False):
144+ def product_id_change(self, cr, uid, ids, pricelist, product, qty=0, uom=False, qty_uos=0, uos=False, name='',
145+ partner_id=False, lang=False, update_tax=True, date_order=False, packaging=False,
146+ fiscal_position=False, flag=False, context=None):
147 '''
148 if the product is short shelf life we display a warning
149 '''
150+ if context is None:
151+ context = {}
152+
153 # call to super
154- result = super(sale_order_line, self).product_id_change(cr, uid, ids, pricelist, product, qty,
155- uom, qty_uos, uos, name, partner_id, lang, update_tax, date_order, packaging, fiscal_position, flag)
156+ result = super(sale_order_line, self).product_id_change(cr, uid, ids, pricelist, product, qty, uom, qty_uos,
157+ uos, name, partner_id, lang, update_tax, date_order,
158+ packaging, fiscal_position, flag, context=context)
159
160 # if the product is short shelf life, display a warning
161 if product:

Subscribers

People subscribed via source and target branches