Merge lp:~therp-nl/ocb-addons/7.0-fix_conflict_rev_9651 into lp:ocb-addons

Proposed by Holger Brunn (Therp)
Status: Merged
Merge reported by: Ronald Portier (Therp)
Merged at revision: not available
Proposed branch: lp:~therp-nl/ocb-addons/7.0-fix_conflict_rev_9651
Merge into: lp:ocb-addons
Diff against target: 198 lines (+102/-33)
3 files modified
procurement/schedulers.py (+0/-1)
purchase/purchase.py (+40/-9)
purchase_requisition/purchase_requisition.py (+62/-23)
To merge this branch: bzr merge lp:~therp-nl/ocb-addons/7.0-fix_conflict_rev_9651
Reviewer Review Type Date Requested Status
Pedro Manuel Baeza code review Approve
Alexandre Fayolle - camptocamp code review, no test Approve
Stefan Rijnhart (Opener) Approve
Review via email: mp+197171@code.launchpad.net

Description of the change

This branch fixes conflicts with commit
http://bazaar.launchpad.net/~openerp/openobject-addons/7.0/revision/9651

The conflicts were introduced by
http://bazaar.launchpad.net/~ocb/ocb-addons/7.0/revision/9628

There's a runbot instance on
http://conflict-rev-9651-25732.runbot.openerp.com/?

What the code does now: I preserved Christophe Chauvet's code (the ocb part) for using reordering rules if applicable, but if not, I use Christophe Simonis' code (the upstream part) looking for warehouses in the location hierarchy.

This way, it seems we get the best of both proposals.

I'm btw just as unhappy as you about the signature of _get_warehouse, but I think we shouldn't change API signatures, even if newly introduced.

Please review fast as this conflict stalls the merge process for ocb-addons.

To post a comment you must log in.
Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote :

Thanks for picking this up! BTW it's not Christophe Chauvet's code but an OPW branch by Rifakat that you backported yourself ;-) Christophe only committed the change.

review: Approve
Revision history for this message
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) wrote :

LGTM

Thanks for keeping an eye on this (and for the heads up)

review: Approve (code review, no test)
9729. By Guewen Baconnier @ Camptocamp

[FIX] make the fields required for all type='contract' and type='template'

9730. By Lorenzo Battistini

[FIX] These changes set the correct account type to view accounts

9731. By Stefan Rijnhart (Opener)

[RVT] Reverting OCB-specific email setting defaults linked to lp:1163832

9732. By Pedro Manuel Baeza

[FIX] mrp: mrp.bom multi-company rule

Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

Seems OK, but a little ugly, as Holger have said. We'll wait for better times on trunk...

Regards.

review: Approve (code review)
9733. By kbh at tinyerp

[FIX]sale_stock:property_ids added

9734. By Holger Brunn (Therp)

[MERGE] Resolve conflict in purchase and purchase_requirement between
    ocb-addons and openobject-addons.

9749. By Martin Trigaux (OpenERP)

[FIX] purchase: revert revision 7677 to set a default unit of measure to 'Unit'
This allows to field a purchase.order without showing the units of measure if not product is selected
Revision 7677 was integrated to fix lp:958897 (no change of uom when selecting a product whose uom is in the category 'Units'). This fix did not solve it properly (only for initial value) and introduced another problem. A better fix will be done on the onchange product.

9750. By Denis Ledoux (OpenERP)

[FIX] {account, sale_stock}: res_config: set_default as SUPERUSER_ID. check user group to avoid passthrough access rights security

9751. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

9752. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

9753. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

9754. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

9755. By Denis Ledoux (OpenERP)

