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

Proposed by jftempo
Status: Merged
Merged at revision: 6274
Proposed branch: lp:~dorian-kemps/unifield-server/US-7323
Merge into: lp:unifield-server
Diff against target: 879 lines (+408/-59) (has conflicts)
19 files modified
bin/addons/base/ir/ir_actions.py (+2/-0)
bin/addons/base/ir/ir_values.py (+14/-2)
bin/addons/msf_outgoing/msf_outgoing_view.xml (+3/-0)
bin/addons/msf_profile/i18n/fr_MF.po (+37/-14)
bin/addons/procurement_request/procurement_request_view.xml (+13/-14)
bin/addons/product/product.py (+21/-0)
bin/addons/product_attributes/product_attributes_view.xml (+190/-16)
bin/addons/purchase/purchase_order.py (+15/-3)
bin/addons/purchase/purchase_view.xml (+0/-6)
bin/addons/reason_types_moves/reason_type_view.xml (+1/-0)
bin/addons/reason_types_moves/stock_view.xml (+1/-0)
bin/addons/sale/sale_order.py (+35/-1)
bin/addons/sale/sale_view.xml (+2/-0)
bin/addons/stock/stock.py (+35/-0)
bin/addons/stock/stock_view.xml (+1/-0)
bin/addons/tender_flow/tender_flow.py (+35/-1)
bin/addons/tender_flow/tender_flow_view.xml (+1/-1)
bin/import_xml.rng (+1/-0)
bin/tools/convert.py (+1/-1)
Text conflict in bin/addons/msf_profile/i18n/fr_MF.po
To merge this branch: bzr merge lp:~dorian-kemps/unifield-server/US-7323
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+424784@code.launchpad.net
To post a comment you must log in.
6248. By Dorian

US-7323 [FIX] Product: Added the search view to the docs' actions to have the correct filters

6249. By Dorian

US-7323 [FIX] Product: Replaced the act_windows by ir.actions.server to lose no views, domain or context while using the actions on the right menu

6250. By Dorian

US-7323 [MERGE] Merge with jfb-tempo-consulting/unifield-server/US-7323

6251. By Dorian

US-7323 [FIX] Product: The right menu actions for the docs put the product_id in the context (and the search filter in the view) instead of the domain

6252. By Dorian

US-7323 [FIX] IR filters: Removed a group in the view to have access to more width

6253. By Dorian

US-7323 [FIX] Product: Removed the product name from the new search views generated by the docs button on the right menu

6254. By Dorian

