[MERGE] Merge with lp:openobject-addons

bzr revid: ysa@tinyerp.co.in-20100407122754-z5mdmqk95j5urvmc
This commit is contained in:
Ysa (Open ERP)
2010-04-07 17:57:54 +05:30
34 changed files with 796 additions and 280 deletions
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_auction_lots_able" model="ir.ui.view">
<field name="name">auction.lots.able.form</field>
<field name="model">auction.lots.able</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Confirm">
<group colspan="4" >
<separator string="Confirmation set taken away" colspan="4"/>
<newline/>
</group>
<separator string="" colspan="4" />
<group colspan="4" col="6">
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
<button icon="gtk-goto-last" string="Able Taken away" name="confirm_able" type="object"/>
</group>
</form>
</field>
</record>
<act_window name="Mark as taken away"
res_model="auction.lots.able"
src_model="auction.lots"
view_mode="form"
target="new"
key2="client_action_multi"
id="action_auction_lots_able"/>
</data>
</openerp>
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_auction_lots_auction_move" model="ir.ui.view">
<field name="name">auction.lots.auction.move.form</field>
<field name="model">auction.lots.auction.move</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Change Auction Date">
<group colspan="4" >
<label string="Warning, this will erase the object adjudication price and its buyer !" colspan="2"/>
<newline/>
<field name="auction_id"/>
</group>
<separator string="" colspan="4" />
<group colspan="4" col="6">
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
<button icon="gtk-redo" string="Move to Auction date" name="auction_move_set" type="object"/>
</group>
</form>
</field>
</record>
<act_window name="Change Auction Date"
res_model="auction.lots.auction.move"
src_model="auction.lots"
view_mode="form"
target="new"
key2="client_action_multi"
id="action_auction_lots_auction_move"/>
</data>
</openerp>
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_auction_lots_enable" model="ir.ui.view">
<field name="name">auction.lots.enable.form</field>
<field name="model">auction.lots.enable</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Confirm">
<group colspan="4" >
<separator string="Confirmation enable taken away" colspan="4"/>
<newline/>
</group>
<separator string="" colspan="4" />
<group colspan="4" col="6">
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
<button icon="gtk-goto-last" string="Enable Taken away" name="confirm_enable" type="object"/>
</group>
</form>
</field>
</record>
<act_window name="Unmark as taken away"
res_model="auction.lots.enable"
src_model="auction.lots"
view_mode="form"
target="new"
key2="client_action_multi"
id="action_auction_lots_enable"/>
</data>
</openerp>
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_auction_lots_make_invoice_buyer" model="ir.ui.view">
<field name="name">auction.lots.make.invoice.buyer.form</field>
<field name="model">auction.lots.make.invoice.buyer</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Paid">
<group colspan="4" >
<field name="amount"/>
<field name="objects"/>
<field name="number"/>
<label string="(Keep empty for automatic number)" colspan="2"/>
<field name="buyer_id"/>
</group>
<separator string="" colspan="4" />
<group colspan="4" col="6">
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
<button icon="gtk-ok" string="Create invoices" name="makeInvoices" type="object"/>
</group>
</form>
</field>
</record>
<act_window name="Invoice Buyer objects"
res_model="auction.lots.make.invoice.buyer"
src_model="auction.lots"
view_mode="form"
target="new"
key2="client_action_multi"
id="action_auction_lots_make_invoice_buyer"/>
</data>
</openerp>
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_auction_lots_make_invoice" model="ir.ui.view">
<field name="name">auction.lots.make.invoice.form</field>
<field name="model">auction.lots.make.invoice</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Paid">
<group colspan="4" >
<field name="amount"/>
<field name="objects"/>
<field name="number" colspan="3"/>
</group>
<separator string="" colspan="4" />
<group colspan="4" col="6">
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
<button icon="gtk-ok" string="Create invoices" name="makeInvoices" type="object"/>
</group>
</form>
</field>
</record>
<act_window name="Invoice Seller objects"
res_model="auction.lots.make.invoice"
src_model="auction.lots"
view_mode="form"
target="new"
key2="client_action_multi"
id="action_auction_lots_make_invoice"/>
</data>
</openerp>
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_auction_lots_sms_send" model="ir.ui.view">
<field name="name">auction.lots.sms.send.form</field>
<field name="model">auction.lots.sms.send</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="SMS - Gateway: clickatell','Bulk SMS send">
<group colspan="4" >
<separator string="SMS - Gateway: clickatell','Bulk SMS send" colspan="4"/>
<field name="app_id"/>
<newline/>
<field name="user"/>
<field name="password"/>
<newline/>
<field name="text" colspan="3"/>
</group>
<separator string="" colspan="4" />
<group colspan="4" col="6">
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
<button icon="gtk-go-back" string="Send SMS" name="sms_send" type="object"/>
</group>
</form>
</field>
</record>
<act_window name="SMS Send"
res_model="auction.lots.sms.send"
src_model="auction.lots"
view_mode="form"
target="new"
key2="client_action_multi"
id="action_auction_lots_sms_send"/>
</data>
</openerp>
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_auction_pay_buy" model="ir.ui.view">
<field name="name">auction.pay.buy.form</field>
<field name="model">auction.pay.buy</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Pay objects">
<group colspan="4" >
<field name="amount"/>
<field name="statement_id1" domain="[('state','=','draft')]"/>
<field name="amount2"/>
<field name="statement_id2" domain="[('state','=','draft')]"/>
<field name="amount3"/>
<field name="statement_id3" domain="[('state','=','draft')]"/>
<newline/>
<field name="buyer_id"/>
<field name="total"/>
</group>
<separator string="" colspan="4" />
<group colspan="4" col="6">
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
<button icon="gtk-yes" string="Pay" name="pay_and_reconcile" type="object"/>
</group>
</form>
</field>
</record>
<act_window name="Pay objects of the buyer"
res_model="auction.pay.buy"
src_model="auction.lots"
view_mode="form"
target="new"
key2="client_action_multi"
id="action_auction_pay_buy"/>
</data>
</openerp>
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_auction_pay_sel" model="ir.ui.view">
<field name="name">auction.pay.sel.form</field>
<field name="model">auction.pay.sel</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Pay invoice">
<group colspan="4" >
<field name="amount"/>
<field name="dest_account_id"/>
<field name="journal_id"/>
<field name="period_id"/>
</group>
<separator string="" colspan="4" />
<group colspan="4" col="6">
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
<button icon="gtk-yes" string="Pay" name="pay_and_reconcile" type="object"/>
</group>
</form>
</field>
</record>
<record id="action_auction_pay_sel" model="ir.actions.act_window">
<field name="name">Pay objects of the seller</field>
<field name="res_model">auction.pay.sel</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_auction_pay_sel"/>
<field name="target">new</field>
</record>
</data>
</openerp>
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_auction_payer" model="ir.ui.view">
<field name="name">auction.payer.form</field>
<field name="model">auction.payer</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Check payment for buyer">
<separator string="" colspan="4" />
<group colspan="4" col="2">
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
<button icon = "gtk-yes" string="Pay" name="payer" type="object"/>
</group>
</form>
</field>
</record>
<record id="view_auction_payer_sel" model="ir.ui.view">
<field name="name">auction.payer.sel.form</field>
<field name="model">auction.payer.sel</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Check payment for seller">
<separator string="" colspan="4" />
<group colspan="4" col="6">
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
<button icon="gtk-yes" string="Pay" name="payer_sel" type="object"/>
</group>
</form>
</field>
</record>
<act_window name="Mark as paid for seller"
res_model="auction.payer.sel"
src_model="auction.lots"
view_mode="form"
target="new"
key2="client_action_multi"
id="action_auction_payer_sel"/>
</data>
</openerp>
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_auction_taken" model="ir.ui.view">
<field name="name">auction.taken.form</field>
<field name="model">auction.taken</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Mark Lots">
<group colspan="4" >
<label string="Select lots which are Sold" colspan="4"/>
<field name="lot_ids" nolabel="1" colspan="4" domain="[('state','=','sold')]"/>
</group>
<separator string="" colspan="4" />
<group colspan="4" col="6">
<button icon="gtk-ok" string="OK" name="process" type="object" />
</group>
</form>
</field>
</record>
<record id="action_auction_taken" model="ir.actions.act_window">
<field name="name">Gestion emporte</field>
<field name="res_model">auction.taken</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_auction_taken"/>
<field name="target">new</field>
</record>
<!-- <menuitem name="Tools Bar Codes"
id="auction_outils_menu"
parent="auction_menu_root" sequence="5"
/>
<menuitem name="Deliveries Management"
action="action_auction_taken"
id="menu_wizard_emporte"
parent="auction_outils_menu"
/> -->
</data>
</openerp>
+1 -1
View File
@@ -34,7 +34,7 @@ This module implements a dashboard for CRM that includes:
* Jobs Tracking (graph)
""",
'author': 'Tiny',
'depends': ['board', 'crm', 'report_crm'],
'depends': ['board', 'crm'],
'update_xml': ['board_crm_statistical_view.xml', 'board_crm_view.xml'],
'demo_xml': ['board_crm_demo.xml'],
'installable': True,
+1 -1
View File
@@ -621,7 +621,7 @@ class crm_case(osv.osv):
@email: Partner's email ID
"""
if not add:
return {'value': {'email_from': False, 'partner_name2': False}}
return {'value': {'email_from': False}}
address = self.pool.get('res.partner.address').browse(cr, uid, add)
return {'value': {'email_from': address.email}}
+32 -16
View File
@@ -24,7 +24,7 @@ from datetime import datetime, timedelta
import crm
import math
import time
from mx import DateTime
import mx.DateTime
from tools.translate import _
class crm_lead(osv.osv):
@@ -32,7 +32,7 @@ class crm_lead(osv.osv):
_name = "crm.lead"
_description = "Leads Cases"
_order = "priority desc, id desc"
_order = "priority, id desc"
_inherit = ['res.partner.address', 'crm.case']
def case_open(self, cr, uid, ids, *args):
@@ -55,36 +55,52 @@ class crm_lead(osv.osv):
@param ids: List of Openday’s IDs
@return: difference between current date and log date
@param context: A standard dictionary for contextual values
"""
log_obj = self.pool.get('crm.case.log')
model_obj = self.pool.get('ir.model')
cal_obj = self.pool.get('resource.calendar')
model_ids = model_obj.search(cr, uid, [('model', '=', self._name)])
model_id = False
if len(model_ids):
model_id = model_ids[0]
"""
cal_obj = self.pool.get('resource.calendar')
res_obj = self.pool.get('resource.resource')
res = {}
for lead in self.browse(cr, uid, ids , context):
for field in fields:
res[lead.id] = {}
duration = 0
ans = False
if field == 'day_open':
if lead.date_open:
date_create = datetime.strptime(lead.create_date, "%Y-%m-%d %H:%M:%S")
date_open = datetime.strptime(lead.date_open, "%Y-%m-%d %H:%M:%S")
ans = date_open - date_create
duration = float(ans.days) + (float(ans.seconds) / 86400)
date_until = lead.date_open
elif field == 'day_close':
if lead.date_closed:
date_create = datetime.strptime(lead.create_date, "%Y-%m-%d %H:%M:%S")
date_close = datetime.strptime(lead.date_closed, "%Y-%m-%d %H:%M:%S")
date_until = lead.date_closed
ans = date_close - date_create
duration = float(ans.days) + (float(ans.seconds) / 86400)
if ans:
resource_id = False
if lead.user_id:
resource_ids = res_obj.search(cr, uid, [('user_id','=',lead.user_id.id)])
resource_id = len(resource_ids) or resource_ids[0]
duration = float(ans.days)
if lead.section_id.resource_calendar_id:
duration = float(ans.days) * 24
new_dates = cal_obj.interval_get(cr,
uid,
lead.section_id.resource_calendar_id and lead.section_id.resource_calendar_id.id or False,
mx.DateTime.strptime(lead.create_date, '%Y-%m-%d %H:%M:%S'),
duration,
resource=resource_id
)
no_days = []
date_until = mx.DateTime.strptime(date_until, '%Y-%m-%d %H:%M:%S')
for in_time, out_time in new_dates:
if in_time.date not in no_days:
no_days.append(in_time.date)
if out_time > date_until:
break
duration = len(no_days)
res[lead.id][field] = abs(int(duration))
return res
+1
View File
@@ -140,6 +140,7 @@
<field name="create_date"/>
<field name="write_date"/>
<field name="date_closed"/>
<field name="date_open"/>
</group>
<group colspan="2" col="2">
<separator string="Statistics" colspan="2" col="2"/>
+32 -15
View File
@@ -24,6 +24,7 @@ from osv import fields,osv,orm
from tools.translate import _
import crm
import time
import mx.DateTime
AVAILABLE_STATES = [
('draft','New'),
@@ -38,7 +39,7 @@ class crm_opportunity(osv.osv):
_name = "crm.opportunity"
_description = "Opportunity Cases"
_order = "id desc"
_order = "priority,id desc"
_inherit = 'crm.case'
def case_open(self, cr, uid, ids, *args):
@@ -61,36 +62,52 @@ class crm_opportunity(osv.osv):
@param ids: List of Openday’s IDs
@return: difference between current date and log date
@param context: A standard dictionary for contextual values
"""
log_obj = self.pool.get('crm.case.log')
model_obj = self.pool.get('ir.model')
cal_obj = self.pool.get('resource.calendar')
model_ids = model_obj.search(cr, uid, [('model', '=', self._name)])
model_id = False
if len(model_ids):
model_id = model_ids[0]
"""
cal_obj = self.pool.get('resource.calendar')
res_obj = self.pool.get('resource.resource')
res = {}
for opportunity in self.browse(cr, uid, ids , context):
for field in fields:
res[opportunity.id] = {}
duration = 0
ans = False
if field == 'day_open':
if opportunity.date_open:
date_create = datetime.strptime(opportunity.create_date, "%Y-%m-%d %H:%M:%S")
date_open = datetime.strptime(opportunity.date_open, "%Y-%m-%d %H:%M:%S")
ans = date_open - date_create
duration = float(ans.days) + (float(ans.seconds) / 86400)
date_until = opportunity.date_open
elif field == 'day_close':
if opportunity.date_closed:
date_create = datetime.strptime(opportunity.create_date, "%Y-%m-%d %H:%M:%S")
date_close = datetime.strptime(opportunity.date_closed, "%Y-%m-%d %H:%M:%S")
date_until = opportunity.date_closed
ans = date_close - date_create
duration = float(ans.days) + (float(ans.seconds) / 86400)
if ans:
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]
duration = float(ans.days)
if opportunity.section_id.resource_calendar_id:
duration = float(ans.days) * 24
new_dates = cal_obj.interval_get(cr,
uid,
opportunity.section_id.resource_calendar_id and opportunity.section_id.resource_calendar_id.id or False,
mx.DateTime.strptime(opportunity.create_date, '%Y-%m-%d %H:%M:%S'),
duration,
resource=resource_id
)
no_days = []
date_until = mx.DateTime.strptime(date_until, '%Y-%m-%d %H:%M:%S')
for in_time, out_time in new_dates:
if in_time.date not in no_days:
no_days.append(in_time.date)
if out_time > date_until:
break
duration = len(no_days)
res[opportunity.id][field] = abs(int(duration))
return res
+3 -1
View File
@@ -220,6 +220,7 @@
<field name="date_deadline" string="Excepted Closing"/>
<field name="section_id"/>
<field name="user_id"/>
<field name="priority"/>
<field name="state"/>
<button name="case_open" string="Open"
states="draft,pending" type="object"
@@ -302,7 +303,8 @@
<group expand="1" string="Group By..." colspan="16">
<filter string="Stage" icon="terp-crm" domain="[]"
context="{'group_by':'stage_id'}" />
<filter string="Priority" icon="terp-crm" domain="[]"
context="{'group_by':'priority'}" />
<filter string="Category" icon="terp-crm"
domain="[]" context="{'group_by':'categ_id'}" />
+9 -1
View File
@@ -108,6 +108,14 @@ class crm_phonecall(osv.osv):
return value
def onchange_partner_address_id(self, cr, uid, ids, add, email=False):
res = super(crm_phonecall, self).onchange_partner_address_id(cr, uid, ids, add, email)
res.setdefault('value', {})
if add:
address = self.pool.get('res.partner.address').browse(cr, uid, add)
res['value']['partner_phone'] = address.mobile
res['value']['partner_mobile'] = address.phone
return res
crm_phonecall()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+1
View File
@@ -20,6 +20,7 @@
<field name="parent_id" select="2" widget="selection"/>
<field name="allow_unlink" select="2"/>
<field name="reply_to" select="2"/>
<field name="resource_calendar_id" select="2"/>
</page>
</notebook>
</form>
+24 -24
View File
@@ -29,19 +29,22 @@ from crm import crm
class crm_send_new_email(osv.osv_memory):
""" Sends new email for the case"""
_name = "crm.send.mail"
_description = "Case Send new email"
_description = "Send new email"
_columns = {
'email_to' : fields.char('To', size=64, required=True),
'email_from' : fields.char('From', size=64, required=True),
'email_cc' : fields.char('CC', size=128),
'subject': fields.char('Subject', size=128, required=True),
'text': fields.text('Message', required=True),
'state': fields.selection(crm.AVAILABLE_STATES, string='State'),
'doc1': fields.binary("Attachment1"),
'doc2': fields.binary("Attachment2"),
'doc3': fields.binary("Attachment3"),
}
'email_to' : fields.char('To', size=64, required=True),
'email_from' : fields.char('From', size=64, required=True),
'email_cc' : fields.char('CC', size=128),
'subject': fields.char('Subject', size=128, required=True),
'text': fields.text('Message', required=True),
'state': fields.selection(crm.AVAILABLE_STATES, string='Set New State To', required=True),
'doc1': fields.binary("Attachment1"),
'doc1_fname': fields.char("File Name", size=64),
'doc2': fields.binary("Attachment2"),
'doc2_fname': fields.char("File Name", size=64),
'doc3': fields.binary("Attachment3"),
'doc3_fname': fields.char("File Name", size=64),
}
def action_cancel(self, cr, uid, ids, context=None):
""" Closes Phonecall to Opportunity form
@@ -51,9 +54,9 @@ class crm_send_new_email(osv.osv_memory):
def action_send(self, cr, uid, ids, context=None):
""" This sends an email to ALL the addresses of the selected partners.
"""
hist_obj = self.pool.get('crm.case.history')
if not context:
context = {}
@@ -79,12 +82,10 @@ class crm_send_new_email(osv.osv_memory):
emails = filter(None, emails)
body = data['text']
if case.user_id.signature:
body += '\n\n%s' % (case.user_id.signature)
body = case_pool.format_body(body)
email_from = data.get('email_from', False)
case_pool._history(cr, uid, [case], _('Send'), history=True, email=data['email_to'], details=body, email_from=email_from)
flag = tools.email_send(
email_from,
emails,
@@ -94,13 +95,13 @@ class crm_send_new_email(osv.osv_memory):
reply_to=case.section_id.reply_to,
openobject_id=str(case.id),
)
if flag:
if flag:
if data['state'] == 'unchanged':
pass
elif data['state'] == 'done':
case_pool.case_close(cr, uid, [case.id])
elif data['state'] == 'draft':
case_pool.case_reset(cr, uid, [case.id])
case_pool.case_reset(cr, uid, [case.id])
elif data['state'] in ['cancel', 'open', 'pending']:
act = 'case_' + data['state']
getattr(case_pool, act)(cr, uid, [case.id])
@@ -141,11 +142,11 @@ class crm_send_new_email(osv.osv_memory):
(case.user_id and case.user_id.address_id and \
case.user_id.address_id.email) or tools.config.get('email_from',False)})
if 'subject' in fields:
res.update({'subject': '[%s] %s' %(str(case.id), case.name or '')})
res.update({'subject': '[%s] %s' %(str(case.id), case.name or '')})
if 'email_cc' in fields:
res.update({'email_cc': case.email_cc or ''})
if 'text' in fields:
res.update({'text': case.description or ''})
res.update({'text': '\n\n'+(case.user_id.signature or '') + '\n\n' + (case.description or '')})
if 'state' in fields:
res.update({'state': 'pending'})
return res
@@ -168,8 +169,8 @@ class crm_send_new_email(osv.osv_memory):
(case.user_id and case.user_id.address_id and \
case.user_id.address_id.email) or hist.email_to or tools.config.get('email_from',False)})
if 'text' in fields:
header = '-------- Original Message --------'
sender = 'From: %s' %(hist.email_from or '')
header = '-------- Original Message --------'
sender = 'From: %s' %(hist.email_from or '')
to = 'To: %s' % (hist.email_to or '')
sentdate = 'Date: %s' % (hist.date)
desc = '\n%s'%(hist.description)
@@ -177,7 +178,7 @@ class crm_send_new_email(osv.osv_memory):
original = '\n'.join(original)
res['text']=original
if 'subject' in fields:
res.update({'subject': '[%s] %s' %(str(case.id), case.name or '')})
res.update({'subject': '[%s] %s' %(str(case.id), case.name or '')})
if 'state' in fields:
res['state']='pending'
return res
@@ -214,4 +215,3 @@ class crm_send_new_email(osv.osv_memory):
crm_send_new_email()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+32 -27
View File
@@ -3,27 +3,32 @@
<data>
<!-- Send New Mail view -->
<record model="ir.ui.view" id="crm_send_new_mail_view">
<field name="name">crm.new.send.mail.form</field>
<field name="model">crm.send.mail</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Send New Mail" col="2">
<field name="email_from" />
<field name="email_to" />
<field name="email_cc" />
<field name="subject" />
<field name="doc1" />
<field name="doc2" />
<field name="doc3" />
<form string="Send New Mail" col="4">
<field name="email_to" />
<field name="email_cc"/>
<field name="subject" colspan="4"/>
<group colspan="4" string="Extended Options" expand="1">
<field name="email_from" />
<field name="doc1" filename="doc1_fname"/>
<field name="doc1_fname"/>
<field name="doc2" filename="doc2_fname" />
<field name="doc2_fname"/>
<field name="doc3" filename="doc3_fname" />
<field name="doc3_fname"/>
</group>
<separator string="" colspan="4"/>
<field name="text" nolabel="1" colspan="4"/>
<separator colspan="4" string="Set case state to" />
<field name="state" />
<separator string=" " colspan="4"/>
<newline/>
<field name="state" />
<separator string=" " colspan="4"/>
<group colspan="4" col="3" >
<label string=" " />
<label string=" " />
<button name="action_cancel" string="_Cancel" icon="gtk-cancel" special="cancel" />
<button name="action_send" type="object" string="_Send" icon="gtk-go-forward" />
</group>
@@ -41,10 +46,10 @@
<field name="view_id" ref="crm_send_new_mail_view"/>
<field name="target">new</field>
</record>
<!-- Reply to Mail view -->
<!-- Reply to Mail view -->
<record model="ir.ui.view" id="crm_reply_mail_view">
<field name="name">crm.mail.reply.form</field>
<field name="model">crm.send.mail</field>
@@ -52,17 +57,17 @@
<field name="arch" type="xml">
<form string="Reply to last Mail" col="2">
<field name="email_from" />
<field name="email_to" />
<field name="email_cc" />
<field name="subject" />
<field name="doc1" />
<field name="doc2" />
<field name="doc3" />
<field name="email_to" />
<field name="email_cc" />
<field name="subject" />
<field name="doc1" />
<field name="doc2" />
<field name="doc3" />
<separator string="" colspan="4"/>
<field name="text" nolabel="1" colspan="4"/>
<separator string=" " colspan="4"/>
<separator string=" " colspan="4"/>
<group colspan="4" col="3" >
<label string=" " />
<label string=" " />
<button name="action_cancel" string="_Cancel" icon="gtk-cancel" special="cancel" />
<button name="action_send" type="object" string="_Send Reply" icon="gtk-go-forward" />
</group>
@@ -80,6 +85,6 @@
<field name="view_id" ref="crm_reply_mail_view"/>
<field name="target">new</field>
</record>
</data>
</openerp>
</openerp>
+10 -1
View File
@@ -27,6 +27,15 @@ class event_registration_list(osv.osv_memory):
_description = "List Event Registrations"
def open_registration(self, cr, uid, ids, context={}):
if not context.get('active_id', None):
return {
'name': 'Event Registrations',
'view_type': 'form',
'view_mode': 'tree,form',
'res_model': 'event.registration',
'type': 'ir.actions.act_window'
}
cr.execute('SELECT section_id FROM event_event WHERE id = %s', (context['active_id'],))
res = cr.fetchone()
return {
@@ -40,4 +49,4 @@ class event_registration_list(osv.osv_memory):
event_registration_list()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+2 -2
View File
@@ -101,8 +101,8 @@ class hr_employee(osv.osv):
'department_id':fields.many2one('hr.department','Department'),
'address_id': fields.many2one('res.partner.address', 'Working Address'),
'address_home_id': fields.many2one('res.partner.address', 'Home Address'),
'work_phone': fields.related('address_id', 'phone', type='char', string='Work Phone'),
'work_email': fields.related('address_id', 'email', type='char', size=240, string='Work E-mail'),
'work_phone': fields.related('address_id', 'phone', type='char', string='Work Phone', readonly=True),
'work_email': fields.related('address_id', 'email', type='char', size=240, string='Work E-mail', readonly=True),
'work_location': fields.char('Office Location', size=32),
'notes': fields.text('Notes'),
+9 -2
View File
@@ -139,8 +139,7 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Contract Type">
<field colspan="4" name="name"/>
<field colspan="4" name="description"/>
<field colspan="4" name="name" select="1"/>
</form>
</field>
</record>
@@ -220,6 +219,14 @@
</record>
<record id="action_hr_contract_type" model="ir.actions.act_window">
<field name="name">Contract Types</field>
<field name="res_model">hr.contract.type</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
</record>
<menuitem action="action_hr_contract_type" id="hr_menu_contract_type" parent="next_id_56"/>
<menuitem id="hr_menu_contract_main" parent="hr.menu_hr_root" name="Contracts" sequence="3"/>
<menuitem action="action_hr_contract" id="hr_menu_contract" parent="hr_menu_contract_main" name="Contracts"/>
</data>
+45 -82
View File
@@ -183,79 +183,48 @@ class hr_evaluation(osv.osv):
return {'value': {'plan_id':evaluation_plan_id}}
def button_plan_in_progress(self,cr, uid, ids, context={}):
user_obj = self.pool.get('res.users')
employee_obj = self.pool.get('hr.employee')
hr_eval_inter_obj = self.pool.get('hr.evaluation.interview')
survey_request_obj = self.pool.get('survey.request')
hr_eval_plan_obj = self.pool.get('hr_evaluation.plan.phase')
curr_employee=self.browse(cr,uid, ids, context=context)[0].employee_id
child_employees=employee_obj.browse(cr,uid, employee_obj.search(cr,uid,[('parent_id','=',curr_employee.id)],context=context))
manager_employee=curr_employee.parent_id
for evaluation in self.browse(cr,uid,ids):
if evaluation and evaluation.plan_id:
apprai_id = []
for phase in evaluation.plan_id.phase_ids:
if phase.action == "bottom-up":
for child in child_employees:
user = False
if child.user_id:
user = child.user_id.id
id = hr_eval_inter_obj.create(cr, uid, {'evaluation_id':evaluation.id ,'user_id' : user,'survey_id' : phase.survey_id.id, 'user_to_review_id' : child.id, 'date_deadline' :(dt.ISO.ParseAny(dt.now().strftime('%Y-%m-%d')) + dt.RelativeDateTime(months =+ 1)).strftime('%Y-%m-%d')},context=context)
if not phase.wait:
hr_eval_inter_obj.survey_req_waiting_answer(cr, uid, [id], context=context)
if phase.mail_feature:
src = tools.config.options['email_from']
user_obj_id = user_obj.browse(cr,uid,uid)
val = {
'employee_name':child.name,
'user_signature':curr_employee.name,
# 'company_name':user_obj_id.company_id.name,
'eval_name':phase.survey_id.title,
'date':time.strftime('%Y-%m-%d'),
}
mailbody = hr_eval_plan_obj.read(cr,uid,phase.id,['mail_body','email_subject'],context=context)
body = mailbody['mail_body']%val
sub = mailbody['email_subject']+phase.survey_id.title
dest=[child.work_email]
if dest:
tools.email_send(src,dest,sub,body)
apprai_id.append(id)
apprai_id = []
for evaluation in self.browse(cr,uid,ids, context):
wait = False
for phase in evaluation.plan_id.phase_ids:
childs = []
if phase.action == "bottom-up":
childs = evaluation.employee_id.child_ids
elif phase.action in ("top-down", "final"):
if evaluation.employee_id.parent_id:
childs = [evaluation.employee_id.parent_id]
elif phase.action == "self":
childs = [evaluation.employee_id]
for child in childs:
if not child.user_id:
continue
hr_eval_inter_obj = self.pool.get('hr.evaluation.interview')
int_id = hr_eval_inter_obj.create(cr, uid, {
'evaluation_id': evaluation.id,
'survey_id': phase.survey_id.id,
'date_deadline': (dt.ISO.ParseAny(dt.now().strftime('%Y-%m-%d')) + dt.RelativeDateTime(months =+ 1)).strftime('%Y-%m-%d'),
'user_id': child.user_id.id,
'user_to_review_id': evaluation.employee_id.id
}, context=context)
if phase.wait:
wait = True
if not wait:
hr_eval_inter_obj.survey_req_waiting_answer(cr, uid, [int_id], context=context)
if (not wait) and phase.mail_feature:
body = phase.mail_body % {
'employee_name': child.name,
'user_signature': user.signature,
'eval_name': phase.survey_id.title,
'date': time.strftime('%Y-%m-%d'),
'time': time
}
sub = phase.email_subject
dest = [child.work_email]
if dest:
tools.email_send(src,dest,sub,body)
elif phase.action == "top-down":
if manager_employee:
user = False
if manager_employee.user_id:
user = manager_employee.user_id.id
id = hr_eval_inter_obj.create(cr, uid, {'evaluation_id':evaluation.id,'user_id': user ,'survey_id' : phase.survey_id.id, 'user_to_review_id' :manager_employee.id, 'date_deadline' :(dt.ISO.ParseAny(dt.now().strftime('%Y-%m-%d')) + dt.RelativeDateTime(months =+ 1)).strftime('%Y-%m-%d')},context=context)
if not phase.wait:
hr_eval_inter_obj.survey_req_waiting_answer(cr, uid, [id], context=context)
if phase.mail_feature:
val.update({'employee_name':manager_employee.name})
mailbody = hr_eval_plan_obj.read(cr,uid,phase.id,['mail_body'],context=context)
body = mailbody['mail_body']%val
dest = [manager_employee.work_email]
if dest:
tools.email_send(src,dest,sub,body)
apprai_id.append(id)
elif phase.action == "self":
if curr_employee:
user = False
if curr_employee.user_id:
user = curr_employee.user_id.id
id = hr_eval_inter_obj.create(cr, uid, {'evaluation_id':evaluation.id,'user_id' : user, 'survey_id' : phase.survey_id.id, 'user_to_review_id' :curr_employee.id, 'date_deadline' :(dt.ISO.ParseAny(dt.now().strftime('%Y-%m-%d')) + dt.RelativeDateTime(months =+ 1)).strftime('%Y-%m-%d')},context=context)
if not phase.wait:
hr_eval_inter_obj.survey_req_waiting_answer(cr, uid, [id], context=context)
apprai_id.append(id)
elif phase.action == "final":
if manager_employee:
user = False
if manager_employee.user_id:
user = manager_employee.user_id.id
id = hr_eval_inter_obj.create(cr, uid, {'evaluation_id':evaluation.id,'user_id' : user, 'survey_id' : phase.survey_id.id, 'user_to_review_id' :manager_employee.id, 'date_deadline' :(dt.ISO.ParseAny(dt.now().strftime('%Y-%m-%d')) + dt.RelativeDateTime(months =+ 1)).strftime('%Y-%m-%d')},context=context)
if not phase.wait:
hr_eval_inter_obj.survey_req_waiting_answer(cr, uid, [id], context=context)
apprai_id.append(id)
self.write(cr, uid, evaluation.id, {'survey_request_ids':[[6, 0, apprai_id]]})
self.write(cr,uid,ids,{'state':'wait'},context=context)
return True
@@ -291,21 +260,15 @@ class hr_evaluation_interview(osv.osv):
_description='Evaluation Interview'
_columns = {
'request_id': fields.many2one('survey.request','Request_id', ondelete='cascade'),
'user_to_review_id': fields.many2one('hr.employee', 'Employee'),
'evaluation_id' : fields.many2one('hr_evaluation.evaluation', 'Evaluation'),
}
'user_to_review_id': fields.many2one('hr.employee', 'Employee to Interview'),
'evaluation_id' : fields.many2one('hr_evaluation.evaluation', 'Evaluation Type'),
}
_defaults = {
'is_evaluation': lambda *a: True,
}
}
def survey_req_waiting_answer(self, cr, uid, ids, context={}):
self.write(cr, uid, ids, { 'state' : 'waiting_answer'})
# for id in self.browse(cr, uid, ids):
# print"id",id
# if id.user_to_review_id and id.user_to_review_id.work_email:
# msg = " Hello %s, \n\n We are inviting you for %s survey. \n\n Thanks," %(id.user_to_review_id.name, id.survey_id.title)
# tools.email_send(tools.config['email_from'], [id.user_to_review_id.work_email],\
# 'Invite to fill up Survey', msg)
return True
def survey_req_done(self, cr, uid, ids, context={}):
+27 -16
View File
@@ -167,7 +167,7 @@
<group col="6" colspan="4">
<field name="state"/>
<button name="button_plan_in_progress"
string="Plan In Progress"
string="Start Evaluation"
states="draft"
type="object"/>
<button name="button_final_validation"
@@ -210,20 +210,30 @@
<field name="arch" type="xml">
<search string="Search Evaluation">
<group col='10' colspan='4'>
<filter icon="terp-hr" string="Draft" domain="[('state','=','draft')]"/>
<filter icon="terp-hr" string="Draft" domain="[('state','=','draft')]"/>
<filter icon="terp-crm" string="In progress" domain="[('state','=','wait')]"/>
<filter icon="terp-mrp" string="Final Step" domain="[('state','=','progress')]"/>
<filter icon="terp-stock" string="Done" domain="[('state','=','done')]"/>
<separator orientation="vertical"/>
<filter icon="gtk-media-rewind" string="7 Days"
help="Evaluations to close within the next 7 days"
domain="[('date','&gt;=',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]"
/>
<filter icon="gtk-media-rewind" string="Overpassed"
help="Evaluations that overpassed the deadline"
domain="[('date','&gt;=',(datetime.date.today()))]"
/>
<separator orientation="vertical"/>
<field name="employee_id" widget="selection" select="1"/>
<field name="plan_id" widget="selection" select="1"/>
<field name="rating"/>
<newline/>
<group col='8' colspan='15' expand='1' string='Group by...'>
</group>
<newline/>
<group col='8' colspan='15' expand='1' string='Group by...'>
<filter string='Employee' icon="terp-stock" domain="[]" context="{'group_by' : 'employee_id'}" />
<filter string='Plan' icon="terp-stock" domain="[]" context="{'group_by' : 'plan_id'}" />
<filter string='state' icon="terp-stock" domain="[]" context="{'group_by' : 'state'}" />
</group>
<filter string='State' icon="terp-stock" domain="[]" context="{'group_by' : 'state'}" />
<separator orientation="vertical"/>
<filter string='Date' icon="terp-stock" domain="[]" context="{'group_by' : 'date'}" />
</group>
</search>
</field>
@@ -282,6 +292,7 @@
<tree string="Interview Evaluation">
<field name="date_deadline"/>
<field name="survey_id"/>
<field name="user_id" string="Interviewer"/>
<field name="user_to_review_id"/>
<field name="response" readonly="1" invisible="True"/>
<button name="%(survey.action_view_survey_question_message)d" string="Interview Question" type="action" states="waiting_answer,done,cancel"
@@ -300,14 +311,14 @@
<field name="arch" type="xml">
<search string="Search Evaluation">
<group col='10' colspan='4'>
<filter icon="terp-crm" string="Unanswered" domain="[('state','=','waiting_answer')]"/>
<filter icon="terp-crm" string="To Do" domain="[('state','=','waiting_answer')]" default="1"/>
<separator orientation="vertical"/>
<filter string="My" icon="terp-partner" domain="[('user_id','=',uid)]" default="1"/>
<separator orientation="vertical"/>
<filter icon="terp-stock" string="Late" domain="[('date_deadline','&lt;',current_date)]"/>
<separator orientation="vertical"/>
<field name="survey_id" widget="selection" select="1"/>
<field name="email" select="1"/>
<field name="user_id" select="1" widget="selection" default="1">
<filter string="MY" icon="terp-partner" domain="[('user_id','=',uid)]"/>
</field>
<field name="user_to_review_id" widget="selection"/>
<field name="user_id" widget="selection"/>
</group>
</search>
</field>
@@ -322,7 +333,7 @@
</record>
<menuitem
name="Intreview Requests" parent="menu_eval_hr"
name="Interview Requests" parent="menu_eval_hr"
id="menu_open_hr_evaluation_interview_requests"
action="action_hr_evaluation_interview_tree"/>
+15 -14
View File
@@ -102,7 +102,7 @@ class hr_holidays(osv.osv):
'user_id':fields.many2one('res.users', 'User', states={'draft':[('readonly',False)]}, select=True, readonly=True),
'date_to' : fields.datetime('End Date', readonly=True, states={'draft':[('readonly',False)]}),
'holiday_status_id' : fields.many2one("hr.holidays.status", "Leave Type", required=True,readonly=True, states={'draft':[('readonly',False)]}),
'employee_id' : fields.many2one('hr.employee', "Employee's Name", select=True, invisible=False, readonly=True, states={'draft':[('readonly',False)]}, help='Leave Manager can let this field empty if this leave request/allocation is for every employee'),
'employee_id' : fields.many2one('hr.employee', "Employee", select=True, invisible=False, readonly=True, states={'draft':[('readonly',False)]}, help='Leave Manager can let this field empty if this leave request/allocation is for every employee'),
'manager_id' : fields.many2one('hr.employee', 'Leave Manager', invisible=False, readonly=True, help='This area is automaticly filled by the user who validate the leave'),
'notes' : fields.text('Notes',readonly=True, states={'draft':[('readonly',False)]}),
'number_of_days': fields.float('Number of Days', readonly=True, states={'draft':[('readonly',False)]}),
@@ -112,7 +112,7 @@ class hr_holidays(osv.osv):
'allocation_type': fields.selection([('employee','Employee Request'),('company','Company Allocation')], 'Allocation Type', required=True, readonly=True, states={'draft':[('readonly',False)]}, help='This field is only for informative purposes, to depict if the leave request/allocation comes from an employee or from the company'),
'parent_id': fields.many2one('hr.holidays', 'Parent'),
'linked_request_ids': fields.one2many('hr.holidays', 'parent_id', 'Linked Requests',),
'department_id':fields.many2one('hr.department','Department', readonly=True, states={'draft':[('readonly',False)]} ),
'department_id':fields.related('employee_id', 'department_id', string='Department', type='many2one', relation='hr.department', readonly=True, store=True),
}
_defaults = {
@@ -222,18 +222,19 @@ class hr_holidays(osv.osv):
if ids2:
vals['manager_id'] = ids2[0]
else:
raise osv.except_osv(_('Warning !'),_('Either there is no Employee defined, or no User attached with it.'))
raise osv.except_osv(_('Warning !'),_('No user related to the selected employee.'))
self.write(cr, uid, ids, vals)
vals= {
'name':record.name,
'date_from':record.date_from,
'date_to':record.date_to,
'calendar_id':record.employee_id.calendar_id.id,
'company_id':record.employee_id.company_id.id,
'resource_id':record.employee_id.resource_id.id
}
self.pool.get('resource.calendar.leaves').create(cr,uid,vals)
for record in self.browse(cr, uid, ids):
if record.type=='remove':
vals= {
'name':record.name,
'date_from':record.date_from,
'date_to':record.date_to,
'calendar_id':record.employee_id.calendar_id.id,
'company_id':record.employee_id.company_id.id,
'resource_id':record.employee_id.resource_id.id
}
self.pool.get('resource.calendar.leaves').create(cr,uid,vals)
return True
def holidays_confirm(self, cr, uid, ids, *args):
@@ -256,7 +257,7 @@ class hr_holidays(osv.osv):
'number_of_days': nb,
'user_id': user_id
})
return True
return True
def holidays_refuse(self, cr, uid, ids, *args):
vals = {
+53 -26
View File
@@ -10,29 +10,33 @@
<group col='8' colspan='4'>
<filter icon="terp-hr" domain="[('state','=','draft')]" string="To Confirm"/>
<filter icon="terp-hr" domain="[('state','=','confirm')]" string="To Validate"/>
<filter icon="terp-hr" domain="[('department_id','=',context.get('department_id',False))]"
string="My Departments Leaves"/>
<filter icon="terp-hr" help="My Leaves" domain="[('user_id','=',uid)]" string="My Leaves"/>
<filter icon="terp-hr" domain="[('state','=','validate')]" string="Validated"
default="context.get('report', False)"/>
<separator orientation="vertical"/>
<field name="user_id" select="1" widget="selection" />
<field name="department_id" select="1" widget="selection" />
<field name="name" select='1'/>
<field name="state" select="1">
<filter icon="terp-hr" domain="[('state','=','refuse')]" help="Refused Holidays"/>
<filter icon="terp-hr" domain="[('state','=','validate')]" help="Validated Holidays"/>
</field>
<filter icon="terp-hr" help="My Leaves" domain="[('user_id','=',uid)]" string="My Leaves" default="1"/>
<separator orientation="vertical"/>
<field name="user_id" widget="selection" />
<field name="department_id" widget="selection">
<filter icon="terp-hr"
domain="[('department_id.manager_id','=',uid)]"
/>
</field>
<field name="holiday_status_id" widget="selection"/>
</group>
<newline />
<group expand="1" string="Group By..." colspan="11" col="11">
<filter string="Department" icon="terp-sale" domain="[]" context="{'group_by':'department_id'}"/>
<filter string="Manager" icon="terp-sale" domain="[]" context="{'group_by':'manager_id'}"/>
<filter string="User" icon="terp-sale" domain="[]" context="{'group_by':'user_id'}"/>
<separator orientation="vertical"/>
<filter string="State" icon="terp-sale" domain="[]" context="{'group_by':'state'}"/>
<filter string="Type" icon="terp-sale" domain="[]" context="{'group_by':'holiday_status_id'}"
default="context.get('report', False)"/>
</group>
</search>
</field>
</record>
<!-- Holidays: Leave Request -->
<record model="ir.ui.view" id="edit_holiday_new">
<field name="name">Leave Request</field>
@@ -41,14 +45,16 @@
<field name="priority">1</field>
<field name="arch" type="xml">
<form string="Leave Request">
<field name="name" select="1"/>
<field name="holiday_status_id" select="1" on_change="onchange_sec_id(holiday_status_id)" context="{'employee_id':employee_id}" />
<field name="date_from" select="1" on_change="onchange_date_from(date_to, date_from)" required="1"/>
<field name="date_to" select="1" on_change="onchange_date_to(date_from, date_to)" required="1"/>
<group col="6" colspan="4">
<field name="name" select="1"/>
<field name="employee_id" select="1" required="1"/>
<field name="holiday_status_id" select="1" on_change="onchange_sec_id(holiday_status_id)" context="{'employee_id':employee_id}" />
<field name="date_from" select="1" on_change="onchange_date_from(date_to, date_from)" required="1"/>
<field name="date_to" select="1" on_change="onchange_date_to(date_from, date_to)" required="1"/>
<field name="number_of_days_temp"/>
</group>
<notebook colspan="4">
<page string="General">
<field name="employee_id" select="1" required="1"/>
<field name="number_of_days_temp"/>
<field name="manager_id"/>
<field name="department_id"/>
<field name="notes" colspan="4"/>
@@ -132,6 +138,27 @@
</field>
</record>
<record model="ir.ui.view" id="view_holiday_simple">
<field name="name">hr.holidays.reprot_tree</field>
<field name="model">hr.holidays</field>
<field name="type">tree</field>
<field name="priority">20</field>
<field name="arch" type="xml">
<tree string="Holidays Report">
<field name="employee_id" invisible="1"/>
<field name="department_id" invisible="1"/>
<field name="number_of_days" string="Number of Days" sum='Remaining Days'/>
<field name="date_from" invisible="1"/>
<field name="date_to" invisible="1"/>
<field name="name" invisible="1"/>
<field name="holiday_status_id" invisible="1"/>
<field name="type" invisible="1"/>
<field name="state" invisible="1"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="view_holiday">
<field name="name">hr.holidays.tree</field>
<field name="model">hr.holidays</field>
@@ -159,8 +186,8 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="My Leaves" >
<field name="employee_id"/>
<field name="user_id"/>
<field name="employee_id"/>
<field name="user_id"/>
<field name="holiday_status"/>
<field name="max_leaves"/>
<field name="leaves_taken" />
@@ -176,7 +203,7 @@
id="menu_open_ask_holidays"/>
<record model="ir.actions.act_window" id="open_ask_holidays">
<field name="name">Leave Request(s)</field>
<field name="name">Leave Requests</field>
<field name="res_model">hr.holidays</field>
<field name="view_type">form</field>
<field name="view_id" ref="edit_holiday_new"/>
@@ -206,7 +233,7 @@
action="open_ask_holidays"/>
<record model="ir.actions.act_window" id="open_allocation_holidays">
<field name="name">Allocation Request(s)</field>
<field name="name">Allocation Requests</field>
<field name="res_model">hr.holidays</field>
<field name="view_type">form</field>
<field name="context">{'type':'add'}</field>
@@ -214,7 +241,7 @@
<field name="view_id" ref="allocation_leave_new" />
</record>
<record model="ir.actions.act_window.view" id="action_open_allocation_holidays_tree">
<record model="ir.actions.act_window.view" id="action_open_allocation_holidays_tree">
<field name="sequence" eval="1"/>
<field name="view_mode">tree</field>
<field name="view_id" ref="view_holiday"/>
@@ -239,12 +266,12 @@
<field name="res_model">hr.holidays</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="allocation_company_new" />
<field name="context">{'allocation_type':'company'}</field>
<field name="view_id" eval="view_holiday_simple" />
<field name="context">{'allocation_type':'company', 'report':True}</field>
</record>
<menuitem
name="Leaves Management"
name="Leaves Summary"
parent="menu_open_ask_holidays"
id="menu_open_company_allocation"
action="open_company_allocation"
@@ -43,10 +43,10 @@
<field name="partner_phone"/>
<field name="job_id"/>
<field name="stage_id"/>
<field name="survey" invisible="1"/>
<field name="response" invisible="1"/>
<button name="stage_previous" string="Previous" states="open,pending" type="object" icon="gtk-go-back"/>
<button name="stage_next" string="Next" states="open,pending" type="object" icon="gtk-go-forward"/>
<field name="survey" invisible="1"/>
<field name="response" invisible="1"/>
<field name="priority"/>
<field name="type_id" invisible="1"/>
<field name="availability" invisible="1"/>
@@ -18,13 +18,15 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import base64
import time
import datetime
import base64
from osv import osv, fields
from tools.translate import _
class l10n_be_vat_declaration(osv.osv_memory):
""" Periodical VAT Declaration """
""" Vat Declaration """
_name = "l1on_be.vat.declaration"
_description = "Vat Declaration"
@@ -32,14 +34,14 @@ class l10n_be_vat_declaration(osv.osv_memory):
'period_id': fields.many2one('account.period','Period', required=True),
'msg': fields.text('File created', size=64, readonly=True),
'file_save': fields.binary('Save File'),
'ask_resitution': {'type': 'boolean', 'string': 'Ask Restitution',},
'ask_payment': {'type': 'boolean', 'string': 'Ask Payment',},
'client_nihil': {'type': 'boolean', 'string': 'Last Declaration of Entreprise', 'help': 'Thick this case only if it concerns only the last statement on the civil or cessation of activity'},
}
'ask_resitution': fields.boolean('Ask Restitution'),
'ask_payment': fields.boolean('Ask Payment'),
'client_nihil': fields.boolean('Last Declaration of Entreprise',help='Thick this case only if it concerns only the last statement on the civil or cessation of activity'),
}
_defaults = {
'msg': lambda *a:'''Save the File with '".xml"' extension.''',
}
}
def create_xml(self, cr, uid, ids, context={}):
obj_fyear = self.pool.get('account.fiscalyear')
@@ -54,7 +56,7 @@ class l10n_be_vat_declaration(osv.osv_memory):
user_cmpny = obj_company.name
vat_no=obj_company.partner_id.vat
if not vat_no:
raise osv.except_osv(_('Data Insufficient'),_('No VAT Number Associated with Main Company!'))
raise wizard.except_wizard(_('Data Insufficient'),_('No VAT Number Associated with Main Company!'))
tax_code_ids = obj_tax_code.search(cr, uid, [], context=context)
ctx = context.copy()
@@ -63,7 +65,9 @@ class l10n_be_vat_declaration(osv.osv_memory):
tax_info = obj_tax_code.read(cr, uid, tax_code_ids, ['code','sum_period'], context=ctx)
address = post_code = city = country_code = ''
city, post_code, address, country_code = obj_comp._get_default_ad(obj_company.partner_id.address)
city, post_code, address, country_code = pooler.get_pool(cr.dbname).get('res.company')._get_default_ad(obj_company.partner_id.address)
year_id = obj_fyear.find(cr, uid)
account_period = obj_acc_period.browse(cr, uid, data['period_id'], context=context)
@@ -81,25 +85,24 @@ class l10n_be_vat_declaration(osv.osv_memory):
#starting month and ending month of selected period are not the same
#it means that the accounting isn't based on periods of 1 month but on quarters
quarter = str(((int(starting_month) - 1) / 3) + 1)
data_of_file += '<QUARTER>' + quarter + '</QUARTER>\n\t\t\t'
data_of_file += '<QUARTER>'+quarter+'</QUARTER>\n\t\t\t'
else:
data_of_file += '<MONTH>' + starting_month + '</MONTH>\n\t\t\t'
data_of_file += '<MONTH>'+starting_month+'</MONTH>\n\t\t\t'
data_of_file += '<YEAR>' + str(account_period.date_stop[:4]) + '</YEAR>\n\t\t</DPERIODE>\n\t\t<ASK RESTITUTION="NO" PAYMENT="NO"/>'
data_of_file += '\n\t\t<ClientListingNihil>'+ (data['form']['client_nihil'] and 'YES' or 'NO') +'</ClientListingNihil>'
data_of_file +='\n\t\t<DATA>\n\t\t\t<DATA_ELEM>'
for item in tax_info:
if item['code']:
if item['code'] == '71-72':
item['code'] = '71'
item['code']='71'
if item['code'] in list_of_tags:
data_of_file +='\n\t\t\t\t<D'+str(int(item['code'])) +'>' + str(abs(int(item['sum_period']*100))) + '</D'+str(int(item['code'])) +'>'
data_of_file +='\n\t\t\t</DATA_ELEM>\n\t\t</DATA>\n\t</VATRECORD>\n</VATSENDING>'
data['file_save'] = base64.encodestring(data_of_file)
self.write(cr, uid, ids, {'file_save':data['file_save']}, context=context)
return True
l10n_be_vat_declaration()
@@ -3,9 +3,9 @@
<data>
<menuitem
id="menu_finance_belgian_statement"
name="Belgium Statements"
parent="account.menu_finance_legal_statement"/>
id="menu_finance_belgian_statement"
name="Belgium Statements"
parent="account.menu_finance_legal_statement"/>
<record id="view_vat_declaration" model="ir.ui.view">
<field name="name">Select Period</field>
@@ -13,12 +13,12 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Select Period">
<group colspan="4" >
<field name="period_id" select="1" default_focus="1"/>
<field name="ask_resitution"/>
<field name="ask_payment"/>
<field name="client_nihil"/>
<button colspan="1" name="create_xml" string="Create XML" type="object" icon="gtk-execute"/>
<group colspan="4" >
<field name="period_id" select="1"/>
<field name="ask_resitution"/>
<field name="ask_payment"/>
<field name="client_nihil"/>
<button colspan="1" name="create_xml" string="Create XML" type="object" default_focus="1"/>
</group>
<separator string="XML Flie has been Created." colspan="4"/>
<group colspan="4" >
+2 -2
View File
@@ -152,9 +152,9 @@ class account_invoice(osv.osv):
## @parma date_invoice date of the invoice
## @parma payment_term inoice payment term
## @param partner_bank_id the partner linked invoice bank
## @return the dict of values with the partner_bank value updated
## @return the dict of values with the partner_bank value updated
def onchange_partner_id(self, cr, uid, ids, type, partner_id,
date_invoice=False, payment_term=False, partner_bank_id=False):
date_invoice=False, payment_term=False, partner_bank_id=False, company_id=False):
""" Function that is call when the partner of the invoice is changed
it will retriev and set the good bank partner bank"""
res = super(account_invoice, self).onchange_partner_id(
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- Cancel Repair -->
<record id="view_cancel_repair" model="ir.ui.view">
<field name="name">Cancel Repair</field>
<field name="model">mrp.repair.cancel</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Cancel Repair Order">
<label string="This operation will cancel the Repair process, but will not cancel it's Invoice. Do you want to continue?" colspan="4"/>
<newline/>
<group col="2" colspan="4">
<button icon='gtk-cancel' special="cancel"
string="No" />
<button name="cancel_repair" string="Yes"
colspan="1" type="object" icon="gtk-ok" />
</group>
</form>
</field>
</record>
<record id="action_cancel_repair" model="ir.actions.act_window">
<field name="name">Cancel Repair Order</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">mrp.repair.cancel</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
</data>
</openerp>
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- Make Invoice -->
<record id="view_make_invoice" model="ir.ui.view">
<field name="name">Make Invoice</field>
<field name="model">mrp.repair.make_invoice</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Create invoices">
<separator colspan="4" string="Do you really want to create the invoices ?" />
<field name="group"/>
<newline/>
<group col="2" colspan="4">
<button icon='gtk-cancel' special="cancel"
string="Cancel" />
<button name="make_invoices" string="Create Invoice"
colspan="1" type="object" icon="gtk-ok" />
</group>
</form>
</field>
</record>
<act_window name="Make Invoice"
res_model="mrp.repair.make_invoice"
src_model="mrp.repair"
view_mode="form"
target="new"
key2="client_action_multi"
id="act_mrp_repair_invoice"/>
</data>
</openerp>
+41 -24
View File
@@ -25,6 +25,7 @@ import re
import time
import tools
from crm import crm
import mx.DateTime
from datetime import datetime, timedelta
from osv import fields,osv,orm
from osv.orm import except_orm
@@ -56,37 +57,53 @@ class project_issue(osv.osv):
@param ids: List of Openday’s IDs
@return: difference between current date and log date
@param context: A standard dictionary for contextual values
"""
log_obj = self.pool.get('crm.case.log')
model_obj = self.pool.get('ir.model')
cal_obj = self.pool.get('resource.calendar')
model_ids = model_obj.search(cr, uid, [('model', '=', self._name)])
model_id = False
if len(model_ids):
model_id = model_ids[0]
"""
cal_obj = self.pool.get('resource.calendar')
res_obj = self.pool.get('resource.resource')
res = {}
for project in self.browse(cr, uid, ids , context):
for issue in self.browse(cr, uid, ids , context):
for field in fields:
res[project.id] = {}
res[issue.id] = {}
duration = 0
ans = False
if field == 'day_open':
if project.date_open:
date_create = datetime.strptime(project.create_date, "%Y-%m-%d %H:%M:%S")
date_open = datetime.strptime(project.date_open, "%Y-%m-%d %H:%M:%S")
if issue.date_open:
date_create = datetime.strptime(issue.create_date, "%Y-%m-%d %H:%M:%S")
date_open = datetime.strptime(issue.date_open, "%Y-%m-%d %H:%M:%S")
ans = date_open - date_create
duration = float(ans.days) + (float(ans.seconds) / 86400)
date_until = issue.date_open
elif field == 'day_close':
if project.date_closed:
date_create = datetime.strptime(project.create_date, "%Y-%m-%d %H:%M:%S")
date_close = datetime.strptime(project.date_closed, "%Y-%m-%d %H:%M:%S")
if issue.date_closed:
date_create = datetime.strptime(issue.create_date, "%Y-%m-%d %H:%M:%S")
date_close = datetime.strptime(issue.date_closed, "%Y-%m-%d %H:%M:%S")
date_until = issue.date_closed
ans = date_close - date_create
duration = float(ans.days) + (float(ans.seconds) / 86400)
res[project.id][field] = abs(int(duration))
if ans:
resource_id = False
if issue.user_id:
resource_ids = res_obj.search(cr, uid, [('user_id','=',issue.user_id.id)])
resource_id = len(resource_ids) or resource_ids[0]
duration = float(ans.days)
if issue.section_id.resource_calendar_id:
duration = float(ans.days) * 24
new_dates = cal_obj.interval_get(cr,
uid,
issue.section_id.resource_calendar_id and issue.section_id.resource_calendar_id.id or False,
mx.DateTime.strptime(issue.create_date, '%Y-%m-%d %H:%M:%S'),
duration,
resource=resource_id
)
no_days = []
date_until = mx.DateTime.strptime(date_until, '%Y-%m-%d %H:%M:%S')
for in_time, out_time in new_dates:
if in_time.date not in no_days:
no_days.append(in_time.date)
if out_time > date_until:
break
duration = len(no_days)
res[issue.id][field] = abs(int(duration))
return res
_columns = {
@@ -109,7 +126,7 @@ class project_issue(osv.osv):
method=True, multi='day_open', type="integer", store=True),
'day_close': fields.function(_compute_day, string='Days to Close', \
method=True, multi='day_close', type="integer", store=True),
'assigned_to' : fields.many2one('res.users', 'Assigned to'),
'assigned_to' : fields.many2one('res.users', 'Assigned to'),
'timesheet_ids' : fields.one2many('hr.analytic.timesheet', 'issue_id', 'Timesheets'),
'analytic_account_id' : fields.many2one('account.analytic.account', 'Analytic Account',
domain="[('partner_id', '=', partner_id)]",