Merge lp://staging/~akretion-team/stock-logistic-flows/70-product_serial-plus-plus into lp://staging/stock-logistic-flows

Proposed by Alexis de Lattre
Status: Needs review
Proposed branch: lp://staging/~akretion-team/stock-logistic-flows/70-product_serial-plus-plus
Merge into: lp://staging/stock-logistic-flows
Diff against target: 1428 lines (+888/-189)
16 files modified
product_serial/__init__.py (+4/-5)
product_serial/i18n/product_serial.pot (+211/-43)
product_serial/product_demo.xml (+1/-0)
product_serial/stock.py (+11/-6)
product_serial/stock_view.xml (+3/-81)
product_serial/wizard/__init__.py (+1/-2)
product_serial/wizard/prodlot_wizard.py (+135/-44)
product_serial/wizard/prodlot_wizard_view.xml (+14/-8)
product_serial_purchase/__init__.py (+23/-0)
product_serial_purchase/__openerp__.py (+44/-0)
product_serial_purchase/i18n/product_serial_purchase.pot (+34/-0)
product_serial_purchase/purchase.py (+131/-0)
product_serial_sale_stock/__init__.py (+23/-0)
product_serial_sale_stock/__openerp__.py (+46/-0)
product_serial_sale_stock/i18n/product_serial_sale_stock.pot (+34/-0)
product_serial_sale_stock/sale_stock.py (+173/-0)
To merge this branch: bzr merge lp://staging/~akretion-team/stock-logistic-flows/70-product_serial-plus-plus
Reviewer Review Type Date Requested Status
Alexandre Fayolle - camptocamp Needs Resubmitting
Joël Grand-Guillaume @ camptocamp code review, no tests Approve
Yannick Vaucher @ Camptocamp Needs Information
Lionel Sausin - Initiatives/Numérigraphe (community) Abstain
Raphaël Valyi - http://www.akretion.com Approve
Review via email: mp+195144@code.staging.launchpad.net

Description of the change

This merge proposal is for the module product_serial.

The main new feature of this merge proposal is the ability to select or create prodlots from a text file (simple texte file, 1 line per prodlot)

Other changes :
- Keep the native "split in serial number" button, because it can be usefull for products that need manual split in non-predictable lot size.
- Code cleaning : reduce flake8 warnings in the wizard, remove old code

I hope you will like this merge proposal :-)

To post a comment you must log in.
39. By Alexis de Lattre

[MERGE] with lp:stock-logistic-flows/7.0 revno 39.

40. By Alexis de Lattre

Add the new field track_internal to demo data.

41. By Alexis de Lattre

Add 2 small modules product_serial_purchase and product_serial_sale_stock.

Revision history for this message
Raphaël Valyi - http://www.akretion.com (rvalyi) wrote :

LGTM, lot's f welcome code cleaning, thanks.

review: Approve
Revision history for this message
Lionel Sausin - Initiatives/Numérigraphe (ls-initiatives) wrote :

product_serial looks like a great module but it already has 4 functional features.
I humbly suggest it would be better to split it into several small specialized modules, and let user cherry-pick the ones they need.
I would make the code easier to understand and to extend.

review: Needs Fixing
Revision history for this message
Alexis de Lattre (alexis-via) wrote :

@Lionel

I agree with you ; my merge proposal is a first step in this direction, with the introduction of :
- product_serial_sale_stock
- product_serial_purchase

but I won't do the split you talk about in this merge proposal, because it's out of the scope of this MP. It would have to be done in a new MP dedicated to this task.

Revision history for this message
Lionel Sausin - Initiatives/Numérigraphe (ls-initiatives) :
review: Abstain
Revision history for this message
Lionel Sausin - Initiatives/Numérigraphe (ls-initiatives) wrote :

Sorry Alexis de Lattre, I didn't notice the modules you introduced.
You're right a dedicated MP for the splitting will be more effective.

42. By Alexis de Lattre

[MERGE] with main branch revno 40.

43. By Alexis de Lattre

Modularize the code of the wizard for the module product_serial_mrp

44. By Alexis de Lattre

Harmonize with the OpenERP strings : Production Lots -> Serial Numbers

Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote :

I'll approve it under the condition this will be splited.
You should already create an other MP which has this one as prerequisite.

Will you split that added feature of serial number in a module as well ?

Otherwise thanks for the code cleaning.

Cheers

review: Needs Information
Revision history for this message
Alexis de Lattre (alexis-via) wrote :

@Yannick:

As I said, this MP is a first step towards a split ; as you can see, it introduce 2 new modules : product_serial_sale_stock and product_serial_purchase. I am about to do an MP on lp:openerp-manufacturing for product_serial_mrp.

BUT I didn't say that i'll do all the work for the split by myself. You say : "You should already create an other MP" : you are also invited to do it, it's a community work, not just my own work ! I am not the original author of the module product_serial, I am just a modest contributor on this module.

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

* in select_or_create_prodlots_from_interval:

The following lines

282 + prodlot_seq = ['%%s%%0%dd%%s' % number_length % (
283 + prefix, current_number, suffix) for current_number in
284 + range(first_number, last_number+1)
285 + ]

