[FIX] stock: add a default group_id if stock.move created from stock.picking
The group_id of a picking is related to the group_id of the first stock.move related to it. When a stock.move is added to a picking manually, the group_id is normally not set. This can be an issue in a very specific case: - In Settings / Sales, tick "Allow setting a different address for delivery and invoicing " - Create a SO - Invoicing on delivery - Customer: Agrolait; Delivery address: Thomas Passot - Add a line: ice cream - Confirm the SO - In the DO, add a line , with an expected date higher than the one of the existing move - Save - Mark as todo - Force reservation - transfer - transfer - Create invoice => See that two invoices are created, one for Agrolait, one for Thomas passot ( the DELIVERY address ) opw-639955
This commit is contained in:
parent
b4802bbdd9
commit
f4a9afdd31
|
@ -1824,6 +1824,13 @@ class stock_move(osv.osv):
|
||||||
def _default_destination_address(self, cr, uid, context=None):
|
def _default_destination_address(self, cr, uid, context=None):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def _default_group_id(self, cr, uid, context=None):
|
||||||
|
context = context or {}
|
||||||
|
if context.get('default_picking_id', False):
|
||||||
|
picking = self.pool.get('stock.picking').browse(cr, uid, context['default_picking_id'], context=context)
|
||||||
|
return picking.group_id.id
|
||||||
|
return False
|
||||||
|
|
||||||
_defaults = {
|
_defaults = {
|
||||||
'location_id': _default_location_source,
|
'location_id': _default_location_source,
|
||||||
'location_dest_id': _default_location_destination,
|
'location_dest_id': _default_location_destination,
|
||||||
|
@ -1838,6 +1845,7 @@ class stock_move(osv.osv):
|
||||||
'procure_method': 'make_to_stock',
|
'procure_method': 'make_to_stock',
|
||||||
'propagate': True,
|
'propagate': True,
|
||||||
'partially_available': False,
|
'partially_available': False,
|
||||||
|
'group_id': _default_group_id,
|
||||||
}
|
}
|
||||||
|
|
||||||
def _check_uom(self, cr, uid, ids, context=None):
|
def _check_uom(self, cr, uid, ids, context=None):
|
||||||
|
|
|
@ -1064,6 +1064,7 @@
|
||||||
<field name="product_id" on_change="onchange_product_id(product_id,location_id,location_dest_id, parent.partner_id)"/>
|
<field name="product_id" on_change="onchange_product_id(product_id,location_id,location_dest_id, parent.partner_id)"/>
|
||||||
<field name="procure_method" attrs="{'readonly': [('state', '!=', 'draft')]}" groups="stock.group_adv_location"/>
|
<field name="procure_method" attrs="{'readonly': [('state', '!=', 'draft')]}" groups="stock.group_adv_location"/>
|
||||||
<field name="picking_type_id" invisible="1"/>
|
<field name="picking_type_id" invisible="1"/>
|
||||||
|
<field name="group_id" invisible="1"/>
|
||||||
<label for="product_uom_qty"/>
|
<label for="product_uom_qty"/>
|
||||||
<div>
|
<div>
|
||||||
<field name="product_uom_qty" on_change="onchange_quantity(product_id, product_uom_qty, product_uom, product_uos)" class="oe_inline"/>
|
<field name="product_uom_qty" on_change="onchange_quantity(product_id, product_uom_qty, product_uom, product_uos)" class="oe_inline"/>
|
||||||
|
|
Loading…
Reference in New Issue