bzr revid: fp@tinyerp.com-20100615081432-9qbkcx3vpb6ll84w
This commit is contained in:
Fabien Pinckaers 2010-06-15 10:14:32 +02:00
parent 0b66c19f61
commit 536a51efbb
6 changed files with 84 additions and 17 deletions

View File

@ -45,7 +45,7 @@
<field name="name"/>
<field name="categ_id" invisible="1"/>
<field name="variants" groups="product.group_product_variant"/>
<field name="uom_id"/>
<field name="uom_id" string="UoM"/>
<field name="type"/>
<field name="qty_available"/>
<field name="virtual_available"/>

View File

@ -5,6 +5,8 @@
"access_stock_warehouse_user","stock.warehouse.user","model_stock_warehouse","base.group_user",1,0,0,0
"access_stock_location_manager","stock.location.manager","model_stock_location","stock.group_stock_manager",1,1,1,1
"access_stock_location_user","stock.location.user","model_stock_location","base.group_user",1,0,0,0
"access_stock_journal_user","stock.journal.user","model_stock_journal","base.group_user",1,0,0,0
"access_stock_journal_manager","stock.journal.manager","model_stock_journal","stock.group_stock_manager",1,1,1,1
"access_stock_picking_move_wizard","stock.picking.move.wizard","model_stock_picking_move_wizard","stock.group_stock_user",1,1,1,1
"access_stock_tracking","stock.tracking","model_stock_tracking","stock.group_stock_user",1,1,1,0
"access_stock_picking","stock.picking","model_stock_picking","stock.group_stock_user",1,1,1,1

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
5 access_stock_warehouse_user stock.warehouse.user model_stock_warehouse base.group_user 1 0 0 0
6 access_stock_location_manager stock.location.manager model_stock_location stock.group_stock_manager 1 1 1 1
7 access_stock_location_user stock.location.user model_stock_location base.group_user 1 0 0 0
8 access_stock_journal_user stock.journal.user model_stock_journal base.group_user 1 0 0 0
9 access_stock_journal_manager stock.journal.manager model_stock_journal stock.group_stock_manager 1 1 1 1
10 access_stock_picking_move_wizard stock.picking.move.wizard model_stock_picking_move_wizard stock.group_stock_user 1 1 1 1
11 access_stock_tracking stock.tracking model_stock_tracking stock.group_stock_user 1 1 1 0
12 access_stock_picking stock.picking model_stock_picking stock.group_stock_user 1 1 1 1

View File

