Merge pull request #2502 from odoo-dev/8.0-wmsstaging9-jco

8.0 wmsstaging9 jco
This commit is contained in:
Josse Colpaert 2014-09-17 22:12:51 +02:00
commit ccc3e7ff99
16 changed files with 66 additions and 48 deletions

View File

@ -147,10 +147,6 @@ class stock_move(osv.osv):
weight = weight_net = 0.00 weight = weight_net = 0.00
if move.product_id.weight > 0.00: if move.product_id.weight > 0.00:
converted_qty = move.product_qty converted_qty = move.product_qty
if move.product_uom.id <> move.product_id.uom_id.id:
converted_qty = uom_obj._compute_qty(cr, uid, move.product_uom.id, move.product_qty, move.product_id.uom_id.id)
weight = (converted_qty * move.product_id.weight) weight = (converted_qty * move.product_id.weight)
if move.product_id.weight_net > 0.00: if move.product_id.weight_net > 0.00:
@ -165,11 +161,11 @@ class stock_move(osv.osv):
_columns = { _columns = {
'weight': fields.function(_cal_move_weight, type='float', string='Weight', digits_compute= dp.get_precision('Stock Weight'), multi='_cal_move_weight', 'weight': fields.function(_cal_move_weight, type='float', string='Weight', digits_compute= dp.get_precision('Stock Weight'), multi='_cal_move_weight',
store={ store={
'stock.move': (lambda self, cr, uid, ids, c=None: ids, ['product_id', 'product_qty', 'product_uom'], 20), 'stock.move': (lambda self, cr, uid, ids, c=None: ids, ['product_id', 'product_uom_qty', 'product_uom'], 30),
}), }),
'weight_net': fields.function(_cal_move_weight, type='float', string='Net weight', digits_compute= dp.get_precision('Stock Weight'), multi='_cal_move_weight', 'weight_net': fields.function(_cal_move_weight, type='float', string='Net weight', digits_compute= dp.get_precision('Stock Weight'), multi='_cal_move_weight',
store={ store={
'stock.move': (lambda self, cr, uid, ids, c=None: ids, ['product_id', 'product_qty', 'product_uom'], 20), 'stock.move': (lambda self, cr, uid, ids, c=None: ids, ['product_id', 'product_uom_qty', 'product_uom'], 30),
}), }),
'weight_uom_id': fields.many2one('product.uom', 'Unit of Measure', required=True,readonly="1",help="Unit of Measure (Unit of Measure) is the unit of measurement for Weight",), 'weight_uom_id': fields.many2one('product.uom', 'Unit of Measure', required=True,readonly="1",help="Unit of Measure (Unit of Measure) is the unit of measurement for Weight",),
} }

View File

@ -1097,6 +1097,7 @@ class mrp_production(osv.osv):
def _make_consume_line_from_data(self, cr, uid, production, product, uom_id, qty, uos_id, uos_qty, context=None): def _make_consume_line_from_data(self, cr, uid, production, product, uom_id, qty, uos_id, uos_qty, context=None):
stock_move = self.pool.get('stock.move') stock_move = self.pool.get('stock.move')
loc_obj = self.pool.get('stock.location')
# Internal shipment is created for Stockable and Consumer Products # Internal shipment is created for Stockable and Consumer Products
if product.type not in ('product', 'consu'): if product.type not in ('product', 'consu'):
return False return False
@ -1107,7 +1108,7 @@ class mrp_production(osv.osv):
if production.bom_id.routing_id and production.bom_id.routing_id.location_id and production.bom_id.routing_id.location_id.id != source_location_id: if production.bom_id.routing_id and production.bom_id.routing_id.location_id and production.bom_id.routing_id.location_id.id != source_location_id:
source_location_id = production.bom_id.routing_id.location_id.id source_location_id = production.bom_id.routing_id.location_id.id
prev_move = True prev_move = True
destination_location_id = production.product_id.property_stock_production.id destination_location_id = production.product_id.property_stock_production.id
move_id = stock_move.create(cr, uid, { move_id = stock_move.create(cr, uid, {
'name': production.name, 'name': production.name,
@ -1125,6 +1126,7 @@ class mrp_production(osv.osv):
#this saves us a browse in create() #this saves us a browse in create()
'price_unit': product.standard_price, 'price_unit': product.standard_price,
'origin': production.name, 'origin': production.name,
'warehouse_id': loc_obj.get_warehouse(cr, uid, production.location_src_id, context=context),
}, context=context) }, context=context)
if prev_move: if prev_move:

