rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
for order_id in order_obj.browse(cr, uid, [record_id], context=context):
for order_id in order_obj.browse(cr, uid, [active_id], context=context):
def close_action(self, cr, uid, ids, context):
obj=order_obj.browse(cr,uid, record_id)
obj=order_obj.browse(cr,uid, active_id)
def close_action(self, cr, uid, ids, context):
'context ':context and context.get('record_id', False),
'context ':context and context.get('active_id', False),
def close_action(self, cr, uid, ids, context):
al.dp as date,
date_trunc('day',al.dp) as date,
def init(self, cr): tools.drop_view_if_exists(cr, 'report_stock_move') cr.execute(""" CREATE OR REPLACE view report_stock_move AS ( SELECT min(sm_id) as id, al.dp as date, al.curr_year as year, al.curr_month as month, al.curr_day as day, al.curr_day_diff as day_diff, al.curr_day_diff1 as day_diff1, al.curr_day_diff2 as...
def unlink(self, cr, uid, ids, context={}):
def unlink(self, cr, uid, ids, context=None):
def unlink(self, cr, uid, ids, context={}): stor = self.pool.get('document.storage') unres = [] # We have to do the unlink in 2 stages: prepare a list of actual # files to be unlinked, update the db (safer to do first, can be # rolled back) and then unlink the files. The list wouldn't exist # after we discard the objec...
r = stor.prepare_unlink(cr, uid, f.parent_id.storage_id, f)
par = f.parent_id storage_id = None while par: if par.storage_id: storage_id = par.storage_id break par = par.parent_id assert storage_id, "Strange, found file r = stor.prepare_unlink(cr, uid, storage_id, f)
def unlink(self, cr, uid, ids, context={}): stor = self.pool.get('document.storage') unres = [] # We have to do the unlink in 2 stages: prepare a list of actual # files to be unlinked, update the db (safer to do first, can be # rolled back) and then unlink the files. The list wouldn't exist # after we discard the objec...
partner_address_id = val_invoice['value']['address_invoice_id'] value = inv_lines_pool.product_id_change(cr, uid, [], reg.event_id.product_id.id, uom =False, partner_id=reg.partner_invoice_id.id, fposition_id=reg.partner_invoice_id.property_account_position.id) l = inv_lines_pool.read(cr, uid, lines)
def _make_invoice(self, cr, uid, reg, lines, context=None): """ Create Invoice from Invoice lines @param reg : Model of Event Registration @param lines: Ids of Invoice lines """ if context is None: context = {} inv_pool = self.pool.get('account.invoice') inv_lines_pool = self.pool.get('account.invoice.line')
contact_id = contact_obj.browse(cr, uid, contact)
def onchange_contact_id(self, cr, uid, ids, contact, partner):
res.update({'text': '\n\n'+(case.user_id.signature or '') + '\n\n' + (case.description or '')})
res.update({'text': '\n\n'+(case.user_id.signature or '')})
def default_get(self, cr, uid, fields, context=None): """ This function gets default values """ if not context: context = {}
nodes = doc.xpath("//page[@name='journal_ids']")
nodes = doc.xpath("//field[@name='journal_ids']")
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): mod_obj = self.pool.get('ir.model.data') res = super(account_bs_report, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=False) doc = etree.XML(re...
node.set('invisible', '1')
node.set('readonly', '1') node.set('required', '0')
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): mod_obj = self.pool.get('ir.model.data') res = super(account_bs_report, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=False) doc = etree.XML(re...
def copy(self, cr, uid, id, default=None, context=None): if default is None: default = {} default = default.copy() default.update({'line_ids': []}) return super(account_tax_code, self).copy(cr, uid, id, default, context)
def _check_recursion(self, cr, uid, ids): level = 100 while len(ids): cr.execute('select distinct parent_id from account_tax_code where id =ANY(%s)',(ids,)) ids = filter(None, map(lambda x:x[0], cr.fetchall())) if not level: return False level -= 1 return True
except : raise Exception(exceptions.html_error_template().render())
except Exception, e: raise except_osv(exceptions.html_error_template().render())
def create_single_pdf(self, cursor, uid, ids, data, report_xml, context=None): """generate the PDF""" if context is None: context={} if report_xml.report_type != 'webkit': return super(WebKitParser,self).create_single_pdf(cursor, uid, ids, data, report_xml, context=context)
raise Exception(exceptions.html_error_template().render())
raise except_osv(exceptions.html_error_template().render())
def create_single_pdf(self, cursor, uid, ids, data, report_xml, context=None): """generate the PDF""" if context is None: context={} if report_xml.report_type != 'webkit': return super(WebKitParser,self).create_single_pdf(cursor, uid, ids, data, report_xml, context=context)
raise osv.except_osv(_('Warning !'),_('Not Available. Moves are not confirmed.'))
raise osv.except_osv(_('Warning !'),_('Not enough stock, unable to reserve the products.'))
def action_assign(self, cr, uid, ids, *args): """ Changes state of picking to available if all moves are confirmed. @return: True """ for pick in self.browse(cr, uid, ids): move_ids = [x.id for x in pick.move_lines if x.state == 'confirmed'] if not move_ids: raise osv.except_osv(_('Warning !'),_('Not Available. Moves a...
'partner_id': fields.related('line_id', 'partner_id', type="many2one", relation="res.partner", string="Partner"),
'partner_id': fields.related('line_id', 'partner_id', type="many2one", relation="res.partner", string="Partner", store=True),
def _search_amount(self, cr, uid, obj, name, args, context): ids = set() for cond in args: amount = cond[2] if isinstance(cond[2],(list,tuple)): if cond[1] in ['in','not in']: amount = tuple(cond[2]) else: continue else: if cond[1] in ['=like', 'like', 'not like', 'ilike', 'not ilike', 'in', 'not in', 'child_of']: cont...
def copy(self, cr, uid, id, default=None, context=None): if default is None: default = {} if context is None: context = {} default = default.copy() default['member_lines'] = [] return super(Partner, self).copy(cr, uid, id, default, context)
def _check_recursion(self, cr, uid, ids): level = 100 while len(ids): cr.execute('select distinct associate_member from res_partner where id =ANY(%s)',(ids,)) ids = filter(None, map(lambda x:x[0], cr.fetchall())) if not level: return False level -= 1 return True
copy_val += " or '" + null_value + "'"
copy_val += " or '''%s'''" % null_value
def compute_pl(self, model_object_field, sub_model_object_field, null_value, template_language='mako'): """ Returns the expression based on data provided @param model_object_field: First level field @param sub_model_object_field: Second level drilled down field (M2O) @param null_value: What has to be returned if the va...
copy_val = copy_val + '|default:"' + null_value + '"'
copy_val = copy_val + "|default:'''%s'''" % null_value
def compute_pl(self, model_object_field, sub_model_object_field, null_value, template_language='mako'): """ Returns the expression based on data provided @param model_object_field: First level field @param sub_model_object_field: Second level drilled down field (M2O) @param null_value: What has to be returned if the va...
fobj.import_cal(cr, uid, base64.encodestring(data), context=ctx)
fobj.import_cal(cr, uid, base64.encodestring(data), context=context)
def process_write(self, cr, uid, node, data, context=None): if node.extension != '.ics': return super(document_directory_content, self).process_write(cr, uid, node, data, context) content = self.browse(cr, uid, node.cnt_id, context) fobj = self.pool.get(content.object_id.model) fobj.import_cal(cr, uid, base64.encodestr...
message = (n +" '" + case.name + "' "+ _("has been closed.")
message = n +" '" + case.name + "' "+ _("has been closed.")
def case_close(self, cr, uid, ids, *args): """Overrides close for crm_case for setting close date @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 ids: List of case Ids @param *args: Tuple Value for additional Params """ ...
raise except_orm(_('UnknownError'), str(e))
raise
def create(self, cr, uid, vals, context={}): try: res = super(account_invoice, self).create(cr, uid, vals, context) return res except Exception,e: if '"journal_id" viol' in e.args[0]: raise except_orm(_('Configuration Error!'), _('There is no Accounting Journal of type Sale/Purchase defined!')) else: raise except_orm(_...
m = self.pool.get('account.move').browse(cr, uid, vals['move_id']) journal_id = m.journal_id.id period_id = m.period_id.id
if vals['move_id']: m = self.pool.get('account.move').browse(cr, uid, vals['move_id']) journal_id = m.journal_id.id period_id = m.period_id.id
def _check_date(self, cr, uid, vals, context=None, check=True): if context is None: context = {} journal_id = False if 'date' in vals.keys(): if 'journal_id' in vals and 'journal_id' not in context: journal_id = vals['journal_id'] if 'period_id' in vals and 'period_id' not in context: period_id = vals['period_id'] elif...
cr.execute(query, (ids,))
cr.execute(query, (tuple(ids),))
def _get_answers(cr, uid, ids): """ @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of crm profiling’s IDs """ query = """ select distinct(answer) from profile_question_yes_rel where profile IN %s""" cr.execute(query, (ids,)) ans_yes = [x[0...
'name': subject or 'History',
'name': subject or _('History'),
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, email_cc=None, \ email_bcc=None, email_date=None, context=None): """ @param self: The object pointer @param cr: the current row, from the database cursor...
msg_txt += (message.email_from or '/') + ' wrote on ' + format_date_tz(message.date, tz) + ':\n\t'
msg_txt += (message.email_from or '/') + _(' wrote on ') + format_date_tz(message.date, tz) + ':\n\t'
def _get_display_text(self, cr, uid, ids, name, arg, context=None): if context is None: context = {} tz = context.get('tz') result = {} for message in self.browse(cr, uid, ids, context=context): msg_txt = '' if message.history: msg_txt += (message.email_from or '/') + ' wrote on ' + format_date_tz(message.date, tz) + '...
msg_txt = (message.user_id.name or '/') + ' on ' + format_date_tz(message.date, tz) + ':\n\t' if message.name == 'Opportunity': msg_txt += "Converted to Opportunity"
msg_txt = (message.user_id.name or '/') + _(' on ') + format_date_tz(message.date, tz) + ':\n\t' if message.name == _('Opportunity'): msg_txt += _("Converted to Opportunity")
def _get_display_text(self, cr, uid, ids, name, arg, context=None): if context is None: context = {} tz = context.get('tz') result = {} for message in self.browse(cr, uid, ids, context=context): msg_txt = '' if message.history: msg_txt += (message.email_from or '/') + ' wrote on ' + format_date_tz(message.date, tz) + '...
msg_txt += "Changed Status to: " + message.name
msg_txt += _("Changed Status to: ") + message.name
def _get_display_text(self, cr, uid, ids, name, arg, context=None): if context is None: context = {} tz = context.get('tz') result = {} for message in self.browse(cr, uid, ids, context=context): msg_txt = '' if message.history: msg_txt += (message.email_from or '/') + ' wrote on ' + format_date_tz(message.date, tz) + '...
'type': fields.selection([('sale', 'Sale'), ('purchase', 'Purchase'), ('expanse', 'Expanse'), ('cash', 'Cash'), ('bank', 'Bank'), ('general', 'General'), ('situation', 'Situation')], 'Type', size=32, required=True,
'type': fields.selection([('sale', 'Sale'), ('purchase', 'Purchase'), ('expense', 'Expense'), ('cash', 'Cash'), ('bank', 'Bank'), ('general', 'General'), ('situation', 'Situation')], 'Type', size=32, required=True,
def _col_get(self, cr, user, context={}): result = [] cols = self.pool.get('account.move.line')._columns for col in cols: result.append( (col, cols[col].string) ) result.sort() return result
'grows': fields.function(_calculate, method=True, store=True, multi='dc', string='Gross Salary', type='float', digits=(16, int(config['price_accuracy']))), 'net': fields.function(_calculate, method=True, store=True, multi='dc', string='Net Salary', digits=(16, int(config['price_accuracy']))), 'allounce': fields.functio...
'grows': fields.function(_calculate, method=True, store=True, multi='dc', string='Gross Salary', type='float', digits=(16, 4))), 'net': fields.function(_calculate, method=True, store=True, multi='dc', string='Net Salary', digits=(16, 4)), 'allounce': fields.function(_calculate, method=True, store=True, multi='dc', stri...
def _calculate(self, cr, uid, ids, field_names, arg, context): res = {} allounce = 0.0 deduction = 0.0 net = 0.0 grows = 0.0 for register in self.browse(cr, uid, ids, context): for slip in register.line_ids: allounce += slip.allounce deduction += slip.deduction net += slip.net grows += slip.grows
'amount': fields.float('Amount', digits=(16, int(config['price_accuracy']))), 'bysal': fields.float('By Salary', digits=(16, int(config['price_accuracy']))),
'amount': fields.float('Amount', digits=(16, 4)), 'bysal': fields.float('By Salary', digits=(16, 4)),
def cancel_sheet(self, cr, uid, ids, context={}): self.write(cr, uid, ids, {'state':'cancel'}) return True
'yearly_total_by_emp': fields.function(_total_contrib, method=True, multi='dc', store=True, string='Total By Employee', digits=(16, int(config['price_accuracy']))), 'yearly_total_by_comp': fields.function(_total_contrib, method=True, multi='dc', store=True, string='Total By Company', digits=(16, int(config['price_accu...
'yearly_total_by_emp': fields.function(_total_contrib, method=True, multi='dc', store=True, string='Total By Employee', digits=(16, 4)), 'yearly_total_by_comp': fields.function(_total_contrib, method=True, multi='dc', store=True, string='Total By Company', digits=(16, 4)), 'monthly_total_by_emp': fields.function(_tota...
def _total_contrib(self, cr, uid, ids, field_names, arg, context={}): line_pool = self.pool.get('hr.contibution.register.line') period_id = self.pool.get('account.period').search(cr,uid,[('date_start','<=',time.strftime('%Y-%m-%d')),('date_stop','>=',time.strftime('%Y-%m-%d'))])[0] fiscalyear_id = self.pool.get('accoun...
'emp_deduction': fields.float('Employee Deduction', digits=(16, int(config['price_accuracy']))), 'comp_deduction': fields.float('Company Deduction', digits=(16, int(config['price_accuracy']))), 'total': fields.function(_total, method=True, store=True, string='Total', digits=(16, int(config['price_accuracy']))),
'emp_deduction': fields.float('Employee Deduction', digits=(16, 4)), 'comp_deduction': fields.float('Company Deduction', digits=(16, 4)), 'total': fields.function(_total, method=True, store=True, string='Total', digits=(16, 4)),
def _total(self, cr, uid, ids, field_names, arg, context): res={} for line in self.browse(cr, uid, ids, context): res[line.id] = line.emp_deduction + line.comp_deduction return res
'contribute_per':fields.float('Contribution', digits=(16, int(config['price_accuracy'])), help='Define Company contribution ratio 1.00=100% contribution, If Employee Contribute 5% then company will and here 0.50 defined then company will contribute 50% on employee 5% contribution'),
'contribute_per':fields.float('Contribution', digits=(16, 4), help='Define Company contribution ratio 1.00=100% contribution, If Employee Contribute 5% then company will and here 0.50 defined then company will contribute 50% on employee 5% contribution'),
def _total(self, cr, uid, ids, field_names, arg, context): res={} for line in self.browse(cr, uid, ids, context): res[line.id] = line.emp_deduction + line.comp_deduction return res
'from_val': fields.float('From', digits=(16, int(config['price_accuracy']))), 'to_val': fields.float('To', digits=(16, int(config['price_accuracy']))),
'from_val': fields.float('From', digits=(16, 4)), 'to_val': fields.float('To', digits=(16, 4)),
def execute_function(self, cr, uid, id, value, context): """ self: pointer to self object cr: cursor to database uid: user id of current executer """
'value': fields.float('Value', digits=(16, int(config['price_accuracy']))),
'value': fields.float('Value', digits=(16, 4)),
def execute_function(self, cr, uid, id, value, context): """ self: pointer to self object cr: cursor to database uid: user id of current executer """
'total': fields.float('Sub Total', readonly=True, digits=(16, int(config['price_accuracy']))),
'total': fields.float('Sub Total', readonly=True, digits=(16, 4)),
def onchange_amount(self, cr, uid, ids, amount, typ): amt = amount if typ and typ == 'per': if int(amt) > 0: amt = amt / 100 return {'value':{'amount':amt}}
'company_contrib': fields.float('Company Contribution', readonly=True, digits=(16, int(config['price_accuracy']))),
'company_contrib': fields.float('Company Contribution', readonly=True, digits=(16, 4)),
def onchange_amount(self, cr, uid, ids, amount, typ): amt = amount if typ and typ == 'per': if int(amt) > 0: amt = amt / 100 return {'value':{'amount':amt}}
'from_val': fields.float('From', digits=(16, int(config['price_accuracy']))), 'to_val': fields.float('To', digits=(16, int(config['price_accuracy']))),
'from_val': fields.float('From', digits=(16, 4)), 'to_val': fields.float('To', digits=(16, 4)),
def execute_function(self, cr, uid, id, value, context): line_pool = self.pool.get('hr.payslip.line.line') res = 0 ids = line_pool.search(cr, uid, [('slipline_id','=',id), ('from_val','<=',value), ('to_val','>=',value)])
'value': fields.float('Value', digits=(16, int(config['price_accuracy']))),
'value': fields.float('Value', digits=(16, 4)),
def execute_function(self, cr, uid, id, value, context): line_pool = self.pool.get('hr.payslip.line.line') res = 0 ids = line_pool.search(cr, uid, [('slipline_id','=',id), ('from_val','<=',value), ('to_val','>=',value)])
'amount_original': fields.function(_compute_balance, method=True, multi='dc', type='float', string='Originial Amount', store=True),
'amount_original': fields.function(_compute_balance, method=True, multi='dc', type='float', string='Original Amount', store=True),
def _compute_balance(self, cr, uid, ids, name, args, context=None): currency_pool = self.pool.get('res.currency') rs_data = {} for line in self.browse(cr, uid, ids, context=context): res = {} company_currency = line.voucher_id.journal_id.company_id.currency_id.id voucher_currency = line.voucher_id.currency_id.id move_l...
message = _("The lead '%s' has been opened.") % name
message = _("The lead '%s' has been opened.") % case.name
def case_open(self, cr, uid, ids, *args): """Overrides cancel for crm_case for setting Open Date @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 ids: List of case's Ids @param *args: Give Tuple Value """ old_state = self...
message = _("The opportunity '%s' has been opened.") % name
message = _("The opportunity '%s' has been opened.") % case.name
def case_open(self, cr, uid, ids, *args): """Overrides cancel for crm_case for setting Open Date @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 ids: List of case's Ids @param *args: Give Tuple Value """ old_state = self...
message = _("The case '%s' has been opened.") % name
message = _("The case '%s' has been opened.") % case.name
def case_open(self, cr, uid, ids, *args): """Overrides cancel for crm_case for setting Open Date @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 ids: List of case's Ids @param *args: Give Tuple Value """ old_state = self...
message = _("The lead '%s' has been closed.") % name
message = _("The lead '%s' has been closed.") % case.name
def case_close(self, cr, uid, ids, *args): """Overrides close for crm_case for setting close date @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 ids: List of case Ids @param *args: Tuple Value for additional Params """ ...
message = _("The opportunity '%s' has been closed.") % name
message = _("The opportunity '%s' has been closed.") % case.name
def case_close(self, cr, uid, ids, *args): """Overrides close for crm_case for setting close date @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 ids: List of case Ids @param *args: Tuple Value for additional Params """ ...
message = _("The case '%s' has been closed.") % name
message = _("The case '%s' has been closed.") % case.name
def case_close(self, cr, uid, ids, *args): """Overrides close for crm_case for setting close date @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 ids: List of case Ids @param *args: Tuple Value for additional Params """ ...
'type':fields.selection([
'server_type':fields.selection([
def fetch_mail(self, cr, uid, ids, context=None): if not context: context = {} email_tool = self.pool.get('email.server.tools') for server in self.browse(cr, uid, ids, context): logger.notifyChannel('imap', netsvc.LOG_INFO, 'fetchmail start checking for new emails on %s' % (server.name)) context.update({'server_id': se...
res[hist.id] = (hist.email or '/') + ' (' + str(hist.date) + ')\n'
res[hist.id] = (hist.email_from or '/') + ' (' + str(hist.date) + ')\n'
def _note_get(self, cursor, user, ids, name, arg, context=None): """ Gives case History Description @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 ids: List of case History’s IDs @param context: A standard dictionary fo...
"""Sets duration as 24 Hours if event is selcted for all day
"""Sets duration as 24 Hours if event is selected for all day
def onchange_allday(self, cr, uid, ids, allday, context=None): """Sets duration as 24 Hours if event is selcted for all day @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 ids: List of calendar event’s IDs. @param allday...
def _balance(self, cr, uid, ids, prop, unknow_none, unknow_dict): res={} for id in ids: cr.execute('SELECT date,account_id FROM account_move_line WHERE id=%s', (id,)) dt, acc = cr.fetchone() cr.execute('SELECT SUM(debit-credit) FROM account_move_line WHERE account_id=%s AND (date<%s OR (date=%s AND id<=%s))', (acc,dt,...
def _balance(self, cr, uid, ids, name, arg, context=None): if context is None: context = {} c = context.copy() c['initital_bal'] = True sql = [ """select l2.id, sum(l1.debit-l1.credit) from account_move_line l1, account_move_line l2""", """where l2.account_id=l1.account_id""", """and""", """l1.id<=l2.id""", """and"""...
def on_create_write(self, cr, uid, id, context={}): ml = self.browse(cr, uid, id, context) return map(lambda x: x.id, ml.move_id.line_id)
'order_partner_id': fields.related('order_id', 'partner_id', type='many2one', relation='res.partner', string='Customer'),
'order_partner_id': fields.related('order_id', 'partner_id', type='many2one', relation='res.partner', store=True, string='Customer'),
def _number_packages(self, cr, uid, ids, field_name, arg, context=None): if context is None: context = {} res = {} for line in self.browse(cr, uid, ids, context=context): try: res[line.id] = int((line.product_uom_qty+line.product_packaging.qty-0.0001) / line.product_packaging.qty) except: res[line.id] = 1 return res
'context': "{'visible_id':%s, 'journal_id': %d, 'search_default_journal_id':%d, 'search_default_period_id':%d}" % (journal_id, journal_id, journal_id, period_id),
'context': "{'visible_id':%s, 'search_default_journal_id':%d, 'search_default_period_id':%d}" % (journal_id, journal_id, period_id),
def action_open_window(self, cr, uid, ids, context=None): """ This function Open action move line window on given period and Journal/Payment Mode @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: account move journal’s ID or list of IDs @return: di...
account_jrnl_obj=self.pool.get('account.journal')
def makeInvoices(self, cr, uid, ids, context=None): """ To get Purchase Order line and create Invoice @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param context: A standard dictionary @return : retrun view of Invoice """ if context is None: context={} ...
journal_id_get = account_jrnl_obj.search(cr,uid,[('type','=','purchase')],context=None)[0]
def make_invoice_by_partner(partner, orders, lines_ids): """ create a new invoice for one supplier @param partner : The object partner @param orders : The set of orders to add in the invoice @param lines : The list of line's id """ a = partner.property_account_payable.id if partner and partner.property_payment_term.id...
'date':inv.date, 'ref':inv.reference,
'date': inv.date, 'ref': ref,
def _get_payment_term_lines(term_id, amount): term_pool = self.pool.get('account.payment.term') if term_id and amount: terms = term_pool.compute(cr, uid, term_id, amount) return terms return False
_description = 'Production'
_description = 'Manufacturing Order'
def get(self, cr, obj, ids, name, user=None, offset=0, context=None, values=None): if not context: context = {} res = {} move_obj = obj.pool.get('stock.move') for prod in obj.browse(cr, user, ids, context=context): cr.execute("SELECT id from stock_move where production_id=%s" % (prod.id)) m_ids = map(lambda x: x[0], cr...
'sale_id': picking.sale_id.id
'sale_id':' sale_id' in picking._columns.keys() and picking.sale_id.id or False
def create_chained_picking(self, cr, uid, moves, context=None): new_moves = [] res_obj = self.pool.get('res.company') picking_obj = self.pool.get('stock.picking') move_obj = self.pool.get('stock.move') if context is None: context = {} for picking, todo in self._chain_compute(cr, uid, moves, context=context).items(): pt...
'product_uom': lambda self,cr,uid,c: self.pool.get('product.uom').search(cr, uid, [('name', '=', 'Day')], context=c)[0]
'product_uom': lambda self,cr,uid,c: self.pool.get('product.uom').search(cr, uid, [('name', '=', 'day')], context=c)[0]
def _get_default_uom_id(self, cr, uid): model_data_obj = self.pool.get('ir.model.data') model_data_id = model_data_obj._get_id(cr, uid, 'product', 'uom_hour') return model_data_obj.read(cr, uid, [model_data_id], ['res_id'])[0]['res_id']
res['arch'] = res['arch'].replace('</search>',search_extended)
res['arch'] = unicode(res['arch'], 'utf8').replace('</search>', search_extended)
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): res = super(project_task,self).fields_view_get(cr, uid, view_id, view_type, context, toolbar=toolbar, submenu=submenu) search_extended = False timebox_obj = self.pool.get('project.gtd.timebox') access_pool = ...
function_id = self.pool.get('res.partner.function').search(cr,uid,[('name','=',lead.function_name)])
def _create_partner(self, cr, uid, ids, context=None): """ This function Creates partner based on 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 ids: List of Lead to Partner's IDs @param context: A standard dict...
'function': function_id and function_id[0] or False,
'function': lead.function_name,
def _create_partner(self, cr, uid, ids, context=None): """ This function Creates partner based on 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 ids: List of Lead to Partner's IDs @param context: A standard dict...
if check and not context.get('no_store_function'):
if check and ((not context.get('no_store_function')) or journal.entry_posted):
def create(self, cr, uid, vals, context=None, check=True): if not context: context={} account_obj = self.pool.get('account.account') tax_obj=self.pool.get('account.tax') if ('account_id' in vals) and not account_obj.read(cr, uid, vals['account_id'], ['active'])['active']: raise osv.except_osv(_('Bad account!'), _('You ...
dedicated_salesman = part.user_id and part.user_id.id or False
dedicated_salesman = part.user_id and part.user_id.id or uid
def onchange_partner_id(self, cr, uid, ids, part): if not part: return {'value': {'partner_invoice_id': False, 'partner_shipping_id': False, 'partner_order_id': False, 'payment_term': False, 'fiscal_position': False}}
def split_to_ids(self, ids_as_str): """ Identifies email IDs separated by separators and returns a list TODO: Doc this "a@b.com,c@bcom; d@b.com;e@b.com->['a@b.com',...]" """ email_sep_by_commas = ids_as_str \ .replace('; ', ',') \ .replace(';', ',') \ .replace(', ', ',') return email_sep_by_commas.split(',') def get_i...
def split_to_ids(self, ids_as_str): """ Identifies email IDs separated by separators and returns a list TODO: Doc this "a@b.com,c@bcom; d@b.com;e@b.com->['a@b.com',...]" """ email_sep_by_commas = ids_as_str \ .replace('; ', ',') \ .replace(';', ',') \ .replace(', ', ',') return email_sep_by_commas.split(',')
addresses_l = self.get_ids_from_dict(addresses)
addresses_l = extract_emails_from_dict(addresses)
def send_mail(self, cr, uid, ids, addresses, subject='', body=None, payload=None, message_id=None, context=None): #TODO: Replace all this with a single email object if body is None: body = {} if payload is None: payload = {} if context is None: context = {} logger = netsvc.Logger() for id in ids: core_obj = self.browse...
serv.sendmail(payload_part['From'], addresses_l['all'], payload_part.as_string())
serv.sendmail(payload_part['From'], addresses_l['all-recipients'], payload_part.as_string())
def send_mail(self, cr, uid, ids, addresses, subject='', body=None, payload=None, message_id=None, context=None): #TODO: Replace all this with a single email object if body is None: body = {} if payload is None: payload = {} if context is None: context = {} logger = netsvc.Logger() for id in ids: core_obj = self.browse...
logger.notifyChannel(_("Email Template"), netsvc.LOG_ERROR, _("Mail from Account %s failed. Probable Reason:Server Send Error\nDescription: %s") % (id, error))
logging.getLogger('email_template').error("Mail from Account %s failed. Probable Reason: Server Send Error\n Description: %s", id, error, exc_info=True)
def send_mail(self, cr, uid, ids, addresses, subject='', body=None, payload=None, message_id=None, context=None): #TODO: Replace all this with a single email object if body is None: body = {} if payload is None: payload = {} if context is None: context = {} logger = netsvc.Logger() for id in ids: core_obj = self.browse...
return super(report_creator, self).read(cr, user, ids, fields, context, load)
return res
def read(self, cr, user, ids, fields=None, context=None, load='_classic_read'): """ overrides orm Read method.Read List of fields for report creator. @param cr: the current row, from the database cursor, @param user: the current user’s ID for security checks, @param ids: List of report creator's id. @param fields: Lis...
if data:
for data in res: if not data.get('sql_query'): return res
def read(self, cr, user, ids, fields=None, context=None, load='_classic_read'): """ overrides orm Read method.Read List of fields for report creator. @param cr: the current row, from the database cursor, @param user: the current user’s ID for security checks, @param ids: List of report creator's id. @param fields: Lis...
report = self._sql_query_get(cr, user, [data], 'sql_query', None, ctx, where_plus = wp) sql_query = report[data] cr.execute(sql_query)
cr.execute(data['sql_query'])
def read(self, cr, user, ids, fields=None, context=None, load='_classic_read'): """ overrides orm Read method.Read List of fields for report creator. @param cr: the current row, from the database cursor, @param user: the current user’s ID for security checks, @param ids: List of report creator's id. @param fields: Lis...
report = self._sql_query_get(cr, user, [context_id], 'sql_query', None, ctx, where_plus = newargs, limit=limit, offset=offset) query = report[context_id] cr.execute(query, newargs2)
sql_query = report.sql_query cr.execute(sql_query, newargs2)
def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False): """ overrides orm search method. @param cr: the current row, from the database cursor, @param user: the current user’s ID for security checks, @param args: list of tuples of form [(‘name_of_the_field’, ‘operator’, value), .....
if prodlot_id: self.write(cr, uid, [move.id],{'prodlot_id': prodlot_id,})
def do_partial(self, cr, uid, ids, partial_datas, context=None): """ Makes partial pickings and moves done. @param partial_datas: Dictionary containing details of partial picking like partner_id, address_id, delivery_date, delivery moves with product_id, product_qty, uom """ res = {} picking_obj = self.pool.get('stock....
id2 = data_obj._get_id(cr, uid, 'crm', 'crm_case_form_view_meet') id3 = data_obj._get_id(cr, uid, 'crm', 'crm_case_tree_view_meet') id4 = data_obj._get_id(cr, uid, 'crm', 'crm_case_calendar_view_meet') if id2: id2 = data_obj.browse(cr, uid, id2, context=context).res_id if id3: id3 = data_obj.browse(cr, uid, id3, contex...
if edit_all and rrule_type: for id in ids: base_calendar.base_calendar_id2real_id(id)
def open_meeting(self, cr, uid, ids, context=None): """ Open Crm Meeting Form for Crm Meeting. @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of crm meeting’s IDs @param context: A standard dictionary for contextual values @return: Dictionar...
def _get_number_of_days(date_from, date_to):
def _get_number_of_days(self, date_from, date_to):
def _get_number_of_days(date_from, date_to): """Returns a float equals to the timedelta between two dates given as string."""
diff_day = timedelta.days + float(timedelata.seconds) / 86400
diff_day = timedelta.days + float(timedelta.seconds) / 86400
def _get_number_of_days(date_from, date_to): """Returns a float equals to the timedelta between two dates given as string."""
return onchange_date_from(cr, uid, ids, date_to, date_from)
return self.onchange_date_from(cr, uid, ids, date_to, date_from)
def onchange_date_to(self, cr, uid, ids, date_from, date_to): return onchange_date_from(cr, uid, ids, date_to, date_from)
message = (n +" '" + case.name + "' "+ _("has been opened.")
message = n +" '" + case.name + "' "+ _("has been opened.")
def case_open(self, cr, uid, ids, *args): """Overrides cancel for crm_case for setting Open Date @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 ids: List of case's Ids @param *args: Give Tuple Value """ old_state = self...
cr = self.get_node_cr(node)
def rmdir(self, datacr): """Remove the specified directory.""" cr, node, rem = datacr assert node cr = self.get_node_cr(node) node.rmcol(cr) cr.commit()
self.do_alarm_unlink(cr, uid, ids)
alarm_obj = self.pool.get('res.alarm') alarm_obj.do_alarm_unlink(cr, uid, ids, self._name)
def unlink(self, cr, uid, ids, context=None): res = False for id in ids: ls = common.caldav_id2real_id(id) if not isinstance(ls, (str, int, long)) and len(ls) >= 2: date_new = ls[1] for record in self.read(cr, uid, [common.caldav_id2real_id(id)], \ ['date', 'rrule', 'exdate']): if record['rrule']: exdate = (record['exd...
p = prod_obj.browse(cr, uid, s[0]) invent_line_obj.create(cr, uid, {
p = product_obj.browse(cr, uid, s[0]) inventory_line_obj.create(cr, uid, {
def fill_inventory(self, cr, uid, ids, context): """ To Import stock inventory according to products available in the selected locations. @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param ids: the ID or list of IDs if we want more than one @param context...
data['ids']=data['form']['chart_account_id']
data['ids'] = [data['form']['chart_account_id']]
def _print_report(self, cr, uid, ids, data, query_line, context=None):
message = str(production_qty) + " '[" + production.product_id.code + '] ' + production.product_id.name + _("' have been manufactured for ") + production.name
for (id, name) in self.pool.get('product.product').name_get(cr, uid, [production.product_id.id]): message = str(production_qty) + ' ' + production.product_uom.name +" '" + name + _("' have been manufactured for ") + production.name
def action_produce(self, cr, uid, production_id, production_qty, production_mode, context=None): """ To produce final product base on production mode (consume/consume&produce). If Production mode is consume, all stock move lines of raw materials will be done/consumed. If Production mode is consume & produce, all stock ...
drop_view_if_exists(cr, 'stock_report_prodlots')
drop_view_if_exists(cr, 'stock_report_tracklots')
def init(self, cr): drop_view_if_exists(cr, 'stock_report_prodlots') cr.execute(""" create or replace view stock_report_tracklots as ( select max(id) as id, location_id, product_id, tracking_id, sum(qty) as name from ( select -max(sm.id) as id, sm.location_id, sm.product_id, sm.tracking_id, -sum(sm.product_qty /uo.fac...
drop_view_if_exists(cr, 'stock_report_prodlots')
drop_view_if_exists(cr, 'report_stock_lines_date')
def init(self, cr): drop_view_if_exists(cr, 'stock_report_prodlots') cr.execute(""" create or replace view report_stock_lines_date as ( select p.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) left join stock_inventory s on (l.invent...
return 1
res = res.values() return len(res) and res[0] or 0
def action_produce_assign_product(self, cr, uid, ids, context={}): """ @summary : This is action which call from workflow to assign production order to procuments @return : True """ res = self.make_mo(cr, uid, ids, context=context) return 1 #TO CHECK: why workflow is generated error if return True
return 1
res = res.values() return len(res) and res[0] or 0
def action_po_assign(self, cr, uid, ids, context={}): """ @summary : This is action which call from workflow to assign purchase order to procuments @return : True """ res = self.make_po(cr, uid, ids, context=context) return 1 #TO CHECK: why workflow is generated error if return True
product_price_type_ids = product_price_type_obj.search(cr, uid, [('field','=','standard_price')], context)
product_price_type_ids = product_price_type_obj.search(cr, uid, [('field','=','standard_price')], context=context)
def on_change_unit_amount(self, cr, uid, id, prod_id, quantity, company_id, unit=False, journal_id=False, context=None): if context==None: context={} if not journal_id: j_ids = self.pool.get('account.analytic.journal').search(cr, uid, [('type','=','purchase')]) journal_id = j_ids and j_ids[0] or False if not journal_id...
value = { 'duration': 24 } duration = 0.0
value = {'duration': 24} duration = 24.0
def onchange_dates(self, cr, uid, ids, start_date, duration=False, end_date=False, allday=False, context=None): """Returns duration and/or end date based on values passed @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 i...
elif end_date and duration:
elif end_date and duration and not allday:
def onchange_dates(self, cr, uid, ids, start_date, duration=False, end_date=False, allday=False, context=None): """Returns duration and/or end date based on values passed @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 i...
ret.setdefault(key, []).extend(val)
if key in ret: ret[key] = ret[key][:] else: ret[key] = [] ret[key].extend(val)
def prep_http_options(self, uri, opts): """see HttpOptions._prep_OPTIONS """ self.parent.log_message('get options: %s' % uri) cr, uid, pool, dbname, uri2 = self.get_cr(uri, allow_last=True)
and not (isinstance(model_pool._columns[x[0]],fields.function) or isinstance(model_pool._columns[x[0]],fields.related)), fields_get.items()))
and not (isinstance(model_columns[x[0]],fields.function) or isinstance(model_columns[x[0]],fields.related)), fields_get.items()))
def _path_get(self,cr, uid, models, filter_ids=[]):
str_where = model_dict.get(model)+"."+ k + "=" + model_dict.get(v.get('relation'))+'.id' where_list.append(str_where)
if k in self.pool.get(model)._columns: str_where = model_dict.get(model)+"."+ k + "=" + model_dict.get(v.get('relation'))+'.id' where_list.append(str_where)
def _path_get(self,cr, uid, models, filter_ids=[]):
data_lines = invoice.move_id.line_id
data_lines = [x for x in invoice.move_id.line_id if x.account_id.id == invoice.account_id.id]
def _get_lines(self, cr, uid, ids, name, arg, context=None): res = {} for invoice in self.browse(cr, uid, ids, context=context): id = invoice.id res[id] = [] if not invoice.move_id: continue data_lines = invoice.move_id.line_id partial_ids = [] for line in data_lines: ids_line = [] if line.reconcile_id: ids_line = line...
if form['display_account'] == 'movement':
if form['display_account'] == 'bal_movement':
def get_children_accounts(self, account, form): res = [] ids_acc = self.pool.get('account.account')._get_children_and_consol(self.cr, self.uid, account.id) for child_account in self.pool.get('account.account').browse(self.cr, self.uid, ids_acc): sql = """ SELECT count(id) FROM account_move_line l WHERE %s AND l.account...
elif form['display_account'] == 'balance':
elif form['display_account'] == 'bal_solde':
def get_children_accounts(self, account, form): res = [] ids_acc = self.pool.get('account.account')._get_children_and_consol(self.cr, self.uid, account.id) for child_account in self.pool.get('account.account').browse(self.cr, self.uid, ids_acc): sql = """ SELECT count(id) FROM account_move_line l WHERE %s AND l.account...
id = super(wiki_wiki2, self).create(cr, uid, vals, context)
id = super(wiki_wiki2, self).create(cr, uid, {'create_id':vals.get('create_id',''), 'name':vals.get('name',''), 'minor_edit':vals.get('minor_edit',''), 'review':vals.get('review',''), 'write_uid':vals.get('write_uid',''), 'parent_id':vals.get('parent_id',''), 'text_area':vals.get('text_area',''), 'toc':vals.get('toc','...
def create(self, cr, uid, vals, context=None):
new_cc = ''
new_cc = []
def action_forward(self, cr, uid, ids, context=None): """ Forward the lead to a partner """ this = self.browse(cr, uid, ids[0], context=context) case_pool = self.pool.get(context.get('active_model')) res_id = context and context.get('active_id', False) or False case = case_pool.browse(cr, uid, res_id, context=context)
new_cc += ', ' + to to_write.update({'email_cc' : case.email_cc and case.email_cc + new_cc})
new_cc.append(to) to_write.update({'email_cc' : case.email_cc or '' + ','.join(new_cc)})
def action_forward(self, cr, uid, ids, context=None): """ Forward the lead to a partner """ this = self.browse(cr, uid, ids[0], context=context) case_pool = self.pool.get(context.get('active_model')) res_id = context and context.get('active_id', False) or False case = case_pool.browse(cr, uid, res_id, context=context)
(_check_dates, 'Error! Task start-date must be lower then task end-date.', ['date_start', 'date_end']),
def _check_recursion(self, cr, uid, ids): obj_task = self.browse(cr, uid, ids[0]) parent_ids = [x.id for x in obj_task.parent_ids] children_ids = [x.id for x in obj_task.child_ids]