Meera Trambadia (OpenERP) has proposed merging
lp:~openerp-dev/openobject-addons/trunk-bug-789019-mtr into
lp:openobject-addons.
Requested reviews:
OpenERP Core Team (openerp)
Related bugs:
Bug #789019 in OpenERP Addons: "unique keys missing"
https://bugs.launchpad.net/openobject-addons/+bug/789019
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-789019-mtr/+merge/70519
=>account,hr,hr_recruitment,hr_payroll,product:- enforced _sql_constraint on
the following objects to to maintain uniqueness:-
-account.period
-account.tax
-hr.recruitment.degree
-hr.salary.rule.category
-hr.salary.rule
-hr.job
-product.product
--fixes=lp:789019
--
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-789019-mtr/+merge/70519
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/trunk-bug-789019-mtr.
=== modified file 'account/account.py'
--- account/account.py 2011-07-18 08:34:24 +0000
+++ account/account.py 2011-08-05 05:58:26 +0000
@@ -880,7 +880,10 @@
'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 @@
'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):
"""
=== modified file 'hr/hr.py'
--- hr/hr.py 2011-07-11 16:38:39 +0000
+++ hr/hr.py 2011-08-05 05:58:26 +0000
@@ -97,6 +97,11 @@
'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:
=== modified file 'hr_payroll/hr_payroll.py'
--- hr_payroll/hr_payroll.py 2011-07-11 16:38:39 +0000
+++ hr_payroll/hr_payroll.py 2011-08-05 05:58:26 +0000
@@ -184,6 +184,9 @@
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 @@
'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):
"""
=== modified file 'hr_payroll/hr_payroll_demo.xml'
--- hr_payroll/hr_payroll_demo.xml 2011-06-29 10:28:01 +0000
+++ hr_payroll/hr_payroll_demo.xml 2011-08-05 05:58:26 +0000
@@ -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"/>
=== modified file 'hr_recruitment/hr_recruitment.py'
--- hr_recruitment/hr_recruitment.py 2011-07-05 12:28:57 +0000
+++ hr_recruitment/hr_recruitment.py 2011-08-05 05:58:26 +0000
@@ -73,6 +73,9 @@
_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):
=== modified file 'product/product.py'
--- product/product.py 2011-07-05 12:28:57 +0000
+++ product/product.py 2011-08-05 05:58:26 +0000
@@ -365,6 +365,9 @@
_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:
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp