[FIX] : lp-660506 remove useless _constraint messages

bzr revid: ksa@tinyerp.co.in-20101027093517-uzse2toe3v3lxdzu
This commit is contained in:
ksa (Open ERP)
2010-10-27 15:05:17 +05:30
parent 2c6e81f010
commit 4e1a8d316f
7 changed files with 81 additions and 81 deletions
+1 -1
View File
@@ -130,7 +130,7 @@ class account_payment_term_line(osv.osv):
return True
_constraints = [
(_check_percent, _('Percentages for Payment Term Line must be between 0 and 1, Example: 0.02 for 2% '), ['value_amount']),
(_check_percent,('Percentages for Payment Term Line must be between 0 and 1, Example: 0.02 for 2% '), ['value_amount']),
]
account_payment_term_line()
+39 -39
View File
@@ -103,7 +103,7 @@ def get_value(cursor, user, recid, message=None, template=None, context=None):
class email_template(osv.osv):
"Templates for sending Email"
_name = "email.template"
_description = 'Email Templates for Models'
@@ -131,7 +131,7 @@ class email_template(osv.osv):
'def_to':fields.char(
'Recipient (To)',
size=250,
help="The Recipient of email. "
help="The Recipient of email. "
"Placeholders can be used here. "
"e.g. ${object.email_to}"),
'def_cc':fields.char(
@@ -146,20 +146,20 @@ class email_template(osv.osv):
help="Blind Carbon Copy address(es), comma-separated."
" Placeholders can be used here. "
"e.g. ${object.email_bcc}"),
'reply_to':fields.char('Reply-To',
size=250,
'reply_to':fields.char('Reply-To',
size=250,
help="The address recipients should reply to,"
" if different from the From address."
" Placeholders can be used here. "
"e.g. ${object.email_reply_to}"),
'message_id':fields.char('Message-ID',
size=250,
'message_id':fields.char('Message-ID',
size=250,
help="Specify the Message-ID SMTP header to use in outgoing emails. Please note that this overrides the Resource tracking option! Placeholders can be used here."),
'track_campaign_item':fields.boolean('Resource Tracking',
help="Enable this is you wish to include a special \
tracking marker in outgoing emails so you can identify replies and link \
them back to the corresponding resource record. \
This is useful for CRM leads for example"),
This is useful for CRM leads for example"),
'lang':fields.char(
'Language',
size=250,
@@ -182,7 +182,7 @@ This is useful for CRM leads for example"),
translate=True),
'use_sign':fields.boolean(
'Signature',
help="the signature from the User details"
help="the signature from the User details"
" will be appended to the mail"),
'file_name':fields.char(
'Report Filename',
@@ -199,16 +199,16 @@ This is useful for CRM leads for example"),
'attachment_id',
'Attached Files',
help="You may attach existing files to this template, "
"so they will be added in all emails created from this template"),
"so they will be added in all emails created from this template"),
'ref_ir_act_window':fields.many2one(
'ir.actions.act_window',
'Window Action',
help="Action that will open this email template on Resource records",
help="Action that will open this email template on Resource records",
readonly=True),
'ref_ir_value':fields.many2one(
'ir.values',
'Wizard Button',
help="Button in the side bar of the form view of this Resource that will invoke the Window Action",
help="Button in the side bar of the form view of this Resource that will invoke the Window Action",
readonly=True),
'allowed_groups':fields.many2many(
'res.groups',
@@ -265,9 +265,9 @@ This is useful for CRM leads for example"),
'template_language' : lambda *a:'mako',
}
_sql_constraints = [
('name', 'unique (name)', _('The template name must be unique !'))
('name', 'unique (name)',('The template name must be unique !'))
]
def create_action(self, cr, uid, ids, context):
@@ -312,11 +312,11 @@ This is useful for CRM leads for example"),
def delete_action(self, cr, uid, ids, context):
self.unlink_action(cr, uid, ids, context)
return True
def unlink(self, cr, uid, ids, context=None):
self.unlink_action(cr, uid, ids, context)
return super(email_template, self).unlink(cr, uid, ids, context)
def copy(self, cr, uid, id, default=None, context=None):
if default is None:
default = {}
@@ -328,7 +328,7 @@ This is useful for CRM leads for example"),
new_name = new_name + '_' + random.choice('abcdefghij') + random.choice('lmnopqrs') + random.choice('tuvwzyz')
default.update({'name':new_name})
return super(email_template, self).copy(cr, uid, id, default, context)
def build_expression(self, field_name, sub_field_name, null_value, template_language='mako'):
"""
Returns a template expression based on data provided
@@ -354,10 +354,10 @@ This is useful for CRM leads for example"),
if sub_field_name:
expression += "." + sub_field_name
if null_value:
expression += "|default: '''%s'''" % null_value
expression += "|default: '''%s'''" % null_value
expression += "}}"
return expression
return expression
def onchange_model_object_field(self, cr, uid, ids, model_object_field, template_language, context=None):
if not model_object_field:
return {}
@@ -385,7 +385,7 @@ This is useful for CRM leads for example"),
result['sub_model_object_field'] = False
result['null_value'] = False
return {'value':result}
def onchange_sub_model_object_field(self, cr, uid, ids, model_object_field, sub_model_object_field, template_language, context=None):
if not model_object_field or not sub_model_object_field:
return {}
@@ -447,7 +447,7 @@ This is useful for CRM leads for example"),
def _add_attachment(self, cursor, user, mailbox_id, name, data, filename, context=None):
"""
Add an attachment to a given mailbox entry.
:param data: base64 encoded attachment data to store
"""
attachment_obj = self.pool.get('ir.attachment')
@@ -484,7 +484,7 @@ This is useful for CRM leads for example"),
"""
Generate report to be attached and attach it
to the email, and add any directly attached files as well.
@param cursor: Database Cursor
@param user: ID of User
@param template: Browse record of
@@ -492,8 +492,8 @@ This is useful for CRM leads for example"),
@param record_id: ID of the target model
for which this mail has
to be generated
@param mail: Browse record of email object
@return: True
@param mail: Browse record of email object
@return: True
"""
if template.report_template:
reportname = 'report.' + \
@@ -510,7 +510,7 @@ This is useful for CRM leads for example"),
user,
[record_id],
data,
context)
context)
fname = tools.ustr(get_value(cursor, user, record_id,
template.file_name, template, context)
or 'Report')
@@ -524,7 +524,7 @@ This is useful for CRM leads for example"),
self._add_attachment(cursor, user, mail.id, attachment.name, attachment.datas, attachment.datas_fname, context)
return True
def _generate_mailbox_item_from_template(self,
cursor,
user,
@@ -534,7 +534,7 @@ This is useful for CRM leads for example"),
"""
Generates an email from the template for
record record_id of target object
@param cursor: Database Cursor
@param user: ID of User
@param template: Browse record of
@@ -542,7 +542,7 @@ This is useful for CRM leads for example"),
@param record_id: ID of the target model
for which this mail has
to be generated
@return: ID of created object
@return: ID of created object
"""
if context is None:
context = {}
@@ -571,9 +571,9 @@ This is useful for CRM leads for example"),
ctx = context.copy()
ctx.update({'lang':lang})
template = self.browse(cursor, user, template.id, context=ctx)
# determine name of sender, either it is specified in email_id or we
# use the account name
# determine name of sender, either it is specified in email_id or we
# use the account name
email_id = from_account['email_id'].strip()
email_from = re.findall(r'([^ ,<@]+@[^> ,]+)', email_id)[0]
if email_from != email_id:
@@ -663,7 +663,7 @@ This is useful for CRM leads for example"),
context)
return mailbox_id
def generate_mail(self,
cursor,
@@ -721,7 +721,7 @@ email_template()
class email_template_preview(osv.osv_memory):
_name = "email_template.preview"
_description = "Email Template Preview"
def _get_model_recs(self, cr, uid, context=None):
if context is None:
context = {}
@@ -766,7 +766,7 @@ class email_template_preview(osv.osv_memory):
context['template_id'],
['object_name'],
context)['object_name'] or False
_columns = {
'ref_template':fields.many2one(
'email.template',
@@ -776,13 +776,13 @@ class email_template_preview(osv.osv_memory):
'to':fields.char('To', size=250, readonly=True),
'cc':fields.char('CC', size=250, readonly=True),
'bcc':fields.char('BCC', size=250, readonly=True),
'reply_to':fields.char('Reply-To',
size=250,
'reply_to':fields.char('Reply-To',
size=250,
help="The address recipients should reply to,"
" if different from the From address."
" Placeholders can be used here."),
'message_id':fields.char('Message-ID',
size=250,
'message_id':fields.char('Message-ID',
size=250,
help="The Message-ID header value, if you need to"
"specify it, for example to automatically recognize the replies later."
" Placeholders can be used here."),
@@ -823,7 +823,7 @@ class email_template_preview(osv.osv_memory):
vals['body_html'] = get_value(cr, uid, rel_model_ref, template.def_body_html, template, context)
vals['report'] = get_value(cr, uid, rel_model_ref, template.file_name, template, context)
return {'value':vals}
email_template_preview()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -257,7 +257,7 @@ class marketing_campaign_segment(osv.osv):
return True
_constraints = [
(_check_model, _('Model of filter must be same as resource model of Campaign '), ['ir_filter_id,campaign_id']),
(_check_model,('Model of filter must be same as resource model of Campaign '), ['ir_filter_id,campaign_id']),
]
def onchange_campaign_id(self, cr, uid, ids, campaign_id):
@@ -309,7 +309,7 @@ class marketing_campaign_segment(osv.osv):
for segment in self.browse(cr, uid, segment_ids, context=context):
if segment.campaign_id.state != 'running':
continue
campaigns.add(segment.campaign_id.id)
act_ids = self.pool.get('marketing.campaign.activity').search(cr,
uid, [('start', '=', True), ('campaign_id', '=', segment.campaign_id.id)], context=context)
@@ -377,7 +377,7 @@ class marketing_campaign_activity(osv.osv):
help="Python expression to decide whether the activity can be executed, otherwise it will be deleted or cancelled."
"The expression may use the following [browsable] variables:\n"
" - activity: the campaign activity\n"
" - workitem: the campaign workitem\n"
" - workitem: the campaign workitem\n"
" - resource: the resource object this campaign item represents\n"
" - transitions: list of campaign transitions outgoing from this activity\n"
"...- re: Python regular expression module"),
@@ -539,9 +539,9 @@ class marketing_campaign_transition(osv.osv):
return True
_constraints = [
(_check_campaign, _('The To/From Activity of transition must be of the same Campaign '), ['activity_from_id,activity_to_id']),
(_check_campaign,('The To/From Activity of transition must be of the same Campaign '), ['activity_from_id,activity_to_id']),
]
_sql_constraints = [
('interval_positive', 'CHECK(interval_nbr >= 0)', 'The interval must be positive or zero')
]
@@ -638,7 +638,7 @@ class marketing_campaign_workitem(osv.osv):
'activity': activity,
'workitem': workitem,
'object': object_id,
'resource': object_id,
'resource': object_id,
'transitions': activity.to_ids,
're': re,
}
+9 -9
View File
@@ -129,9 +129,9 @@ class product_pricelist(osv.osv):
#def price_get_multi(self, cr, uid, product_ids, context=None):
def price_get_multi(self, cr, uid, pricelist_ids, products_by_qty_by_partner, context=None):
"""multi products 'price_get'.
@param pricelist_ids:
@param products_by_qty:
@param partner:
@param pricelist_ids:
@param products_by_qty:
@param partner:
@param context: {
'date': Date of the pricelist (%Y-%m-%d),}
@return: a dict of dict with product_id as key and a dict 'price by pricelist' as value
@@ -371,7 +371,7 @@ class product_pricelist(osv.osv):
'ORDER BY sequence',
(tmpl_id, prod_id, plversion['id'], qty))
res1 = cr.dictfetchall()
for res in res1:
item_id = 0
if res:
@@ -386,7 +386,7 @@ class product_pricelist(osv.osv):
res['base_pricelist_id']).currency_id.id
price = currency_obj.compute(cr, uid, ptype_src,
res['currency_id'], price_tmp, round=False)
break
break
elif res['base'] == -2:
where = []
if partner:
@@ -413,7 +413,7 @@ class product_pricelist(osv.osv):
if price:
price_limit = price
price = price * (1.0+(res['price_discount'] or 0.0))
price = rounding(price, res['price_round'])
price += (res['price_surcharge'] or 0.0)
@@ -422,14 +422,14 @@ class product_pricelist(osv.osv):
if res['price_max_margin']:
price = min(price, price_limit+res['price_max_margin'])
item_id = res['id']
break
break
else:
# False means no valid line found ! But we may not raise an
# exception here because it breaks the search
price = False
result[id] = price
result['item_id'] = {id: item_id}
result['item_id'] = {id: item_id}
if context and ('uom' in context):
product = product_obj.browse(cr, uid, prod_id)
uom = product.uos_id or product.uom_id
@@ -559,7 +559,7 @@ class product_pricelist_item(osv.osv):
}
_constraints = [
(_check_recursion, _('Error ! You cannot assign the Main Pricelist as Other Pricelist in PriceList Item!'), ['base_pricelist_id'])
(_check_recursion,('Error ! You cannot assign the Main Pricelist as Other Pricelist in PriceList Item!'), ['base_pricelist_id'])
]
def product_id_change(self, cr, uid, ids, product_id, context={}):
+2 -2
View File
@@ -86,7 +86,7 @@ class project(osv.osv):
cr.execute('''SELECT
project_id, sum(planned_hours), sum(total_hours), sum(effective_hours), SUM(remaining_hours)
FROM
project_task
project_task
WHERE
project_id in %s AND
state<>'cancelled'
@@ -475,7 +475,7 @@ class task(osv.osv):
return True
_constraints = [
(_check_recursion, _('Error ! You cannot create recursive tasks.'), ['parent_ids'])
(_check_recursion,('Error ! You cannot create recursive tasks.'), ['parent_ids'])
]
#
# Override view according to the company definition
+23 -23
View File
@@ -24,13 +24,13 @@
picking_policy: direct
pricelist_id: product.list0
shop_id: sale.shop
-
-
I confirm the Sale Order.
-
-
!workflow {model: sale.order, action: order_confirm, ref: sale_order_so0}
-
I click on Create Invoice button to create the invoice.
-
-
!workflow {model: sale.order, action: manual_invoice, ref: sale_order_so0}
-
@@ -38,7 +38,7 @@
-
!python {model: sale.order}: |
so = self.browse(cr, uid, ref("sale_order_so0"))
assert so.invoice_ids, "Invoices has not been generated for sale_order_so0"
assert so.invoice_ids, "Invoices has not been generated for sale_order_so0"
-
I open the Invoice for the SO.
-
@@ -69,7 +69,7 @@
assert inv_brw.move_id, "Journal Entries has not been created"
-
Assign analytic journal into bank journal
-
-
!record {model: account.journal, id: sale.account_journal_bankjournal0}:
analytic_journal_id: account.cose_journal_sale
-
@@ -85,7 +85,7 @@
ref('account.period_8'), ref('sale.account_journal_bankjournal0'),
name='test')
-
I verify the invoice is in done state.
I verify the invoice is in done state.
-
!python {model: account.invoice}: |
sale_order_obj = self.pool.get('sale.order')
@@ -98,9 +98,9 @@
!python {model: sale.order}: |
sale_id=self.browse(cr, uid, ref("sale_order_so0"))
assert(sale_id.invoiced == True), "Paid has not been set to true"
-
-
I verify that the picking has been generated for the sale order
-
-
!python {model: sale.order}: |
so = self.browse(cr, uid, ref("sale_order_so0"))
assert so.picking_ids,"Picking has not been generated for sale_order_so0"
@@ -111,7 +111,7 @@
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so0"))
picking_id = self.search(cr, uid, [('origin','=',so.name)])
assert (picking_id),"Delivery order has not been generated"
assert(picking_id),"Delivery order has not been generated"
-
I verify that a procurement has been generated for so
-
@@ -120,7 +120,7 @@
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so0"))
proc_ids = self.search(cr, uid, [('origin','=',so.name)])
assert proc_ids, _('No Procurements!')
assert(proc_ids),"No Procurements!"
-
Then I click on the "Run Procurement" button
-
@@ -144,7 +144,7 @@
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so0"))
proc_ids = self.search(cr, uid, [('origin','=',so.name),('state','=','running')])
assert proc_ids, _('Procurement is not in the running state!')
assert(proc_ids),"Procurement is not in the running state!"
-
I verify that a purchase order has been generated
-
@@ -157,8 +157,8 @@
so = self.browse(cr, uid, ref("sale_order_so0"))
pur_obj=self.pool.get('purchase.order')
pur_id=pur_obj.search(cr, uid, [('origin','=',so.name)])
assert pur_id, _('Purchase order has not been generated')
assert(pur_id),"Purchase order has not been generated"
-
I click on the "Confirm" button to confirm the purchase order
-
@@ -175,7 +175,7 @@
pur_ids = pur_obj.search(cr, uid, [('origin','=',so.name)])
for pur in pur_ids:
wf_service.trg_validate(uid, 'purchase.order',pur,'purchase_confirm', cr)
-
-
I click on the "Approved by supplier" button to approve the purchase order
-
!python {model: sale.order}: |
@@ -192,7 +192,7 @@
for pur in pur_ids:
wf_service.trg_validate(uid, 'purchase.order',pur,'purchase_approve', cr)
-
I verify that a picking related to purchase order has been generated.
I verify that a picking related to purchase order has been generated.
-
!python {model: sale.order}: |
modules = self.pool.get('ir.module.module')
@@ -204,7 +204,7 @@
pur_id = pur_obj.search(cr, uid, [('origin','=',so.name)])
po = pur_obj.browse(cr, uid, pur_id)[0]
assert(po.picking_ids),"Picking for purchase order has not been generated"
-
-
Then I click on the "Products Received" button of Incoming Shipments
-
!record {model: stock.partial.picking, id: stock_partial_picking_0}:
@@ -242,10 +242,10 @@
po = pur_obj.browse(cr, uid, pur_id)[0]
picking_obj = self.pool.get('stock.picking')
ids = picking_obj.search(cr, uid, [('purchase_id', '=', po.id ),('state', '=', 'done')])
assert ids, _('Picking is not in the done state!')
assert(ids),"Picking is not in the done state!"
-
Then I done the picking
-
-
!python {model: stock.picking }: |
import time
sale_order_obj = self.pool.get('sale.order')
@@ -264,7 +264,7 @@
'product_id': move.product_id.id,
'product_qty': move.product_qty,
'product_uom': move.product_uom.id,
}
}
self.do_partial(cr, uid, [pick.id],partial_datas)
-
I verify that picking for sale order is in done state.
@@ -274,7 +274,7 @@
so = sale_order_obj.browse(cr, uid, ref("sale_order_so0"))
picking_id = self.search(cr, uid, [('origin','=',so.name),('type','=','out')])
pick = self.browse(cr,uid,picking_id[0])
assert (pick.state) =='done', "Picking for SO is not in done state."
assert (pick.state) =='done', "Picking for SO is not in done state."
-
Then I done the delivery order
-
@@ -296,8 +296,8 @@
'product_id': move.product_id.id,
'product_qty': move.product_qty,
'product_uom': move.product_uom.id,
}
self.do_partial(cr, uid, [pick.id],partial_datas)
}
self.do_partial(cr, uid, [pick.id],partial_datas)
-
I verify that delivery state is done
-
@@ -308,7 +308,7 @@
pick = self.browse(cr,uid,picking_id[0])
assert (pick.state) =='done', "Picking for SO is not in done state."
-
I verify that a "Picked" has been set to true
I verify that a "Picked" has been set to true
-
!python {model: sale.order}: |
so = self.browse(cr, uid, ref("sale_order_so0"))
+1 -1
View File
@@ -1368,7 +1368,7 @@ class stock_production_lot(osv.osv):
'product_id': lambda x, y, z, c: c.get('product_id', False),
}
_sql_constraints = [
('name_ref_uniq', 'unique (name, ref)', _('The combination of serial number and internal reference must be unique !')),
('name_ref_uniq', 'unique (name, ref)',('The combination of serial number and internal reference must be unique !')),
]
def action_traceability(self, cr, uid, ids, context={}):
""" It traces the information of a product