-
-
Notifications
You must be signed in to change notification settings - Fork 493
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[11.0][MIG] mrp_mto_with_stock #255
Conversation
1d32e12
to
9ba29fc
Compare
mrp_mto_with_stock/demo/product.xml
Outdated
|
||
<odoo> <data noupdate="1"> | ||
|
||
<record id="product_product_manufacture_1" model="product.product"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could be the occasion to fix this 8 spaces indentation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have notice same. Somewhere I have read that formatting changes not allow. So ignore it. May we allow to fix it in XML files ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Formatting changes are to avoid when you do a pull request for a change in an existing version. I'd say as we are doing a large diff anyway it could be the right moment to fix it. On the other hand, it can make the port of pull requests less easier. No strong opinion then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corresponded. Thank you.
@api.multi | ||
def _adjust_procure_method(self): | ||
# Si location => By pass method... | ||
super(MrpProduction, self)._adjust_procure_method() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code is the same in the 10.0 version, but I don't see the point of it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. I am agree. We will remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corresponded. Thank you.
77d6fde
to
e035400
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested locally, does not work as expected.
if move.group_id: | ||
domain.append(('group_id', '=', move.group_id.id)) | ||
procurement = self.env['procurement.order'].search(domain) | ||
procurement = True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you asuming that if you have group you don't have to procure?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lreficent will improve these. Appreciate your feedback.
@@ -68,18 +67,11 @@ def test_manufacture_with_forecast_stock(self): | |||
|
|||
self.assertEqual(self.production.availability, 'partially_available') | |||
|
|||
self.assertEquals(self.subproduct1.virtual_available, 0) | |||
self.assertEquals(self.subproduct1.virtual_available, -3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, I didn't check in deep but my first thought here is that this is not the way to migrate tests. If tests are failing change the logic, don't adapt the result to what you are getting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lreficent Here is explanation for -3 virtual quantity.
- Update
self.subproduct1
with2
quantity and MO is generated with5
quantity. So2-5=-3
I will do more analysis on it and update you. Thanks for trigger.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, of course but the module should use that 2 units and then create a procurement for the remaining 3. The previous 0 was there for a reason, that's what I meant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would recommend you to review the functionality in v10 and understand it a little bit more and then come back to v11 so you will know what to expect and could figure out what to fix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bodedra In v10, the method action_assign
in https://github.com/OCA/manufacture/blob/10.0/mrp_mto_with_stock/models/mrp_production.py#L20 is supposed to create a new procurement order to fulfill the missing quantity of the component.
In v11, you need to migrate the method to create a new purchase order or manufacturing order (depending on the product configuration). This will increase the forecast quantity and it will match the expected quantity set in the tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure with the scope of this module, looking at the code I haven't seen regarding orderpoints on the procurement should we also need to consider it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If an MO that triggered for a PO is cancelled what would happen to the PO? What if PO is on Draft/RFQ state? How about if PO is on confirmed state?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with @lreficent, please do not merge this branch before fixing this properly (maening not the test result). @max3903 You can drop a card at us to help here if required. |
b686d2a
to
f9a7832
Compare
Hi All, Following screen-shots represents test case in Odoo 10. It seems have problem in it. Current behavior
Expected behaviorFirst use 2 quantity in stock location and then create PO with 10 quantity to fulfil MO requirements. Would you please correct me on these. @lreficent May we do screen share via google hangout if possible for you? |
I think that the problem is that you have selected the route "Make to
order" for R1. And this overrides the MTO-MTS.
Please remove the 'Make to order' route and re-try.
…On Tue, Mar 6, 2018 at 1:23 PM, Bhavesh Odedra ***@***.***> wrote:
Hi All,
Following screen-shots represents test case in Odoo 10. It seems have
problem in it.
Current behavior
1. Create "P1" and "R1" product. Update "2" quantity of "R1" in
location stock.
[image: screenshot from 2018-03-06 17 19 40]
<https://user-images.githubusercontent.com/14229503/37031370-821c25cc-2164-11e8-9bee-63258953ab79.png>
[image: screenshot from 2018-03-06 17 19 58]
<https://user-images.githubusercontent.com/14229503/37031378-8a28bef6-2164-11e8-9631-371fa6f0af7b.png>
1. "R1" product manufacturing MTO/MTS location configuration.
[image: screenshot from 2018-03-06 17 45 14]
<https://user-images.githubusercontent.com/14229503/37031847-6b93493c-2166-11e8-9bad-efa9579dbcb3.png>
1. Create bill of materials of "P1" product.
[image: screenshot from 2018-03-06 17 20 25]
<https://user-images.githubusercontent.com/14229503/37031429-b3bba0f8-2164-11e8-9366-09c66a03f95b.png>
1. Create manufacturing order of "P1" with quantity *12* and save it.
[image: screenshot from 2018-03-06 17 20 54]
<https://user-images.githubusercontent.com/14229503/37031492-f4dbf998-2164-11e8-8bcd-57fbaa47370b.png>
[image: screenshot from 2018-03-06 17 21 23]
<https://user-images.githubusercontent.com/14229503/37031497-fa9f02b2-2164-11e8-9831-48beaac70d0d.png>
1. It will trigger purchase order for "R1" with *12* quantity as per
our product configuration.
[image: screenshot from 2018-03-06 17 21 30]
<https://user-images.githubusercontent.com/14229503/37031528-255409b2-2165-11e8-808f-70552d21bfb2.png>
1. "R1" product quantity on hand and forecasted quantity.
[image: screenshot from 2018-03-06 17 21 41]
<https://user-images.githubusercontent.com/14229503/37031569-4d2a5450-2165-11e8-8c54-a946d04eb0aa.png>
Expected behavior
First use *2* quantity in stock location and then create PO with *10*
quantity to fulfil MO requirements.
------------------------------
Would you please correct me on these.
@lreficent <https://github.com/lreficent> May we do screen share via
google hangout if possible for you?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#255 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AHU_Vj1JF0YigcPXu6q67pItk6KEAHiOks5tbn_bgaJpZM4SIppZ>
.
--
Jordi Ballester Alomar
CEO & Founder | Eficent
(+34) 629530707 | jordi.ballester@eficent.com | http://www.eficent.com
Twitter: https://twitter.com/jbeficent_erp | Linkedin:
https://www.linkedin.com/in/jordiballesteralomar
|
@jbeficent Appreciate your quick response. I have tested as per your suggested configuration and it creates PO with 10 quantity. I will start working on Odoo 11 to get same. Thank you. |
f9a7832
to
fa27afd
Compare
fa27afd
to
dab59bc
Compare
@jbeficent What do you think if @bodedra adds an onchange or check the values when writing to avoid this misconfiguration? |
Hi, I think the best way to avoid this problem would be to refactor this module on this one: https://github.com/OCA/stock-logistics-warehouse/tree/10.0/stock_mts_mto_rule -> It means:
I don't know if I'm clear enough, but the idea is to bring this behavior through routes & run_* methods instead of overriding it like it has been done here... I think this would be the "ideal" way to bring this feature IMO. Then, if too complicated or too much work at this stage, I understand.. Regards, Joël |
I also think it could be more logical to use the routes/rules. But it seems kind of tricky to use route and pull rule... Hard to see a good solution here. But, maybe we could use only the route. Anyway, I am not sure it is really better. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the work!
Althought tests are green, I see 2 main problem.
One bug about mto_with_no_move_dest_id option, not yet showed by tests.
And the other is about useless procurement group creation, unless I miss understood this part.
# Search procurement group which has created from here | ||
group_name = '{0}:{1}'.format( | ||
production.name, move.product_id.name) | ||
procurement = procurement_obj.search( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't get this part. Why are you (later) creating a new procurement group? I don't think it is needed.
new_move = move | ||
pg_data = production._get_procurement_group_data( | ||
new_move) | ||
group = procurement_obj.create(pg_data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same thing than before, I see no reason to create a procurement group, as it used only un run_procurement
to find the origin. In that case, you can simply define a char origin variable instead of creating a record in Odoo!
qty_to_procure = production.get_mto_qty_to_procure(move) | ||
if qty_to_procure > 0.0: | ||
pg_data = production._get_procurement_group_data(move) | ||
group = procurement_obj.create(pg_data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same issue
def run_procurement(self, move, group, qty): | ||
self.ensure_one() | ||
errors = [] | ||
values = move._prepare_procurement_values() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case of mto_with_no_move_dest_id, you need to remove 'move_dest_ids' from values.
Else the 2 case handled in this module are the same.
Indeed, with mto_with_no_move_dest_id, we want to buy/manufacture to make the future qty (virtual qty) = 0
but we do not want to link the purchase/manufacture order to the stock move.
It would be nice to add a small test to show this issue.
It can be easily done, for instance, adding
self.production.action_assign()
self.assertEquals(self.production.move_raw_ids[0].state, 'assigned')
after https://github.com/ursais/manufacture/blob/dab59bcc211b61bab0f67486818bdaed38539e2a/mrp_mto_with_stock/tests/test_mrp_mto_with_stock.py#L77
Indeed, if you add this test with the present code, it will fail because the raw moves have ancestor and they should not.
Of course, the rest of the test may need to be adapted.
Hello, |
[11.0][mrp_mto_with_stock] Migration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested on runbot. This looks good to me now!
Thanks @florian-dacosta and @bodedra
@florian-dacosta and @lreficent appreciate your support. Thank you. |
#226