[MERGE] merged dev branch

bzr revid: qdp-launchpad@openerp.com-20110512193633-j1jfda3x9uwcxq2b
This commit is contained in:
Quentin (OpenERP) 2011-05-12 21:36:33 +02:00
commit b21655ea29
18 changed files with 200 additions and 68 deletions

View File

@ -33,6 +33,20 @@ class followup(osv.osv):
_defaults = {
'company_id': lambda s, cr, uid, c: s.pool.get('res.company')._company_default_get(cr, uid, 'account_followup.followup', context=c),
}
def check_company_uniq(self, cr, uid, ids, context=None):
sr_id = self.search(cr,uid,[],context=context)
lines = self.browse(cr, uid, sr_id, context=context)
company = []
for l in lines:
if l.company_id.id in company:
return False
if l.company_id.id not in company:
company.append(l.company_id.id)
return True
_constraints = [
(check_company_uniq, 'Only One Folllowup by Company.',['company_id'] )
]
followup()
@ -47,6 +61,9 @@ class followup_line(osv.osv):
'followup_id': fields.many2one('account_followup.followup', 'Follow Ups', required=True, ondelete="cascade"),
'description': fields.text('Printed Message', translate=True),
}
_defaults = {
'start': 'days',
}
followup_line()

View File

@ -8,10 +8,9 @@
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Follow-Up Lines">
<field name="sequence"/>
<field name="name"/>
<field name="delay"/>
<field name="start"/>
<field name="start" groups="base.group_extended"/>
</tree>
</field>
</record>
@ -22,12 +21,12 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Follow-Up Lines">
<field name="sequence"/>
<field name="name" />
<field name="delay" />
<field name="start" />
<field name="start" groups="base.group_extended"/>
<newline/>
<field colspan="4" name="description" />
<separator string="" colspan="4"/>
<field colspan="4" name="description" nolabel="1"/>
<separator string="Legend" colspan="4"/>
<label string="%%(partner_name)s: Partner Name" colspan="2"/>
<label string="%%(date)s: Current Date" colspan="2"/>
@ -45,9 +44,7 @@
<form string="Follow-Up">
<field name="name" />
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
<separator colspan="4" string="Description"/>
<field colspan="4" name="description" nolabel="1" />
<separator colspan="4" string="Followup Lines"/>
<separator colspan="4" string="" />
<field colspan="4" name="followup_line" nolabel="1"/>
</form>
</field>
@ -75,6 +72,10 @@
<field name="name"/>
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
</group>
<newline/>
<group expand="0" string="Group By...">
<filter string="Company" icon="terp-go-home" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
</group>
</search>
</field>
</record>
@ -170,6 +171,27 @@
</field>
</field>
</record>
<!-- Configure Follow-Ups Wizard -->
<record id="action_view_account_followup_followup_form" model="ir.actions.act_window">
<field name="name">Configure Follow-Ups</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">account_followup.followup</field>
<field name="view_type">form</field>
<field name="view_mode">form,tree</field>
<field name="view_id" ref="view_account_followup_followup_form"/>
</record>
<!-- register configuration wizard -->
<record id="config_wizard_view_account_followup_followup_form" model="ir.actions.todo">
<field name="action_id" ref="action_view_account_followup_followup_form"/>
<field name="target">current</field>
<field name="type">normal</field>
<field name="state">skip</field>
</record>
</data>
</openerp>

View File

@ -1,8 +1,12 @@
-
In order to test account followup module in OpenERP I create a FollowUp structure
-
!record {model: res.company, id: ymltest_company_2}:
name: Acme 2
-
!record {model: account_followup.followup, id: account_followup_followup_testfollowups0}:
description: First letter after 15 net days, 30 net days and 45 days end of month levels.
company_id: ymltest_company_2
followup_line:
- delay: 15
name: 'level 0: 15 days'

View File

@ -171,7 +171,7 @@ class account_followup_print_all(osv.osv_memory):
"SELECT * "\
"FROM account_followup_followup_line "\
"WHERE followup_id=%s "\
"ORDER BY sequence", (fup_id,))
"ORDER BY delay", (fup_id,))
for result in cr.dictfetchall():
delay = datetime.timedelta(days=result['delay'])
fups[old] = (current_date - delay, result['id'])

View File

