Jean-Christophe VASSORT (OpenERP) has proposed merging
lp:~openerp-dev/openobject-addons/6.1-opw-381630-jcv into
lp:openobject-addons/6.1.
Requested reviews:
OpenERP R&D Team (openerp-dev)
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-381630-jcv/+merge/96153
[FIX] Address field of stock.picking
This fix is related to OPW 381630 and Bug #916248
https://bugs.launchpad.net/openobject-addons/+bug/916248
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-381630-rgo/+merge/90042
When going through the act_window "Receptions" in Purchase Order, address field
of stock.picking(Receptions) form shows the partner name instead of partner
address.
And also, the picking address should be filled with the destination_address
from particular PO and if that is not the case then the address of warehouse
should be considered otherwise shipping address or default address of Company
should be considered. Currently, it is taking the address of Supplier if
destination address not specified in PO.
--
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-381630-jcv/+merge/96153
Your team OpenERP R&D Team is requested to review the proposed merge of
lp:~openerp-dev/openobject-addons/6.1-opw-381630-jcv into
lp:openobject-addons/6.1.
=== modified file 'purchase/purchase.py'
--- purchase/purchase.py 2012-02-16 12:34:08 +0000
+++ purchase/purchase.py 2012-03-06 15:39:19 +0000
@@ -427,13 +427,24 @@
self.log(cr, uid, id, message)
return True
+ def _get_default_delivery_address(self, cr, uid, order, context=None):
+ if order.dest_address_id:
+ return order.dest_address_id.id
+ elif order.warehouse_id and order.warehouse_id.partner_address_id:
+ return order.warehouse_id.partner_address_id.id
+ elif order.company_id.partner_id.address:
+ addresses = self.pool.get('res.partner').address_get(cr, uid, [order.company_id.partner_id.id], ['default', 'delivery'])
+ return addresses.get('delivery', False) or addresses.get('default', False)
+ else:
+ return False
+
def _prepare_order_picking(self, cr, uid, order, context=None):
return {
'name': self.pool.get('ir.sequence').get(cr, uid, 'stock.picking.in'),
'origin': order.name + ((order.origin and (':' + order.origin)) or ''),
'date': order.date_order,
'type': 'in',
- 'address_id': order.dest_address_id.id or order.partner_address_id.id,
+ 'address_id': self._get_default_delivery_address(cr, uid, order, context=context),
'invoice_state': '2binvoiced' if order.invoice_method == 'picking' else 'none',
'purchase_id': order.id,
'company_id': order.company_id.id,
@@ -453,7 +464,7 @@
'location_id': order.partner_id.property_stock_supplier.id,
'location_dest_id': order.location_id.id,
'picking_id': picking_id,
- 'address_id': order.dest_address_id.id or order.partner_address_id.id,
+ 'address_id': self._get_default_delivery_address(cr, uid, order, context=context),
'move_dest_id': order_line.move_dest_id.id,
'state': 'draft',
'purchase_line_id': order_line.id,
=== modified file 'purchase/test/process/rfq2order2done.yml'
--- purchase/test/process/rfq2order2done.yml 2011-11-13 19:28:05 +0000
+++ purchase/test/process/rfq2order2done.yml 2012-03-06 15:39:19 +0000
@@ -40,7 +40,7 @@
assert len(purchase_order.picking_ids) >= 1, "You should have only one reception order"
for picking in purchase_order.picking_ids:
assert picking.state == "assigned", "Reception state should be in assigned state"
- assert picking.address_id.id == purchase_order.partner_address_id.id, "Delivery address of reception id is different from order"
+ assert picking.address_id.id == self.pool.get('res.partner').address_get(cr, uid, [purchase_order.company_id.partner_id.id])['default'], "Delivery address of reception id is different from order"
assert picking.company_id.id == purchase_order.company_id.id, "Company is not correspond with purchase order"
-
Reception is ready for process so now done the reception.
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp