[MERGE] merged the usability branch (with fixesssss)

bzr revid: qdp-launchpad@tinyerp.com-20101015165315-qigrk92klwozhv5f
This commit is contained in:
qdp-launchpad@tinyerp.com 2010-10-15 18:53:15 +02:00
commit e43a45fc9c
49 changed files with 440 additions and 301 deletions

View File

@ -35,9 +35,10 @@
</record>
<act_window id="action_merge_opportunities"
multi="True"
key2="client_action_multi" name="Merge Opportunities"
res_model="crm.merge.opportunity" src_model="crm.lead"
view_mode="form" target="new" view_type="form" />
</data>
</openerp>
</openerp>

View File

@ -2,10 +2,6 @@
<openerp>
<data>
<menuitem id="base.dashboard" name="Dashboards" sequence="2" parent="base.reporting_menu"/>
<menuitem
id="menu_hr_deshboard"
name="Human Resources"
parent="base.dashboard"/>
<!-- This board view will be complete by other hr_* modules-->
<record id="board_hr_form" model="ir.ui.view">
@ -32,6 +28,11 @@
<field name="usage">menu</field>
<field name="view_id" ref="board_hr_form"/>
</record>
<menuitem id="menu_hr_root" icon="terp-hr" name="Human Resources" sequence="15" action="open_board_hr"/>
<menuitem id="menu_hr_root" icon="terp-hr" name="Human Resources" sequence="15"/>
<menuitem
id="menu_hr_deshboard"
name="Human Resources"
parent="base.dashboard"
action="open_board_hr"/>
</data>
</openerp>

View File

@ -82,16 +82,23 @@ class hr_job(osv.osv):
def _no_of_employee(self, cr, uid, ids, name, args, context=None):
res = {}
for emp in self.browse(cr, uid, ids):
res[emp.id] = len(emp.employee_ids or [])
for job in self.browse(cr, uid, ids, context):
res[job.id] = len(job.employee_ids or [])
return res
def _no_of_recruitement(self, cr, uid, ids, name, args, context=None):
res = {}
for job in self.browse(cr, uid, ids, context):
res[job.id] = job.expected_employees - job.no_of_employee
return res
_name = "hr.job"
_description = "Job Description"
_columns = {
'name': fields.char('Job Name', size=128, required=True, select=True),
'expected_employees': fields.integer('Expected Employees', help='Required number of Employees'),
'no_of_employee': fields.function(_no_of_employee, method=True, string='No of Employees', type='integer', help='Number of Employees selected'),
'expected_employees': fields.integer('Expected Employees', help='Required number of Employees in total for that job.'),
'no_of_employee': fields.function(_no_of_employee, method=True, string="No of Employee", help='Number of employee with that job.'),
'no_of_recruitment': fields.function(_no_of_recruitement, method=True, string='Expected in Recruitment', readonly=True),
'employee_ids': fields.one2many('hr.employee', 'job_id', 'Employees'),
'description': fields.text('Job Description'),
'requirements': fields.text('Requirements'),
@ -102,9 +109,17 @@ class hr_job(osv.osv):
_defaults = {
'expected_employees': 1,
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'hr.job', context=c),
'state': 'open'
'state': 'open',
}
def on_change_expected_employee(self, cr, uid, ids, expected_employee, no_of_employee, context=None):
if context is None:
context = {}
result={}
if expected_employee:
result['no_of_recruitment'] = expected_employee - no_of_employee
return {'value': result}
def job_old(self, cr, uid, ids, *args):
self.write(cr, uid, ids, {'state': 'old'})
return True

View File

@ -324,8 +324,9 @@
<field name="name" />
<field name="department_id" />
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
<field name="expected_employees"/>
<field name="expected_employees" on_change="on_change_expected_employee(expected_employees,no_of_employee)"/>
<field name="no_of_employee"/>
<field name="no_of_recruitment"/>
</group>
<newline/>
<notebook colspan="4">
@ -360,6 +361,7 @@
<field name="company_id" groups="base.group_multi_company"/>
<field name="expected_employees"/>
<field name="no_of_employee"/>
<field name="no_of_recruitment"/>
<field name="state"/>
</tree>
</field>

View File

