[FIX] account,hr,hr_recruitment,hr_payroll,product:- enforced _sql_constraint to maintain uniqueness
lp bug: https://launchpad.net/bugs/789019 fixed bzr revid: mtr@mtr-20110805052025-3w0w7ccnnlrish2b
This commit is contained in:
parent
fbbebc5273
commit
b3d4085714
|
@ -880,7 +880,10 @@ class account_period(osv.osv):
|
|||
'state': 'draft',
|
||||
}
|
||||
_order = "date_start, special desc"
|
||||
|
||||
_sql_constraints = [
|
||||
('name_company_uniq', 'unique(name, company_id)', 'The name of the period must be unique per company !'),
|
||||
]
|
||||
|
||||
def _check_duration(self,cr,uid,ids,context=None):
|
||||
obj_period = self.browse(cr, uid, ids[0], context=context)
|
||||
if obj_period.date_stop < obj_period.date_start:
|
||||
|
@ -1762,6 +1765,9 @@ class account_tax(osv.osv):
|
|||
'type_tax_use': fields.selection([('sale','Sale'),('purchase','Purchase'),('all','All')], 'Tax Application', required=True)
|
||||
|
||||
}
|
||||
_sql_constraints = [
|
||||
('name_company_uniq', 'unique(name, company_id)', 'Tax Name must be unique per company!'),
|
||||
]
|
||||
|
||||
def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=80):
|
||||
"""
|
||||
|
|
|
@ -97,6 +97,11 @@ class hr_job(osv.osv):
|
|||
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'hr.job', context=c),
|
||||
'state': 'open',
|
||||
}
|
||||
|
||||
_sql_constraints = [
|
||||
('name_company_uniq', 'unique(name, company_id)', 'The name of the job position must be unique per company !'),
|
||||
]
|
||||
|
||||
|
||||
def on_change_expected_employee(self, cr, uid, ids, no_of_recruitment, no_of_employee, context=None):
|
||||
if context is None:
|
||||
|
|
|
@ -184,6 +184,9 @@ class hr_salary_rule_category(osv.osv):
|
|||
self.pool.get('res.users').browse(cr, uid, uid,
|
||||
context=context).company_id.id,
|
||||
}
|
||||
_sql_constraints = [
|
||||
('code_uniq', 'unique(code)', 'The code of salary rule category must be unique!'),
|
||||
]
|
||||
|
||||
hr_salary_rule_category()
|
||||
|
||||
|
@ -816,6 +819,10 @@ result = rules.NET > categories.NET * 0.10''',
|
|||
'amount_percentage': 0.0,
|
||||
'quantity': '1.0',
|
||||
}
|
||||
|
||||
_sql_constraints = [
|
||||
('code_uniq', 'unique(code)', 'The code of salary rule must be unique!'),
|
||||
]
|
||||
|
||||
def _recursive_search_of_rules(self, cr, uid, rule_ids, context=None):
|
||||
"""
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
<record id="hr_salary_rule_ca_paolino" model="hr.salary.rule">
|
||||
<field name="amount_select">fix</field>
|
||||
<field eval="600.0" name="amount_fix"/>
|
||||
<field name="code">CA</field>
|
||||
<field name="code">CAQP</field>
|
||||
<field name="category_id" ref="hr_payroll.ALW"/>
|
||||
<field name="name">Conveyance Allowance For Paolino</field>
|
||||
<field name="sequence" eval="15"/>
|
||||
|
|
|
@ -73,6 +73,9 @@ class hr_recruitment_degree(osv.osv):
|
|||
_defaults = {
|
||||
'sequence': 1,
|
||||
}
|
||||
_sql_constraints = [
|
||||
('name_uniq', 'unique (name)', 'The name of the Degree of Recruitment must be unique!')
|
||||
]
|
||||
hr_recruitment_degree()
|
||||
|
||||
class hr_applicant(crm.crm_case, osv.osv):
|
||||
|
|
|
@ -365,6 +365,9 @@ class product_template(osv.osv):
|
|||
_constraints = [
|
||||
(_check_uom, 'Error: The default UOM and the purchase UOM must be in the same category.', ['uom_id']),
|
||||
]
|
||||
_sql_constraints = [
|
||||
('name_ref_uniq', 'unique(name, company_id)', 'The name of the product must be unique per company!'),
|
||||
]
|
||||
|
||||
def name_get(self, cr, user, ids, context=None):
|
||||
if context is None:
|
||||
|
|
Loading…
Reference in New Issue