[IMP] stock management - simplified view

bzr revid: fp@tinyerp.com-20100409000121-34mhhp8rbl2u3osy
This commit is contained in:
Fabien Pinckaers 2010-04-09 02:01:21 +02:00
parent d93fa50771
commit 7d5a38ba3b
9 changed files with 29 additions and 198 deletions

View File

@ -36,14 +36,14 @@
<field name="view_id" ref="crm_case_form_view_meet"/>
<field name="act_window_id" ref="crm_case_categ_meet_create_partner"/>
</record>
<record model="ir.actions.act_window.view" id="action_crm_tag_gantt_meet_partner">
<record model="ir.actions.act_window.view" id="action_crm_tag_gantt_meet_partner">
<field name="sequence" eval="3"/>
<field name="view_mode">gantt</field>
<field name="view_id" ref="crm_case_gantt_view_meet"/>
<field name="act_window_id" ref="crm_case_categ_meet_create_partner"/>
</record>
<act_window
<act_window
id="crm_case_categ_meet_case"
name="Schedule a Meeting"
res_model="crm.meeting"
@ -74,7 +74,7 @@
<field name="view_id" ref="crm_case_form_view_meet"/>
<field name="act_window_id" ref="crm_case_categ_meet_case"/>
</record>
<record model="ir.actions.act_window.view" id="action_crm_tag_gantt_meet_case">
<record model="ir.actions.act_window.view" id="action_crm_tag_gantt_meet_case">
<field name="sequence" eval="3"/>
<field name="view_mode">gantt</field>
<field name="view_id" ref="crm_case_gantt_view_meet"/>
@ -116,26 +116,27 @@
<!-- ALL MEETINGS -->
<menuitem name="Meetings" id="menu_meeting_sale"
parent="base.menu_base_partner" sequence="3" />
parent="base.menu_base_partner" sequence="3" />
<menuitem name="Meetings" id="menu_crm_case_categ_meet"
action="crm_case_categ_meet" parent="menu_meeting_sale"
sequence="1" />
action="crm_case_categ_meet" parent="menu_meeting_sale"
sequence="1" />
<record id="action_view_attendee_form" model="ir.actions.act_window">
<field name="name">Meeting Invitations</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">calendar.attendee</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="base_calendar.base_calendar_attendee_tree_view" />
<field name="name">Meeting Invitations</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">calendar.attendee</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="base_calendar.base_calendar_attendee_tree_view" />
<field name="domain">[('ref','like','crm.meeting,')]</field>
<field name="context">{'default_sent_by_uid': uid}</field>
</record>
<field name="context">{'default_sent_by_uid': uid}</field>
</record>
<menuitem id="menu_attendee_invitations"
name="Meeting Invitations" parent="crm.menu_meeting_sale"
sequence="10" action="action_view_attendee_form" />
name="Meeting Invitations" parent="crm.menu_meeting_sale"
groups="base.group_extended"
sequence="10" action="action_view_attendee_form" />
<record model="ir.actions.act_window" id="crm_case_category_act_meetall3">
@ -145,7 +146,7 @@
<field name="view_mode">tree,calendar,form,gantt</field>
<field name="view_id" ref="crm_case_calendar_view_meet"/>
<field name="domain"
eval="[('state','in',('pending','draft','open')),('date','>=',time.strftime('%Y-%m-%d'))]" />
eval="[('state','in',('pending','draft','open')),('date','>=',time.strftime('%Y-%m-%d'))]" />
</record>
<record model="ir.actions.act_window.view" id="action_crm_tag_calendar_view_meetall3">
@ -169,7 +170,7 @@
<field name="act_window_id" ref="crm_case_category_act_meetall3"/>
</record>
<record model="ir.actions.act_window.view" id="action_crm_tag_gantt_view_meetall3">
<record model="ir.actions.act_window.view" id="action_crm_tag_gantt_view_meetall3">
<field name="sequence" eval="2"/>
<field name="view_mode">gantt</field>
<field name="view_id" ref="crm_case_gantt_view_meet"/>

View File

@ -88,7 +88,7 @@ class crm_opportunity(osv.osv):
resource_id = False
if opportunity.user_id:
resource_ids = res_obj.search(cr, uid, [('user_id','=',opportunity.user_id.id)])
resource_id = len(resource_ids) or resource_ids[0]
resource_id = len(resource_ids) and resource_ids[0] or False
duration = float(ans.days)
if opportunity.section_id.resource_calendar_id:

View File

@ -82,21 +82,19 @@
</group>
<notebook colspan="4">
<page string="Opportunity">
<group col="3" colspan="2">
<group col="4" colspan="2">
<separator colspan="4" string="Contacts"/>
<field name="partner_id" select="1"
on_change="onchange_partner_id(partner_id, email_from)"
colspan="2" />
on_change="onchange_partner_id(partner_id, email_from)" />
<field name="partner_address_id"
string="Contact"
on_change="onchange_partner_address_id(partner_address_id, email_from)"
colspan="1" />
on_change="onchange_partner_address_id(partner_address_id, email_from)"/>
<field name="email_from" string="Email" />
<field name="phone"/>
</group>
<group col="2" colspan="2">
<separator colspan="2" string="Categorization"/>
<field name="type_id" select="1" string="Campaign"/>
<field name="type_id" select="1" string="Campaign" groups="base.group_extended"/>
<field name="section_id" colspan="1" widget="selection"/>
<field name="priority" string="Priority"/>
<field name="categ_id" select="1"

View File

@ -2,7 +2,7 @@
<openerp>
<data>
<menuitem groups="base.group_extended" id="menu_product_pricelist_main"
<menuitem id="menu_product_pricelist_main"
name="Pricelists" parent="prod_config_main"
groups="base.group_extended"
sequence="50"/>

View File

@ -56,7 +56,6 @@ Thanks to the double entry management, the inventory controlling is powerful and
"wizard/stock_traceability_view.xml",
"wizard/stock_picking_make_view.xml",
"wizard/stock_return_picking_view.xml",
"wizard/stock_split_move_view.xml",
"stock_workflow.xml",
"stock_incoterms.xml",
"stock_wizard.xml",

View File

@ -662,10 +662,6 @@
</notebook>
</form>
</field>
<group col="7" colspan="4">
<label colspan="6"/>
<button name="%(act_split_moves)d" string="Split Entry Lines in two" type="action" icon="gtk-justify-fill"/>
</group>
<group col="10" colspan="4">
<field name="state" readonly="1"/>
<button name="draft_force_assign" states="draft" string="Confirm (Do Not Process Now)" type="object" icon="gtk-apply"/>
@ -823,10 +819,6 @@
</notebook>
</form>
</field>
<group col="7" colspan="4">
<label colspan="6"/>
<button name="%(act_split_moves)d" string="Split in Two" type="action" states="assigned,confirmed,draft,auto" icon="gtk-justify-fill"/>
</group>
<group col="10" colspan="4">
<field name="state" readonly="1"/>
<button name="draft_force_assign" states="draft" string="Process Later" type="object" icon="gtk-ok"/>
@ -1020,10 +1012,6 @@
</notebook>
</form>
</field>
<group col="7" colspan="4">
<label colspan="6"/>
<button name="%(act_split_moves)d" string="Split in Two" type="action" icon="gtk-justify-fill"/>
</group>
<group col="10" colspan="4">
<field name="state" readonly="1"/>
<button name="draft_force_assign" states="draft" string="Process Later" type="object" icon="gtk-ok"/>
@ -1226,7 +1214,7 @@
</page>
<page string="Notes">
<field colspan="4" name="note" nolabel="1"/>
</page>
</notebook>
</form>
</field>
@ -1443,24 +1431,6 @@
</record>
<menuitem action="action_move_form2" id="menu_action_move_form2" parent="menu_traceability" sequence="1"/>
<record id="action_picking_all" model="ir.actions.act_window">
<field name="name">Picking lists</field>
<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,calendar</field>
<field name="search_view_id" ref="view_stock_picking_filter"/>
<field name="domain">[('type','=','out')]</field>
<field name="context">{'contact_display': 'partner',"search_default_available":1}</field>
</record>
<record id="action_picking_out_tree_view" model="ir.actions.act_window.view">
<field eval="1" name="sequence"/>
<field name="view_mode">tree</field>
<field name="view_id" ref="view_picking_out_tree"/>
<field name="act_window_id" ref="action_picking_all"/>
</record>
<menuitem action="action_picking_all" id="menu_action_picking_all" parent="menu_stock_warehouse_mgmt" sequence="3"/>
====================================
Reception Picking (By Stock Move)
====================================

View File

@ -26,7 +26,6 @@ import stock_partial_move
import stock_picking_make
import wizard_replacement
import stock_return_picking
import stock_split_move
import wizard_ups
import stock_inventory_merge
import stock_inventory_set_stock_zero

View File

@ -1,125 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# 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/>.
#
##############################################################################
from osv import osv, fields
class stock_split_move_line(osv.osv_memory):
_name = 'stock.move.line.split'
_description = "Split Moves"
def default_get(self, cr, uid, fields, context):
"""
To get default values for the object.
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param fields: List of fields for which we want default values
@param context: A standard dictionary
@return: A dictionary which of fields with values.
"""
res = super(stock_split_move_line, self).default_get(cr, uid, fields, context=context)
record_id = context and context.get('active_id', False) or False
pick_obj = self.pool.get('stock.picking')
pick = pick_obj.browse(cr, uid, record_id)
for m in [line for line in pick.move_lines]:
res['move%s'%(m.id)] = m.product_qty
return res
def view_init(self, cr, uid, fields_list, context=None):
"""
Creates view dynamically and adding fields at runtime.
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param context: A standard dictionary
@return: New arch of view with new columns.
"""
res = super(stock_split_move_line, self).view_init(cr, uid, fields_list, context=context)
record_id = context and context.get('active_id', False) or False
if record_id:
pick_obj = self.pool.get('stock.picking')
try:
pick = pick_obj.browse(cr, uid, record_id)
for m in [line for line in pick.move_lines]:
if 'move%s' % m.id not in self._columns:
self._columns['move%s' % m.id] = fields.float(string=m.product_id.name)
except:
return res
return res
def fields_view_get(self, cr, uid, view_id=None, view_type='form',
context=None, toolbar=False, submenu=False):
"""
Changes the view dynamically
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param context: A standard dictionary
@return: New arch of view.
"""
res = super(stock_split_move_line, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar,submenu=False)
record_id = context and context.get('active_id', False) or False
assert record_id,'Active ID not found'
pick_obj = self.pool.get('stock.picking')
pick = pick_obj.browse(cr, uid, record_id)
arch_lst = ['<?xml version="1.0"?>', '<form string="Split lines">', '<label string="Indicate here the quantity of the new line. A quantity of zero will not split the line." colspan="4"/>']
for m in [line for line in pick.move_lines]:
quantity = m.product_qty
arch_lst.append('<field name="move%s" />\n<newline />' % (m.id,))
res['fields']['move%s' % m.id] = {'string' : m.product_id.name, 'type' : 'float', 'required' : True}
arch_lst.append('<group col="2" colspan="4">')
arch_lst.append('<button icon="gtk-cancel" special="cancel" string="Cancel" />')
arch_lst.append('<button name="split_lines" string="Split" colspan="1" type="object" icon="gtk-apply" />')
arch_lst.append('</group>')
arch_lst.append('</form>')
res['arch'] = '\n'.join(arch_lst)
return res
def split_lines(self, cr, uid, ids, context):
"""
Splits moves in quantity given in the wizard.
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param ids: List of ids selected
@param context: A standard dictionary
@return: A dictionary which of fields with values.
"""
move_obj = self.pool.get('stock.move')
record_id = context and context.get('active_id', False) or False
pick_obj = self.pool.get('stock.picking')
pick = pick_obj.browse(cr, uid, record_id)
data = self.read(cr, uid, ids[0])
move_ids = [m.id for m in [line for line in pick.move_lines]]
for move in move_obj.browse(cr, uid, move_ids):
quantity = data['move%s' % move.id]
if 0 < quantity < move.product_qty:
new_qty = move.product_qty - quantity
new_uos_qty = new_qty / move.product_qty * move.product_uos_qty
new_obj = move_obj.copy(cr, uid, move.id, {'product_qty' : new_qty, 'product_uos_qty': new_uos_qty, 'state':move.state})
uos_qty = quantity / move.product_qty * move.product_uos_qty
move_obj.write(cr, uid, [move.id], {'product_qty' : quantity, 'product_uos_qty': uos_qty})
return {}
stock_split_move_line()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,17 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- Split Moves -->
<record id="act_split_moves" model="ir.actions.act_window">
<field name="name">Split Moves</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">stock.move.line.split</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
</data>
</openerp>
</data>
</openerp>