@ -49,6 +49,17 @@ class stock_incoterms(osv.osv):
stock_incoterms()
class stock_journal(osv.osv):
_name = "stock.journal"
_description = "Stock Journal"
_columns = {
'name': fields.char('Stock Journal', size=32, required=True),
'user_id': fields.many2one('res.users','Responsible'),
}
_defaults = {
'user_id': lambda s,c,u,ctx: u
}
stock_journal()
#----------------------------------------------------------
# Stock Location
@ -169,6 +180,7 @@ class stock_location(osv.osv):
'location_id': fields.many2one('stock.location', 'Parent Location', select=True, ondelete='cascade'),
'child_ids': fields.one2many('stock.location', 'location_id', 'Contains'),
'chained_journal_id': fields.many2one('stock.journal', 'Chained Journal'),
'chained_location_id': fields.many2one('stock.location', 'Chained Location If Fixed'),
'chained_location_type': fields.selection([('none', 'None'), ('customer', 'Customer'), ('fixed', 'Fixed Location')],
'Chained Location Type', required=True),
@ -225,7 +237,7 @@ class stock_location(osv.osv):
elif location.chained_location_type == 'fixed':
result = location.chained_location_id
if result:
return result, location.chained_auto_packing, location.chained_delay
return result, location.chained_auto_packing, location.chained_delay, location.chained_journal_id and location.chained_journal_id.id or False
return result
def picking_type_get(self, cr, uid, from_location, to_location, context={}):
@ -557,7 +569,7 @@ class stock_picking(osv.osv):
'type': fields.selection([('out', 'Sending Goods'), ('in', 'Getting Goods'), ('internal', 'Internal'), ('delivery', 'Delivery')], 'Shipping Type', required=True, select=True, help="Shipping type specify, goods coming in or going out."),
'active': fields.boolean('Active', help="If the active field is set to true, it will allow you to hide the picking without removing it."),
'note': fields.text('Notes'),
'stock_journal_id': fields.many2one('stock.journal','Stock Journal'),
'location_id': fields.many2one('stock.location', 'Location', help="Keep empty if you produce at the location where the finished products are needed." \
"Set a location if you produce at a fixed location. This can be a partner location " \
"if you subcontract the manufacturing operations."),
@ -1563,6 +1575,7 @@ class stock_move(osv.osv):
pick_name = ''
if ptype == 'delivery':
pick_name = self.pool.get('ir.sequence').get(cr, uid, 'stock.picking.delivery')
print todo
pickid = self.pool.get('stock.picking').create(cr, uid, {
'name': pick_name or picking.name,
'origin': str(picking.origin or ''),
@ -1570,11 +1583,11 @@ class stock_move(osv.osv):
'note': picking.note,
'move_type': picking.move_type,
'auto_picking': todo[0][1][1] == 'auto',
'stock_journal_id': todo[0][1][3],
'address_id': picking.address_id.id,
'invoice_state': 'none'
})
for move, (loc, auto, delay) in todo:
# Is it smart to copy ? May be it's better to recreate ?
for move, (loc, auto, delay, journal) in todo:
new_id = self.pool.get('stock.move').copy(cr, uid, move.id, {
'location_id': move.location_dest_id.id,
'location_dest_id': loc.id,

View File

@ -420,6 +420,7 @@
<field name="chained_location_id"/>
<field name="chained_auto_packing"/>
<field name="chained_delay"/>
<field name="chained_journal_id" groups="base.group_extended"/>
</group>
<group col="2" colspan="2">
<separator string="Localization" colspan="2"/>
@ -603,15 +604,13 @@
<field name="arch" type="xml">
<form string="Picking list">
<group colspan="4" col="6">
<field name="name" readonly="1"/>
<!-- <field name="address_id" context="{'contact_display' : 'partner'}" groups="base.group_extended"/>-->
<field name="origin"/>
<field name="backorder_id" groups="base.group_extended" readonly="1"/>
<field name="date"/>
<field name="min_date"/>
<field name="type"/>
<field name="stock_journal_id" groups="base.group_extended" widget="selection"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
</group>
<notebook colspan="4">
@ -715,10 +714,9 @@
<separator orientation="vertical"/>
<filter icon="terp-accessories-archiver-minus" string="Back Order" domain="[('backorder_id', '&lt;&gt;', False)]" help="Has Back Order" />
<separator orientation="vertical"/>
<field name="location_id"/>
<field name="location_dest_id"/>
<field name="name"/>
<field name="address_id"/>
<field name="stock_journal_id" groups="base.group_extended" widget="selection"/>
</group>
<newline/>
<group expand="0" string="Group By..." colspan="4" col="8">
@ -761,8 +759,9 @@
<field name="backorder_id" groups="base.group_extended" readonly="1"/>
<field name="date" />
<field name="min_date"/>
<field name="type" invisible="1"/>
<field name="stock_journal_id" groups="base.group_extended" widget="selection"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
<field name="type" invisible="1"/>
</group>
<notebook colspan="4">
<page string="General Information">
@ -863,6 +862,7 @@
<field name="name"/>
<field name="address_id"/>
<field name="origin"/>
<field name="stock_journal_id" groups="base.group_extended" widget="selection"/>
</group>
<newline/>
<group expand="0" string="Group By..." colspan="4" col="10">
@ -939,6 +939,7 @@
<field name="backorder_id" readonly="1"/>
<field name="origin" readonly="1"/>
<field name="type" invisible="1"/>
<field name="stock_journal_id" groups="base.group_extended" widget="selection"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
</group>
<notebook colspan="4">
@ -1048,6 +1049,7 @@
<field name="name"/>
<field name="address_id" />
<field name="origin"/>
<field name="stock_journal_id" groups="base.group_extended" widget="selection"/>
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
</group>
<newline/>
@ -1125,6 +1127,7 @@
<field name="type"/>
<field name="min_date" readonly="1"/>
<field name="invoice_state" string="Invoice Control"/>
<field name="stock_journal_id" groups="base.group_extended" widget="selection"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
</group>
<notebook colspan="4">
@ -1220,6 +1223,7 @@
<field name="name"/>
<field name="address_id"/>
<field name="origin"/>
<field name="stock_journal_id" groups="base.group_extended" widget="selection"/>
<field name="company_id" widget="selection" groups="base.group_multi_company" />
</group>
<newline/>
@ -1277,6 +1281,7 @@
<separator orientation="vertical"/>
<field name="name"/>
<field name="origin"/>
<field name="stock_journal_id" groups="base.group_extended" widget="selection"/>
<field name="company_id" widget="selection"/>
</group>
<newline/>
@ -1799,5 +1804,52 @@
<menuitem action="action_reception_picking_move" id="menu_action_pdct_in" parent="menu_stock_products_moves" sequence="1"/>
<menuitem action="action_out_picking_move" id="menu_action_pdct_out" parent="menu_stock_products_moves" sequence="2"/>
<record id="view_stock_journal_filter" model="ir.ui.view">
<field name="name">stock.journal.filter</field>
<field name="model">stock.journal</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Stock Journal">
<field name="name"/>
<field name="user_id"/>
</search>
</field>
</record>
<record model="ir.ui.view" id="view_stock_journal_tree">
<field name="name">Stock Journals</field>
<field name="model">stock.journal</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Stock Journal">
<field name="name"/>
<field name="user_id"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="view_stock_journal_form">
<field name="name">Stock Journals</field>
<field name="model">stock.journal</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Stock Journal">
<field name="name"/>
<field name="user_id"/>
</form>
</field>
</record>
<record id="action_stock_journal_form" model="ir.actions.act_window">
<field name="name">Stock Journals</field>
<field name="res_model">stock.journal</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
</record>
<menuitem
action="action_stock_journal_form"
id="menu_action_stock_journal_form"
groups="base.group_extended"
parent="menu_stock_configuration" />
</data>
</openerp>

View File

@ -70,6 +70,7 @@ class procurement_order(osv.osv):
'origin': origin,
'company_id': line.company_id and line.company_id.id or False,
'type': line.picking_type,
'stock_journal_id': line.journal_id and line.journal_id.id or False,
'move_type': 'one',
'address_id': line.partner_address_id.id,
'note': line.name, # TODO: note on procurement ?
@ -124,8 +125,5 @@ class procurement_order(osv.osv):
{'location_id':proc.location_id.id})
self.write(cr, uid, [proc.id], {'state':'running','message':_('Moved from other location')})
return False
procurement_order()

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
#
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
@ -15,7 +15,7 @@
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
@ -30,6 +30,7 @@ class stock_location_path(osv.osv):
'name': fields.char('Operation', size=64),
'company_id': fields.many2one('res.company', 'Company'),
'product_id' : fields.many2one('product.product', 'Products', ondelete='cascade', select=1),
'journal_id': fields.many2one('stock.journal','Journal'),
'location_from_id' : fields.many2one('stock.location', 'Source Location', ondelete='cascade', select=1),
'location_dest_id' : fields.many2one('stock.location', 'Destination Location', ondelete='cascade', select=1),
'delay': fields.integer('Delay (days)', help="Number of days to do this transition"),
@ -64,6 +65,7 @@ class product_pulled_flow(osv.osv):
'cancel_cascade': fields.boolean('Cancel Cascade', help="Allow you to cancel moves related to the product pull flow"),
'location_id': fields.many2one('stock.location','Location', required=True, help="Is the destination location that needs supplying"),
'location_src_id': fields.many2one('stock.location','Location Source', help="Location used by Destination Location to supply"),
'journal_id': fields.many2one('stock.journal','Journal'),
'procure_method': fields.selection([('make_to_stock','Make to Stock'),('make_to_order','Make to Order')], 'Procure Method', required=True, help="'Make to Stock': When needed, take from the stock or wait until re-supplying. 'Make to Order': When needed, purchase or produce for the procurement request."),
'type_proc': fields.selection([('produce','Produce'),('buy','Buy'),('move','Move')], 'Type of Procurement', required=True),
'company_id': fields.many2one('res.company', 'Company', help="Is used to know to which company belong packings and moves"),
@ -115,7 +117,7 @@ class stock_location(osv.osv):
if product:
for path in product.path_ids:
if path.location_from_id.id == location.id:
return path.location_dest_id, path.auto, path.delay
return path.location_dest_id, path.auto, path.delay, path.journal_id.id
return super(stock_location, self).chained_location_get(cr, uid, location, partner, product, context)
stock_location()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: