[MERGE]: Merged with lp:~openerp-dev/openobject-addons/trunk-dev-addons1
bzr revid: uco@tinyerp.co.in-20100426105329-f2drgl3m2es8i26h
This commit is contained in:
@@ -78,8 +78,8 @@
|
||||
<!-- report-related wizards -->
|
||||
<!-- <wizard id="wizard_partner_balance_report" menu="False" model="res.partner" name="account.partner.balance.report" string="Partner Balance"/>
|
||||
<menuitem icon="STOCK_PRINT" action="wizard_partner_balance_report" id="menu_partner_balance" parent="account.next_id_22" type="wizard"/> -->
|
||||
<!-- <menuitem id="next_id_22" name="Partner Accounts" parent="menu_finance_generic_reporting" sequence="1"/>
|
||||
<wizard id="wizard_third_party_ledger" menu="False" model="res.partner" name="account.third_party_ledger.report" string="Partner Ledger"/>
|
||||
<menuitem id="next_id_22" name="Partner Accounts" parent="menu_finance_generic_reporting" sequence="1"/>
|
||||
<!--<wizard id="wizard_third_party_ledger" menu="False" model="res.partner" name="account.third_party_ledger.report" string="Partner Ledger"/>
|
||||
<menuitem icon="STOCK_PRINT" action="wizard_third_party_ledger" id="menu_third_party_ledger" parent="account.next_id_22" type="wizard"/> -->
|
||||
|
||||
<!-- <wizard id="wizard_general_ledger_report" keyword="client_print_multi" model="account.account" name="account.general.ledger.report" string="General Ledger"/>-->
|
||||
|
||||
@@ -2,11 +2,6 @@
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<menuitem id="next_id_22"
|
||||
name="Partner Accounts"
|
||||
parent="menu_finance_generic_reporting"
|
||||
sequence="1"/>
|
||||
|
||||
<record id="account_aged_balance_view" model="ir.ui.view">
|
||||
<field name="name">Aged Partner Balance</field>
|
||||
<field name="model">account.aged.trial.balance</field>
|
||||
|
||||
@@ -28,6 +28,17 @@ class delivery_carrier(osv.osv):
|
||||
_name = "delivery.carrier"
|
||||
_description = "Carrier and delivery grids"
|
||||
|
||||
def name_get(self, cr, uid, ids, context={}):
|
||||
if not len(ids):
|
||||
return []
|
||||
order_id = context.get('order_id',False)
|
||||
if not order_id:
|
||||
res = super(delivery_carrier, self).name_get(cr, uid, ids, context=context)
|
||||
else:
|
||||
order = self.pool.get('sale.order').browse(cr, uid, [order_id])[0]
|
||||
currency = order.pricelist_id.currency_id.name or ''
|
||||
res = [(r['id'], r['name']+' ('+(str(r['price']))+' '+currency+')') for r in self.read(cr, uid, ids, ['name', 'price'], context)]
|
||||
return res
|
||||
def get_price(self, cr, uid, ids, field_name, arg=None, context={}):
|
||||
res={}
|
||||
sale_obj=self.pool.get('sale.order')
|
||||
@@ -94,9 +105,7 @@ class delivery_grid(osv.osv):
|
||||
}
|
||||
_order = 'sequence'
|
||||
|
||||
|
||||
def get_price(self, cr, uid, id, order, dt, context):
|
||||
|
||||
total = 0
|
||||
weight = 0
|
||||
volume = 0
|
||||
@@ -112,7 +121,6 @@ class delivery_grid(osv.osv):
|
||||
|
||||
def get_price_from_picking(self, cr, uid, id, total, weight, volume, context={}):
|
||||
grid = self.browse(cr, uid, id, context)
|
||||
|
||||
price = 0.0
|
||||
ok = False
|
||||
|
||||
|
||||
@@ -289,5 +289,16 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="edit_project_multicompany">
|
||||
<field name="name">sale.order.multicompany</field>
|
||||
<field name="model">sale.order</field>
|
||||
<field name="inherit_id" ref="sale.view_order_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="/form/notebook/page[@string='Sale Order']/group[1]/button[@name='button_dummy']" position="after">
|
||||
<button name="%(action_delivery_cost)d" states="draft" string="Delivery Costs" type="action" icon="gtk-execute" context="{'order_id':id}"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -50,7 +50,11 @@ class make_delivery(osv.osv_memory):
|
||||
res = super(make_delivery, self).default_get(cr, uid, fields, context=context)
|
||||
order_obj = self.pool.get('sale.order')
|
||||
for order in order_obj.browse(cr, uid, context.get('active_ids', [])):
|
||||
res.update({'carrier_id': order.partner_id.property_delivery_carrier.id})
|
||||
carrier = order.carrier_id.id
|
||||
if not carrier:
|
||||
carrier = order.partner_id.property_delivery_carrier.id
|
||||
res.update({'carrier_id': carrier})
|
||||
|
||||
return res
|
||||
|
||||
def view_init(self, cr , uid , fields, context=None):
|
||||
|
||||
@@ -11,26 +11,28 @@
|
||||
<field name="arch" type="xml">
|
||||
<form string="Create Deliveries">
|
||||
<separator colspan="4" string="Delivery Method" />
|
||||
<field name="carrier_id"/>
|
||||
<field name="carrier_id" widget="selection"/>
|
||||
<newline/>
|
||||
<separator colspan="4"/>
|
||||
<group col="2" colspan="4">
|
||||
<button icon='gtk-cancel' special="cancel"
|
||||
string="Cancel" />
|
||||
<button name="delivery_set" string="Add Delivery Costs"
|
||||
colspan="1" type="object" icon="gtk-ok" />
|
||||
string="_Cancel" />
|
||||
<button name="delivery_set" string="_Apply"
|
||||
colspan="1" type="object" icon="gtk-apply" />
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_delivery_cost" model="ir.actions.act_window">
|
||||
<field name="name">Delivery Costs</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">delivery.sale.order</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="view_make_delivery_wizard"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<act_window name="Delivery Costs"
|
||||
res_model="delivery.sale.order"
|
||||
src_model="sale.order"
|
||||
view_mode="form"
|
||||
target="new"
|
||||
key2="client_action_multi"
|
||||
id="act_delivery_cost"/>
|
||||
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
|
||||
# $Id$
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU 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 General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import time
|
||||
|
||||
from osv import osv, fields
|
||||
from tools.translate import _
|
||||
|
||||
class job2phonecall(osv.osv_memory):
|
||||
_name = 'hr.recruitment.job2phonecall'
|
||||
_description = 'Schedule Phone Call'
|
||||
_columns = {
|
||||
'user_id': fields.many2one('res.users', 'Assign To'),
|
||||
'deadline': fields.datetime('Planned Date'),
|
||||
'note': fields.text('Goals'),
|
||||
'category_id': fields.many2one('crm.case.categ', 'Category', required=True),
|
||||
}
|
||||
|
||||
def _date_user(self, cr, uid, context=None):
|
||||
case_obj = self.pool.get('hr.applicant')
|
||||
case = case_obj.browse(cr, uid, context['active_id'])
|
||||
return case.user_id and case.user_id.id or False
|
||||
|
||||
def _date_category(self, cr, uid, context=None):
|
||||
categ_id = self.pool.get('crm.case.categ').search(cr, uid, [('name','=','Outbound')])
|
||||
return categ_id and categ_id[0] or case.categ_id and case.categ_id.id or False
|
||||
|
||||
def _get_note(self, cr, uid, context=None):
|
||||
case_obj = self.pool.get('hr.applicant')
|
||||
case = case_obj.browse(cr, uid, context['active_id'])
|
||||
return case.description or ''
|
||||
|
||||
_defaults = {
|
||||
'user_id': _date_user,
|
||||
'category_id': _date_category,
|
||||
'note': _get_note
|
||||
}
|
||||
|
||||
def make_phonecall(self, cr, uid, ids, context=None):
|
||||
mod_obj = self.pool.get('ir.model.data')
|
||||
job_case_obj = self.pool.get('hr.applicant')
|
||||
data_obj = self.pool.get('ir.model.data')
|
||||
phonecall_case_obj = self.pool.get('crm.phonecall')
|
||||
|
||||
form = self.read(cr, uid, ids, [], context=context)[0]
|
||||
# form = data['form']
|
||||
result = mod_obj._get_id(cr, uid, 'crm', 'view_crm_case_phonecalls_filter')
|
||||
res = mod_obj.read(cr, uid, result, ['res_id'])
|
||||
# Select the view
|
||||
|
||||
id2 = data_obj._get_id(cr, uid, 'crm', 'crm_case_phone_tree_view')
|
||||
id3 = data_obj._get_id(cr, uid, 'crm', 'crm_case_phone_form_view')
|
||||
if id2:
|
||||
id2 = data_obj.browse(cr, uid, id2, context=context).res_id
|
||||
if id3:
|
||||
id3 = data_obj.browse(cr, uid, id3, context=context).res_id
|
||||
|
||||
for job in job_case_obj.browse(cr, uid, context['active_ids']):
|
||||
#TODO : Take other info from job
|
||||
new_phonecall_id = phonecall_case_obj.create(cr, uid, {
|
||||
'name' : job.name,
|
||||
'user_id' : form['user_id'],
|
||||
'categ_id' : form['category_id'],
|
||||
'description' : form['note'],
|
||||
'date' : form['deadline'],
|
||||
# 'section_id' : form['section_id'],
|
||||
'description':job.description,
|
||||
'partner_id':job.partner_id.id,
|
||||
'partner_address_id':job.partner_address_id.id,
|
||||
'partner_phone':job.partner_phone,
|
||||
'partner_mobile':job.partner_mobile,
|
||||
'description':job.description,
|
||||
'date':job.date,
|
||||
}, context=context)
|
||||
new_phonecall = phonecall_case_obj.browse(cr, uid, new_phonecall_id)
|
||||
vals = {}
|
||||
# if not job.case_id:
|
||||
# vals.update({'phonecall_id' : new_phonecall.id})
|
||||
job_case_obj.write(cr, uid, [job.id], vals)
|
||||
job_case_obj.case_cancel(cr, uid, [job.id])
|
||||
phonecall_case_obj.case_open(cr, uid, [new_phonecall_id])
|
||||
|
||||
value = {
|
||||
'name': _('Phone Call'),
|
||||
'view_type': 'form',
|
||||
'view_mode': 'tree,form',
|
||||
'res_model': 'crm.phonecall',
|
||||
'res_id' : new_phonecall_id,
|
||||
'views': [(id3,'form'),(id2,'tree'),(False,'calendar'),(False,'graph')],
|
||||
'type': 'ir.actions.act_window',
|
||||
'search_view_id': res['res_id']
|
||||
}
|
||||
return value
|
||||
|
||||
job2phonecall()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:>>>>>>> MERGE-SOURCE
|
||||
@@ -1,273 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
|
||||
# $Id$
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU 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 General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from mx.DateTime import now
|
||||
|
||||
import wizard
|
||||
import netsvc
|
||||
import ir
|
||||
import pooler
|
||||
import time
|
||||
|
||||
from tools.translate import _
|
||||
|
||||
class job2phonecall(wizard.interface):
|
||||
case_form = """<?xml version="1.0"?>
|
||||
<form string="Schedule Phone Call">
|
||||
<separator string="Phone Call Description" colspan="4" />
|
||||
<newline />
|
||||
<field name='user_id' />
|
||||
<field name='deadline' />
|
||||
<newline />
|
||||
<field name='note' colspan="4"/>
|
||||
<newline />
|
||||
<field name='section_id' />
|
||||
<field name='category_id'/>
|
||||
</form>"""
|
||||
|
||||
case_fields = {
|
||||
'user_id' : {'string' : 'Assign To', 'type' : 'many2one', 'relation' : 'res.users'},
|
||||
'deadline' : {'string' : 'Planned Date', 'type' : 'datetime'},
|
||||
'note' : {'string' : 'Goals', 'type' : 'text'},
|
||||
'category_id' : {'string' : 'Category', 'type' : 'many2one', 'relation' : 'crm.case.categ', 'required' : True},
|
||||
'section_id' : {'string' : 'Section', 'type' : 'many2one', 'relation' : 'hr.case.section'},
|
||||
|
||||
}
|
||||
def _default_values(self, cr, uid, data, context):
|
||||
|
||||
case_obj = pooler.get_pool(cr.dbname).get('hr.applicant')
|
||||
categ_id=pooler.get_pool(cr.dbname).get('crm.case.categ').search(cr, uid, [('name','=','Outbound')])
|
||||
case = case_obj.browse(cr, uid, data['id'])
|
||||
return {
|
||||
'user_id' : case.user_id and case.user_id.id,
|
||||
'category_id' : categ_id and categ_id[0] or case.categ_id and case.categ_id.id,
|
||||
'section_id' : case.section_id and case.section_id.id or False,
|
||||
'note' : case.description
|
||||
}
|
||||
|
||||
def _doIt(self, cr, uid, data, context):
|
||||
form = data['form']
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
mod_obj = pool.get('ir.model.data')
|
||||
result = mod_obj._get_id(cr, uid, 'hr', 'view_hr_case_phonecalls_filter')
|
||||
res = mod_obj.read(cr, uid, result, ['res_id'])
|
||||
phonecall_case_obj = pool.get('hr.phonecall')
|
||||
job_case_obj = pool.get('hr.applicant')
|
||||
# Select the view
|
||||
|
||||
data_obj = pool.get('ir.model.data')
|
||||
id2 = data_obj._get_id(cr, uid, 'hr', 'hr_case_phone_tree_view')
|
||||
id3 = data_obj._get_id(cr, uid, 'hr', 'hr_case_phone_form_view')
|
||||
if id2:
|
||||
id2 = data_obj.browse(cr, uid, id2, context=context).res_id
|
||||
if id3:
|
||||
id3 = data_obj.browse(cr, uid, id3, context=context).res_id
|
||||
|
||||
for job in job_case_obj.browse(cr, uid, data['ids']):
|
||||
#TODO : Take other info from job
|
||||
new_phonecall_id = phonecall_case_obj.create(cr, uid, {
|
||||
'name' : job.name,
|
||||
'user_id' : form['user_id'],
|
||||
'categ_id' : form['category_id'],
|
||||
'description' : form['note'],
|
||||
'date' : form['deadline'],
|
||||
'section_id' : form['section_id'],
|
||||
'description':job.description,
|
||||
'partner_id':job.partner_id.id,
|
||||
'partner_address_id':job.partner_address_id.id,
|
||||
'partner_phone':job.partner_phone,
|
||||
'partner_mobile':job.partner_mobile,
|
||||
'description':job.description,
|
||||
'date':job.date,
|
||||
}, context=context)
|
||||
new_phonecall = phonecall_case_obj.browse(cr, uid, new_phonecall_id)
|
||||
vals = {}
|
||||
if not job.case_id:
|
||||
vals.update({'phonecall_id' : new_phonecall.id})
|
||||
job_case_obj.write(cr, uid, [job.id], vals)
|
||||
job_case_obj.case_cancel(cr, uid, [job.id])
|
||||
phonecall_case_obj.case_open(cr, uid, [new_phonecall_id])
|
||||
value = {
|
||||
'name': _('Phone Call'),
|
||||
'view_type': 'form',
|
||||
'view_mode': 'tree,form',
|
||||
'res_model': 'hr.phonecall',
|
||||
'res_id' : new_phonecall_id,
|
||||
'views': [(id3,'form'),(id2,'tree'),(False,'calendar'),(False,'graph')],
|
||||
'type': 'ir.actions.act_window',
|
||||
'search_view_id': res['res_id']
|
||||
}
|
||||
return value
|
||||
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [_default_values],
|
||||
'result': {'type': 'form', 'arch': case_form, 'fields': case_fields,
|
||||
'state' : [('end', 'Cancel','gtk-cancel'),('order', 'Schedule Phone Call','gtk-go-forward')]}
|
||||
},
|
||||
'order': {
|
||||
'actions': [],
|
||||
'result': {'type': 'action', 'action': _doIt, 'state': 'end'}
|
||||
}
|
||||
}
|
||||
|
||||
job2phonecall('hr.applicant.reschedule_phone_call')
|
||||
|
||||
class job2meeting(wizard.interface):
|
||||
|
||||
def _makeMeeting(self, cr, uid, data, context):
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
job_case_obj = pool.get('hr.applicant')
|
||||
meeting_case_obj = pool.get('hr.meeting')
|
||||
for job in job_case_obj.browse(cr, uid, data['ids']):
|
||||
new_meeting_id = meeting_case_obj.create(cr, uid, {
|
||||
'name': job.name,
|
||||
'date': job.date,
|
||||
'duration': job.duration,
|
||||
})
|
||||
new_meeting = meeting_case_obj.browse(cr, uid, new_meeting_id)
|
||||
vals = {}
|
||||
job_case_obj.write(cr, uid, [job.id], vals)
|
||||
job_case_obj.case_cancel(cr, uid, [job.id])
|
||||
meeting_case_obj.case_open(cr, uid, [new_meeting_id])
|
||||
|
||||
data_obj = pool.get('ir.model.data')
|
||||
result = data_obj._get_id(cr, uid, 'hr', 'view_hr_case_meetings_filter')
|
||||
id = data_obj.read(cr, uid, result, ['res_id'])
|
||||
id1 = data_obj._get_id(cr, uid, 'hr', 'hr_case_calendar_view_meet')
|
||||
id2 = data_obj._get_id(cr, uid, 'hr', 'hr_case_form_view_meet')
|
||||
id3 = data_obj._get_id(cr, uid, 'hr', 'hr_case_tree_view_meet')
|
||||
if id1:
|
||||
id1 = data_obj.browse(cr, uid, id1, context=context).res_id
|
||||
if id2:
|
||||
id2 = data_obj.browse(cr, uid, id2, context=context).res_id
|
||||
if id3:
|
||||
id3 = data_obj.browse(cr, uid, id3, context=context).res_id
|
||||
return {
|
||||
'name': _('Meetings'),
|
||||
'view_type': 'form',
|
||||
'view_mode': 'calendar,form,tree',
|
||||
'res_model': 'hr.meeting',
|
||||
'view_id': False,
|
||||
'views': [(id1,'calendar'),(id2,'form'),(id3,'tree'),(False,'graph')],
|
||||
'type': 'ir.actions.act_window',
|
||||
'search_view_id': id['res_id']
|
||||
}
|
||||
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [],
|
||||
'result': {'type': 'action', 'action': _makeMeeting, 'state': 'order'}
|
||||
},
|
||||
'order': {
|
||||
'actions': [],
|
||||
'result': {'type': 'state', 'state': 'end'}
|
||||
}
|
||||
}
|
||||
|
||||
job2meeting('hr.applicant.meeting_set')
|
||||
|
||||
|
||||
class partner_create(wizard.interface):
|
||||
|
||||
case_form = """<?xml version="1.0"?>
|
||||
<form string="Convert To Partner">
|
||||
<label string="Are you sure you want to create a partner based on this job request ?" colspan="4"/>
|
||||
<label string="You may have to verify that this partner does not exist already." colspan="4"/>
|
||||
<!--field name="close"/-->
|
||||
</form>"""
|
||||
|
||||
case_fields = {
|
||||
'close': {'type':'boolean', 'string':'Close job request'}
|
||||
}
|
||||
|
||||
def _selectPartner(self, cr, uid, data, context):
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
case_obj = pool.get('hr.applicant')
|
||||
for case in case_obj.browse(cr, uid, data['ids']):
|
||||
if case.partner_id:
|
||||
raise wizard.except_wizard(_('Warning !'),
|
||||
_('A partner is already defined on this job request.'))
|
||||
return {}
|
||||
|
||||
def _makeOrder(self, cr, uid, data, context):
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
mod_obj = pool.get('ir.model.data')
|
||||
result = mod_obj._get_id(cr, uid, 'base', 'view_res_partner_filter')
|
||||
res = mod_obj.read(cr, uid, result, ['res_id'])
|
||||
case_obj = pool.get('hr.applicant')
|
||||
partner_obj = pool.get('res.partner')
|
||||
contact_obj = pool.get('res.partner.address')
|
||||
for case in case_obj.browse(cr, uid, data['ids']):
|
||||
partner_id = partner_obj.search(cr, uid, [('name', '=', case.partner_name or case.name)])
|
||||
if partner_id:
|
||||
raise wizard.except_wizard(_('Warning !'),_('A partner is already existing with the same name.'))
|
||||
else:
|
||||
partner_id = partner_obj.create(cr, uid, {
|
||||
'name': case.partner_name or case.name,
|
||||
'user_id': case.user_id.id,
|
||||
'comment': case.description,
|
||||
})
|
||||
contact_id = contact_obj.create(cr, uid, {
|
||||
'partner_id': partner_id,
|
||||
'name': case.partner_name2,
|
||||
'phone': case.partner_phone,
|
||||
'mobile': case.partner_mobile,
|
||||
'email': case.email_from
|
||||
})
|
||||
|
||||
|
||||
case_obj.write(cr, uid, data['ids'], {
|
||||
'partner_id': partner_id,
|
||||
'partner_address_id': contact_id
|
||||
})
|
||||
if data['form']['close']:
|
||||
case_obj.case_close(cr, uid, data['ids'])
|
||||
|
||||
value = {
|
||||
'domain': "[]",
|
||||
'view_type': 'form',
|
||||
'view_mode': 'form,tree',
|
||||
'res_model': 'res.partner',
|
||||
'res_id': int(partner_id),
|
||||
'view_id': False,
|
||||
'type': 'ir.actions.act_window',
|
||||
'search_view_id': res['res_id']
|
||||
}
|
||||
return value
|
||||
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [_selectPartner],
|
||||
'result': {'type': 'form', 'arch': case_form, 'fields': case_fields,
|
||||
'state' : [('end', 'Cancel', 'gtk-cancel'),('confirm', 'Create Partner', 'gtk-go-forward')]}
|
||||
},
|
||||
'confirm': {
|
||||
'actions': [],
|
||||
'result': {'type': 'action', 'action': _makeOrder, 'state': 'end'}
|
||||
}
|
||||
}
|
||||
|
||||
partner_create('hr.applicant.partner_create')
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -192,10 +192,10 @@
|
||||
<field name="arch" type="xml">
|
||||
<search string="Search Timesheet">
|
||||
<group col="10" colspan="4">
|
||||
<filter icon="terp-partner" domain="[('user_id','=',uid)]" help="My" default="1"/>
|
||||
<filter icon="terp-partner" string="My Timesheet" domain="[('user_id','=',uid)]" help="My Timesheets" />
|
||||
<separator orientation="vertical"/>
|
||||
<filter icon="terp-crm" string="In Progress" domain="[('state','in',('draft', 'new'))]" help="Unvalidated Timesheets"/>
|
||||
<filter icon="terp-crm" string="To Validate" domain="[('state','=','confirmed')]" help="Confirmed Timesheets"/>
|
||||
<filter icon="terp-crm" string="In Draft" domain="[('state','in',('draft', 'new'))]" help="Unvalidated Timesheets"/>
|
||||
<filter icon="terp-crm" string="To Validate" domain="[('state','=','confirm')]" help="Confirmed Timesheets"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="user_id" select="1" widget="selection"/>
|
||||
<field name="date_from"/>
|
||||
|
||||
@@ -188,7 +188,7 @@
|
||||
</tree>
|
||||
</field>
|
||||
<newline/>
|
||||
<group col="7" colspan="4">
|
||||
<group col="8" colspan="5">
|
||||
<field name="amount_untaxed" sum="Untaxed amount"/>
|
||||
<field name="amount_tax"/>
|
||||
<field name="amount_total" sum="Total amount"/>
|
||||
|
||||
@@ -62,6 +62,7 @@ Thanks to the double entry management, the inventory controlling is powerful and
|
||||
"product_data.xml",
|
||||
"product_view.xml",
|
||||
"partner_view.xml",
|
||||
"report/report_stock_move_view.xml",
|
||||
"report/report_stock_view.xml",
|
||||
"report/report_stock_picking_view.xml",
|
||||
"security/stock_security.xml",
|
||||
|
||||
@@ -28,6 +28,7 @@ import lot_overview
|
||||
import lot_overview_all
|
||||
import report_stock
|
||||
import report_stock_picking
|
||||
import report_stock_move
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
||||
Executable
+62
@@ -0,0 +1,62 @@
|
||||
# -*- 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import tools
|
||||
from osv import fields,osv
|
||||
|
||||
|
||||
class report_stock_move(osv.osv):
|
||||
_name = "report.stock.move"
|
||||
_description = "Stock Statistics"
|
||||
_auto = False
|
||||
_columns = {
|
||||
'date': fields.date('Date', readonly=True),
|
||||
'year': fields.char('Year', size=4, readonly=True),
|
||||
'day': fields.char('Day', size=128, readonly=True),
|
||||
'month':fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'),
|
||||
('05','May'), ('06','June'), ('07','July'), ('08','August'), ('09','September'),
|
||||
('10','October'), ('11','November'), ('12','December')], 'Month',readonly=True),
|
||||
'product_id':fields.many2one('product.product', 'Product', readonly=True),
|
||||
'location_id':fields.many2one('stock.location', 'Location', readonly=True),
|
||||
'product_qty':fields.integer('Qty',readonly=True),
|
||||
'state': fields.selection([('draft', 'Draft'), ('waiting', 'Waiting'), ('confirmed', 'Confirmed'), ('assigned', 'Available'), ('done', 'Done'), ('cancel', 'Cancelled')], 'State', readonly=True, select=True,
|
||||
help='When the stock move is created it is in the \'Draft\' state.\n After that it is set to \'Confirmed\' state.\n If stock is available state is set to \'Avaiable\'.\n When the picking it done the state is \'Done\'.\
|
||||
\nThe state is \'Waiting\' if the move is waiting for another one.'),
|
||||
|
||||
}
|
||||
|
||||
def init(self, cr):
|
||||
tools.drop_view_if_exists(cr, 'report_stock_move')
|
||||
cr.execute("""
|
||||
create or replace view report_stock_move as (
|
||||
select min(m.id) as id,
|
||||
m.date as date,
|
||||
to_char(date_trunc('day',m.date), 'YYYY') as year,
|
||||
to_char(date_trunc('day',m.date), 'MM') as month,
|
||||
to_char(date_trunc('day',m.date), 'YYYY-MM-DD') as day,
|
||||
m.location_id as location_id,
|
||||
m.product_id as product_id,
|
||||
m.state as state,
|
||||
sum(m.product_qty) as product_qty
|
||||
from stock_move as m group by m.product_id, m.location_id, m.id, m.date, m.state
|
||||
)
|
||||
""")
|
||||
report_stock_move()
|
||||
+106
@@ -0,0 +1,106 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record id="view_stock_tree" model="ir.ui.view">
|
||||
<field name="name">report.stock.move.tree</field>
|
||||
<field name="model">report.stock.move</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Stock Orders Statistics">
|
||||
<field name="date"/>
|
||||
<field name="year" invisible="1" />
|
||||
<field name="month" invisible="1"/>
|
||||
<field name="day" invisible="1"/>
|
||||
<field name="product_id"/>
|
||||
<field name="product_qty"/>
|
||||
<field name="location_id"/>
|
||||
<field name="state"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_stock_graph" model="ir.ui.view">
|
||||
<field name="name">report.stock.move.graph</field>
|
||||
<field name="model">report.stock.move</field>
|
||||
<field name="type">graph</field>
|
||||
<field name="arch" type="xml">
|
||||
<graph string="Stock Moves Statistics" type="bar">
|
||||
<field name="product_id"/>
|
||||
<field name="product_qty"/>
|
||||
</graph>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_stock_search" model="ir.ui.view">
|
||||
<field name="name">report.stock.move.search</field>
|
||||
<field name="model">report.stock.move</field>
|
||||
<field name="type">search</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Stock Move">
|
||||
<group>
|
||||
<filter icon="terp-stock"
|
||||
string="This Year"
|
||||
domain="[('year','=',time.strftime('%%Y'))]"
|
||||
help="Stock Moves of the year"/>
|
||||
<filter icon="terp-stock"
|
||||
string="This Month"
|
||||
domain="[('month','=',time.strftime('%%m'))]"
|
||||
help="Stock Moves of this month"/>
|
||||
<filter icon="terp-stock"
|
||||
string="Current Stock"
|
||||
separator="1"
|
||||
domain="[('date', '=', time.strftime('%%Y-%%m-%%d')]"
|
||||
help="Stock Moves of today"/>
|
||||
<separator orientation="vertical"/>
|
||||
|
||||
<filter string="Waiting"
|
||||
icon="terp-stock"
|
||||
domain="[('state','=','waiting')]"
|
||||
help = "Confirmed Stock-Moves"/>
|
||||
|
||||
<filter string="Available"
|
||||
icon="terp-stock"
|
||||
domain="[('state','=','assigned')]"
|
||||
help = "Available Stock-Moves"/>
|
||||
|
||||
<filter string="Done"
|
||||
icon="terp-stock"
|
||||
domain="[('state','=','done')]"
|
||||
help = "Completed Stock-Moves"/>
|
||||
|
||||
<separator orientation="vertical"/>
|
||||
<field name="product_id" select="1" widget="selection"/>
|
||||
<field name="location_id" select="1" widget="selection"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="1" string="Group By..." >
|
||||
<filter string="Product" icon="terp-stock" context="{'group_by':'product_id'}"/>
|
||||
<filter string="Location" icon="terp-stock" context="{'group_by':'location_id'}"/>
|
||||
<filter string="State" icon="terp-stock" context="{'group_by':'state'}"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="Day" icon="terp-stock" context="{'group_by':'day'}"/>
|
||||
<filter string="Month" icon="terp-stock" context="{'group_by':'date'}"/>
|
||||
<filter string="Year" icon="terp-stock" context="{'group_by':'year'}"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_stock_move_report" model="ir.actions.act_window">
|
||||
<field name="name">Stock Moves</field>
|
||||
<field name="res_model">report.stock.move</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,graph</field>
|
||||
<field name="search_view_id" ref="view_stock_search"/>
|
||||
|
||||
</record>
|
||||
|
||||
<menuitem
|
||||
id="stock.next_id_61"
|
||||
name="Reporting"
|
||||
parent="stock.menu_stock_root" groups="base.group_user"/>
|
||||
|
||||
<menuitem action="action_stock_move_report" id="menu_action_stock_move_report" parent="next_id_61" sequence="5"/>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
Reference in New Issue
Block a user