Merge lp:~jfb-tempo-consulting/unifield-server/US-8336 into lp:unifield-server

Proposed by jftempo
Status: Merged
Merged at revision: 6083
Proposed branch: lp:~jfb-tempo-consulting/unifield-server/US-8336
Merge into: lp:unifield-server
Diff against target: 438 lines (+208/-39)
7 files modified
bin/addons/mission_stock/mission_stock.py (+82/-29)
bin/addons/mission_stock/mission_stock_view.xml (+40/-0)
bin/addons/msf_profile/data/patches.xml (+3/-0)
bin/addons/msf_profile/msf_profile.py (+71/-1)
bin/addons/msf_sync_data_server/data/sync_server.sync_rule.csv (+2/-2)
bin/addons/product_attributes/product_attributes.py (+7/-5)
bin/addons/product_attributes/wizard/product_merged.py (+3/-2)
To merge this branch: bzr merge lp:~jfb-tempo-consulting/unifield-server/US-8336
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+409202@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/mission_stock/mission_stock.py'
2--- bin/addons/mission_stock/mission_stock.py 2021-02-09 17:29:10 +0000
3+++ bin/addons/mission_stock/mission_stock.py 2021-09-27 10:27:25 +0000
4@@ -1019,6 +1019,7 @@
5 qty = self.pool.get('product.uom')._compute_qty(cr, uid, uom, qty, line.product_id.uom_id.id)
6
7 vals['in_pipe_qty'] += qty
8+ vals['used_in_transaction'] = True
9
10 if partner == coordo_id:
11 vals['in_pipe_coor_qty'] += qty
12@@ -1047,6 +1048,53 @@
13 ''')
14 res = cr.fetchall()
15 all_move_ids = []
16+ doc_field_error_dom = [
17+ ('stock_move', 'product_id'),
18+ ('stock_production_lot', 'product_id'),
19+ ('purchase_order_line', 'product_id'),
20+ ('sale_order_line', 'product_id'),
21+ ('tender_line', 'product_id'),
22+ ('physical_inventory_counting', 'product_id'),
23+ ('initial_stock_inventory_line', 'product_id'),
24+ ('real_average_consumption_line', 'product_id'),
25+ ('replenishment_segment_line', 'product_id'),
26+ ('product_list_line', 'name'),
27+ ('composition_kit', 'composition_product_id'),
28+ ('composition_item', 'item_product_id'),
29+ ]
30+
31+ timer_used = time.time()
32+ # record the current value in transaction_updated
33+ cr.execute("update stock_mission_report_line set transaction_updated=coalesce(used_in_transaction, 'f'), used_in_transaction='f' where mission_report_id=%s", (report_id, ))
34+ for table, foreign_field in doc_field_error_dom:
35+ # set used_in_transaction='t'
36+ cr.execute('''
37+ update
38+ stock_mission_report_line l
39+ set
40+ used_in_transaction='t'
41+ from
42+ ''' + table + ''' ft
43+ where
44+ coalesce(l.used_in_transaction,'f')='f' and
45+ l.mission_report_id = %s and
46+ ft.''' + foreign_field + ''' = l.product_id
47+ ''', (report_id, )) # not_a_user_entry
48+
49+ # trigger sync update
50+ cr.execute('''
51+ update ir_model_data d
52+ set last_modification=NOW(), touched='[''used_in_transaction'']'
53+ from
54+ stock_mission_report_line l
55+ where
56+ l.id = d.res_id and
57+ l.transaction_updated!=used_in_transaction and
58+ d.model='stock.mission.report.line' and
59+ l.mission_report_id = %s
60+ ''', (report_id, ))
61+ logging.getLogger('MSR').info("""___ computation of used in transaction in %.2f sec.""" % (time.time() - timer_used))
62+
63 for move in res:
64 all_move_ids.append(move[0])
65 product = product_obj.browse(cr, uid, move[1],
66@@ -1056,17 +1104,19 @@
67 if line_id:
68 line = line_obj.browse(cr, uid, line_id[0])
69 qty = self.pool.get('product.uom')._compute_qty(cr, uid, move[2], move[3], product.uom_id.id)
70- vals = {'internal_qty': line.internal_qty or 0.00,
71- 'stock_qty': line.stock_qty or 0.00,
72- 'cross_qty': line.cross_qty or 0.00,
73- 'secondary_qty': line.secondary_qty or 0.00,
74- 'cu_qty': line.cu_qty or 0.00,
75- 'quarantine_qty': line.quarantine_qty or 0.00,
76- 'input_qty': line.input_qty or 0.00,
77- 'opdd_qty': line.opdd_qty or 0.00,
78- 'updated': True,
79- 'product_state': line.product_id.state and line.product_id.state.code,}
80-
81+ vals = {
82+ 'internal_qty': line.internal_qty or 0.00,
83+ 'stock_qty': line.stock_qty or 0.00,
84+ 'cross_qty': line.cross_qty or 0.00,
85+ 'secondary_qty': line.secondary_qty or 0.00,
86+ 'cu_qty': line.cu_qty or 0.00,
87+ 'quarantine_qty': line.quarantine_qty or 0.00,
88+ 'input_qty': line.input_qty or 0.00,
89+ 'opdd_qty': line.opdd_qty or 0.00,
90+ 'updated': True,
91+ 'product_state': line.product_id.state and line.product_id.state.code,
92+ 'used_in_transaction': True
93+ }
94 if move[4] in internal_loc:
95 vals['internal_qty'] -= qty
96 if move[4] in stock_loc:
97@@ -1500,8 +1550,8 @@
98 'product_id': fields.many2one('product.product', string='Name', required=True, ondelete="cascade", select=1),
99 'default_code': fields.related('product_id', 'default_code', string='Reference', type='char', size=64, store=True, write_relate=False),
100 'xmlid_code': fields.related('product_id', 'xmlid_code', string='MSFID', type='char', size=18, store=True, write_relate=False, _fnct_migrate=xmlid_code_migration),
101- 'old_code': fields.related('product_id', 'old_code', string='Old Code', type='char'),
102- 'name': fields.related('product_id', 'name', string='Name', type='char'),
103+ 'old_code': fields.related('product_id', 'old_code', string='Old Code', type='char', write_relate=False),
104+ 'name': fields.related('product_id', 'name', string='Name', type='char', write_relate=False),
105 'categ_id': fields.related('product_id', 'categ_id', string='Category', type='many2one', relation='product.category',
106 store={'product.template': (_get_template, ['type'], 10),
107 'stock.mission.report.line': (lambda self, cr, uid, ids, c={}: ids, ['product_id'], 10)},
108@@ -1526,17 +1576,17 @@
109 ),
110 'product_state': fields.char(size=128, string='Unifield state'),
111 # mandatory nomenclature levels
112- 'nomen_manda_0': fields.related('product_id', 'nomen_manda_0', type='many2one', relation='product.nomenclature', string='Main Type'),
113- 'nomen_manda_1': fields.related('product_id', 'nomen_manda_1', type='many2one', relation='product.nomenclature', string='Group'),
114- 'nomen_manda_2': fields.related('product_id', 'nomen_manda_2', type='many2one', relation='product.nomenclature', string='Family'),
115- 'nomen_manda_3': fields.related('product_id', 'nomen_manda_3', type='many2one', relation='product.nomenclature', string='Root'),
116+ 'nomen_manda_0': fields.related('product_id', 'nomen_manda_0', type='many2one', relation='product.nomenclature', string='Main Type', write_relate=False),
117+ 'nomen_manda_1': fields.related('product_id', 'nomen_manda_1', type='many2one', relation='product.nomenclature', string='Group', write_relate=False),
118+ 'nomen_manda_2': fields.related('product_id', 'nomen_manda_2', type='many2one', relation='product.nomenclature', string='Family', write_relate=False),
119+ 'nomen_manda_3': fields.related('product_id', 'nomen_manda_3', type='many2one', relation='product.nomenclature', string='Root', write_relate=False),
120 # optional nomenclature levels
121- 'nomen_sub_0': fields.related('product_id', 'nomen_sub_0', type='many2one', relation='product.nomenclature', string='Sub Class 1'),
122- 'nomen_sub_1': fields.related('product_id', 'nomen_sub_1', type='many2one', relation='product.nomenclature', string='Sub Class 2'),
123- 'nomen_sub_2': fields.related('product_id', 'nomen_sub_2', type='many2one', relation='product.nomenclature', string='Sub Class 3'),
124- 'nomen_sub_3': fields.related('product_id', 'nomen_sub_3', type='many2one', relation='product.nomenclature', string='Sub Class 4'),
125- 'nomen_sub_4': fields.related('product_id', 'nomen_sub_4', type='many2one', relation='product.nomenclature', string='Sub Class 5'),
126- 'nomen_sub_5': fields.related('product_id', 'nomen_sub_5', type='many2one', relation='product.nomenclature', string='Sub Class 6'),
127+ 'nomen_sub_0': fields.related('product_id', 'nomen_sub_0', type='many2one', relation='product.nomenclature', string='Sub Class 1', write_relate=False),
128+ 'nomen_sub_1': fields.related('product_id', 'nomen_sub_1', type='many2one', relation='product.nomenclature', string='Sub Class 2', write_relate=False),
129+ 'nomen_sub_2': fields.related('product_id', 'nomen_sub_2', type='many2one', relation='product.nomenclature', string='Sub Class 3', write_relate=False),
130+ 'nomen_sub_3': fields.related('product_id', 'nomen_sub_3', type='many2one', relation='product.nomenclature', string='Sub Class 4', write_relate=False),
131+ 'nomen_sub_4': fields.related('product_id', 'nomen_sub_4', type='many2one', relation='product.nomenclature', string='Sub Class 5', write_relate=False),
132+ 'nomen_sub_5': fields.related('product_id', 'nomen_sub_5', type='many2one', relation='product.nomenclature', string='Sub Class 6', write_relate=False),
133 'nomen_manda_0_s': fields.function(_get_nomen_s, method=True, type='many2one', relation='product.nomenclature', string='Main Type', fnct_search=_search_nomen_s, multi="nom_s"),
134 'nomen_manda_1_s': fields.function(_get_nomen_s, method=True, type='many2one', relation='product.nomenclature', string='Group', fnct_search=_search_nomen_s, multi="nom_s"),
135 'nomen_manda_2_s': fields.function(_get_nomen_s, method=True, type='many2one', relation='product.nomenclature', string='Family', fnct_search=_search_nomen_s, multi="nom_s"),
136@@ -1552,8 +1602,8 @@
137 'product_amc': fields.float('AMC'),
138 'product_consumption': fields.float('FMC'),
139
140- 'currency_id': fields.related('product_id', 'currency_id', type='many2one', relation='res.currency', string='Func. cur.'),
141- 'cost_price': fields.related('product_id', 'standard_price', type='float', string='Cost price'),
142+ 'currency_id': fields.related('product_id', 'currency_id', type='many2one', relation='res.currency', string='Func. cur.', write_relate=False),
143+ 'cost_price': fields.related('product_id', 'standard_price', type='float', string='Cost price', write_relate=False),
144 'uom_id': fields.related('product_id', 'uom_id', type='many2one', relation='product.uom', string='UoM',
145 store={
146 'product.template': (_get_template, ['type'], 10),
147@@ -1582,7 +1632,7 @@
148 'in_pipe_coor_qty': fields.float(digits=(16,2), string='In Pipe from Coord.', related_uom='uom_id'),
149 'in_pipe_coor_val': fields.float(digits=(16,2), string='In Pipe from Coord.', related_uom='uom_id'),
150 'updated': fields.boolean(string='Updated'),
151- 'full_view': fields.related('mission_report_id', 'full_view', string='Full view', type='boolean', store=True),
152+ 'full_view': fields.related('mission_report_id', 'full_view', string='Full view', type='boolean', store=True, write_relate=False),
153 'instance_id': fields.many2one(
154 'msf.instance',
155 string='HQ Instance',
156@@ -1591,6 +1641,8 @@
157 'quarantine_qty': fields.float(digits=(16, 2), string='Quarantine Qty.', related_uom='uom_id'),
158 'input_qty': fields.float(digits=(16, 2), string='Input Qty.', related_uom='uom_id'),
159 'opdd_qty': fields.float(digits=(16, 2), string='Output/Packing/Dispatch/Distribution Qty.', related_uom='uom_id'),
160+ 'used_in_transaction': fields.boolean('Used in a transaction'),
161+ 'transaction_updated': fields.boolean('Used changed', help='temporary value used to touch ir.model.data'),
162 }
163
164 @tools.cache(skiparg=2)
165@@ -1642,7 +1694,8 @@
166 sum(l.internal_qty)*t.standard_price AS internal_val,
167 sum(l.quarantine_qty) AS quarantine_qty,
168 sum(l.input_qty) AS input_qty,
169- sum(l.opdd_qty) AS opdd_qty
170+ sum(l.opdd_qty) AS opdd_qty,
171+ bool_or(used_in_transaction) AS used_in_transaction
172 FROM stock_mission_report_line l
173 LEFT JOIN
174 stock_mission_report m
175@@ -1683,10 +1736,10 @@
176 internal_qty=%s, stock_qty=%s,
177 cross_qty=%s, secondary_qty=%s,
178 cu_qty=%s, in_pipe_qty=%s, in_pipe_coor_qty=%s,
179- wh_qty=%s, quarantine_qty=%s, input_qty=%s, opdd_qty=%s
180+ wh_qty=%s, quarantine_qty=%s, input_qty=%s, opdd_qty=%s, used_in_transaction=%s
181 WHERE id=%s""" % (line[1] or 0.00, line[2] or 0.00, line[3] or 0.00, line[4] or 0.00,
182 line[5] or 0.00, line[6] or 0.00, line[7] or 0.00,
183- (line[2] or 0.00) + (line[3] or 0.00), line[9], line[10], line[11], line_id)) # not_a_user_entry
184+ (line[2] or 0.00) + (line[3] or 0.00), line[9], line[10], line[11], line[12] or False, line_id)) # not_a_user_entry
185 return True
186
187
188
189=== modified file 'bin/addons/mission_stock/mission_stock_view.xml'
190--- bin/addons/mission_stock/mission_stock_view.xml 2020-10-20 15:57:14 +0000
191+++ bin/addons/mission_stock/mission_stock_view.xml 2021-09-27 10:27:25 +0000
192@@ -80,6 +80,7 @@
193 <field name="default_code"/>
194 <field name="name"/>
195 <field name="categ_id" widget="selection" operator="child_of"/>
196+ <field name="used_in_transaction" />
197 <newline/>
198 <filter string="Single Item" icon="terp-accessories-archiver" domain="[('subtype','=','single')]"/>
199 <filter string="Kit/Module" icon="terp-accessories-archiver" domain="[('subtype','=','kit')]"/>
200@@ -152,12 +153,51 @@
201 <!-- <field name="cu_val" invisible="not context.get('with_valuation')" /> -->
202 <field name="product_amc" invisible="context.get('hide_amc_fmc')"/>
203 <field name="product_consumption" invisible="context.get('hide_amc_fmc')" />
204+ <field name="used_in_transaction" />
205 <field name="in_pipe_qty" />
206 <field name="categ_id" invisible="1" />
207 <field name="type" invisible="1" />
208 </tree>
209 </field>
210 </record>
211+
212+ <record id="mission_stock_line_form_view" model="ir.ui.view">
213+ <field name="name">mission.stock.product.form.view</field>
214+ <field name="model">stock.mission.report.line</field>
215+ <field name="type">form</field>
216+ <field name="arch" type="xml">
217+ <form string="Mission Stock Report" noteditable="1" hide_new_button="1" hide_save_button="1" hide_duplicate_button="1" hide_delete_button="1">
218+ <field name="product_id" />
219+ <field name="default_code" />
220+ <field name="name" />
221+ <field name="product_active" />
222+ <field name="uom_id" />
223+ <field name="cost_price" invisible="not context.get('with_valuation')" />
224+ <field name="currency_id" invisible="not context.get('with_valuation')" />
225+ <field name="internal_qty" />
226+ <field name="internal_val" invisible="not context.get('with_valuation')" />
227+ <!-- field name="in_pipe_coor_qty" />
228+ <field name="in_pipe_coor_val" invisible="not context.get('with_valuation')" / -->
229+ <field name="stock_qty" />
230+ <field name="cross_qty" />
231+ <!-- <field name="cross_val" invisible="not context.get('with_valuation')" /> -->
232+ <field name="secondary_qty" />
233+ <!-- <field name="secondary_val" invisible="not context.get('with_valuation')" /> -->
234+ <field name="cu_qty" />
235+ <field name="quarantine_qty" />
236+ <field name="input_qty" />
237+ <field name="opdd_qty" />
238+ <!-- <field name="cu_val" invisible="not context.get('with_valuation')" /> -->
239+ <field name="product_amc" invisible="context.get('hide_amc_fmc')"/>
240+ <field name="product_consumption" invisible="context.get('hide_amc_fmc')" />
241+ <field name="used_in_transaction" />
242+ <field name="in_pipe_qty" />
243+ <field name="categ_id" invisible="1" />
244+ <field name="type" invisible="1" />
245+ </form>
246+ </field>
247+ </record>
248+
249
250 <record id="consolidated_mission_stock_wizard_view" model="ir.ui.view">
251 <field name="name">consolidated.mission.stock.wizard.view</field>
252
253=== modified file 'bin/addons/msf_profile/data/patches.xml'
254--- bin/addons/msf_profile/data/patches.xml 2021-08-18 16:06:31 +0000
255+++ bin/addons/msf_profile/data/patches.xml 2021-09-27 10:27:25 +0000
256@@ -701,5 +701,8 @@
257 <record id="us_9003_partner_im_is_currencies" model="patch.scripts">
258 <field name="method">us_9003_partner_im_is_currencies</field>
259 </record>
260+ <record id="us_8336_update_msr_used" model="patch.scripts">
261+ <field name="method">us_8336_update_msr_used</field>
262+ </record>
263 </data>
264 </openerp>
265
266=== modified file 'bin/addons/msf_profile/msf_profile.py'
267--- bin/addons/msf_profile/msf_profile.py 2021-08-19 10:03:30 +0000
268+++ bin/addons/msf_profile/msf_profile.py 2021-09-27 10:27:25 +0000
269@@ -37,6 +37,7 @@
270 from msf_field_access_rights.osv_override import _get_instance_level
271 import cStringIO
272 import csv
273+import zlib
274
275
276 class patch_scripts(osv.osv):
277@@ -53,6 +54,65 @@
278 'model': lambda *a: 'patch.scripts',
279 }
280
281+ def us_8336_update_msr_used(self, cr, uid, *a, **b):
282+ if not self.pool.get('sync.client.entity'):
283+ # exclude new instances
284+ return True
285+
286+ if _get_instance_level(self, cr, uid) == 'hq':
287+ # exclude hq
288+ return True
289+
290+ doc_field_error_dom = [
291+ ('stock_move', 'product_id'),
292+ ('stock_production_lot', 'product_id'),
293+ ('purchase_order_line', 'product_id'),
294+ ('sale_order_line', 'product_id'),
295+ ('tender_line', 'product_id'),
296+ ('physical_inventory_counting', 'product_id'),
297+ ('initial_stock_inventory_line', 'product_id'),
298+ ('real_average_consumption_line', 'product_id'),
299+ ('replenishment_segment_line', 'product_id'),
300+ ('product_list_line', 'name'),
301+ ('composition_kit', 'composition_product_id'),
302+ ('composition_item', 'item_product_id'),
303+ ]
304+ report_ids = self.pool.get('stock.mission.report').search(cr, uid, [('local_report', '=', True), ('full_view', '=', False)])
305+ if not report_ids:
306+ return True
307+ report_id = report_ids[0]
308+ for table, foreign_field in doc_field_error_dom:
309+ # set used_in_transaction='t'
310+ cr.execute('''
311+ update
312+ stock_mission_report_line l
313+ set
314+ used_in_transaction='t'
315+ from
316+ ''' + table + ''' ft
317+ where
318+ coalesce(l.used_in_transaction,'f')='f' and
319+ l.mission_report_id = %s and
320+ ft.''' + foreign_field + ''' = l.product_id
321+ ''', (report_id, )) # not_a_user_entry
322+
323+ cr.execute('''
324+ select d.name
325+ from ir_model_data d, stock_mission_report_line l
326+ where
327+ l.id = d.res_id and
328+ used_in_transaction='t' and
329+ d.model='stock.mission.report.line' and
330+ l.mission_report_id = %s
331+ ''', (report_id,))
332+ if cr.rowcount:
333+ zipstr = base64.b64encode(zlib.compress(','.join([x[0] for x in cr.fetchall()])))
334+ self.pool.get('sync.trigger.something.up').create(cr, uid, {'name': 'msr_used', 'args': zipstr})
335+ return True
336+
337+
338+
339+
340 # UF22.0
341 def us_9003_partner_im_is_currencies(self, cr, uid, *a, **b):
342 self.us_5559_set_pricelist(cr, uid, *a, **b)
343@@ -4962,7 +5022,17 @@
344 if remote_id:
345 cr.execute("update stock_mission_report_line set cu_qty=0, cu_val=0 where mission_report_id in (select id from stock_mission_report where instance_id = %s and full_view='f')", (remote_id[0],))
346 _logger.warn('Reset %d mission stock CU Stock for instance_id %s' % (cr.rowcount, remote_id[0]))
347-
348+ elif vals.get('name') == 'msr_used':
349+ cr.execute('''
350+ update stock_mission_report_line l
351+ set used_in_transaction='t'
352+ from
353+ ir_model_data d
354+ where
355+ d.model='stock.mission.report.line' and
356+ d.res_id = l.id and
357+ d.name in %s
358+ ''', (tuple((zlib.decompress(base64.b64decode(vals.get('args'))).split(','))),))
359 return super(sync_tigger_something_up, self).create(cr, uid, vals, context)
360
361 sync_tigger_something_up()
362
363=== modified file 'bin/addons/msf_sync_data_server/data/sync_server.sync_rule.csv'
364--- bin/addons/msf_sync_data_server/data/sync_server.sync_rule.csv 2021-06-07 13:41:02 +0000
365+++ bin/addons/msf_sync_data_server/data/sync_server.sync_rule.csv 2021-09-27 10:27:25 +0000
366@@ -100,8 +100,8 @@
367 msf_sync_data_server.budget_line,TRUE,TRUE,FALSE,FALSE,bidirectional,Up,"[('budget_id','in',('msf.budget','id',[('type','=','normal'), ('state', '!=', 'draft')]))]","['account_id/id', 'budget_id/id', 'month1', 'month2', 'month3', 'month4', 'month5', 'month6', 'month7', 'month8', 'month9', 'month10', 'month11', 'month12', 'destination_id/id', 'line_type']",OC,msf.budget.line,,Budget line,Valid,,431
368 msf_sync_data_server.budget_status,TRUE,TRUE,FALSE,FALSE,bidirectional,Up,"[('type','=','normal'), ('state', '!=', 'draft')]",['state'],OC,msf.budget,,Budget status,Valid,,432
369 msf_sync_data_server.mission_stock_report,TRUE,TRUE,FALSE,FALSE,bidirectional,Up,"[('full_view', '=', False), ('local_report', '=', True)]","['full_view', 'instance_id/id', 'last_update', 'name']",OC,stock.mission.report,,Mission Stock Report,Valid,,440
370-msf_sync_data_server.mission_stock_report_line,TRUE,TRUE,FALSE,FALSE,bidirectional,Up,"[('mission_report_id.full_view', '=', False), ('mission_report_id.local_report', '=', True), ('international_status','in',['Local', 'Temporary'])]","['cross_qty', 'cross_val', 'cu_qty', 'cu_val', 'in_pipe_coor_qty', 'in_pipe_coor_val', 'in_pipe_qty', 'in_pipe_val', 'internal_qty', 'internal_val', 'mission_report_id/id', 'product_id/id', 'secondary_qty', 'secondary_val', 'stock_qty', 'stock_val', 'xmlid_code', 'product_state', 'product_active', 'state_ud', 'international_status_code', 'product_amc', 'product_consumption', 'quarantine_qty', 'input_qty', 'opdd_qty']",MISSION,stock.mission.report.line,,Mission Stock Report Line,Valid,,441
371-msf_sync_data_server.mission_stock_report_line_OC,TRUE,TRUE,FALSE,FALSE,bidirectional,Up,"[('mission_report_id.full_view', '=', False), ('mission_report_id.local_report', '=', True), ('international_status','in',['ITC', 'UniData', 'ESC', 'HQ'])]","['cross_qty', 'cross_val', 'cu_qty', 'cu_val', 'in_pipe_coor_qty', 'in_pipe_coor_val', 'in_pipe_qty', 'in_pipe_val', 'internal_qty', 'internal_val', 'mission_report_id/id', 'product_id/id', 'secondary_qty', 'secondary_val', 'stock_qty', 'stock_val', 'xmlid_code', 'product_state', 'product_active', 'state_ud', 'international_status_code', 'product_amc', 'product_consumption', 'quarantine_qty', 'input_qty', 'opdd_qty']",OC,stock.mission.report.line,,Mission Stock Report Line OC,Valid,,442
372+msf_sync_data_server.mission_stock_report_line,TRUE,TRUE,FALSE,FALSE,bidirectional,Up,"[('mission_report_id.full_view', '=', False), ('mission_report_id.local_report', '=', True), ('international_status','in',['Local', 'Temporary'])]","['cross_qty', 'cross_val', 'cu_qty', 'cu_val', 'in_pipe_coor_qty', 'in_pipe_coor_val', 'in_pipe_qty', 'in_pipe_val', 'internal_qty', 'internal_val', 'mission_report_id/id', 'product_id/id', 'secondary_qty', 'secondary_val', 'stock_qty', 'stock_val', 'xmlid_code', 'product_state', 'product_active', 'state_ud', 'international_status_code', 'product_amc', 'product_consumption', 'quarantine_qty', 'input_qty', 'opdd_qty', 'used_in_transaction']",MISSION,stock.mission.report.line,,Mission Stock Report Line,Valid,,441
373+msf_sync_data_server.mission_stock_report_line_OC,TRUE,TRUE,FALSE,FALSE,bidirectional,Up,"[('mission_report_id.full_view', '=', False), ('mission_report_id.local_report', '=', True), ('international_status','in',['ITC', 'UniData', 'ESC', 'HQ'])]","['cross_qty', 'cross_val', 'cu_qty', 'cu_val', 'in_pipe_coor_qty', 'in_pipe_coor_val', 'in_pipe_qty', 'in_pipe_val', 'internal_qty', 'internal_val', 'mission_report_id/id', 'product_id/id', 'secondary_qty', 'secondary_val', 'stock_qty', 'stock_val', 'xmlid_code', 'product_state', 'product_active', 'state_ud', 'international_status_code', 'product_amc', 'product_consumption', 'quarantine_qty', 'input_qty', 'opdd_qty', 'used_in_transaction']",OC,stock.mission.report.line,,Mission Stock Report Line OC,Valid,,442
374 msf_sync_data_server.financing_contract_formats_fc,TRUE,TRUE,FALSE,TRUE,bidirectional,Bidirectional-Private,[],"['cost_center_ids/id', 'eligibility_from_date', 'eligibility_to_date', 'format_name', 'overhead_percentage', 'overhead_type', 'reporting_type', 'hidden_instance_id/id']",HQ + MISSION,financing.contract.format,hidden_instance_id,Financing Contract Formats FC,Valid,,450
375 msf_sync_data_server.financing_contract_formats,TRUE,TRUE,TRUE,TRUE,bidirectional,Bidirectional,"[('hidden_instance_id','=',False)]","['hidden_instance_id/id','cost_center_ids/id', 'eligibility_from_date', 'eligibility_to_date', 'format_name', 'overhead_percentage', 'overhead_type', 'reporting_type']",HQ + MISSION,financing.contract.format,,Financing Contract Formats,Valid,,451
376 msf_sync_data_server.financing_contract_format_lines,TRUE,TRUE,TRUE,TRUE,bidirectional,Bidirectional,"[('instance_id', '=', False)]","['account_destination_ids/id', 'instance_id/id','allocated_budget_value', 'allocated_real_value', 'code', 'format_id/id', 'line_type', 'name', 'overhead_percentage', 'overhead_type', 'project_budget_value', 'project_real_value', 'is_quadruplet', 'quadruplet_sync_list', 'reporting_select_accounts_only', 'reporting_account_ids/id']",HQ + MISSION,financing.contract.format.line,,Financing Contract Format Lines,Valid,,452
377
378=== modified file 'bin/addons/product_attributes/product_attributes.py'
379--- bin/addons/product_attributes/product_attributes.py 2021-08-18 14:49:48 +0000
380+++ bin/addons/product_attributes/product_attributes.py 2021-09-27 10:27:25 +0000
381@@ -2737,6 +2737,7 @@
382 ('composition.kit', 'composition_product_id', _('Composition Kit(s)'), []),
383 ('composition.item', 'item_product_id', _('Composition Kit line(s)'), []),
384 ]
385+ # please update also doc_field_error_dom in bin/addons/mission_stock/mission_stock.py
386
387 for obj, field, msg, dom in doc_field_error_dom:
388 nb = self.pool.get(obj).search(cr, uid, [(field, '=', prod_id)]+dom, count=True, context=context)
389@@ -2755,7 +2756,7 @@
390
391 cr.execute('''
392 select
393- l.product_id
394+ l.product_id, array_agg(i.code)
395 from
396 stock_mission_report r, msf_instance i, stock_mission_report_line l
397 where
398@@ -2764,10 +2765,10 @@
399 l.mission_report_id = r.id and
400 l.product_id in %s and
401 r.full_view = 'f' and
402- ( l.internal_qty > 0 or l.in_pipe_qty > 0)
403+ ( l.internal_qty > 0 or l.in_pipe_qty > 0 or l.used_in_transaction='t')
404 group by l.product_id
405 ''' , (tuple(ids), ))
406- return [x[0] for x in cr.fetchall()]
407+ return [(x[0],', '.join(x[1])) for x in cr.fetchall()]
408
409
410 def merge_product(self, cr, uid, nsl_prod_id, local_id, context=None):
411@@ -2782,8 +2783,9 @@
412 if error_used:
413 raise osv.except_osv(_('Warning'), _('The selected UD product %s has already been used in the past. Merge cannot be done for this product') % (new_data['default_code'], ))
414
415- if self._has_pipe(cr, uid, nsl_prod_id):
416- raise osv.except_osv(_('Warning'), _('Warning there is stock / pipeline in at least one of the instances in this mission! Therefore the product cannot be merged') % (new_data['default_code'], ))
417+ has_pipe = self._has_pipe(cr, uid, nsl_prod_id)
418+ if has_pipe:
419+ raise osv.except_osv(_('Warning'), _('Warning there is stock / pipeline in at least one of the instances in this mission! Therefore the product cannot be merged. Instance(s): %s') % (has_pipe[0][1], ))
420
421 local_dom = [('id', '=', local_id), ('international_status', '=', 'Local'), ('replaced_by_product_id', '=', False)]
422 if not context.get('sync_update_execution'):
423
424=== modified file 'bin/addons/product_attributes/wizard/product_merged.py'
425--- bin/addons/product_attributes/wizard/product_merged.py 2020-05-04 16:40:38 +0000
426+++ bin/addons/product_attributes/wizard/product_merged.py 2021-09-27 10:27:25 +0000
427@@ -26,8 +26,9 @@
428 if error_used:
429 raise osv.except_osv(_('Warning'), _('The selected UD product has already been used in the past. Merge cannot be done for this product.'))
430
431- if prod_obj._has_pipe(cr, uid, wiz.new_product_id.id):
432- raise osv.except_osv(_('Warning'), _('Warning there is stock / pipeline in at least one of the instances in this mission! Therefore this product cannot be merged.'))
433+ has_pipe = prod_obj._has_pipe(cr, uid, wiz.new_product_id.id)
434+ if has_pipe:
435+ raise osv.except_osv(_('Warning'), _('Warning there is stock / pipeline in at least one of the instances in this mission! Therefore this product cannot be merged. Instances: %s') % (has_pipe[0][1], ))
436
437 block_msg = prod_obj.check_same_value(cr, uid, wiz.new_product_id.id, wiz.old_product_id.id, blocker=True, context=context)
438 if block_msg:

Subscribers

People subscribed via source and target branches