@ -116,52 +116,22 @@
</record>
<!-- Import or create customers configartion view -->
<record id="view_import_create_installer" model="ir.ui.view">
<field name="name">Import or create customers </field>
<field name="model">product.installer</field>
<field name="type">form</field>
<field name="inherit_id" ref="base.res_config_view_base"/>
<field name="arch" type="xml">
<data>
<form position="attributes">
<attribute name="string">Import or create customers </attribute>
</form>
<separator string="title" position="attributes">
<attribute name="string">Import or create customers </attribute>
</separator>
<xpath expr="//label[@string='description']"
position="attributes">
<attribute name="string">Create some customers, suppliers and their contacts manually or import a CSV spreadsheet by clicking on the import link</attribute>
</xpath>
<xpath expr='//separator[@string="vsep"]' position='attributes'>
<attribute name='rowspan'>15</attribute>
<attribute name='string'></attribute>
</xpath>
<group string="res_config_contents" position="replace">
<group colspan="4">
<field colspan="4" name="customers" width="200"/>
</group>
</group>
</data>
</field>
</record>
<record id="action_import_create_installer" model="ir.actions.act_window">
<field name="name">Import or create customers </field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">product.installer</field>
<field name="view_id" ref="view_import_create_installer"/>
<field name="res_model">res.partner</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="base.view_partner_tree"/>
<field name="help">Create some customers, suppliers and their contacts manually or import a CSV spreadsheet by clicking on the import link</field>
</record>
<!-- register configuration wizard -->
<record id="config_wizard_res_product_installer" model="ir.actions.todo">
<record id="config_wizard_action_import_create_installer" model="ir.actions.todo">
<field name="action_id" ref="action_import_create_installer"/>
<field name="type">normal</field>
<field name="target">current</field>
<field name="state">skip</field>
</record>
@ -182,7 +152,7 @@
</xpath>
<xpath expr="//label[@string='description']"
position="attributes">
<attribute name="string">Specify default values. These data are just default values, each user is free to change his own preferences.</attribute>
<attribute name="string">Specify default values.This will set the default values for each new user, each user is free to change his own preferences.</attribute>
</xpath>
<xpath expr='//separator[@string="vsep"]' position='attributes'>
<attribute name='string'></attribute>
@ -218,10 +188,10 @@
<field name="state">skip</field>
</record>
<!-- Config Wiz Give access to others users -->
<!-- Config Wiz Create New User's Login -->
<record id="action_config_access_other_user" model="ir.actions.act_window">
<field name="name">Give access to others users</field>
<field name="name">Create New User's Login</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">res.users</field>
<field name="view_type">form</field>
@ -251,13 +221,19 @@
<newline/>
<separator string="" colspan="4"/>
<group colspan="4" col="2">
<button name="%(action_res_company_logo)d"
string="Upload/Change Logo" type="action" icon="gtk-open"/>
<button name="preview_report" string="Preview Report" type="object" icon="gtk-print"/>
</group>
</field>
</field>
</record>
<!-- register Upload Logo configuration wizard -->
<record id="config_wizard_action_res_company_logo" model="ir.actions.todo">
<field name="action_id" ref="action_res_company_logo"/>
<field name="type">normal</field>
<field name="state">cancel</field>
</record>
</data>
</openerp>

View File

@ -64,5 +64,6 @@
<field name="type">normal</field>
<field name="state">skip</field>
</record>
</data>
</openerp>

View File

@ -221,8 +221,8 @@ class user_preferences_config(osv.osv_memory):
"translations are available"),
'view': fields.selection([('simple','Simplified'),
('extended','Extended')],
'Interface', required=True ),
'menu_tips': fields.boolean('Menu Tips', help="Check out this box if you want to always display tips on each menu action"),
'Interface', required=True, help= "If you use OpenERP for the first time we strongly advise you to select the simplified interface, which has less features but is easier. You can always switch later from the user preferences." ),
'menu_tips': fields.boolean('Display Tips', help="Check out this box if you want to always display tips on each menu action"),
}
_defaults={
@ -230,6 +230,15 @@ class user_preferences_config(osv.osv_memory):
'context_lang' : 'en_US',
'menu_tips' : True
}
def default_get(self, cr, uid, fields, context=None):
if context is None:
context = {}
res = super(user_preferences_config, self).default_get(cr, uid, fields, context=context)
res_default = self.pool.get('ir.values').get(cr, uid, 'default', False, ['res.users'])
for id, field, value in res_default:
res.update({field: value})
return res
def execute(self, cr, uid, ids, context=None):
for o in self.browse(cr, uid, ids, context=context):

View File

@ -37,10 +37,9 @@ class res_company_logo(osv.osv_memory):
def execute(self, cr, uid, ids, context=None):
if context is None:
context = {}
record_id = context.get('active_id', False) or False
comp_obj = self.pool.get("res.company")
user_comp = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id
get_val = self.browse(cr, uid, ids)[0]
comp_obj.write(cr, uid, record_id, {'logo': get_val.logo}, context=context)
user_comp.write({'logo': get_val.logo}, context=context)
return {'type': 'ir.actions.act_window_close'}
res_company_logo()

View File

@ -7,7 +7,7 @@
<field name="model">res.company.logo</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Upload Logo">
<form string="Upload Your Company Logo">
<separator string="Upload your company logo in JPG or PNG with a format similar to 450*150 pixels" colspan="4"/>
<field colspan="4" height="150" name="logo" widget="image" nolabel="1"/>
<separator colspan="4"/>
@ -21,7 +21,7 @@
</record>
<record id="action_res_company_logo" model="ir.actions.act_window">
<field name="name">Set Logo</field>
<field name="name">Upload Your Company Logo</field>
<field name="res_model">res.company.logo</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>

View File

@ -25,12 +25,13 @@
</record>
<record model="ir.actions.act_window" id="crm_case_section_view_form_installer">
<field name="name">Create sales team</field>
<field name="name">Create Sales Team</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">crm.case.section</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="crm.crm_case_section_view_form"/>
<field name="view_id" ref="crm.crm_case_section_view_tree"/>
<field name="help">Define a Sales Team to organize your different salesmen or sales departments into separate teams. Each team will work in its own list of opportunities, sales orders, etc. Each user can set a default team in his user preferences. The opportunities and sales order displayed, will automatically be filtered according to his team.</field>
</record>
<record id="crm_case_section_installer_todo" model="ir.actions.todo">
@ -46,7 +47,8 @@
<field name="res_model">crm.case.stage</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="crm.crm_case_stage_form"/>
<field name="view_id" ref="crm.crm_case_stage_tree"/>
<field name="help">Add specific stages to leads and opportunities allowing your sales to better organise their sales pipeline. Stages will allow them to easily track how a specific lead or opportunity is positioned in the sales cycle.</field>
</record>
<record id="crm_case_stage_installer_todo" model="ir.actions.todo">

View File

@ -59,9 +59,9 @@ class email_server(osv.osv):
'password' : fields.char('Password', size=1024, invisible=True, required=True, readonly=True, states={'draft':[('readonly', False)]}),
'note': fields.text('Description'),
'action_id':fields.many2one('ir.actions.server', 'Email Server Action', required=False, domain="[('state','=','email')]", help="An Email Server Action. It will be run whenever an e-mail is fetched from server."),
'object_id': fields.many2one('ir.model', "Model", required=True, help="OpenObject Model. Generates a record of this model.\nSelect Object with message_new attrbutes."),
'object_id': fields.many2one('ir.model', "Object To Create", required=True, help="Whenever an email arrives, it automatically creates the object of this type with all the information attached."),
'priority': fields.integer('Server Priority', readonly=True, states={'draft':[('readonly', False)]}, help="Priority between 0 to 10, select define the order of Processing"),
'user_id':fields.many2one('res.users', 'User', required=False),
'user_id':fields.many2one('res.users', 'User', required=False, help="This is the user that runs the cron"),
'message_ids': fields.one2many('mailgate.message', 'server_id', 'Messages', readonly=True),
}
_defaults = {

View File

@ -7,7 +7,8 @@
<field name="res_model">hr.department</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="hr.view_department_form"/>
<field name="view_id" ref="hr.view_department_tree"/>
<field name="help">Your Company's Department Structure is used to manage all documents related to employees by departments: expenses and timesheet validation, leaves management, recruitments, etc.</field>
</record>
<record id="view_department_form_todo" model="ir.actions.todo">

View File

@ -322,3 +322,41 @@ class resource_calendar_leaves(osv.osv):
resource_calendar_leaves()
class hr_employee(osv.osv):
_inherit="hr.employee"
def _set_remaining_days(self, cr, uid, empl_id, name, value, arg, context=None):
employee = self.browse(cr, uid, empl_id, context=context)
diff = value - employee.remaining_leaves
type_obj = self.pool.get('hr.holidays.status')
holiday_obj = self.pool.get('hr.holidays')
# Find for holidays status
status_ids = type_obj.search(cr, uid, [('limit', '=', False)], context=context)
status_id = status_ids and status_ids[0] or False
if not status_id or diff <= 0:
return False
leave_id = holiday_obj.create(cr, uid, {'name': 'Allocation for ' + employee.name,'employee_id': employee.id, 'holiday_status_id': status_id, 'type': 'add', 'holiday_type': 'employee', 'number_of_days_temp': diff}, context=context)
holiday_obj.holidays_confirm(cr, uid, [leave_id])
holiday_obj.holidays_validate2(cr, uid, [leave_id])
return True
def _get_remaining_days(self, cr, uid, ids, name, args, context=None):
cr.execute("SELECT sum(h.number_of_days_temp) as days, h.employee_id from hr_holidays h join hr_holidays_status s on (s.id=h.holiday_status_id) where h.type='add' and h.state='validate' and s.limit=False group by h.employee_id")
res = cr.dictfetchall()
remaining = {}
for r in res:
remaining[r['employee_id']] = r['days']
for employee_id in ids:
if not remaining.get(employee_id):
remaining[employee_id] = 0.0
return remaining
_columns = {
'remaining_leaves': fields.function(_get_remaining_days, method=True, string='Remaining Leaves', fnct_inv=_set_remaining_days, type="float", help='Remaining Leaves', store=True),
}
hr_employee()

View File

@ -441,6 +441,35 @@
src_model="hr.employee"
view_id ="view_holiday"
id="act_hr_employee_holiday_request"/>
<!-- Assing leave -->
<record id="hr_holidays_leaves_assign_tree_view" model="ir.ui.view">
<field name="name">hr.employee.leave.tree</field>
<field name="model">hr.employee</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Assign Leaves" editable="top">
<field name="name" string="Employee"/>
<field name="remaining_leaves"/>
</tree>
</field>
</record>
<record model="ir.actions.act_window" id="hr_holidays_leaves_assign_legal">
<field name="name">Assign Legal Leaves to Employees</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">hr.employee</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="hr_holidays_leaves_assign_tree_view"/>
</record>
<record id="hr_holidays_leaves_assign_form_view_todo" model="ir.actions.todo">
<field name="action_id" ref="hr_holidays_leaves_assign_legal"/>
<field name="type">normal</field>
<field name="state">skip</field>
</record>
</data>
</openerp>

View File

@ -43,6 +43,41 @@
<field name="type">normal</field>
<field name="state">skip</field>
</record>
<!-- Configure Your Services Config Wiz -->
<record id="product_timesheet_invoice_tree_view" model="ir.ui.view">
<field name="name">product.product.tree</field>
<field name="model">product.product</field>
<field name="type">tree</field>
<field eval="7" name="priority"/>
<field name="arch" type="xml">
<tree colors="red:virtual_available&lt;0;blue:virtual_available&gt;=0 and state in ('draft', 'end', 'obsolete');black:virtual_available&gt;=0 and state not in ('draft', 'end', 'obsolete')" string="Products">
<field name="name"/>
<field name="standard_price"/>
<field name="lst_price"/>
<field name="uom_id" string="UoM"/>
</tree>
</field>
</record>
<record model="ir.actions.act_window" id="product_services_form_view_installer">
<field name="name">Configure Your Services</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">product.product</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('type','=','service')]</field>
<field name="context" eval="'{\'default_type\':\'service\', \'default_sale_ok\':True, \'default_hr_expense_ok\':False,}'"/>
<field name="view_id" ref="product_timesheet_invoice_tree_view"/>
</record>
<record id="product_services_form_view_todo" model="ir.actions.todo">
<field name="action_id" ref="product_services_form_view_installer"/>
<field name="sequence">3</field>
<field name="type">normal</field>
<field name="state">skip</field>
</record>
</data>
</openerp>

View File

@ -292,7 +292,6 @@
<search string="Products">
<field name="name" />
<field name="category_id" widget="selection"/>
<field name="description" />
<field name="price"/>
</search>
</field>

View File

@ -1180,7 +1180,7 @@ class sale_config_picking_policy(osv.osv_memory):
'order_policy': fields.selection([
('manual', 'Invoice Based on Sales Orders'),
('picking', 'Invoice Based on Deliveries'),
], 'Invoice Method', required=True,
], 'Invoicing Method', required=True,
help="You can generate invoices based on sales orders or based on shippings."),
'step': fields.selection([
('one', 'Delivery Order Only'),

View File

@ -521,7 +521,7 @@
<act_window
context="{'search_default_product_id': [active_id], 'default_product_id': active_id}"
id="action_order_line_product_tree"
name="Sales order line"
name="Sales Order Lines"
res_model="sale.order.line"
src_model="product.product"
groups="base.group_sale_salesman"/>
@ -532,7 +532,7 @@
<!-- configartion view -->
<record id="view_config_picking_policy" model="ir.ui.view">
<field name="name">Setup your sales flow</field>
<field name="name">Set Up Your Invoicing Method</field>
<field name="model">sale.config.picking_policy</field>
<field name="type">form</field>
<field name="inherit_id" ref="base.res_config_view_base"/>
@ -562,7 +562,7 @@
</record>
<record id="action_config_picking_policy" model="ir.actions.act_window">
<field name="name">Setup your sales flow</field>
<field name="name">Set Up Your Invoicing Method</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">sale.config.picking_policy</field>
<field name="view_id" ref="view_config_picking_policy"/>