<data>
<!-- Delivery Carriers -->
<menuitem id="menu_delivery" name="Delivery" parent="stock.menu_stock_configuration" sequence="4"/>
--
++
<record id="view_delivery_carrier_tree" model="ir.ui.view">
<field name="name">delivery.carrier.tree</field>
<field name="model">delivery.carrier</field>
<field name="view_mode">tree,form</field>
</record>
<menuitem action="action_delivery_carrier_form" id="menu_action_delivery_carrier_form" parent="menu_delivery"/>
--
++
<!-- Delivery Grids -->
<record id="view_delivery_grid_tree" model="ir.ui.view">
<field name="name">delivery.grid.tree</field>
</tree>
</field>
</record>
--
++
<record id="view_delivery_grid_form" model="ir.ui.view">
<field name="name">delivery.grid.form</field>
<field name="model">delivery.grid</field>
<field name="view_mode">tree,form</field>
</record>
<menuitem action="action_delivery_grid_form" id="menu_action_delivery_grid_form" parent="menu_delivery"/>
--
++
<record id="view_delivery_grid_line_form" model="ir.ui.view">
<field name="name">delivery.grid.line.form</field>
<field name="model">delivery.grid.line</field>
</tree>
</field>
</record>
--
++
<record id="view_order_withcarrier_form" model="ir.ui.view">
<field name="name">delivery.sale.order_withcarrier.form.view</field>
<field name="type">form</field>
</separator>
</field>
</record>
--
-- <record id="view_picking_withcarrier_form" model="ir.ui.view">
-- <field name="name">delivery.stock.picking_withcarrier.form.view</field>
-- <field name="type">form</field>
-- <field name="model">stock.picking</field>
-- <field name="inherit_id" ref="stock.view_picking_delivery_form"/>
-- <field name="arch" type="xml">
-- <field name="address_id" position="after">
-- <field name="volume"/>
-- <field name="weight"/>
-- <field name="carrier_id"/>
-- </field>
-- </field>
-- </record>
++
<record id="view_picking_withcarrier_out_form" model="ir.ui.view">
<field name="name">delivery.stock.picking_withcarrier.out.form.view</field>
<field name="type">form</field>
<field name="inherit_id" ref="stock.view_picking_out_form"/>
<field name="arch" type="xml">
<field name="address_id" position="after">
-- <field name="volume"/>
<field name="weight"/>
<field name="carrier_id"/>
</field>
</field>
</record>
--
++
<record id="view_picking_withcarrier_delivery_form" model="ir.ui.view">
<field name="name">delivery.stock.picking_withcarrier.delivery.form.view</field>
<field name="type">form</field>
<field name="inherit_id" ref="stock.view_picking_delivery_form"/>
<field name="arch" type="xml">
<field name="address_id" position="after">
-- <field name="volume"/>
<field name="weight"/>
<field name="carrier_id"/>
</field>
</field>
</record>
--
++
<record id="action_picking_tree4" model="ir.actions.act_window">
<field name="name">Packings to be invoiced</field>
<field name="res_model">stock.picking</field>
<field name="domain">[('invoice_state','=','2binvoiced'),('state','=','done'),('type','=','out')]</field>
</record>
<menuitem action="action_picking_tree4" id="menu_action_picking_tree3" parent="stock.menu_action_picking_tree"/>
--
--
++
<record id="action_picking_tree5" model="ir.actions.act_window">
<field name="name">Generate Draft Invoices On Receptions</field>
<field name="res_model">stock.picking</field>
<field name="domain">[('invoice_state','=','2binvoiced'),('state','=','done'),('type','=','in')]</field>
</record>
<menuitem action="action_picking_tree5" id="menu_action_picking_tree5" parent="stock.menu_action_picking_tree4"/>
--
--
++
</data>
</openerp>
help='Coefficient to convert UOM to UOS\n'
' uom = uos * coeff'),
'mes_type': fields.selection((('fixed', 'Fixed'), ('variable', 'Variable')), 'Measure Type', required=True),
- 'tracking': fields.boolean('Track Lots', help="Force to use a Production Lot number during stock operations for traceability."),
- 'track_production' : fields.boolean('Track Production Lots' , help="Force to use a Production Lot number during Production"),
- 'track_incoming' : fields.boolean('Track Incomming Lots', help="Force to use a Production Lot number during Purchase"),
- 'track_outgoing' : fields.boolean('Track Outging Lots', help="Force to use a Production Lot number during Sale"),
'seller_delay': fields.function(_calc_seller_delay, method=True, type='integer', string='Supplier Lead Time', help="This is the average delay in days between the purchase order confirmation and the reception of goods for this product and for the default supplier. It is used by the scheduler to order requests based on reordering delays."),
'seller_ids': fields.one2many('product.supplierinfo', 'product_id', 'Partners'),
'loc_rack': fields.char('Rack', size=16),
</group>
<group colspan="2" col="2" name="uom">
- <separator string="Lots" colspan="2"/>
- <separator string="UOM" colspan="2"/>
++ <separator string="UOM" colspan="2"/>
<field name="uom_id" on_change="onchange_uom(uom_id,uom_po_id)"/>
<field name="uom_po_id"/>
- <field name="tracking"/>
- </group>
- <group colspan="4" col="4" name="lot">
- <separator string="Lots" colspan="4"/>
- <field name="track_production" />
- <field name="track_incoming" />
- <field name="track_outgoing" />
-
-
</group>
<group colspan="2" col="2" name="uos" groups="product.group_uos">
'virtual_available': fields.function(_product_virtual_available, method=True, type='float', string='Virtual Stock'),
'incoming_qty': fields.function(_product_incoming_qty, method=True, type='float', string='Incoming'),
'outgoing_qty': fields.function(_product_outgoing_qty, method=True, type='float', string='Outgoing'),
++ 'track_production' : fields.boolean('Track Production Lots' , help="Force to use a Production Lot during production order"),
++ 'track_incoming' : fields.boolean('Track Incomming Lots', help="Force to use a Production Lot during receptions"),
++ 'track_outgoing' : fields.boolean('Track Outging Lots', help="Force to use a Production Lot during deliveries"),
}
product_product()
<field name="incoming_qty"/>
<field name="outgoing_qty"/>
</group>
++ <group colspan="2" col="2" name="lot" groups="base.group_extended">
++ <separator string="Lots" colspan="4"/>
++ <field name="track_production" />
++ <field name="track_incoming" />
++ <field name="track_outgoing" />
++ </group>
</group>
</field>
</record>
if 'location_id' not in context:
locations = self.pool.get('stock.location').search(cr, uid, [('usage','=','internal')], context=context)
else:
-- locations = self.pool.get('stock.location').search(cr, uid, [('location_id','child_of', [context['location_id']])], context=context)
++ locations = [context['location_id']]
res = {}.fromkeys(ids, 0.0)
cr.execute('''select
prodlot_id,
'name': fields.char('Serial', size=64, required=True),
'ref': fields.char('Internal Ref.', size=64),
'product_id': fields.many2one('product.product','Product',required=True),
-- 'date': fields.datetime('Date create', required=True),
++ 'date': fields.datetime('Created Date', required=True),
'stock_available': fields.function(_get_stock, method=True, type="float", string="Available", select="2"),
'revisions': fields.one2many('stock.production.lot.revision','lot_id','Revisions'),
}
return (res and res[0]) or False
_name = "stock.move"
_description = "Stock Move"
-
+
+ def _check_tracking(self, cr, uid, ids):
+ for move in self.browse(cr, uid, ids):
+ if not move.prodlot_id and \
+ (move.state == 'done' and \
+ ( \
+ (move.product_id.track_production and move.location_id.usage=='production') or \
+ (move.product_id.track_production and move.location_dest_id.usage=='production') or \
+ (move.product_id.track_incoming and move.location_id.usage=='supplier') or \
+ (move.product_id.track_outgoing and move.location_dest_id.usage=='customer') \
+ )):
- return False
-
++ return False
+ return True
+
+ def _check_product_lot(self, cr, uid, ids):
+ for move in self.browse(cr, uid, ids):
+ if move.prodlot_id and (move.prodlot_id.product_id.id != move.product_id.id):
+ return False
+ return True
+
_columns = {
'name': fields.char('Name', size=64, required=True, select=True),
'priority': fields.selection([('0','Not urgent'),('1','Urgent')], 'Priority'),
'price_unit': fields.float('Unit Price',
digits=(16, int(config['price_accuracy']))),
}
+
+ _constraints = [
+ (_check_tracking,
- 'Production lot must be set',
++ 'You must assign a production lot for this product',
+ ['prodlot_id']),
+ (_check_product_lot,
- 'Move Production lot must be on the same Product Production lot',
++ 'You try to assign a lot which is not from the same product',
+ ['prodlot_id'])]
+
def _default_location_destination(self, cr, uid, context={}):
if context.get('move_line', []):
return context['move_line'][0][2]['location_dest_id']
ON stock_move (location_id, location_dest_id, product_id, state)')
cursor.commit()
-
+ def onchange_lot_id(self, cr, uid, context, prodlot_id=False,product_qty=False, loc_id=False):
++ print uid, prodlot_id, product_qty, loc_id
+ if not prodlot_id or not loc_id:
+ return {}
- prodlot = self.pool.get('stock.production.lot').browse(cr, uid, [prodlot_id])[0]
- location=self.pool.get('stock.location').browse(cr,uid,[loc_id])[0]
- warning={}
- if not prodlot.stock_available or (location.usage == 'internal' and product_qty < prodlot.stock_available):
- warning={'title':'Warning!','message':'Less stock available than given quantity'}
++ prodlot = self.pool.get('stock.production.lot').browse(cr, uid, prodlot_id)
++ location=self.pool.get('stock.location').browse(cr,uid,loc_id)
++ warning={}
++ if (location.usage == 'internal') and (product_qty > (prodlot.stock_available or 0.0)):
++ print 'Warning'
++ warning={
++ 'title':'Bad Lot Assignation !',
++ 'message':'You are moving %.2f products but only %.2f available in this lot.' % (product_qty,prodlot.stock_available or 0.0)
++ }
+ return {'warning':warning}
def onchange_product_id(self, cr, uid, context, prod_id=False, loc_id=False, loc_dest_id=False):
if not prod_id:
def _chain_compute(self, cr, uid, moves, context={}):
result = {}
for m in moves:
-- dest = self.pool.get('stock.location').chained_location_get(cr, uid, m.location_dest_id, m.picking_id and m.picking_id.address_id and m.picking_id.address_id.partner_id, m.product_id, context)
++ dest = self.pool.get('stock.location').chained_location_get(
++ cr,
++ uid,
++ m.location_dest_id,
++ m.picking_id and m.picking_id.address_id and m.picking_id.address_id.partner_id,
++ m.product_id,
++ context
++ )
if dest:
if dest[1]=='transparent':
self.write(cr, uid, [m.id], {
wf_service.trg_trigger(uid, 'stock.move', id, cr)
return True
--
def unlink(self, cr, uid, ids, context=None):
for move in self.browse(cr, uid, ids, context=context):
if move.state != 'draft':
<form string="Move Lines">
<field name="address_id" invisible="True" context="{'context_display':'partner'}"/>
<field name="picking_id" invisible="True"/>
-- <field domain="[('picking_id','<>',picking_id),('state','in',['confirmed','assigned'])]" name="move_ids" select="1"/><newline/>
++ <field domain="[('picking_id','<>',picking_id),('state','in',['confirmed','assigned']),('picking_id.address_id','=',address_id)]" name="move_ids" nolabel="1"/><newline/>
<group colspan="4">
<button special="cancel" string="Cancel"/>
<button name="action_move" string="Add" type="object"/>
<group colspan="4" col="6">
<field name="address_id" select="2" context="{'context_display':'partner'}"/>
<field name="type"/>
-- <field name="name"/>
++ <field name="name" readonly="1"/>
<field name="date"/>
<field name="min_date" select="2"/>
-- <field name="address_id" select="2"/>
</group>
<notebook>
<page string="General Information">
<field name="date_planned"/>
<field name="address_id" select="1" context="{'context_display':'partner'}"/>
<field groups="base.group_extended" name="product_packaging"/>
-- <field name="prodlot_id" select="2" context="{'location_id':location_id, 'product_id':product_id}" domain="[('product_id','=',product_id)]"/>
++ <field name="prodlot_id" select="2" context="{'location_id':location_id, 'product_id':product_id}" domain="[('product_id','=',product_id)]" on_change="onchange_lot_id(prodlot_id,product_qty, location_id)"/>
<field groups="base.group_extended" name="tracking_id" select="2"/>
<newline/>
<label/>
<field name="arch" type="xml">
<form string="Packing list">
<group col="6" colspan="4">
-- <field name="name" select="1"/>
-- <field name="partner_id" select="1"/>
-- <field name="date" select="1"/>
++ <field name="address_id" select="1"/>
++ <field name="name" select="1" readonly="1"/>
<field name="min_date" select="1"/>
-- <field name="backorder_id" select="2"/>
++ <field name="backorder_id" select="2" readonly="1"/>
</group>
<notebook colspan="4">
<page string="General Information">
<field invisible="1" name="date"/>
<field name="date_planned"/>
<field groups="base.group_extended" name="product_packaging"/>
-- <field name="prodlot_id" select="2" context="{'location_id':location_id, 'product_id':product_id}" domain="[('product_id','=',product_id)]"/>
++ <field name="prodlot_id" select="2" context="{'location_id':location_id, 'product_id':product_id}" domain="[('product_id','=',product_id)]" on_change="onchange_lot_id(prodlot_id,product_qty, location_id)"/>
<field groups="base.group_extended" name="tracking_id" select="1"/>
<separator colspan="4" string="Move State"/>
<field name="state" select="1"/>
<field name="active" select="2"/>
<newline/>
<field name="move_type"/>
++ <field name="date" select="1"/>
</page>
</notebook>
</form>
<field name="view_id" ref="view_picking_delivery_form"/>
<field name="act_window_id" ref="action_picking_tree_delivery"/>
</record>
++ <record id="action_picking_tree_delivery_view2_calendar" model="ir.actions.act_window.view">
++ <field eval="3" name="sequence"/>
++ <field name="view_mode">calendar</field>
++ <field name="act_window_id" ref="action_picking_tree_delivery"/>
++ </record>
<menuitem action="action_picking_tree_delivery" groups="base.group_extended" id="menu_action_picking_tree_delivery" parent="menu_stock_root" sequence="20"/>
<field name="view_id" ref="view_picking_delivery_form"/>
<field name="act_window_id" ref="action_picking_tree2_delivery"/>
</record>
++ <record id="action_picking_tree_delivery_view2_toproc_cal" model="ir.actions.act_window.view">
++ <field eval="3" name="sequence"/>
++ <field name="view_mode">calendar</field>
++ <field name="act_window_id" ref="action_picking_tree2_delivery"/>
++ </record>
<menuitem action="action_picking_tree2_delivery" id="menu_picking_waiting_delivery" parent="menu_action_picking_tree_delivery"/>
<record id="action_picking_tree3_delivery" model="ir.actions.act_window">
<field name="view_id" ref="view_picking_delivery_form"/>
<field name="act_window_id" ref="action_picking_tree3_delivery"/>
</record>
++ <record id="action_picking_tree_delivery_view2_waiting_cal" model="ir.actions.act_window.view">
++ <field eval="3" name="sequence"/>
++ <field name="view_mode">calendar</field>
++ <field name="act_window_id" ref="action_picking_tree3_delivery"/>
++ </record>
<menuitem action="action_picking_tree3_delivery" id="menu_action_picking_tree3_delivery" parent="menu_action_picking_tree_delivery"/>
<record id="action_picking_calendar_delivery" model="ir.actions.act_window">
<field name="arch" type="xml">
<form string="Packing list">
<group col="6" colspan="4">
-- <field name="name" select="1"/>
<field name="address_id" select="2"/>
-- <field name="backorder_id" select="2"/>
++ <field name="name" select="1" readonly="1"/>
<field name="min_date" select="2"/>
-- <field name="date" select="2"/>
++ <field name="backorder_id" select="2" readonly="1"/>
</group>
<notebook colspan="4">
<page string="General Information">
<field invisible="1" name="date"/>
<field name="date_planned"/>
<field groups="base.group_extended" name="product_packaging"/>
-- <field name="prodlot_id" select="1" context="{'location_id':location_id, 'product_id':product_id}" domain="[('product_id','=',product_id)]"/>
++ <field name="prodlot_id" select="1" context="{'location_id':location_id, 'product_id':product_id}" domain="[('product_id','=',product_id)]" on_change="onchange_lot_id(prodlot_id,product_qty, location_id)"/>
<field groups="base.group_extended" name="tracking_id" select="1"/>
<separator colspan="4" string="Move State"/>
<field name="state" select="1"/>
<field name="auto_picking"/>
<newline/>
<field name="move_type"/>
++ <field name="date" select="2"/>
</page>
</notebook>
</form>
<field name="view_id" ref="view_picking_out_form"/>
<field name="act_window_id" ref="action_picking_tree"/>
</record>
++ <record id="action_picking_tree_out_view2_waiting_cal" model="ir.actions.act_window.view">
++ <field eval="3" name="sequence"/>
++ <field name="view_mode">calendar</field>
++ <field name="act_window_id" ref="action_picking_tree"/>
++ </record>
<menuitem action="action_picking_tree" id="menu_action_picking_tree" parent="menu_stock_root" sequence="19"/>
<record id="action_picking_tree2" model="ir.actions.act_window">
<field name="view_id" ref="view_picking_out_form"/>
<field name="act_window_id" ref="action_picking_tree2"/>
</record>
++ <record id="action_picking_tree2_out_view2_cal" model="ir.actions.act_window.view">
++ <field eval="3" name="sequence"/>
++ <field name="view_mode">calendar</field>
++ <field name="act_window_id" ref="action_picking_tree2"/>
++ </record>
<menuitem action="action_picking_tree2" id="menu_picking_waiting" parent="menu_action_picking_tree"/>
<record id="action_picking_tree3" model="ir.actions.act_window">
<field name="view_id" ref="view_picking_out_form"/>
<field name="act_window_id" ref="action_picking_tree3"/>
</record>
++ <record id="action_picking_tree3_out_view2_cal" model="ir.actions.act_window.view">
++ <field eval="3" name="sequence"/>
++ <field name="view_mode">calendar</field>
++ <field name="act_window_id" ref="action_picking_tree3"/>
++ </record>
<menuitem action="action_picking_tree3" id="menu_action_picking_tree3" parent="menu_action_picking_tree"/>
#
<newline/>
<field groups="base.group_extended" name="product_packaging"/>
<newline/>
-- <field name="prodlot_id" select="1" context="{'location_id':location_id, 'product_id':product_id}" domain="[('product_id','=',product_id)]"/>
++ <field name="prodlot_id" select="1" context="{'location_id':location_id, 'product_id':product_id}" domain="[('product_id','=',product_id)]" on_change="onchange_lot_id(prodlot_id,product_qty, location_id)"/>
<field groups="base.group_extended" name="tracking_id" select="1"/>
<newline/>
<label/>
</field>
<group col="7" colspan="4">
<label colspan="5"/>
-- <button name="%(act_stock_picking_move_wizard)d" string="Fill From Unreceived Products" type="action"/>
++ <button name="%(act_stock_picking_move_wizard)d" string="Unreceived Products" type="action" states="draft,confirmed,assigned"/>
</group>
<group col="10" colspan="4">
<field name="state" readonly="1"/>
<field name="view_id" ref="view_picking_in_form"/>
<field name="act_window_id" ref="action_picking_tree4"/>
</record>
--
++ <record id="action_invoice_tree5_view2_cal" model="ir.actions.act_window.view">
++ <field eval="3" name="sequence"/>
++ <field name="view_mode">calendar</field>
++ <field name="act_window_id" ref="action_picking_tree4"/>
++ </record>
<menuitem action="action_picking_tree4" id="menu_action_picking_tree4" parent="menu_stock_root" sequence="17"/>
<record id="action_picking_tree5" model="ir.actions.act_window">
<field name="view_id" ref="view_picking_in_form"/>
<field name="act_window_id" ref="action_picking_tree5"/>
</record>
++ <record id="action_invoice_tree6_view2_cal" model="ir.actions.act_window.view">
++ <field eval="3" name="sequence"/>
++ <field name="view_mode">calendar</field>
++ <field name="act_window_id" ref="action_picking_tree5"/>
++ </record>
<menuitem action="action_picking_tree5" id="menu_action_picking_tree5" parent="menu_action_picking_tree4"/>
<record id="action_picking_form" model="ir.actions.act_window">
<field name="res_model">stock.picking</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
-- <field name="view_mode">form,tree</field>
++ <field name="view_mode">form,tree,calendar</field>
<field name="context">{'contact_display': 'partner'}</field>
<field name="domain">[('type','=','in')]</field>
</record>
<field name="view_id" ref="view_picking_in_form"/>
<field name="act_window_id" ref="action_picking_form"/>
</record>
++ <record id="action_picking_form_view2_cal" model="ir.actions.act_window.view">
++ <field eval="3" name="sequence"/>
++ <field name="view_mode">calendar</field>
++ <field name="act_window_id" ref="action_picking_form"/>
++ </record>
<menuitem action="action_picking_form" id="menu_action_picking_form" parent="menu_action_picking_tree4"/>
<record id="action_picking_tree6" model="ir.actions.act_window">
<field name="priority"/>
<field name="address_id" select="1" context="{'context_display':'partner'}"/>
<newline/>
- <field name="prodlot_id" select="1" context="{'location_id':location_id, 'product_id':product_id}" domain="[('product_id','=',product_id)]"/>
- <field name="prodlot_id" select="1" context="{'location_id':location_id, 'product_id':product_id}" on_change="onchange_lot_id(prodlot_id,product_qty, location_id)" domain="[('product_id','=',product_id)]"/>
++ <field name="prodlot_id" select="1" context="{'location_id':location_id, 'product_id':product_id}" domain="[('product_id','=',product_id)]" on_change="onchange_lot_id(prodlot_id,product_qty, location_id)"/>
<field name="tracking_id" select="1"/>
<newline/>
<label/>
<field name="res_model">stock.picking</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
-- <field name="view_mode">tree,form</field>
++ <field name="view_mode">tree,form,calendar</field>
<field name="context">{'contact_display': 'partner'}</field>
</record>
<menuitem action="action_picking_all" id="menu_action_picking_all" parent="menu_traceability_low"/>
class res_partner(osv.osv):
_inherit = 'res.partner'
_columns = {
-- 'sale_warn' : fields.boolean('Sale Order'),
-- 'sale_warn_msg' : fields.char('Message for Sale Order', size=64),
-- 'purchase_warn' : fields.boolean('Purchase Order'),
-- 'purchase_warn_msg' : fields.char('Message for Purchase Order', size=64),
-- 'picking_warn' : fields.boolean('Stock Picking'),
-- 'picking_warn_msg' : fields.char('Message for Stock Picking', size=64),
-- 'invoice_warn' : fields.boolean('Invoice'),
-- 'invoice_warn_msg' : fields.char('Message for Invoice', size=64),
-- }
++ 'sale_warn' : fields.boolean('Sale Order'),
++ 'sale_warn_msg' : fields.char('Message for Sale Order', size=64),
++ 'purchase_warn' : fields.boolean('Purchase Order'),
++ 'purchase_warn_msg' : fields.char('Message for Purchase Order', size=64),
++ 'picking_warn' : fields.boolean('Stock Picking'),
++ 'picking_warn_msg' : fields.char('Message for Stock Picking', size=64),
++ 'invoice_warn' : fields.boolean('Invoice'),
++ 'invoice_warn_msg' : fields.char('Message for Invoice', size=64),
++ }
res_partner()