Merge lp:~unifield-team/unifield-addons/addons-uf-1055-internal-request into lp:unifield-addons

Proposed by Matthieu Choplin
Status: Merged
Merged at revision: 4560
Proposed branch: lp:~unifield-team/unifield-addons/addons-uf-1055-internal-request
Merge into: lp:unifield-addons
Diff against target: 76 lines (+28/-8)
2 files modified
sale/sale.py (+26/-5)
stock/board_warehouse_view.xml (+2/-3)
To merge this branch: bzr merge lp:~unifield-team/unifield-addons/addons-uf-1055-internal-request
Reviewer Review Type Date Requested Status
UniField Dev Team Pending
Review via email: mp+116875@code.launchpad.net

Description of the change

This merge proposal is linked to the UF-1055 about internal request and also the branch https://code.launchpad.net/~unifield-team/unifield-wm/uf-1055.

As it affects different very important methods such as action_ship_create in sale/sale.py, with added hooks, it may be a critical change.

Please keep me update if some things seem awkward so that I will change the code.

To post a comment you must log in.
4553. By <email address hidden>

Merge

4554. By Duy VO

[uf-1055] merged with trunk

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'sale/sale.py'
2--- sale/sale.py 2012-08-10 09:01:42 +0000
3+++ sale/sale.py 2012-09-18 22:17:21 +0000
4@@ -739,6 +739,24 @@
5 result = line.product_id and line.product_id.product_tmpl_id.type in ('product', 'consu')
6 return result
7
8+ def _hook_ship_create_product_id(self, cr, uid, ids, context=None, *args, **kwargs):
9+ '''
10+ Please copy this to your module's method also.
11+ This hook belongs to the action_ship_create method from sale>sale.py
12+
13+ - allow to modifiy product especially for internal request which type is "make_to_order"
14+ '''
15+ pass
16+
17+ def _hook_ship_create_uom_id(self, cr, uid, ids, context=None, *args, **kwargs):
18+ '''
19+ Please copy this to your module's method also.
20+ This hook belongs to the action_ship_create method from sale>sale.py
21+
22+ - allow to modifiy uom especially for internal request which type is "make_to_order"
23+ '''
24+ pass
25+
26 def _hook_execute_action_assign(self, cr, uid, *args, **kwargs):
27 '''
28 Please copy this to your module's method also.
29@@ -811,17 +829,20 @@
30 # hook for stock move data modification
31 move_data = self._hook_ship_create_stock_move(cr, uid, ids, context=context, move_data=move_data, line=line, order=order,)
32 move_id = self.pool.get('stock.move').create(cr, uid, move_data, context=context)
33-
34 # customer code execution position 02
35 self._hook_ship_create_execute_specific_code_02(cr, uid, ids, context=context, order=order, line=line, move_id=move_id)
36-
37- if line.product_id and self._hook_procurement_create_line_condition(cr, uid, ids, context=context, line=line, order=order):
38+ # the hook _hook_ship_create_product_id is useful when we make an IR with the type "make_to_order" => we take a 'ghost' product because it is required in procurement and we do not have product
39+ product_id = self._hook_ship_create_product_id(cr, uid, ids, context=context, line=line)
40+ if product_id \
41+ and self._hook_procurement_create_line_condition(cr, uid, ids, context=context, line=line, order=order) :
42+ # the hook _hook_ship_create_uom_id is useful when we make an IR with the type "make_to_order"
43+ product_uom = self._hook_ship_create_uom_id(cr, uid, ids, context=context, line=line)
44 proc_data = {'name': line.name,
45 'origin': order.name,
46 'date_planned': date_planned,
47- 'product_id': line.product_id.id,
48+ 'product_id': product_id,
49 'product_qty': line.product_uom_qty,
50- 'product_uom': line.product_uom.id,
51+ 'product_uom': product_uom,
52 'product_uos_qty': (line.product_uos and line.product_uos_qty)\
53 or line.product_uom_qty,
54 'product_uos': (line.product_uos and line.product_uos.id)\
55
56=== modified file 'stock/board_warehouse_view.xml'
57--- stock/board_warehouse_view.xml 2011-01-14 00:11:01 +0000
58+++ stock/board_warehouse_view.xml 2012-09-18 22:17:21 +0000
59@@ -4,8 +4,7 @@
60 <record id="note_warehouse_type" model="board.note.type">
61 <field name="name">Warehouse</field>
62 </record>
63-
64-
65+
66 <record id="action_incoming_product_board" model="ir.actions.act_window">
67 <field name="name">Incoming Product</field>
68 <field name="res_model">stock.move</field>
69@@ -50,7 +49,7 @@
70 <form string="Warehouse board">
71 <hpaned position="200">
72 <child1>
73- <action colspan="4" name="%(action_incoming_product_board)d" string="Incoming Product" width="510"/>
74+ <action colspan="4" name="%(stock.action_incoming_product_board)d" string="Incoming Product" width="510"/>
75 <action colspan="4" name="%(action_outgoing_product_board)d" string="Outgoing Product" width="510"/>
76 </child1>
77

Subscribers

People subscribed via source and target branches

to all changes: