rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
loc_id=False, product_id=False, context=None):
loc_id=False, product_id=False, uom_id=False, context=None):
def onchange_lot_id(self, cr, uid, ids, prodlot_id=False, product_qty=False, loc_id=False, product_id=False, context=None): """ On change of production lot gives a warning message. @param prodlot_id: Changed production lot id @param product_qty: Quantity of product @param loc_id: Location id @param product_id: Product ...
'message': _('You are moving %.2f products but only %.2f available in this lot.') % (product_qty, prodlot.stock_available or 0.0)
'message': _('You are moving %.2f %s products but only %.2f %s available in this lot.') % (product_qty, uom.name, prodlot.stock_available or 0.0, uom.name)
def onchange_lot_id(self, cr, uid, ids, prodlot_id=False, product_qty=False, loc_id=False, product_id=False, context=None): """ On change of production lot gives a warning message. @param prodlot_id: Changed production lot id @param product_qty: Quantity of product @param loc_id: Location id @param product_id: Product ...
def _file_get(self,cr, nodename=False, directory_id=False):
def _file_get(self,cr, nodename=False):
def _file_get(self,cr, nodename=False, directory_id=False): res = [] cntobj = self.context._dirobj.pool.get('document.directory.content') uid = self.context.uid ctx = self.context.context.copy() ctx.update(self.dctx) where = [('directory_id','=',directory_id) ] ids = cntobj.search(cr, uid, where, context=ctx) for conte...
cntobj = self.context._dirobj.pool.get('document.directory.content') uid = self.context.uid ctx = self.context.context.copy() ctx.update(self.dctx) where = [('directory_id','=',directory_id) ] ids = cntobj.search(cr, uid, where, context=ctx) for content in cntobj.browse(cr, uid, ids, context=ctx): res3 = cntobj._file_g...
def _file_get(self,cr, nodename=False, directory_id=False): res = [] cntobj = self.context._dirobj.pool.get('document.directory.content') uid = self.context.uid ctx = self.context.context.copy() ctx.update(self.dctx) where = [('directory_id','=',directory_id) ] ids = cntobj.search(cr, uid, where, context=ctx) for conte...
return super(node_dir,self)._file_get(cr, nodename, self.dir_id)
res = super(node_dir,self)._file_get(cr, nodename) cntobj = self.context._dirobj.pool.get('document.directory.content') uid = self.context.uid ctx = self.context.context.copy() ctx.update(self.dctx) where = [('directory_id','=',self.dir_id) ] ids = cntobj.search(cr, uid, where, context=ctx) for content in cntobj.brows...
def _file_get(self, cr, nodename=False): return super(node_dir,self)._file_get(cr, nodename, self.dir_id)
'password': generate_random_pass(),
'password': password,
def _create_new_share_users(self, cr, uid, wizard_data, group_id, context=None): user_obj = self.pool.get('res.users') current_user = user_obj.browse(cr, uid, uid) user_ids = [] if wizard_data.user_type == 'new': for new_user in wizard_data.new_users.split('\n'): # attempt to show more user-friendly msg than default co...
uom_id = line.product_id.uom_po_id.id
uom_id = line.product_id.uom_po_id and line.product_id.uom_po_id.id or False
def create_order(self, cr, uid, ids, context): """ To Create a purchase orders . @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 @param context: A standard dictionary @return: {} """ record_ids = context and context.get('ac...
newdate = newdate - line.product_id.seller_ids[0].delay
newdate = newdate -(line.product_id.seller_ids and line.product_id.seller_ids[0].delay or DateTime.strptime(tender.date_start, '%Y-%m-%d %H:%M:%S') )
def create_order(self, cr, uid, ids, context): """ To Create a purchase orders . @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 @param context: A standard dictionary @return: {} """ record_ids = context and context.get('ac...
partner = line.product_id.seller_ids[0].name pricelist_id = partner.property_product_pricelist_purchase.id
partner = line.product_id.seller_ids and line.product_id.seller_ids[0].name or supplier_data pricelist_id = partner.property_product_pricelist_purchase and partner.property_product_pricelist_purchase.id
def create_order(self, cr, uid, ids, context): """ To Create a purchase orders . @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 @param context: A standard dictionary @return: {} """ record_ids = context and context.get('ac...
if short: return date.fromtimestamp(time.mktime(time.strptime(idate, '%Y-%m-%d')))
if idate: if short: return date.fromtimestamp(time.mktime(time.strptime(idate, '%Y-%m-%d'))) else: return datetime.strptime(idate, '%Y-%m-%d %H:%M:%S')
def ics_datetime(idate, short=False): if short: return date.fromtimestamp(time.mktime(time.strptime(idate, '%Y-%m-%d'))) else: return datetime.strptime(idate, '%Y-%m-%d %H:%M:%S')
return datetime.strptime(idate, '%Y-%m-%d %H:%M:%S')
return False
def ics_datetime(idate, short=False): if short: return date.fromtimestamp(time.mktime(time.strptime(idate, '%Y-%m-%d'))) else: return datetime.strptime(idate, '%Y-%m-%d %H:%M:%S')
sub = res_obj.name att_infos = []
def _send_mail(self, cr, uid, ids, mail_to, email_from=tools.config.get('email_from', False), context=None): """ Send mail for event invitation to event attendees. @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of attendee’s IDs. @param emai...
else: other_invitation_ids = [] for att2 in self.browse(cr, uid, other_invitation_ids): att_infos.append(((att2.user_id and att2.user_id.name) or \ (att2.partner_id and att2.partner_id.name) or \ att2.email) + ' - Status: ' + att2.state.title()) body_vals = {'name': res_obj.name, 'start_date': res_obj.date, 'end_date'...
for att2 in self.browse(cr, uid, other_invitation_ids): att_infos.append(((att2.user_id and att2.user_id.name) or \ (att2.partner_id and att2.partner_id.name) or \ att2.email) + ' - Status: ' + att2.state.title()) body_vals = {'name': res_obj.name, 'start_date': res_obj.date, 'end_date': res_obj.date_deadline or False,...
def _send_mail(self, cr, uid, ids, mail_to, email_from=tools.config.get('email_from', False), context=None): """ Send mail for event invitation to event attendees. @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of attendee’s IDs. @param emai...
'lines_ids': [(0,0,{
'line_ids': [(0,0,{
def make_po(self, cr, uid, ids, context={}): sequence_obj=self.pool.get('ir.sequence') res = super(mrp_procurement, self).make_po(cr, uid, ids, context) for proc_id,po_id in res.items(): procurement = self.browse(cr, uid, proc_id) if procurement.product_id.purchase_requisition: self.pool.get('purchase.requisition').cre...
toremove = self.pool.get('account.analytic.line').search(cr, uid, [('move_id','=',line.id)], context=context)
toremove = analytic_line_obj.search(cr, uid, [('move_id','=',line.id)], context=context)
def create_analytic_lines(self, cr, uid, ids, context={}): super(account_move_line, self).create_analytic_lines(cr, uid, ids, context) for line in self.browse(cr, uid, ids, context): if line.analytics_id: if not line.journal_id.analytic_journal_id: raise osv.except_osv(_('No Analytic Journal !'),_("You have to define a...
line.unlink(cr, uid, toremove, context=context)
analytic_line_obj.unlink(cr, uid, toremove, context=context)
def create_analytic_lines(self, cr, uid, ids, context={}): super(account_move_line, self).create_analytic_lines(cr, uid, ids, context) for line in self.browse(cr, uid, ids, context): if line.analytics_id: if not line.journal_id.analytic_journal_id: raise osv.except_osv(_('No Analytic Journal !'),_("You have to define a...
ali_id=self.pool.get('account.analytic.line').create(cr,uid,al_vals)
ali_id=analytic_line_obj.create(cr, uid, al_vals, context=context)
def create_analytic_lines(self, cr, uid, ids, context={}): super(account_move_line, self).create_analytic_lines(cr, uid, ids, context) for line in self.browse(cr, uid, ids, context): if line.analytics_id: if not line.journal_id.analytic_journal_id: raise osv.except_osv(_('No Analytic Journal !'),_("You have to define a...
obj_model = self.pool.get('ir.model.data') obj_act = self.pool.get('ir.actions.act_window') order= obj_payment_order.browse(cr, uid, context['active_id'], context) t = order.mode and order.mode.type.code or 'manual' if t == 'manual' : obj_payment_order.set_done(cr,uid,context['active_id'],context) return {} gw = obj_p...
return obj_payment_order.set_done(cr, uid, context['active_id'], context)
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') obj_model = self.pool.get('ir.model.data') obj_act = self.pool.get('ir.actions.act_window') order= obj_payment_o...
return self.pool.get('account.period').find(cr, uid)
period_ids = self.pool.get('account.period').find(cr, uid) return period_ids and period_ids[0] or False
def _get_period(self, cr, uid, context=None): """Return default period value""" return self.pool.get('account.period').find(cr, uid)
vals = model_obj.import_cal(cr, uid, data['file_path'], context['active_id'], context)
vals = model_obj.import_cal(cr, uid, base64.decodestring(data['file_path']), context['active_id'], context)
def process_imp_ics(self, cr, uid, ids, context=None): """ Process Import ics File. @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 import’s IDs @return: dictionary of calendar evet import window with Import successful msg....
cr.execute('SELECT SUM('+mode+') '\ 'FROM account_move_line '\ 'WHERE move_id=%s AND id<>%s', (move.id, line_id2))
cr.execute('SELECT SUM(%s) FROM account_move_line WHERE move_id=%%s AND id!=%%s' % (mode,), (move.id, line_id2))
def _centralise(self, cr, uid, move, mode, context=None): if context is None: context = {}
'process_type_id' :fields.many2one('change.process.type','Type Change'),
'process_type_id' :fields.many2one('document.change.process.type','Type Change'),
def _latestmodification(self, cr, uid, ids, field_name, arg, context={}): res = {} #TODOto calculate latest modified date from all related documents return res
'user_id':field.many2one('res.users','Change Owner'),
'user_id':fields.many2one('res.users','Change Owner'),
def _latestmodification(self, cr, uid, ids, field_name, arg, context={}): res = {} #TODOto calculate latest modified date from all related documents return res
bom_point = sbom_obj.browse(cr, uid, [bom_id])[0]
bom_point = bom_obj.browse(cr, uid, [bom_id])[0]
def change_prod_qty(self, cr, uid, ids, context): """ Changes the Quantity of Product. @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param ids: List of IDs selected @param context: A standard dictionary @return: """ record_id = context and context.get('...
'date': fields.datetime('Created Date'),
'date': fields.datetime('Creation Date'),
def _check_product_lot(self, cr, uid, ids): """ Checks whether move is done or not and production lot is assigned to that move. @return: True or False """ for move in self.browse(cr, uid, ids): if move.prodlot_id and move.state == 'done' and (move.prodlot_id.product_id.id != move.product_id.id): return False return Tru...
'location_dest_id': fields.many2one('stock.location', 'Dest. Location', required=True, select=True, help="Location where the system will stock the finished products."), 'address_id': fields.many2one('res.partner.address', 'Dest. Address', help="Address where goods are to be delivered"),
'location_dest_id': fields.many2one('stock.location', 'Destination Location', required=True, select=True, help="Location where the system will stock the finished products."), 'address_id': fields.many2one('res.partner.address', 'Destination Address', help="Optional address where goods are to be delivered, specifically ...
def _check_product_lot(self, cr, uid, ids): """ Checks whether move is done or not and production lot is assigned to that move. @return: True or False """ for move in self.browse(cr, uid, ids): if move.prodlot_id and move.state == 'done' and (move.prodlot_id.product_id.id != move.product_id.id): return False return Tru...
'tracking_id': fields.many2one('stock.tracking', 'Pack', select=True, help="This is the code that will be put on the logistical unit: pallet, box, pack."),
'tracking_id': fields.many2one('stock.tracking', 'Pack', select=True, help="Logistical shipping unit: pallet, box, pack ..."),
def _check_product_lot(self, cr, uid, ids): """ Checks whether move is done or not and production lot is assigned to that move. @return: True or False """ for move in self.browse(cr, uid, ids): if move.prodlot_id and move.state == 'done' and (move.prodlot_id.product_id.id != move.product_id.id): return False return Tru...
'move_dest_id': fields.many2one('stock.move', 'Dest. Move'), 'move_history_ids': fields.many2many('stock.move', 'stock_move_history_ids', 'parent_id', 'child_id', 'Move History'), 'move_history_ids2': fields.many2many('stock.move', 'stock_move_history_ids', 'child_id', 'parent_id', 'Move History'),
'move_dest_id': fields.many2one('stock.move', 'Destination Move', help="Optional: next stock move when chaining them"), 'move_history_ids': fields.many2many('stock.move', 'stock_move_history_ids', 'parent_id', 'child_id', 'Move History (child moves)'), 'move_history_ids2': fields.many2many('stock.move', 'stock_move_his...
def _check_product_lot(self, cr, uid, ids): """ Checks whether move is done or not and production lot is assigned to that move. @return: True or False """ for move in self.browse(cr, uid, ids): if move.prodlot_id and move.state == 'done' and (move.prodlot_id.product_id.id != move.product_id.id): return False return Tru...
if not context: context={} group_id = self.pool.get('res.groups').search(cr, uid, [('name', 'in', ('Administration / Configuration','Administration / Access Rights'))]) user_obj = self.pool.get('res.users') group=[] user_rec = user_obj.read(cr, uid, uid) for move in self.browse(cr, uid, ids): if move.state=='done': gro...
if uid != 1: for move in self.browse(cr, uid, ids): if move.state == 'done': frozen_fields = set(['product_qty', 'product_uom', 'product_uos_qty', 'product_uos', 'location_id', 'location_dest_id', 'product_id']) if frozen_fields.intersection(vals): raise osv.except_osv(_('Operation forbidden'), _('Quantities, UoMs, Pro...
def write(self, cr, uid, ids, vals, context=None): if not context: context={} group_id = self.pool.get('res.groups').search(cr, uid, [('name', 'in', ('Administration / Configuration','Administration / Access Rights'))]) user_obj = self.pool.get('res.users') group=[] user_rec = user_obj.read(cr, uid, uid) for move in se...
def stage_next(self, cr, uid, ids, context=None): """This function computes next stage for case from its current stage using available stage for that case type @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...
def _find_next_stage(self, cr, uid, stage_list, index, current_seq, stage_pool, context=None): if index + 1 == len(stage_list): return False print "cul" print index next_stage_id = stage_list[index + 1] next_stage = stage_pool.browse(cr, uid, next_stage_id, context=context) if not next_stage: return False next_seq = n...
def stage_next(self, cr, uid, ids, context=None): """This function computes next stage for case from its current stage using available stage for that case type @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...
stages = stage_pool.search(cr, uid, domain, order='sequence')
stages = stage_pool.search(cr, uid, domain, order=order) current_seq = case.stage_id.sequence
def stage_next(self, cr, uid, ids, context=None): """This function computes next stage for case from its current stage using available stage for that case type @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...
if index + 1 == len(stages): return False else: next_stage = stages[index + 1] current_seq = case.stage_id.sequence
print stages print "call" next_stage = self._find_next_stage(cr, uid, stages, index, current_seq, stage_pool, context=context)
def stage_next(self, cr, uid, ids, context=None): """This function computes next stage for case from its current stage using available stage for that case type @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...
stage = stage_pool.browse(cr, uid, next_stage, context=context) next_seq = stage.sequence if current_seq and (next_seq - current_seq) >= 1: data = {'stage_id': next_stage} if stage.on_change: data.update({'probability': stage.probability})
next_stage_id = next_stage.id data = {'stage_id': next_stage.id} if next_stage.on_change: data.update({'probability': next_stage.probability})
def stage_next(self, cr, uid, ids, context=None): """This function computes next stage for case from its current stage using available stage for that case type @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...
return next_stage
return next_stage_id def stage_next(self, cr, uid, ids, context=None): """This function computes next stage for case from its current stage using available stage for that case type @param self: The object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security chec...
def stage_next(self, cr, uid, ids, context=None): """This function computes next stage for case from its current stage using available stage for that case type @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...
if not context: context = {} stage_pool = self.pool.get('crm.case.stage') stage_type = context and context.get('stage_type','') for case in self.browse(cr, uid, ids, context): prev_stage = False data = {} domain = [('type', '=', stage_type),('section_ids', '=', case.section_id.id)] if case.section_id and case.section_i...
return self.stage_change(cr, uid, ids, context=context, order='sequence desc')
def stage_previous(self, cr, uid, ids, context=None): """This function computes previous stage for case from its current stage using available stage for that case type @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:...
def onchange_multi_level_bom(self, cr, uid, ids, multi_level_bom, context={}): """ Changes multi_level_bom. @param multi_level_bom: Changed multi_level_bom @return: Dictionary of changed values """ bom_ids = ids and ids[0] bom = self.browse(cr, uid, bom_ids) line_ids = bom and map(lambda x:x.id, bom.bom_lines) if mult...
def onchange_product_id(self, cr, uid, ids, product_id, name, context={}): """ Changes UoM and name if product_id changes. @param name: Name of the field @param product_id: Changed product_id @return: Dictionary of changed values """ if product_id: prod = self.pool.get('product.product').browse(cr, uid, [product_id])[...
message = type_list.get(vals.get('type', False), _('Picking')) + " '" + (vals['name'] or "n/a") + _(" with origin")+" '" + (vals['origin'] or "n/a") + "' "+ _("is created.")
message = type_list.get(vals.get('type', False), _('Picking')) + " '" + (vals.get('name', 'n/a')) + _(" with origin")+" '" + vals.get('origin', 'n/a') + "' "+ _("is created.")
def create(self, cr, user, vals, context=None): if ('name' not in vals) or (vals.get('name')=='/'): seq_obj_name = 'stock.picking.' + vals['type'] vals['name'] = self.pool.get('ir.sequence').get(cr, user, seq_obj_name) type_list = { 'out':_('Packing List'), 'in':_('Reception'), 'internal': _('Internal picking'), 'deli...
hrs = float(planned / occupation_rate)
hrs = float(planned / float(occupation_rate))
def onchange_planned(self, cr, uid, ids, project, user_id=False, planned=0.0, effective=0.0, date_start=None, occupation_rate=0.0): result = {} if date_start: resource_pool = self.pool.get('resource.resource') project_pool = self.pool.get('project.project') resource_calendar = self.pool.get('resource.calendar') dt_star...
'get_start_date': self.get_start_date, 'get_end_date': self.get_end_date,
'get_start_date': self._get_start_date, 'get_end_date': self._get_end_date,
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, 'periods': self.periods, 'sum_debit_period': self._sum_debit_per...
qty)[res['base_pricelist_id']]
qty, context=context)[res['base_pricelist_id']]
def _create_parent_category_list(id, lst): if not id: return [] parent = product_category_tree.get(id) if parent: lst.append(parent) return _create_parent_category_list(parent, lst) else: return lst
journal_data = obj_journal.browse(cr, uid, context['journal'])
journal_data = journal_obj.browse(cr, uid, context['journal'])
def _default_get(self, cr, uid, fields, context={}): if not context.get('journal_id', False) and context.get('search_default_journal_id', False): context['journal_id'] = context.get('search_default_journal_id') account_obj = self.pool.get('account.account') period_obj = self.pool.get('account.period') journal_obj = sel...
to_char(date_close, 'YYYY') as name, to_char(date_close, 'MM') as month,
to_char(date_end, 'YYYY') as name, to_char(date_end, 'MM') as month,
def init(self, cr): tools.sql.drop_view_if_exists(cr, 'report_project_task_user') cr.execute(""" create or replace view report_project_task_user as ( select min(t.id) as id, to_char(date_close, 'YYYY') as name, to_char(date_close, 'MM') as month, count(distinct t.id) as task_closed, t.user_id, t.project_id, sum(planned...
to_char(avg(date_close::abstime-t.create_date::timestamp), 'DD"d" HH24:MI:SS') as closing_days,
to_char(avg(date_end::abstime-t.create_date::timestamp), 'DD"d" HH24:MI:SS') as closing_days,
def init(self, cr): tools.sql.drop_view_if_exists(cr, 'report_project_task_user') cr.execute(""" create or replace view report_project_task_user as ( select min(t.id) as id, to_char(date_close, 'YYYY') as name, to_char(date_close, 'MM') as month, count(distinct t.id) as task_closed, t.user_id, t.project_id, sum(planned...
to_char(date_close, 'YYYY'),to_char(date_close, 'MM'),t.user_id,project_id
to_char(date_end, 'YYYY'),to_char(date_end, 'MM'),t.user_id,project_id
def init(self, cr): tools.sql.drop_view_if_exists(cr, 'report_project_task_user') cr.execute(""" create or replace view report_project_task_user as ( select min(t.id) as id, to_char(date_close, 'YYYY') as name, to_char(date_close, 'MM') as month, count(distinct t.id) as task_closed, t.user_id, t.project_id, sum(planned...
to_char(date_close, 'YYYY') as name, to_char(date_close, 'MM') as month,
to_char(date_end, 'YYYY') as name, to_char(date_end, 'MM') as month,
def init(self, cr): tools.sql.drop_view_if_exists(cr, 'report_project_task') cr.execute(""" create or replace view report_project_task as ( select min(t.id) as id, to_char(date_close, 'YYYY') as name, to_char(date_close, 'MM') as month, count(distinct t.id) as task_closed, t.project_id, sum(planned_hours) as hours_plan...
to_char(avg(date_close::abstime-t.create_date::timestamp), 'DD"d" HH12:MI:SS') as closing_days,
to_char(avg(date_end::abstime-t.create_date::timestamp), 'DD"d" HH12:MI:SS') as closing_days,
def init(self, cr): tools.sql.drop_view_if_exists(cr, 'report_project_task') cr.execute(""" create or replace view report_project_task as ( select min(t.id) as id, to_char(date_close, 'YYYY') as name, to_char(date_close, 'MM') as month, count(distinct t.id) as task_closed, t.project_id, sum(planned_hours) as hours_plan...
to_char(date_close, 'YYYY'),to_char(date_close, 'MM'),project_id
to_char(date_end, 'YYYY'),to_char(date_end, 'MM'),project_id
def init(self, cr): tools.sql.drop_view_if_exists(cr, 'report_project_task') cr.execute(""" create or replace view report_project_task as ( select min(t.id) as id, to_char(date_close, 'YYYY') as name, to_char(date_close, 'MM') as month, count(distinct t.id) as task_closed, t.project_id, sum(planned_hours) as hours_plan...
factor = production.product_qty * production.product_uom.factor / bom_point.product_uom.factor
factor = production.product_qty * production.product_uom.factor_inv / bom_point.product_uom.factor
def action_compute(self, cr, uid, ids, properties=[]): """ Computes bills of material of a product. @param properties: List containing dictionaries of properties. @return: No. of products. """ results = [] bom_obj = self.pool.get('mrp.bom') prod_line_obj = self.pool.get('mrp.production.product.line') workcenter_line_ob...
self.pool.get('stock.move').action_done(cr, uid, new_moves)
def action_production_end(self, cr, uid, ids):
self.pool.get('stock.move').action_done(cr, uid, move_ids)
def action_production_end(self, cr, uid, ids):
if not default.get('name',False): default['name'] = self.pool.get('ir.sequence').get(cr, uid, 'stock.picking')
picking_obj = self.browse(cr, uid, [id], context)[0] if ('name' not in default) or (picking_obj.get('name')=='/'): seq_obj_name = 'stock.picking.' + picking_obj.type default['name'] = self.pool.get('ir.sequence').get(cr, uid, seq_obj_name)
def copy(self, cr, uid, id, default=None, context={}): if default is None: default = {} default = default.copy() if not default.get('name',False): default['name'] = self.pool.get('ir.sequence').get(cr, uid, 'stock.picking') return super(stock_picking, self).copy(cr, uid, id, default, context)
return_false = False
for id in ids: res[id] = {}.fromkeys(name, 0)
def _user_left_days(self, cr, uid, ids, name, args, context={}): res = {} return_false = False if context and context.has_key('employee_id'): if not context['employee_id']: return_false = True employee_id = context['employee_id'] else: employee_ids = self.pool.get('hr.employee').search(cr, uid, [('user_id','=',uid)]) i...
'<a href="
+ \
def insert_pad_link(self, output): # Insert the link on the line right after the link to open the # attachment form form_opener_insertion = output.index( '\n', output.index(self.ADD_ATTACHMENT_BUTTON)) + 1 output = output[:form_opener_insertion] + \ '<a href="#" id="add-pad" class="button-a">${_("Pad")}</a>\n' + \ outp...
domain="['|',('section_id','=',section_id),('section_id','=',False), ('object_id.model', '=', 'crm.project.bug')]"),
domain="['|',('section_id','=',section_id),('section_id','=',False), ('object_id.model', '=', 'crm.lead')]"),
def _compute_day(self, cr, uid, ids, fields, args, context={}): """ @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of Openday’s IDs @return: difference between current date and log date @param context: A standard dictionary for contextual va...
print "<<<<<<<<<<<<<<s<<<<<<<<"
def action_done(self, cr, uid, ids, context={}): track_flag = False picking_ids = [] lines=[] sale=[] purchase=[] product_uom_obj = self.pool.get('product.uom') price_type_obj = self.pool.get('product.price.type') product_obj=self.pool.get('product.product') move_obj = self.pool.get('account.move') for move in self.bro...
lines=sale[0] +purchase[0]
def action_done(self, cr, uid, ids, context={}): track_flag = False picking_ids = [] lines=[] sale=[] purchase=[] product_uom_obj = self.pool.get('product.uom') price_type_obj = self.pool.get('product.price.type') product_obj=self.pool.get('product.product') move_obj = self.pool.get('account.move') for move in self.bro...
'line_id':lines,
'line_id':(purchase and purchase[0]) or( sale and sale[0]),
def action_done(self, cr, uid, ids, context={}): track_flag = False picking_ids = [] lines=[] sale=[] purchase=[] product_uom_obj = self.pool.get('product.uom') price_type_obj = self.pool.get('product.price.type') product_obj=self.pool.get('product.product') move_obj = self.pool.get('account.move') for move in self.bro...
cr.execute("select count(id) from email_server where user='%s' and password='%s'", (vals['user'], vals['password']))
cr.execute("select count(id) from email_server where user=%s and password=%s", (vals['user'], vals['password']))
def check_duplicate(self, cr, uid, ids):
res = super(crm_send_new_email, self).default_get(cr, uid, fields, context=context)
res = super(crm_send_new_email2, self).default_get(cr, uid, fields, context=context)
def default_get(self, cr, uid, fields, context=None): """ This function gets default values """ if not context: context = {}
amount = currency_obj.compute(cr, uid, line.currency_id.id,
amount = currency_obj.compute(cursor, user, line.currency_id.id,
def populate_statement(self, cr, uid, ids, context=None):
else: if line.debit > 0: amount=line.debit elif line.credit > 0: amount=-line.credit
elif (line.invoice and line.invoice.currency_id.id <> statement.currency.id): amount = currency_obj.compute(cursor, user, line.invoice.currency_id.id, statement.currency.id, amount, context=ctx)
def populate_statement(self, cr, uid, ids, context=None):
users = self.pool.get('res_users')
users = self.pool.get('res.users')
def set_default_menu(self, cr, uid, menu, context=None): users = self.pool.get('res_users') users.write(cr, uid, users.search(cr, uid, [('action_id','=','Setup')], context=context), {'action_id': menu.id}, context=context) users.write(cr, uid, users.search(cr, uid, [('menu_id','=','Setup')], context=context), {'menu_id...
'factor': fields.float('Ratio', required=True,digits=(12, 6),
'factor': fields.float('Ratio', required=True,digits=(12, 12),
def create(self, cr, uid, data, context={}): if 'factor_inv' in data: if data['factor_inv'] <> 1: data['factor'] = self._compute_factor_inv(data['factor_inv']) del(data['factor_inv']) return super(product_uom, self).create(cr, uid, data, context)
res = dict.fromkeys(ids, {name: 0})
res = dict.fromkeys(ids, {'leaves_taken': 0, 'remaining_leaves': 0, 'max_leaves': 0})
def _user_left_days(self, cr, uid, ids, name, args, context=None): if context is None: context = {} return_false = False employee_id = False res = {}
company_id = period_obj.browse(cr, uid, data['form']['period_from'], context=context).company_id
company_id = period_obj.browse(cr, uid, data['form']['period_from'], context=context).company_id.id
def _build_contexts(self, cr, uid, ids, data, context=None): if context is None: context = {} result = {} period_obj = self.pool.get('account.period') fiscal_obj = self.pool.get('account.fiscalyear') result['fiscalyear'] = 'fiscalyear_id' in data['form'] and data['form']['fiscalyear_id'] or False result['journal_ids'] ...
raise osv.except_osv(_('Error !'), _('User %s does not have rights to access %s journal !' % (statement.user_id.name, statement.journal_id.name)))
raise osv.except_osv(_('Error !'), (_('User %s does not have rights to access %s journal !') % (statement.user_id.name, statement.journal_id.name)))
def button_open(self, cr, uid, ids, context=None): """ Changes statement state to Running. @return: True """ if context is None: context = {} statement_pool = self.pool.get('account.bank.statement') for statement in statement_pool.browse(cr, uid, ids, context=context): vals = {} force_allow = context.get('force_allow',...
type1 = context['type'] or 'move_history_ids'
type1 = context['type'] or 'move_history_ids2'
def action_traceability(self, cr, uid, ids, context={}): """ It traces the information of a product @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param ids: List of IDs selected @param context: A standard dictionary @return: A dictionary of values """
'name': ((type1=='move_history_ids') and 'Donwstream Traceability') or 'Upstream Traceability',
'name': ((type1=='move_history_ids2') and 'Upstream Traceability') or 'Downstream Traceability',
def action_traceability(self, cr, uid, ids, context={}): """ It traces the information of a product @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param ids: List of IDs selected @param context: A standard dictionary @return: A dictionary of values """
self.pool.get('stock.move').action_confirm(cr, uid, [move]) self.pool.get('stock.move').force_assign(cr,uid, [move])
todo_moves.append(move) self.pool.get('stock.move').action_confirm(cr, uid, todo_moves) self.pool.get('stock.move').force_assign(cr, uid, todo_moves)
def action_picking_create(self,cr, uid, ids, *args): picking_id = False for order in self.browse(cr, uid, ids): loc_id = order.partner_id.property_stock_supplier.id istate = 'none' if order.invoice_method=='picking': istate = '2binvoiced' pick_name = self.pool.get('ir.sequence').get(cr, uid, 'stock.picking.in') picking...
self.write(cr, uid, move.id, {'state':'assigned'})
self.write(cr, uid, [move.id], {'state':'assigned'})
def check_assign(self, cr, uid, ids, context=None): """ Checks the product type and accordingly writes the state. @return: No. of moves done """ done = [] count = 0 pickings = {} if context is None: context = {} for move in self.browse(cr, uid, ids, context=context): if move.product_id.type == 'consu': if move.state in...
ret = super(users,self).login(db, login, password)
ret = super(users,self).login(db, login, password) tools.debug(ret)
def login(self, db, login, password): ret = super(users,self).login(db, login, password) if ret: return ret pool = pooler.get_pool(db) cr = pooler.get_db(db).cursor() action_obj = pool.get('ir.actions.actions') cr.execute(""" SELECT id, company, ldap_server, ldap_server_port, ldap_binddn, ldap_password, ldap_filter, ld...
SELECT id, company, ldap_server, ldap_server_port, ldap_binddn, ldap_password, ldap_filter, ldap_base, \"user\", create_user FROM res_company_ldap
SELECT id, company, ldap_server, ldap_server_port, ldap_binddn, ldap_password, ldap_filter, ldap_base, "user", create_user FROM res_company_ldap
def login(self, db, login, password): ret = super(users,self).login(db, login, password) if ret: return ret pool = pooler.get_pool(db) cr = pooler.get_db(db).cursor() action_obj = pool.get('ir.actions.actions') cr.execute(""" SELECT id, company, ldap_server, ldap_server_port, ldap_binddn, ldap_password, ldap_filter, ld...
if l.bind_s(dn, passwd):
if l.bind_s(dn, password):
def login(self, db, login, password): ret = super(users,self).login(db, login, password) if ret: return ret pool = pooler.get_pool(db) cr = pooler.get_db(db).cursor() action_obj = pool.get('ir.actions.actions') cr.execute(""" SELECT id, company, ldap_server, ldap_server_port, ldap_binddn, ldap_password, ldap_filter, ld...
pool = pooler.get_pool(db) cr = pooler.get_db(db).cursor()
cr = pooler.get_db(db).cursor()
def check(self, db, uid, passwd): try: return super(users,self).check(db, uid, passwd) except: # AccessDenied pass pool = pooler.get_pool(db) cr = pooler.get_db(db).cursor() user = self.browse(cr, 1, uid) if user and user.company_id.ldaps: for res_company_ldap in user.company_id.ldaps: try: l = ldap.open(res_company_ld...
name = result_data[0][1]['cn']
def check(self, db, uid, passwd): try: return super(users,self).check(db, uid, passwd) except: # AccessDenied pass pool = pooler.get_pool(db) cr = pooler.get_db(db).cursor() user = self.browse(cr, 1, uid) if user and user.company_id.ldaps: for res_company_ldap in user.company_id.ldaps: try: l = ldap.open(res_company_ld...
'res_users': menu.res_model,
'res_model': menu.res_model,
def menu(self, cr, uid, ids, context=None): menu = self.get_default_menu(cr, uid, context=context) self.set_default_menu(cr, uid, menu, context=context)
'description': fields.text('Description'),
'description': fields.text('Note'),
def _compute_day(self, cr, uid, ids, fields, args, context={}): """ @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of Openday’s IDs @return: difference between current date and log date @param context: A standard dictionary for contextual va...
manager = self.pool.get('hr.department').browse(cr, uid, department_id).manager_id.id return {'value': {'parent_id':manager or False}}
if not department_id: return {'value':{'parent_id': False}} manager = self.pool.get('hr.department').browse(cr, uid, department_id).manager_id return {'value': {'parent_id':manager and manager.id or False}}
def onchange_department(self, cr, uid, ids, department_id, context=None): manager = self.pool.get('hr.department').browse(cr, uid, department_id).manager_id.id return {'value': {'parent_id':manager or False}}
'photo': fields.binary('Photo')
'photo': fields.binary('Photo'), 'passport_id':fields.char('Passport', size=64)
def job_open(self, cr, uid, ids, *args): self.write(cr, uid, ids, {'state': 'open'}) return True
self.res_find_all = parent.res_find_all
if isinstance(parent, node_res_dir): self.res_find_all = parent.res_find_all else: self.res_find_all = False
def __init__(self, path, dir_id, parent, context, res_model, res_bo, res_id = None): super(node_res_obj,self).__init__(path, parent,context) assert parent #todo: more info from dirr self.dir_id = dir_id self.mimetype = 'application/x-directory' # 'httpd/unix-directory' self.create_date = parent.create_date # TODO: the ...
res.append(klass(res_name, dir_id=self.dir_id, parent=self, context=self.context, res_model=self.res_model, res_bo=bo))
rnode = klass(res_name, dir_id=self.dir_id, parent=self, context=self.context, res_model=self.res_model, res_bo=bo) rnode.res_find_all = self.res_find_all res.append(rnode)
def _child_get(self, cr, name=None, domain=None): dirobj = self.context._dirobj
res.append(klass(dirr.name, dirr.id, self, self.context, self.res_model, res_bo = None, res_id = self.res_id))
res.append(klass(dirr.name, dirr.id, self, self.context, self.res_model, res_bo = bo, res_id = self.res_id))
def _child_get(self, cr, name=None, domain=None): dirobj = self.context._dirobj
where5 = where4 + [('ressource_id','=',0)]
where5 = where4 + ['|', ('ressource_id','=',0), ('ressource_id','=',self.res_id)]
def _child_get(self, cr, name=None, domain=None): dirobj = self.context._dirobj
where5 = where4 + [('ressource_id','=',self.res_id)] dirids = dirids + dirobj.search(cr,uid, where5)
def _child_get(self, cr, name=None, domain=None): dirobj = self.context._dirobj
res.append(klass(dirr.name, dirr.id, self, self.context, self.res_model, res_bo = None, res_id = self.res_id))
rnode = klass(dirr.name, dirr.id, self, self.context, self.res_model, res_bo = bo, res_id = self.res_id) rnode.res_find_all = dirr.resource_find_all res.append(rnode)
def _child_get(self, cr, name=None, domain=None): dirobj = self.context._dirobj
res.append(klass(dirr.name, self, self.context, dirr, {'active_id': self.res_id}))
rnode = klass(dirr.name, self, self.context, dirr, {'active_id': self.res_id}) rnode.res_find_all = dirr.resource_find_all res.append(rnode)
def _child_get(self, cr, name=None, domain=None): dirobj = self.context._dirobj
'parent_id' : False
'parent_id' : False, 'resource_find_all': False,
def create_child_collection(self, cr, objname): dirobj = self.context._dirobj is_allowed = self.check_perms(2) if not is_allowed: raise IOError(errno.EPERM,"Permission denied")
'factor': fields.float('Ratio', digits_compute=dp.get_precision('Product UoM'), required=True,
'factor': fields.float('Ratio', required=True,digits=(12, 6),
def create(self, cr, uid, data, context={}): if 'factor_inv' in data: if data['factor_inv'] <> 1: data['factor'] = self._compute_factor_inv(data['factor_inv']) del(data['factor_inv']) return super(product_uom, self).create(cr, uid, data, context)
emails = [obj.email_to]
emails = re.findall(r'([^ ,<@]+@[^> ,]+)', obj.email_to or '')
def action_send(self, cr, uid, ids, context=None): """ This sends an email to ALL the addresses of the selected partners. """ hist_obj = self.pool.get('mailgate.message')
res.update({'reply_to': case.section_id.reply_to})
res.update({'reply_to': case.section_id.reply_to or ''})
def get_reply_defaults(self, cr, uid, fields, context=None): """ This function gets default values for reply mail """ hist_obj = self.pool.get('mailgate.message') res_ids = context and context.get('active_ids', []) or []
'product_packaging': False
'product_packaging': False, 'price_unit': 0.0,
def _number_packages(self, cr, uid, ids, field_name, arg, context=None): 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':{'date_from':product_margin_obj.from_date,'date_to':product_margin_obj.to_date,'invoice_state' : product_margin_obj.invoice_state},
'context': context,
def action_open_window(self, cr, uid, ids, context=None): """ @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: the ID or list of IDs if we want more than one
ids = move_line_pool.search(cr, uid, [('account_id.type', '=', account_type), ('reconcile_id', '=', False), ('partner_id', '=', partner_id)], context=context)
ids = move_line_pool.search(cr, uid, [('state','=','valid'), ('account_id.type', '=', account_type), ('reconcile_id', '=', False), ('partner_id', '=', partner_id)], context=context)
def onchange_partner_id(self, cr, uid, ids, partner_id, journal_id, price, currency_id, ttype, context=None): """price Returns a dict that contains new values and context
prod_obj = self.pool.get('product.template') location_obj = self.pool.get('stock.location') lot_obj = self.pool.get('stock.report.prodlots') move_obj = self.pool.get('account.move') move_line_obj = self.pool.get('account.move.line') data_obj = self.pool.get('ir.model.data') res = self.read(cr, uid, ids[0], ['new_price...
assert rec_id, _('Active ID is not set in Context') prod_obj = self.pool.get('product.product') res = self.browse(cr, uid, ids) datas = { 'new_price' : res[0].new_price, 'stock_output_account' : res[0].stock_account_output.id, 'stock_input_account' : res[0].stock_account_input.id, 'stock_journal' : res[0].stock_journal...
def change_price(self, cr, uid, ids, context): """ Changes the Standard Price of Product. And creates an account move accordingly.
return [(r['id'], r['name'] + ' - ' + r['vat']) \
return [(r['id'], r['name'] or '' + ' - ' + r['vat'] or '') \
def name_get(self, cr, uid, ids, context={}): if not len(ids): return [] return [(r['id'], r['name'] + ' - ' + r['vat']) \ for r in self.read(cr, uid, ids, ['name', 'vat'], context, load='_classic_write')]
attrs.append('string="'+field_it[2]+'"')
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): journal_pool = self.pool.get('account.journal') if context is None: context = {} result = super(osv.osv, self).fields_view_get(cr, uid, view_id, view_type, context=context, toolbar=toolbar, submenu=submenu) i...
'scrum_master_id': fields.many2one('res.users', 'Scrum Manager', required=True,help="The person who is maintains the processes for the product"),
'scrum_master_id': fields.many2one('res.users', 'Scrum Master', required=True,help="The person who is maintains the processes for the product"),
def button_pending(self, cr, uid, ids, context={}): self.write(cr, uid, ids, {'state':'pending'}, context=context) return True
self.email_send(cr, uid, ids, email)
self.email_send(cr, uid, ids, meeting_id.sprint_id.scrum_master_id.user_email)
def button_send_to_master(self, cr, uid, ids, context=None): meeting_id = self.browse(cr, uid, ids)[0] user = self.pool.get('res.users').browse(cr, uid, uid, context=context) if meeting_id and meeting_id.sprint_id.scrum_master_id.user_email: self.email_send(cr, uid, ids, email) else: raise osv.except_osv(_('Error !'), ...
self.email_send(cr,uid,ids,email)
self.email_send(cr,uid,ids,meeting_id.sprint_id.product_owner_id.user_email)
def button_send_product_owner(self, cr, uid, ids, context=None): meeting_id = self.browse(cr, uid, ids)[0] if meeting_id.sprint_id.product_owner_id.user_email: self.email_send(cr,uid,ids,email) else: raise osv.except_osv(_('Error !'), _('Please provide email address for product owner defined on sprint.')) return True
DROP LANGUAGE IF EXISTS plpgsql CASCADE; CREATE LANGUAGE plpgsql ;
def execute(self, cr, uid, ids, context=None): """ This function is used to create contact and address from existing partner address """ obj = self.pool.get("base.contact.installer").browse(cr, uid, uid, context=context) if obj.migrate: cr.execute("""DROP TRIGGER IF EXISTS contactjob on res_partner_contact; DROP LANGU...