View File

@ -383,7 +383,6 @@
<field name="product_uom" on_change="onchange_uom(product_id, product_uom)" groups="product.group_uom"/> <field name="product_uom" on_change="onchange_uom(product_id, product_uom)" groups="product.group_uom"/>
<field name="date_start"/> <field name="date_start"/>
<field name="date_stop"/> <field name="date_stop"/>
<field name="routing_id"/>
<field name="attribute_value_ids" widget="many2many_tags"/> <field name="attribute_value_ids" widget="many2many_tags"/>
</tree> </tree>
</field> </field>

View File

@ -519,7 +519,7 @@ class ProductChangeMixin(object):
partner = self.pool.get('res.partner').browse(cr, uid, partner_id) partner = self.pool.get('res.partner').browse(cr, uid, partner_id)
result['tax_id'] = self.pool.get('account.fiscal.position').map_tax(cr, uid, partner.property_account_position, product_obj.taxes_id) result['tax_id'] = self.pool.get('account.fiscal.position').map_tax(cr, uid, partner.property_account_position, product_obj.taxes_id)
result['name'] = product_obj.partner_ref result['name'] = product_obj.display_name
result['product_uom'] = product_obj.uom_id and product_obj.uom_id.id or False result['product_uom'] = product_obj.uom_id and product_obj.uom_id.id or False
if not pricelist: if not pricelist:
warning = { warning = {

View File

@ -1007,9 +1007,10 @@ class product_product(osv.osv):
sellers = filter(lambda x: x.name.id == partner_id, product.seller_ids) sellers = filter(lambda x: x.name.id == partner_id, product.seller_ids)
if sellers: if sellers:
for s in sellers: for s in sellers:
seller_variant = s.product_name and "%s (%s)" % (s.product_name, variant) or False
mydict = { mydict = {
'id': product.id, 'id': product.id,
'name': s.product_name or name, 'name': seller_variant or name,
'default_code': s.product_code or product.default_code, 'default_code': s.product_code or product.default_code,
} }
result.append(_name_get(mydict)) result.append(_name_get(mydict))

View File

@ -36,15 +36,15 @@ class product_product(osv.osv):
testdict = {} testdict = {}
for prod_id in ids: for prod_id in ids:
bom_obj = self.pool.get('mrp.bom') bom_obj = self.pool.get('mrp.bom')
bom_ids = bom_obj.search(cr, uid, [('product_id','=', prod_id), ('bom_line_ids', '!=', False)], context=context) bom_id = bom_obj._bom_find(cr, uid, False, product_id = prod_id, context=context)
if bom_ids: if bom_id:
bom_id = bom_ids[0]
# In recursive mode, it will first compute the prices of child boms # In recursive mode, it will first compute the prices of child boms
if recursive: if recursive:
#Search the products that are components of this bom of prod_id #Search the products that are components of this bom of prod_id
boms = bom_obj.search(cr, uid, [('bom_id', '=', bom_id)], context=context) bom = bom_obj.browse(cr, uid, bom_id, context=context)
#Call compute_price on these subproducts #Call compute_price on these subproducts
prod_set = set([x.product_id.id for x in bom_obj.browse(cr, uid, boms, context=context)]) prod_set = set([x.product_id.id for x in bom.bom_line_ids])
res = self.compute_price(cr, uid, list(prod_set), recursive=recursive, test=test, real_time_accounting = real_time_accounting, context=context) res = self.compute_price(cr, uid, list(prod_set), recursive=recursive, test=test, real_time_accounting = real_time_accounting, context=context)
if test: if test:
testdict.update(res) testdict.update(res)
@ -63,10 +63,10 @@ class product_product(osv.osv):
context={} context={}
price = 0 price = 0
uom_obj = self.pool.get("product.uom") uom_obj = self.pool.get("product.uom")
if bom.bom_line_ids: tmpl_obj = self.pool.get('product.template')
for sbom in bom.bom_line_ids: for sbom in bom.bom_line_ids:
my_qty = sbom.bom_line_ids and 1.0 or sbom.product_qty my_qty = sbom.product_qty
price += uom_obj._compute_price(cr, uid, sbom.product_id.uom_id.id, sbom.product_id.standard_price, sbom.product_uom.id) * my_qty price += uom_obj._compute_price(cr, uid, sbom.product_id.uom_id.id, sbom.product_id.standard_price, sbom.product_uom.id) * my_qty
if bom.routing_id: if bom.routing_id:
for wline in bom.routing_id.workcenter_lines: for wline in bom.routing_id.workcenter_lines:
@ -79,15 +79,16 @@ class product_product(osv.osv):
#Convert on product UoM quantities #Convert on product UoM quantities
if price > 0: if price > 0:
price = uom_obj._compute_price(cr, uid, bom.product_uom.id, price / bom.product_qty, bom.product_id.uom_id.id) price = uom_obj._compute_price(cr, uid, bom.product_uom.id, price / bom.product_qty, bom.product_id.uom_id.id)
product = self.pool.get("product.product").browse(cr, uid, bom.product_id.id, context=context)
product = tmpl_obj.browse(cr, uid, bom.product_tmpl_id.id, context=context)
if not test: if not test:
if (product.valuation != "real_time" or not real_time_accounting): if (product.valuation != "real_time" or not real_time_accounting):
self.write(cr, uid, [bom.product_id.id], {'standard_price' : price}, context=context) tmpl_obj.write(cr, uid, [product.id], {'standard_price' : price}, context=context)
else: else:
#Call wizard function here #Call wizard function here
wizard_obj = self.pool.get("stock.change.standard.price") wizard_obj = self.pool.get("stock.change.standard.price")
ctx = context.copy() ctx = context.copy()
ctx.update({'active_id': bom.product_id.id}) ctx.update({'active_id': product.id, 'active_model': 'product.template'})
wiz_id = wizard_obj.create(cr, uid, {'new_price': price}, context=ctx) wiz_id = wizard_obj.create(cr, uid, {'new_price': price}, context=ctx)
wizard_obj.change_price(cr, uid, [wiz_id], context=ctx) wizard_obj.change_price(cr, uid, [wiz_id], context=ctx)
return price return price

View File

@ -679,12 +679,12 @@ class purchase_order(osv.osv):
def action_cancel(self, cr, uid, ids, context=None): def action_cancel(self, cr, uid, ids, context=None):
for purchase in self.browse(cr, uid, ids, context=context): for purchase in self.browse(cr, uid, ids, context=context):
for pick in purchase.picking_ids: for pick in purchase.picking_ids:
if pick.state not in ('draft', 'cancel'): for move in pick.move_lines:
raise osv.except_osv( if pick.state == 'done':
_('Unable to cancel the purchase order %s.') % (purchase.name), raise osv.except_osv(
_('First cancel all receipts related to this purchase order.')) _('Unable to cancel the purchase order %s.') % (purchase.name),
self.pool.get('stock.picking') \ _('You have already received some goods for it. '))
.signal_workflow(cr, uid, map(attrgetter('id'), purchase.picking_ids), 'button_cancel') self.pool.get('stock.picking').action_cancel(cr, uid, [x.id for x in purchase.picking_ids if x.state != 'cancel'], context=context)
for inv in purchase.invoice_ids: for inv in purchase.invoice_ids:
if inv and inv.state not in ('cancel', 'draft'): if inv and inv.state not in ('cancel', 'draft'):
raise osv.except_osv( raise osv.except_osv(
@ -692,10 +692,6 @@ class purchase_order(osv.osv):
_('You must first cancel all invoices related to this purchase order.')) _('You must first cancel all invoices related to this purchase order.'))
self.pool.get('account.invoice') \ self.pool.get('account.invoice') \
.signal_workflow(cr, uid, map(attrgetter('id'), purchase.invoice_ids), 'invoice_cancel') .signal_workflow(cr, uid, map(attrgetter('id'), purchase.invoice_ids), 'invoice_cancel')
self.pool['purchase.order.line'].write(cr, uid, [l.id for l in purchase.order_line],
{'state': 'cancel'})
self.write(cr, uid, ids, {'state': 'cancel'})
self.set_order_line_status(cr, uid, ids, 'cancel', context=context)
self.signal_workflow(cr, uid, ids, 'purchase_cancel') self.signal_workflow(cr, uid, ids, 'purchase_cancel')
return True return True
@ -1156,6 +1152,7 @@ class purchase_order_line(osv.osv):
self.write(cr, uid, ids, {'state': 'confirmed'}, context=context) self.write(cr, uid, ids, {'state': 'confirmed'}, context=context)
return True return True
class procurement_rule(osv.osv): class procurement_rule(osv.osv):
_inherit = 'procurement.rule' _inherit = 'procurement.rule'
@ -1287,7 +1284,7 @@ class procurement_order(osv.osv):
product = prod_obj.browse(cr, uid, procurement.product_id.id, context=new_context) product = prod_obj.browse(cr, uid, procurement.product_id.id, context=new_context)
taxes_ids = procurement.product_id.supplier_taxes_id taxes_ids = procurement.product_id.supplier_taxes_id
taxes = acc_pos_obj.map_tax(cr, uid, partner.property_account_position, taxes_ids) taxes = acc_pos_obj.map_tax(cr, uid, partner.property_account_position, taxes_ids)
name = product.partner_ref name = product.display_name
if product.description_purchase: if product.description_purchase:
name += '\n' + product.description_purchase name += '\n' + product.description_purchase

View File

@ -202,8 +202,7 @@
<button name="view_picking" string="Receive Products" type="object" attrs="{'invisible': ['|', ('shipped','=',True), ('state','!=', 'approved')]}" class="oe_highlight"/> <button name="view_picking" string="Receive Products" type="object" attrs="{'invisible': ['|', ('shipped','=',True), ('state','!=', 'approved')]}" class="oe_highlight"/>
<button name="view_invoice" string="Receive Invoice" type="object" attrs="{'invisible': ['|', ('invoice_method','in', ['picking', 'manual']), '|', ('state','!=', 'approved'), ('invoiced','=',True) ]}" class="oe_highlight"/> <button name="view_invoice" string="Receive Invoice" type="object" attrs="{'invisible': ['|', ('invoice_method','in', ['picking', 'manual']), '|', ('state','!=', 'approved'), ('invoiced','=',True) ]}" class="oe_highlight"/>
<button name="action_cancel_draft" states="cancel,sent,confirmed" string="Set to Draft" type="object" /> <button name="action_cancel_draft" states="cancel,sent,confirmed" string="Set to Draft" type="object" />
<button name="purchase_cancel" states="draft,confirmed,sent,bid" string="Cancel"/> <button name="action_cancel" states="draft,confirmed,sent,bid,approved,except_picking,except_invoice" string="Cancel" type="object" />
<button name="action_cancel" states="approved,except_picking,except_invoice" string="Cancel" type="object" />
<field name="state" widget="statusbar" statusbar_visible="draft,sent,bid,approved,done" statusbar_colors='{"except_picking":"red","except_invoice":"red","confirmed":"blue"}' readonly="1"/> <field name="state" widget="statusbar" statusbar_visible="draft,sent,bid,approved,done" statusbar_colors='{"except_picking":"red","except_invoice":"red","confirmed":"blue"}' readonly="1"/>
</header> </header>
<sheet> <sheet>

View File

@ -139,6 +139,25 @@ class stock_picking(osv.osv):
}), }),
} }
def _create_invoice_from_picking(self, cr, uid, picking, vals, context=None):
purchase_obj = self.pool.get("purchase.order")
purchase_line_obj = self.pool.get('purchase.order.line')
invoice_line_obj = self.pool.get('account.invoice.line')
invoice_id = super(stock_picking, self)._create_invoice_from_picking(cr, uid, picking, vals, context=context)
if picking.move_lines and picking.move_lines[0].purchase_line_id:
purchase_id = picking.move_lines[0].purchase_line_id.order_id.id
purchase_line_ids = purchase_line_obj.search(cr, uid, [('order_id', '=', purchase_id), ('product_id.type', '=', 'service'), ('invoiced', '=', False)], context=context)
if purchase_line_ids:
inv_lines = []
for po_line in purchase_line_obj.browse(cr, uid, purchase_line_ids, context=context):
acc_id = purchase_obj._choose_account_from_po_line(cr, uid, po_line, context=context)
inv_line_data = purchase_obj._prepare_inv_line(cr, uid, acc_id, po_line, context=context)
inv_line_id = invoice_line_obj.create(cr, uid, inv_line_data, context=context)
inv_lines.append(inv_line_id)
po_line.write({'invoice_lines': [(4, inv_line_id)]})
invoice_line_obj.write(cr, uid, inv_lines, {'invoice_id': invoice_id}, context=context)
return invoice_id
class stock_warehouse(osv.osv): class stock_warehouse(osv.osv):
_inherit = 'stock.warehouse' _inherit = 'stock.warehouse'

