[MERGE] forward port of branch 7.0 up to revid 9954 chs@openerp.com-20140403153129-jq9zc7ityoy25c73

bzr revid: chs@openerp.com-20140403155904-ya5mas5s3g7ivihb
This commit is contained in:
Christophe Simonis 2014-04-03 17:59:04 +02:00
commit db6fb31870
8 changed files with 35 additions and 27 deletions

View File

@ -1666,7 +1666,7 @@ class account_bank_statement_line(osv.osv):
def _check_amount(self, cr, uid, ids, context=None): def _check_amount(self, cr, uid, ids, context=None):
for obj in self.browse(cr, uid, ids, context=context): for obj in self.browse(cr, uid, ids, context=context):
if obj.voucher_id: if obj.voucher_id:
diff = abs(obj.amount) - obj.voucher_id.amount diff = abs(obj.amount) - abs(obj.voucher_id.amount)
if not self.pool.get('res.currency').is_zero(cr, uid, obj.statement_id.currency, diff): if not self.pool.get('res.currency').is_zero(cr, uid, obj.statement_id.currency, diff):
return False return False
return True return True

View File

@ -241,10 +241,10 @@ class crm_lead(format_address, osv.osv):
'opt_out': fields.boolean('Opt-Out', oldname='optout', 'opt_out': fields.boolean('Opt-Out', oldname='optout',
help="If opt-out is checked, this contact has refused to receive emails for mass mailing and marketing campaign. " help="If opt-out is checked, this contact has refused to receive emails for mass mailing and marketing campaign. "
"Filter 'Available for Mass Mailing' allows users to filter the leads when performing mass mailing."), "Filter 'Available for Mass Mailing' allows users to filter the leads when performing mass mailing."),
'type':fields.selection([ ('lead','Lead'), ('opportunity','Opportunity'), ],'Type', help="Type is used to separate Leads and Opportunities"), 'type': fields.selection([ ('lead','Lead'), ('opportunity','Opportunity'), ],'Type', select=True, help="Type is used to separate Leads and Opportunities"),
'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Priority', select=True), 'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Priority', select=True),
'date_closed': fields.datetime('Closed', readonly=True), 'date_closed': fields.datetime('Closed', readonly=True),
'stage_id': fields.many2one('crm.case.stage', 'Stage', track_visibility='onchange', 'stage_id': fields.many2one('crm.case.stage', 'Stage', track_visibility='onchange', select=True,
domain="['&', ('section_ids', '=', section_id), '|', ('type', '=', type), ('type', '=', 'both')]"), domain="['&', ('section_ids', '=', section_id), '|', ('type', '=', type), ('type', '=', 'both')]"),
'user_id': fields.many2one('res.users', 'Salesperson', select=True, track_visibility='onchange'), 'user_id': fields.many2one('res.users', 'Salesperson', select=True, track_visibility='onchange'),
'referred': fields.char('Referred By', size=64), 'referred': fields.char('Referred By', size=64),

View File

@ -571,7 +571,7 @@ class hr_payslip(osv.osv):
payslip_obj = Payslips(self.pool, cr, uid, payslip.employee_id.id, payslip) payslip_obj = Payslips(self.pool, cr, uid, payslip.employee_id.id, payslip)
rules_obj = BrowsableObject(self.pool, cr, uid, payslip.employee_id.id, rules) rules_obj = BrowsableObject(self.pool, cr, uid, payslip.employee_id.id, rules)
localdict = {'categories': categories_obj, 'rules': rules_obj, 'payslip': payslip_obj, 'worked_days': worked_days_obj, 'inputs': input_obj} baselocaldict = {'categories': categories_obj, 'rules': rules_obj, 'payslip': payslip_obj, 'worked_days': worked_days_obj, 'inputs': input_obj}
#get the ids of the structures on the contracts and their parent id as well #get the ids of the structures on the contracts and their parent id as well
structure_ids = self.pool.get('hr.contract').get_all_structures(cr, uid, contract_ids, context=context) structure_ids = self.pool.get('hr.contract').get_all_structures(cr, uid, contract_ids, context=context)
#get the rules of the structure and thier children #get the rules of the structure and thier children
@ -581,11 +581,12 @@ class hr_payslip(osv.osv):
for contract in self.pool.get('hr.contract').browse(cr, uid, contract_ids, context=context): for contract in self.pool.get('hr.contract').browse(cr, uid, contract_ids, context=context):
employee = contract.employee_id employee = contract.employee_id
localdict.update({'employee': employee, 'contract': contract}) localdict = dict(baselocaldict, employee=employee, contract=contract)
for rule in obj_rule.browse(cr, uid, sorted_rule_ids, context=context): for rule in obj_rule.browse(cr, uid, sorted_rule_ids, context=context):
key = rule.code + '-' + str(contract.id) key = rule.code + '-' + str(contract.id)
localdict['result'] = None localdict['result'] = None
localdict['result_qty'] = 1.0 localdict['result_qty'] = 1.0
localdict['result_rate'] = 100
#check if the rule can be applied #check if the rule can be applied
if obj_rule.satisfy_condition(cr, uid, rule.id, localdict, context=context) and rule.id not in blacklist: if obj_rule.satisfy_condition(cr, uid, rule.id, localdict, context=context) and rule.id not in blacklist:
#compute the amount of the rule #compute the amount of the rule

