salesman for invoices created from a picking

Bug #861306 reported by Manu
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Fix Committed
Low
OpenERP R&D Addons Team 3

Bug Description

The salesman for the invoices created from a picking is not correct.

When an invoice is created from a sale.order in the method action_invoice_create (sale/sale.py), the user_id field gets the value:

'user_id': order.user_id and order.user_id.id or False

so the code properly copies the salesman from the order to the invoice.

However, when invoicing from pickings, the method action_invoice_create (stock/stock.py), the user_id field for the invoice gets the value:

'user_id': uid

when it should get the value:

'user_id': picking.sale_id and picking.sale_id.user_id and picking.sale_id.user_id.id or False

in the 2 locations of the method action_invoice_create.

Please fix it.

Related branches

Changed in openobject-addons:
assignee: nobody → OpenERP R&D Addons Team 3 (openerp-dev-addons3)
importance: Undecided → Low
status: New → Confirmed
Changed in openobject-addons:
status: Confirmed → In Progress
Changed in openobject-addons:
status: In Progress → Fix Committed
Revision history for this message
Bharat Devnani (Open ERP) (bde-openerp) wrote :

Hello Manu,

Thanks for your time and contribution, i seen your suggestions regarding user_id in stock.py of Stock Module but alone it was not solving the issue related to user_id, so i have made certain changes in sale.py of Sale Module inorder to correct the users in SO and Customer Invoice. The solution will be merged in addons soon. Following are the Revision ID and Number of the proposed branch:

Revision ID : <email address hidden>
Revision Number : 5236

Thanks & Regards,
Devnani Bharat R.

Revision history for this message
Manu (manu-tiedra) wrote :

Hello Devnani Bharat,

I have seen the diff. Could you please tell me why you changed on sale/sale.py, onchange_partner_id:

user_id = uid

instead of what it was:

user_id = part.user_id and part.user_id.id or uid

I think it made more sense before: If the partner has a dedicated salesman configured, use that. If not, use the current user. If not, I think the user_id property for res.partner is not used in any other place.

What I would change on sale/sale.py would be the _default for the user_id field. Now it is:

'user_id': lambda obj, cr, uid, context: uid,

But to be more in sync with how it was before your change i would make it to pick up the user_id if there is a partner_id in the context, like it is done for partner_invoice_id.

Please comment. Thank you.

Changed in openobject-addons:
milestone: none → 6.1
Revision history for this message
Bharat Devnani (Open ERP) (bde-openerp) wrote :

Hello Manu,

I have kept the value of user_id as it is (i.e uid) in defaults. But for your suggested solution below:

But to be more in sync with how it was before your change i would make it to pick up the user_id if there is a partner_id in the context, like it is done for partner_invoice_id.

I request you to post another bug for the same.

Thanks & Regards,
Devnani Bharat R.

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.