rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
location = baseuri + self.redirect_paths[self.path]
location = baseuri + redir_path
def send_head(self): """Common code for GET and HEAD commands.
self._logger.debug("redirecting %s to %s", self.path, self.redirect_paths[self.path])
self._logger.debug("redirecting %s to %s", self.path, redir_path)
def send_head(self): """Common code for GET and HEAD commands.
currency = self.pool.get('res.currency').browse(cr, uid, currency_id) currency_obj.round(cr, uid, currency, 300)
currency = currency_obj.browse(cr, uid, currency_id)
def _product_value(self, cr, uid, ids, field_names, arg, context=None): """Computes stock value (real and virtual) for a product, as well as stock qty (real and virtual). @param field_names: Name of field @return: Dictionary of values """ prod_id = context and context.get('product_id', False)
def get_currency_id(self, cursor, user, picking):
def get_currency_id(self, cr, uid, picking):
def get_currency_id(self, cursor, user, picking): return False
def _get_payment_term(self, cursor, user, picking):
def _get_payment_term(self, cr, uid, picking):
def _get_payment_term(self, cursor, user, picking): '''Return {'contact': address, 'invoice': address} for invoice''' partner_obj = self.pool.get('res.partner') partner = picking.address_id.partner_id return partner.property_payment_term and partner.property_payment_term.id or False
def _get_address_invoice(self, cursor, user, picking):
def _get_address_invoice(self, cr, uid, picking):
def _get_address_invoice(self, cursor, user, picking): '''Return {'contact': address, 'invoice': address} for invoice''' partner_obj = self.pool.get('res.partner') partner = picking.address_id.partner_id
return partner_obj.address_get(cursor, user, [partner.id],
return partner_obj.address_get(cr, uid, [partner.id],
def _get_address_invoice(self, cursor, user, picking): '''Return {'contact': address, 'invoice': address} for invoice''' partner_obj = self.pool.get('res.partner') partner = picking.address_id.partner_id
def _get_comment_invoice(self, cursor, user, picking):
def _get_comment_invoice(self, cr, uid, picking):
def _get_comment_invoice(self, cursor, user, picking): '''Return comment string for invoice''' return picking.note or ''
def _get_price_unit_invoice(self, cursor, user, move_line, type):
def _get_price_unit_invoice(self, cr, uid, move_line, type, context=None):
def _get_price_unit_invoice(self, cursor, user, move_line, type): '''Return the price unit for the move line''' if type in ('in_invoice', 'in_refund'): # Take the user company and pricetype price_type_id=self.pool.get('res.users').browse(cr,users,users).company_id.property_valuation_price_type.id pricetype=self.pool.ge...
price_type_id=self.pool.get('res.users').browse(cr,users,users).company_id.property_valuation_price_type.id pricetype=self.pool.get('product.price.type').browse(cr,uid,price_type_id) context['currency_id']=move_line.company_id.currency_id.id amount_unit=move_line.product_id.price_get(pricetype.field, context)[move_lin...
price_type_id = self.pool.get('res.users').browse(cr, uid, uid).company_id.property_valuation_price_type.id pricetype = self.pool.get('product.price.type').browse(cr, uid, price_type_id) context['currency_id'] = move_line.company_id.currency_id.id amount_unit = move_line.product_id.price_get(pricetype.field, context)[...
def _get_price_unit_invoice(self, cursor, user, move_line, type): '''Return the price unit for the move line''' if type in ('in_invoice', 'in_refund'): # Take the user company and pricetype price_type_id=self.pool.get('res.users').browse(cr,users,users).company_id.property_valuation_price_type.id pricetype=self.pool.ge...
def _get_discount_invoice(self, cursor, user, move_line):
def _get_discount_invoice(self, cr, uid, move_line):
def _get_discount_invoice(self, cursor, user, move_line): '''Return the discount for the move line''' return 0.0
def _get_taxes_invoice(self, cursor, user, move_line, type):
def _get_taxes_invoice(self, cr, uid, move_line, type):
def _get_taxes_invoice(self, cursor, user, move_line, type): '''Return taxes ids for the move line''' if type in ('in_invoice', 'in_refund'): taxes = move_line.product_id.supplier_taxes_id else: taxes = move_line.product_id.taxes_id
cursor, user,
cr, uid,
def _get_taxes_invoice(self, cursor, user, move_line, type): '''Return taxes ids for the move line''' if type in ('in_invoice', 'in_refund'): taxes = move_line.product_id.supplier_taxes_id else: taxes = move_line.product_id.taxes_id
def _get_account_analytic_invoice(self, cursor, user, picking, move_line):
def _get_account_analytic_invoice(self, cr, uid, picking, move_line):
def _get_account_analytic_invoice(self, cursor, user, picking, move_line): return False
def _invoice_line_hook(self, cursor, user, move_line, invoice_line_id):
def _invoice_line_hook(self, cr, uid, move_line, invoice_line_id):
def _invoice_line_hook(self, cursor, user, move_line, invoice_line_id): '''Call after the creation of the invoice line''' return
def _invoice_hook(self, cursor, user, picking, invoice_id):
def _invoice_hook(self, cr, uid, picking, invoice_id):
def _invoice_hook(self, cursor, user, picking, invoice_id): '''Call after the creation of the invoice''' return
def action_invoice_create(self, cursor, user, ids, journal_id=False,
def action_invoice_create(self, cr, uid, ids, journal_id=False,
def action_invoice_create(self, cursor, user, ids, journal_id=False, group=False, type='out_invoice', context=None): '''Return ids of created invoices for the pickings''' invoice_obj = self.pool.get('account.invoice') invoice_line_obj = self.pool.get('account.invoice.line') invoices_group = {} res = {}
for picking in self.browse(cursor, user, ids, context=context):
for picking in self.browse(cr, uid, ids, context=context):
def action_invoice_create(self, cursor, user, ids, journal_id=False, group=False, type='out_invoice', context=None): '''Return ids of created invoices for the pickings''' invoice_obj = self.pool.get('account.invoice') invoice_line_obj = self.pool.get('account.invoice.line') invoices_group = {} res = {}
payment_term_id = self._get_payment_term(cursor, user, picking)
payment_term_id = self._get_payment_term(cr, uid, picking)
def action_invoice_create(self, cursor, user, ids, journal_id=False, group=False, type='out_invoice', context=None): '''Return ids of created invoices for the pickings''' invoice_obj = self.pool.get('account.invoice') invoice_line_obj = self.pool.get('account.invoice.line') invoices_group = {} res = {}
self._get_address_invoice(cursor, user, picking).values() comment = self._get_comment_invoice(cursor, user, picking)
self._get_address_invoice(cr, uid, picking).values() comment = self._get_comment_invoice(cr, uid, picking)
def action_invoice_create(self, cursor, user, ids, journal_id=False, group=False, type='out_invoice', context=None): '''Return ids of created invoices for the pickings''' invoice_obj = self.pool.get('account.invoice') invoice_line_obj = self.pool.get('account.invoice.line') invoices_group = {} res = {}
invoice = invoice_obj.browse(cursor, user, invoice_id)
invoice = invoice_obj.browse(cr, uid, invoice_id)
def action_invoice_create(self, cursor, user, ids, journal_id=False, group=False, type='out_invoice', context=None): '''Return ids of created invoices for the pickings''' invoice_obj = self.pool.get('account.invoice') invoice_line_obj = self.pool.get('account.invoice.line') invoices_group = {} res = {}
invoice_obj.write(cursor, user, [invoice_id], invoice_vals, context=context)
invoice_obj.write(cr, uid, [invoice_id], invoice_vals, context=context)
def action_invoice_create(self, cursor, user, ids, journal_id=False, group=False, type='out_invoice', context=None): '''Return ids of created invoices for the pickings''' invoice_obj = self.pool.get('account.invoice') invoice_line_obj = self.pool.get('account.invoice.line') invoices_group = {} res = {}
cur_id = self.get_currency_id(cursor, user, picking)
cur_id = self.get_currency_id(cr, uid, picking)
def action_invoice_create(self, cursor, user, ids, journal_id=False, group=False, type='out_invoice', context=None): '''Return ids of created invoices for the pickings''' invoice_obj = self.pool.get('account.invoice') invoice_line_obj = self.pool.get('account.invoice.line') invoices_group = {} res = {}
invoice_id = invoice_obj.create(cursor, user, invoice_vals,
invoice_id = invoice_obj.create(cr, uid, invoice_vals,
def action_invoice_create(self, cursor, user, ids, journal_id=False, group=False, type='out_invoice', context=None): '''Return ids of created invoices for the pickings''' invoice_obj = self.pool.get('account.invoice') invoice_line_obj = self.pool.get('account.invoice.line') invoices_group = {} res = {}
price_unit = self._get_price_unit_invoice(cursor, user,
price_unit = self._get_price_unit_invoice(cr, uid,
def action_invoice_create(self, cursor, user, ids, journal_id=False, group=False, type='out_invoice', context=None): '''Return ids of created invoices for the pickings''' invoice_obj = self.pool.get('account.invoice') invoice_line_obj = self.pool.get('account.invoice.line') invoices_group = {} res = {}
discount = self._get_discount_invoice(cursor, user, move_line) tax_ids = self._get_taxes_invoice(cursor, user, move_line, type) account_analytic_id = self._get_account_analytic_invoice(cursor, user, picking, move_line)
discount = self._get_discount_invoice(cr, uid, move_line) tax_ids = self._get_taxes_invoice(cr, uid, move_line, type) account_analytic_id = self._get_account_analytic_invoice(cr, uid, picking, move_line)
def action_invoice_create(self, cursor, user, ids, journal_id=False, group=False, type='out_invoice', context=None): '''Return ids of created invoices for the pickings''' invoice_obj = self.pool.get('account.invoice') invoice_line_obj = self.pool.get('account.invoice.line') invoices_group = {} res = {}
account_id = self.pool.get('account.fiscal.position').map_account(cursor, user, partner.property_account_position, account_id)
account_id = self.pool.get('account.fiscal.position').map_account(cr, uid, partner.property_account_position, account_id)
def action_invoice_create(self, cursor, user, ids, journal_id=False, group=False, type='out_invoice', context=None): '''Return ids of created invoices for the pickings''' invoice_obj = self.pool.get('account.invoice') invoice_line_obj = self.pool.get('account.invoice.line') invoices_group = {} res = {}
invoice_line_id = invoice_line_obj.create(cursor, user, {
invoice_line_id = invoice_line_obj.create(cr, uid, {
def action_invoice_create(self, cursor, user, ids, journal_id=False, group=False, type='out_invoice', context=None): '''Return ids of created invoices for the pickings''' invoice_obj = self.pool.get('account.invoice') invoice_line_obj = self.pool.get('account.invoice.line') invoices_group = {} res = {}
self._invoice_line_hook(cursor, user, move_line, invoice_line_id) invoice_obj.button_compute(cursor, user, [invoice_id], context=context,
self._invoice_line_hook(cr, uid, move_line, invoice_line_id) invoice_obj.button_compute(cr, uid, [invoice_id], context=context,
def action_invoice_create(self, cursor, user, ids, journal_id=False, group=False, type='out_invoice', context=None): '''Return ids of created invoices for the pickings''' invoice_obj = self.pool.get('account.invoice') invoice_line_obj = self.pool.get('account.invoice.line') invoices_group = {} res = {}
self.write(cursor, user, [picking.id], {
self.write(cr, uid, [picking.id], {
def action_invoice_create(self, cursor, user, ids, journal_id=False, group=False, type='out_invoice', context=None): '''Return ids of created invoices for the pickings''' invoice_obj = self.pool.get('account.invoice') invoice_line_obj = self.pool.get('account.invoice.line') invoices_group = {} res = {}
self._invoice_hook(cursor, user, picking, invoice_id) self.write(cursor, user, res.keys(), {
self._invoice_hook(cr, uid, picking, invoice_id) self.write(cr, uid, res.keys(), {
def action_invoice_create(self, cursor, user, ids, journal_id=False, group=False, type='out_invoice', context=None): '''Return ids of created invoices for the pickings''' invoice_obj = self.pool.get('account.invoice') invoice_line_obj = self.pool.get('account.invoice.line') invoices_group = {} res = {}
ids = self.search(cr, user, args, limit=limit, context=context)
if name: ids = self.search(cr, user, [('description', '=', name)] + args, limit=limit, context=context) if not ids: ids = self.search(cr, user, [('name', operator, name)] + args, limit=limit, context=context) else: ids = self.search(cr, user, args, limit=limit, context=context or {})
Returns a list of tupples containing id, name, as internally it is called {def name_get}
self.ical_set(cal_data.name.lower(), {'name':cal_data.params['CN']}, 'value')
self.ical_set(cal_data.name.lower(), {'name': cal_data.params['CN'][0]}, 'value') continue
def parse_ics(self, cr, uid, child, cal_children=None, context=None): """ parse calendaring and scheduling information @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 context: A standard dictionary for contextual values ...
'sum_currency_amount_account': self._sum_currency_amount_account,
def __init__(self, cr, uid, name, context=None): if context is None: context = {} super(journal_print, self).__init__(cr, uid, name, context=context) self.period_ids = [] self.journal_ids = [] self.localcontext.update( { 'time': time, 'lines': self.lines, 'sum_debit': self._sum_debit, 'sum_credit': self._sum_credit, 'g...
def _sum_currency_amount_account(self, account, form): self._set_get_account_currency_code(account.id) self.cr.execute("SELECT sum(aml.amount_currency) FROM account_move_line as aml,res_currency as rc WHERE aml.currency_id = rc.id AND aml.account_id= %s ", (account.id,)) total = self.cr.fetchone() if self.account_curr...
def _set_get_account_currency_code(self, account_id): self.cr.execute("SELECT c.code as code "\ "FROM res_currency c,account_account as ac "\ "WHERE ac.id = %s AND ac.currency_id = c.id"%(account_id)) result = self.cr.fetchone() if result: self.account_currency = result[0] else: self.account_currency = False
res=self.cr.fetchone()[0]
res=self.cr.fetchone()[0] or 0.0
def __pos_payment_date__total__(self,form): dt1 = form['date_start'] + ' 00:00:00' dt2 = form['date_end'] + ' 23:59:59' res=[] self.cr.execute ("select sum(pol.price_unit * pol.qty * (1 - (pol.discount) / 100.0)) " \ "from pos_order as po,pos_order_line as pol,product_product as pp,product_template as pt " \ "where pt....
partner_data = res_obj.browse(cr, uid, part)
def onchange_partner_id(self, cr, uid, ids, part, event_id, email=False): """This function returns value of Patner Invoice id, Unit Price, badget title based on partner and Event. @param self: The object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks,...
return obj_payment_order.set_done(cr, uid, context['active_id'], context)
obj_payment_order.set_done(cr, uid, context['active_id'], context) return {}
def launch_wizard(self, cr, uid, ids, context=None): """ Search for a wizard to launch according to the type. If type is manual. just confirm the order. """ obj_payment_order = self.pool.get('payment.order')
res = self.write(cr, uid, event_id, {'exdate': date_new})
exdate = (record['exdate'] and (record['exdate'] + ',') or '') + date_new res = self.write(cr, uid, event_id, {'exdate': exdate})
def unlink(self, cr, uid, ids, context=None): """ Deletes records specified in ids. @param self: the object pointer. @param cr: the current row, from the database cursor, @param id: List of calendar event's id. @param context: A standard dictionary for contextual values @return: True """ res = False for event_id in ids...
default['backorder_id'] = False return super(stock_picking, self).copy(cr, uid, id, default, context)
default['backorder_id'] = False res=super(stock_picking, self).copy(cr, uid, id, default, context) if res: picking_obj = self.browse(cr, uid, [res], context)[0] for move in picking_obj.move_lines: move_obj.write(cr, uid, [move.id], {'tracking_id': False,'prodlot_id':False}) return res
def copy(self, cr, uid, id, default=None, context=None): if default is None: default = {} default = default.copy() picking_obj = self.browse(cr, uid, [id], context)[0] if ('name' not in default) or (picking_obj.name=='/'): seq_obj_name = 'stock.picking.' + picking_obj.type default['name'] = self.pool.get('ir.sequence'...
def button_confirm(self, cr, uid, ids, *args): for id in ids: wf_service = netsvc.LocalService("workflow") wf_service.trg_validate(uid, 'stock.picking', id, 'button_confirm', cr) self.force_assign(cr, uid, ids, *args) return True
def button_confirm(self, cr, uid, ids, *args): for id in ids: wf_service = netsvc.LocalService("workflow") wf_service.trg_validate(uid, 'stock.picking', id, 'button_confirm', cr) self.force_assign(cr, uid, ids, *args) return True
class account_bank_statement_line(osv.osv): def _default_company(self, cr, uid, context={}): """ To get default company for the object" @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 bank statement ids @pa...
def _user_allow(self, cr, uid, ids, statement, context={}): res = False uids = [] for user in statement.journal_id.journal_users: uids.append(user.id) if uid in uids: res = True return res
(check_duplicate, 'Warning! Can\'t have duplicate server configuration!', ['user', 'password'])
(check_duplicate, 'Warning! Can\'t have duplicate server configuration!', ['user', 'password']), (check_model, 'Warning! Record for slected Model can not be created\nPlease choose valid Model', ['object_id'])
def check_duplicate(self, cr, uid, ids):
self.ical_set(cal_data.name.lower(), {'name': cal_data.params['CN'][0]}, 'value')
self.ical_set(cal_data.name.lower(), {'name': cal_data.params.get('CN') and cal_data.params.get('CN')[0]}, 'value')
def parse_ics(self, cr, uid, child, cal_children=None, context=None): """ parse calendaring and scheduling information @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 context: A standard dictionary for contextual values ...
'product_qty': product_qty, 'product_uos_qty': product_qty
'product_qty': move.product_qty, 'product_uos_qty': move.product_qty
def do_partial(self, cr, uid, ids, partial_datas, context={}): """ @ partial_datas : dict. contain 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.picking') delivery_obj = self.pool.get('stock.deliver...
sql2="""SELECT sum(qty) as qty,l.price_unit*sum(l.qty) as amt,t.name as name from product_product p, product_template t, pos_order_line l where order_id IN %s and p.product_tmpl_id=t.id and l.product_id=p.id group by t.name, l.price_unit""",(tuple(a_l),)
sql2="""SELECT sum(qty) as qty,l.price_unit*sum(l.qty) as amt,t.name as name from product_product p, product_template t, pos_order_line l where order_id = %d and p.product_tmpl_id=t.id and l.product_id=p.id group by t.name, l.price_unit"""%(o.id)
def _get_data(self,o): data={} sql1=""" SELECT distinct(o.id) from account_bank_statement s, account_bank_statement_line l,pos_order o,pos_order_line i where i.order_id=o.id and o.state='paid' and l.statement_id=s.id and l.pos_statement_id=o.id and s.id=%d"""%(o.id) self.cr.execute(sql1) data = self.cr.dictfetchall() ...
name = allocation.resource_id.name if allocation.user_id: name = '%s' %(allocation.user_id.name)
name = allocation.phase_id.name
def get_name(self, cr, uid, ids, field_name, arg, context=None): res = {} for allocation in self.browse(cr, uid, ids, context=context): name = allocation.resource_id.name if allocation.user_id: name = '%s' %(allocation.user_id.name) name += ' (%s%%)' %(allocation.useability) res[allocation.id] = name return res
def read_group(self, cr, uid, domain, fields, groupby, offset=0, limit=None, context=None):
def read_group(self, cr, uid, domain, fields, groupby, offset=0, limit=None, context=None, orderby=False):
def read_group(self, cr, uid, domain, fields, groupby, offset=0, limit=None, context=None): todel=[] fiscalyear_obj = self.pool.get('account.fiscalyear') period_obj = self.pool.get('account.period') for arg in domain: if arg[0] == 'period_id' and arg[2] == 'current_period': current_period = period_obj.find(cr, uid)[0] ...
return super(account_entries_report, self).read_group(cr, uid, domain, fields, groupby, offset, limit, context)
return super(account_entries_report, self).read_group(cr, uid, domain, fields, groupby, offset, limit, context, orderby)
def read_group(self, cr, uid, domain, fields, groupby, offset=0, limit=None, context=None): todel=[] fiscalyear_obj = self.pool.get('account.fiscalyear') period_obj = self.pool.get('account.period') for arg in domain: if arg[0] == 'period_id' and arg[2] == 'current_period': current_period = period_obj.find(cr, uid)[0] ...
r = {}
def _debit_calc(self, cr, uid, ids, name, arg, context={}):
move_ids = []
def action_production_end(self, cr, uid, ids): move_ids = [] for production in self.browse(cr, uid, ids): for res in production.move_lines: for move in production.move_created_ids: #XXX must use the orm cr.execute('INSERT INTO stock_move_history_ids \ (parent_id, child_id) VALUES (%s,%s)', (res.id, move.id)) move_ids.a...
move_ids.append(res.id)
def action_production_end(self, cr, uid, ids): move_ids = [] for production in self.browse(cr, uid, ids): for res in production.move_lines: for move in production.move_created_ids: #XXX must use the orm cr.execute('INSERT INTO stock_move_history_ids \ (parent_id, child_id) VALUES (%s,%s)', (res.id, move.id)) move_ids.a...
self.pool.get('stock.move').action_done(cr, uid, new_moves)
def action_production_end(self, cr, uid, ids): move_ids = [] for production in self.browse(cr, uid, ids): for res in production.move_lines: for move in production.move_created_ids: #XXX must use the orm cr.execute('INSERT INTO stock_move_history_ids \ (parent_id, child_id) VALUES (%s,%s)', (res.id, move.id)) move_ids.a...
result = voucher_obj.onchange_partner_id(cr, uid, [], partner_id=line.partner_id.id, journal_id=statement.journal_id.id, price=abs(amount), currency_id= statement.currency.id, ttype=(amount < 0 and 'payment' or 'receipt'), context=context)
result = voucher_obj.onchange_partner_id(cr, uid, [], partner_id=line.partner_id.id, journal_id=statement.journal_id.id, price=abs(amount), currency_id= statement.currency.id, ttype=(amount < 0 and 'payment' or 'receipt'), date=time.strftime('%Y-%m-%d'), context=context)
def populate_statement(self, cr, uid, ids, context=None): if context is None: context = {} statement_id = context.get('statement_id', False) if not statement_id: return {} data = self.read(cr, uid, ids, context=context)[0] line_ids = data['line_ids'] if not line_ids: return {}
x_headers = { 'Reply-To':"%s" % case.section_id.reply_to, }
x_headers = dict()
def action_send(self, cr, uid, ids, context=None): """ This sends an email to ALL the addresses of the selected partners. """
params.append(max_amount)
params += max_amount
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_w...
res[event.id]['register_current'] = len(reg_ids)
res[event.id]['register_current'] = number and number[0] or 0.0
def _get_register(self, cr, uid, ids, fields, args, context=None): """Get Confirm or uncofirm register value. @param ids: List of Event registration type's id @param fields: List of function fields(register_current and register_prospect). @param context: A standard dictionary for contextual values @return: Dictionary o...
res[event.id]['register_prospect'] = len(reg_ids)
res[event.id]['register_prospect'] = number and number[0] or 0.0
def _get_register(self, cr, uid, ids, fields, args, context=None): """Get Confirm or uncofirm register value. @param ids: List of Event registration type's id @param fields: List of function fields(register_current and register_prospect). @param context: A standard dictionary for contextual values @return: Dictionary o...
task_ids = map(lambda x : x.id, (filter(lambda x : x.state in ['open', 'draft', 'pending'] , phase.task_ids)))
task_ids = map(lambda x : x.id, (filter(lambda x : x.state in ['draft'] , phase.task_ids)))
def schedule_tasks(self, cr, uid, ids, context=None): """ Schedule the tasks according to resource available and priority. """ task_pool = self.pool.get('project.task') resource_pool = self.pool.get('resource.resource') resources_list = self.generate_resources(cr, uid, ids, context=context) return_msg = {} for phase in...
res = {} result_acc = []
def lines(self, form, ids=[], done=None):#, level=1): obj_account = self.pool.get('account.account') if not ids: ids = self.ids if not ids: return [] if not done: done={}
parents = ids
def lines(self, form, ids=[], done=None):#, level=1): obj_account = self.pool.get('account.account') if not ids: ids = self.ids if not ids: return [] if not done: done={}
accounts = obj_account.read(self.cr, self.uid, ids, ['type','code','name','debit','credit','balance','parent_id','level'], ctx) for account in accounts: if account['id'] in done: continue done[account['id']] = 1 res = { 'id': account['id'], 'type': account['type'], 'code': account['code'], 'name': account['name'], 'lev...
accounts = obj_account.read(self.cr, self.uid, ids, ['type','code','name','debit','credit','balance','parent_id','level','child_id'], ctx) for parent in parents: if parent in done: continue done[parent] = 1 _process_child(accounts,form['display_account'],parent) return self.result_acc
def lines(self, form, ids=[], done=None):#, level=1): obj_account = self.pool.get('account.account') if not ids: ids = self.ids if not ids: return [] if not done: done={}
return new_ids = isinstance(ids, (str, int, long)) and data[0] or data
return isinstance(ids, (str, int, long)) and data[0] or data
def read(self, cr, uid, ids, fields=None, context={}, load='_classic_read'): """ Read IR Model @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 IR Model’s IDs. @param context: A standard dictionary for contex...
last_date = datetime(record.name, '%Y-%m-%d') + relativedelta(months=1) - 1 task_obj=self.pool.get('project.task.work')
last_date = datetime.strptime(record.name, '%Y-%m-%d') + relativedelta(months=1) - relativedelta(days=1) task_obj = self.pool.get('project.task.work')
def _get_task_hours(self, cr, uid, ids, name,args,context): result = {} for record in self.browse(cr, uid, ids,context): last_date = datetime(record.name, '%Y-%m-%d') + relativedelta(months=1) - 1 task_obj=self.pool.get('project.task.work') task_ids = task_obj.search(cr, uid, [('user_id','=',record.user_id.id),('date',...
last_date = datetime.strptime(record.name, '%Y-%m-%d') + relativedelta(months=1) - 1 obj=self.pool.get('hr_timesheet_sheet.sheet.day')
last_date = datetime.strptime(record.name, '%Y-%m-%d') + relativedelta(months=1) - relativedelta(days=1) obj = self.pool.get('hr_timesheet_sheet.sheet.day')
def get_hrs_timesheet(self, cr, uid, ids, name,args,context): result = {} sum = 0.0 for record in self.browse(cr, uid, ids, context): last_date = datetime.strptime(record.name, '%Y-%m-%d') + relativedelta(months=1) - 1 obj=self.pool.get('hr_timesheet_sheet.sheet.day') sheet_ids = obj.search(cr, uid, [('sheet_id.user_id...
data = self.read(cr, uid, ids, [], context)[0] line_ids= data['entries']
payment_obj = self.pool.get('payment.line') if context is None: context = {} data = self.read(cr, uid, ids, [])[0] line_ids = data['entries']
def create_payment(self, cr, uid, ids, context=None): order_obj = self.pool.get('payment.order') line_obj = self.pool.get('account.move.line')
payment = order_obj.browse(cr, uid, data['active_id'], context=context)
payment = order_obj.browse(cr, uid, context['active_id'], context=context)
def create_payment(self, cr, uid, ids, context=None): order_obj = self.pool.get('payment.order') line_obj = self.pool.get('account.move.line')
line2bank = pool.get('account.move.line').line2bank(cr, uid, line_ids, t, context)
line2bank = line_obj.line2bank(cr, uid, line_ids, t, context)
def create_payment(self, cr, uid, ids, context=None): order_obj = self.pool.get('payment.order') line_obj = self.pool.get('account.move.line')
pool.get('payment.line').create(cr, uid,{
payment_obj.create(cr, uid,{
def create_payment(self, cr, uid, ids, context=None): order_obj = self.pool.get('payment.order') line_obj = self.pool.get('account.move.line')
return {}
return {'nodestroy':True,}
def create_payment(self, cr, uid, ids, context=None): order_obj = self.pool.get('payment.order') line_obj = self.pool.get('account.move.line')
if context is None: context = {}
def search_entries(self, cr, uid, ids, context=None): order_obj = self.pool.get('payment.order') line_obj = self.pool.get('account.move.line') mod_obj = self.pool.get('ir.model.data')
last_date = datetime(record.name, '%Y-%m-%d') + relativedelta(months=1) - 1
last_date = datetime.strptime(record.name, '%Y-%m-%d') + relativedelta(months=1) - 1
def _get_task_hours(self, cr, uid, ids, name,args,context): result = {} for record in self.browse(cr, uid, ids,context): last_date = datetime(record.name, '%Y-%m-%d') + relativedelta(months=1) - 1 task_obj=self.pool.get('project.task.work') task_ids = task_obj.search(cr, uid, [('user_id','=',record.user_id.id),('date',...
'base_code_id': fields.many2one('account.tax.code', 'Base Code', help="Use this code for the VAT declaration."), 'tax_code_id': fields.many2one('account.tax.code', 'Tax Code', help="Use this code for the VAT declaration."),
'base_code_id': fields.many2one('account.tax.code', 'Account Base Code', help="Use this code for the VAT declaration."), 'tax_code_id': fields.many2one('account.tax.code', 'Account Tax Code', help="Use this code for the VAT declaration."),
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)
res_id = model_pool.message_new(cr, uid, msg, context)
res_id = model_pool.message_new(cr, uid, msg, context)fetchmail/fetchmail.py
logger.notifyChannel('imap', netsvc.LOG_WARNING, 'method def message_update is not define in model %s' % (model_pool._name))
fp = os.popen('ping www.google.com -c 1 -w 5',"r") if not fp.read(): logger.notifyChannel('imap', netsvc.LOG_WARNING, 'lost internet connection !')
def fetch_mail(self, cr, uid, ids, context={}):
date_planned = (date_planned - relativedelta(company.security_lead)).strftime('%Y-%m-%d %H:%M:%S')
date_planned = (date_planned - timedelta(days=company.security_lead)).strftime('%Y-%m-%d %H:%M:%S')
def action_ship_create(self, cr, uid, ids, *args): picking_id = False company = self.pool.get('res.users').browse(cr, uid, uid).company_id for order in self.browse(cr, uid, ids, context={}): proc_ids = [] output_id = order.shop_id.warehouse_id.lot_output_id.id picking_id = False for line in order.order_line: proc_id = ...
"AND reconcile_id IS NULL " \
" " + RECONCILE_TAG + " "\
def _get_intial_balance(self, partner): move_state = ['draft','posted'] if self.target_move == 'posted': move_state = ['posted']
'am_out': fields.boolean('Controle for Output Operations'), 'disc_controle': fields.boolean('Discount Controle '),
'am_out': fields.boolean('Control for Output Operations'), 'disc_controle': fields.boolean('Discount Control'),
def _scan_product(self, cr, uid, ean, qty, order): # search pricelist_id product_obj=self.pool.get('product.product') pricelist_id = self.pool.get('pos.order').read(cr, uid, [order], ['pricelist_id'] ) if not pricelist_id: return False
LOG_DEBUG2 = 'debug2'
def log(lvl,msg): netsvc.Logger().notifyChannel("index",lvl,msg)
_columns = { 'year': fields.char('Year', size='4', readonly=True, select=1), 'canceled_number': fields.integer('Canceled', readonly=True), 'waiting_number': fields.integer('Waiting', readonly=True), 'invoiced_number': fields.integer('Invoiced', readonly=True), 'paid_number': fields.integer('Paid', readonly=True), 'canc...
def init(self, cr): '''Create the view''' cr.execute("""
case_val = case_obj.browse(cr, uid, alarmdata.get('id'), context)[0] for att in case_val.attendees:
case_val = case_obj.browse(cr, uid, alarmdata.get('id'), context) for att in case_val.attendee_ids:
def run_scheduler(self, cr, uid, automatic=False, use_new_cursor=False, \ context=None): if not context: context = {} cr.execute('select c.id as id, crm_case.date as date, alarm.id as alarm_id, alarm.name as name,\ alarm.trigger_interval, alarm.trigger_duration, alarm.trigger_related, \ alarm.trigger_occurs from crm_me...
ls = common.caldav_id2real_id(caldav_id)
ls = common.caldav_id2real_id(id)
def unlink(self, cr, uid, ids, context=None): for id in ids: ls = common.caldav_id2real_id(caldav_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['exdate']...
'availability': fields.selection([('free', 'Free'), \ ('busy', 'Busy'), ('both', 'Both')], 'User Avaliability') } _defaults = { 'availability': lambda *x: 'free', }
}
def _get_user_avail(self, cr, uid, ids, name, args, context=None): res={} if not context or not context.get('model'): return {} else: model = context.get('model') obj = self.pool.get(model) event_obj = obj.browse(cr, uid, context['active_id']) event_start = event_obj.date event_end = datetime.datetime.strptime(event_ob...
datas = self.read(cr, uid, ids)[0] if not context or not context.get('model') or not datas.get('users'): return {} else: model = context.get('model') obj = self.pool.get(model) res_obj = obj.browse(cr, uid, context['active_id']) user_obj = self.pool.get('res.users') attendee_obj = self.pool.get('crm.caldav.attendee') f...
def do_invite(self, cr, uid, ids, context={}): #TODO: Add attendee return {}
res = {'value' : {'code' : '%s - %03d' % (parent['code'] or '', numchild + 1),}}
res = {'value' : {}}
def on_change_parent(self, cr, uid, id, parent_id): if not parent_id: return {} parent = self.read(cr, uid, [parent_id], ['partner_id','code'])[0] childs = self.search(cr, uid, [('parent_id', '=', parent_id)]) numchild = len(childs) if parent['partner_id']: partner = parent['partner_id'][0] else: partner = False res = ...
value = acct_obj.search(cr, uid, [('type', 'in',('sale','sale_refund') )])
value = acct_obj.search(cr, uid, [('type', 'in',('sale','purchase_refund') )])
def _get_journal_id(self, cr, uid, context=None): if context is None: context = {}
value = acct_obj.search(cr, uid, [('type', 'in',('purchase','purchase_refund') )])
value = acct_obj.search(cr, uid, [('type', 'in',('purchase','sale_refund') )])
def _get_journal_id(self, cr, uid, context=None): if context is None: context = {}
cr.execute("select m.id, m.rrule, m.date, m.date_deadline, \
cr.execute("select m.id, m.rrule, m.date, m.date_deadline, m.duration, \
def get_recurrent_ids(self, cr, uid, select, base_start_date, base_until_date, limit=100): """Gives virtual event ids for recurring events based on value of Recurrence Rule This method gives ids of dates that comes between start date and end date of calendar views @param self: The object pointer @param cr: the current ...
report_sxw.report_sxw('report.account.central.journal', 'account.journal.period', 'addons/account/report/central_journal.rml', parser=journal_print, header=False)
def _get_account(self, data): if data['model']=='account.journal.period': return self.pool.get('account.journal.period').browse(self.cr, self.uid, data['id']).company_id.name return super(journal_print ,self)._get_account(data) def _get_fiscalyear(self, data): if data['model']=='account.journal.period': return self.po...
def _sum_currency_amount_account(self, account, form): self._set_get_account_currency_code(account.id) self.cr.execute("SELECT sum(aml.amount_currency) FROM account_move_line as aml,res_currency as rc WHERE aml.currency_id = rc.id AND aml.account_id= %s ", (account.id,)) total = self.cr.fetchone()
return super(event_event, self)._check_recursion(self, cr, uid, ids)
return super(event_event, self)._check_recursion(cr, uid, ids)
def _check_recursion(self, cr, uid, ids): return super(event_event, self)._check_recursion(self, cr, uid, ids)
if not time.strptime(vals['date'],'%Y-%m-%d')>=time.strptime(period.date_start,'%Y-%m-%d') and time.strptime(vals['date'],'%Y-%m-%d')<=time.strptime(period.date_stop,'%Y-%m-%d'):
date = time.strptime(vals['date'], '%Y-%m-%d') if not (date >= time.strptime(period.date_start,'%Y-%m-%d') and date <= time.strptime(period.date_stop,'%Y-%m-%d') ):
def check_date(self, cr, uid, vals, context=None, check=True): if not context: context = {} 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 'journal_id' not in con...
'move_ids': fields.related('move_id','line_id', type='many2many', relation='account.move.line', string='Real Entry'),
'move_ids': fields.related('move_id','line_id', type='many2many', relation='account.move.line', string='Journal Items', readonly=True, states={'draft':[('readonly',False)]}),
def _get_currency(self, cr, uid, context): user = self.pool.get('res.users').browse(cr, uid, uid) if user.company_id: return user.company_id.currency_id.id else: return self.pool.get('res.currency').search(cr, uid, [('rate','=',1.0)])[0]
val = {'invoiced': True}
for line in order.order_line: if line.state == 'exception': self.pool.get('sale.order.line').write(cr, uid, [line.id], {'state': 'confirmed'}, context=context)
def action_invoice_end(self, cr, uid, ids, context=None): if context is None: context = {} for order in self.browse(cr, uid, ids, context=context): val = {'invoiced': True} if order.state == 'invoice_except': val['state'] = 'progress'
val['state'] = 'progress' for line in order.order_line: towrite = [] if line.state == 'exception': towrite.append(line.id) if towrite: self.pool.get('sale.order.line').write(cr, uid, towrite, {'state': 'confirmed'}, context=context) self.write(cr, uid, [order.id], val)
self.write(cr, uid, [order.id], {'state' : 'progress'}, context=context)
def action_invoice_end(self, cr, uid, ids, context=None): if context is None: context = {} for order in self.browse(cr, uid, ids, context=context): val = {'invoiced': True} if order.state == 'invoice_except': val['state'] = 'progress'
cr.execute( "UPDATE account_move_line "\ "SET followup_line_id=%s, followup_date=%s "\ "WHERE id=%s", (to_update[id], data['form']['date'], int(id),))
if to_update[id]['partner_id'] in data['form']['partner_ids'][0][2]: cr.execute( "UPDATE account_move_line "\ "SET followup_line_id=%s, followup_date=%s "\ "WHERE id=%s", (to_update[id]['level'], data['form']['date'], int(id),))
def _update_partners(self, cr, uid, data, context): to_update = data['form']['to_update'] for id in to_update.keys(): cr.execute( "UPDATE account_move_line "\ "SET followup_line_id=%s, followup_date=%s "\ "WHERE id=%s", (to_update[id], data['form']['date'], int(id),)) return {}
to_update[str(id)] = fups[followup_line_id][1]
to_update[str(id)]= {'level': fups[followup_line_id][1], 'partner_id': partner_id}
def _get_partners(self, cr, uid, data, context): pool = pooler.get_pool(cr.dbname) cr.execute( "SELECT l.partner_id, l.followup_line_id,l.date_maturity, l.date, l.id "\ "FROM account_move_line AS l "\ "LEFT JOIN account_account AS a "\ "ON (l.account_id=a.id) "\ "WHERE (l.reconcile_id IS NULL) "\ "AND (a.type='receivab...
_order = "sequence"
def unlink(self, cr, uid, ids, *args, **kwargs): for proj in self.browse(cr, uid, ids): if proj.tasks: raise osv.except_osv(_('Operation Not Permitted !'), _('You can not delete a project with tasks. I suggest you to deactivate it.')) return super(project, self).unlink(cr, uid, ids, *args, **kwargs)
'date_from': fields.function(_product_margin, method=True, type='date', string='From Date', multi=True), 'date_to': fields.function(_product_margin, method=True, type='date', string='To Date', multi=True),
'date_from': fields.function(_product_margin, method=True, type='date', string='From Date', multi='product_margin'), 'date_to': fields.function(_product_margin, method=True, type='date', string='To Date', multi='product_margin'),
def _product_margin(self, cr, uid, ids, field_names, arg, context=None): res = {} if context is None: context = {} for val in self.browse(cr, uid, ids,context=context): res[val.id] = {} date_from = context.get('date_from', time.strftime('%Y-01-01')) date_to = context.get('date_to', time.strftime('%Y-12-31')) invoice_st...
('paid','Paid'),('open_paid','Open and Paid'),('draft_open_paid','Draft, Open and Paid') ], string='Invoice State',multi=True, readonly=True), 'sale_avg_price' : fields.function(_product_margin, method=True, type='float', string='Avg. Unit Price', multi='sale',help="Avg. Price in Customer Invoices)"), 'purchase_avg_pri...
('paid','Paid'),('open_paid','Open and Paid'),('draft_open_paid','Draft, Open and Paid') ], string='Invoice State',multi='product_margin', readonly=True), 'sale_avg_price' : fields.function(_product_margin, method=True, type='float', string='Avg. Unit Price', multi='product_margin', help="Avg. Price in Customer Invoice...
def _product_margin(self, cr, uid, ids, field_names, arg, context=None): res = {} if context is None: context = {} for val in self.browse(cr, uid, ids,context=context): res[val.id] = {} date_from = context.get('date_from', time.strftime('%Y-01-01')) date_to = context.get('date_to', time.strftime('%Y-12-31')) invoice_st...
'account_id': a,
'account_id': a.id,
def inv_line_create(self, cr, uid, a, ol): return (0, False, { 'name': ol.name, 'account_id': a, 'price_unit': ol.price_unit or 0.0, 'quantity': ol.product_qty, 'product_id': ol.product_id.id or False, 'uos_id': ol.product_uom.id or False, 'invoice_line_tax_id': [(6, 0, [x.id for x in ol.taxes_id])], 'account_analytic_...