View File

@ -752,7 +752,7 @@ class task(osv.osv):
'description': fields.text('Description'), 'description': fields.text('Description'),
'priority': fields.selection([('4','Very Low'), ('3','Low'), ('2','Medium'), ('1','Important'), ('0','Very important')], 'Priority', select=True), 'priority': fields.selection([('4','Very Low'), ('3','Low'), ('2','Medium'), ('1','Important'), ('0','Very important')], 'Priority', select=True),
'sequence': fields.integer('Sequence', select=True, help="Gives the sequence order when displaying a list of tasks."), 'sequence': fields.integer('Sequence', select=True, help="Gives the sequence order when displaying a list of tasks."),
'stage_id': fields.many2one('project.task.type', 'Stage', track_visibility='onchange', 'stage_id': fields.many2one('project.task.type', 'Stage', track_visibility='onchange', select=True,
domain="[('project_ids', '=', project_id)]"), domain="[('project_ids', '=', project_id)]"),
'categ_ids': fields.many2many('project.category', string='Tags'), 'categ_ids': fields.many2many('project.category', string='Tags'),
'kanban_state': fields.selection([('normal', 'Normal'),('blocked', 'Blocked'),('done', 'Ready for next stage')], 'Kanban State', 'kanban_state': fields.selection([('normal', 'Normal'),('blocked', 'Blocked'),('done', 'Ready for next stage')], 'Kanban State',
@ -768,7 +768,7 @@ class task(osv.osv):
'date_end': fields.datetime('Ending Date',select=True), 'date_end': fields.datetime('Ending Date',select=True),
'date_deadline': fields.date('Deadline',select=True), 'date_deadline': fields.date('Deadline',select=True),
'date_last_stage_update': fields.datetime('Last Stage Update', select=True), 'date_last_stage_update': fields.datetime('Last Stage Update', select=True),
'project_id': fields.many2one('project.project', 'Project', ondelete='set null', select="1", track_visibility='onchange', change_default=True), 'project_id': fields.many2one('project.project', 'Project', ondelete='set null', select=True, track_visibility='onchange', change_default=True),
'parent_ids': fields.many2many('project.task', 'project_task_parent_rel', 'task_id', 'parent_id', 'Parent Tasks'), 'parent_ids': fields.many2many('project.task', 'project_task_parent_rel', 'task_id', 'parent_id', 'Parent Tasks'),
'child_ids': fields.many2many('project.task', 'project_task_parent_rel', 'parent_id', 'task_id', 'Delegated Tasks'), 'child_ids': fields.many2many('project.task', 'project_task_parent_rel', 'parent_id', 'task_id', 'Delegated Tasks'),
'notes': fields.text('Notes'), 'notes': fields.text('Notes'),
@ -794,7 +794,7 @@ class task(osv.osv):
'project.task': (lambda self, cr, uid, ids, c={}: ids, ['work_ids', 'remaining_hours', 'planned_hours'], 10), 'project.task': (lambda self, cr, uid, ids, c={}: ids, ['work_ids', 'remaining_hours', 'planned_hours'], 10),
'project.task.work': (_get_task, ['hours'], 10), 'project.task.work': (_get_task, ['hours'], 10),
}), }),
'user_id': fields.many2one('res.users', 'Assigned to', track_visibility='onchange'), 'user_id': fields.many2one('res.users', 'Assigned to', select=True, track_visibility='onchange'),
'delegated_user_id': fields.related('child_ids', 'user_id', type='many2one', relation='res.users', string='Delegated To'), 'delegated_user_id': fields.related('child_ids', 'user_id', type='many2one', relation='res.users', string='Delegated To'),
'partner_id': fields.many2one('res.partner', 'Customer'), 'partner_id': fields.many2one('res.partner', 'Customer'),
'work_ids': fields.one2many('project.task.work', 'task_id', 'Work done'), 'work_ids': fields.one2many('project.task.work', 'task_id', 'Work done'),

