[FIX] sale : Constraint Error-Order Reference must be unique per company

lp bug: https://launchpad.net/bugs/800100 fixed

bzr revid: mdi@tinyerp.com-20111109063048-i1z9mpz68aubht5r
This commit is contained in:
Divyesh Makwana (Open ERP)
2011-11-09 12:00:48 +05:30
parent 63e3886bc3
commit 3e92b00eea
3 changed files with 13 additions and 4 deletions
+3
View File
@@ -286,6 +286,9 @@ class account_invoice(osv.osv):
'internal_number': False,
'user_id': lambda s, cr, u, c: u,
}
_sql_constraints = [
('number_uniq', 'unique(number,company_id)', 'Invoice Number must be unique per Company!'),
]
def fields_view_get(self, cr, uid, view_id=None, view_type=False, context=None, toolbar=False, submenu=False):
journal_obj = self.pool.get('account.journal')
+4 -1
View File
@@ -271,7 +271,7 @@ class mrp_bom(osv.osv):
if context is None:
context = {}
context['lang'] = self.pool.get('res.users').browse(cr,uid,uid).context_lang
if product_id:
prod = self.pool.get('product.product').browse(cr, uid, product_id, context=context)
v = {'name': prod.name, 'product_uom': prod.uom_id.id}
@@ -490,6 +490,9 @@ class mrp_production(osv.osv):
'name': lambda x, y, z, c: x.pool.get('ir.sequence').get(y, z, 'mrp.production') or '/',
'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'mrp.production', context=c),
}
_sql_constraints = [
('name_uniq', 'unique(name,company_id)', 'Order Reference must be unique per Company!'),
]
_order = 'priority desc, date_planned asc';
def _check_qty(self, cr, uid, ids, context=None):
+6 -3
View File
@@ -661,6 +661,9 @@ class stock_picking(osv.osv):
'date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'stock.picking', context=c)
}
_sql_constraints = [
('name_uniq', 'unique(name,company_id)', 'Order Reference must be unique per Company!'),
]
def action_process(self, cr, uid, ids, context=None):
if context is None: context = {}
@@ -1774,7 +1777,7 @@ class stock_move(osv.osv):
def onchange_date(self, cr, uid, ids, date, date_expected, context=None):
""" On change of Scheduled Date gives a Move date.
@param date_expected: Scheduled Date
@param date_expected: Scheduled Date
@param date: Move Date
@return: Move Date
"""
@@ -2237,7 +2240,7 @@ class stock_move(osv.osv):
return super(stock_move, self).unlink(
cr, uid, ids, context=ctx)
# _create_lot function is not used anywhere
# _create_lot function is not used anywhere
def _create_lot(self, cr, uid, ids, product_id, prefix=False):
""" Creates production lot
@return: Production lot id
@@ -2283,7 +2286,7 @@ class stock_move(osv.osv):
self.action_done(cr, uid, res)
return res
# action_split function is not used anywhere
# action_split function is not used anywhere
def action_split(self, cr, uid, ids, quantity, split_by_qty=1, prefix=False, with_lot=True, context=None):
""" Split Stock Move lines into production lot which specified split by quantity.
@param cr: the database cursor