@ -32,7 +32,6 @@
'author': 'OpenERP SA',
'depends': ['hr'],
'update_xml': [
'security/hr_security.xml',
'security/ir.model.access.csv',
'hr_attendance_view.xml',
'hr_attendance_report.xml',

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="1">
</data>
</openerp>

View File

@ -36,7 +36,6 @@
'depends': ['hr'],
'init_xml': ['hr_contract_data.xml'],
'update_xml': [
'security/hr_contract_security.xml',
'security/ir.model.access.csv',
'hr_contract_view.xml'
],

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="1">
</data>
</openerp>

View File

@ -267,7 +267,18 @@ class hr_evaluation(osv.osv):
context = {}
self.write(cr, uid, ids,{'state':'cancel'}, context=context)
return True
def write(self, cr, uid, ids, vals, context=None):
if context is None:
context = {}
if 'date' in vals:
new_vals = {'date_deadline': vals.get('date')}
obj_hr_eval_iterview = self.pool.get('hr.evaluation.interview')
for evalutation in self.browse(cr, uid, ids, context=context):
for survey_req in evalutation.survey_request_ids:
obj_hr_eval_iterview.write(cr, uid, [survey_req.id], new_vals, context=context)
return super(hr_evaluation, self).write(cr, uid, ids, vals, context=context)
hr_evaluation()
class survey_request(osv.osv):
@ -320,7 +331,7 @@ class hr_evaluation_interview(osv.osv):
for id in self.browse(cr, uid, ids, context=context):
flag = False
wating_id = 0
tot_done_req = 0
tot_done_req = 1
if not id.evaluation_id.id:
raise osv.except_osv(_('Warning !'),_("You cannot start evaluation without Evaluation."))
records = hr_eval_obj.browse(cr, uid, [id.evaluation_id.id], context=context)[0].survey_request_ids

View File

@ -29,14 +29,14 @@ class hr_evaluation_reminder(osv.osv_memory):
}
def send_mail(self, cr, uid, ids, context=None):
hr_evaluation_obj = self.pool.get('hr_evaluation.evaluation')
hr_evaluation_interview_obj = self.pool.get('hr.evaluation.interview')
if context is None:
context = {}
evaluation_data = self.read(cr, uid, ids, context=context)[0]
for waiting_id in hr_evaluation_obj.browse(cr, uid, evaluation_data['evaluation_id'], context=context).survey_request_ids:
if waiting_id.state == "waiting_answer" and waiting_id.user_to_review_id.work_email :
msg = " Hello %s, \n\n Kindly post your response for %s survey. \n\n Thanks," %(waiting_id.user_to_review_id.name, waiting_id.survey_id.title)
tools.email_send(tools.config['email_from'], [waiting_id.user_to_review_id.work_email],\
current_interview = hr_evaluation_interview_obj.browse(cr, uid, evaluation_data.get('evaluation_id'))
if current_interview.state == "waiting_answer" and current_interview.user_to_review_id.work_email :
msg = " Hello %s, \n\n Kindly post your response for '%s' survey interview. \n\n Thanks," %(current_interview.user_to_review_id.name, current_interview.survey_id.title)
tools.email_send(tools.config['email_from'], [current_interview.user_to_review_id.work_email],\
'Reminder to fill up Survey', msg)
return {'type': 'ir.actions.act_window_close'}

View File

@ -95,7 +95,7 @@
<separator orientation="vertical"/>
<filter string="Product" icon="terp-accessories-archiver" context="{'group_by':'product_id'}"/>
<separator orientation="vertical" groups="analytic.group_analytic_accounting"/>
<filter string="Analytic account" icon="terp-folder-green" context="{'group_by':'analytic_account'}" groups="analytic.group_analytic_accounting"/>
<filter string="Analytic account" icon="terp-folder-violet" context="{'group_by':'analytic_account'}" groups="analytic.group_analytic_accounting"/>
<separator orientation="vertical" groups="analytic.group_analytic_accounting"/>
<filter string="State" icon="terp-stock_effects-object-colorize" context="{'group_by':'state'}"/>
<filter string="Company" icon="terp-go-home" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>

View File

@ -137,7 +137,7 @@
<field name="notes" nolabel="1" colspan="4" />
<newline/>
<field name="state" colspan="2"/>
<group colspan="2">
<group colspan="2" col="6">
<button string="Cancel" name="cancel" states="validate,refuse" type="workflow" icon="gtk-cancel" groups="base.group_hr_manager"/>
<button string="Confirm" name="confirm" states="draft" type="workflow" icon="gtk-yes" groups="base.group_hr_user,base.group_hr_manager"/>
<button string="Approve" name="validate" states="confirm" type="workflow" icon="gtk-apply" groups="base.group_hr_manager"/>

View File

@ -88,7 +88,7 @@
</record>
<record id="action_hr_available_holidays_report" model="ir.actions.act_window">
<field name="name">Available Holidays</field>
<field name="name">Leaves Analysis</field>
<field name="res_model">available.holidays.report</field>
<field name="view_type">form</field>
<field name="view_mode">tree,graph</field>
@ -110,7 +110,7 @@
<field name="act_window_id" ref="action_hr_available_holidays_report"/>
</record>
<menuitem name="Available Holidays" id="menu_hr_available_holidays_report_tree" action="action_hr_available_holidays_report" parent="menu_hr_reporting_holidays"/>
<menuitem name="Leaves Analysis" id="menu_hr_available_holidays_report_tree" action="action_hr_available_holidays_report" parent="menu_hr_reporting_holidays"/>
</data>
</openerp>

View File

@ -22,67 +22,6 @@
import tools
from osv import fields,osv
class hr_holidays_report(osv.osv):
_name = "hr.holidays.report"
_description = "Leaves Statistics By Employee and category"
_auto = False
_rec_name = 'date'
_columns = {
'date': fields.date('Date', readonly=True),
'delay_approve': fields.float('Delay to Approve', digits=(16,2),readonly=True),
'year': fields.char('Year', size=4, readonly=True),
'day': fields.char('Day', size=15, 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),
'date_from' : fields.datetime('Start Date', readonly=True),
'date_to' : fields.datetime('End Date', readonly=True),
'number_of_days_temp': fields.float('Number of Days', readonly=True),
'employee_id' : fields.many2one('hr.employee', "Employee's Name", readonly=True),
'category_id' : fields.many2one('hr.employee.category', "Category's Name", readonly=True),
'user_id':fields.many2one('res.users', 'User', readonly=True),
'holiday_status_id' : fields.many2one("hr.holidays.status", "Leave Type",readonly=True),
'department_id':fields.many2one('hr.department','Department',readonly=True),
'state': fields.selection([('draft', 'Draft'),
('confirm', 'Waiting Validation'),
('refuse', 'Refused'),
('validate', 'Validated'),
('cancel', 'Cancelled')]
,'State', readonly=True),
}
_order = 'date desc'
def init(self, cr):
tools.drop_view_if_exists(cr, 'hr_holidays_report')
cr.execute("""
create or replace view hr_holidays_report as (
select
min(s.id) as id,
date_trunc('day',s.create_date) as date,
date_trunc('day',s.date_from) as date_from,
date_trunc('day',s.date_to) as date_to,
sum(s.number_of_days_temp) as number_of_days_temp,
s.employee_id,
s.category_id,
s.user_id as user_id,
to_char(s.date_from, 'YYYY') as year,
to_char(s.date_from, 'MM') as month,
to_char(s.date_from, 'YYYY-MM-DD') as day,
s.holiday_status_id,
s.department_id,
s.state,
avg(extract('epoch' from age(s.create_date,CURRENT_DATE)))/(3600*24) as delay_approve
from
hr_holidays s
WHERE type='remove'
GROUP BY
s.create_date,s.state,s.date_from,s.date_to,
s.employee_id,s.user_id,s.holiday_status_id,
s.department_id, s.category_id
)
""")
hr_holidays_report()
class hr_holidays_remaining_leaves_user(osv.osv):
_name = "hr.holidays.remaining.leaves.user"
_description = "Total holidays by type"

View File

@ -2,111 +2,6 @@
<openerp>
<data>
<record id="view_hr_holidays_report_tree" model="ir.ui.view">
<field name="name">hr.holidays.report.tree</field>
<field name="model">hr.holidays.report</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree colors="blue:state in ('draft');black:state in ('confirm','refuse','validate');gray:state in('cancel')" string="Leaves Statistics">
<field name="date" invisible="1"/>
<field name="employee_id" invisible="1"/>
<field name="category_id" invisible="1"/>
<field name="user_id" invisible="1"/>
<field name="date_from" invisible="1"/>
<field name="date_to" invisible="1"/>
<field name="number_of_days_temp" sum="#Days"/>
<field name="delay_approve"/>
<field name="holiday_status_id" invisible="1"/>
<field name="department_id" invisible="1"/>
<field name="year" invisible="1"/>
<field name="day" invisible="1"/>
<field name="month" invisible="1"/>
<field name="state" invisible="1"/>
</tree>
</field>
</record>
<record id="view_hr_holidays_report_graph" model="ir.ui.view">
<field name="name">hr.holidays.report.graph</field>
<field name="model">hr.holidays.report</field>
<field name="type">graph</field>
<field name="arch" type="xml">
<graph string="Leaves Statistics" type="bar">
<field name="employee_id"/>
<field name="number_of_days_temp" operator="+"/>
<field name="state" group = "True"/>
</graph>
</field>
</record>
<record id="view_hr_holidays_report_search" model="ir.ui.view">
<field name="name">hr.holidays.report.search</field>
<field name="model">hr.holidays.report</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Leaves">
<group>
<filter icon="terp-go-year" string=" Year "
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')),('date','&gt;=',time.strftime('%%Y-01-01'))]" help="Leaves taken in current year"/>
<filter icon="terp-go-month" string=" Month " name="month"
domain="[('date','&lt;=',(datetime.date.today()+relativedelta(day=31)).strftime('%%Y-%%m-%%d')),('date','&gt;=',(datetime.date.today()-relativedelta(day=1)).strftime('%%Y-%%m-%%d'))]"
help="Leaves taken in current month"/>
<filter icon="terp-go-month" string=" Month-1 " separator="1"
domain="[('date','&lt;=', (datetime.date.today() - relativedelta(day=31, months=1)).strftime('%%Y-%%m-%%d')),('date','&gt;=',(datetime.date.today() - relativedelta(day=1,months=1)).strftime('%%Y-%%m-%%d'))]"
help="Leaves taken in last month"/>
<separator orientation="vertical"/>
<filter string="Future Leaves" icon="terp-gtk-media-pause" domain="[('state', 'in' ,('draft','confirm'))]"
help = "Draft and Confirmed leaves"/>
<filter string="Validated" name="Validated" icon="terp-camera_test" domain="[('state','=','validate')]"
help = "Pending Leaves"/>
<filter icon="gtk-cancel" string="Cancelled" domain="[('state','=','cancel')]"/>
<separator orientation="vertical"/>
<field name="department_id"/>
<field name="employee_id"/>
</group>
<newline/>
<group expand="0" string="Extended Filters..." colspan="10" col="12">
<field name="holiday_status_id"/>
<field name="category_id"/>
<separator orientation="vertical"/>
<field name="user_id"/>
<newline/>
<field name="date_from"/>
<field name="date_to"/>
</group>
<newline/>
<group expand="1" string="Group By..." colspan="10" col="12">
<filter icon="terp-personal" string="Employee" name="Employee" context="{'group_by':'employee_id'}"
help="Leaves by empolyee"/>
<filter string="Validation User" name="User" icon="terp-personal" context="{'group_by':'user_id'}"/>
<separator orientation="vertical"/>
<filter string="Department" name="department" icon="terp-personal+" context="{'group_by':'department_id'}"/>
<separator orientation="vertical"/>
<filter icon="terp-stock_symbol-selection" string="Category" context="{'group_by':'category_id'}"
help="Leaves by category"/>
<filter string="Type" icon="terp-stock_symbol-selection" context="{'group_by':'holiday_status_id'}"/>
<separator orientation="vertical"/>
<filter string="State" icon="terp-stock_effects-object-colorize" context="{'group_by':'state'}"/>
<separator orientation="vertical"/>
<filter string="Day" icon="terp-go-today" context="{'group_by':'day'}" help="Creation Date"/>
<filter string="Month" icon="terp-go-month" context="{'group_by':'month'}" help="Creation Date"/>
<filter string="Year" icon="terp-go-year" context="{'group_by':'year'}" help="Creation Date"/>
</group>
</search>
</field>
</record>
<record id="action_hr_holidays_report_all" model="ir.actions.act_window">
<field name="name">Leaves Analysis</field>
<field name="res_model">hr.holidays.report</field>
<field name="view_type">form</field>
<field name="view_mode">tree,graph</field>
<field name="context">{'search_default_Employee':1,'search_default_department':1,"search_default_Validated":1, 'group_by':[], 'group_by_no_leaf':1} </field>
<field name="search_view_id" ref="view_hr_holidays_report_search"/>
</record>
<menuitem action="action_hr_holidays_report_all" id="menu_hr_holidays_report_all" parent="menu_hr_reporting_holidays" sequence="0"/>
<record id="view_hr_holidays_remaining_leaves_user_tree" model="ir.ui.view">
<field name="name">hr.holidays.remaining.leaves.user.tree</field>
<field name="model">hr.holidays.remaining.leaves.user</field>

View File

@ -2,6 +2,5 @@
"access_hr_holydays_status_user","hr.holidays.status user","model_hr_holidays_status","base.group_hr_user",1,1,1,1
"access_hr_holidays_user","hr.holidays.user","model_hr_holidays","base.group_hr_user",1,1,1,1
"access_hr_holidays_remain_user","hr.holidays.ramain.user","model_hr_holidays_remaining_leaves_user","base.group_hr_user",1,1,1,1
"access_hr_holidays_report_manager","hr.holidays.report.manager","model_hr_holidays_report","base.group_hr_manager",1,1,1,1
"access_resource_calendar_leaves_manager","resource_calendar_leaves_manager","resource.model_resource_calendar_leaves","base.group_hr_manager",1,1,1,1
"access_available_holidays_report_user","hr.available.holidays.report.user","model_available_holidays_report","base.group_hr_user",1,1,1,1

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_hr_holydays_status_user hr.holidays.status user model_hr_holidays_status base.group_hr_user 1 1 1 1
3 access_hr_holidays_user hr.holidays.user model_hr_holidays base.group_hr_user 1 1 1 1
4 access_hr_holidays_remain_user hr.holidays.ramain.user model_hr_holidays_remaining_leaves_user base.group_hr_user 1 1 1 1
access_hr_holidays_report_manager hr.holidays.report.manager model_hr_holidays_report base.group_hr_manager 1 1 1 1
5 access_resource_calendar_leaves_manager resource_calendar_leaves_manager resource.model_resource_calendar_leaves base.group_hr_manager 1 1 1 1
6 access_available_holidays_report_user hr.available.holidays.report.user model_available_holidays_report base.group_hr_user 1 1 1 1

View File

@ -429,17 +429,9 @@ class hr_applicant(crm.crm_case, osv.osv):
message = _('Applicant ') + " '" + name + "' "+ _("is Hired.")
self.log(cr, uid, id, message)
stage_id = self.pool.get('hr.recruitment.stage').search(cr, uid, [('name','=','Contract Signed')])
self.write(cr, uid, ids,{'stage_id':stage_id[0]})
applicant = self.browse(cr, uid, ids)[0]
if applicant.job_id :
emp_id = employee_obj.create(cr,uid,{'name':applicant.name,'job_id':applicant.job_id.id})
job_data = job_obj.browse(cr,uid, applicant.job_id.id)
expected_emp = job_data['expected_employees'] - 1
if expected_emp == 0:
job_obj.write(cr,uid, [applicant.job_id.id],{'state':'old'})
job_obj.write(cr,uid, [applicant.job_id.id],{'expected_employees':expected_emp})
return res
def case_reset(self, cr, uid, ids, *args):
@ -450,18 +442,9 @@ class hr_applicant(crm.crm_case, osv.osv):
@param ids: List of case Ids
@param *args: Tuple Value for additional Params
"""
applicant = self.browse(cr, uid, ids)[0]
if applicant.job_id :
job_obj = self.pool.get('hr.job')
emp_obj = self.pool.get('hr.employee')
job_data = job_obj.browse(cr,uid, applicant.job_id.id)
expected_emp = job_data['expected_employees'] + 1
emp_id = emp_obj.search(cr,uid, [('job_id','=',applicant.job_id.id),('name','=',applicant.name)])
emp_obj.unlink(cr, uid, emp_id)
job_obj.write(cr,uid, [applicant.job_id.id],{'expected_employees':expected_emp})
res = super(hr_applicant, self).case_reset(cr, uid, ids, *args)
self.write(cr, uid, ids, {'date_open': False, 'date_closed':False})
return res

View File

@ -297,7 +297,7 @@
<field name="type">form</field>
<field name="inherit_id" ref="hr.view_hr_job_form"/>
<field name="arch" type="xml">
<field name="no_of_employee" position="after">
<field name="department_id" position="after">
<field name="survey_id"/>
</field>
</field>

View File

@ -468,7 +468,7 @@
<filter string="User" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}"/>
<separator orientation="vertical"/>
<filter string="Product" icon="terp-accessories-archiver" domain="[]" context="{'group_by':'product_id'}"/>
<filter string="Analytic Account" icon="terp-folder-green" domain="[]" context="{'group_by':'analytic_account_id'}"/>
<filter string="Analytic Account" icon="terp-folder-violet" domain="[]" context="{'group_by':'analytic_account_id'}"/>
<filter string="General Account" icon="terp-folder-orange" domain="[]" context="{'group_by':'general_account_id'}"/>
</group>
</search>

View File

@ -28,8 +28,6 @@
I create invoice on analytic Line using "Invoice analytic Line" wizard.
-
!record {model: hr.timesheet.invoice.create, id: hr_timesheet_invoice_create_0}:
accounts:
- account.analytic_sednacom
date: 1
name: 1
price: 1
@ -46,10 +44,12 @@
I check that Invoice is created for this timesheet.
-
!python {model: account.analytic.line}: |
account_id = self.pool.get('account.analytic.line')
accounts = account_id.browse(cr, uid, [ref("account_analytic_line_developyamlforhrmodule0")])[0]
exp = self.browse(cr, uid, [ref('account_analytic_line_developyamlforhrmodule0')])[0]
analytic_account_obj = self.pool.get('account.analytic.account')
data = self.pool.get('hr.timesheet.invoice.create').read(cr, uid, [ref("hr_timesheet_invoice_create_0")], [], context)[0]
account_ids = data['accounts']
account_ids = accounts['account_id']
for account in analytic_account_obj.browse(cr, uid, account_ids, context):
partner = account.partner_id.id
@ -81,4 +81,4 @@
-
I can also make some theoretical revenue reports.
-
I can also see timesheet profit using Timesheet profit report.
I can also see timesheet profit using Timesheet profit report.

View File

@ -55,6 +55,7 @@ The validation can be configured in the company:
'process/hr_timesheet_sheet_process.xml',
'board_hr_timesheet_view.xml',
'report/hr_timesheet_report_view.xml',
'report/timesheet_report_view.xml',
'wizard/hr_timesheet_current_view.xml',
'hr_timesheet_sheet_data.xml'
],

View File

@ -3,7 +3,7 @@
<data>
<menuitem
id="base.menu_hr_dasboard" name="Dashboard" parent="hr.menu_hr_reporting"
sequence="0" groups="base.group_hr_manager"/>
sequence="0"/>
<menuitem
action="hr.open_board_hr"
icon="terp-graph"

View File

@ -19,5 +19,7 @@
#
##############################################################################
import timesheet_report
import hr_timesheet_report
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -72,7 +72,7 @@
<filter string="User" name="group_user_id" icon="terp-personal" context="{'group_by':'user_id'}"/>
<filter string="Product" icon="terp-accessories-archiver" context="{'group_by':'product_id'}"/>
<separator orientation="vertical" groups="analytic.group_analytic_accounting"/>
<filter string="Analytic Account" icon="terp-folder-green" context="{'group_by':'account_id'}" groups="analytic.group_analytic_accounting"/>
<filter string="Analytic Account" icon="terp-folder-violet" context="{'group_by':'account_id'}" groups="analytic.group_analytic_accounting"/>
<filter string="General Account" icon="terp-folder-orange" context="{'group_by':'general_account_id'}"/>
<filter string="Company" icon="terp-go-home" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
<separator orientation="vertical"/>

View File

@ -0,0 +1,122 @@
# -*- 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 timesheet_report(osv.osv):
_name = "timesheet.report"
_description = "Timesheet"
_auto = False
_columns = {
'year': fields.char('Year',size=64,required=False, 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),
'day': fields.char('Day', size=128, readonly=True),
'name': fields.char('Description', size=64,readonly=True),
'product_id' : fields.many2one('product.product', 'Product'),
'general_account_id' : fields.many2one('account.account', 'General Account', readonly=True),
'user_id': fields.many2one('res.users', 'User',readonly=True),
'to_invoice': fields.many2one('hr_timesheet_invoice.factor', 'Type of Invoicing',readonly=True),
'account_id': fields.many2one('account.analytic.account', 'Analytic Account',readonly=True),
'nbr': fields.integer('#Nbr',readonly=True),
'total_diff': fields.float('#Total Diff',readonly=True),
'total_timesheet': fields.float('#Total Timesheet',readonly=True),
'total_attendance': fields.float('#Total Attendance',readonly=True),
'company_id': fields.many2one('res.company', 'Company',readonly=True),
'department_id':fields.many2one('hr.department','Department',readonly=True),
'date_from': fields.date('Date from',readonly=True,),
'date_to': fields.date('Date to',readonly=True),
'date_current': fields.date('Current date', required=True),
'state' : fields.selection([
('new', 'New'),
('draft','Draft'),
('confirm','Confirmed'),
('done','Done')], 'State', readonly=True),
'quantity': fields.float('#Quantity',readonly=True),
'cost': fields.float('#Cost',readonly=True),
}
def init(self, cr):
tools.drop_view_if_exists(cr, 'timesheet_report')
cr.execute("""
create or replace view timesheet_report as (
select
min(aal.id) as id,
htss.date_current,
htss.name,
htss.date_from,
htss.date_to,
to_char(htss.date_current,'YYYY') as year,
to_char(htss.date_current,'MM') as month,
to_char(htss.date_current, 'YYYY-MM-DD') as day,
count(*) as nbr,
aal.unit_amount as quantity,
aal.amount as cost,
aal.account_id,
aal.product_id,
(SELECT sum(day.total_difference)
FROM hr_timesheet_sheet_sheet AS sheet
LEFT JOIN hr_timesheet_sheet_sheet_day AS day
ON (sheet.id = day.sheet_id
AND day.name = sheet.date_current) where sheet.id=htss.id) as total_diff,
(SELECT sum(day.total_timesheet)
FROM hr_timesheet_sheet_sheet AS sheet
LEFT JOIN hr_timesheet_sheet_sheet_day AS day
ON (sheet.id = day.sheet_id
AND day.name = sheet.date_current) where sheet.id=htss.id) as total_timesheet,
(SELECT sum(day.total_attendance)
FROM hr_timesheet_sheet_sheet AS sheet
LEFT JOIN hr_timesheet_sheet_sheet_day AS day
ON (sheet.id = day.sheet_id
AND day.name = sheet.date_current) where sheet.id=htss.id) as total_attendance,
aal.to_invoice,
aal.general_account_id,
htss.user_id,
htss.company_id,
htss.department_id,
htss.state
from account_analytic_line as aal
left join hr_analytic_timesheet as hat ON (hat.line_id=aal.id)
left join hr_timesheet_sheet_sheet as htss ON (hat.line_id=htss.id)
group by
to_char(htss.date_current,'YYYY'),
to_char(htss.date_current,'MM'),
to_char(htss.date_current, 'YYYY-MM-DD'),
aal.account_id,
htss.date_from,
htss.date_to,
aal.unit_amount,
aal.amount,
htss.date_current,
aal.to_invoice,
aal.product_id,
aal.general_account_id,
htss.name,
htss.company_id,
htss.state,
htss.id,
htss.department_id,
htss.user_id
)
""")
timesheet_report()

View File

@ -0,0 +1,126 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_timesheet_report_graph" model="ir.ui.view">
<field name="name">timesheet.report.graph</field>
<field name="model">timesheet.report</field>
<field name="type">graph</field>
<field name="arch" type="xml">
<graph string="Timesheet" type="bar">
<field name="user_id" />
<field name="quantity" operator = "+"/>
<field name="state" group = "True"/>
</graph>
</field>
</record>
<record id="view_timesheet_report_tree" model="ir.ui.view">
<field name="name">timesheet.report.tree</field>
<field name="model">timesheet.report</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree colors="blue:state in ('draft');black:state in ('confirm','new');gray:state in('cancel')" string="Timesheet">
<field name="date_current" invisible="1"/>
<field name="name" invisible="1"/>
<field name="user_id" invisible="1"/>
<field name="date_from" invisible="1"/>
<field name="date_to" invisible="1"/>
<field name="state" invisible="1"/>
<field name="department_id" invisible="1"/>
<field name="company_id" invisible="1"/>
<field name="to_invoice" invisible="1"/>
<field name="product_id" invisible="1"/>
<field name="account_id" invisible="1"/>
<field name="general_account_id" invisible="1"/>
<field name="year" invisible="1"/>
<field name="day" invisible="1"/>
<field name="month" invisible="1"/>
<field name="quantity" sum="#Quantity"/>
<field name="cost" sum="#Cost"/>
<field name="total_diff" sum="#Total Diff"/>
<field name="total_timesheet" sum="#Total Timesheet"/>
<field name="total_attendance" sum="#Total Attendance"/>
</tree>
</field>
</record>
<record id="view_timesheet_report_search" model="ir.ui.view">
<field name="name">timesheet.report.search</field>
<field name="model">timesheet.report</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Timesheet">
<group col="10" colspan="12">
<filter icon="terp-go-year" string=" Year "
domain="[('date_current','&lt;=', time.strftime('%%Y-%%m-%%d')),('date_current','&gt;',(datetime.date.today()-datetime.timedelta(days=365)).strftime('%%Y-%%m-%%d'))]"
help="Timesheet in current year"/>
<filter icon="terp-go-month" string=" Month "
name="month"
domain="[('date_current','&lt;=', time.strftime('%%Y-%%m-%%d')), ('date_current','&gt;',(datetime.date.today()-datetime.timedelta(days=30)).strftime('%%Y-%%m-%%d'))]"
help="Timesheet in current month"/>
<filter icon="terp-go-month"
string=" Month-1 "
domain="[('date_current','&lt;=', (datetime.date (int(time.strftime('%%Y')), datetime.date.today().month, 1) - datetime.timedelta (days = 1)).strftime('%%Y-%%m-%%d')),('date_current','&gt;',(datetime.date (int(time.strftime('%%Y')), datetime.date.today().month-1, 1)).strftime('%%Y-%%m-%%d'))]"
help="Timesheet of last month"/>
<separator orientation="vertical"/>
<filter icon="terp-document-new"
string="Draft"
domain="[('state','=','draft')]"/>
<filter icon="terp-camera_test"
string="Confirmed"
domain="[('state','=','confirm')]"/>
<filter icon="terp-dialog-close"
string="Done"
domain="[('state','=','done')]"/>
<separator orientation="vertical"/>
<field name="account_id"/>
<field name="user_id" />
</group>
<newline/>
<group expand="0" string="Extended Filters..." groups="base.group_extended">
<field name="general_account_id"/>
<field name="to_invoice" widget="selection"/>
<separator orientation="vertical"/>
<field name="product_id"/>
<separator orientation="vertical"/>
<field name="department_id" widget="selection"/>
<separator orientation="vertical"/>
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
<newline/>
<field name="date_to"/>
<field name="date_from"/>
</group>
<newline/>
<group expand="1" string="Group By...">
<filter string="User" name="User_id" icon="terp-personal" context="{'group_by':'user_id'}"/>
<filter string="Department" icon="terp-personal+" context="{'group_by':'department_id'}"/>
<separator orientation="vertical"/>
<filter string="Product" icon="terp-accessories-archiver" context="{'group_by':'product_id'}"/>
<separator orientation="vertical"/>
<filter string="Type of Invoicing" icon="terp-stock_symbol-selection" context="{'group_by':'to_invoice'}"/>
<separator orientation="vertical"/>
<filter string="Analytic Account" icon="terp-folder-green" context="{'group_by':'account_id'}"/>
<filter string="General Account" icon="terp-folder-orange" context="{'group_by':'general_account_id'}"/>
<separator orientation="vertical"/>
<filter string="State" icon="terp-stock_effects-object-colorize" context="{'group_by':'state'}"/>
<separator orientation="vertical"/>
<filter string="Company" icon="terp-go-home" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
<separator orientation="vertical"/>
<filter string="Day" icon="terp-go-today" context="{'group_by':'day'}" help="Group by day of date"/>
<filter string="Month" icon="terp-go-month" context="{'group_by':'month'}" help="Group by month of date"/>
<filter string="Year" icon="terp-go-year" context="{'group_by':'year'}" help="Group by year of date"/>
</group>
</search>
</field>
</record>
<record id="action_timesheet_report_stat_all" model="ir.actions.act_window">
<field name="name">Timesheet Sheet Analysis</field>
<field name="res_model">timesheet.report</field>
<field name="view_type">form</field>
<field name="view_mode">tree,graph</field>
<field name="context">{'search_default_month':1,'search_default_User_id':1,'group_by_no_leaf':1,'group_by':[]}</field>
<field name="search_view_id" ref="view_timesheet_report_search"/>
</record>
<menuitem action="action_timesheet_report_stat_all" id="menu_timesheet_report_all"
parent="hr_timesheet.menu_hr_reporting_timesheet" sequence="1" groups="base.group_hr_manager"/>
</data>
</openerp>

View File

@ -6,3 +6,4 @@
"access_hr_timesheet_report","hr.timesheet.report","model_hr_timesheet_report","base.group_hr_manager",1,1,1,1
"access_hr_analytic_timesheet_system_user","hr.analytic.timesheet.system.user","model_hr_analytic_timesheet","base.group_user",1,0,0,0
"access_hr_timesheet_sheet_sheet_day","hr.timesheet.sheet.sheet.day.user","model_hr_timesheet_sheet_sheet_day","base.group_user",1,0,0,0
"access_timesheet_report_user","timesheet.report.user","model_timesheet_report","base.group_hr_manager",1,1,1,1

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
6 access_hr_timesheet_report hr.timesheet.report model_hr_timesheet_report base.group_hr_manager 1 1 1 1
7 access_hr_analytic_timesheet_system_user hr.analytic.timesheet.system.user model_hr_analytic_timesheet base.group_user 1 0 0 0
8 access_hr_timesheet_sheet_sheet_day hr.timesheet.sheet.sheet.day.user model_hr_timesheet_sheet_sheet_day base.group_user 1 0 0 0
9 access_timesheet_report_user timesheet.report.user model_timesheet_report base.group_hr_manager 1 1 1 1

View File

@ -32,6 +32,10 @@ class marketing_installer(osv.osv_memory):
'crm_profiling':fields.boolean('Profiling Tools',
help="Helps you to perform segmentation of partners and design segmentation questionnaires")
}
_defaults = {
'marketing_campaign': lambda *a: 1,
}
marketing_installer()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,48 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- Select an Open Sale Order -->
<record id="view_pos_payment" model="ir.ui.view">
<field name="name">Add payment :</field>
<field name="model">pos.make.payment</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Add payment :">
<group colspan="8" col="8" width="660" height="230">
<group colspan="4" col="4" width="150">
<label align="0.0" string="The register must be opened to be able to execute a payment." colspan="2"/>
<separator string="" orientation="vertical" rowspan="6"/>
</group>
<group colspan="4" col="4">
<field name="journal"/>
<field name="amount"/>
<field name="payment_date"/>
<!--field name="payment_name" /-->
<field name="invoice_wanted"/>
<field name="num_sale"/>
<field name="is_acc"/>
<group attrs="{'invisible':[('is_acc','=',False)]}" colspan="4" col="2">
<field name="product_id" attrs="{'required':[('is_acc', '=', True)]}" domain="[('type','=','service')]" on_change="onchange_product_id(product_id, amount)"/>
</group>
<newline/>
<group attrs="{'invisible':[('invoice_wanted','=',False)]}" colspan="4">
<field name="partner_id" attrs="{'required':[('invoice_wanted', '=', True)]}" colspan="2"/>
<field name="pricelist_id" attrs="{'required':[('invoice_wanted', '=', True)]}" colspan="2"/>
</group>
</group>
<separator colspan="8"/>
<group col="4" colspan="4"/>
<group col="4" colspan="4">
<group col="2" colspan="2"/>
<group col="2" colspan="2">
<button icon="gtk-stop" special="cancel" string="Cancel"/>
<button name="check" string="Make Payment" colspan="1" type="object" icon="terp-dolar"/>
</group>
</group>
</group>
</form>
<group colspan="6" col="6" >
<group colspan="3" >
<separator string="The register must be opened to be able to execute a payment." />
</group>
<newline/>
<group colspan="6">
<field name="journal"/>
<field name="payment_date"/>
<field name="num_sale" />
<field name="amount" />
<!--field name="payment_name" /-->
<field name="invoice_wanted" />
<field name="is_acc" />
</group>
<group attrs="{'invisible':[('is_acc','=',False)]}" colspan="3" >
<field name="product_id" attrs="{'required':[('is_acc', '=', True)]}" domain="[('type','=','service')]" on_change="onchange_product_id(product_id, amount)"/>
</group>
<newline/>
<group attrs="{'invisible':[('invoice_wanted','=',False)]}" colspan="3">
<field name="partner_id" attrs="{'required':[('invoice_wanted', '=', True)]}" colspan="2"/>
<field name="pricelist_id" attrs="{'required':[('invoice_wanted', '=', True)]}" colspan="2"/>
</group>
<separator colspan="6"/>
<group colspan="3"/>
<group colspan="3">
<group colspan="2"/>
<group colspan="2">
<button icon="gtk-stop" special="cancel" string="Cancel"/>
<button name="check" string="Make Payment" colspan="1" type="object" icon="terp-dolar"/>
</group>
</group>
</group>
</form>
</field>
</record>
<record id="action_pos_payment" model="ir.actions.act_window">
@ -54,5 +54,5 @@
<field name="target">new</field>
</record>
</data>
</openerp>
</openerp>

View File

@ -143,6 +143,23 @@ class pos_return(osv.osv_memory):
@return: Return the add product form again for adding more product
"""
current_rec = self.read(cr, uid, data[0], context=context)
order_obj =self.pool.get('pos.order')
line_obj = self.pool.get('pos.order.line')
pos_current = order_obj.browse(cr, uid, context.get('active_id'))
pos_line_ids = pos_current.lines
if pos_line_ids:
for pos_line in pos_line_ids:
line_field = "return"+str(pos_line.id)
pos_list = current_rec.keys()
newline_vals = {}
if line_field in pos_list :
less_qty = current_rec.get(line_field)
pos_cur_line = line_obj.browse(cr, uid, pos_line.id, context=context)
qty = pos_cur_line.qty
qty = qty - less_qty
newline_vals.update({'qty':qty})
line_obj.write(cr, uid, pos_line.id, newline_vals, context=context)
return {
'name': _('Add Product'),
'view_type': 'form',

View File

@ -407,7 +407,7 @@
<group expand="0" string="Group By..." colspan="4" col="20">
<filter string="Users" name="group_user_id" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}"/>
<separator orientation="vertical"/>
<filter string="Project" name="group_project_id" icon="terp-folder-blue" domain="[]" context="{'group_by':'project_id'}"/>
<filter string="Project" name="group_project_id" icon="terp-folder-violet" domain="[]" context="{'group_by':'project_id'}"/>
<separator orientation="vertical"/>
<filter string="Stage" name="group_stage_id" icon="terp-stage" domain="[]" context="{'group_by':'type_id'}"/>
<filter string="State" name="group_state" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>

View File

@ -89,7 +89,7 @@
domain="[('state','=','done')]"/>
<separator orientation="vertical"/>
<field name="project_id">
<filter icon="terp-folder-blue"
<filter icon="terp-folder-violet"
string="My Projects"
help="My Projects" domain="[('project_id.user_id','=',uid)]"/>
</field>
@ -121,7 +121,7 @@
</group>
<newline/>
<group expand="1" string="Group By..." colspan="10" col="12">
<filter string="Project" name="project" icon="terp-folder-blue" context="{'group_by':'project_id'}"/>
<filter string="Project" name="project" icon="terp-folder-violet" context="{'group_by':'project_id'}"/>
<filter string="Task" icon="terp-stock_align_left_24" context="{'group_by':'name'}" />
<separator orientation="vertical"/>
<filter string="Partner" icon="terp-partner" context="{'group_by':'partner_id'}" />

View File

@ -236,7 +236,7 @@
<filter string="Partner" icon="terp-partner" domain="[]"
context="{'group_by':'partner_id'}" />
<separator orientation="vertical"/>
<filter string="Project" icon="terp-folder-blue" domain="[]"
<filter string="Project" icon="terp-folder-violet" domain="[]"
context="{'group_by':'project_id'}" />
<filter string="Version" icon="terp-gtk-jump-to-rtl"
domain="[]" context="{'group_by':'version_id'}" />

View File

@ -121,7 +121,7 @@
domain="[]"
context="{'group_by':'section_id'}" />
<separator orientation="vertical" />
<filter string="Project" name="project" icon="terp-folder-blue" context="{'group_by':'project_id'}" />
<filter string="Project" name="project" icon="terp-folder-violet" context="{'group_by':'project_id'}" />
<filter string="Task" icon="terp-stock_align_left_24" domain="[]" context="{'group_by':'task_id'}"/>
<separator orientation="vertical" />
<filter string="Category" icon="terp-stock_symbol-selection"

View File

@ -83,7 +83,7 @@
<group expand="0" string="Group By..." colspan="4" col="20">
<filter name="resource" string="Resource" icon="terp-personal" domain="[]" context="{'group_by':'resource_id'}"/>
<separator orientation="vertical"/>
<filter string="Project" icon="terp-folder-blue" domain="[]" context="{'group_by':'project_id'}"/>
<filter string="Project" icon="terp-folder-violet" domain="[]" context="{'group_by':'project_id'}"/>
<filter string="Phase" icon="terp-project" domain="[]" context="{'group_by':'phase_id'}"/>
</group>
</search>
@ -264,7 +264,7 @@
<separator orientation="vertical"/>
<field name="name"/>
<field name="project_id">
<filter domain="[('project_id.user_id','=',uid)]" help="My Projects" icon="terp-personal"/>
<filter domain="[('project_id.user_id','=',uid)]" help="My Projects" icon="terp-folder-violet"/>
</field>
<field name="responsible_id"/>
<field name="date_start"/>
@ -273,7 +273,7 @@
<group expand="0" string="Group By..." colspan="4" col="20" groups="base.group_extended">
<filter string="Responsible" icon="terp-personal" domain="[]" context="{'group_by':'responsible_id'}"/>
<separator orientation="vertical"/>
<filter string="Project" icon="terp-folder-blue" domain="[]" context="{'group_by':'project_id'}" name="project"/>
<filter string="Project" icon="terp-folder-violet" domain="[]" context="{'group_by':'project_id'}" name="project"/>
<separator orientation="vertical"/>
<filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
<separator orientation="vertical"/>

View File

@ -82,7 +82,7 @@
<filter string="Message To" icon="terp-personal" domain="[]" context="{'group_by':'to_id'}"/>
<filter string="Message From" icon="terp-personal" domain="[]" context="{'group_by':'from_id'}"/>
<separator orientation="vertical"/>
<filter string="Project" icon="terp-folder-blue" domain="[]" context="{'group_by':'project_id'}"/>
<filter string="Project" icon="terp-folder-violet" domain="[]" context="{'group_by':'project_id'}"/>
</group>
</search>
</field>

View File

@ -166,7 +166,7 @@
<group expand="0" string="Group By..." colspan="4" col="20" groups="base.group_extended">
<filter string="Author" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}"/>
<separator orientation="vertical"/>
<filter string="Project" icon="terp-folder-blue" domain="[]" context="{'group_by':'project_id'}"/>
<filter string="Project" icon="terp-folder-violet" domain="[]" context="{'group_by':'project_id'}"/>
<filter string="Sprint" icon="terp-gtk-jump-to-ltr" domain="[]" context="{'group_by':'sprint_id'}"/>
<separator orientation="vertical"/>
<filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
@ -332,7 +332,7 @@
<filter string="Product owner" icon="terp-personal" domain="[]" context="{'group_by':'product_owner_id'}"/>
<filter string="Scrum Master" icon="terp-personal" domain="[]" context="{'group_by':'scrum_master_id'}"/>
<separator orientation="vertical"/>
<filter string="Project" icon="terp-folder-blue" domain="[]" context="{'group_by':'project_id'}"/>
<filter string="Project" icon="terp-folder-violet" domain="[]" context="{'group_by':'project_id'}"/>
<separator orientation="vertical"/>
<filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
<separator orientation="vertical"/>