View File

@ -381,7 +381,7 @@
</h1> </h1>
<group> <group>
<group> <group>
<field name="project_id" on_change="onchange_project(project_id)" context="{'default_use_tasks':1}"/> <field name="project_id" domain="[('state', '!=', 'close')]" on_change="onchange_project(project_id)" context="{'default_use_tasks':1}"/>
<field name="user_id" <field name="user_id"
options='{"no_open": True}' options='{"no_open": True}'
context="{'default_groups_ref': ['base.group_user', 'base.group_partner_manager', 'project.group_project_user']}"/> context="{'default_groups_ref': ['base.group_user', 'base.group_partner_manager', 'project.group_project_user']}"/>

View File

@ -264,9 +264,9 @@ class project_issue(osv.Model):
'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Priority', select=True), 'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Priority', select=True),
'version_id': fields.many2one('project.issue.version', 'Version'), 'version_id': fields.many2one('project.issue.version', 'Version'),
'stage_id': fields.many2one ('project.task.type', 'Stage', 'stage_id': fields.many2one ('project.task.type', 'Stage',
track_visibility='onchange', track_visibility='onchange', select=True,
domain="[('project_ids', '=', project_id)]"), domain="[('project_ids', '=', project_id)]"),
'project_id':fields.many2one('project.project', 'Project', track_visibility='onchange'), 'project_id': fields.many2one('project.project', 'Project', track_visibility='onchange', select=True),
'duration': fields.float('Duration'), 'duration': fields.float('Duration'),
'task_id': fields.many2one('project.task', 'Task', domain="[('project_id','=',project_id)]"), 'task_id': fields.many2one('project.task', 'Task', domain="[('project_id','=',project_id)]"),
'day_open': fields.function(_compute_day, string='Days to Open', \ 'day_open': fields.function(_compute_day, string='Days to Open', \

View File

@ -101,7 +101,6 @@ class sale_order_line_make_invoice(osv.osv_memory):
break break
if flag: if flag:
workflow.trg_validate(uid, 'sale.order', order.id, 'manual_invoice', cr) workflow.trg_validate(uid, 'sale.order', order.id, 'manual_invoice', cr)
sales_order_obj.write(cr, uid, [order.id], {'state': 'progress'})
if not invoices: if not invoices:
raise osv.except_osv(_('Warning!'), _('Invoice cannot be created for this Sales Order Line due to one of the following reasons:\n1.The state of this sales order line is either "draft" or "cancel"!\n2.The Sales Order Line is Invoiced!')) raise osv.except_osv(_('Warning!'), _('Invoice cannot be created for this Sales Order Line due to one of the following reasons:\n1.The state of this sales order line is either "draft" or "cancel"!\n2.The Sales Order Line is Invoiced!'))

View File

@ -19,21 +19,7 @@
# #
############################################################################## ##############################################################################
from openerp.osv import fields, osv from openerp.osv import fields, osv
from openerp import SUPERUSER_ID
class res_groups(osv.osv):
_name = "res.groups"
_inherit = 'res.groups'
_columns = {
'share': fields.boolean('Share Group', readonly=True,
help="Group created to set access rights for sharing data with some users.")
}
def get_application_groups(self, cr, uid, domain=None, context=None):
if domain is None:
domain = []
domain.append(('share', '=', False))
return super(res_groups, self).get_application_groups(cr, uid, domain=domain, context=context)
class res_users(osv.osv): class res_users(osv.osv):
_name = 'res.users' _name = 'res.users'
@ -43,4 +29,26 @@ class res_users(osv.osv):
help="External user with limited access, created only for the purpose of sharing data.") help="External user with limited access, created only for the purpose of sharing data.")
} }
class res_groups(osv.osv):
_name = "res.groups"
_inherit = 'res.groups'
_columns = {
'share': fields.boolean('Share Group', readonly=True,
help="Group created to set access rights for sharing data with some users.")
}
def init(self, cr):
# force re-generation of the user groups view without the shared groups
self.update_user_groups_view(cr, SUPERUSER_ID)
parent_class = super(res_groups, self)
if hasattr(parent_class, 'init'):
parent_class.init(cr)
def get_application_groups(self, cr, uid, domain=None, context=None):
if domain is None:
domain = []
domain.append(('share', '=', False))
return super(res_groups, self).get_application_groups(cr, uid, domain=domain, context=context)
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: