openerp-india team mailing list archive
-
openerp-india team
-
Mailing list archive
-
Message #27072
[Bug 1269528] [NEW] Wrong planned date in procurements generated by orderpoints
Public bug reported:
Here is a scenario to reproduce the problem :
This scenario is executed on January 15th 2014
1) Connect to Runbot v7.0
2) On the company, set "Manufacturing Lead Time" to 0, Purchase Lead
Time to 0 and Security days to 0 (it make it easier to understand delays
that way)
2) Create 3 products :
a) name : P3
Can be sold : yes
Can be purchase : no
Type : stockable product
Procurement method : MTS
Supply Method : Manufacture
Manufacturing Lead time : 15
Customer Lead Time : 28
=> for this product, create a new orderpoint with default values
(OP/00009)
b) name : P2
Can be sold : no
Can be purchase : no
Type : stockable product
Procurement method : MTS
Supply Method : Manufacture
Manufacturing Lead time : 5
=> for this product, create a new orderpoint with default values
(OP/000010)
c) name : P1
Can be sold : no
Can be purchase : yes
Type : consumable
default values for the rest of the product configuration.
3) P2 is built from P1 ; P3 is built from P2.
So you have to create 2 BOMs :
a) First BOM :
Product = P2
qty 1
Component : P1 with qty 1
b) Second BOM :
Product = P3
qty 1
Component : P2 with qty 1
4) Create a new quotation (SO018) with 1 sale order line :
product : P3
qty : 1
Confirm the quotation.
5) The out picking (OUT/0015) has a schedule time of February 12 2014
=>OK, it corresponds to the customer lead time of 28 days for P3. The
underlying procurement has the same scheduled date.
6) Run the scheduler twice.
It will create 2 manufacturing orders :
a) one manufacturing order for P3 (MO/00015) with scheduled date = January 1st 2014... why ???
b) one manufacturing order for P2 (MO/00016) with scheduled date = January 11th 2014... why ???
So, according to the manufacturing orders, we have to produce P3 first, and then produce P2... but we require P2 to be able to produce P3 !!! => it's all WRONG.
When we look at the procurements, we see 4 procurements :
a) a procurement for P3 with origin SO0018, MTS, linked to the move line of the out picking OUT/00015, with schedule date = Feb 12 2014 => OK
b) another procurement for P3 with origin OP/00009, MTO, linked to MO/00015, with schedule date = January 16th 2014 => why this date ?
c) a procurement for P2 with origin OP/00009:MO/00015, MTS, linked to the stock move stock>stock of the manufacturing order, with schedule date = January 1st 2014 (= the schedule date of MO/000015) => OK
d) another procurement for P2 with origin OP/00010, MTO, linked to the manufacturing order MO/00016, with schedule date = January 16th 2014 => why this date ?
Code analysis
===========
Here is a short analysis of the code :
First, I wanted to know how OpenERP computes the schedule dates of the
MO generated by the orderpoints. When you look at
addons-70/mrp/procurement.py, in the function make_mo() around line 94,
you see that the date_planned of the MO = date_planned of the
procurement order - produce_delay of the product - manufacturing lead of
the company. This code is correct.
Then, we want to know how the date of the procurement is computed. In
particular, we want to know how the date of the procurement b) and d)
are computed, because we don't understand why openerp gives the date of
January 16th 2014 to these procurements. I am not an expert of the code
of the schedulers, but, with some prints in the code, I am able to
confirm that the date_planned of the procurements b) and d) are computed
by the function _get_orderpoint_date_planned() in
addons-70/procurement/scheduler.py line 188. The code is the following :
date_planned = start_date +
relativedelta(days=orderpoint.product_id.seller_delay or 0.0)
start_date is given by the function _prepare_orderpoint_procurement()
which is right under ; it says start_date = today.
seller_delay is a fields.function defined is addons/product/product.py ;
the computation is the following (line 509 in the function
_calc_seller() ):
'seller_delay': main_supplier.delay if main_supplier else 1,
in my case, there is no "main_supplier" for P2 nor P3 because they are
supply method = Manufacture ! So the seller_delay = 1. This explains the
planned date of the procurement b) and d) : today + 1 = January 16,
2014.
I really don't see the logic of all this.
The only thing I see it that, for the users, it is a complete non-sense
to have a a date planned for the MO for P3 before the date planned of
the MO for P2, given that we need P2 to produce P3 !
** Affects: openobject-addons
Importance: Undecided
Status: New
--
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Addons.
https://bugs.launchpad.net/bugs/1269528
Title:
Wrong planned date in procurements generated by orderpoints
Status in OpenERP Addons (modules):
New
Bug description:
Here is a scenario to reproduce the problem :
This scenario is executed on January 15th 2014
1) Connect to Runbot v7.0
2) On the company, set "Manufacturing Lead Time" to 0, Purchase Lead
Time to 0 and Security days to 0 (it make it easier to understand
delays that way)
2) Create 3 products :
a) name : P3
Can be sold : yes
Can be purchase : no
Type : stockable product
Procurement method : MTS
Supply Method : Manufacture
Manufacturing Lead time : 15
Customer Lead Time : 28
=> for this product, create a new orderpoint with default values
(OP/00009)
b) name : P2
Can be sold : no
Can be purchase : no
Type : stockable product
Procurement method : MTS
Supply Method : Manufacture
Manufacturing Lead time : 5
=> for this product, create a new orderpoint with default values
(OP/000010)
c) name : P1
Can be sold : no
Can be purchase : yes
Type : consumable
default values for the rest of the product configuration.
3) P2 is built from P1 ; P3 is built from P2.
So you have to create 2 BOMs :
a) First BOM :
Product = P2
qty 1
Component : P1 with qty 1
b) Second BOM :
Product = P3
qty 1
Component : P2 with qty 1
4) Create a new quotation (SO018) with 1 sale order line :
product : P3
qty : 1
Confirm the quotation.
5) The out picking (OUT/0015) has a schedule time of February 12 2014
=>OK, it corresponds to the customer lead time of 28 days for P3. The
underlying procurement has the same scheduled date.
6) Run the scheduler twice.
It will create 2 manufacturing orders :
a) one manufacturing order for P3 (MO/00015) with scheduled date = January 1st 2014... why ???
b) one manufacturing order for P2 (MO/00016) with scheduled date = January 11th 2014... why ???
So, according to the manufacturing orders, we have to produce P3 first, and then produce P2... but we require P2 to be able to produce P3 !!! => it's all WRONG.
When we look at the procurements, we see 4 procurements :
a) a procurement for P3 with origin SO0018, MTS, linked to the move line of the out picking OUT/00015, with schedule date = Feb 12 2014 => OK
b) another procurement for P3 with origin OP/00009, MTO, linked to MO/00015, with schedule date = January 16th 2014 => why this date ?
c) a procurement for P2 with origin OP/00009:MO/00015, MTS, linked to the stock move stock>stock of the manufacturing order, with schedule date = January 1st 2014 (= the schedule date of MO/000015) => OK
d) another procurement for P2 with origin OP/00010, MTO, linked to the manufacturing order MO/00016, with schedule date = January 16th 2014 => why this date ?
Code analysis
===========
Here is a short analysis of the code :
First, I wanted to know how OpenERP computes the schedule dates of the
MO generated by the orderpoints. When you look at
addons-70/mrp/procurement.py, in the function make_mo() around line
94, you see that the date_planned of the MO = date_planned of the
procurement order - produce_delay of the product - manufacturing lead
of the company. This code is correct.
Then, we want to know how the date of the procurement is computed. In
particular, we want to know how the date of the procurement b) and d)
are computed, because we don't understand why openerp gives the date
of January 16th 2014 to these procurements. I am not an expert of the
code of the schedulers, but, with some prints in the code, I am able
to confirm that the date_planned of the procurements b) and d) are
computed by the function _get_orderpoint_date_planned() in
addons-70/procurement/scheduler.py line 188. The code is the following
:
date_planned = start_date +
relativedelta(days=orderpoint.product_id.seller_delay or 0.0)
start_date is given by the function _prepare_orderpoint_procurement()
which is right under ; it says start_date = today.
seller_delay is a fields.function defined is addons/product/product.py
; the computation is the following (line 509 in the function
_calc_seller() ):
'seller_delay': main_supplier.delay if main_supplier else 1,
in my case, there is no "main_supplier" for P2 nor P3 because they are
supply method = Manufacture ! So the seller_delay = 1. This explains
the planned date of the procurement b) and d) : today + 1 = January
16, 2014.
I really don't see the logic of all this.
The only thing I see it that, for the users, it is a complete non-
sense to have a a date planned for the MO for P3 before the date
planned of the MO for P2, given that we need P2 to produce P3 !
To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-addons/+bug/1269528/+subscriptions
Follow ups
References