[16.0][ADD] sale_order_confirm_partial: add module#2958
[16.0][ADD] sale_order_confirm_partial: add module#2958dmitriypaulov wants to merge 1 commit intoOCA:16.0from
Conversation
4b6cb4e to
bd26a1e
Compare
| ) | ||
|
|
||
| @api.onchange("mode") | ||
| def _onchange_mode(self): |
There was a problem hiding this comment.
Can we use compute with readonly=False instead of onchange here?
1086848 to
c449bef
Compare
ivs-cetmix
left a comment
There was a problem hiding this comment.
Check the comments and add tests pls.
| unconfirmed_order = self.copy( | ||
| { | ||
| "name": self.name + unconfirmed_suffix, | ||
| "order_line": False, |
There was a problem hiding this comment.
why not to set "cancel" state directly here?
There was a problem hiding this comment.
Because in the loop below I'm changing order lines of this order, but Odoo restricts such changes for orders in Cancel state
| - confirmed_line.confirmed_qty, | ||
| } | ||
| ) | ||
| unconfirmed_order.state = "cancel" |
0c577d5 to
c9c557a
Compare
c9c557a to
0368b40
Compare
sale_order_confirm_partial/tests/test_sale_order_confirm_partial.py
Outdated
Show resolved
Hide resolved
| # Check original order lines quantities | ||
| # (they should stay the same) | ||
| self.assertEqual( | ||
| self.sale_order.order_line[0].product_uom_qty, |
There was a problem hiding this comment.
This is what I was talking about in the previous comment. You need to use direct reference. Eg
self.so_line_1.product_uom_qty,
bc7643b to
654e1ce
Compare
|
@dmitriypaulov What's the status of this ? |
|
Hi
Hi @rousseldenis we are already using this module. However would appreciate additional code review. |
Hi @rousseldenis, could we have this checked and merged? |
|
Hey @OCA/crm-sales-marketing-maintainers I know that's summer holiday season and probably you are enjoying your drinks is some beach bars 😄 |
654e1ce to
705517c
Compare
Hey @OCA/crm-sales-marketing-maintainers and @rousseldenis |
705517c to
efb3c71
Compare
|
@dmitriypaulov @ivs-cetmix CI is red. Could you rebase ? |
9447fbe to
7ac09ab
Compare
|
Hi @rousseldenis , PR is rebased. Let me know what should be done next. |
|
@dmitriypaulov @ivs-cetmix you should fix tests |
7ac09ab to
c176a52
Compare
[ADD] sale_order_confirm_partial: add tests [REF] sale_order_confirm_partial: safer approach to test so lines
c176a52 to
99a413a
Compare
mmequignon
left a comment
There was a problem hiding this comment.
What about sale_order_split_strategy (available in 18.0) ?
That's absolutely different module. This one is user-focused: "I have an order, I want to confirm it right now, but only Item A and Item B". P.S. this module was initially developed for a project that ... and it's gone... 😆 So if you would like to have this merge would appreciate your assistance with tests as it looks like they need to be addressed still. |
I would rather use the sale_order_split_strategy module, add a new field I honestly would avoid having 2 modules doing "mostly" the same thing but with a slight difference. |
I got your point, however they are absolutely different modules designed for different things. Yes, they both split quotations, but this is the only thing they have in common. I would recommend you to open the documentation for the both modules and check it. |
You are misunderstanding my point I think. I would rather backport |
I see, got your point now. Yes, this might be reasonable. In this case I would prefer to abandon this PR but leave it in case someone would like to implement this later. Probably it makes no sense to keep it for 16.0 as the main focus shifted to 18.0 already. |
alexey-pelykh
left a comment
There was a problem hiding this comment.
Thanks for the contribution. I looked through the code and I tend to agree with @mmequignon's suggestion -- building on top of sale_order_split_strategy (with a backport to 16.0 if needed) would be a cleaner path and avoid maintaining two modules with overlapping scope.
Since @ivs-cetmix also acknowledged this direction makes sense, it might be worth closing this PR in favor of that approach.
That said, a few code-level notes in case anyone picks this up or adapts it later:
-
action_confirmbreaks multi-record calls. The override usesself.id(singular) to setdefault_sale_order_idon the wizard, but stockaction_confirmsupports multi-record. When partial confirmation is enabled, callingaction_confirm()on a recordset of multiple orders would silently use only the last order's id. Should at minimum addself.ensure_one()or loop explicitly. -
Tests reference fields that don't exist on the model. In
test_confirmation_with_save_unconfirmed_selected, the assertion filtersunconfirmed_so.order_lineusinglambda x: x.so_line_id == self.so_line_1-- butsale.order.linehas noso_line_idfield (that's on the wizard line model). This is likely why CI is red. -
attrssyntax is deprecated in Odoo 16+. The views useattrs="{'invisible': [...]}"which still works in 16.0 but newer OCA linting may flag it. Minor point for a 16.0 target. -
String formatting with
%in translatable strings. Themessage_postcalls use_("...") % {...}-- while this works, OCA guidelines generally prefer_("... %(name)s ...") % {...}which is already used here, so that part is fine.
|
@ivs-cetmix Could we close ? |
|
@rousseldenis yes, thank you! |
This module allows to select which sale order lines you would like to confirm. It also can create a new quotation in the "Cancel" state with all the unconfirmed lines from the original quotation in case you need to keep that information.