View File

@ -37,6 +37,7 @@ from osv.orm import browse_record, browse_null
# Model definition
#
class purchase_order(osv.osv):
def _calc_amount(self, cr, uid, ids, prop, unknow_none, unknow_dict):
res = {}
for order in self.browse(cr, uid, ids):
@ -44,7 +45,7 @@ class purchase_order(osv.osv):
for oline in order.order_line:
res[order.id] += oline.price_unit * oline.product_qty
return res
def _amount_all(self, cr, uid, ids, field_name, arg, context=None):
res = {}
cur_obj=self.pool.get('res.currency')

View File

@ -30,7 +30,8 @@ Lines will only be merged if: &#13;
res_model="purchase.order.group"
src_model="purchase.order"
view_mode="form"
target="new"
target="new"
multi="True"
key2="client_action_multi"
groups="base.group_extended"
id="action_view_purchase_order_group"/>

View File

@ -102,7 +102,7 @@
<filter string="Default UoM" icon="terp-mrp" context="{'group_by':'uom_name'}"/>
<filter string="Category of Product" icon="terp-stock_symbol-selection" context="{'group_by':'categ_id'}"/>
<separator orientation="vertical" groups="analytic.group_analytic_accounting"/>
<filter string="Analytic Account" icon="terp-folder-green" context="{'group_by':'analytic_account_id'}" groups="analytic.group_analytic_accounting"/>
<filter string="Analytic Account" icon="terp-folder-violet" context="{'group_by':'analytic_account_id'}" groups="analytic.group_analytic_accounting"/>
<separator orientation="vertical" groups="analytic.group_analytic_accounting"/>
<filter string="State" icon="terp-stock_effects-object-colorize" context="{'group_by':'state'}"/>
<separator orientation="vertical"/>

