bugged
stringlengths
4
228k
fixed
stringlengths
0
96.3M
__index_level_0__
int64
0
481k
args['account_id'] = order.partner_id and order.partner_id.property_account_receivable and order.partner_id.property_account_receivable.id or account_def or curr_c.account_receivable.id
args['account_id'] = order.partner_id and order.partner_id.property_account_receivable and order.partner_id.property_account_receivable.id or account_def or curr_c.account_receivable.id
469,500
def reconcile(self, cr, uid, ids, context=None): move_line_obj = self.pool.get('account.move.line') obj_model = self.pool.get('ir.model.data') if context is None: context = {} form = self.read(cr, uid, ids, [])[0] max_amount = form.get('max_amount', False) and form.get('max_amount') or 0.0 power = form['power'] allow_write_off = form['allow_write_off'] reconciled = unreconciled = 0 if not form['account_ids']: raise osv.except_osv(_('UserError'), _('You must select accounts to reconcile')) for account_id in form['account_ids']: params = (account_id,) if not allow_write_off: query = """SELECT partner_id FROM account_move_line WHERE account_id=%s AND reconcile_id IS NULL AND state <> 'draft' GROUP BY partner_id HAVING ABS(SUM(debit-credit)) = 0.0 AND count(*)>0""" else: query = """SELECT partner_id FROM account_move_line WHERE account_id=%s AND reconcile_id IS NULL AND state <> 'draft' GROUP BY partner_id HAVING ABS(SUM(debit-credit)) < %s AND count(*)>0""" params += max_amount # reconcile automatically all transactions from partners whose balance is 0 cr.execute(query, params) partner_ids = [id for (id,) in cr.fetchall()] for partner_id in partner_ids: cr.execute( "SELECT id " \ "FROM account_move_line " \ "WHERE account_id=%s " \ "AND partner_id=%s " \ "AND state <> 'draft' " \ "AND reconcile_id IS NULL", (account_id, partner_id)) line_ids = [id for (id,) in cr.fetchall()] if len(line_ids): reconciled += len(line_ids) if allow_write_off: move_line_obj.reconcile(cr, uid, line_ids, 'auto', form['writeoff_acc_id'], form['period_id'], form['journal_id'], context) else: move_line_obj.reconcile_partial(cr, uid, line_ids, 'manual', context={})
def reconcile(self, cr, uid, ids, context=None): move_line_obj = self.pool.get('account.move.line') obj_model = self.pool.get('ir.model.data') if context is None: context = {} form = self.read(cr, uid, ids, [])[0] max_amount = form.get('max_amount', False) and form.get('max_amount') or 0.0 power = form['power'] allow_write_off = form['allow_write_off'] reconciled = unreconciled = 0 if not form['account_ids']: raise osv.except_osv(_('UserError'), _('You must select accounts to reconcile')) for account_id in form['account_ids']: params = (account_id,) if not allow_write_off: query = """SELECT partner_id FROM account_move_line WHERE account_id=%s AND reconcile_id IS NULL AND state <> 'draft' GROUP BY partner_id HAVING ABS(SUM(debit-credit)) = 0.0 AND count(*)>0""" else: query = """SELECT partner_id FROM account_move_line WHERE account_id=%s AND reconcile_id IS NULL AND state <> 'draft' GROUP BY partner_id HAVING ABS(SUM(debit-credit)) < %s AND count(*)>0""" params += (max_amount,) # reconcile automatically all transactions from partners whose balance is 0 cr.execute(query, params) partner_ids = [id for (id,) in cr.fetchall()] for partner_id in partner_ids: cr.execute( "SELECT id " \ "FROM account_move_line " \ "WHERE account_id=%s " \ "AND partner_id=%s " \ "AND state <> 'draft' " \ "AND reconcile_id IS NULL", (account_id, partner_id)) line_ids = [id for (id,) in cr.fetchall()] if len(line_ids): reconciled += len(line_ids) if allow_write_off: move_line_obj.reconcile(cr, uid, line_ids, 'auto', form['writeoff_acc_id'], form['period_id'], form['journal_id'], context) else: move_line_obj.reconcile_partial(cr, uid, line_ids, 'manual', context={})
469,501
def check_import(self, cr, uid, vals, context={}): """ @param self: The object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param vals: Get Values @param context: A standard dictionary for contextual values """ ids = [] model_obj = self.pool.get(context.get('model')) recur_pool = {} try: for val in vals: exists, r_id = caldav.uid2openobjectid(cr, val['id'], context.get('model'), \ val.get('recurrent_id')) if val.has_key('create_date'): val.pop('create_date') u_id = val.get('id', None) val.pop('id') if exists and r_id: val.update({'recurrent_uid': exists}) model_obj.write(cr, uid, [r_id], val) ids.append(r_id) elif exists: # Compute value of duration if 'date_deadline' in val and 'duration' not in val: start = datetime.strptime(val['date'], '%Y-%m-%d %H:%M:%S') end = datetime.strptime(val['date_deadline'], '%Y-%m-%d %H:%M:%S') diff = end - start val['duration'] = (diff.seconds/float(86400) + diff.days) * 24 model_obj.write(cr, uid, [exists], val) ids.append(exists) else: if u_id in recur_pool and val.get('recurrent_id'): val.update({'recurrent_uid': recur_pool[u_id]}) revent_id = model_obj.create(cr, uid, val) ids.append(revent_id) else: event_id = model_obj.create(cr, uid, val) recur_pool[u_id] = event_id ids.append(event_id) except Exception, e: raise osv.except_osv(('Error !'), (str(e))) return ids
def check_import(self, cr, uid, vals, context={}): """ @param self: The object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param vals: Get Values @param context: A standard dictionary for contextual values """ ids = [] model_obj = self.pool.get(context.get('model')) recur_pool = {} try: for val in vals: exists, r_id = calendar.uid2openobjectid(cr, val['id'], context.get('model'), \ val.get('recurrent_id')) if val.has_key('create_date'): val.pop('create_date') u_id = val.get('id', None) val.pop('id') if exists and r_id: val.update({'recurrent_uid': exists}) model_obj.write(cr, uid, [r_id], val) ids.append(r_id) elif exists: # Compute value of duration if 'date_deadline' in val and 'duration' not in val: start = datetime.strptime(val['date'], '%Y-%m-%d %H:%M:%S') end = datetime.strptime(val['date_deadline'], '%Y-%m-%d %H:%M:%S') diff = end - start val['duration'] = (diff.seconds/float(86400) + diff.days) * 24 model_obj.write(cr, uid, [exists], val) ids.append(exists) else: if u_id in recur_pool and val.get('recurrent_id'): val.update({'recurrent_uid': recur_pool[u_id]}) revent_id = model_obj.create(cr, uid, val) ids.append(revent_id) else: event_id = model_obj.create(cr, uid, val) recur_pool[u_id] = event_id ids.append(event_id) except Exception, e: raise osv.except_osv(('Error !'), (str(e))) return ids
469,502
def email_send(self, cr, uid, obj, emails, body, emailfrom=tools.config.get('email_from', False), context={}): """ send email @param self: The object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param email: pass the emails @param emailfrom: Pass name the email From else False @param context: A standard dictionary for contextual values """ body = self.format_mail(obj, body) if not emailfrom: if hasattr(obj, 'user_id') and obj.user_id and obj.user_id.address_id and\ obj.user_id.address_id.email: emailfrom = obj.user_id.address_id.email
def email_send(self, cr, uid, obj, emails, body, emailfrom=None, context=None): """ send email @param self: The object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param email: pass the emails @param emailfrom: Pass name the email From else False @param context: A standard dictionary for contextual values """ body = self.format_mail(obj, body) if not emailfrom: if hasattr(obj, 'user_id') and obj.user_id and obj.user_id.address_id and\ obj.user_id.address_id.email: emailfrom = obj.user_id.address_id.email
469,503
def do_action(self, cr, uid, action, model_obj, obj, context={}): """ Do Action @param self: The object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param action: pass action @param model_obj: pass Model object @param context: A standard dictionary for contextual values """
def do_action(self, cr, uid, action, model_obj, obj, context={}): """ Do Action @param self: The object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param action: pass action @param model_obj: pass Model object @param context: A standard dictionary for contextual values """
469,504
def __view_look_dom(self, cr, user, node, view_id, context=None): if not context: context = {} result = False fields = {} childs = True
def __view_look_dom(self, cr, user, node, view_id, context=None): if not context: context = {} result = False fields = {} childs = True
469,505
def _history(self, cr, uid, cases, keyword, history=False, subject=None, email=False, details=None, \ email_from=False, message_id=False, references=None, attach=None, context=None): """ @param self: The object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param cases: a browse record list @param keyword: Case action keyword e.g.: If case is closed "Close" keyword is used @param history: Value True/False, If True it makes entry in case History otherwise in Case Log @param email: Email address if any @param details: Details of case history if any @param atach: Attachment sent in email @param context: A standard dictionary for contextual values""" if context is None: context = {} if attach is None: attach = []
def _history(self, cr, uid, cases, keyword, history=False, subject=None, email=False, details=None, \ email_from=False, message_id=False, references=None, attach=None, context=None): """ @param self: The object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param cases: a browse record list @param keyword: Case action keyword e.g.: If case is closed "Close" keyword is used @param history: Value True/False, If True it makes entry in case History otherwise in Case Log @param email: Email address if any @param details: Details of case history if any @param atach: Attachment sent in email @param context: A standard dictionary for contextual values""" if context is None: context = {} if attach is None: attach = []
469,506
def _history(self, cr, uid, cases, keyword, history=False, subject=None, email=False, details=None, \ email_from=False, message_id=False, references=None, attach=None, context=None): """ @param self: The object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param cases: a browse record list @param keyword: Case action keyword e.g.: If case is closed "Close" keyword is used @param history: Value True/False, If True it makes entry in case History otherwise in Case Log @param email: Email address if any @param details: Details of case history if any @param atach: Attachment sent in email @param context: A standard dictionary for contextual values""" if context is None: context = {} if attach is None: attach = []
def _history(self, cr, uid, cases, keyword, history=False, subject=None, email=False, details=None, \ email_from=False, message_id=False, references=None, attach=None, context=None): """ @param self: The object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param cases: a browse record list @param keyword: Case action keyword e.g.: If case is closed "Close" keyword is used @param history: Value True/False, If True it makes entry in case History otherwise in Case Log @param email: Email address if any @param details: Details of case history if any @param atach: Attachment sent in email @param context: A standard dictionary for contextual values""" if context is None: context = {} if attach is None: attach = []
469,507
def _history(self, cr, uid, cases, keyword, history=False, subject=None, email=False, details=None, \ email_from=False, message_id=False, references=None, attach=None, context=None): """ @param self: The object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param cases: a browse record list @param keyword: Case action keyword e.g.: If case is closed "Close" keyword is used @param history: Value True/False, If True it makes entry in case History otherwise in Case Log @param email: Email address if any @param details: Details of case history if any @param atach: Attachment sent in email @param context: A standard dictionary for contextual values""" if context is None: context = {} if attach is None: attach = []
def _history(self, cr, uid, cases, keyword, history=False, subject=None, email=False, details=None, \ email_from=False, message_id=False, references=None, attach=None, context=None): """ @param self: The object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param cases: a browse record list @param keyword: Case action keyword e.g.: If case is closed "Close" keyword is used @param history: Value True/False, If True it makes entry in case History otherwise in Case Log @param email: Email address if any @param details: Details of case history if any @param atach: Attachment sent in email @param context: A standard dictionary for contextual values""" if context is None: context = {} if attach is None: attach = []
469,508
def _history(self, cr, uid, cases, keyword, history=False, subject=None, email=False, details=None, \ email_from=False, message_id=False, references=None, attach=None, context=None): """ @param self: The object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param cases: a browse record list @param keyword: Case action keyword e.g.: If case is closed "Close" keyword is used @param history: Value True/False, If True it makes entry in case History otherwise in Case Log @param email: Email address if any @param details: Details of case history if any @param atach: Attachment sent in email @param context: A standard dictionary for contextual values""" if context is None: context = {} if attach is None: attach = []
def _history(self, cr, uid, cases, keyword, history=False, subject=None, email=False, details=None, \ email_from=False, message_id=False, references=None, attach=None, context=None): """ @param self: The object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param cases: a browse record list @param keyword: Case action keyword e.g.: If case is closed "Close" keyword is used @param history: Value True/False, If True it makes entry in case History otherwise in Case Log @param email: Email address if any @param details: Details of case history if any @param atach: Attachment sent in email @param context: A standard dictionary for contextual values""" if context is None: context = {} if attach is None: attach = []
469,509
def _history(self, cr, uid, cases, keyword, history=False, subject=None, email=False, details=None, \ email_from=False, message_id=False, references=None, attach=None, context=None): """ @param self: The object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param cases: a browse record list @param keyword: Case action keyword e.g.: If case is closed "Close" keyword is used @param history: Value True/False, If True it makes entry in case History otherwise in Case Log @param email: Email address if any @param details: Details of case history if any @param atach: Attachment sent in email @param context: A standard dictionary for contextual values""" if context is None: context = {} if attach is None: attach = []
def _history(self, cr, uid, cases, keyword, history=False, subject=None, email=False, details=None, \ email_from=False, message_id=False, references=None, attach=None, context=None): """ @param self: The object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param cases: a browse record list @param keyword: Case action keyword e.g.: If case is closed "Close" keyword is used @param history: Value True/False, If True it makes entry in case History otherwise in Case Log @param email: Email address if any @param details: Details of case history if any @param atach: Attachment sent in email @param context: A standard dictionary for contextual values""" if context is None: context = {} if attach is None: attach = []
469,510
def history(self, cr, uid, model, res_ids, msg, attach, context=None): """This function creates history for mails fetched @param self: The object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param model: OpenObject Model @param res_ids: Ids of the record of OpenObject model created @param msg: Email details @param attach: Email attachments """ if isinstance(res_ids, (int, long)): res_ids = [res_ids]
def history(self, cr, uid, model, res_ids, msg, attach, context=None): """This function creates history for mails fetched @param self: The object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param model: OpenObject Model @param res_ids: Ids of the record of OpenObject model created @param msg: Email details @param attach: Email attachments """ if isinstance(res_ids, (int, long)): res_ids = [res_ids]
469,511
def create_record(msg): if hasattr(model_pool, 'message_new'): res_id = model_pool.message_new(cr, uid, msg, context) else: data = { 'name': msg.get('subject'), 'email_from': msg.get('from'), 'email_cc': msg.get('cc'), 'user_id': False, 'description': msg.get('body'), 'state' : 'draft', } data.update(self.get_partner(cr, uid, msg.get('from'), context=context)) res_id = model_pool.create(cr, uid, data, context=context)
def create_record(msg): if hasattr(model_pool, 'message_new'): res_id = model_pool.message_new(cr, uid, msg, context) else: data = { 'name': msg.get('subject'), 'email_from': msg.get('from'), 'email_cc': msg.get('cc'), 'user_id': False, 'description': msg.get('body'), 'state' : 'draft', } data.update(self.get_partner(cr, uid, msg.get('from'), context=context)) res_id = model_pool.create(cr, uid, data, context=context)
469,512
def create_record(msg): if hasattr(model_pool, 'message_new'): res_id = model_pool.message_new(cr, uid, msg, context) else: data = { 'name': msg.get('subject'), 'email_from': msg.get('from'), 'email_cc': msg.get('cc'), 'user_id': False, 'description': msg.get('body'), 'state' : 'draft', } data.update(self.get_partner(cr, uid, msg.get('from'), context=context)) res_id = model_pool.create(cr, uid, data, context=context)
def create_record(msg): if hasattr(model_pool, 'message_new'): res_id = model_pool.message_new(cr, uid, msg, context) else: data = { 'name': msg.get('subject'), 'email_from': msg.get('from'), 'email_cc': msg.get('cc'), 'user_id': False, 'description': msg.get('body'), 'state' : 'draft', } data.update(self.get_partner(cr, uid, msg.get('from'), context=context)) res_id = model_pool.create(cr, uid, data, context=context)
469,513
def create_record(msg): if hasattr(model_pool, 'message_new'): res_id = model_pool.message_new(cr, uid, msg, context) else: data = { 'name': msg.get('subject'), 'email_from': msg.get('from'), 'email_cc': msg.get('cc'), 'user_id': False, 'description': msg.get('body'), 'state' : 'draft', } data.update(self.get_partner(cr, uid, msg.get('from'), context=context)) res_id = model_pool.create(cr, uid, data, context=context)
def create_record(msg): if hasattr(model_pool, 'message_new'): res_id = model_pool.message_new(cr, uid, msg, context) else: data = { 'name': msg.get('subject'), 'email_from': msg.get('from'), 'email_cc': msg.get('cc'), 'user_id': False, 'description': msg.get('body'), 'state' : 'draft', } data.update(self.get_partner(cr, uid, msg.get('from'), context=context)) res_id = model_pool.create(cr, uid, data, context=context)
469,514
def create_record(msg): if hasattr(model_pool, 'message_new'): res_id = model_pool.message_new(cr, uid, msg, context) else: data = { 'name': msg.get('subject'), 'email_from': msg.get('from'), 'email_cc': msg.get('cc'), 'user_id': False, 'description': msg.get('body'), 'state' : 'draft', } data.update(self.get_partner(cr, uid, msg.get('from'), context=context)) res_id = model_pool.create(cr, uid, data, context=context)
def create_record(msg): if hasattr(model_pool, 'message_new'): res_id = model_pool.message_new(cr, uid, msg, context) else: data = { 'name': msg.get('subject'), 'email_from': msg.get('from'), 'email_cc': msg.get('cc'), 'user_id': False, 'description': msg.get('body'), 'state' : 'draft', } data.update(self.get_partner(cr, uid, msg.get('from'), context=context)) res_id = model_pool.create(cr, uid, data, context=context)
469,515
def create_record(msg): if hasattr(model_pool, 'message_new'): res_id = model_pool.message_new(cr, uid, msg, context) else: data = { 'name': msg.get('subject'), 'email_from': msg.get('from'), 'email_cc': msg.get('cc'), 'user_id': False, 'description': msg.get('body'), 'state' : 'draft', } data.update(self.get_partner(cr, uid, msg.get('from'), context=context)) res_id = model_pool.create(cr, uid, data, context=context)
def create_record(msg): if hasattr(model_pool, 'message_new'): res_id = model_pool.message_new(cr, uid, msg, context) else: data = { 'name': msg.get('subject'), 'email_from': msg.get('from'), 'email_cc': msg.get('cc'), 'user_id': False, 'description': msg.get('body'), 'state' : 'draft', } data.update(self.get_partner(cr, uid, msg.get('from'), context=context)) res_id = model_pool.create(cr, uid, data, context=context)
469,516
def create_record(msg): if hasattr(model_pool, 'message_new'): res_id = model_pool.message_new(cr, uid, msg, context) else: data = { 'name': msg.get('subject'), 'email_from': msg.get('from'), 'email_cc': msg.get('cc'), 'user_id': False, 'description': msg.get('body'), 'state' : 'draft', } data.update(self.get_partner(cr, uid, msg.get('from'), context=context)) res_id = model_pool.create(cr, uid, data, context=context)
def create_record(msg): if hasattr(model_pool, 'message_new'): res_id = model_pool.message_new(cr, uid, msg, context) else: data = { 'name': msg.get('subject'), 'email_from': msg.get('from'), 'email_cc': msg.get('cc'), 'user_id': False, 'description': msg.get('body'), 'state' : 'draft', } data.update(self.get_partner(cr, uid, msg.get('from'), context=context)) res_id = model_pool.create(cr, uid, data, context=context)
469,517
def _child_compute(self, cr, uid, ids, name, arg, context={}): """ Gets child bom. @param self: The object pointer @param cr: The current row, from the database cursor, @param uid: The current user ID for security checks @param ids: List of selected IDs @param name: Name of the field @param arg: User defined argument @param context: A standard dictionary for contextual values @return: Dictionary of values """ result = {} bom_obj = self.pool.get('mrp.bom') bom_parent = bom_obj.browse(cr, uid, context['active_id']) for bom in self.browse(cr, uid, ids, context=context): if bom_parent.multi_level_bom or bom.id == context['active_id']: result[bom.id] = map(lambda x: x.id, bom.bom_lines) else: result[bom.id] = [] if bom.bom_lines: continue ok = ((name=='child_complete_ids') and (bom.product_id.supply_method=='produce')) if (bom.type=='phantom' or ok) and bom_parent.multi_level_bom: sids = bom_obj.search(cr, uid, [('bom_id','=',False),('product_id','=',bom.product_id.id)]) if sids: bom2 = bom_obj.browse(cr, uid, sids[0], context=context) result[bom.id] += map(lambda x: x.id, bom2.bom_lines)
def _child_compute(self, cr, uid, ids, name, arg, context={}): """ Gets child bom. @param self: The object pointer @param cr: The current row, from the database cursor, @param uid: The current user ID for security checks @param ids: List of selected IDs @param name: Name of the field @param arg: User defined argument @param context: A standard dictionary for contextual values @return: Dictionary of values """ result = {} bom_obj = self.pool.get('mrp.bom') bom_id = context and context.get('active_id', False) or False cr.execute('select id from mrp_bom') if all(bom_id != r[0] for r in cr.fetchall()): ids.sort() bom_id = ids[0] bom_parent = bom_obj.browse(cr, uid, bom_id) for bom in self.browse(cr, uid, ids, context=context): if bom_parent.multi_level_bom or bom.id == context['active_id']: result[bom.id] = map(lambda x: x.id, bom.bom_lines) else: result[bom.id] = [] if bom.bom_lines: continue ok = ((name=='child_complete_ids') and (bom.product_id.supply_method=='produce')) if (bom.type=='phantom' or ok) and bom_parent.multi_level_bom: sids = bom_obj.search(cr, uid, [('bom_id','=',False),('product_id','=',bom.product_id.id)]) if sids: bom2 = bom_obj.browse(cr, uid, sids[0], context=context) result[bom.id] += map(lambda x: x.id, bom2.bom_lines)
469,518
def _child_compute(self, cr, uid, ids, name, arg, context={}): """ Gets child bom. @param self: The object pointer @param cr: The current row, from the database cursor, @param uid: The current user ID for security checks @param ids: List of selected IDs @param name: Name of the field @param arg: User defined argument @param context: A standard dictionary for contextual values @return: Dictionary of values """ result = {} bom_obj = self.pool.get('mrp.bom') bom_parent = bom_obj.browse(cr, uid, context['active_id']) for bom in self.browse(cr, uid, ids, context=context): if bom_parent.multi_level_bom or bom.id == context['active_id']: result[bom.id] = map(lambda x: x.id, bom.bom_lines) else: result[bom.id] = [] if bom.bom_lines: continue ok = ((name=='child_complete_ids') and (bom.product_id.supply_method=='produce')) if (bom.type=='phantom' or ok) and bom_parent.multi_level_bom: sids = bom_obj.search(cr, uid, [('bom_id','=',False),('product_id','=',bom.product_id.id)]) if sids: bom2 = bom_obj.browse(cr, uid, sids[0], context=context) result[bom.id] += map(lambda x: x.id, bom2.bom_lines)
def _child_compute(self, cr, uid, ids, name, arg, context={}): """ Gets child bom. @param self: The object pointer @param cr: The current row, from the database cursor, @param uid: The current user ID for security checks @param ids: List of selected IDs @param name: Name of the field @param arg: User defined argument @param context: A standard dictionary for contextual values @return: Dictionary of values """ result = {} bom_obj = self.pool.get('mrp.bom') bom_parent = bom_obj.browse(cr, uid, context['active_id']) for bom in self.browse(cr, uid, ids, context=context): if (bom_parent and bom_parent.multi_level_bom) or bom.id == bom_id: result[bom.id] = map(lambda x: x.id, bom.bom_lines) else: result[bom.id] = [] if bom.bom_lines: continue ok = ((name=='child_complete_ids') and (bom.product_id.supply_method=='produce')) if (bom.type=='phantom' or ok) and bom_parent.multi_level_bom: sids = bom_obj.search(cr, uid, [('bom_id','=',False),('product_id','=',bom.product_id.id)]) if sids: bom2 = bom_obj.browse(cr, uid, sids[0], context=context) result[bom.id] += map(lambda x: x.id, bom2.bom_lines)
469,519
def pre_action(self, cr, uid, ids, model, context=None): # Searching for action rules cr.execute("SELECT model.model, rule.id FROM base_action_rule rule \ LEFT JOIN ir_model model on (model.id = rule.model_id) \ where active") res = cr.fetchall() # Check if any rule matching with current object for obj_name, rule_id in res: if not (model == obj_name): continue else: obj = self.pool.get(obj_name) self._action(cr, uid, [rule_id], obj.browse(cr, uid, ids, context=context), context=context) return True
def pre_action(self, cr, uid, ids, model, context=None): # Searching for action rules cr.execute("SELECT model.model, rule.id FROM base_action_rule rule \ LEFT JOIN ir_model model on (model.id = rule.model_id) \ WHERE active") res = cr.fetchall() # Check if any rule matching with current object for obj_name, rule_id in res: if not (model == obj_name): continue else: obj = self.pool.get(obj_name) self._action(cr, uid, [rule_id], obj.browse(cr, uid, ids, context=context), context=context) return True
469,520
def _dept_name_get_fnc(self, cr, uid, ids, prop, unknow_none, context): res = self.name_get(cr, uid, ids, context) return dict(res)
def _dept_name_get_fnc(self, cr, uid, ids, prop, unknow_none, context): res = self.name_get(cr, uid, ids, context) return dict(res)
469,521
def init(self, cr): tools.sql.drop_view_if_exists(cr, 'purchase_report') cr.execute(""" create or replace view purchase_report as ( select min(l.id) as id, s.date_order as date, to_char(s.date_order, 'YYYY') as name, to_char(s.date_order, 'MM') as month, to_char(s.date_order, 'YYYY-MM-DD') as day, s.state, s.date_approve, date_trunc('day',s.minimum_planned_date) as expected_date, s.partner_address_id, s.dest_address_id, s.pricelist_id, s.validator, s.warehouse_id as warehouse_id, s.partner_id as partner_id, s.create_uid as user_id, s.company_id as company_id, l.product_id, t.categ_id as category_id, l.product_uom as product_uom, s.location_id as location_id, sum(l.product_qty*u.factor) as quantity, extract(epoch from age(s.date_approve,s.date_order))/(24*60*60)::decimal(16,2) as delay, extract(epoch from age(l.date_planned,s.date_order))/(24*60*60)::decimal(16,2) as delay_pass, count(*) as nbr, (l.price_unit*l.product_qty*u.factor)::decimal(16,2) as price_total, avg(100.0 * (l.price_unit*l.product_qty*u.factor) / (t.standard_price*l.product_qty*u.factor))::decimal(16,2) as negociation, sum(t.standard_price*l.product_qty*u.factor)::decimal(16,2) as price_standard, (sum(l.product_qty*l.price_unit)/sum(l.product_qty*u.factor))::decimal(16,2) as price_average from purchase_order s left join purchase_order_line l on (s.id=l.order_id) left join product_product p on (l.product_id=p.id) left join product_template t on (p.product_tmpl_id=t.id) left join product_uom u on (u.id=l.product_uom) where l.product_id is not null group by s.company_id, s.create_uid, s.partner_id, l.product_qty, u.factor, s.location_id, l.price_unit, s.date_approve, l.date_planned, l.product_uom, date_trunc('day',s.minimum_planned_date), s.partner_address_id, s.pricelist_id, s.validator, s.dest_address_id, l.product_id, t.categ_id, s.date_order, to_char(s.date_order, 'YYYY'), to_char(s.date_order, 'MM'), to_char(s.date_order, 'YYYY-MM-DD'), s.state, s.warehouse_id ) """)
def init(self, cr): tools.sql.drop_view_if_exists(cr, 'purchase_report') cr.execute(""" create or replace view purchase_report as ( select min(l.id) as id, s.date_order as date, to_char(s.date_order, 'YYYY') as name, to_char(s.date_order, 'MM') as month, to_char(s.date_order, 'YYYY-MM-DD') as day, s.state, s.date_approve, date_trunc('day',s.minimum_planned_date) as expected_date, s.partner_address_id, s.dest_address_id, s.pricelist_id, s.validator, s.warehouse_id as warehouse_id, s.partner_id as partner_id, s.create_uid as user_id, s.company_id as company_id, l.product_id, t.categ_id as category_id, l.product_uom as product_uom, s.location_id as location_id, sum(l.product_qty*u.factor) as quantity, extract(epoch from age(s.date_approve,s.date_order))/(24*60*60)::decimal(16,2) as delay, extract(epoch from age(l.date_planned,s.date_order))/(24*60*60)::decimal(16,2) as delay_pass, count(*) as nbr, (l.price_unit*l.product_qty*u.factor)::decimal(16,2) as price_total, avg(case when t.standard_price <= 0 then (100.0 * (l.price_unit*l.product_qty*u.factor)) else (100.0 * (l.price_unit*l.product_qty*u.factor) / (t.standard_price*l.product_qty*u.factor)) end) as negociation, sum(t.standard_price*l.product_qty*u.factor)::decimal(16,2) as price_standard, (sum(l.product_qty*l.price_unit)/sum(l.product_qty*u.factor))::decimal(16,2) as price_average from purchase_order s left join purchase_order_line l on (s.id=l.order_id) left join product_product p on (l.product_id=p.id) left join product_template t on (p.product_tmpl_id=t.id) left join product_uom u on (u.id=l.product_uom) where l.product_id is not null group by s.company_id, s.create_uid, s.partner_id, l.product_qty, u.factor, s.location_id, l.price_unit, s.date_approve, l.date_planned, l.product_uom, date_trunc('day',s.minimum_planned_date), s.partner_address_id, s.pricelist_id, s.validator, s.dest_address_id, l.product_id, t.categ_id, s.date_order, to_char(s.date_order, 'YYYY'), to_char(s.date_order, 'MM'), to_char(s.date_order, 'YYYY-MM-DD'), s.state, s.warehouse_id ) """)
469,522
def phase_done(self, cr, uid, ids,*args): self.write(cr, uid, ids, {'state': 'done'}) return True
def phase_done(self, cr, uid, ids,*args): self.write(cr, uid, ids, {'state': 'done'}) return True
469,523
def create_move_from_st_line(self, cr, uid, st_line_id, company_currency_id, st_line_number, context=None): res_currency_obj = self.pool.get('res.currency') account_move_obj = self.pool.get('account.move') account_move_line_obj = self.pool.get('account.move.line') account_bank_statement_line_obj = self.pool.get('account.bank.statement.line') st_line = account_bank_statement_line_obj.browse(cr, uid, st_line_id, context) st = st_line.statement_id
def create_move_from_st_line(self, cr, uid, st_line_id, company_currency_id, st_line_number, context=None): res_currency_obj = self.pool.get('res.currency') account_move_obj = self.pool.get('account.move') account_move_line_obj = self.pool.get('account.move.line') account_bank_statement_line_obj = self.pool.get('account.bank.statement.line') st_line = account_bank_statement_line_obj.browse(cr, uid, st_line_id, context) st = st_line.statement_id
469,524
def onchange_partner_id(self, cursor, user, line_id, partner_id, type, currency_id, context=None): res_users_obj = self.pool.get('res.users') res_currency_obj = self.pool.get('res.currency') res = {'value': {}} obj_partner = self.pool.get('res.partner') if context is None: context = {} if not partner_id: return res account_id = False line = self.browse(cursor, user, line_id) if not line or (line and not line[0].account_id): part = obj_partner.browse(cursor, user, partner_id, context=context) if type == 'supplier': account_id = part.property_account_payable.id else: account_id = part.property_account_receivable.id res['value']['account_id'] = account_id
def onchange_partner_id(self, cursor, user, line_id, partner_id, type, currency_id, context=None): res_users_obj = self.pool.get('res.users') res_currency_obj = self.pool.get('res.currency') res = {'value': {}} obj_partner = self.pool.get('res.partner') if context is None: context = {} if not partner_id: return res account_id = False line = self.browse(cursor, user, line_id) if not line or (line and not line[0].account_id): part = obj_partner.browse(cursor, user, partner_id, context=context) if type == 'supplier': account_id = part.property_account_payable.id else: account_id = part.property_account_receivable.id res['value']['account_id'] = account_id
469,525
def _unit_compute_inv(self, cr, uid, taxes, price_unit, address_id=None, product=None, partner=None): taxes = self._applicable(cr, uid, taxes, price_unit, address_id, product, partner)
def _unit_compute_inv(self, cr, uid, taxes, price_unit, address_id=None, product=None, partner=None): taxes = self._applicable(cr, uid, taxes, price_unit, address_id, product, partner)
469,526
def _check(self, cr, uid, automatic=False, use_new_cursor=False, \ context=None): """ This Function is call by scheduler. """ rule_pool = self.pool.get('base.action.rule') rule_ids = rule_pool.search(cr, uid, [], context=context) self._register_hook(cr, uid, rule_ids, context=context)
def _check(self, cr, uid, automatic=False, use_new_cursor=False, \ context=None): """ This Function is call by scheduler. """ rule_pool = self.pool.get('base.action.rule') rule_ids = rule_pool.search(cr, uid, [], context=context) self._register_hook(cr, uid, rule_ids, context=context)
469,527
def _check(self, cr, uid, automatic=False, use_new_cursor=False, \ context=None): """ This Function is call by scheduler. """ rule_pool = self.pool.get('base.action.rule') rule_ids = rule_pool.search(cr, uid, [], context=context) self._register_hook(cr, uid, rule_ids, context=context)
def _check(self, cr, uid, automatic=False, use_new_cursor=False, \ context=None): """ This Function is call by scheduler. """ rule_pool = self.pool.get('base.action.rule') rule_ids = rule_pool.search(cr, uid, [], context=context) self._register_hook(cr, uid, rule_ids, context=context)
469,528
def _check(self, cr, uid, automatic=False, use_new_cursor=False, \ context=None): """ This Function is call by scheduler. """ rule_pool = self.pool.get('base.action.rule') rule_ids = rule_pool.search(cr, uid, [], context=context) self._register_hook(cr, uid, rule_ids, context=context)
def _check(self, cr, uid, automatic=False, use_new_cursor=False, \ context=None): """ This Function is call by scheduler. """ rule_pool = self.pool.get('base.action.rule') rule_ids = rule_pool.search(cr, uid, [], context=context) self._register_hook(cr, uid, rule_ids, context=context)
469,529
def _check(self, cr, uid, automatic=False, use_new_cursor=False, \ context=None): """ This Function is call by scheduler. """ rule_pool = self.pool.get('base.action.rule') rule_ids = rule_pool.search(cr, uid, [], context=context) self._register_hook(cr, uid, rule_ids, context=context)
def _check(self, cr, uid, automatic=False, use_new_cursor=False, \ context=None): """ This Function is call by scheduler. """ rule_pool = self.pool.get('base.action.rule') rule_ids = rule_pool.search(cr, uid, [], context=context) self._register_hook(cr, uid, rule_ids, context=context)
469,530
def _get_and_change_date_format_for_swiss (self,date_to_format): date_formatted='' print date_to_format if date_to_format: date_formatted = strptime(date_to_format,'%Y-%m-%d').strftime('%d.%m.%Y') return date_formatted
def _get_and_change_date_format_for_swiss (self,date_to_format): date_formatted='' print date_to_format if date_to_format: date_formatted = time.strptime(date_to_format,'%Y-%m-%d').strftime('%d.%m.%Y') return date_formatted
469,531
def _check_ean_key(self, cr, uid, ids): for partner in self.browse(cr, uid, ids): if not partner.ean13: continue if len(partner.ean13) not in [13,14,8]: return False try: int(partner.ean13) except: return False oddsum=0 evensum=0 total=0 eanvalue=partner.ean13 reversevalue = eanvalue[::-1] finalean=reversevalue[1:]
def _check_ean_key(self, cr, uid, ids): for partner in self.browse(cr, uid, ids): if not partner.ean13: continue if len(partner.ean13) not in [13,14,8]: return False try: int(partner.ean13) except: return False oddsum=0 evensum=0 total=0 eanvalue=partner.ean13 reversevalue = eanvalue[::-1] finalean=reversevalue[1:]
469,532
def name_search(self, cr, user, name='', args=None, operator='ilike', context=None, limit=80): if not args: args=[] if not context: context={} ids = False if len(name) == 2: ids = self.search(cr, user, [('code', '=', name)] + args, limit=limit, context=context) if not ids: ids = self.search(cr, user, [('name', operator, name)] + args, limit=limit, context=context) return self.name_get(cr, user, ids, context)
def name_search(self, cr, user, name='', args=None, operator='ilike', context=None, limit=80): if not args: args=[] if not context: context={} ids = False if len(name) == 2: ids = self.search(cr, user, [('code', 'ilike', name)] + args, limit=limit, context=context) if not ids: ids = self.search(cr, user, [('name', operator, name)] + args, limit=limit, context=context) return self.name_get(cr, user, ids, context)
469,533
def holidays_validate(self, cr, uid, ids, *args): obj_emp = self.pool.get('hr.employee') data_holiday = self.browse(cr, uid, ids) self.check_holidays(cr, uid, ids) vals = {'state':'validate'} ids2 = obj_emp.search(cr, uid, [('user_id', '=', uid)]) if ids2: if data_holiday[0].state == 'validate1': vals['manager_id2'] = ids2[0] else: vals['manager_id'] = ids2[0] else: raise osv.except_osv(_('Warning !'), _('No user related to the selected employee.')) self.write(cr, uid, ids, vals) for record in data_holiday: if record.holiday_type == 'employee' and record.type == 'remove': vals = { 'name': record.name, 'date_from': record.date_from, 'date_to': record.date_to, 'calendar_id': record.employee_id.calendar_id.id, 'company_id': record.employee_id.company_id.id, 'resource_id': record.employee_id.resource_id.id, 'holiday_id': record.id } self._create_resource_leave(cr, uid, vals) elif record.holiday_type == 'category' and record.type == 'remove': emp_ids = obj_emp.search(cr, uid, [('category_id', '=', record.category_id.id)]) for emp in obj_emp.browse(cr, uid, emp_ids): vals = { 'name': record.name, 'date_from': record.date_from, 'date_to': record.date_to, 'calendar_id': emp.calendar_id.id, 'company_id': emp.company_id.id, 'resource_id': emp.resource_id.id, 'holiday_id':record.id } self._create_resource_leave(cr, uid, vals) return True
def holidays_validate(self, cr, uid, ids, *args): obj_emp = self.pool.get('hr.employee') data_holiday = self.browse(cr, uid, ids) self.check_holidays(cr, uid, ids) vals = {'state':'validate'} ids2 = obj_emp.search(cr, uid, [('user_id', '=', uid)]) if ids2: if data_holiday[0].state == 'validate1': vals['manager_id2'] = ids2[0] else: vals['manager_id'] = ids2[0] else: raise osv.except_osv(_('Warning !'), _('No user related to the selected employee.')) self.write(cr, uid, ids, vals) for record in data_holiday: if record.holiday_type == 'employee' and record.type == 'remove': vals = { 'name': record.name, 'date_from': record.date_from, 'date_to': record.date_to, 'calendar_id': record.employee_id.calendar_id.id, 'company_id': record.employee_id.company_id.id, 'resource_id': record.employee_id.resource_id.id, 'holiday_id': record.id } self._create_resource_leave(cr, uid, vals) elif record.holiday_type == 'category' and record.type == 'remove': emp_ids = obj_emp.search(cr, uid, [('category_ids', '=', record.category_id.id)]) for emp in obj_emp.browse(cr, uid, emp_ids): vals = { 'name': record.name, 'date_from': record.date_from, 'date_to': record.date_to, 'calendar_id': emp.calendar_id.id, 'company_id': emp.company_id.id, 'resource_id': emp.resource_id.id, 'holiday_id':record.id } self._create_resource_leave(cr, uid, vals) return True
469,534
def set_done(self, cr, uid, ids, *args): self.write(cr, uid, ids, {'state': 'done'}) return True
def set_done(self, cr, uid, ids, *args): self.write(cr, uid, ids, {'state': 'done'}) return True
469,535
def invoice_pay_customer(self, cr, uid, ids, context={}): if not ids: return [] inv = self.browse(cr, uid, ids[0], context=context) return { 'name':_("Pay Invoice"), 'view_mode': 'form', 'view_id': False, 'view_type': 'form', 'res_model': 'account.voucher', 'type': 'ir.actions.act_window', 'nodestroy': True, 'target': 'new', 'domain': '[]', 'context': { 'default_partner_id': inv.partner_id.id, 'default_amount': inv.residual, 'default_name':inv.name, 'close_after_process': True, 'invoice_type':inv.type, 'invoice_id':inv.id, 'default_type': inv.type in ('out_invoice','out_refund') and 'receipt' or 'payment' } }
def invoice_pay_customer(self, cr, uid, ids, context={}): if not ids: return [] inv = self.browse(cr, uid, ids[0], context=context) return { 'name':_("Pay Invoice"), 'view_mode': 'form', 'view_id': False, 'view_type': 'form', 'res_model': 'account.voucher', 'type': 'ir.actions.act_window', 'nodestroy': True, 'target': 'current', 'domain': '[]', 'context': { 'default_partner_id': inv.partner_id.id, 'default_amount': inv.residual, 'default_name':inv.name, 'close_after_process': True, 'invoice_type':inv.type, 'invoice_id':inv.id, 'default_type': inv.type in ('out_invoice','out_refund') and 'receipt' or 'payment' } }
469,536
def log(self, title, msg): Logger().notifyChannel('%s' % title, LOG_DEBUG_RPC, pformat(msg))
def log(self, title, msg): Logger().notifyChannel('%s' % title, LOG_DEBUG_RPC, pformat(msg))
469,537
def upload_report(self, cr, uid, report_id, file_sxw, file_type, context): ''' Untested function ''' pool = pooler.get_pool(cr.dbname) sxwval = StringIO(base64.decodestring(file_sxw)) if file_type=='sxw': fp = open(addons.get_module_resource('base_report_designer','openerp_sxw2rml', 'normalized_oo2rml.xsl'),'rb') if file_type=='odt': fp = open(addons.get_module_resource('base_report_designer','openerp_sxw2rml', 'normalized_odt2rml.xsl'),'rb') report = pool.get('ir.actions.report.xml').write(cr, uid, [report_id], { 'report_sxw_content': base64.decodestring(file_sxw), 'report_rml_content': str(sxw2rml(sxwval, xsl=fp.read())), }) db = pooler.get_db_only(cr.dbname) interface.register_all(db) return True
def upload_report(self, cr, uid, report_id, file_sxw, file_type, context): ''' Untested function ''' pool = pooler.get_pool(cr.dbname) sxwval = StringIO(base64.decodestring(file_sxw)) if file_type=='sxw': fp = open(addons.get_module_resource('base_report_designer','openerp_sxw2rml', 'normalized_oo2rml.xsl'),'rb') if file_type=='odt': fp = open(addons.get_module_resource('base_report_designer','openerp_sxw2rml', 'normalized_odt2rml.xsl'),'rb') report = pool.get('ir.actions.report.xml').write(cr, uid, [report_id], { 'report_sxw_content': base64.decodestring(file_sxw), 'report_rml_content': str(sxw2rml(sxwval, xsl=fp.read())), }) pool.get('ir.actions.report.xml').register_all(cr) return True
469,538
def _amount_reconciled(self, cursor, user, ids, name, args, context=None): if not ids: return {} res_currency_obj = self.pool.get('res.currency') res = {} company_currency_id = False
def_amount_reconciled(self,cursor,user,ids,name,args,context=None):ifnotids:return{}res_currency_obj=self.pool.get('res.currency')res={}company_currency_id=False
469,539
def _amount_reconciled(self, cursor, user, ids, name, args, context=None): if not ids: return {} res_currency_obj = self.pool.get('res.currency') res = {} company_currency_id = False
def _amount_reconciled(self, cursor, user, ids, name, args, context=None): if not ids: return {} res_currency_obj = self.pool.get('res.currency') res = {} company_currency_id = False
469,540
def _amount_reconciled(self, cursor, user, ids, name, args, context=None): if not ids: return {} res_currency_obj = self.pool.get('res.currency') res = {} company_currency_id = False
def _amount_reconciled(self, cursor, user, ids, name, args, context=None): if not ids: return {} res_currency_obj = self.pool.get('res.currency') res = {} company_currency_id = False
469,541
def signal(self, cr, uid, model, res_id, signal, context=None): if not signal: raise ValueError('signal cannot be False')
def signal(self, cr, uid, model, res_id, signal, context=None): if not signal: raise ValueError('signal cannot be False')
469,542
def _process_one(self, cr, uid, workitem, context=None): if workitem.state != 'todo': return
def _process_one(self, cr, uid, workitem, context=None): if workitem.state != 'todo': return
469,543
def _process_one(self, cr, uid, workitem, context=None): if workitem.state != 'todo': return
def _process_one(self, cr, uid, workitem, context=None): if workitem.state != 'todo': return
469,544
def _fnct_write(self,obj,cr, uid, ids, field_name, values, args, context=None): if values and field_name: self._field_get2(cr, uid, obj, context) relation = obj._name res = {} if type(ids) != type([]): ids=[ids] objlst = obj.browse(cr, uid, ids) for data in objlst: t_id=None t_data = data relation = obj._name for i in range(len(self.arg)): field_detail = self._relations[i] relation = field_detail['object'] if not t_data[self.arg[i]]: t_data = False break if field_detail['type'] in ('one2many', 'many2many'): if self._type != "many2one": t_id=t_data.id t_data = t_data[self.arg[i]][0] else: t_id=t_data['id'] t_data = t_data[self.arg[i]] if t_id: obj.pool.get(field_detail['object']).write(cr,uid,[t_id],{args[-1]:values}, context=context)
def _fnct_write(self,obj,cr, uid, ids, field_name, values, args, context=None): if values and field_name: self._field_get2(cr, uid, obj, context) relation = obj._name res = {} if type(ids) != type([]): ids=[ids] objlst = obj.browse(cr, uid, ids) for data in objlst: t_id=None t_data = data relation = obj._name for i in range(len(self.arg)): field_detail = self._relations[i] relation = field_detail['object'] if not t_data[self.arg[i]]: t_data = False break if field_detail['type'] in ('one2many', 'many2many'): if self._type != "many2one": t_id = t_data.id t_data = t_data[self.arg[i]][0] else: t_id=t_data['id'] t_data = t_data[self.arg[i]] if t_id: obj.pool.get(field_detail['object']).write(cr,uid,[t_id],{args[-1]:values}, context=context)
469,545
def _fnct_write(self,obj,cr, uid, ids, field_name, values, args, context=None): if values and field_name: self._field_get2(cr, uid, obj, context) relation = obj._name res = {} if type(ids) != type([]): ids=[ids] objlst = obj.browse(cr, uid, ids) for data in objlst: t_id=None t_data = data relation = obj._name for i in range(len(self.arg)): field_detail = self._relations[i] relation = field_detail['object'] if not t_data[self.arg[i]]: t_data = False break if field_detail['type'] in ('one2many', 'many2many'): if self._type != "many2one": t_id=t_data.id t_data = t_data[self.arg[i]][0] else: t_id=t_data['id'] t_data = t_data[self.arg[i]] if t_id: obj.pool.get(field_detail['object']).write(cr,uid,[t_id],{args[-1]:values}, context=context)
def _fnct_write(self,obj,cr, uid, ids, field_name, values, args, context=None): if values and field_name: self._field_get2(cr, uid, obj, context) relation = obj._name res = {} if type(ids) != type([]): ids=[ids] objlst = obj.browse(cr, uid, ids) for data in objlst: t_id=None t_data = data relation = obj._name for i in range(len(self.arg)): field_detail = self._relations[i] relation = field_detail['object'] if not t_data[self.arg[i]]: t_data = False break if field_detail['type'] in ('one2many', 'many2many'): if self._type != "many2one": t_id=t_data.id t_data = t_data[self.arg[i]][0] else: t_id = t_data['id'] t_data = t_data[self.arg[i]] if t_id: obj.pool.get(field_detail['object']).write(cr,uid,[t_id],{args[-1]:values}, context=context)
469,546
def _get_picking(self, cr, uid, ctx=None): if ctx is None: ctx = {} if ctx.get('action_id', False): return ctx['action_id'] return False
def _get_picking(self, cr, uid, ctx=None): if ctx is None: ctx = {} if ctx.get('active_id', False): return ctx['active_id'] return False
469,547
def _get_picking_address(self, cr, uid, context=None): picking_obj = self.pool.get('stock.picking') if context is None: context = {} if context.get('action_id', False): picking = picking_obj.browse(cr, uid, [context['action_id']])[0] return picking.address_id and picking.address_id.id or False return False
def _get_picking_address(self, cr, uid, context=None): picking_obj = self.pool.get('stock.picking') if context is None: context = {} if context.get('active_id', False): picking = picking_obj.browse(cr, uid, [context['active_id']])[0] return picking.address_id and picking.address_id.id or False return False
469,548
def create_move_from_st_line(self, cr, uid, st_line_id, company_currency_id, st_line_number, context=None): res_currency_obj = self.pool.get('res.currency') res_users_obj = self.pool.get('res.users') account_move_obj = self.pool.get('account.move') account_move_line_obj = self.pool.get('account.move.line') account_analytic_line_obj = self.pool.get('account.analytic.line') account_bank_statement_line_obj = self.pool.get('account.bank.statement.line')
def create_move_from_st_line(self, cr, uid, st_line_id, company_currency_id, st_line_number, context=None): res_currency_obj = self.pool.get('res.currency') res_users_obj = self.pool.get('res.users') account_move_obj = self.pool.get('account.move') account_move_line_obj = self.pool.get('account.move.line') account_analytic_line_obj = self.pool.get('account.analytic.line') account_bank_statement_line_obj = self.pool.get('account.bank.statement.line')
469,549
def get(self, cr, obj, ids, name, user=None, offset=0, context=None, values=None): if not context: context = {}
def get(self, cr, obj, ids, name, user=None, offset=0, context=None, values=None): if not context: context = {}
469,550
def get_recurrent_ids(self, cr, uid, ids, start_date, until_date, limit=100): if not limit: limit = 100 if ids and (start_date or until_date): cr.execute("select m.id, m.rrule, c.date, m.exdate from crm_meeting m\ join crm_case c on (c.id=m.inherit_case_id) \ where m.id in ("+ ','.join(map(lambda x: str(x), ids))+")") result = [] count = 0 start_date = start_date and datetime.datetime.strptime(start_date, "%Y-%m-%d") or False until_date = until_date and datetime.datetime.strptime(until_date, "%Y-%m-%d") or False for data in cr.dictfetchall(): if count > limit: break event_date = datetime.datetime.strptime(data['date'], "%Y-%m-%d %H:%M:%S") if start_date and start_date <= event_date: start_date = event_date if not data['rrule']: idval = common.real_id2caldav_id(data['id'], data['date']) result.append(idval) count += 1 else: exdate = data['exdate'] and data['exdate'].split(',') or [] event_obj = self.pool.get('basic.calendar.event') rrule_str = data['rrule'] new_rrule_str = [] rrule_until_date = False is_until = False for rule in rrule_str.split(';'): name, value = rule.split('=') if name == "UNTIL": is_until = True value = parser.parse(value) rrule_until_date = parser.parse(value.strftime("%Y-%m-%d")) if until_date and until_date >= rrule_until_date: until_date = rrule_until_date if until_date: value = until_date.strftime("%Y%m%d%H%M%S") new_rule = '%s=%s' % (name, value) new_rrule_str.append(new_rule) if not is_until and until_date: value = until_date.strftime("%Y%m%d%H%M%S") name = "UNTIL" new_rule = '%s=%s' % (name, value) new_rrule_str.append(new_rule) new_rrule_str = ';'.join(new_rrule_str) start_date = datetime.datetime.strptime(data['date'], "%Y-%m-%d %H:%M:%S") rdates = event_obj.get_recurrent_dates(str(new_rrule_str), exdate, start_date) for rdate in rdates: idval = common.real_id2caldav_id(data['id'], rdate) result.append(idval) count += 1 ids = result return ids
def get_recurrent_ids(self, cr, uid, ids, base_start_date, base_until_date, limit=100): if not limit: limit = 100 if ids and (start_date or until_date): cr.execute("select m.id, m.rrule, c.date, m.exdate from crm_meeting m\ join crm_case c on (c.id=m.inherit_case_id) \ where m.id in ("+ ','.join(map(lambda x: str(x), ids))+")") result = [] count = 0 start_date = start_date and datetime.datetime.strptime(start_date, "%Y-%m-%d") or False until_date = until_date and datetime.datetime.strptime(until_date, "%Y-%m-%d") or False for data in cr.dictfetchall(): if count > limit: break event_date = datetime.datetime.strptime(data['date'], "%Y-%m-%d %H:%M:%S") if start_date and start_date <= event_date: start_date = event_date if not data['rrule']: idval = common.real_id2caldav_id(data['id'], data['date']) result.append(idval) count += 1 else: exdate = data['exdate'] and data['exdate'].split(',') or [] event_obj = self.pool.get('basic.calendar.event') rrule_str = data['rrule'] new_rrule_str = [] rrule_until_date = False is_until = False for rule in rrule_str.split(';'): name, value = rule.split('=') if name == "UNTIL": is_until = True value = parser.parse(value) rrule_until_date = parser.parse(value.strftime("%Y-%m-%d")) if until_date and until_date >= rrule_until_date: until_date = rrule_until_date if until_date: value = until_date.strftime("%Y%m%d%H%M%S") new_rule = '%s=%s' % (name, value) new_rrule_str.append(new_rule) if not is_until and until_date: value = until_date.strftime("%Y%m%d%H%M%S") name = "UNTIL" new_rule = '%s=%s' % (name, value) new_rrule_str.append(new_rule) new_rrule_str = ';'.join(new_rrule_str) start_date = datetime.datetime.strptime(data['date'], "%Y-%m-%d %H:%M:%S") rdates = event_obj.get_recurrent_dates(str(new_rrule_str), exdate, start_date) for rdate in rdates: idval = common.real_id2caldav_id(data['id'], rdate) result.append(idval) count += 1 ids = result return ids
469,551
def get_recurrent_ids(self, cr, uid, ids, start_date, until_date, limit=100): if not limit: limit = 100 if ids and (start_date or until_date): cr.execute("select m.id, m.rrule, c.date, m.exdate from crm_meeting m\ join crm_case c on (c.id=m.inherit_case_id) \ where m.id in ("+ ','.join(map(lambda x: str(x), ids))+")") result = [] count = 0 start_date = start_date and datetime.datetime.strptime(start_date, "%Y-%m-%d") or False until_date = until_date and datetime.datetime.strptime(until_date, "%Y-%m-%d") or False for data in cr.dictfetchall(): if count > limit: break event_date = datetime.datetime.strptime(data['date'], "%Y-%m-%d %H:%M:%S") if start_date and start_date <= event_date: start_date = event_date if not data['rrule']: idval = common.real_id2caldav_id(data['id'], data['date']) result.append(idval) count += 1 else: exdate = data['exdate'] and data['exdate'].split(',') or [] event_obj = self.pool.get('basic.calendar.event') rrule_str = data['rrule'] new_rrule_str = [] rrule_until_date = False is_until = False for rule in rrule_str.split(';'): name, value = rule.split('=') if name == "UNTIL": is_until = True value = parser.parse(value) rrule_until_date = parser.parse(value.strftime("%Y-%m-%d")) if until_date and until_date >= rrule_until_date: until_date = rrule_until_date if until_date: value = until_date.strftime("%Y%m%d%H%M%S") new_rule = '%s=%s' % (name, value) new_rrule_str.append(new_rule) if not is_until and until_date: value = until_date.strftime("%Y%m%d%H%M%S") name = "UNTIL" new_rule = '%s=%s' % (name, value) new_rrule_str.append(new_rule) new_rrule_str = ';'.join(new_rrule_str) start_date = datetime.datetime.strptime(data['date'], "%Y-%m-%d %H:%M:%S") rdates = event_obj.get_recurrent_dates(str(new_rrule_str), exdate, start_date) for rdate in rdates: idval = common.real_id2caldav_id(data['id'], rdate) result.append(idval) count += 1 ids = result return ids
def get_recurrent_ids(self, cr, uid, ids, start_date, until_date, limit=100): if not limit: limit = 100 if ids and (base_start_date or base_until_date): cr.execute("select m.id, m.rrule, c.date, m.exdate from crm_meeting m\ join crm_case c on (c.id=m.inherit_case_id) \ where m.id in ("+ ','.join(map(lambda x: str(x), ids))+")") result = [] count = 0 start_date = start_date and datetime.datetime.strptime(start_date, "%Y-%m-%d") or False until_date = until_date and datetime.datetime.strptime(until_date, "%Y-%m-%d") or False for data in cr.dictfetchall(): if count > limit: break event_date = datetime.datetime.strptime(data['date'], "%Y-%m-%d %H:%M:%S") if start_date and start_date <= event_date: start_date = event_date if not data['rrule']: idval = common.real_id2caldav_id(data['id'], data['date']) result.append(idval) count += 1 else: exdate = data['exdate'] and data['exdate'].split(',') or [] event_obj = self.pool.get('basic.calendar.event') rrule_str = data['rrule'] new_rrule_str = [] rrule_until_date = False is_until = False for rule in rrule_str.split(';'): name, value = rule.split('=') if name == "UNTIL": is_until = True value = parser.parse(value) rrule_until_date = parser.parse(value.strftime("%Y-%m-%d")) if until_date and until_date >= rrule_until_date: until_date = rrule_until_date if until_date: value = until_date.strftime("%Y%m%d%H%M%S") new_rule = '%s=%s' % (name, value) new_rrule_str.append(new_rule) if not is_until and until_date: value = until_date.strftime("%Y%m%d%H%M%S") name = "UNTIL" new_rule = '%s=%s' % (name, value) new_rrule_str.append(new_rule) new_rrule_str = ';'.join(new_rrule_str) start_date = datetime.datetime.strptime(data['date'], "%Y-%m-%d %H:%M:%S") rdates = event_obj.get_recurrent_dates(str(new_rrule_str), exdate, start_date) for rdate in rdates: idval = common.real_id2caldav_id(data['id'], rdate) result.append(idval) count += 1 ids = result return ids
469,552
def get_recurrent_ids(self, cr, uid, ids, start_date, until_date, limit=100): if not limit: limit = 100 if ids and (start_date or until_date): cr.execute("select m.id, m.rrule, c.date, m.exdate from crm_meeting m\ join crm_case c on (c.id=m.inherit_case_id) \ where m.id in ("+ ','.join(map(lambda x: str(x), ids))+")") result = [] count = 0 start_date = start_date and datetime.datetime.strptime(start_date, "%Y-%m-%d") or False until_date = until_date and datetime.datetime.strptime(until_date, "%Y-%m-%d") or False for data in cr.dictfetchall(): if count > limit: break event_date = datetime.datetime.strptime(data['date'], "%Y-%m-%d %H:%M:%S") if start_date and start_date <= event_date: start_date = event_date if not data['rrule']: idval = common.real_id2caldav_id(data['id'], data['date']) result.append(idval) count += 1 else: exdate = data['exdate'] and data['exdate'].split(',') or [] event_obj = self.pool.get('basic.calendar.event') rrule_str = data['rrule'] new_rrule_str = [] rrule_until_date = False is_until = False for rule in rrule_str.split(';'): name, value = rule.split('=') if name == "UNTIL": is_until = True value = parser.parse(value) rrule_until_date = parser.parse(value.strftime("%Y-%m-%d")) if until_date and until_date >= rrule_until_date: until_date = rrule_until_date if until_date: value = until_date.strftime("%Y%m%d%H%M%S") new_rule = '%s=%s' % (name, value) new_rrule_str.append(new_rule) if not is_until and until_date: value = until_date.strftime("%Y%m%d%H%M%S") name = "UNTIL" new_rule = '%s=%s' % (name, value) new_rrule_str.append(new_rule) new_rrule_str = ';'.join(new_rrule_str) start_date = datetime.datetime.strptime(data['date'], "%Y-%m-%d %H:%M:%S") rdates = event_obj.get_recurrent_dates(str(new_rrule_str), exdate, start_date) for rdate in rdates: idval = common.real_id2caldav_id(data['id'], rdate) result.append(idval) count += 1 ids = result return ids
def get_recurrent_ids(self, cr, uid, ids, start_date, until_date, limit=100): if not limit: limit = 100 if ids and (start_date or until_date): cr.execute("select m.id, m.rrule, c.date, m.exdate from crm_meeting m\ join crm_case c on (c.id=m.inherit_case_id) \ where m.id in ("+ ','.join(map(lambda x: str(x), ids))+")") result = [] count = 0 for data in cr.dictfetchall(): start_date = base_start_date and datetime.datetime.strptime(base_start_date, "%Y-%m-%d") or False until_date = base_until_date and datetime.datetime.strptime(base_until_date, "%Y-%m-%d") or False if count > limit: break event_date = datetime.datetime.strptime(data['date'], "%Y-%m-%d %H:%M:%S") if start_date and start_date <= event_date: start_date = event_date if not data['rrule']: idval = common.real_id2caldav_id(data['id'], data['date']) result.append(idval) count += 1 else: exdate = data['exdate'] and data['exdate'].split(',') or [] event_obj = self.pool.get('basic.calendar.event') rrule_str = data['rrule'] new_rrule_str = [] rrule_until_date = False is_until = False for rule in rrule_str.split(';'): name, value = rule.split('=') if name == "UNTIL": is_until = True value = parser.parse(value) rrule_until_date = parser.parse(value.strftime("%Y-%m-%d")) if until_date and until_date >= rrule_until_date: until_date = rrule_until_date if until_date: value = until_date.strftime("%Y%m%d%H%M%S") new_rule = '%s=%s' % (name, value) new_rrule_str.append(new_rule) if not is_until and until_date: value = until_date.strftime("%Y%m%d%H%M%S") name = "UNTIL" new_rule = '%s=%s' % (name, value) new_rrule_str.append(new_rule) new_rrule_str = ';'.join(new_rrule_str) start_date = datetime.datetime.strptime(data['date'], "%Y-%m-%d %H:%M:%S") rdates = event_obj.get_recurrent_dates(str(new_rrule_str), exdate, start_date) for rdate in rdates: idval = common.real_id2caldav_id(data['id'], rdate) result.append(idval) count += 1 ids = result return ids
469,553
def search(self, cr, uid, args, offset=0, limit=100, order=None, context=None, count=False): args_without_date = [] start_date = False until_date = False for arg in args: if arg[0] not in ('date', unicode('date')): args_without_date.append(arg) else: if arg[1] in ('>', '>='): start_date = arg[2] elif arg[1] in ('<', '<='): until_date = arg[2]
def search(self, cr, uid, args, offset=0, limit=100, order=None, context=None, count=False): args_without_date = [] start_date = False until_date = False for arg in args: if arg[0] not in ('date', unicode('date')): args_without_date.append(arg) else: if arg[1] in ('>', '>='): start_date = arg[2] elif arg[1] in ('<', '<='): until_date = arg[2]
469,554
def search(self, cr, uid, args, offset=0, limit=100, order=None, context=None, count=False): args_without_date = [] start_date = False until_date = False for arg in args: if arg[0] not in ('date', unicode('date')): args_without_date.append(arg) else: if arg[1] in ('>', '>='): start_date = arg[2] elif arg[1] in ('<', '<='): until_date = arg[2]
def search(self, cr, uid, args, offset=0, limit=100, order=None, context=None, count=False): args_without_date = [] start_date = False until_date = False for arg in args: if arg[0] not in ('date', unicode('date')): args_without_date.append(arg) else: if arg[1] in ('>', '>='): start_date = arg[2] elif arg[1] in ('<', '<='): until_date = arg[2]
469,555
def test_expr(expr, allowed_codes, mode="eval"): """test_expr(expression, allowed_codes[, mode]) -> code_object Test that the expression contains only the allowed opcodes. If the expression is valid and contains only allowed codes, return the compiled code object. Otherwise raise a ValueError. """ try: code_obj = compile(expr, "", mode) except: raise ValueError("%s is not a valid expression" % expr) for code in _get_opcodes(code_obj): if code not in allowed_codes: raise ValueError("opcode %s not allowed (%r)" % (opname[code], expr)) return code_obj
def test_expr(expr, allowed_codes, mode="eval"): """test_expr(expression, allowed_codes[, mode]) -> code_object Test that the expression contains only the allowed opcodes. If the expression is valid and contains only allowed codes, return the compiled code object. Otherwise raise a ValueError. """ try: code_obj = compile(expr, "", mode) except SyntaxError: raise except TypeError: raise except Exception, e: raise ValueError("%s is not a valid expression" % expr) for code in _get_opcodes(code_obj): if code not in allowed_codes: raise ValueError("opcode %s not allowed (%r)" % (opname[code], expr)) return code_obj
469,556
def create(self, cr, user, vals, context=None): """ Create new record with specified value
def create(self, cr, user, vals, context=None): """ Create new record with specified value
469,557
def _amount_line2(self, cr, uid, ids, name, args, context=None): """ Return the subtotal excluding taxes with respect to price_type. """ res = {} tax_obj = self.pool.get('account.tax') cur_obj = self.pool.get('res.currency') for line in self.browse(cr, uid, ids): cur = line.invoice_id and line.invoice_id.currency_id or False res_init = super(account_invoice_line, self)._amount_line(cr, uid, [line.id], name, args, context) res[line.id] = { 'price_subtotal': 0.0, 'price_subtotal_incl': 0.0, 'data': [] } if not line.quantity: continue if line.invoice_id: product_taxes = [] if line.product_id: if line.invoice_id.type in ('out_invoice', 'out_refund'): product_taxes = filter(lambda x: x.price_include, line.product_id.taxes_id) else: product_taxes = filter(lambda x: x.price_include, line.product_id.supplier_taxes_id)
def _amount_line2(self, cr, uid, ids, name, args, context=None): """ Return the subtotal excluding taxes with respect to price_type. """ res = {} tax_obj = self.pool.get('account.tax') cur_obj = self.pool.get('res.currency') for line in self.browse(cr, uid, ids): cur = line.invoice_id and line.invoice_id.currency_id or False res_init = super(account_invoice_line, self)._amount_line(cr, uid, [line.id], name, args, context) res[line.id] = { 'price_subtotal': 0.0, 'price_subtotal_incl': 0.0, 'data': [] } if not line.quantity: continue if line.invoice_id: product_taxes = [] if line.product_id: if line.invoice_id.type in ('out_invoice', 'out_refund'): product_taxes = filter(lambda x: x.price_include, line.product_id.taxes_id) else: product_taxes = filter(lambda x: x.price_include, line.product_id.supplier_taxes_id)
469,558
def init(self, cr): tools.drop_view_if_exists(cr, 'account_invoice_report') cr.execute(""" create or replace view account_invoice_report as ( select min(ail.id) as id, ai.date_invoice as date, to_char(ai.date_invoice, 'YYYY') as year, to_char(ai.date_invoice, 'MM') as month, to_char(ai.date_invoice, 'YYYY-MM-DD') as day, ail.product_id, ai.partner_id as partner_id, ai.payment_term as payment_term, ai.period_id as period_id, u.name as uom_name, ai.currency_id as currency_id, ai.journal_id as journal_id, ai.fiscal_position as fiscal_position, ai.user_id as user_id, ai.company_id as company_id, count(ail.*) as nbr, ai.type as type, ai.state, pt.categ_id, ai.date_due as date_due, ai.address_contact_id as address_contact_id, ai.address_invoice_id as address_invoice_id, ai.account_id as account_id, ai.partner_bank_id as partner_bank_id, sum(case when ai.type in ('out_refund','in_invoice') then ail.quantity * u.factor * -1 else ail.quantity * u.factor end) as product_qty, sum(case when ai.type in ('out_refund','in_invoice') then ail.quantity*ail.price_unit * -1 else ail.quantity*ail.price_unit end) as price_total, sum(case when ai.type in ('out_refund','in_invoice') then ai.amount_total * -1 else ai.amount_total end) as price_total_tax, sum(ail.quantity*ail.price_unit)/sum(ail.quantity*u.factor)*count(ail.product_id)::decimal(16,2) as price_average, sum((select extract(epoch from avg(date_trunc('day',aml.date_created)-date_trunc('day',l.create_date)))/(24*60*60)::decimal(16,2) from account_move_line as aml left join account_invoice as a ON (a.move_id=aml.move_id) left join account_invoice_line as l ON (a.id=l.invoice_id) where a.id=ai.id)) as delay_to_pay, (case when ai.type in ('out_refund','in_invoice') then ai.residual * -1 else ai.residual end)/(select count(l.*) from account_invoice_line as l left join account_invoice as a ON (a.id=l.invoice_id) where a.id=ai.id) as residual from account_invoice_line as ail left join account_invoice as ai ON (ai.id=ail.invoice_id) left join product_template pt on (pt.id=ail.product_id) left join product_uom u on (u.id=ail.uos_id) group by ail.product_id, ai.date_invoice, ai.id, to_char(ai.date_invoice, 'YYYY'), to_char(ai.date_invoice, 'MM'), to_char(ai.date_invoice, 'YYYY-MM-DD'), ai.partner_id, ai.payment_term, ai.period_id, u.name, ai.currency_id, ai.journal_id, ai.fiscal_position, ai.user_id, ai.company_id, ai.type, ai.state, pt.categ_id, ai.date_due, ai.address_contact_id, ai.address_invoice_id, ai.account_id, ai.partner_bank_id, ai.residual, ai.amount_total ) """)
def init(self, cr): tools.drop_view_if_exists(cr, 'account_invoice_report') cr.execute(""" create or replace view account_invoice_report as ( select min(ail.id) as id, ai.date_invoice as date, to_char(ai.date_invoice, 'YYYY') as year, to_char(ai.date_invoice, 'MM') as month, to_char(ai.date_invoice, 'YYYY-MM-DD') as day, ail.product_id, ai.partner_id as partner_id, ai.payment_term as payment_term, ai.period_id as period_id, u.name as uom_name, ai.currency_id as currency_id, ai.journal_id as journal_id, ai.fiscal_position as fiscal_position, ai.user_id as user_id, ai.company_id as company_id, count(ail.*) as nbr, ai.type as type, ai.state, pt.categ_id, ai.date_due as date_due, ai.address_contact_id as address_contact_id, ai.address_invoice_id as address_invoice_id, ai.account_id as account_id, ai.partner_bank_id as partner_bank_id, sum(case when ai.type in ('out_refund','in_invoice') then ail.quantity * u.factor * -1 else ail.quantity * u.factor end) as product_qty, sum(case when ai.type in ('out_refund','in_invoice') then ail.quantity*ail.price_unit * -1 else ail.quantity*ail.price_unit end) as price_total, sum(case when ai.type in ('out_refund','in_invoice') then ai.amount_total * -1 else ai.amount_total end) as price_total_tax, (case when ai.type in ('out_refund','in_invoice') then sum(ail.quantity*ail.price_unit*-1) else sum(ail.quantity*ail.price_unit) end)/(case when ai.type in ('out_refund','in_invoice') then sum(ail.quantity*u.factor*-1) else sum(ail.quantity*u.factor) end) as price_average, sum((select extract(epoch from avg(date_trunc('day',aml.date_created)-date_trunc('day',l.create_date)))/(24*60*60)::decimal(16,2) from account_move_line as aml left join account_invoice as a ON (a.move_id=aml.move_id) left join account_invoice_line as l ON (a.id=l.invoice_id) where a.id=ai.id)) as delay_to_pay, (case when ai.type in ('out_refund','in_invoice') then ai.residual * -1 else ai.residual end)/(select count(l.*) from account_invoice_line as l left join account_invoice as a ON (a.id=l.invoice_id) where a.id=ai.id) as residual from account_invoice_line as ail left join account_invoice as ai ON (ai.id=ail.invoice_id) left join product_template pt on (pt.id=ail.product_id) left join product_uom u on (u.id=ail.uos_id) group by ail.product_id, ai.date_invoice, ai.id, to_char(ai.date_invoice, 'YYYY'), to_char(ai.date_invoice, 'MM'), to_char(ai.date_invoice, 'YYYY-MM-DD'), ai.partner_id, ai.payment_term, ai.period_id, u.name, ai.currency_id, ai.journal_id, ai.fiscal_position, ai.user_id, ai.company_id, ai.type, ai.state, pt.categ_id, ai.date_due, ai.address_contact_id, ai.address_invoice_id, ai.account_id, ai.partner_bank_id, ai.residual, ai.amount_total ) """)
469,559
def check_vat_sk(self, vat): ''' Check Slovakia VAT number. ''' try: int(vat) except: return False if len(vat) not in(9, 10): return False
def check_vat_sk(self, vat): ''' Check Slovakia VAT number. ''' try: int(vat) except: return False if len(vat) not in(9, 10): return False
469,560
def on_change_product_cost(self, cr, uid, ids, product_id, context=None): if context is None: context = {} value = {}
def on_change_product_cost(self, cr, uid, ids, product_id, context=None): if context is None: context = {} value = {}
469,561
def _costs_generate(self, cr, uid, production): """ Calculates total costs at the end of the production. @param production: Id of production order. @return: Calculated amount. """ amount = 0.0 analytic_line_obj = self.pool.get('account.analytic.line') for wc_line in production.workcenter_lines: wc = wc_line.workcenter_id if wc.costs_journal_id and wc.costs_general_account_id: value = wc_line.hour * wc.costs_hour account = wc.costs_hour_account_id.id if value and account: amount += value analytic_line_obj.create(cr, uid, { 'name': wc_line.name + ' (H)', 'amount': value, 'account_id': account, 'general_account_id': wc.costs_general_account_id.id, 'journal_id': wc.costs_journal_id.id, 'ref': wc.code, 'product_id': wc.product_id.id, 'unit_amount': wc.costs_hour * wc.time_cycle, 'product_uom_id': wc.product_id.uom_id.id } ) if wc.costs_journal_id and wc.costs_general_account_id: value = wc_line.cycle * wc.costs_cycle account = wc.costs_cycle_account_id.id if value and account: amount += value analytic_line_obj.create(cr, uid, { 'name': wc_line.name+' (C)', 'amount': value, 'account_id': account, 'general_account_id': wc.costs_general_account_id.id, 'journal_id': wc.costs_journal_id.id, 'ref': wc.code, 'product_id': wc.product_id.id, 'unit_amount': wc.costs_hour * wc.time_cycle, 'product_uom_id': wc.product_id.uom_id.id } ) return amount
def _costs_generate(self, cr, uid, production): """ Calculates total costs at the end of the production. @param production: Id of production order. @return: Calculated amount. """ amount = 0.0 analytic_line_obj = self.pool.get('account.analytic.line') for wc_line in production.workcenter_lines: wc = wc_line.workcenter_id if wc.costs_journal_id and wc.costs_general_account_id: value = wc_line.hour * wc.costs_hour account = wc.costs_hour_account_id.id if value and account: amount += value analytic_line_obj.create(cr, uid, { 'name': wc_line.name + ' (H)', 'amount': value, 'account_id': account, 'general_account_id': wc.costs_general_account_id.id, 'journal_id': wc.costs_journal_id.id, 'ref': wc.code, 'product_id': wc.product_id.id, 'unit_amount': wc_line.hour, 'product_uom_id': wc.product_id.uom_id.id } ) if wc.costs_journal_id and wc.costs_general_account_id: value = wc_line.cycle * wc.costs_cycle account = wc.costs_cycle_account_id.id if value and account: amount += value analytic_line_obj.create(cr, uid, { 'name': wc_line.name+' (C)', 'amount': value, 'account_id': account, 'general_account_id': wc.costs_general_account_id.id, 'journal_id': wc.costs_journal_id.id, 'ref': wc.code, 'product_id': wc.product_id.id, 'unit_amount': wc_line.hour, 'product_uom_id': wc.product_id.uom_id.id } ) return amount
469,562
def _costs_generate(self, cr, uid, production): """ Calculates total costs at the end of the production. @param production: Id of production order. @return: Calculated amount. """ amount = 0.0 analytic_line_obj = self.pool.get('account.analytic.line') for wc_line in production.workcenter_lines: wc = wc_line.workcenter_id if wc.costs_journal_id and wc.costs_general_account_id: value = wc_line.hour * wc.costs_hour account = wc.costs_hour_account_id.id if value and account: amount += value analytic_line_obj.create(cr, uid, { 'name': wc_line.name + ' (H)', 'amount': value, 'account_id': account, 'general_account_id': wc.costs_general_account_id.id, 'journal_id': wc.costs_journal_id.id, 'ref': wc.code, 'product_id': wc.product_id.id, 'unit_amount': wc.costs_hour * wc.time_cycle, 'product_uom_id': wc.product_id.uom_id.id } ) if wc.costs_journal_id and wc.costs_general_account_id: value = wc_line.cycle * wc.costs_cycle account = wc.costs_cycle_account_id.id if value and account: amount += value analytic_line_obj.create(cr, uid, { 'name': wc_line.name+' (C)', 'amount': value, 'account_id': account, 'general_account_id': wc.costs_general_account_id.id, 'journal_id': wc.costs_journal_id.id, 'ref': wc.code, 'product_id': wc.product_id.id, 'unit_amount': wc.costs_hour * wc.time_cycle, 'product_uom_id': wc.product_id.uom_id.id } ) return amount
def _costs_generate(self, cr, uid, production): """ Calculates total costs at the end of the production. @param production: Id of production order. @return: Calculated amount. """ amount = 0.0 analytic_line_obj = self.pool.get('account.analytic.line') for wc_line in production.workcenter_lines: wc = wc_line.workcenter_id if wc.costs_journal_id and wc.costs_general_account_id: value = wc_line.hour * wc.costs_hour account = wc.costs_hour_account_id.id if value and account: amount += value analytic_line_obj.create(cr, uid, { 'name': wc_line.name + ' (H)', 'amount': value, 'account_id': account, 'general_account_id': wc.costs_general_account_id.id, 'journal_id': wc.costs_journal_id.id, 'ref': wc.code, 'product_id': wc.product_id.id, 'unit_amount': wc_line.cycle, 'product_uom_id': wc.product_id.uom_id.id } ) if wc.costs_journal_id and wc.costs_general_account_id: value = wc_line.cycle * wc.costs_cycle account = wc.costs_cycle_account_id.id if value and account: amount += value analytic_line_obj.create(cr, uid, { 'name': wc_line.name+' (C)', 'amount': value, 'account_id': account, 'general_account_id': wc.costs_general_account_id.id, 'journal_id': wc.costs_journal_id.id, 'ref': wc.code, 'product_id': wc.product_id.id, 'unit_amount': wc_line.cycle, 'product_uom_id': wc.product_id.uom_id.id } ) return amount
469,563
def _get_company(self, cr, uid, ids, context={}): user_obj = self.pool.get('res.users') company_obj = self.pool.get('res.company') user = user_obj.browse(cr, uid, uid, context=context) if user.company_id: return user.company_id.id else: return company_obj.search(cr, uid, [('parent_id', '=', False)])[0]
def _get_company(self, cr, uid, context={}): user_obj = self.pool.get('res.users') company_obj = self.pool.get('res.company') user = user_obj.browse(cr, uid, uid, context=context) if user.company_id: return user.company_id.id else: return company_obj.search(cr, uid, [('parent_id', '=', False)])[0]
469,564
def onchange_user(self, cr, uid, ids, user_id, context=None): mail = self.pool.get('res.users').browse(cr,uid,user_id) return {'value': {'work_email':mail}}
def onchange_user(self, cr, uid, ids, user_id, context=None): mail = self.pool.get('res.users').browse(cr,uid,user_id) return {'value': {'work_email':mail.user_email}}
469,565
def compute_refund(self, cr, uid, ids, mode='refund', context=None): """ @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: the account invoice refund’s ID or list of IDs
def compute_refund(self, cr, uid, ids, mode='refund', context=None): """ @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: the account invoice refund’s ID or list of IDs
469,566
def unlink(self, cr, uid, ids, context={}): raise osv.except_osv(_('Error !'), _('You cannot delete any record!'))
def unlink(self, cr, uid, ids, context={}): raise osv.except_osv(_('Error !'), _('You cannot delete any record!'))
469,567
def init(self, cr): cr.execute(""" create or replace view report_stock_lines_date as ( select l.id as id, p.id as product_id, max(l.create_date) as create_date from product_product p left outer join stock_inventory_line l on (p.id=l.product_id) where l.create_date is not null group by p.id,l.id )""")
def init(self, cr): cr.execute(""" create or replace view report_stock_lines_date as ( select min(l.id) as id, p.id as product_id, max(l.create_date) as create_date from product_product p left outer join stock_inventory_line l on (p.id=l.product_id) where l.create_date is not null group by p.id,l.id )""")
469,568
def init(self, cr): cr.execute(""" create or replace view report_stock_lines_date as ( select l.id as id, p.id as product_id, max(l.create_date) as create_date from product_product p left outer join stock_inventory_line l on (p.id=l.product_id) where l.create_date is not null group by p.id,l.id )""")
def init(self, cr): cr.execute(""" create or replace view report_stock_lines_date as ( select l.id as id, p.id as product_id, max(s.date) as date from product_product p left outer join stock_inventory_line l on (p.id=l.product_id) where l.create_date is not null group by p.id,l.id )""")
469,569
def init(self, cr): cr.execute(""" create or replace view report_stock_lines_date as ( select l.id as id, p.id as product_id, max(l.create_date) as create_date from product_product p left outer join stock_inventory_line l on (p.id=l.product_id) where l.create_date is not null group by p.id,l.id )""")
def init(self, cr): cr.execute(""" create or replace view report_stock_lines_date as ( select l.id as id, p.id as product_id, max(l.create_date) as create_date from product_product p left outer join stock_inventory_line l on (p.id=l.product_id) where l.create_date is not null and s.state = 'done' group by p.id )""")
469,570
def __getitem__(self, name): if name == 'id': return self._id if name not in self._data[self._id]: # build the list of fields we will fetch
def __getitem__(self, name): if name == 'id': return self._id if name not in self._data[self._id]: # build the list of fields we will fetch
469,571
def create(self, cr, user, vals, context=None): """ create(cr, user, vals, context) -> int cr = database cursor user = user id vals = dictionary of the form {'field_name':field_value, ...} """ if not context: context = {} self.pool.get('ir.model.access').check(cr, user, self._name, 'create')
def create(self, cr, user, vals, context=None): """ create(cr, user, vals, context) -> int cr = database cursor user = user id vals = dictionary of the form {'field_name':field_value, ...} """ if not context: context = {} self.pool.get('ir.model.access').check(cr, user, self._name, 'create')
469,572
def populate_statement(self, cr, uid, ids, context=None):
def populate_statement(self, cr, uid, ids, context=None):
469,573
def populate_statement(self, cr, uid, ids, context=None):
def populate_statement(self, cr, uid, ids, context=None):
469,574
def exists(self, cr, uid, id, context=None): return id in self.datas
def__logger = logging.getLogger('orm') __schema = logging.getLogger('orm.schema') exists(self,__logger = logging.getLogger('orm') __schema = logging.getLogger('orm.schema') cr,__logger = logging.getLogger('orm') __schema = logging.getLogger('orm.schema') uid,__logger = logging.getLogger('orm') __schema = logging.getLogger('orm.schema') id,__logger = logging.getLogger('orm') __schema = logging.getLogger('orm.schema') context=None):__logger = logging.getLogger('orm') __schema = logging.getLogger('orm.schema') return__logger = logging.getLogger('orm') __schema = logging.getLogger('orm.schema') id__logger = logging.getLogger('orm') __schema = logging.getLogger('orm.schema') in__logger = logging.getLogger('orm') __schema = logging.getLogger('orm.schema') self.datas
469,575
def _check_removed_columns(self, cr, log=False): logger = netsvc.Logger() # iterate on the database columns to drop the NOT NULL constraints # of fields which were required but have been removed (or will be added by another module) columns = [c for c in self._columns if not (isinstance(self._columns[c], fields.function) and not self._columns[c].store)] columns += ('id', 'write_uid', 'write_date', 'create_uid', 'create_date') # openerp access columns cr.execute("SELECT a.attname, a.attnotnull" " FROM pg_class c, pg_attribute a" " WHERE c.relname=%s" " AND c.oid=a.attrelid" " AND a.attisdropped=%s" " AND pg_catalog.format_type(a.atttypid, a.atttypmod) NOT IN ('cid', 'tid', 'oid', 'xid')" " AND a.attname NOT IN %s", (self._table, False, tuple(columns))),
def _check_removed_columns(self, cr, log=False): # iterate on the database columns to drop the NOT NULL constraints # of fields which were required but have been removed (or will be added by another module) columns = [c for c in self._columns if not (isinstance(self._columns[c], fields.function) and not self._columns[c].store)] columns += ('id', 'write_uid', 'write_date', 'create_uid', 'create_date') # openerp access columns cr.execute("SELECT a.attname, a.attnotnull" " FROM pg_class c, pg_attribute a" " WHERE c.relname=%s" " AND c.oid=a.attrelid" " AND a.attisdropped=%s" " AND pg_catalog.format_type(a.atttypid, a.atttypmod) NOT IN ('cid', 'tid', 'oid', 'xid')" " AND a.attname NOT IN %s", (self._table, False, tuple(columns))),
469,576
def _check_removed_columns(self, cr, log=False): logger = netsvc.Logger() # iterate on the database columns to drop the NOT NULL constraints # of fields which were required but have been removed (or will be added by another module) columns = [c for c in self._columns if not (isinstance(self._columns[c], fields.function) and not self._columns[c].store)] columns += ('id', 'write_uid', 'write_date', 'create_uid', 'create_date') # openerp access columns cr.execute("SELECT a.attname, a.attnotnull" " FROM pg_class c, pg_attribute a" " WHERE c.relname=%s" " AND c.oid=a.attrelid" " AND a.attisdropped=%s" " AND pg_catalog.format_type(a.atttypid, a.atttypmod) NOT IN ('cid', 'tid', 'oid', 'xid')" " AND a.attname NOT IN %s", (self._table, False, tuple(columns))),
def _check_removed_columns(self, cr, log=False): logger = netsvc.Logger() # iterate on the database columns to drop the NOT NULL constraints # of fields which were required but have been removed (or will be added by another module) columns = [c for c in self._columns if not (isinstance(self._columns[c], fields.function) and not self._columns[c].store)] columns += ('id', 'write_uid', 'write_date', 'create_uid', 'create_date') # openerp access columns cr.execute("SELECT a.attname, a.attnotnull" " FROM pg_class c, pg_attribute a" " WHERE c.relname=%s" " AND c.oid=a.attrelid" " AND a.attisdropped=%s" " AND pg_catalog.format_type(a.atttypid, a.atttypmod) NOT IN ('cid', 'tid', 'oid', 'xid')" " AND a.attname NOT IN %s", (self._table, False, tuple(columns))),
469,577
def _check_removed_columns(self, cr, log=False): logger = netsvc.Logger() # iterate on the database columns to drop the NOT NULL constraints # of fields which were required but have been removed (or will be added by another module) columns = [c for c in self._columns if not (isinstance(self._columns[c], fields.function) and not self._columns[c].store)] columns += ('id', 'write_uid', 'write_date', 'create_uid', 'create_date') # openerp access columns cr.execute("SELECT a.attname, a.attnotnull" " FROM pg_class c, pg_attribute a" " WHERE c.relname=%s" " AND c.oid=a.attrelid" " AND a.attisdropped=%s" " AND pg_catalog.format_type(a.atttypid, a.atttypmod) NOT IN ('cid', 'tid', 'oid', 'xid')" " AND a.attname NOT IN %s", (self._table, False, tuple(columns))),
def _check_removed_columns(self, cr, log=False): logger = netsvc.Logger() # iterate on the database columns to drop the NOT NULL constraints # of fields which were required but have been removed (or will be added by another module) columns = [c for c in self._columns if not (isinstance(self._columns[c], fields.function) and not self._columns[c].store)] columns += ('id', 'write_uid', 'write_date', 'create_uid', 'create_date') # openerp access columns cr.execute("SELECT a.attname, a.attnotnull" " FROM pg_class c, pg_attribute a" " WHERE c.relname=%s" " AND c.oid=a.attrelid" " AND a.attisdropped=%s" " AND pg_catalog.format_type(a.atttypid, a.atttypmod) NOT IN ('cid', 'tid', 'oid', 'xid')" " AND a.attname NOT IN %s", (self._table, False, tuple(columns))),
469,578
def _auto_init(self, cr, context={}): store_compute = False logger = netsvc.Logger() create = False todo_end = [] self._field_create(cr, context=context) if getattr(self, '_auto', True): cr.execute("SELECT relname FROM pg_class WHERE relkind IN ('r','v') AND relname=%s", (self._table,)) if not cr.rowcount: cr.execute('CREATE TABLE "%s" (id SERIAL NOT NULL, PRIMARY KEY(id)) WITHOUT OIDS' % (self._table,)) cr.execute("COMMENT ON TABLE \"%s\" IS '%s'" % (self._table, self._description.replace("'", "''"))) create = True
def _auto_init(self, cr, context={}): store_compute = False create = False todo_end = [] self._field_create(cr, context=context) if getattr(self, '_auto', True): cr.execute("SELECT relname FROM pg_class WHERE relkind IN ('r','v') AND relname=%s", (self._table,)) if not cr.rowcount: cr.execute('CREATE TABLE "%s" (id SERIAL NOT NULL, PRIMARY KEY(id)) WITHOUT OIDS' % (self._table,)) cr.execute("COMMENT ON TABLE \"%s\" IS '%s'" % (self._table, self._description.replace("'", "''"))) create = True
469,579
def _auto_init(self, cr, context={}): store_compute = False logger = netsvc.Logger() create = False todo_end = [] self._field_create(cr, context=context) if getattr(self, '_auto', True): cr.execute("SELECT relname FROM pg_class WHERE relkind IN ('r','v') AND relname=%s", (self._table,)) if not cr.rowcount: cr.execute('CREATE TABLE "%s" (id SERIAL NOT NULL, PRIMARY KEY(id)) WITHOUT OIDS' % (self._table,)) cr.execute("COMMENT ON TABLE \"%s\" IS '%s'" % (self._table, self._description.replace("'", "''"))) create = True
def _auto_init(self, cr, context={}): store_compute = False logger = netsvc.Logger() create = False todo_end = [] self._field_create(cr, context=context) if getattr(self, '_auto', True): cr.execute("SELECT relname FROM pg_class WHERE relkind IN ('r','v') AND relname=%s", (self._table,)) if not cr.rowcount: cr.execute('CREATE TABLE "%s" (id SERIAL NOT NULL, PRIMARY KEY(id)) WITHOUT OIDS' % (self._table,)) cr.execute("COMMENT ON TABLE \"%s\" IS '%s'" % (self._table, self._description.replace("'", "''"))) create = True
469,580
def _auto_init(self, cr, context={}): store_compute = False logger = netsvc.Logger() create = False todo_end = [] self._field_create(cr, context=context) if getattr(self, '_auto', True): cr.execute("SELECT relname FROM pg_class WHERE relkind IN ('r','v') AND relname=%s", (self._table,)) if not cr.rowcount: cr.execute('CREATE TABLE "%s" (id SERIAL NOT NULL, PRIMARY KEY(id)) WITHOUT OIDS' % (self._table,)) cr.execute("COMMENT ON TABLE \"%s\" IS '%s'" % (self._table, self._description.replace("'", "''"))) create = True
def _auto_init(self, cr, context={}): store_compute = False logger = netsvc.Logger() create = False todo_end = [] self._field_create(cr, context=context) if getattr(self, '_auto', True): cr.execute("SELECT relname FROM pg_class WHERE relkind IN ('r','v') AND relname=%s", (self._table,)) if not cr.rowcount: cr.execute('CREATE TABLE "%s" (id SERIAL NOT NULL, PRIMARY KEY(id)) WITHOUT OIDS' % (self._table,)) cr.execute("COMMENT ON TABLE \"%s\" IS '%s'" % (self._table, self._description.replace("'", "''"))) create = True
469,581
def _auto_init(self, cr, context={}): store_compute = False logger = netsvc.Logger() create = False todo_end = [] self._field_create(cr, context=context) if getattr(self, '_auto', True): cr.execute("SELECT relname FROM pg_class WHERE relkind IN ('r','v') AND relname=%s", (self._table,)) if not cr.rowcount: cr.execute('CREATE TABLE "%s" (id SERIAL NOT NULL, PRIMARY KEY(id)) WITHOUT OIDS' % (self._table,)) cr.execute("COMMENT ON TABLE \"%s\" IS '%s'" % (self._table, self._description.replace("'", "''"))) create = True
def _auto_init(self, cr, context={}): store_compute = False logger = netsvc.Logger() create = False todo_end = [] self._field_create(cr, context=context) if getattr(self, '_auto', True): cr.execute("SELECT relname FROM pg_class WHERE relkind IN ('r','v') AND relname=%s", (self._table,)) if not cr.rowcount: cr.execute('CREATE TABLE "%s" (id SERIAL NOT NULL, PRIMARY KEY(id)) WITHOUT OIDS' % (self._table,)) cr.execute("COMMENT ON TABLE \"%s\" IS '%s'" % (self._table, self._description.replace("'", "''"))) create = True
469,582
def _auto_init(self, cr, context={}): store_compute = False logger = netsvc.Logger() create = False todo_end = [] self._field_create(cr, context=context) if getattr(self, '_auto', True): cr.execute("SELECT relname FROM pg_class WHERE relkind IN ('r','v') AND relname=%s", (self._table,)) if not cr.rowcount: cr.execute('CREATE TABLE "%s" (id SERIAL NOT NULL, PRIMARY KEY(id)) WITHOUT OIDS' % (self._table,)) cr.execute("COMMENT ON TABLE \"%s\" IS '%s'" % (self._table, self._description.replace("'", "''"))) create = True
def _auto_init(self, cr, context={}): store_compute = False logger = netsvc.Logger() create = False todo_end = [] self._field_create(cr, context=context) if getattr(self, '_auto', True): cr.execute("SELECT relname FROM pg_class WHERE relkind IN ('r','v') AND relname=%s", (self._table,)) if not cr.rowcount: cr.execute('CREATE TABLE "%s" (id SERIAL NOT NULL, PRIMARY KEY(id)) WITHOUT OIDS' % (self._table,)) cr.execute("COMMENT ON TABLE \"%s\" IS '%s'" % (self._table, self._description.replace("'", "''"))) create = True
469,583
def _auto_init(self, cr, context={}): store_compute = False logger = netsvc.Logger() create = False todo_end = [] self._field_create(cr, context=context) if getattr(self, '_auto', True): cr.execute("SELECT relname FROM pg_class WHERE relkind IN ('r','v') AND relname=%s", (self._table,)) if not cr.rowcount: cr.execute('CREATE TABLE "%s" (id SERIAL NOT NULL, PRIMARY KEY(id)) WITHOUT OIDS' % (self._table,)) cr.execute("COMMENT ON TABLE \"%s\" IS '%s'" % (self._table, self._description.replace("'", "''"))) create = True
def _auto_init(self, cr, context={}): store_compute = False logger = netsvc.Logger() create = False todo_end = [] self._field_create(cr, context=context) if getattr(self, '_auto', True): cr.execute("SELECT relname FROM pg_class WHERE relkind IN ('r','v') AND relname=%s", (self._table,)) if not cr.rowcount: cr.execute('CREATE TABLE "%s" (id SERIAL NOT NULL, PRIMARY KEY(id)) WITHOUT OIDS' % (self._table,)) cr.execute("COMMENT ON TABLE \"%s\" IS '%s'" % (self._table, self._description.replace("'", "''"))) create = True
469,584
def _auto_init(self, cr, context={}): store_compute = False logger = netsvc.Logger() create = False todo_end = [] self._field_create(cr, context=context) if getattr(self, '_auto', True): cr.execute("SELECT relname FROM pg_class WHERE relkind IN ('r','v') AND relname=%s", (self._table,)) if not cr.rowcount: cr.execute('CREATE TABLE "%s" (id SERIAL NOT NULL, PRIMARY KEY(id)) WITHOUT OIDS' % (self._table,)) cr.execute("COMMENT ON TABLE \"%s\" IS '%s'" % (self._table, self._description.replace("'", "''"))) create = True
def _auto_init(self, cr, context={}): store_compute = False logger = netsvc.Logger() create = False todo_end = [] self._field_create(cr, context=context) if getattr(self, '_auto', True): cr.execute("SELECT relname FROM pg_class WHERE relkind IN ('r','v') AND relname=%s", (self._table,)) if not cr.rowcount: cr.execute('CREATE TABLE "%s" (id SERIAL NOT NULL, PRIMARY KEY(id)) WITHOUT OIDS' % (self._table,)) cr.execute("COMMENT ON TABLE \"%s\" IS '%s'" % (self._table, self._description.replace("'", "''"))) create = True
469,585
def _auto_init(self, cr, context={}): store_compute = False logger = netsvc.Logger() create = False todo_end = [] self._field_create(cr, context=context) if getattr(self, '_auto', True): cr.execute("SELECT relname FROM pg_class WHERE relkind IN ('r','v') AND relname=%s", (self._table,)) if not cr.rowcount: cr.execute('CREATE TABLE "%s" (id SERIAL NOT NULL, PRIMARY KEY(id)) WITHOUT OIDS' % (self._table,)) cr.execute("COMMENT ON TABLE \"%s\" IS '%s'" % (self._table, self._description.replace("'", "''"))) create = True
def _auto_init(self, cr, context={}): store_compute = False logger = netsvc.Logger(create = False todo_end = [] self._field_create(cr, context=contextif getattr(self, '_auto', True): cr.execute("SELECT relname FROM pg_class WHERE relkind IN ('r','v'AND relname=%s", (self._table,)if not cr.rowcount: cr.execute('CREATE TABLE "%s" (id SERIAL NOT NULL, PRIMARY KEY(id)WITHOUT OIDS' % (self._table,)cr.execute("COMMENT ON TABLE \"%s\" IS '%s'" % (self._table, self._description.replace("'", "''"))create = True
469,586
def _auto_init(self, cr, context={}): store_compute = False logger = netsvc.Logger() create = False todo_end = [] self._field_create(cr, context=context) if getattr(self, '_auto', True): cr.execute("SELECT relname FROM pg_class WHERE relkind IN ('r','v') AND relname=%s", (self._table,)) if not cr.rowcount: cr.execute('CREATE TABLE "%s" (id SERIAL NOT NULL, PRIMARY KEY(id)) WITHOUT OIDS' % (self._table,)) cr.execute("COMMENT ON TABLE \"%s\" IS '%s'" % (self._table, self._description.replace("'", "''"))) create = True
def _auto_init(self, cr, context={}): store_compute = False logger = netsvc.Logger() create = False todo_end = [] self._field_create(cr, context=context) if getattr(self, '_auto', True): cr.execute("SELECT relname FROM pg_class WHERE relkind IN ('r','v') AND relname=%s", (self._table,)) if not cr.rowcount: cr.execute('CREATE TABLE "%s" (id SERIAL NOT NULL, PRIMARY KEY(id)) WITHOUT OIDS' % (self._table,)) cr.execute("COMMENT ON TABLE \"%s\" IS '%s'" % (self._table, self._description.replace("'", "''"))) create = True
469,587
def _auto_init(self, cr, context={}): store_compute = False logger = netsvc.Logger() create = False todo_end = [] self._field_create(cr, context=context) if getattr(self, '_auto', True): cr.execute("SELECT relname FROM pg_class WHERE relkind IN ('r','v') AND relname=%s", (self._table,)) if not cr.rowcount: cr.execute('CREATE TABLE "%s" (id SERIAL NOT NULL, PRIMARY KEY(id)) WITHOUT OIDS' % (self._table,)) cr.execute("COMMENT ON TABLE \"%s\" IS '%s'" % (self._table, self._description.replace("'", "''"))) create = True
def _auto_init(self, cr, context={}): store_compute = False logger = netsvc.Logger() create = False todo_end = [] self._field_create(cr, context=context) if getattr(self, '_auto', True): cr.execute("SELECT relname FROM pg_class WHERE relkind IN ('r','v') AND relname=%s", (self._table,)) if not cr.rowcount: cr.execute('CREATE TABLE "%s" (id SERIAL NOT NULL, PRIMARY KEY(id)) WITHOUT OIDS' % (self._table,)) cr.execute("COMMENT ON TABLE \"%s\" IS '%s'" % (self._table, self._description.replace("'", "''"))) create = True
469,588
f_pg_def = res[0]
f_pg_def = res[0]
469,589
f_pg_def = res[0]
f_pg_def = res[0]
469,590
f_pg_def = res[0]
f_pg_def = res[0]
469,591
f_pg_def = res[0]
f_pg_def = res[0]
469,592
f_pg_def = res[0]
f_pg_def = res[0]
469,593
f_pg_def = res[0]
f_pg_def = res[0]
469,594
f_pg_def = res[0]
f_pg_def = res[0]
469,595
f_pg_def = res[0]
f_pg_def = res[0]
469,596
f_pg_def = res[0]
f_pg_def = res[0]
469,597
f_pg_def = res[0]
f_pg_def = res[0]
469,598
f_pg_def = res[0]
f_pg_def = res[0]
469,599