[FIX]portal_sale: add the lang to the email templates (sale.order and account.invoice), for the email to be translated in the customer language (as this is the case for regular email templates from sale and account modules-

9756. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

9757. By Denis Ledoux (OpenERP)

[FIX] sale_crm: wizard crm_make_sale crash if partner_id not sent on the opp.

Because defaults get function of partner_id of wizard read the partner_id of the opp and return the first item of the tuple, but if there isnt a partner on the opp, the read return a false for this field, not a tuple.
No return the first item of the tuple if the partner_id is set, else False

9758. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

9759. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

9760. By Denis Ledoux (OpenERP)

[FIX] sale_stock,stock: change model to stock.picking.out of deliveries to invoice view in sales

Deliveries to invoice in sales menu should display delivery order only (no incoming shipment). This was already the case thanks to the domain [('type','=','out')], but since the refactor of the module stock, and the division of stock.picking to stock.picking.in and stock.picking.out, the model of this view should be stock.picking.out instead of stock.picking (for instance, to get the actions binding (ir.values) of stock.picking.out model).
+ typo fix in action binding

9761. By Denis Ledoux (OpenERP)

[FIX] purchase: warning uom category different only if the changed field is product_uom itself.

Changing product_id with a different unit category does not trigger the uom category change warning

9762. By Martin Trigaux (OpenERP)

[MERGE] [FIX] account: performance improvement on account.analytic.lines
don't create new analytic lines at move creation, will do it once the move is balanced
don't remove analytic lines (to avoid duplicates) at the begining of the validation of a move, will do it once we create the new correct analytic lines (opw 597719)

9763. By Martin Trigaux (OpenERP)

[FIX] account: correct name_search on account to be validated even at negation
added test checking every combinaison of name_search

9764. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

9765. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

9766. By Thibault Delavallée (OpenERP)

[MERGE] [FIX] mail: fixed message_follower_ids function field.

The set method of the field, set_followers, is now using message_subscribe and message_unsubscribe to have only one access point to adding or removing followers. Previously to this fix it was directly creating entries in the mail_followers table, neglecting the calculation of subtypes and default subtypes.

9767. By Denis Ledoux (OpenERP)

[FIX] point_of_sale: ignore TOTAlY returns

Returns were partially ignored when typing keystrokes, thanks to a return; when event which equaled 13, but the default behaviour (press on the focused input/button) was not prevented. This is now the case thanks to preventDefault. For instance, just after a discount set, the focused input was pressed and the associated value was added when scanning a new product with the scanner. Therefore, if we entered a discount of 30%, scanning a new product added '0', the last pushed button, to the discount, and then added the product.

9768. By Xavier ALT

[FIX] crm: use email widget for email_from field in Opportunities form view

9769. By Denis Ledoux (OpenERP)

[FIX] stock: incoming shipment supplier quick create was creating a customer instead of a supplier

9770. By Denis Ledoux (OpenERP)

[FIX] purchase: set readonly on warehouse_id related field in stock.picking.in

9771. By Christophe Simonis (OpenERP)

[MERGE] annoucement bar

9772. By Denis Ledoux (OpenERP)

[FIX] point_of_sale: fix default destination(or source, for returns) location for pos order moves

For instance, the source location of moves of returned products was output instead of partners locations / customers

9773. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

9774. By Denis Ledoux (OpenERP)

[FIX] mrp: cost structure report, do not display twice main supplier

9775. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

9776. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

9777. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

9778. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

9779. By Denis Ledoux (OpenERP)

[FIX] account_analytic_analysis: is_overdue_quantity was not updated when quantity max was changed

is_overdue_quantity is a stored function field which was updated only when analytic lines where updated. Or, when the quantity_max field is updated, this field should be recomputed and restored. This is now the case

9780. By Xavier ALT

[FIX] document: duplicate directory detection should work even when a record rule prevent user from seeing duplicates

9781. By Olivier Dony (Odoo)

[FIX] base_action_rule: upon update/create of an automated action in multiprocess mode, force registry reload

Short of signaling the other workers, the (new) automated
rule may be randomly ignored, depending on which worker
handles the request (until the workers all reload
their registries).

9782. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

9783. By Olivier Dony (Odoo)

[FIX] project_mrp: local copy of the "Procurement" process node to avoid errors during updates when sale_stock is not installed

The various attempts to fix this error without duplicating the node
have all caused other errors. Having a duplicate process node has
no consequence on business operations, so it is an acceptable
workaround until the node can be moved to the sale module.

9784. By Denis Ledoux (OpenERP)

[FIX]sale_crm: quotation/sale order default section_id based on res_users default_section_id

9785. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

9786. By Martin Trigaux (OpenERP)

[MERGE] [IMP] account_payment: remove widget=selection (was forcing the preloading of every partner for an invisible field)

9787. By Xavier ALT

[FIX] hr_holidays, hr_timesheet: fix XMLSyntaxError when company name contain an ampersand '&' sign

9788. By Xavier ALT

[FIX] l10n_be: fix no value in 'Code (Tax Code)' column on 'Print VAT Intra' preview report

9789. By Xavier ALT

[FIX] project: fix error on ``schedule_tasks`` when there is no resource available on project

9790. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

9791. By Xavier ALT

[FIX] document: on report.document.user view, use correct field type for ``user_id`` field.

9792. By Xavier ALT

[FIX] purchase: remove duplicate 'Warehouse' and 'Reference UOM' groupby filter in Purchase Analysis search view

9793. By Xavier ALT

[FIX] project: fix task progress not correctly updated when reopening a task

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'procurement/schedulers.py'
2--- procurement/schedulers.py 2013-11-12 13:06:12 +0000
3+++ procurement/schedulers.py 2013-11-29 11:11:54 +0000
4@@ -197,7 +197,6 @@
5 'company_id': orderpoint.company_id.id,
6 'product_uom': orderpoint.product_uom.id,
7 'location_id': orderpoint.location_id.id,
8- 'warehouse_id': orderpoint.warehouse_id.id,
9 'procure_method': 'make_to_order',
10 'origin': orderpoint.name}
11
12
13=== modified file 'purchase/purchase.py'
14--- purchase/purchase.py 2013-11-27 08:46:25 +0000
15+++ purchase/purchase.py 2013-11-29 11:11:54 +0000
16@@ -1117,6 +1117,45 @@
17 seller_delay = int(procurement.product_id.seller_delay)
18 return schedule_date - relativedelta(days=seller_delay)
19
20+ def _get_warehouse(self, procurement, user_company):
21+ """
22+ Return the warehouse containing the procurment stock location (or one of it ancestors)
23+ If none match, returns then first warehouse of the company
24+ """
25+ # TODO refactor the domain once we implement the "parent_of" domain operator
26+ # NOTE This method has been copied in the `purchase_requisition` module to ensure
27+ # retro-compatibility. This code duplication will be deleted in next stable version.
28+ # Do not forget to update both version in case of modification.
29+ Orderpoint = self.pool['stock.warehouse.orderpoint']
30+ ids = Orderpoint.search(
31+ procurement._cr, procurement._uid,
32+ [('procurement_id','=', procurement.id)],
33+ context=procurement._context)
34+ if ids:
35+ return Orderpoint.browse(
36+ procurement._cr, procurement._uid, ids[0],
37+ context=procurement._context).warehouse_id.id
38+
39+ company_id = (procurement.company_id or user_company).id
40+ domains = [
41+ [
42+ '&', ('company_id', '=', company_id),
43+ '|', '&', ('lot_stock_id.parent_left', '<', procurement.location_id.parent_left),
44+ ('lot_stock_id.parent_right', '>', procurement.location_id.parent_right),
45+ ('lot_stock_id', '=', procurement.location_id.id)
46+ ],
47+ [('company_id', '=', company_id)]
48+ ]
49+
50+ cr, uid = procurement._cr, procurement._uid
51+ context = procurement._context
52+ Warehouse = self.pool['stock.warehouse']
53+ for domain in domains:
54+ ids = Warehouse.search(cr, uid, domain, context=context)
55+ if ids:
56+ return ids[0]
57+ return False
58+
59 def make_po(self, cr, uid, ids, context=None):
60 """ Make purchase order from procurement
61 @return: New created Purchase Orders procurement wise
62@@ -1131,8 +1170,6 @@
63 prod_obj = self.pool.get('product.product')
64 acc_pos_obj = self.pool.get('account.fiscal.position')
65 seq_obj = self.pool.get('ir.sequence')
66- warehouse_obj = self.pool.get('stock.warehouse')
67- orderpoint_obj = self.pool.get('stock.warehouse.orderpoint')
68 for procurement in self.browse(cr, uid, ids, context=context):
69 res_id = procurement.move_id.id
70 partner = procurement.product_id.seller_id # Taken Main Supplier of Product of Procurement.
71@@ -1140,12 +1177,6 @@
72 partner_id = partner.id
73 address_id = partner_obj.address_get(cr, uid, [partner_id], ['delivery'])['delivery']
74 pricelist_id = partner.property_product_pricelist_purchase.id
75- order_point_ids = orderpoint_obj.search(cr, uid, [('procurement_id','=', procurement.id)], context=context)
76- if order_point_ids:
77- warehouse_id = orderpoint_obj.browse(cr, uid, order_point_ids[0], context=context).warehouse_id.id
78- else:
79- warehouse_ids = warehouse_obj.search(cr, uid, [('lot_input_id', '=', procurement.location_id.id)], context=context)
80- warehouse_id = warehouse_ids and warehouse_ids[0] or False
81 uom_id = procurement.product_id.uom_po_id.id
82
83 qty = uom_obj._compute_qty(cr, uid, procurement.product_uom.id, procurement.product_qty, uom_id)
84@@ -1184,7 +1215,7 @@
85 'origin': procurement.origin,
86 'partner_id': partner_id,
87 'location_id': procurement.location_id.id,
88- 'warehouse_id': warehouse_id,
89+ 'warehouse_id': self._get_warehouse(procurement, company),
90 'pricelist_id': pricelist_id,
91 'date_order': purchase_date.strftime(DEFAULT_SERVER_DATETIME_FORMAT),
92 'company_id': procurement.company_id.id,
93
94=== modified file 'purchase_requisition/purchase_requisition.py'
95--- purchase_requisition/purchase_requisition.py 2013-09-05 10:09:56 +0000
96+++ purchase_requisition/purchase_requisition.py 2013-11-29 11:11:54 +0000
97@@ -262,40 +262,79 @@
98 product_product()
99
100 class procurement_order(osv.osv):
101-
102 _inherit = 'procurement.order'
103 _columns = {
104- 'requisition_id' : fields.many2one('purchase.requisition','Latest Requisition')
105+ 'requisition_id': fields.many2one('purchase.requisition', 'Latest Requisition')
106 }
107+
108+ def _get_warehouse(self, procurement, user_company):
109+ """
110+ Return the warehouse containing the procurment stock location (or one of it ancestors)
111+ If none match, returns then first warehouse of the company
112+ """
113+ # NOTE This method is a copy of the one on the procurement.order defined in purchase
114+ # module. It's been copied to ensure it been always available, even if module
115+ # purchase is not up to date.
116+ # Do not forget to update both version in case of modification.
117+ Orderpoint = self.pool['stock.warehouse.orderpoint']
118+ ids = Orderpoint.search(
119+ procurement._cr, procurement._uid,
120+ [('procurement_id','=', procurement.id)],
121+ context=procurement._context)
122+ if ids:
123+ return Orderpoint.browse(
124+ procurement._cr, procurement._uid, ids[0],
125+ context=procurement._context).warehouse_id.id
126+
127+ company_id = (procurement.company_id or user_company).id
128+ domains = [
129+ [
130+ '&', ('company_id', '=', company_id),
131+ '|', '&', ('lot_stock_id.parent_left', '<', procurement.location_id.parent_left),
132+ ('lot_stock_id.parent_right', '>', procurement.location_id.parent_right),
133+ ('lot_stock_id', '=', procurement.location_id.id)
134+ ],
135+ [('company_id', '=', company_id)]
136+ ]
137+
138+ cr, uid = procurement._cr, procurement._uid
139+ context = procurement._context
140+ Warehouse = self.pool['stock.warehouse']
141+ for domain in domains:
142+ ids = Warehouse.search(cr, uid, domain, context=context)
143+ if ids:
144+ return ids[0]
145+ return False
146+
147 def make_po(self, cr, uid, ids, context=None):
148 res = {}
149 requisition_obj = self.pool.get('purchase.requisition')
150- warehouse_obj = self.pool.get('stock.warehouse')
151- orderpoint_obj = self.pool.get('stock.warehouse.orderpoint')
152- procurement = self.browse(cr, uid, ids, context=context)[0]
153- if procurement.product_id.purchase_requisition:
154- order_point_ids = orderpoint_obj.search(cr, uid, [('procurement_id','=', procurement.id)], context=context)
155- if order_point_ids:
156- warehouse_id = orderpoint_obj.browse(cr, uid, order_point_ids[0], context=context).warehouse_id.id
157- else:
158- warehouse_ids = warehouse_obj.search(cr, uid, [('lot_input_id', '=', procurement.location_id.id)], context=context)
159- warehouse_id = warehouse_ids and warehouse_ids[0] or False
160- res[procurement.id] = requisition_obj.create(cr, uid,
161- {
162+ non_requisition = []
163+ for procurement in self.browse(cr, uid, ids, context=context):
164+ if procurement.product_id.purchase_requisition:
165+ user_company = self.pool['res.users'].browse(cr, uid, uid, context=context).company_id
166+ req = res[procurement.id] = requisition_obj.create(cr, uid, {
167 'origin': procurement.origin,
168 'date_end': procurement.date_planned,
169- 'warehouse_id': warehouse_id,
170- 'company_id':procurement.company_id.id,
171- 'line_ids': [(0,0,{
172+ 'warehouse_id': self._get_warehouse(procurement, user_company),
173+ 'company_id': procurement.company_id.id,
174+ 'line_ids': [(0, 0, {
175 'product_id': procurement.product_id.id,
176 'product_uom_id': procurement.product_uom.id,
177 'product_qty': procurement.product_qty
178-
179- })],
180- })
181- self.write(cr,uid,[procurement.id],{'state': 'running','requisition_id': res[procurement.id]},context=context)
182- return {}
183- return super(procurement_order, self).make_po(cr, uid, ids, context=context)
184+ })],
185+ })
186+ procurement.write({
187+ 'state': 'running',
188+ 'requisition_id': req
189+ })
190+ else:
191+ non_requisition.append(procurement.id)
192+
193+ if non_requisition:
194+ res.update(super(procurement_order, self).make_po(cr, uid, non_requisition, context=context))
195+
196+ return res
197
198 procurement_order()
199