View File

@ -54,7 +54,7 @@ def _incoterm_get(self, cr, uid, context=None):
class sale_order(osv.osv):
_name = "sale.order"
_description = "Sale Order"
def copy(self, cr, uid, id, default=None, context=None):
if context is None:
context = {}

View File

@ -26,6 +26,7 @@
<field name="view_mode">form</field>
<field name="view_id" ref="view_sale_order_make_invoice"/>
<field name="target">new</field>
<field name="multi">True</field>
</record>
<record model="ir.values" id="sale_order_make_invoice">

View File

@ -2371,7 +2371,7 @@ class stock_inventory(osv.osv):
'state': 'draft',
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'stock.inventory', context=c)
}
def _inventory_line_hook(self, cr, uid, inventory_line, move_vals):
""" Creates a stock move from an inventory line
@param inventory_line:

View File

@ -1,33 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_stock_fill_inventory" model="ir.ui.view">
<record id="view_stock_fill_inventory" model="ir.ui.view">
<field name="name">Import Inventory</field>
<field name="model">stock.fill.inventory</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Import Inventory">
<separator string="Import current product inventory from the following location" colspan="4" />
<field name="location_id"/>
<newline/>
<field name="recursive"/>
<newline/>
<field name="set_stock_zero"/>
<separator string="" colspan="4" />
<button special="cancel" string="_Cancel" icon='gtk-cancel'/>
<button name="fill_inventory" string="Fill Inventory" type="object" icon="gtk-ok"/>
<separator string="Import current product inventory from the following location" colspan="4" />
<field name="location_id"/>
<newline/>
<field name="recursive"/>
<newline/>
<field name="set_stock_zero"/>
<separator string="" colspan="4" />
<button special="cancel" string="_Cancel" icon='gtk-cancel'/>
<button name="fill_inventory" string="Fill Inventory" type="object" icon="gtk-ok"/>
</form>
</field>
</record>
</record>
<act_window name="Import Inventory"
res_model="stock.fill.inventory"
src_model="stock.inventory"
view_mode="form"
target="new"
context="{'search_default_in_location':1}"
<act_window name="Import Inventory"
res_model="stock.fill.inventory"
src_model="stock.inventory"
view_mode="form"
target="new"
multi="False"
context="{'search_default_in_location':1}"
key2="client_action_multi"
id="action_view_stock_fill_inventory"/>
id="action_view_stock_fill_inventory"/>
</data>
</openerp>

View File

@ -22,6 +22,7 @@
res_model="stock.inventory.merge"
src_model="stock.inventory"
view_mode="form"
multi="True"
target="new"
key2="client_action_multi"
id="action_view_stock_merge_inventories"/>

View File

@ -68,6 +68,7 @@ class survey(osv.osv):
'users': fields.many2many('res.users', 'survey_users_rel', 'sid', 'uid', 'Users'),
'send_response': fields.boolean('E-mail Notification on Answer'),
'type': fields.many2one('survey.type', 'Type'),
'invited_user_ids': fields.many2many('res.users', 'survey_invited_user_rel', 'sid', 'uid', 'Invited User'),
}
_defaults = {
'state': lambda * a: "draft",

View File

@ -206,6 +206,9 @@
<separator colspan="4" string="Survey Details"/>
<field name="note" colspan="4" nolabel="1"/>
</page>
<page string="Invited User">
<field name="invited_user_ids" nolabel="1" readonly="1"/>
</page>
<page string="History">
<field name="date_open" select="1"/>
<field name="date_close"/>

View File

@ -62,9 +62,20 @@ class survey_name_wiz(osv.osv_memory):
for sur in surv_obj.browse(cr, uid, [context.get('survey_id',False)]):
result.append((sur.id, sur.title))
return result
survey_user_group_id = self.pool.get('res.groups').search(cr, uid, [('name', '=', 'Survey / User')])
group_id = self.pool.get('res.groups').search(cr, uid, [('name', 'in', ('Tools / Manager','Tools / User','Survey / User'))])
user_obj = self.pool.get('res.users')
user_rec = user_obj.read(cr, uid, uid)
if survey_user_group_id:
if survey_user_group_id == user_rec['groups_id']:
for sur in surv_obj.browse(cr, uid, surv_obj.search(cr, uid, [])):
if sur.state == 'open':
u_list = []
for use in sur.invited_user_ids:
u_list.append(use.id)
if uid in u_list:
result.append((sur.id, sur.title))
return result
for sur in surv_obj.browse(cr, uid, surv_obj.search(cr, uid, [])):
if sur.state == 'open':
res = False

View File

@ -113,7 +113,13 @@ class survey_send_invitation(osv.osv_memory):
error = ""
res_user = ""
user_exists = False
new_user = []
attachments = []
current_sur = survey_ref.browse(cr, uid, context.get('active_id'), context=context)
exist_user = current_sur.invited_user_ids
if exist_user:
for use in exist_user:
new_user.append(use.id)
for id in survey_ref.browse(cr, uid, survey_ids):
report = self.create_report(cr, uid, [id.id], 'report.survey.form', id.title)
file = open(tools.config['addons_path'] + '/survey/report/' + id.title +".pdf")
@ -134,6 +140,8 @@ class survey_send_invitation(osv.osv_memory):
continue
user = user_ref.search(cr, uid, [('login', "=", addr.email)])
if user:
if user[0] not in new_user:
new_user.append(user[0])
user = user_ref.browse(cr, uid, user[0])
user_ref.write(cr, uid, user.id, {'survey_id':[[6, 0, survey_ids]]})
mail = record['mail']%{'login':addr.email, 'passwd':user.password, \
@ -172,11 +180,17 @@ class survey_send_invitation(osv.osv_memory):
'survey_id': [[6, 0, survey_ids]]
}
user = user_ref.create(cr, uid, res_data)
if user not in new_user:
new_user.append(user)
created+= "- %s (Login: %s, Password: %s)\n" % (addr.name or 'Unknown',\
addr.email, passwd)
else:
error+= "- %s (Login: %s, Password: %s)\n" % (addr.name or 'Unknown',\
addr.email, passwd)
new_vals = {}
new_vals.update({'invited_user_ids':[[6,0,new_user]]})
survey_ref.write(cr, uid, context.get('active_id'),new_vals)
note= ""
if created:
note += 'Created users:\n%s\n\n' % (created)