Ignoring connector exceptions on a sales order does not confirm the order

Bug #1222867 reported by Brendan Clune (Logic Supply)
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
e-commerce-addons
New
Undecided
Unassigned

Bug Description

When attempting to confirm a draft sales order that raises connector exceptions, the user must first ignore the exceptions, then attempt to confirm the sales order again. This seems unnecessary to me, because the exceptions are only visible when attempting to confirm the order in the first place. That is, if a user chooses to ignore exceptions, he or she has already expressed intent to confirm the order.

Firing the workflow in the sale exception wizard eliminates the need for extra button presses and streamlines the sale confirmation dialog:

         if form.ignore:
             self.pool.get('sale.order').write(cr, uid, form.sale_id.id,
                     {'ignore_exceptions': True}, context=context)
             wf_service = netsvc.LocalService('workflow')
             wf_service.trg_validate(uid, 'sale.order', form.sale_id.id, 'order_confirm', cr)
         return {'type': 'ir.actions.act_window_close'}

A patch is attached.

Revision history for this message
Brendan Clune (Logic Supply) (brendan-clune) wrote :
description: updated
description: updated
Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

Hi Brendan,

Thanks for the patch.

Originally, the sales exception module behaved as you suggest [0].
Doing the confirmation here breaks the modularity if we want to use the wizard in another manner. The thing is that I couldn't find anymore why we needed to use it in another manner... but I think that we needed to be able to check if there are exceptions on a sales order even before clicking on the confirm button.

Anyway, this is often a matter of confusion for the users, so I agree with this change and, if the need for the wizard which doesn't confirm comes again, we can introduce an boolean argument for that.

I would like to have other opinions on this change, if someone else see any valid reason not to do that though.

[0] http://bazaar.launchpad.net/~extra-addons-commiter/e-commerce-addons/7.0/revision/218

Revision history for this message
Brendan Clune (Logic Supply) (brendan-clune) wrote :

Guewen,

I agree that we need to see whether exceptions exist without trying to confirm the sales order, but I think that the user should be able to display those separately without attempting to confirm the order (that is, without clicking the "Confirm Sale" button). If the wizard is needed in multiple places, perhaps we can set a context variable and fire the workflow accordingly. I've attached another patch demonstrating this method, though I have not rigorously tested it.

Revision history for this message
Brendan Clune (Logic Supply) (brendan-clune) wrote :

I should clarify the above:

The patch _does_ confirm the sale order when the "Confirm Sale" button is clicked. I have not tested whether accessing the wizard using a different method submits the order (although I would be surprised if it did), and I have not tested whether my addition to the context dictionary causes any unwanted behavior in the methods it is passed to (again, I would be surprised if if did). Nevertheless, I'll push it to our testing branch and let you know if I notice any strange behavior.

Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

Seems fine to me.

I just discovered that Sébastien Beau is working on the sales exception module, seemingly doing a generic module:
https://bazaar.launchpad.net/~sebastien.beau/openerp-connector/e-commerce-addons-pending-merge/revision/333
In the Sébastien's branch, the wizard is now generic, so either he'll need to keep a wizard specific to the sales, or introduce a sort of callback in the generic one.

I just want to be sure that Sébastien takes that into account when he's working on that, I'll send him an email.

Revision history for this message
Sébastien BEAU - http://www.akretion.com (sebastien.beau) wrote :

Hi, yes I am working on it.
Two big change
- first I extract a generic module "exception_rule" in order to use exception in sale order, purchase order, and why not picking, invoice....
- secondly I change the check box 'ignore exception' by 2 button "cancel validation" and "ignore exception and force validation"

I think it's more user friendly than checking a box and validating it, what do you think?

You can try my branch if you want I will propose a merge this week

Revision history for this message
Brendan Clune (Logic Supply) (brendan-clune) wrote :

Sébastien,

I think that approach will work well. I will keep an eye out for the merge proposal and refactor our module as necessary.

information type: Embargoed → Public
affects: openerp-connector → openerp-connector-magento
affects: openerp-connector-magento → e-commerce-addons
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.