US-7323 [FIX] Product right menu: the new docs ations will put no default filter on the generated view expect for the product_id

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/addons/base/ir/ir_actions.py'
2--- bin/addons/base/ir/ir_actions.py 2021-10-12 16:20:20 +0000
3+++ bin/addons/base/ir/ir_actions.py 2022-07-13 15:38:28 +0000
4@@ -373,6 +373,8 @@
5 if not new_tab:
6 res['target'] = 'crush'
7 return res
8+
9+
10 act_window()
11
12 class act_window_view(osv.osv):
13
14=== modified file 'bin/addons/base/ir/ir_values.py'
15--- bin/addons/base/ir/ir_values.py 2021-08-20 10:32:29 +0000
16+++ bin/addons/base/ir/ir_values.py 2022-07-13 15:38:28 +0000
17@@ -237,11 +237,23 @@
18 # for the admin only add the "Update Sent / Received" links in the menu on the right for all synched objects
19 if key == 'action' and key2 == 'client_action_relate' and uid == 1 and self.pool.get('update.link') and models:
20 obj_model = models[0][0]
21+ act_to_add = []
22 if self.pool.get('sync.client.rule').search_exist(cr, uid, [('model', '=', obj_model), ('type', '!=', 'USB')]):
23 act_sent_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'sync_client', 'action_open_updates_sent')[1]
24- result.append((act_sent_id, 'Updates_Sent', u'ir.actions.server,%d' % act_sent_id, True, None, u'action'))
25+ act_to_add.append((act_sent_id, 'Updates_Sent', u'ir.actions.server,%d' % act_sent_id, True, None, u'action'))
26 act_rcv_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'sync_client', 'action_open_updates_received')[1]
27- result.append((act_rcv_id, 'Updates_Received', u'ir.actions.server,%d' % act_rcv_id, True, None, u'action'))
28+ act_to_add.append((act_rcv_id, 'Updates_Received', u'ir.actions.server,%d' % act_rcv_id, True, None, u'action'))
29+
30+ if obj_model == 'product.product':
31+ # on product updates links are not at the end
32+ new_res = []
33+ for x in result:
34+ new_res.append(x)
35+ if x[1] == u'View_log_product.product':
36+ new_res += act_to_add
37+ result = new_res
38+ else:
39+ result += act_to_add
40
41 if not result:
42 return []
43
44=== modified file 'bin/addons/msf_outgoing/msf_outgoing_view.xml'
45--- bin/addons/msf_outgoing/msf_outgoing_view.xml 2022-03-09 10:33:36 +0000
46+++ bin/addons/msf_outgoing/msf_outgoing_view.xml 2022-07-13 15:38:28 +0000
47@@ -467,6 +467,7 @@
48 <field name="reason_type_id" widget="selection" domain="[('outgoing_ok', '=', True)]" />
49 <field name="date" />
50 <field name="min_date" />
51+ <field name="product_id" />
52 </group>
53 <newline />
54 <group string="State of lines" col="8" colspan="4">
55@@ -803,8 +804,10 @@
56 <field name="order_category" />
57 <field name="reason_type_id" widget="selection" />
58 <field name="company_id" widget="selection" groups="base.group_multi_company"/>
59+ <newline/>
60 <field name="date" />
61 <field name="min_date" />
62+ <field name="product_id" />
63 </group>
64 <newline/>
65 <group expand="0" string="Group By..." colspan="4" col="8">
66
67=== modified file 'bin/addons/msf_profile/i18n/fr_MF.po'
68--- bin/addons/msf_profile/i18n/fr_MF.po 2022-07-11 08:43:43 +0000
69+++ bin/addons/msf_profile/i18n/fr_MF.po 2022-07-13 15:38:28 +0000
70@@ -10568,11 +10568,12 @@
71 msgid "Lists/Sublists"
72 msgstr "Listes/Sous-listes"
73
74-#. modules: sale, useability_dashboard_and_menu
75+#. modules: sale, useability_dashboard_and_menu, product_attributes
76 #: view:sale.report:0
77 #: view:sale.order:0
78+#: model:ir.actions.server,name:product_attributes.action_product_fo_tree
79 msgid "Field Orders"
80-msgstr "Commandes du terrain"
81+msgstr "Commandes de Terrain"
82
83 #. modules: purchase_msf, purchase_override
84 #: field:purchase.order.line,internal_name:0
85@@ -12144,11 +12145,6 @@
86 msgid "Draft statement"
87 msgstr "Relevé sous statut brouillon"
88
89-#. module: product_attributes
90-#: model:ir.actions.act_window,name:product_attributes.action_order_line_product_tree
91-msgid "Field orders"
92-msgstr "Commandes de terrain"
93-
94 #. module: tender_flow
95 #: selection:tender,internal_state:0
96 msgid "Rfq Updated"
97@@ -17168,7 +17164,7 @@
98 msgstr "Employé - Etat civil "
99
100 #. modules: product_attributes, tender_flow, sales_followup
101-#: model:ir.actions.act_window,name:product_attributes.action_tender_product_tree
102+#: model:ir.actions.server,name:product_attributes.action_product_tender_tree
103 #: view:sale.order.line.followup:0
104 #: model:ir.actions.act_window,name:tender_flow.tender_action
105 #: model:ir.ui.menu,name:tender_flow.menu_tender
106@@ -23027,7 +23023,7 @@
107 msgid "Pacific/Easter"
108 msgstr "Pacific/Easter"
109
110-#. modules: purchase, msf_outgoing, useability_dashboard_and_menu, stock
111+#. modules: purchase, msf_outgoing, useability_dashboard_and_menu, stock, product_attributes
112 #: view:purchase.order:0
113 #: model:ir.actions.act_window,name:stock.action_picking_tree
114 #: model:ir.ui.menu,name:stock.menu_action_picking_tree
115@@ -23037,6 +23033,7 @@
116 #: code:addons/msf_outgoing/wizard/internal_move_processor.py:185
117 #: code:addons/msf_outgoing/wizard/internal_move_processor.py:205
118 #: code:addons/msf_outgoing/wizard/outgoing_delivery_processor.py:104
119+#: model:ir.actions.server,name:product_attributes.action_product_out_tree
120 #, python-format
121 msgid "Delivery Orders"
122 msgstr "Bons de Livraison"
123@@ -39331,9 +39328,10 @@
124 msgid "Cross-docking Val."
125 msgstr "Transbordement - Valeur."
126
127-#. module: tender_flow
128+#. module: tender_flow, product_attributes
129 #: view:tender:0
130 #: field:tender,rfq_ids:0
131+#: model:ir.actions.server,name:product_attributes.action_product_rfq_tree
132 msgid "RfQs"
133 msgstr "DdD"
134
135@@ -69281,7 +69279,7 @@
136 msgid "Display graph"
137 msgstr "Affichage du Graphique"
138
139-#. modules: purchase, useability_dashboard_and_menu, stock, msf_outgoing
140+#. modules: purchase, useability_dashboard_and_menu, stock, msf_outgoing, product_attributes
141 #: code:addons/msf_outgoing/wizard/internal_move_processor.py:183
142 #: model:ir.ui.menu,name:purchase.menu_action_picking_tree4
143 #: model:ir.actions.act_window,name:stock.action_picking_tree4
144@@ -69289,6 +69287,7 @@
145 #: view:stock.picking:0
146 #: view:board.board:0
147 #: model:ir.actions.act_window,name:useability_dashboard_and_menu.action_picking_tree_available
148+#: model:ir.actions.server,name:product_attributes.action_product_in_tree
149 #, python-format
150 msgid "Incoming Shipments"
151 msgstr "Livraisons Entrantes"
152@@ -78816,12 +78815,13 @@
153 msgid "Subtotal (functional currency)"
154 msgstr "Sous-Total (devise fonctionnelle)"
155
156-#. modules: stock, msf_outgoing
157+#. modules: stock, msf_outgoing, product_attributes
158 #: code:addons/msf_outgoing/wizard/internal_move_processor.py:184
159 #: model:ir.actions.act_window,name:stock.action_picking_tree6
160 #: model:ir.ui.menu,name:stock.menu_action_picking_tree6
161 #: view:stock.picking:0
162 #: field:stock.picking,move_lines:0
163+#: model:ir.actions.server,name:product_attributes.action_product_int_tree
164 #, python-format
165 msgid "Internal Moves"
166 msgstr "Mouvements Internes"
167@@ -79431,9 +79431,10 @@
168 msgid "You do not have access to the field (%s). If you did not edit this field, please let an OpenERP administrator know about this error message, and the field name."
169 msgstr "You do not have access to the field (%s). If you did not edit this field, please let an OpenERP administrator know about this error message, and the field name."
170
171-#. module: procurement_request
172+#. module: procurement_request, product_attributes
173 #: model:ir.actions.act_window,name:procurement_request.action_procurement_request
174 #: model:ir.ui.menu,name:procurement_request.menu_procurement_request
175+#: model:ir.actions.server,name:product_attributes.action_product_ir_tree
176 #: view:sale.order:0
177 msgid "Internal Requests"
178 msgstr "Demandes Internes"
179@@ -82989,6 +82990,7 @@
180 #: field:view.expired.expiring.stock.lines,product_id:0
181 #: field:account.commitment.line,line_product_id:0
182 #: field:product.ed_bn.mass.update.history,product_id:0
183+#: field:stock.picking,product_id:0
184 #, python-format
185 msgid "Product"
186 msgstr "Produit"
187@@ -87933,7 +87935,7 @@
188 #: view:account.analytic.line:0
189 #: field:analytic.distribution,purchase_ids:0
190 #: model:ir.ui.menu,name:base.menu_purchase_root
191-#: model:ir.actions.act_window,name:purchase.action_purchase_line_product_tree2
192+#: model:ir.actions.server,name:product_attributes.action_product_po_tree
193 msgid "Purchases"
194 msgstr "Achats"
195
196@@ -115351,6 +115353,7 @@
197 #, python-format
198 msgid "Cannot update these products, ED/BN attributes have not changed since the KCL creation"
199 msgstr "Impossible de mettre à jour ces produits. Les attributs NL/DE n'ont pas changé depuis la création du Kit"
200+<<<<<<< TREE
201
202 #. module: board
203 #: report:addons/board/report/integrity.mako:83
204@@ -115652,3 +115655,23 @@
205 msgid "This report is an analysis done by employee. It is a report containing one line per employee representing the cumulative credit balance."
206 msgstr "Ce rapport est une analyse effectuée par employé. Il s'agit d'un rapport contenant une ligne par employé et représentant le solde créditeur cumulé."
207
208+=======
209+
210+#. modules: purchase, tender_flow, sale, stock
211+#: help:purchase.order,product_id:0
212+#: help:sale.order,product_id:0
213+#: help:stock.picking,product_id:0
214+#: help:tender,product_id:0
215+msgid "Product to find in the lines"
216+msgstr "Produit à trouver dans les lignes"
217+
218+#. module: product_attributes
219+#: model:ir.actions.server,name:product_attributes.action_product_pick_tree
220+msgid "Pickings"
221+msgstr "Pickings"
222+
223+#. module: product_attributes
224+#: model:ir.actions.server,name:product_attributes.action_product_pack_tree
225+msgid "Packings"
226+msgstr "Colisages"
227+>>>>>>> MERGE-SOURCE
228
229=== modified file 'bin/addons/procurement_request/procurement_request_view.xml'
230--- bin/addons/procurement_request/procurement_request_view.xml 2022-05-18 11:32:30 +0000
231+++ bin/addons/procurement_request/procurement_request_view.xml 2022-07-13 15:38:28 +0000
232@@ -173,19 +173,18 @@
233 <field name="priority" eval="250" />
234 <field name="arch" type="xml">
235 <search string="Internal Requests">
236- <group string="Filters" expand="1">
237- <filter name="state_proc" string="Draft" icon="terp-document-new" domain="[('state', 'in', ['draft','draft_p'])]" />
238- <filter name="state_valid" string="Validated" icon="terp-check" domain="[('state', 'in', ['validated','validated_p'])]" />
239- <filter name="sourced" string="Sourced" icon="gtk-paste-v" domain="[('state','in',['sourced','sourced_p'])]" />
240- <filter name="state_proc_progress" string="Confirmed" icon="terp-camera_test" domain="[('state', 'in', ('confirmed', 'confirmed_p'))]" />
241- <filter name="state_done" string="Closed" icon="terp-dialog-close" domain="[('state', '=', 'done')]" />
242- <filter name="cancelled" string="Cancelled" icon="gtk-cancel" domain="[('state', '=', 'cancel')]" />
243- <separator orientation="vertical" />
244- <field name="name" />
245- <field name="origin" />
246- <field name="requestor" />
247- <field name="location_requestor_id" />
248- </group>
249+ <filter name="state_proc" string="Draft" icon="terp-document-new" domain="[('state', 'in', ['draft','draft_p'])]" />
250+ <filter name="state_valid" string="Validated" icon="terp-check" domain="[('state', 'in', ['validated','validated_p'])]" />
251+ <filter name="sourced" string="Sourced" icon="gtk-paste-v" domain="[('state','in',['sourced','sourced_p'])]" />
252+ <filter name="state_proc_progress" string="Confirmed" icon="terp-camera_test" domain="[('state', 'in', ('confirmed', 'confirmed_p'))]" />
253+ <filter name="state_done" string="Closed" icon="terp-dialog-close" domain="[('state', '=', 'done')]" />
254+ <filter name="cancelled" string="Cancelled" icon="gtk-cancel" domain="[('state', '=', 'cancel')]" />
255+ <separator orientation="vertical" />
256+ <field name="name" />
257+ <field name="origin" />
258+ <field name="requestor" />
259+ <field name="location_requestor_id" />
260+ <field name="product_id" />
261 <newline />
262 <group string="Group By...">
263 <filter string="State" icon="terp-gtk-select-all" domain="[]" context="{'group_by': 'state'}" />
264@@ -216,7 +215,7 @@
265 <field name="res_model">sale.order</field>
266 <field name="view_type">form</field>
267 <field name="view_mode">tree,form</field>
268- <field name="view_search_id" ref="procurement_request_search_view" />
269+ <field name="search_view_id" ref="procurement_request_search_view" />
270 <field name="context">{'procurement_request': True}</field>
271 <field name="domain">[('procurement_request', '=', True)]</field>
272 </record>
273
274=== modified file 'bin/addons/product/product.py'
275--- bin/addons/product/product.py 2021-08-06 15:49:01 +0000
276+++ bin/addons/product/product.py 2022-07-13 15:38:28 +0000
277@@ -27,6 +27,7 @@
278 import re
279 from tools.translate import _
280 from tools import cache
281+from tools.safe_eval import safe_eval
282
283 def is_pair(x):
284 return not x%2
285@@ -893,9 +894,29 @@
286 res.update({'value': {'list_price': list_price}})
287 return res
288
289+ def view_docs_with_product(self, cr, uid, ids, menu_action, context=None):
290+ '''
291+ Get info from the given menu action to return the right view with the right data
292+ '''
293+
294+ if context is None:
295+ context = {}
296+
297+ res = self.pool.get('ir.actions.act_window').open_view_from_xmlid(cr, uid, menu_action, ['tree', 'form'], new_tab=True, context=context)
298+
299+ res_context = res.get('context', False) and safe_eval(res['context']) or {}
300+ for col in res_context: # Remove the default filters
301+ if 'search_default_' in col:
302+ res_context[col] = False
303+ res_context['search_default_product_id'] = context.get('active_id', False)
304+ res['context'] = res_context
305+
306+ return res
307+
308
309 product_product()
310
311+
312 class product_packaging(osv.osv):
313 _name = "product.packaging"
314 _description = "Packaging"
315
316=== modified file 'bin/addons/product_attributes/product_attributes_view.xml'
317--- bin/addons/product_attributes/product_attributes_view.xml 2021-12-07 15:12:27 +0000
318+++ bin/addons/product_attributes/product_attributes_view.xml 2022-07-13 15:38:28 +0000
319@@ -542,22 +542,196 @@
320 </field>
321 </record>
322
323- <act_window
324- context="{}"
325- domain="[('procurement_request', '=', False), ('product_id', '=', active_id)]"
326- id="action_order_line_product_tree"
327- name="Field orders"
328- res_model="sale.order"
329- src_model="product.product" />
330-
331- <act_window
332- context="{}"
333- domain="[('product_id', '=', active_id)]"
334- id="action_tender_product_tree"
335- name="Tenders"
336- res_model="tender"
337- src_model="product.product" />
338-
339+ <!-- List of actions at the bottom of the list, the dashed line-break is located on the web's side -->
340+ <!-- FO -->
341+ <record id="action_product_fo_tree" model="ir.actions.server">
342+ <field name="name">Field Orders</field>
343+ <field name="model_id" ref="product.model_product_product"/>
344+ <field name="state">code</field>
345+ <field name="code">
346+action = self.view_docs_with_product(cr, uid, ids, menu_action='sale.action_order_form', context=context)
347+ </field>
348+ </record>
349+
350+ <record id="open_product_fo_tree" model="ir.values">
351+ <field name="key2">client_action_relate</field>
352+ <field name="model">product.product</field>
353+ <field name="name">Field Orders</field>
354+ <field name="value" eval="'ir.actions.server,%d'%action_product_fo_tree"/>
355+ <field name="object" eval="True"/>
356+ <field name="sequence" eval="100001"/>
357+ </record>
358+
359+ <!-- IR -->
360+ <record id="action_product_ir_tree" model="ir.actions.server">
361+ <field name="name">Internal Requests</field>
362+ <field name="model_id" ref="product.model_product_product"/>
363+ <field name="state">code</field>
364+ <field name="code">
365+action = self.view_docs_with_product(cr, uid, ids, menu_action='procurement_request.action_procurement_request', context=context)
366+ </field>
367+ </record>
368+
369+ <record id="open_product_ir_tree" model="ir.values">
370+ <field name="key2">client_action_relate</field>
371+ <field name="model">product.product</field>
372+ <field name="name">Internal Requests</field>
373+ <field name="value" eval="'ir.actions.server,%d'%action_product_ir_tree"/>
374+ <field name="object" eval="True"/>
375+ <field name="sequence" eval="100002"/>
376+ </record>
377+
378+ <!-- PO -->
379+ <record id="action_product_po_tree" model="ir.actions.server">
380+ <field name="name">Purchases</field>
381+ <field name="model_id" ref="product.model_product_product"/>
382+ <field name="state">code</field>
383+ <field name="code">
384+action = self.view_docs_with_product(cr, uid, ids, menu_action='purchase.purchase_form_action', context=context)
385+ </field>
386+ </record>
387+
388+ <record id="open_product_po_tree" model="ir.values">
389+ <field name="key2">client_action_relate</field>
390+ <field name="model">product.product</field>
391+ <field name="name">Purchases</field>
392+ <field name="value" eval="'ir.actions.server,%d'%action_product_po_tree"/>
393+ <field name="object" eval="True"/>
394+ <field name="sequence" eval="100003"/>
395+ </record>
396+
397+ <!-- RfQ -->
398+ <record id="action_product_rfq_tree" model="ir.actions.server">
399+ <field name="name">RfQs</field>
400+ <field name="model_id" ref="product.model_product_product"/>
401+ <field name="state">code</field>
402+ <field name="code">
403+action = self.view_docs_with_product(cr, uid, ids, menu_action='purchase.purchase_rfq', context=context)
404+ </field>
405+ </record>
406+
407+ <record id="open_product_rfq_tree" model="ir.values">
408+ <field name="key2">client_action_relate</field>
409+ <field name="model">product.product</field>
410+ <field name="name">RfQs</field>
411+ <field name="value" eval="'ir.actions.server,%d'%action_product_rfq_tree"/>
412+ <field name="object" eval="True"/>
413+ <field name="sequence" eval="100004"/>
414+ </record>
415+
416+ <!-- Tender -->
417+ <record id="action_product_tender_tree" model="ir.actions.server">
418+ <field name="name">Tenders</field>
419+ <field name="model_id" ref="product.model_product_product"/>
420+ <field name="state">code</field>
421+ <field name="code">
422+action = self.view_docs_with_product(cr, uid, ids, menu_action='tender_flow.tender_action', context=context)
423+ </field>
424+ </record>
425+
426+ <record id="open_product_tender_tree" model="ir.values">
427+ <field name="key2">client_action_relate</field>
428+ <field name="model">product.product</field>
429+ <field name="name">Tenders</field>
430+ <field name="value" eval="'ir.actions.server,%d'%action_product_tender_tree"/>
431+ <field name="object" eval="True"/>
432+ <field name="sequence" eval="100005"/>
433+ </record>
434+
435+ <!-- IN -->
436+ <record id="action_product_in_tree" model="ir.actions.server">
437+ <field name="name">Incoming Shipments</field>
438+ <field name="model_id" ref="product.model_product_product"/>
439+ <field name="state">code</field>
440+ <field name="code">
441+action = self.view_docs_with_product(cr, uid, ids, menu_action='stock.action_picking_tree4', context=context)
442+ </field>
443+ </record>
444+
445+ <record id="open_product_in_tree" model="ir.values">
446+ <field name="key2">client_action_relate</field>
447+ <field name="model">product.product</field>
448+ <field name="name">Incoming Shipments</field>
449+ <field name="value" eval="'ir.actions.server,%d'%action_product_in_tree"/>
450+ <field name="object" eval="True"/>
451+ <field name="sequence" eval="100006"/>
452+ </record>
453+
454+ <!-- INT -->
455+ <record id="action_product_int_tree" model="ir.actions.server">
456+ <field name="name">Internal Moves</field>
457+ <field name="model_id" ref="product.model_product_product"/>
458+ <field name="state">code</field>
459+ <field name="code">
460+action = self.view_docs_with_product(cr, uid, ids, menu_action='stock.action_picking_tree6', context=context)
461+ </field>
462+ </record>
463+
464+ <record id="open_product_int_tree" model="ir.values">
465+ <field name="key2">client_action_relate</field>
466+ <field name="model">product.product</field>
467+ <field name="name">Internal Moves</field>
468+ <field name="value" eval="'ir.actions.server,%d'%action_product_int_tree"/>
469+ <field name="object" eval="True"/>
470+ <field name="sequence" eval="100007"/>
471+ </record>
472+
473+ <!-- OUT -->
474+ <record id="action_product_out_tree" model="ir.actions.server">
475+ <field name="name">Delivery Orders</field>
476+ <field name="model_id" ref="product.model_product_product"/>
477+ <field name="state">code</field>
478+ <field name="code">
479+action = self.view_docs_with_product(cr, uid, ids, menu_action='stock.action_picking_tree', context=context)
480+ </field>
481+ </record>
482+
483+ <record id="open_product_out_tree" model="ir.values">
484+ <field name="key2">client_action_relate</field>
485+ <field name="model">product.product</field>
486+ <field name="name">Delivery Orders</field>
487+ <field name="value" eval="'ir.actions.server,%d'%action_product_out_tree"/>
488+ <field name="object" eval="True"/>
489+ <field name="sequence" eval="100008"/>
490+ </record>
491+
492+ <!-- Pick -->
493+ <record id="action_product_pick_tree" model="ir.actions.server">
494+ <field name="name">Pickings</field>
495+ <field name="model_id" ref="product.model_product_product"/>
496+ <field name="state">code</field>
497+ <field name="code">
498+action = self.view_docs_with_product(cr, uid, ids, menu_action='msf_outgoing.action_picking_ticket', context=context)
499+ </field>
500+ </record>
501+
502+ <record id="open_product_pick_tree" model="ir.values">
503+ <field name="key2">client_action_relate</field>
504+ <field name="model">product.product</field>
505+ <field name="name">Pickings</field>
506+ <field name="value" eval="'ir.actions.server,%d'%action_product_pick_tree"/>
507+ <field name="object" eval="True"/>
508+ <field name="sequence" eval="100009"/>
509+ </record>
510+
511+ <!-- PPL -->
512+ <record id="action_product_pack_tree" model="ir.actions.server">
513+ <field name="name">Packings</field>
514+ <field name="model_id" ref="product.model_product_product"/>
515+ <field name="state">code</field>
516+ <field name="code">
517+action = self.view_docs_with_product(cr, uid, ids, menu_action='msf_outgoing.action_ppl', context=context)
518+ </field>
519+ </record>
520+
521+ <record id="open_product_pack_tree" model="ir.values">
522+ <field name="key2">client_action_relate</field>
523+ <field name="model">product.product</field>
524+ <field name="name">Packings</field>
525+ <field name="value" eval="'ir.actions.server,%d'%action_product_pack_tree"/>
526+ <field name="object" eval="True"/>
527+ <field name="sequence" eval="100010"/>
528+ </record>
529
530 <!-- Add a link to see all inactivated products -->
531 <act_window
532
533=== modified file 'bin/addons/purchase/purchase_order.py'
534--- bin/addons/purchase/purchase_order.py 2022-03-22 09:01:13 +0000
535+++ bin/addons/purchase/purchase_order.py 2022-07-13 15:38:28 +0000
536@@ -54,9 +54,12 @@
537 '''
538 new_dom = []
539 dest_partner_names = False
540+ product_id = False
541 for x in domain:
542 if x[0] == 'dest_partner_names':
543 dest_partner_names = x[2]
544+ elif x[0] == 'product_id':
545+ product_id = x[2]
546 else:
547 new_dom.append(x)
548
549@@ -72,6 +75,12 @@
550 ret.where_clause.append(' "res_partner"."name" ilike %s ')
551 ret.where_clause_params.append('%%%s%%'%dest_partner_names)
552 ret.having_group_by = ' GROUP BY "purchase_order"."id" '
553+ if product_id and isinstance(product_id, int):
554+ ret.tables.append('"purchase_order_line"')
555+ ret.joins.setdefault('"purchase_order"', [])
556+ ret.joins['"purchase_order"'] += [('"purchase_order_line"', 'id', 'order_id', 'LEFT JOIN')]
557+ ret.where_clause.append(''' "purchase_order_line"."product_id" = %s ''')
558+ ret.where_clause_params.append(product_id)
559 return ret
560
561 def _amount_all(self, cr, uid, ids, field_name, arg, context=None):
562@@ -708,9 +717,13 @@
563
564 def _get_fake(self, cr, uid, ids, name, arg, context=None):
565 """
566- Fake method for 'has_confirmed_line' field
567+ Fake method for 'has_confirmed_line', 'has_confirmed_or_further_line' and 'product_id' fields
568 """
569 res = {}
570+ if not ids:
571+ return res
572+ if isinstance(ids, (int, long)):
573+ ids = [ids]
574 for po_id in ids:
575 res[po_id] = False
576 return res
577@@ -806,7 +819,6 @@
578
579 return ret
580
581-
582 _columns = {
583 'order_type': fields.selection(ORDER_TYPES_SELECTION, string='Order Type', required=True),
584 'loan_id': fields.many2one('sale.order', string='Linked loan', readonly=True),
585@@ -841,7 +853,7 @@
586 'unallocation_ok': fields.boolean(string='Unallocated PO'),
587 'partner_ref': fields.char('Supplier Reference', size=128),
588 'short_partner_ref': fields.function(_get_short_partner_ref, method=True, string='Supplier Reference', type='char', size=64, store=False),
589- 'product_id': fields.related('order_line', 'product_id', type='many2one', relation='product.product', string='Product'),
590+ 'product_id': fields.function(_get_fake, method=True, type='many2one', relation='product.product', string='Product', help='Product to find in the lines', store=False, readonly=True),
591 'no_line': fields.function(_get_no_line, method=True, type='boolean', string='No line'),
592 'active': fields.boolean('Active', readonly=True),
593 'po_from_ir': fields.function(_po_from_x, method=True, type='boolean', string='Is PO from IR ?', multi='po_from_x'),
594
595=== modified file 'bin/addons/purchase/purchase_view.xml'
596--- bin/addons/purchase/purchase_view.xml 2022-06-14 11:28:55 +0000
597+++ bin/addons/purchase/purchase_view.xml 2022-07-13 15:38:28 +0000
598@@ -1015,12 +1015,6 @@
599 </field>
600 </record>
601
602-
603- <act_window context="{}"
604- domain="[('rfq_ok', '=', False), ('product_id', '=', active_id)]"
605- id="purchase.action_purchase_line_product_tree2" name="Purchases"
606- res_model="purchase.order" src_model="product.product" groups=""/>
607-
608 <record id="purchase_line_form_action2" model="ir.actions.act_window">
609 <field name="name">Purchase Lines Not Invoiced</field>
610 <field name="type">ir.actions.act_window</field>
611
612=== modified file 'bin/addons/reason_types_moves/reason_type_view.xml'
613--- bin/addons/reason_types_moves/reason_type_view.xml 2020-02-06 15:20:20 +0000
614+++ bin/addons/reason_types_moves/reason_type_view.xml 2022-07-13 15:38:28 +0000
615@@ -196,6 +196,7 @@
616 <newline />
617 <field name="date" />
618 <field name="min_date" />
619+ <field name="product_id" />
620 </xpath>
621 <xpath expr="/search//field[@name='company_id']" position="replace" />
622 <xpath expr="/search//filter[@name='done']" position="attributes">
623
624=== modified file 'bin/addons/reason_types_moves/stock_view.xml'
625--- bin/addons/reason_types_moves/stock_view.xml 2021-12-20 15:55:25 +0000
626+++ bin/addons/reason_types_moves/stock_view.xml 2022-07-13 15:38:28 +0000
627@@ -157,6 +157,7 @@
628 <field name="date" string="Creation date" />
629 <field name="min_date" string="Expected date" />
630 <field name="shipment_ref" />
631+ <field name="product_id" />
632 </group>
633 <newline/>
634 <group expand="0" string="Group By..." colspan="4" col="8">
635
636=== modified file 'bin/addons/sale/sale_order.py'
637--- bin/addons/sale/sale_order.py 2022-06-20 12:17:27 +0000
638+++ bin/addons/sale/sale_order.py 2022-07-13 15:38:28 +0000
639@@ -61,6 +61,27 @@
640 _name = "sale.order"
641 _description = "Sales Order"
642
643+ def _where_calc(self, cr, uid, domain, active_test=True, context=None):
644+ '''
645+ overwrite to allow search on customer and self instance
646+ '''
647+ new_dom = []
648+ product_id = False
649+ for x in domain:
650+ if x[0] == 'product_id':
651+ product_id = x[2]
652+ else:
653+ new_dom.append(x)
654+
655+ ret = super(sale_order, self)._where_calc(cr, uid, new_dom, active_test=active_test, context=context)
656+ if product_id and isinstance(product_id, int):
657+ ret.tables.append('"sale_order_line"')
658+ ret.joins.setdefault('"sale_order"', [])
659+ ret.joins['"sale_order"'] += [('"sale_order_line"', 'id', 'order_id', 'LEFT JOIN')]
660+ ret.where_clause.append(''' "sale_order_line"."product_id" = %s ''')
661+ ret.where_clause_params.append(product_id)
662+ return ret
663+
664 def copy(self, cr, uid, id, default=None, context=None):
665 """
666 Copy the sale.order. When copy the sale.order:
667@@ -598,6 +619,19 @@
668
669 return ret
670
671+ def _get_fake(self, cr, uid, ids, name, args, context=None):
672+ '''
673+ Fake method for 'product_id' field
674+ '''
675+ res = {}
676+ if not ids:
677+ return res
678+ if isinstance(ids, (int, long)):
679+ ids = [ids]
680+ for id in ids:
681+ res[id] = False
682+ return res
683+
684 _columns = {
685 'name': fields.char('Order Reference', size=64, required=True, readonly=True, states={'draft': [('readonly', False)]}, select=True, sort_column='id'),
686 'origin': fields.char('Source Document', size=512, help="Reference of the document that generated this sales order request."),
687@@ -694,7 +728,7 @@
688 'split_type_sale_order': fields.selection(SALE_ORDER_SPLIT_SELECTION, required=True, readonly=True, internal=1),
689 'original_so_id_sale_order': fields.many2one('sale.order', 'Original Field Order', readonly=True),
690 'active': fields.boolean('Active', readonly=True),
691- 'product_id': fields.related('order_line', 'product_id', type='many2one', relation='product.product', string='Product'),
692+ 'product_id': fields.function(_get_fake, method=True, type='many2one', relation='product.product', string='Product', help='Product to find in the lines', store=False, readonly=True),
693 'no_line': fields.function(_get_no_line, method=True, type='boolean', string='No line'),
694 'manually_corrected': fields.function(_get_manually_corrected, method=True, type='boolean', string='Manually corrected'),
695 'is_a_counterpart': fields.boolean('Counterpart?', help="This field is only for indicating that the order is a counterpart"),
696
697=== modified file 'bin/addons/sale/sale_view.xml'
698--- bin/addons/sale/sale_view.xml 2022-05-17 14:21:03 +0000
699+++ bin/addons/sale/sale_view.xml 2022-07-13 15:38:28 +0000
700@@ -504,6 +504,8 @@
701 <filter domain="[('user_id','=',uid)]" help="My Sale Orders" icon="terp-personal"/>
702 </field>
703 <newline />
704+ <field name="product_id" />
705+ <newline />
706 <group string="Type" expand="0">
707 <filter icon="terp-check" string="Regular" domain="[('order_type','=','regular')]"/>
708 <filter icon="terp-stage" string="Donation before expiry" domain="[('order_type','=','donation_exp')]"/>
709
710=== modified file 'bin/addons/stock/stock.py'
711--- bin/addons/stock/stock.py 2022-05-02 15:04:12 +0000
712+++ bin/addons/stock/stock.py 2022-07-13 15:38:28 +0000
713@@ -746,6 +746,27 @@
714 _name = "stock.picking"
715 _description = "Picking List"
716
717+ def _where_calc(self, cr, uid, domain, active_test=True, context=None):
718+ '''
719+ overwrite to allow search on customer and self instance
720+ '''
721+ new_dom = []
722+ product_id = False
723+ for x in domain:
724+ if x[0] == 'product_id':
725+ product_id = x[2]
726+ else:
727+ new_dom.append(x)
728+
729+ ret = super(stock_picking, self)._where_calc(cr, uid, new_dom, active_test=active_test, context=context)
730+ if product_id and isinstance(product_id, int):
731+ ret.tables.append('"stock_move"')
732+ ret.joins.setdefault('"stock_picking"', [])
733+ ret.joins['"stock_picking"'] += [('"stock_move"', 'id', 'picking_id', 'LEFT JOIN')]
734+ ret.where_clause.append(''' "stock_move"."product_id" = %s ''')
735+ ret.where_clause_params.append(product_id)
736+ return ret
737+
738 def _set_maximum_date(self, cr, uid, ids, name, value, arg, context=None):
739 """ Calculates planned date if it is greater than 'value'.
740 @param name: Name of field
741@@ -893,6 +914,19 @@
742
743 return res
744
745+ def _get_fake(self, cr, uid, ids, name, args, context=None):
746+ '''
747+ Fake method for 'product_id' field
748+ '''
749+ res = {}
750+ if not ids:
751+ return res
752+ if isinstance(ids, (int, long)):
753+ ids = [ids]
754+ for id in ids:
755+ res[id] = False
756+ return res
757+
758 _columns = {
759 'object_name': fields.function(_get_object_name, type='char', method=True, string='Title'),
760 'name': fields.char('Reference', size=64, select=True),
761@@ -952,6 +986,7 @@
762 'customers': fields.char('Customers', size=1026),
763 'customer_ref': fields.char('Customer Ref.', size=1026),
764 'sync_dpo_in': fields.boolean('Synced IN for DPO reception', internal=1, help='Used to flag a IN linked to a DPO'),
765+ 'product_id': fields.function(_get_fake, method=True, type='many2one', relation='product.product', string='Product', help='Product to find in the lines', store=False, readonly=True),
766 }
767
768 _defaults = {
769
770=== modified file 'bin/addons/stock/stock_view.xml'
771--- bin/addons/stock/stock_view.xml 2021-11-17 15:46:45 +0000
772+++ bin/addons/stock/stock_view.xml 2022-07-13 15:38:28 +0000
773@@ -1003,6 +1003,7 @@
774 <field name="origin"/>
775 <field name="stock_journal_id" groups="base.group_extended" widget="selection"/>
776 <field name="company_id" widget="selection"/>
777+ <field name="product_id"/>
778 </group>
779 <newline/>
780 <group expand="0" string="Group By..." colspan="4" col="8">
781
782=== modified file 'bin/addons/tender_flow/tender_flow.py'
783--- bin/addons/tender_flow/tender_flow.py 2022-03-21 12:41:58 +0000
784+++ bin/addons/tender_flow/tender_flow.py 2022-07-13 15:38:28 +0000
785@@ -41,6 +41,27 @@
786 _description = 'Tender'
787 _trace = True
788
789+ def _where_calc(self, cr, uid, domain, active_test=True, context=None):
790+ '''
791+ overwrite to allow search on customer and self instance
792+ '''
793+ new_dom = []
794+ product_id = False
795+ for x in domain:
796+ if x[0] == 'product_id':
797+ product_id = x[2]
798+ else:
799+ new_dom.append(x)
800+
801+ ret = super(tender, self)._where_calc(cr, uid, new_dom, active_test=active_test, context=context)
802+ if product_id and isinstance(product_id, int):
803+ ret.tables.append('"tender_line"')
804+ ret.joins.setdefault('"tender"', [])
805+ ret.joins['"tender"'] += [('"tender_line"', 'id', 'tender_id', 'LEFT JOIN')]
806+ ret.where_clause.append(''' "tender_line"."product_id" = %s ''')
807+ ret.where_clause_params.append(product_id)
808+ return ret
809+
810 def copy(self, cr, uid, id, default=None, context=None, done_list=[], local=False):
811 if not default:
812 default = {}
813@@ -116,6 +137,19 @@
814 res[tender.id] = diff_number
815 return res
816
817+ def _get_fake(self, cr, uid, ids, name, args, context=None):
818+ '''
819+ Fake method for 'product_id' field
820+ '''
821+ res = {}
822+ if not ids:
823+ return res
824+ if isinstance(ids, (int, long)):
825+ ids = [ids]
826+ for id in ids:
827+ res[id] = False
828+ return res
829+
830 _columns = {
831 'name': fields.char('Tender Reference', size=64, required=True, select=True, readonly=True, sort_column='id'),
832 'sale_order_id': fields.many2one('sale.order', string="Sale Order", readonly=True),
833@@ -136,7 +170,7 @@
834 'notes': fields.text('Notes'),
835 'internal_state': fields.selection([('draft', 'Draft'), ('updated', 'Rfq Updated'), ], string="Internal State", readonly=True),
836 'rfq_name_list': fields.function(_vals_get, method=True, string='RfQs Ref', type='char', readonly=True, store=False, multi='get_vals',),
837- 'product_id': fields.related('tender_line_ids', 'product_id', type='many2one', relation='product.product', string='Product'),
838+ 'product_id': fields.function(_get_fake, method=True, type='many2one', relation='product.product', string='Product', help='Product to find in the lines', store=False, readonly=True),
839 'delivery_address': fields.many2one('res.partner.address', string='Delivery address', required=True),
840 'tender_from_fo': fields.function(_is_tender_from_fo, method=True, type='boolean', string='Is tender from FO ?',),
841 'diff_nb_rfq_supplier': fields.function(_diff_nb_rfq_supplier, method=True, type="boolean", string="Compare the number of rfqs and the number of suppliers", store=False),
842
843=== modified file 'bin/addons/tender_flow/tender_flow_view.xml'
844--- bin/addons/tender_flow/tender_flow_view.xml 2020-05-06 12:28:03 +0000
845+++ bin/addons/tender_flow/tender_flow_view.xml 2022-07-13 15:38:28 +0000
846@@ -136,7 +136,7 @@
847 domain="[('state', '=', 'cancel')]" />
848 <field name="name" />
849 <field name="supplier_ids" string="Supplier" widget="many2one" />
850- <field name="product_id" string="Product" widget="many2one" />
851+ <field name="product_id" />
852 <field name="sale_order_id" string="Sale Order" />
853 <field name="creator" />
854 <field name="creation_date" />
855
856=== modified file 'bin/import_xml.rng'
857--- bin/import_xml.rng 2021-10-12 15:17:17 +0000
858+++ bin/import_xml.rng 2022-07-13 15:38:28 +0000
859@@ -214,6 +214,7 @@
860 <rng:optional> <rng:attribute name="empty_ids"/> </rng:optional>
861 <rng:optional> <rng:attribute name="auto_refresh"/> </rng:optional>
862 <rng:optional> <rng:attribute name="search_view_id"/> </rng:optional>
863+ <rng:optional> <rng:attribute name="sequence"/> </rng:optional>
864 <rng:empty />
865 </rng:element>
866 </rng:define>
867
868=== modified file 'bin/tools/convert.py'
869--- bin/tools/convert.py 2021-10-12 15:17:17 +0000
870+++ bin/tools/convert.py 2022-07-13 15:38:28 +0000
871@@ -537,7 +537,7 @@
872 if rec.get('view_ids'):
873 for x in rec.get('view_ids').split(','):
874 linked_views.append(self.id_get(cr,x))
875- self.pool.get('ir.model.data').ir_set(cr, self.uid, 'action', keyword, xml_id, [src_model], value, replace=replace, isobject=True, xml_id=xml_id, view_ids=linked_views)
876+ self.pool.get('ir.model.data').ir_set(cr, self.uid, 'action', keyword, xml_id, [src_model], value, replace=replace, isobject=True, xml_id=xml_id, view_ids=linked_views, sequence=rec.get('sequence', 100))
877 # TODO add remove ir.model.data
878
879 def _tag_ir_set(self, cr, rec, data_node=None):

Subscribers

People subscribed via source and target branches