View File

@ -243,8 +243,9 @@ class sale_order(osv.osv):
'company_id': fields.many2one('res.company', 'Company'), 'company_id': fields.many2one('res.company', 'Company'),
'section_id': fields.many2one('crm.case.section', 'Sales Team'), 'section_id': fields.many2one('crm.case.section', 'Sales Team'),
'procurement_group_id': fields.many2one('procurement.group', 'Procurement group', copy=False), 'procurement_group_id': fields.many2one('procurement.group', 'Procurement group', copy=False),
'product_id': fields.related('order_line', 'product_id', type='many2one', relation='product.product', string='Product'),
} }
_defaults = { _defaults = {
'date_order': fields.datetime.now, 'date_order': fields.datetime.now,
'order_policy': 'manual', 'order_policy': 'manual',

View File

@ -250,6 +250,7 @@
<field name="user_id"/> <field name="user_id"/>
<field name="section_id" string="Sales Team" groups="base.group_multi_salesteams"/> <field name="section_id" string="Sales Team" groups="base.group_multi_salesteams"/>
<field name="project_id"/> <field name="project_id"/>
<field name="product_id"/>
<filter string="My" domain="[('user_id','=',uid)]" name="my_sale_orders_filter"/> <filter string="My" domain="[('user_id','=',uid)]" name="my_sale_orders_filter"/>
<separator/> <separator/>
<filter string="Quotations" name="draft" domain="[('state','in',('draft','sent'))]" help="Sales Order that haven't yet been confirmed"/> <filter string="Quotations" name="draft" domain="[('state','in',('draft','sent'))]" help="Sales Order that haven't yet been confirmed"/>

View File

@ -789,12 +789,12 @@ class stock_picking(osv.osv):
* Cancelled: has been cancelled, can't be confirmed anymore""" * Cancelled: has been cancelled, can't be confirmed anymore"""
), ),
'priority': fields.function(get_min_max_date, multi="min_max_date", fnct_inv=_set_priority, type='selection', selection=procurement.PROCUREMENT_PRIORITIES, string='Priority', 'priority': fields.function(get_min_max_date, multi="min_max_date", fnct_inv=_set_priority, type='selection', selection=procurement.PROCUREMENT_PRIORITIES, string='Priority',
store={'stock.move': (_get_pickings, ['priority'], 20)}, states={'done': [('readonly', True)], 'cancel': [('readonly', True)]}, select=1, help="Priority for this picking. Setting manually a value here would set it as priority for all the moves", store={'stock.move': (_get_pickings, ['priority', 'picking_id'], 20)}, states={'done': [('readonly', True)], 'cancel': [('readonly', True)]}, select=1, help="Priority for this picking. Setting manually a value here would set it as priority for all the moves",
track_visibility='onchange', required=True), track_visibility='onchange', required=True),
'min_date': fields.function(get_min_max_date, multi="min_max_date", fnct_inv=_set_min_date, 'min_date': fields.function(get_min_max_date, multi="min_max_date", fnct_inv=_set_min_date,
store={'stock.move': (_get_pickings, ['date_expected'], 20)}, type='datetime', states={'done': [('readonly', True)], 'cancel': [('readonly', True)]}, string='Scheduled Date', select=1, help="Scheduled time for the first part of the shipment to be processed. Setting manually a value here would set it as expected date for all the stock moves.", track_visibility='onchange'), store={'stock.move': (_get_pickings, ['date_expected', 'picking_id'], 20)}, type='datetime', states={'done': [('readonly', True)], 'cancel': [('readonly', True)]}, string='Scheduled Date', select=1, help="Scheduled time for the first part of the shipment to be processed. Setting manually a value here would set it as expected date for all the stock moves.", track_visibility='onchange'),
'max_date': fields.function(get_min_max_date, multi="min_max_date", 'max_date': fields.function(get_min_max_date, multi="min_max_date",
store={'stock.move': (_get_pickings, ['date_expected'], 20)}, type='datetime', string='Max. Expected Date', select=2, help="Scheduled time for the last part of the shipment to be processed"), store={'stock.move': (_get_pickings, ['date_expected', 'picking_id'], 20)}, type='datetime', string='Max. Expected Date', select=2, help="Scheduled time for the last part of the shipment to be processed"),
'date': fields.datetime('Creation Date', help="Creation Date, usually the time of the order", select=True, states={'done': [('readonly', True)], 'cancel': [('readonly', True)]}, track_visibility='onchange'), 'date': fields.datetime('Creation Date', help="Creation Date, usually the time of the order", select=True, states={'done': [('readonly', True)], 'cancel': [('readonly', True)]}, track_visibility='onchange'),
'date_done': fields.datetime('Date of Transfer', help="Date of Completion", states={'done': [('readonly', True)], 'cancel': [('readonly', True)]}, copy=False), 'date_done': fields.datetime('Date of Transfer', help="Date of Completion", states={'done': [('readonly', True)], 'cancel': [('readonly', True)]}, copy=False),
'move_lines': fields.one2many('stock.move', 'picking_id', 'Internal Moves', states={'done': [('readonly', True)], 'cancel': [('readonly', True)]}, copy=True), 'move_lines': fields.one2many('stock.move', 'picking_id', 'Internal Moves', states={'done': [('readonly', True)], 'cancel': [('readonly', True)]}, copy=True),
@ -938,7 +938,8 @@ class stock_picking(osv.osv):
'pack_operation_ids': [], 'pack_operation_ids': [],
'backorder_id': picking.id, 'backorder_id': picking.id,
}) })
self.message_post(cr, uid, picking.id, body=_("Back order <em>%s</em> <b>created</b>.") % (picking.name), context=context) backorder = self.browse(cr, uid, backorder_id, context=context)
self.message_post(cr, uid, picking.id, body=_("Back order <em>%s</em> <b>created</b>.") % (backorder.name), context=context)
move_obj = self.pool.get("stock.move") move_obj = self.pool.get("stock.move")
move_obj.write(cr, uid, backorder_move_ids, {'picking_id': backorder_id}, context=context) move_obj.write(cr, uid, backorder_move_ids, {'picking_id': backorder_id}, context=context)

View File

@ -77,7 +77,7 @@
<field name="product_id" ref="product.product_product_6"/> <field name="product_id" ref="product.product_product_6"/>
<field name="product_uom_id" ref="product.product_uom_unit"/> <field name="product_uom_id" ref="product.product_uom_unit"/>
<field name="inventory_id" ref="stock_inventory_0"/> <field name="inventory_id" ref="stock_inventory_0"/>
<field name="product_qty">10.0</field> <field name="product_qty">500.0</field>
<field name="location_id" ref="stock_location_components"/> <field name="location_id" ref="stock_location_components"/>
</record> </record>
<record id="stock_inventory_line_4" model="stock.inventory.line"> <record id="stock_inventory_line_4" model="stock.inventory.line">

View File

@ -687,18 +687,18 @@
<field name="note" placeholder="Add an internal note..." class="oe_inline"/> <field name="note" placeholder="Add an internal note..." class="oe_inline"/>
</page> </page>
<page string="Operations" attrs="{'invisible': ['|', ('state','!=','done'), ('pack_operation_ids','=',[])]}"> <page string="Operations" attrs="{'invisible': ['|', ('state','!=','done'), ('pack_operation_ids','=',[])]}">
<field name="pack_operation_ids"> <field name="pack_operation_ids" context="{'default_picking_id': active_id, 'default_location_id': location_id, 'default_location_dest_id': location_dest_id}">
<tree editable="top"> <tree editable="top">
<field name="package_id" groups="stock.group_tracking_lot"/> <field name="package_id" groups="stock.group_tracking_lot"/>
<field name="product_id"/> <field name="product_id" on_change="product_id_change(product_id, product_uom_id, product_qty)"/>
<field name="product_uom_id" groups="product.group_uom"/> <field name="product_uom_id" groups="product.group_uom"/>
<field name="lot_id" domain="[('product_id','=?', product_id)]" context="{'product_id': product_id}" groups="stock.group_production_lot"/> <field name="lot_id" domain="[('product_id','=?', product_id)]" context="{'product_id': product_id}" groups="stock.group_production_lot"/>
<field name="picking_id" invisible="1"/> <field name="picking_id" invisible="1"/>
<field name="owner_id" groups="stock.group_tracking_owner"/> <field name="owner_id" groups="stock.group_tracking_owner"/>
<field name="product_qty" attrs="{'required': [('product_id', '!=', False)]}"/> <field name="product_qty" attrs="{'required': [('product_id', '!=', False)]}"/>
<field name="location_id"/> <field name="location_id" domain="[('id', 'child_of', parent.location_id)]"/>
<field name="location_dest_id"/> <field name="location_dest_id" domain="[('id', 'child_of', parent.location_dest_id)]"/>
<field name="result_package_id" groups="stock.group_tracking_lot"/> <field name="result_package_id" groups="stock.group_tracking_lot" context="{'location_id': location_dest_id}"/>
</tree> </tree>
</field> </field>
<p class="oe_grey" groups="stock.group_tracking_lot"> <p class="oe_grey" groups="stock.group_tracking_lot">

View File

@ -98,7 +98,8 @@ class stock_change_product_qty(osv.osv_memory):
'product_id': data.product_id.id, 'product_id': data.product_id.id,
'location_id': data.location_id.id, 'location_id': data.location_id.id,
'lot_id': data.lot_id.id}, context=context) 'lot_id': data.lot_id.id}, context=context)
th_qty = data.product_id.qty_available product = data.product_id.with_context(location=data.location_id.id)
th_qty = product.qty_available
line_data = { line_data = {
'inventory_id': inventory_id, 'inventory_id': inventory_id,
'product_qty': data.new_quantity, 'product_qty': data.new_quantity,

View File

@ -191,7 +191,7 @@ class stock_picking(osv.osv):
pick = self.browse(cr, uid, picking_id, context=context) pick = self.browse(cr, uid, picking_id, context=context)
moves = [x.id for x in pick.move_lines] moves = [x.id for x in pick.move_lines]
move_obj= self.pool.get("stock.move") move_obj= self.pool.get("stock.move")
move_obj.write(cr, uid, moves, {'invoice_state': pick.invoice_state}) move_obj.write(cr, uid, moves, {'invoice_state': pick.invoice_state}, context=context)
_columns = { _columns = {
'invoice_state': fields.function(__get_invoice_state, type='selection', selection=[ 'invoice_state': fields.function(__get_invoice_state, type='selection', selection=[