should be rewritten using '%s%0*d%s' % (prefix, current_number, number_length, suffix) (see http://docs.python.org/2.7/library/stdtypes.html#string-formatting-operations)

I also suggest testing that the interval limits are > 0

* spell check: s/splitted/split/ everywhere

* product_serial_sale_stock/sale_stock.py : the code is not calling super()._create_pickings_and_procurements and will therefore break any addons which overloads this method. If you really need to reimplement the method without playing the super game, this needs at least to be proeminently documented in the module description. And I think monkey patching the official addon implementation would be less disruptive to other addons.

* there are no automated tests for the new feature.

review: Needs Fixing (code review, no test)
45. By Alexis de Lattre

As suggested by Alexandre Fayolle:
- splitted -> split (English irregular verb)
- simplify string formatting in the spread prodlot wizard
- in the speard prodlot wizard, check that the numbers are > 0
- add a warning in the description of the module product_serial_sale_stock that the module doesn't call super()

Update POT file

Revision history for this message
Alexis de Lattre (alexis-via) wrote :

@Alexandre

Thanks for your review.

You are right, the fact that I don't call super() on _create_pickings_and_procurements() in the module product_serial_sale_stock is a big problem and I am aware of that. But, unfortunately, I didn't find a solution that includes calling super(). If you think it's possible, please give me some ideas !

I am not an expert of monkey patching, but I'll see with my colleagues if it is possible.

And thanks for pointing out my mistakes on English irregular verbs :)

46. By Alexis de Lattre

Use monkey-patching in product_serial_sale_stock, as suggested by Alexandre Fayolle.
[FIX] Copy splitted qty to product_uos_qty, because this field is used for invoicing !

47. By Alexis de Lattre

PEP-8 stuff (I forgot to check it before my previous commit)

48. By Alexis de Lattre

Small change in import (idea of Sebastien Beau)

Revision history for this message
Alexis de Lattre (alexis-via) wrote :

@Alexandre:

Could you update your review status "Needs fixing" following my commits 45 to 48 ?

Revision history for this message
Joël Grand-Guillaume @ camptocamp (jgrandguillaume-c2c) wrote :

Hi Alexis,

Thanks for this contribs. I checked the corrected points suggested by Alexandre and that's fine now !

The only point I see is that we have no tests provided. Can I ask you to add at least one when making the next MP on splitting the module ?

This is a feature we need to be able to rely on, therefor having tests is important here IMO.

I don't want to block this MP any longer, but please think on adding tests the next time.

Best regards,

Joël

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

The source code management for this project has been moved to https://github.com/OCA/stock-logistics-workflow

Could you resubmit this MP on the new site?

review: Needs Resubmitting
Revision history for this message
Alexis de Lattre (alexis-via) wrote :

Well... product_serial will have to be largely re-written for v8, given all the big changes in stock management. If the modules in v7.0 stay on LP, we could keep this branch here.

Revision history for this message
Leonardo Pistone (lepistone) wrote :

Alexis, They don't! :)

On Thu, Jul 3, 2014 at 6:16 PM, Alexis de Lattre <email address hidden>
wrote:

> Well... product_serial will have to be largely re-written for v8, given all the big changes in stock management. If the modules in v7.0 stay on LP, we could keep this branch here.
> --
> https://code.launchpad.net/~akretion-team/stock-logistic-flows/70-product_serial-plus-plus/+merge/195144
> Your team Stock and Logistic Core Editors is subscribed to branch lp:stock-logistic-flows.
> --
> Mailing list: https://launchpad.net/~openerp-community-reviewer
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~openerp-community-reviewer
> More help : https://help.launchpad.net/ListHelp

49. By Alexis de Lattre

Add missing dependancy.

50. By Alexis de Lattre

FIX a bug that was causing wrong stock level when the qty was changed manually by the user in a PO generated by procurements.

51. By Alexis de Lattre

FIX my previous fix : don't fail when line.move_dest_id is False

52. By Alexis de Lattre

FIX avoid a crash when the module product_serial_sale_stock is not installed.

53. By Alexis de Lattre

Using split('\n') is not a good idea when we have windows files that use '\n\r' for new lines.

54. By Alexis de Lattre

FIX avoid infinite loop when product qty on sale order line is 0 !

55. By Alexis de Lattre

Add prepare method for prodlot generation

Unmerged revisions

55. By Alexis de Lattre

Add prepare method for prodlot generation

54. By Alexis de Lattre

FIX avoid infinite loop when product qty on sale order line is 0 !

53. By Alexis de Lattre

Using split('\n') is not a good idea when we have windows files that use '\n\r' for new lines.

52. By Alexis de Lattre

FIX avoid a crash when the module product_serial_sale_stock is not installed.

51. By Alexis de Lattre

FIX my previous fix : don't fail when line.move_dest_id is False

50. By Alexis de Lattre

FIX a bug that was causing wrong stock level when the qty was changed manually by the user in a PO generated by procurements.

49. By Alexis de Lattre

Add missing dependancy.

48. By Alexis de Lattre

Small change in import (idea of Sebastien Beau)

47. By Alexis de Lattre

PEP-8 stuff (I forgot to check it before my previous commit)

46. By Alexis de Lattre

Use monkey-patching in product_serial_sale_stock, as suggested by Alexandre Fayolle.
[FIX] Copy splitted qty to product_uos_qty, because this field is used for invoicing !

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches