Skip to content

Commit

Permalink
[9.0][FIX] [purchase_request_to_rfq]
Browse files Browse the repository at this point in the history
* Respect 'Requested day' when converting to PO lines.
* Correct README.
  • Loading branch information
LoisRForgeFlow committed Apr 3, 2017
1 parent 82b5ef6 commit 1458c34
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion purchase_request_procurement/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Usage
=====

* Go to the product form, in tab 'Procurement' and choose 'Purchase Request'.
When a procurement order is created and the supply method is 'Make to Order'
When a procurement order is created and the supply method is 'Buy'
the application will now create a Purchase Request.

.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def _prepare_purchase_order(self, picking_type, location, company):

@api.model
def _get_purchase_line_onchange_fields(self):
return ['date_planned', 'product_uom', 'price_unit', 'name',
return ['product_uom', 'price_unit', 'name',
'taxes_id']

@api.model
Expand Down Expand Up @@ -168,6 +168,7 @@ def _prepare_purchase_order_line(self, po, item):
'product_qty': qty,
'account_analytic_id': item.line_id.analytic_account_id.id,
'purchase_request_lines': [(4, item.line_id.id)],
'date_planned': item.line_id.date_required
}
if item.line_id.procurement_id:
vals['procurement_ids'] = [(4, item.line_id.procurement_id.id)]
Expand All @@ -192,6 +193,7 @@ def _get_order_line_search_domain(self, order, item):
order_line_data = [('order_id', '=', order.id),
('name', '=', name),
('product_id', '=', item.product_id.id or False),
('date_planned', '=', item.line_id.date_required),
('product_uom', '=', vals['product_uom']),
('account_analytic_id', '=',
item.line_id.analytic_account_id.id or False),
Expand Down Expand Up @@ -249,6 +251,9 @@ def make_purchase_order(self):
new_pr_line=new_pr_line)
po_line.product_qty = new_qty
po_line._onchange_quantity()
# The onchange quantity is altering the scheduled date of the PO
# lines. We do not want that:
po_line.date_planned = item.line_id.date_required
res.append(purchase.id)

return {
Expand Down

0 comments on commit 1458c34

Please sign in to comment.