bugged
stringlengths
4
228k
fixed
stringlengths
0
96.3M
__index_level_0__
int64
0
481k
def process_function(self, node): if self.mode != 'init': return function, values = node.items()[0] local_context = {'ref': self._ref, '_ref': self._ref} context = self.get_context(node, local_context) args = [] if function.eval: args = eval(function.eval, local_context) for value in values: if not 'model' in value and (not 'eval' in value or not 'search' in value): raise YamlImportException('You must provide a "model" and an "eval" or "search" to evaluate.') value_model = self.get_model(value['model']) local_context = {'ref': self._ref, '_ref': self._ref} local_context['obj'] = lambda x: value_model.browse(self.cr, self.uid, x, context=context) local_context.update(self.id_map) id = eval(value['eval'], local_context) if id != None: args.append(id) model = self.get_model(function.model) method = function.name getattr(model, method)(self.cr, self.uid, *args)
def process_function(self, node): if self.mode != 'init': return local_context = {'ref': self._ref, '_ref': self._ref} context = self.get_context(node, local_context) args = [] if function.eval: args = eval(function.eval, local_context) for value in values: if not 'model' in value and (not 'eval' in value or not 'search' in value): raise YamlImportException('You must provide a "model" and an "eval" or "search" to evaluate.') value_model = self.get_model(value['model']) local_context = {'ref': self._ref, '_ref': self._ref} local_context['obj'] = lambda x: value_model.browse(self.cr, self.uid, x, context=context) local_context.update(self.id_map) id = eval(value['eval'], local_context) if id != None: args.append(id) model = self.get_model(function.model) method = function.name getattr(model, method)(self.cr, self.uid, *args)
468,300
def process_function(self, node): if self.mode != 'init': return function, values = node.items()[0] local_context = {'ref': self._ref, '_ref': self._ref} context = self.get_context(node, local_context) args = [] if function.eval: args = eval(function.eval, local_context) for value in values: if not 'model' in value and (not 'eval' in value or not 'search' in value): raise YamlImportException('You must provide a "model" and an "eval" or "search" to evaluate.') value_model = self.get_model(value['model']) local_context = {'ref': self._ref, '_ref': self._ref} local_context['obj'] = lambda x: value_model.browse(self.cr, self.uid, x, context=context) local_context.update(self.id_map) id = eval(value['eval'], local_context) if id != None: args.append(id) model = self.get_model(function.model) method = function.name getattr(model, method)(self.cr, self.uid, *args)
def process_function(self, node): if self.mode != 'init': return function, values = node.items()[0] local_context = {'ref': self._ref, '_ref': self._ref} context = self.get_context(function, local_context) args = [] if function.eval: args = eval(function.eval, local_context) for value in values: if not 'model' in value and (not 'eval' in value or not 'search' in value): raise YamlImportException('You must provide a "model" and an "eval" or "search" to evaluate.') value_model = self.get_model(value['model']) local_context = {'ref': self._ref, '_ref': self._ref} local_context['obj'] = lambda x: value_model.browse(self.cr, self.uid, x, context=context) local_context.update(self.id_map) id = eval(value['eval'], local_context) if id != None: args.append(id) model = self.get_model(function.model) method = function.name getattr(model, method)(self.cr, self.uid, *args)
468,301
def process_menuitem(self, node): self.validate_xml_id(node.id)
def process_menuitem(self, node): self.validate_xml_id(node.id)
468,302
def process_act_window(self, node): self.validate_xml_id(node.id) view_id = False if node.view: view_id = self.get_id(node.view) context = eval(node.context, {'ref': self._ref, '_ref': self._ref})
def process_act_window(self, node): self.validate_xml_id(node.id) view_id = False if node.view: view_id = self.get_id(node.view) context = eval(node.context, {'ref': self._ref, '_ref': self._ref})
468,303
def process_url(self, node): self.validate_xml_id(node.id)
def process_url(self, node): self.validate_xml_id(node.id)
468,304
def read_group(self, cr, uid, domain, fields, groupby, offset=0, limit=None, context=None): """ Get the list of records in list view grouped by the given ``groupby`` fields
def read_group(self, cr, uid, domain, fields, groupby, offset=0, limit=None, context=None): """ Get the list of records in list view grouped by the given ``groupby`` fields
468,305
def uid2openobjectid(cr, uidval, oomodel, rdate): """ UID To Open Object Id @param cr: the current row, from the database cursor, @param uidval: Get USerId vale @oomodel: Open Object ModelName @param rdate: Get Recurrent Date """ __rege = re.compile(r'OpenObject-([\w|\.]+)_([0-9]+)@(\w+)$') if not uidval: return (False, None) wematch = __rege.match(uidval.encode('utf8')) if not wematch: return (False, None) else: model, id, dbname = wematch.groups() model_obj = pooler.get_pool(cr.dbname).get(model) if (not model == oomodel) or (not dbname == cr.dbname): return (False, None) qry = 'SELECT DISTINCT(id) FROM %s' % model_obj._table if rdate: qry += " WHERE recurrent_id=%s" cr.execute(qry, (rdate,)) r_id = cr.fetchone() if r_id: return (id, r_id[0]) cr.execute(qry) ids = map(lambda x: str(x[0]), cr.fetchall()) if id in ids: return (id, None) return (False, None)
def uid2openobjectid(cr, uidval, oomodel, rdate): """ UID To Open Object Id @param cr: the current row, from the database cursor, @param uidval: Get USerId vale @oomodel: Open Object ModelName @param rdate: Get Recurrent Date """ __rege = re.compile(r'OpenObject-([\w|\.]+)_([0-9]+)@(\w+)$') if not uidval: return (False, None) wematch = __rege.match(uidval.encode('utf8')) if not wematch: return (False, None) else: model, id, dbname = wematch.groups() model_obj = pooler.get_pool(cr.dbname).get(model) if (not model == oomodel) or (not dbname == cr.dbname): return (False, None) qry = 'SELECT DISTINCT(id) FROM %s' % model_obj._table if rdate: qry += " where recurrent_id='%s'" % (rdate) cr.execute(qry) r_id = cr.fetchone() if r_id: return (id, r_id[0]) cr.execute(qry) ids = map(lambda x: str(x[0]), cr.fetchall()) if id in ids: return (id, None) return (False, None)
468,306
def _check_company(self, cr, uid, ids, context=None): return all(((this.company_id in this.company_ids) or not this.company_ids) for this in self.browse(cr, uid, ids, context))
def _check_company(self, cr, uid, ids, context=None): return all(((this.company_id in this.company_ids) or not this.company_ids) for this in self.browse(cr, uid, ids, context))
468,307
def _sum_period(self, cr, uid, ids, name, args, context): if context is None: context = {} move_state = ('posted', ) if context.get('state', False) == 'all': move_state = ('draft', 'posted', ) if context.get('period_id', False): period_id = context['period_id'] else: period_id = self.pool.get('account.period').find(cr, uid) if not period_id: return dict.fromkeys(ids, 0.0) period_id = period_id[0] return self._sum(cr, uid, ids, name, args, context, where=' AND line.period_id=%s AND move.state IN %s', where_params=(period_id, move_state))
def_sum_period(self,cr,uid,ids,name,args,context):ifcontextisNone:context={}move_state=('posted',)ifcontext.get('state',False)=='all':move_state=('draft','posted',)ifcontext.get('period_id',False):period_id=context['period_id']else:period_id=self.pool.get('account.period').find(cr,uid)ifnotperiod_id:returndict.fromkeys(ids,0.0)period_id=period_id[0]returnself._sum(cr,uid,ids,name,args,context,where='ANDline.period_id=%sANDmove.stateIN%s',where_params=(period_id,move_state))
468,308
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 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)
468,309
def start(self, cr, uid, ids, context=None): todo_ids = self.pool.get('ir.actions.todo').search(cr, uid, ['|', ('state', '=', 'open'), '&', ('state', '=', 'skip'), ('restart', '=', 'onskip')]) if not todo_ids: # When there is no wizard todo it will display message data_obj = self.pool.get('ir.model.data') result = data_obj._get_id(cr, uid, 'base', 'view_base_module_configuration_form') view_id = data_obj.browse(cr, uid, result).res_id value = { 'name': _('System Configuration done'), 'view_type': 'form', 'view_mode': 'form', 'res_model': 'base.module.configuration', 'view_id': [view_id], 'type': 'ir.actions.act_window', 'target': 'new' } return value # Run the config wizards config_pool = self.pool.get('res.config') return config_pool.start(cr, uid, ids, context=context)
def start(self, cr, uid, ids, context=None): todo_ids = self.pool.get('ir.actions.todo').search(cr, uid, ['|', '|', ('restart','=','always'), ('state', '=', 'open'), '&', ('state', '=', 'skip'), ('restart', '=', 'onskip')]) if not todo_ids: # When there is no wizard todo it will display message data_obj = self.pool.get('ir.model.data') result = data_obj._get_id(cr, uid, 'base', 'view_base_module_configuration_form') view_id = data_obj.browse(cr, uid, result).res_id value = { 'name': _('System Configuration done'), 'view_type': 'form', 'view_mode': 'form', 'res_model': 'base.module.configuration', 'view_id': [view_id], 'type': 'ir.actions.act_window', 'target': 'new' } return value # Run the config wizards config_pool = self.pool.get('res.config') return config_pool.start(cr, uid, ids, context=context)
468,310
def __init__(self, cr, module, id_map, mode, filename, noupdate=False): self.cr = cr self.module = module self.id_map = id_map self.mode = mode self.filename = filename self.assert_report = TestReport() self.noupdate = noupdate self.logger = logging.getLogger("%s.%s" % (logger_channel, self.module)) self.pool = pooler.get_pool(cr.dbname) self.uid = 1 self.context = {} # opererp context self.eval_context = {'ref': self._ref, '_ref': self._ref, 'time': time} # added '_ref' so that record['ref'] is possible
def __init__(self, cr, module, id_map, mode, filename, noupdate=False): self.cr = cr self.module = module self.id_map = id_map self.mode = mode self.filename = filename self.assert_report = TestReport() self.noupdate = noupdate self.logger = logging.getLogger("%s.%s" % (logger_channel, self.module)) self.pool = pooler.get_pool(cr.dbname) self.uid = 1 self.context = {} # opererp context self.eval_context = {'ref': self._ref(), '_ref': self._ref(), 'time': time} # added '_ref' so that record['ref'] is possible
468,311
def do_partial(self, cr, uid, ids, partial_datas, context=None): """ Makes partial picking 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 @return: Dictionary of values """ if context is None: context = {} else: context = dict(context) res = {} move_obj = self.pool.get('stock.move') product_obj = self.pool.get('product.product') currency_obj = self.pool.get('res.currency') users_obj = self.pool.get('res.users') uom_obj = self.pool.get('product.uom') price_type_obj = self.pool.get('product.price.type') sequence_obj = self.pool.get('ir.sequence') wf_service = netsvc.LocalService("workflow") partner_id = partial_datas.get('partner_id', False) address_id = partial_datas.get('address_id', False) delivery_date = partial_datas.get('delivery_date', False) for pick in self.browse(cr, uid, ids, context=context): new_picking = None new_moves = [] complete, too_many, too_few = [], [], [] move_product_qty = {} for move in pick.move_lines: if move.state in ('done', 'cancel'): continue partial_data = partial_datas.get('move%s'%(move.id), False) assert partial_data, _('Do not Found Partial data of Stock Move Line :%s' %(move.id)) product_qty = partial_data.get('product_qty',0.0) move_product_qty[move.id] = product_qty product_uom = partial_data.get('product_uom',False) product_price = partial_data.get('product_price',0.0) product_currency = partial_data.get('product_currency',False) prodlot_id = partial_data.get('prodlot_id',False) if prodlot_id: move_obj.write(cr, uid, [move.id],{'prodlot_id': prodlot_id,}) if move.product_qty == product_qty: complete.append(move) elif move.product_qty > product_qty: too_few.append(move) else: too_many.append(move)
def do_partial(self, cr, uid, ids, partial_datas, context=None): """ Makes partial picking 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 @return: Dictionary of values """ if context is None: context = {} else: context = dict(context) res = {} move_obj = self.pool.get('stock.move') product_obj = self.pool.get('product.product') currency_obj = self.pool.get('res.currency') users_obj = self.pool.get('res.users') uom_obj = self.pool.get('product.uom') price_type_obj = self.pool.get('product.price.type') sequence_obj = self.pool.get('ir.sequence') wf_service = netsvc.LocalService("workflow") partner_id = partial_datas.get('partner_id', False) address_id = partial_datas.get('address_id', False) delivery_date = partial_datas.get('delivery_date', False) for pick in self.browse(cr, uid, ids, context=context): new_picking = None new_moves = [] complete, too_many, too_few = [], [], [] move_product_qty = {} for move in pick.move_lines: if move.state in ('done', 'cancel'): continue partial_data = partial_datas.get('move%s'%(move.id), False) assert partial_data, _('Do not Found Partial data of Stock Move Line :%s' %(move.id)) product_qty = partial_data.get('product_qty',0.0) move_product_qty[move.id] = product_qty product_uom = partial_data.get('product_uom',False) product_price = partial_data.get('product_price',0.0) product_currency = partial_data.get('product_currency',False) prodlot_id = partial_data.get('prodlot_id',False) if move.product_qty == product_qty: complete.append(move) elif move.product_qty > product_qty: too_few.append(move) else: too_many.append(move)
468,312
def action_done(self, cr, uid, ids, context=None): """ Makes the move done and if all moves are done, it will finish the picking. @return: """ track_flag = False picking_ids = [] product_uom_obj = self.pool.get('product.uom') price_type_obj = self.pool.get('product.price.type') product_obj = self.pool.get('product.product') if context is None: context = {} for move in self.browse(cr, uid, ids): if move.picking_id: picking_ids.append(move.picking_id.id) if move.move_dest_id.id and (move.state != 'done'): cr.execute('insert into stock_move_history_ids (parent_id,child_id) values (%s,%s)', (move.id, move.move_dest_id.id)) if move.move_dest_id.state in ('waiting', 'confirmed'): self.write(cr, uid, [move.move_dest_id.id], {'state': 'assigned'}) if move.move_dest_id.picking_id: wf_service = netsvc.LocalService("workflow") wf_service.trg_write(uid, 'stock.picking', move.move_dest_id.picking_id.id, cr) else: pass if move.move_dest_id.auto_validate: self.action_done(cr, uid, [move.move_dest_id.id], context=context)
def action_done(self, cr, uid, ids, context=None): """ Makes the move done and if all moves are done, it will finish the picking. @return: """ track_flag = False picking_ids = [] product_uom_obj = self.pool.get('product.uom') price_type_obj = self.pool.get('product.price.type') product_obj = self.pool.get('product.product') if context is None: context = {} for move in self.browse(cr, uid, ids): if move.picking_id: picking_ids.append(move.picking_id.id) if move.move_dest_id.id and (move.state != 'done'): cr.execute('insert into stock_move_history_ids (parent_id,child_id) values (%s,%s)', (move.id, move.move_dest_id.id)) if move.move_dest_id.state in ('waiting', 'confirmed'): self.write(cr, uid, [move.move_dest_id.id], {'state': 'assigned'}) if move.move_dest_id.picking_id: wf_service = netsvc.LocalService("workflow") wf_service.trg_write(uid, 'stock.picking', move.move_dest_id.picking_id.id, cr) else: pass if move.move_dest_id.auto_validate: self.action_done(cr, uid, [move.move_dest_id.id], context=context)
468,313
def __init__(self, cr, uid, name, context=None): if context is None: context = {} super(partner_balance, self).__init__(cr, uid, name, context=context) self.date_lst = [] self.account_ids = [] self.localcontext.update( { 'time': time, 'lines': self.lines, 'sum_debit': self._sum_debit, 'sum_credit': self._sum_credit, 'sum_litige': self._sum_litige, 'sum_sdebit': self._sum_sdebit, 'sum_scredit': self._sum_scredit, 'solde_debit': self._solde_balance_debit, 'solde_credit': self._solde_balance_credit, 'get_currency': self._get_currency, 'comma_me' : self.comma_me, 'get_fiscalyear': self._get_fiscalyear, 'get_periods':self.get_periods, 'get_journal': self._get_journal, 'get_filter': self._get_filter, 'get_account': self._get_account, 'get_start_date':self._get_start_date, 'get_end_date':self._get_end_date, 'get_start_period': self.get_start_period, 'get_end_period': self.get_end_period, 'get_partners':self._get_partners, }) ## Compute account list one time
def __init__(self, cr, uid, name, context=None): if context is None: context = {} super(partner_balance, self).__init__(cr, uid, name, context=context) self.account_ids = [] self.localcontext.update( { 'time': time, 'lines': self.lines, 'sum_debit': self._sum_debit, 'sum_credit': self._sum_credit, 'sum_litige': self._sum_litige, 'sum_sdebit': self._sum_sdebit, 'sum_scredit': self._sum_scredit, 'solde_debit': self._solde_balance_debit, 'solde_credit': self._solde_balance_credit, 'get_currency': self._get_currency, 'comma_me' : self.comma_me, 'get_fiscalyear': self._get_fiscalyear, 'get_periods':self.get_periods, 'get_journal': self._get_journal, 'get_filter': self._get_filter, 'get_account': self._get_account, 'get_start_date':self._get_start_date, 'get_end_date':self._get_end_date, 'get_start_period': self.get_start_period, 'get_end_period': self.get_end_period, 'get_partners':self._get_partners, }) ## Compute account list one time
468,314
def get_periods(self, form): result = '' if form.has_key('periods') and form['periods']: period_ids = form['periods'] per_ids = self.pool.get('account.period').browse(self.cr, self.uid, form['periods']) for r in per_ids: if r == per_ids[len(per_ids)-1]: result+=r.name+". " else: result+=r.name+", " else: fy_obj = self.pool.get('account.fiscalyear').browse(self.cr, self.uid, form['fiscalyear']) res = fy_obj.period_ids len_res = len(res) for r in res: if r == res[len_res-1]: result += r.name + ". " else: result += r.name + ", " return str(result and result[:-1]) or 'ALL'
def get_periods(self, form): result = '' if form.has_key('periods') and form['periods']: period_ids = form['periods'] per_ids = self.pool.get('account.period').browse(self.cr, self.uid, form['periods']) for r in per_ids: if r == per_ids[len(per_ids)-1]: result+=r.name+". " else: result+=r.name+", " else: fy_obj = self.pool.get('account.fiscalyear').browse(self.cr, self.uid, form['fiscalyear']) res = fy_obj.period_ids len_res = len(res) for r in res: if r == res[len_res-1]: result += r.name + ". " else: result += r.name + ", " return str(result and result[:-1]) or 'ALL'
468,315
def transform_period_into_date_array(self, data): ## Get All Period Date # # If we have no period we will take all perdio in the FiscalYear. if not data['form']['periods']: periods_id = self.pool.get('account.period').search(self.cr, self.uid, [('fiscalyear_id','=',data['form']['fiscalyear'])]) else: periods_id = data['form']['periods'] date_array = [] for period_id in periods_id: period_obj = self.pool.get('account.period').browse(self.cr, self.uid, period_id) date_array = date_array + self.date_range(period_obj.date_start, period_obj.date_stop) self.date_lst = date_array self.date_lst.sort()
def transform_period_into_date_array(self, data): ## Get All Period Date # # If we have no period we will take all perdio in the FiscalYear. if not data['form']['periods']: periods_id = self.pool.get('account.period').search(self.cr, self.uid, [('fiscalyear_id','=',data['form']['fiscalyear'])]) else: periods_id = data['form']['periods'] date_array = [] for period_id in periods_id: period_obj = self.pool.get('account.period').browse(self.cr, self.uid, period_id) date_array = date_array + self.date_range(period_obj.date_start, period_obj.date_stop) self.date_lst = date_array self.date_lst.sort()
468,316
def comma_me(self, amount): if type(amount) is float : amount = str('%.2f'%amount) else : amount = str(amount) if (amount == '0'): return ' ' orig = amount new = re.sub("^(-?\d+)(\d{3})", "\g<1>'\g<2>", amount) if orig == new: return new else: return self.comma_me(new)
def comma_me(self, amount): if type(amount) is float : amount = str('%.2f'%amount) else : amount = str(amount) if (amount == '0'): return ' ' orig = amount new = re.sub("^(-?\d+)(\d{3})", "\g<1>'\g<2>", amount) if orig == new: return new else: return self.comma_me(new)
468,317
def set_context(self, objects, data, ids, report_type=None): # Transformation des date # # if data['form']['filter'] == 'filter_no': self.transform_none_into_date_array(data) elif data['form']['filter'] == 'filter_date': self.transform_date_into_date_array(data) elif data['form']['filter'] == 'filter_period': self.transform_period_into_date_array(data)
def set_context(self, objects, data, ids, report_type=None): # Transformation des date # # if data['form']['filter'] == 'filter_no': self.transform_none_into_date_array(data) elif data['form']['filter'] == 'filter_date': self.transform_date_into_date_array(data) elif data['form']['filter'] == 'filter_period': self.transform_period_into_date_array(data)
468,318
def set_context(self, objects, data, ids, report_type=None): # Transformation des date # # if data['form']['filter'] == 'filter_no': self.transform_none_into_date_array(data) elif data['form']['filter'] == 'filter_date': self.transform_date_into_date_array(data) elif data['form']['filter'] == 'filter_period': self.transform_period_into_date_array(data)
defset_context(self,objects,data,ids,report_type=None):#Transformationdesdate##ifdata['form']['filter']=='filter_no':self.transform_none_into_date_array(data)elifdata['form']['filter']=='filter_date':self.transform_date_into_date_array(data)elifdata['form']['filter']=='filter_period':self.transform_period_into_date_array(data)
468,319
def _sum_debit(self, data): if not self.ids: return 0.0 result_tmp = 0.0 temp_res = 0.0 if self.date_lst: self.cr.execute( "SELECT sum(debit) " \ "FROM account_move_line AS l " \ "WHERE l.account_id IN %s" \ "AND l.date IN %s", (tuple(self.account_ids), tuple(self.date_lst))) temp_res = float(self.cr.fetchone()[0] or 0.0) if self.initial_balance: self.cr.execute( "SELECT sum(debit) " \ "FROM account_move_line AS l " \ "WHERE l.account_id IN %s " \ "AND " + self.init_query + "" , (tuple(self.account_ids), )) temp_res += float(self.cr.fetchone()[0] or 0.0) result_tmp = result_tmp + temp_res return result_tmp
def _sum_debit(self, data): if not self.ids: return 0.0 temp_res = 0.0 if self.date_lst: self.cr.execute( "SELECT sum(debit) " \ "FROM account_move_line AS l " \ "WHERE l.account_id IN %s" \ "AND l.date IN %s", (tuple(self.account_ids), tuple(self.date_lst))) temp_res = float(self.cr.fetchone()[0] or 0.0) if self.initial_balance: self.cr.execute( "SELECT sum(debit) " \ "FROM account_move_line AS l " \ "WHERE l.account_id IN %s " \ "AND " + self.init_query + "" , (tuple(self.account_ids), )) temp_res += float(self.cr.fetchone()[0] or 0.0) result_tmp = result_tmp + temp_res return result_tmp
468,320
def _sum_debit(self, data): if not self.ids: return 0.0 result_tmp = 0.0 temp_res = 0.0 if self.date_lst: self.cr.execute( "SELECT sum(debit) " \ "FROM account_move_line AS l " \ "WHERE l.account_id IN %s" \ "AND l.date IN %s", (tuple(self.account_ids), tuple(self.date_lst))) temp_res = float(self.cr.fetchone()[0] or 0.0) if self.initial_balance: self.cr.execute( "SELECT sum(debit) " \ "FROM account_move_line AS l " \ "WHERE l.account_id IN %s " \ "AND " + self.init_query + "" , (tuple(self.account_ids), )) temp_res += float(self.cr.fetchone()[0] or 0.0) result_tmp = result_tmp + temp_res return result_tmp
def _sum_debit(self, data): if not self.ids: return 0.0 result_tmp = 0.0 temp_res = 0.0 self.cr.execute( "SELECT sum(debit) " \ "FROM account_move_line AS l " \ "WHERE l.account_id IN %s" \ "AND " + self.query + "" , (tuple(self.account_ids), )) temp_res = float(self.cr.fetchone()[0] or 0.0) if self.initial_balance: self.cr.execute( "SELECT sum(debit) " \ "FROM account_move_line AS l " \ "WHERE l.account_id IN %s " \ "AND " + self.init_query + "" , (tuple(self.account_ids), )) temp_res += float(self.cr.fetchone()[0] or 0.0) result_tmp = result_tmp + temp_res return result_tmp
468,321
def _sum_debit(self, data): if not self.ids: return 0.0 result_tmp = 0.0 temp_res = 0.0 if self.date_lst: self.cr.execute( "SELECT sum(debit) " \ "FROM account_move_line AS l " \ "WHERE l.account_id IN %s" \ "AND l.date IN %s", (tuple(self.account_ids), tuple(self.date_lst))) temp_res = float(self.cr.fetchone()[0] or 0.0) if self.initial_balance: self.cr.execute( "SELECT sum(debit) " \ "FROM account_move_line AS l " \ "WHERE l.account_id IN %s " \ "AND " + self.init_query + "" , (tuple(self.account_ids), )) temp_res += float(self.cr.fetchone()[0] or 0.0) result_tmp = result_tmp + temp_res return result_tmp
def _sum_debit(self, data): if not self.ids: return 0.0 result_tmp = 0.0 temp_res = 0.0 if self.date_lst: self.cr.execute( "SELECT sum(debit) " \ "FROM account_move_line AS l " \ "WHERE l.account_id IN %s" \ "AND l.date IN %s", (tuple(self.account_ids), tuple(self.date_lst))) temp_res = float(self.cr.fetchone()[0] or 0.0) if self.initial_balance: self.cr.execute( "SELECT sum(debit) " \ "FROM account_move_line AS l " \ "WHERE l.account_id IN %s " \ "AND " + self.init_query + "" , (tuple(self.account_ids), )) temp_res += float(self.cr.fetchone()[0] or 0.0) result_tmp = result_tmp + temp_res return result_tmp
468,322
def _sum_credit(self, data): if not self.ids: return 0.0 result_tmp = 0.0 temp_res = 0.0 if self.date_lst: self.cr.execute( "SELECT sum(credit) " \ "FROM account_move_line AS l " \ "WHERE l.account_id IN %s" \ "AND l.date IN %s", (tuple(self.account_ids), tuple(self.date_lst),)) temp_res = float(self.cr.fetchone()[0] or 0.0) if self.initial_balance: self.cr.execute( "SELECT sum(credit) " \ "FROM account_move_line AS l " \ "WHERE l.account_id IN %s " \ "AND " + self.init_query + "" , (tuple(self.account_ids),)) temp_res += float(self.cr.fetchone()[0] or 0.0) result_tmp = result_tmp + temp_res return result_tmp
def _sum_credit(self, data): if not self.ids: return 0.0 temp_res = 0.0 if self.date_lst: self.cr.execute( "SELECT sum(credit) " \ "FROM account_move_line AS l " \ "WHERE l.account_id IN %s" \ "AND l.date IN %s", (tuple(self.account_ids), tuple(self.date_lst),)) temp_res = float(self.cr.fetchone()[0] or 0.0) if self.initial_balance: self.cr.execute( "SELECT sum(credit) " \ "FROM account_move_line AS l " \ "WHERE l.account_id IN %s " \ "AND " + self.init_query + "" , (tuple(self.account_ids),)) temp_res += float(self.cr.fetchone()[0] or 0.0) result_tmp = result_tmp + temp_res return result_tmp
468,323
def _sum_credit(self, data): if not self.ids: return 0.0 result_tmp = 0.0 temp_res = 0.0 if self.date_lst: self.cr.execute( "SELECT sum(credit) " \ "FROM account_move_line AS l " \ "WHERE l.account_id IN %s" \ "AND l.date IN %s", (tuple(self.account_ids), tuple(self.date_lst),)) temp_res = float(self.cr.fetchone()[0] or 0.0) if self.initial_balance: self.cr.execute( "SELECT sum(credit) " \ "FROM account_move_line AS l " \ "WHERE l.account_id IN %s " \ "AND " + self.init_query + "" , (tuple(self.account_ids),)) temp_res += float(self.cr.fetchone()[0] or 0.0) result_tmp = result_tmp + temp_res return result_tmp
def _sum_credit(self, data): if not self.ids: return 0.0 result_tmp = 0.0 temp_res = 0.0 self.cr.execute( "SELECT sum(credit) " \ "FROM account_move_line AS l " \ "WHERE l.account_id IN %s" \ "AND " + self.query + "" , (tuple(self.account_ids),)) temp_res = float(self.cr.fetchone()[0] or 0.0) if self.initial_balance: self.cr.execute( "SELECT sum(credit) " \ "FROM account_move_line AS l " \ "WHERE l.account_id IN %s " \ "AND " + self.init_query + "" , (tuple(self.account_ids),)) temp_res += float(self.cr.fetchone()[0] or 0.0) result_tmp = result_tmp + temp_res return result_tmp
468,324
def _sum_credit(self, data): if not self.ids: return 0.0 result_tmp = 0.0 temp_res = 0.0 if self.date_lst: self.cr.execute( "SELECT sum(credit) " \ "FROM account_move_line AS l " \ "WHERE l.account_id IN %s" \ "AND l.date IN %s", (tuple(self.account_ids), tuple(self.date_lst),)) temp_res = float(self.cr.fetchone()[0] or 0.0) if self.initial_balance: self.cr.execute( "SELECT sum(credit) " \ "FROM account_move_line AS l " \ "WHERE l.account_id IN %s " \ "AND " + self.init_query + "" , (tuple(self.account_ids),)) temp_res += float(self.cr.fetchone()[0] or 0.0) result_tmp = result_tmp + temp_res return result_tmp
def _sum_credit(self, data): if not self.ids: return 0.0 result_tmp = 0.0 temp_res = 0.0 if self.date_lst: self.cr.execute( "SELECT sum(credit) " \ "FROM account_move_line AS l " \ "WHERE l.account_id IN %s" \ "AND l.date IN %s", (tuple(self.account_ids), tuple(self.date_lst),)) temp_res = float(self.cr.fetchone()[0] or 0.0) if self.initial_balance: self.cr.execute( "SELECT sum(credit) " \ "FROM account_move_line AS l " \ "WHERE l.account_id IN %s " \ "AND " + self.init_query + "" , (tuple(self.account_ids),)) temp_res += float(self.cr.fetchone()[0] or 0.0) result_tmp = result_tmp + temp_res return result_tmp
468,325
def _sum_litige(self, data): if not self.ids: return 0.0 result_tmp = 0.0 temp_res = 0.0 if self.date_lst: self.cr.execute( "SELECT sum(debit-credit) " \ "FROM account_move_line AS l " \ "WHERE l.account_id IN %s" \ "AND l.date IN %s " \ "AND l.blocked=TRUE ", (tuple(self.account_ids), tuple(self.date_lst),)) temp_res = float(self.cr.fetchone()[0] or 0.0) if self.initial_balance: self.cr.execute( "SELECT sum(debit-credit) " \ "FROM account_move_line AS l " \ "WHERE l.account_id IN %s " \ "AND " + self.init_query + "" , (tuple(self.account_ids), )) temp_res += float(self.cr.fetchone()[0] or 0.0)
def _sum_litige(self, data): if not self.ids: return 0.0 temp_res = 0.0 if self.date_lst: self.cr.execute( "SELECT sum(debit-credit) " \ "FROM account_move_line AS l " \ "WHERE l.account_id IN %s" \ "AND l.date IN %s " \ "AND l.blocked=TRUE ", (tuple(self.account_ids), tuple(self.date_lst),)) temp_res = float(self.cr.fetchone()[0] or 0.0) if self.initial_balance: self.cr.execute( "SELECT sum(debit-credit) " \ "FROM account_move_line AS l " \ "WHERE l.account_id IN %s " \ "AND " + self.init_query + "" , (tuple(self.account_ids), )) temp_res += float(self.cr.fetchone()[0] or 0.0)
468,326
def _sum_litige(self, data): if not self.ids: return 0.0 result_tmp = 0.0 temp_res = 0.0 if self.date_lst: self.cr.execute( "SELECT sum(debit-credit) " \ "FROM account_move_line AS l " \ "WHERE l.account_id IN %s" \ "AND l.date IN %s " \ "AND l.blocked=TRUE ", (tuple(self.account_ids), tuple(self.date_lst),)) temp_res = float(self.cr.fetchone()[0] or 0.0) if self.initial_balance: self.cr.execute( "SELECT sum(debit-credit) " \ "FROM account_move_line AS l " \ "WHERE l.account_id IN %s " \ "AND " + self.init_query + "" , (tuple(self.account_ids), )) temp_res += float(self.cr.fetchone()[0] or 0.0)
def _sum_litige(self, data): if not self.ids: return 0.0 result_tmp = 0.0 temp_res = 0.0 self.cr.execute( "SELECT sum(debit-credit) " \ "FROM account_move_line AS l " \ "WHERE l.account_id IN %s" \ "AND " + self.query + " " \ "AND l.blocked=TRUE ", (tuple(self.account_ids), )) temp_res = float(self.cr.fetchone()[0] or 0.0) if self.initial_balance: self.cr.execute( "SELECT sum(debit-credit) " \ "FROM account_move_line AS l " \ "WHERE l.account_id IN %s" \ "AND l.date IN %s " \ "AND l.blocked=TRUE ", (tuple(self.account_ids), tuple(self.date_lst),)) temp_res = float(self.cr.fetchone()[0] or 0.0) if self.initial_balance: self.cr.execute( "SELECT sum(debit-credit) " \ "FROM account_move_line AS l " \ "WHERE l.account_id IN %s " \ "AND " + self.init_query + "" , (tuple(self.account_ids), )) temp_res += float(self.cr.fetchone()[0] or 0.0)
468,327
def _sum_litige(self, data): if not self.ids: return 0.0 result_tmp = 0.0 temp_res = 0.0 if self.date_lst: self.cr.execute( "SELECT sum(debit-credit) " \ "FROM account_move_line AS l " \ "WHERE l.account_id IN %s" \ "AND l.date IN %s " \ "AND l.blocked=TRUE ", (tuple(self.account_ids), tuple(self.date_lst),)) temp_res = float(self.cr.fetchone()[0] or 0.0) if self.initial_balance: self.cr.execute( "SELECT sum(debit-credit) " \ "FROM account_move_line AS l " \ "WHERE l.account_id IN %s " \ "AND " + self.init_query + "" , (tuple(self.account_ids), )) temp_res += float(self.cr.fetchone()[0] or 0.0)
def _sum_litige(self, data): if not self.ids: return 0.0 result_tmp = 0.0 temp_res = 0.0 if self.date_lst: self.cr.execute( "SELECT sum(debit-credit) " \ "FROM account_move_line AS l " \ "WHERE l.account_id IN %s" \ "AND l.date IN %s " \ "AND l.blocked=TRUE ", (tuple(self.account_ids), tuple(self.date_lst),)) temp_res = float(self.cr.fetchone()[0] or 0.0) if self.initial_balance: self.cr.execute( "SELECT sum(debit-credit) " \ "FROM account_move_line AS l " \ "WHERE l.account_id IN %s " \ "AND " + self.init_query + "" , (tuple(self.account_ids), )) temp_res += float(self.cr.fetchone()[0] or 0.0)
468,328
def _sum_sdebit(self, data): if not self.ids: return 0.0 result_tmp = 0.0 a = 0.0 if self.date_lst: self.cr.execute( "SELECT CASE WHEN sum(debit) > sum(credit) " \ "THEN sum(debit) - sum(credit) " \ "ELSE 0 " \ "END " \ "FROM account_move_line AS l " \ "WHERE l.account_id IN %s" \ "AND l.date IN %s " \ "GROUP BY l.partner_id", (tuple(self.account_ids), tuple(self.date_lst),)) a = self.cr.fetchone()[0]
def _sum_sdebit(self, data): if not self.ids: return 0.0 result_tmp = 0.0 a = 0.0 if self.date_lst: self.cr.execute( "SELECT CASE WHEN sum(debit) > sum(credit) " \ "THEN sum(debit) - sum(credit) " \ "ELSE 0 " \ "END " \ "FROM account_move_line AS l " \ "WHERE l.account_id IN %s" \ "AND l.date IN %s " \ "GROUP BY l.partner_id", (tuple(self.account_ids), tuple(self.date_lst),)) a = self.cr.fetchone()[0]
468,329
def _sum_scredit(self, data): if not self.ids: return 0.0 result_tmp = 0.0 a = 0.0 if self.date_lst: self.cr.execute( "SELECT CASE WHEN sum(debit) < sum(credit) " \ "THEN sum(credit) - sum(debit) " \ "ELSE 0 " \ "END " \ "FROM account_move_line AS l " \ "WHERE l.account_id IN %s" \ "AND l.date IN %s " \ "GROUP BY l.partner_id", (tuple(self.account_ids), tuple(self.date_lst),)) a = self.cr.fetchone()[0] or 0.0 if self.cr.fetchone() != None: result_tmp = result_tmp + (a or 0.0)
def _sum_scredit(self, data): if not self.ids: return 0.0 result_tmp = 0.0 a = 0.0 if self.date_lst: self.cr.execute( "SELECT CASE WHEN sum(debit) < sum(credit) " \ "THEN sum(credit) - sum(debit) " \ "ELSE 0 " \ "END " \ "FROM account_move_line AS l " \ "WHERE l.account_id IN %s" \ "AND l.date IN %s " \ "GROUP BY l.partner_id", (tuple(self.account_ids), tuple(self.date_lst),)) a = self.cr.fetchone()[0] or 0.0 if self.cr.fetchone() != None: result_tmp = result_tmp + (a or 0.0)
468,330
def _get_partners(self, data): if data['form']['result_selection']=='customer': return 'Receivable Accounts' elif data['form']['result_selection']=='supplier': return 'Payable Accounts' elif data['form']['result_selection']=='customer_supplier': return 'Receivable and Payable Accounts' return ''
def _get_partners(self, data): if data['form']['result_selection'] == 'customer': return 'Receivable Accounts' elif data['form']['result_selection']=='supplier': return 'Payable Accounts' elif data['form']['result_selection']=='customer_supplier': return 'Receivable and Payable Accounts' return ''
468,331
def _get_partners(self, data): if data['form']['result_selection']=='customer': return 'Receivable Accounts' elif data['form']['result_selection']=='supplier': return 'Payable Accounts' elif data['form']['result_selection']=='customer_supplier': return 'Receivable and Payable Accounts' return ''
def _get_partners(self, data): if data['form']['result_selection']=='customer': return 'Receivable Accounts' elif data['form']['result_selection'] == 'supplier': return 'Payable Accounts' elif data['form']['result_selection']=='customer_supplier': return 'Receivable and Payable Accounts' return ''
468,332
def _get_partners(self, data): if data['form']['result_selection']=='customer': return 'Receivable Accounts' elif data['form']['result_selection']=='supplier': return 'Payable Accounts' elif data['form']['result_selection']=='customer_supplier': return 'Receivable and Payable Accounts' return ''
def _get_partners(self, data): if data['form']['result_selection']=='customer': return 'Receivable Accounts' elif data['form']['result_selection']=='supplier': return 'Payable Accounts' elif data['form']['result_selection'] == 'customer_supplier': return 'Receivable and Payable Accounts' return ''
468,333
def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False): """ Search for record/s based on a search domain.
def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False): """ Search for record/s based on a search domain.
468,334
def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False): """ Search for record/s based on a search domain.
def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False): """ Search for record/s based on a search domain.
468,335
def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False): """ Search for record/s based on a search domain.
def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False): """ Search for record/s based on a search domain.
468,336
def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False): """ Search for record/s based on a search domain.
def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False): """ Search for record/s based on a search domain.
468,337
def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False): """ Search for record/s based on a search domain.
def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False): """ Search for record/s based on a search domain.
468,338
def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False): """ Search for record/s based on a search domain.
def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False): """ Search for record/s based on a search domain.
468,339
def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False): """ Search for record/s based on a search domain.
def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False): """ Search for record/s based on a search domain.
468,340
def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False): """ Search for record/s based on a search domain.
def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False): """ Search for record/s based on a search domain.
468,341
def account_tax_chart_open_window(self, cr, uid, ids, context=None): """ Opens chart of Accounts @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of account chart’s IDs @return: dictionary of Open account chart window on given fiscalyear and all Entries or posted entries """ mod_obj = self.pool.get('ir.model.data') act_obj = self.pool.get('ir.actions.act_window') period_obj = self.pool.get('account.period') if context is None: context = {} data = self.read(cr, uid, ids, [], context=context)[0] result = mod_obj._get_id(cr, uid, 'account', 'action_tax_code_tree') id = mod_obj.read(cr, uid, [result], ['res_id'], context=context)[0]['res_id'] result = act_obj.read(cr, uid, [id], context=context)[0] if data['period_id']: fiscalyear_id = period_obj.read(cr, uid, [data['period_id']], context=context)[0]['fiscalyear_id'][0] result['context'] = str({'period_id': data['period_id'], \ 'fiscalyear_id': fiscalyear_id, \ 'state': data['target_move']}) else: result['context'] = str({'state': data['target_move']})
def account_tax_chart_open_window(self, cr, uid, ids, context=None): """ Opens chart of Accounts @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of account chart’s IDs @return: dictionary of Open account chart window on given fiscalyear and all Entries or posted entries """ mod_obj = self.pool.get('ir.model.data') act_obj = self.pool.get('ir.actions.act_window') period_obj = self.pool.get('account.period') if context is None: context = {} data = self.read(cr, uid, ids, [], context=context)[0] result = mod_obj._get_id(cr, uid, 'account', 'action_tax_code_tree') id = mod_obj.read(cr, uid, [result], ['res_id'], context=context)[0]['res_id'] result = act_obj.read(cr, uid, [id], context=context)[0] if data['period_id']: fiscalyear_id = period_obj.read(cr, uid, [data['period_id']], context=context)[0]['fiscalyear_id'][0] result['context'] = str({'period_id': data['period_id'], \ 'fiscalyear_id': fiscalyear_id, \ 'state': data['target_move']}) else: result['context'] = str({'state': data['target_move']})
468,342
def product_id_change(self, cr, uid, ids, pricelist, product, qty=0, uom=False, qty_uos=0, uos=False, name='', partner_id=False, lang=False, update_tax=True, date_order=False, packaging=False, fiscal_position=False, flag=False): res = super(sale_order_line, self).product_id_change(cr, uid, ids, pricelist, product, qty=qty, uom=uom, qty_uos=qty_uos, uos=uos, name=name, partner_id=partner_id, lang=lang, update_tax=update_tax, date_order=date_order, packaging=packaging, fiscal_position=fiscal_position, flag=flag) if product: purchase_price = self.pool.get('product.product').browse(cr, uid, product).standard_price res['value'].update({'purchase_price': purchase_price}) return res
def product_id_change(self, cr, uid, ids, pricelist, product, qty=0, uom=False, qty_uos=0, uos=False, name='', partner_id=False, lang=False, update_tax=True, date_order=False, packaging=False, fiscal_position=False, flag=False): res = super(sale_order_line, self).product_id_change(cr, uid, ids, pricelist, product, qty=qty, uom=uom, qty_uos=qty_uos, uos=uos, name=name, partner_id=partner_id, lang=lang, update_tax=update_tax, date_order=date_order, packaging=packaging, fiscal_position=fiscal_position, flag=flag) if product: purchase_price = self.pool.get('product.product').browse(cr, uid, product).standard_price res['value'].update({'purchase_price': purchase_price * rate}) return res
468,343
def holidays_cancel(self, cr, uid, ids, *args): for record in self.browse(cr, uid, ids): if record.state=='validate': holiday_id=self.pool.get('hr.holidays.per.user').search(cr, uid, [('employee_id','=', record.employee_id.id),('holiday_status','=',record.holiday_status.id)]) if holiday_id: obj_holidays_per_user=self.pool.get('hr.holidays.per.user').browse(cr, uid,holiday_id[0]) self.pool.get('hr.holidays.per.user').write(cr,uid,obj_holidays_per_user.id,{'leaves_taken':obj_holidays_per_user.leaves_taken - record.number_of_days}) if record.case_id: if record.case_id.state <> 'draft': raise osv.except_osv(_('Warning !'), _('You can not cancel this holiday request. first You have to make its case in draft state.')) else: self.pool.get('crm.case').unlink(cr,uid,[record.case_id.id]) self.write(cr, uid, ids, { 'state':'cancel' }) self._create_holiday(cr, uid, ids) return True
def holidays_cancel(self, cr, uid, ids, *args): self._update_user_holidays(cr, uid, ids) self.write(cr, uid, ids, { 'state':'cancel' }) self._create_holiday(cr, uid, ids) return True
468,344
def _get_dav_displayname(self,uri): self.parent.log_message('get DN: %s' % uri) cr, uid, pool, dbname, uri2 = self.get_cr(uri) if not dbname: if cr: cr.close() return COLLECTION node = self.uri2object(cr, uid, pool, uri2) if not node: if cr: cr.close() raise DAV_NotFound2(uri2) cr.close() return node.displayname
def _get_dav_displayname(self,uri): self.parent.log_message('get DN: %s' % uri) cr, uid, pool, dbname, uri2 = self.get_cr(uri) if not dbname: if cr: cr.close() if uri2 and len(uri2) < 2: return uri2[-1] return '' node = self.uri2object(cr, uid, pool, uri2) if not node: if cr: cr.close() raise DAV_NotFound2(uri2) cr.close() return node.displayname
468,345
def _connection_get(self, cr, uid, ids, field_name, arg, context = {}): """ Return a connection string url needed by SQL Alchemy. Exemple: 'postgres://scott:tiger@localhost:5432/mydatabase' @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of connection’s IDs @param context: A standard dictionary for contextual values
def _connection_get(self, cr, uid, ids, field_name, arg, context = {}): """ Return a connection string url needed by SQL Alchemy. Exemple: 'postgres://scott:tiger@localhost:5432/mydatabase' @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of connection’s IDs @param context: A standard dictionary for contextual values
468,346
def test_connection(self, cr, uid, ids, context = {}):
deftest_connection(self,cr,uid,ids,context={}):
468,347
def test_connection(self, cr, uid, ids, context = {}):
deftest_connection(self,cr,uid,ids,context={}):
468,348
def _app_detect(self, cr, uid, ids, field_name, arg, context = {}):
def _app_detect(self, cr, uid, ids, field_name, arg, context = {}):
468,349
def action_dbconnect(self, cr, uid, ids, context = {}):
defaction_dbconnect(self,cr,uid,ids,context={}):
468,350
def action_dbconnect(self, cr, uid, ids, context = {}):
def action_dbconnect(self, cr, uid, ids, context = {}):
468,351
def action_dbload(self, cr, uid, ids, context = {}):
defaction_dbload(self,cr,uid,ids,context={}):
468,352
def action_dbconfigure(self, cr, uid, ids, context = {}):
defaction_dbconfigure(self,cr,uid,ids,context={}):
468,353
def action_dbconfigure(self, cr, uid, ids, context = {}):
def action_dbconfigure(self, cr, uid, ids, context = {}):
468,354
def action_dbready(self, cr, uid, ids, context = {}):
def action_dbready(self, cr, uid, ids, context = {}):
468,355
def action_dbready(self, cr, uid, ids, context = {}):
def action_dbready(self, cr, uid, ids, context = {}):
468,356
def action_done(self, cr, uid, ids, context = {}):
def action_done(self, cr, uid, ids, context = {}):
468,357
def action_done(self, cr, uid, ids, context = {}):
def action_done(self, cr, uid, ids, context = {}):
468,358
def request(self, cr, uid, name, request, context = {}):
def request(self, cr, uid, name, request, context = {}):
468,359
def request(self, cr, uid, name, request, context = {}):
defrequest(self,cr,uid,name,request,context={}):
468,360
def request(self, cr, uid, name, request, context = {}):
def request(self, cr, uid, name, request, context = {}):
468,361
def name_get(self, cr, uid, ids, context = {}):
defname_get(self,cr,uid,ids,context={}):
468,362
def show_col_view(self, cr, uid, ids, context = {}): """ Open Tree View of Database Columns @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of Column’s IDs @param context: A standard dictionary for contextual values """
def show_col_view(self, cr, uid, ids, context = {}): """ Open Tree View of Database Columns @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of Column’s IDs @param context: A standard dictionary for contextual values """
468,363
def _datatypes_get(self, *args, **argv):
def _datatypes_get(self, *args, **argv):
468,364
def name_get(self, cr, uid, ids, context = {}):
defname_get(self,cr,uid,ids,context={}):
468,365
def search(self, cr, uid, args, offset = 0, limit = None, order = None, context = None, count = False):
def search(self, cr, uid, args, offset = 0, limit = None, order = None, context = None, count = False):
468,366
def hide_col(self, cr, uid, ids, context = {}):
def hide_col(self, cr, uid, ids, context = {}):
468,367
def write(self, cr, uid, ids, vals, context = None):
def write(self, cr, uid, ids, vals, context = None):
468,368
def write(self, cr, uid, ids, vals, context=None):
def write(self, cr, uid, ids, vals, context=None):
468,369
def convert_field(f): if f in ('create_date', 'write_date'): return "date_trunc('second', %s) as %s" % (f, f) if f == self.CONCURRENCY_CHECK_FIELD: if self._log_access: return "COALESCE(%s.write_date, %s.create_date, now())::timestamp AS %s" % (self._table, self._table, f,) return "now()::timestamp AS %s" % (f,) if isinstance(self._columns[f], fields.binary) and context.get('bin_size', False): return 'length("%s") as "%s"' % (f, f) return '"%s"' % (f,)
def convert_field(f): if f in ('create_date', 'write_date'): return "date_trunc('second', %s) as %s" % (f, f) if f == self.CONCURRENCY_CHECK_FIELD: if self._log_access: return "COALESCE(%s.write_date, %s.create_date, now())::timestamp AS %s" % (self._table, self._table, f,) return "now()::timestamp AS %s" % (f,) if isinstance(self._columns[f], fields.binary) and context.get('bin_size', False): return 'length("%s") as "%s"' % (f, f) return '"%s"' % (f,)
468,370
def move_line_get(self, cr, uid, invoice_id, context=None): res = super(account_invoice_line,self).move_line_get(cr, uid, invoice_id, context=context) inv = self.pool.get('account.invoice').browse(cr, uid, invoice_id, context=context) if inv.type in ('out_invoice','out_refund'): for i_line in inv.invoice_line: if i_line.product_id: if inv.type == 'out_invoice': # debit account dacc will be the output account # first check the product, if empty check the category dacc = i_line.product_id.product_tmpl_id.property_stock_account_output and i_line.product_id.product_tmpl_id.property_stock_account_output.id if not dacc: dacc = i_line.product_id.categ_id.property_stock_account_output_categ and i_line.product_id.categ_id.property_stock_account_output_categ.id else: # = out_refund # debit account dacc will be the input account # first check the product, if empty check the category dacc = i_line.product_id.product_tmpl_id.property_stock_account_input and i_line.product_id.product_tmpl_id.property_stock_account_input.id if not dacc: dacc = i_line.product_id.categ_id.property_stock_account_input_categ and i_line.product_id.categ_id.property_stock_account_input_categ.id # in both cases the credit account cacc will be the expense account # first check the product, if empty check the category cacc = i_line.product_id.product_tmpl_id.property_account_expense and i_line.product_id.product_tmpl_id.property_account_expense.id if not cacc: cacc = i_line.product_id.categ_id.property_account_expense_categ and i_line.product_id.categ_id.property_account_expense_categ.id if dacc and cacc: res.append({ 'type':'src', 'name': i_line.name[:64], 'price_unit':i_line.product_id.product_tmpl_id.standard_price, 'quantity':i_line.quantity, 'price':i_line.product_id.product_tmpl_id.standard_price * i_line.quantity, 'account_id':dacc, 'product_id':i_line.product_id.id, 'uos_id':i_line.uos_id.id, 'account_analytic_id':i_line.account_analytic_id.id, 'taxes':i_line.invoice_line_tax_id, }) res.append({ 'type':'src', 'name': i_line.name[:64], 'price_unit':i_line.product_id.product_tmpl_id.standard_price, 'quantity':i_line.quantity, 'price': -1 * i_line.product_id.product_tmpl_id.standard_price * i_line.quantity, 'account_id':cacc, 'product_id':i_line.product_id.id, 'uos_id':i_line.uos_id.id, 'account_analytic_id':i_line.account_analytic_id.id, 'taxes':i_line.invoice_line_tax_id, }) elif inv.type in ('in_invoice','in_refund'): for i_line in inv.invoice_line: if i_line.product_id: if i_line.product_id.product_tmpl_id.type != 'service': # get the price difference account at the product acc = i_line.product_id.product_tmpl_id.property_account_creditor_price_difference and i_line.product_id.product_tmpl_id.property_account_creditor_price_difference.id if not acc: # if not found on the product get the price difference account at the category acc = i_line.product_id.categ_id.property_account_creditor_price_difference_categ and i_line.product_id.categ_id.property_account_creditor_price_difference_categ.id a = None if inv.type == 'in_invoice': # oa will be the stock input account # first check the product, if empty check the category oa = i_line.product_id.product_tmpl_id.property_stock_account_input and i_line.product_id.product_tmpl_id.property_stock_account_input.id if not oa: oa = i_line.product_id.categ_id.property_stock_account_input_categ and i_line.product_id.categ_id.property_stock_account_input_categ.id else: # = in_refund # oa will be the stock output account # first check the product, if empty check the category oa = i_line.product_id.product_tmpl_id.property_stock_account_output and i_line.product_id.product_tmpl_id.property_stock_account_output.id if not oa: oa = i_line.product_id.categ_id.property_stock_account_output_categ and i_line.product_id.categ_id.property_stock_account_output_categ.id if oa: # get the fiscal position fpos = i_line.invoice_id.fiscal_position or False a = self.pool.get('account.fiscal.position').map_account(cr, uid, fpos, oa) diff_res = [] # calculate and write down the possible price difference between invoice price and product price for line in res: if a == line['account_id'] and i_line.product_id.id == line['product_id']: uom = i_line.product_id.uos_id or i_line.product_id.uom_id standard_price = self.pool.get('product.uom')._compute_price(cr, uid, uom.id, i_line.product_id.product_tmpl_id.standard_price, i_line.uos_id.id) if standard_price != i_line.price_unit and line['price_unit'] == i_line.price_unit and acc: price_diff = i_line.price_unit - standard_price line.update({'price':standard_price * line['quantity']}) diff_res.append({ 'type':'src', 'name': i_line.name[:64], 'price_unit':price_diff, 'quantity':line['quantity'], 'price': price_diff * line['quantity'], 'account_id':acc, 'product_id':line['product_id'], 'uos_id':line['uos_id'], 'account_analytic_id':line['account_analytic_id'], 'taxes':line.get('taxes',[]), }) res += diff_res return res
def move_line_get(self, cr, uid, invoice_id, context=None): res = super(account_invoice_line,self).move_line_get(cr, uid, invoice_id, context=context) inv = self.pool.get('account.invoice').browse(cr, uid, invoice_id, context=context) if inv.type in ('out_invoice','out_refund'): for i_line in inv.invoice_line: if i_line.product_id: if inv.type == 'out_invoice': # debit account dacc will be the output account # first check the product, if empty check the category dacc = i_line.product_id.product_tmpl_id.property_stock_account_output and i_line.product_id.product_tmpl_id.property_stock_account_output.id if not dacc: dacc = i_line.product_id.categ_id.property_stock_account_output_categ and i_line.product_id.categ_id.property_stock_account_output_categ.id else: # = out_refund # debit account dacc will be the input account # first check the product, if empty check the category dacc = i_line.product_id.product_tmpl_id.property_stock_account_input and i_line.product_id.product_tmpl_id.property_stock_account_input.id if not dacc: dacc = i_line.product_id.categ_id.property_stock_account_input_categ and i_line.product_id.categ_id.property_stock_account_input_categ.id # in both cases the credit account cacc will be the expense account # first check the product, if empty check the category cacc = i_line.product_id.product_tmpl_id.property_account_expense and i_line.product_id.product_tmpl_id.property_account_expense.id if not cacc: cacc = i_line.product_id.categ_id.property_account_expense_categ and i_line.product_id.categ_id.property_account_expense_categ.id if dacc and cacc: res.append({ 'type':'src', 'name': i_line.name[:64], 'price_unit':i_line.product_id.product_tmpl_id.standard_price, 'quantity':i_line.quantity, 'price':get_price(cr, uid, inv, company_currency, i_line), 'account_id':dacc, 'product_id':i_line.product_id.id, 'uos_id':i_line.uos_id.id, 'account_analytic_id':i_line.account_analytic_id.id, 'taxes':i_line.invoice_line_tax_id, }) res.append({ 'type':'src', 'name': i_line.name[:64], 'price_unit':i_line.product_id.product_tmpl_id.standard_price, 'quantity':i_line.quantity, 'price': -1 * i_line.product_id.product_tmpl_id.standard_price * i_line.quantity, 'account_id':cacc, 'product_id':i_line.product_id.id, 'uos_id':i_line.uos_id.id, 'account_analytic_id':i_line.account_analytic_id.id, 'taxes':i_line.invoice_line_tax_id, }) elif inv.type in ('in_invoice','in_refund'): for i_line in inv.invoice_line: if i_line.product_id: if i_line.product_id.product_tmpl_id.type != 'service': # get the price difference account at the product acc = i_line.product_id.product_tmpl_id.property_account_creditor_price_difference and i_line.product_id.product_tmpl_id.property_account_creditor_price_difference.id if not acc: # if not found on the product get the price difference account at the category acc = i_line.product_id.categ_id.property_account_creditor_price_difference_categ and i_line.product_id.categ_id.property_account_creditor_price_difference_categ.id a = None if inv.type == 'in_invoice': # oa will be the stock input account # first check the product, if empty check the category oa = i_line.product_id.product_tmpl_id.property_stock_account_input and i_line.product_id.product_tmpl_id.property_stock_account_input.id if not oa: oa = i_line.product_id.categ_id.property_stock_account_input_categ and i_line.product_id.categ_id.property_stock_account_input_categ.id else: # = in_refund # oa will be the stock output account # first check the product, if empty check the category oa = i_line.product_id.product_tmpl_id.property_stock_account_output and i_line.product_id.product_tmpl_id.property_stock_account_output.id if not oa: oa = i_line.product_id.categ_id.property_stock_account_output_categ and i_line.product_id.categ_id.property_stock_account_output_categ.id if oa: # get the fiscal position fpos = i_line.invoice_id.fiscal_position or False a = self.pool.get('account.fiscal.position').map_account(cr, uid, fpos, oa) diff_res = [] # calculate and write down the possible price difference between invoice price and product price for line in res: if a == line['account_id'] and i_line.product_id.id == line['product_id']: uom = i_line.product_id.uos_id or i_line.product_id.uom_id standard_price = self.pool.get('product.uom')._compute_price(cr, uid, uom.id, i_line.product_id.product_tmpl_id.standard_price, i_line.uos_id.id) if standard_price != i_line.price_unit and line['price_unit'] == i_line.price_unit and acc: price_diff = i_line.price_unit - standard_price line.update({'price':standard_price * line['quantity']}) diff_res.append({ 'type':'src', 'name': i_line.name[:64], 'price_unit':price_diff, 'quantity':line['quantity'], 'price': price_diff * line['quantity'], 'account_id':acc, 'product_id':line['product_id'], 'uos_id':line['uos_id'], 'account_analytic_id':line['account_analytic_id'], 'taxes':line.get('taxes',[]), }) res += diff_res return res
468,371
def move_line_get(self, cr, uid, invoice_id, context=None): res = super(account_invoice_line,self).move_line_get(cr, uid, invoice_id, context=context) inv = self.pool.get('account.invoice').browse(cr, uid, invoice_id, context=context) if inv.type in ('out_invoice','out_refund'): for i_line in inv.invoice_line: if i_line.product_id: if inv.type == 'out_invoice': # debit account dacc will be the output account # first check the product, if empty check the category dacc = i_line.product_id.product_tmpl_id.property_stock_account_output and i_line.product_id.product_tmpl_id.property_stock_account_output.id if not dacc: dacc = i_line.product_id.categ_id.property_stock_account_output_categ and i_line.product_id.categ_id.property_stock_account_output_categ.id else: # = out_refund # debit account dacc will be the input account # first check the product, if empty check the category dacc = i_line.product_id.product_tmpl_id.property_stock_account_input and i_line.product_id.product_tmpl_id.property_stock_account_input.id if not dacc: dacc = i_line.product_id.categ_id.property_stock_account_input_categ and i_line.product_id.categ_id.property_stock_account_input_categ.id # in both cases the credit account cacc will be the expense account # first check the product, if empty check the category cacc = i_line.product_id.product_tmpl_id.property_account_expense and i_line.product_id.product_tmpl_id.property_account_expense.id if not cacc: cacc = i_line.product_id.categ_id.property_account_expense_categ and i_line.product_id.categ_id.property_account_expense_categ.id if dacc and cacc: res.append({ 'type':'src', 'name': i_line.name[:64], 'price_unit':i_line.product_id.product_tmpl_id.standard_price, 'quantity':i_line.quantity, 'price':i_line.product_id.product_tmpl_id.standard_price * i_line.quantity, 'account_id':dacc, 'product_id':i_line.product_id.id, 'uos_id':i_line.uos_id.id, 'account_analytic_id':i_line.account_analytic_id.id, 'taxes':i_line.invoice_line_tax_id, }) res.append({ 'type':'src', 'name': i_line.name[:64], 'price_unit':i_line.product_id.product_tmpl_id.standard_price, 'quantity':i_line.quantity, 'price': -1 * i_line.product_id.product_tmpl_id.standard_price * i_line.quantity, 'account_id':cacc, 'product_id':i_line.product_id.id, 'uos_id':i_line.uos_id.id, 'account_analytic_id':i_line.account_analytic_id.id, 'taxes':i_line.invoice_line_tax_id, }) elif inv.type in ('in_invoice','in_refund'): for i_line in inv.invoice_line: if i_line.product_id: if i_line.product_id.product_tmpl_id.type != 'service': # get the price difference account at the product acc = i_line.product_id.product_tmpl_id.property_account_creditor_price_difference and i_line.product_id.product_tmpl_id.property_account_creditor_price_difference.id if not acc: # if not found on the product get the price difference account at the category acc = i_line.product_id.categ_id.property_account_creditor_price_difference_categ and i_line.product_id.categ_id.property_account_creditor_price_difference_categ.id a = None if inv.type == 'in_invoice': # oa will be the stock input account # first check the product, if empty check the category oa = i_line.product_id.product_tmpl_id.property_stock_account_input and i_line.product_id.product_tmpl_id.property_stock_account_input.id if not oa: oa = i_line.product_id.categ_id.property_stock_account_input_categ and i_line.product_id.categ_id.property_stock_account_input_categ.id else: # = in_refund # oa will be the stock output account # first check the product, if empty check the category oa = i_line.product_id.product_tmpl_id.property_stock_account_output and i_line.product_id.product_tmpl_id.property_stock_account_output.id if not oa: oa = i_line.product_id.categ_id.property_stock_account_output_categ and i_line.product_id.categ_id.property_stock_account_output_categ.id if oa: # get the fiscal position fpos = i_line.invoice_id.fiscal_position or False a = self.pool.get('account.fiscal.position').map_account(cr, uid, fpos, oa) diff_res = [] # calculate and write down the possible price difference between invoice price and product price for line in res: if a == line['account_id'] and i_line.product_id.id == line['product_id']: uom = i_line.product_id.uos_id or i_line.product_id.uom_id standard_price = self.pool.get('product.uom')._compute_price(cr, uid, uom.id, i_line.product_id.product_tmpl_id.standard_price, i_line.uos_id.id) if standard_price != i_line.price_unit and line['price_unit'] == i_line.price_unit and acc: price_diff = i_line.price_unit - standard_price line.update({'price':standard_price * line['quantity']}) diff_res.append({ 'type':'src', 'name': i_line.name[:64], 'price_unit':price_diff, 'quantity':line['quantity'], 'price': price_diff * line['quantity'], 'account_id':acc, 'product_id':line['product_id'], 'uos_id':line['uos_id'], 'account_analytic_id':line['account_analytic_id'], 'taxes':line.get('taxes',[]), }) res += diff_res return res
def move_line_get(self, cr, uid, invoice_id, context=None): res = super(account_invoice_line,self).move_line_get(cr, uid, invoice_id, context=context) inv = self.pool.get('account.invoice').browse(cr, uid, invoice_id, context=context) if inv.type in ('out_invoice','out_refund'): for i_line in inv.invoice_line: if i_line.product_id: if inv.type == 'out_invoice': # debit account dacc will be the output account # first check the product, if empty check the category dacc = i_line.product_id.product_tmpl_id.property_stock_account_output and i_line.product_id.product_tmpl_id.property_stock_account_output.id if not dacc: dacc = i_line.product_id.categ_id.property_stock_account_output_categ and i_line.product_id.categ_id.property_stock_account_output_categ.id else: # = out_refund # debit account dacc will be the input account # first check the product, if empty check the category dacc = i_line.product_id.product_tmpl_id.property_stock_account_input and i_line.product_id.product_tmpl_id.property_stock_account_input.id if not dacc: dacc = i_line.product_id.categ_id.property_stock_account_input_categ and i_line.product_id.categ_id.property_stock_account_input_categ.id # in both cases the credit account cacc will be the expense account # first check the product, if empty check the category cacc = i_line.product_id.product_tmpl_id.property_account_expense and i_line.product_id.product_tmpl_id.property_account_expense.id if not cacc: cacc = i_line.product_id.categ_id.property_account_expense_categ and i_line.product_id.categ_id.property_account_expense_categ.id if dacc and cacc: res.append({ 'type':'src', 'name': i_line.name[:64], 'price_unit':i_line.product_id.product_tmpl_id.standard_price, 'quantity':i_line.quantity, 'price':i_line.product_id.product_tmpl_id.standard_price * i_line.quantity, 'account_id':dacc, 'product_id':i_line.product_id.id, 'uos_id':i_line.uos_id.id, 'account_analytic_id':i_line.account_analytic_id.id, 'taxes':i_line.invoice_line_tax_id, }) res.append({ 'type':'src', 'name': i_line.name[:64], 'price_unit':i_line.product_id.product_tmpl_id.standard_price, 'quantity':i_line.quantity, 'price': -1 * get_price(cr, uid, inv, company_currency, i_line), 'account_id':cacc, 'product_id':i_line.product_id.id, 'uos_id':i_line.uos_id.id, 'account_analytic_id':i_line.account_analytic_id.id, 'taxes':i_line.invoice_line_tax_id, }) elif inv.type in ('in_invoice','in_refund'): for i_line in inv.invoice_line: if i_line.product_id: if i_line.product_id.product_tmpl_id.type != 'service': # get the price difference account at the product acc = i_line.product_id.product_tmpl_id.property_account_creditor_price_difference and i_line.product_id.product_tmpl_id.property_account_creditor_price_difference.id if not acc: # if not found on the product get the price difference account at the category acc = i_line.product_id.categ_id.property_account_creditor_price_difference_categ and i_line.product_id.categ_id.property_account_creditor_price_difference_categ.id a = None if inv.type == 'in_invoice': # oa will be the stock input account # first check the product, if empty check the category oa = i_line.product_id.product_tmpl_id.property_stock_account_input and i_line.product_id.product_tmpl_id.property_stock_account_input.id if not oa: oa = i_line.product_id.categ_id.property_stock_account_input_categ and i_line.product_id.categ_id.property_stock_account_input_categ.id else: # = in_refund # oa will be the stock output account # first check the product, if empty check the category oa = i_line.product_id.product_tmpl_id.property_stock_account_output and i_line.product_id.product_tmpl_id.property_stock_account_output.id if not oa: oa = i_line.product_id.categ_id.property_stock_account_output_categ and i_line.product_id.categ_id.property_stock_account_output_categ.id if oa: # get the fiscal position fpos = i_line.invoice_id.fiscal_position or False a = self.pool.get('account.fiscal.position').map_account(cr, uid, fpos, oa) diff_res = [] # calculate and write down the possible price difference between invoice price and product price for line in res: if a == line['account_id'] and i_line.product_id.id == line['product_id']: uom = i_line.product_id.uos_id or i_line.product_id.uom_id standard_price = self.pool.get('product.uom')._compute_price(cr, uid, uom.id, i_line.product_id.product_tmpl_id.standard_price, i_line.uos_id.id) if standard_price != i_line.price_unit and line['price_unit'] == i_line.price_unit and acc: price_diff = i_line.price_unit - standard_price line.update({'price':standard_price * line['quantity']}) diff_res.append({ 'type':'src', 'name': i_line.name[:64], 'price_unit':price_diff, 'quantity':line['quantity'], 'price': price_diff * line['quantity'], 'account_id':acc, 'product_id':line['product_id'], 'uos_id':line['uos_id'], 'account_analytic_id':line['account_analytic_id'], 'taxes':line.get('taxes',[]), }) res += diff_res return res
468,372
def create(self, cr, user, vals, context=None): self.vaccum(cr, user) self.next_id += 1 id_new = self.next_id default = [] for f in self._columns.keys(): if not f in vals: default.append(f) if len(default): vals.update(self.default_get(cr, user, default, context)) vals2 = {} upd_todo = [] for field in vals: if self._columns[field]._classic_write: vals2[field] = vals[field] else: upd_todo.append(field) self.datas[id_new] = vals2 self.datas[id_new]['internal.date_access'] = time.time() self.datas[id_new]['internal.create_uid'] = user
def create(self, cr, user, vals, context=None): self.vaccum(cr, user) self.next_id += 1 id_new = self.next_id defaults = self.default_get(cr, user, [], context) defaults.update(vals) vals = defaults vals2 = {} upd_todo = [] for field in vals: if self._columns[field]._classic_write: vals2[field] = vals[field] else: upd_todo.append(field) self.datas[id_new] = vals2 self.datas[id_new]['internal.date_access'] = time.time() self.datas[id_new]['internal.create_uid'] = user
468,373
def create(self, cr, user, vals, context=None): """ Create new record with specified value
def create(self, cr, user, vals, context=None): """ Create new record with specified value
468,374
def init(self, cr):
def init(self, cr):
468,375
def data_save(self, cr, uid, ids, context=None): """ This function close account fiscalyear and create entries in new fiscalyear @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of Account fiscalyear close state’s IDs
def data_save(self, cr, uid, ids, context=None): """ This function close account fiscalyear and create entries in new fiscalyear @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of Account fiscalyear close state’s IDs
468,376
def data_save(self, cr, uid, ids, context=None): """ This function close account fiscalyear and create entries in new fiscalyear @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of Account fiscalyear close state’s IDs
def data_save(self, cr, uid, ids, context=None): """ This function close account fiscalyear and create entries in new fiscalyear @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of Account fiscalyear close state’s IDs
468,377
def product_id_change(self, cr, uid, ids, product, uom, qty=0, name='', type='out_invoice', partner_id=False, fposition_id=False, price_unit=False, address_invoice_id=False, context=None): if context is None: context = {} if not partner_id: raise osv.except_osv(_('No Partner Defined !'),_("You must first select a partner !") ) if not product: if type in ('in_invoice', 'in_refund'): return {'domain':{'product_uom':[]}} else: return {'value': {'price_unit': 0.0}, 'domain':{'product_uom':[]}} part = self.pool.get('res.partner').browse(cr, uid, partner_id) fpos = fposition_id and self.pool.get('account.fiscal.position').browse(cr, uid, fposition_id) or False
def product_id_change(self, cr, uid, ids, product, uom, qty=0, name='', type='out_invoice', partner_id=False, fposition_id=False, price_unit=False, address_invoice_id=False, context=None): if context is None: context = {} if not partner_id: raise osv.except_osv(_('No Partner Defined !'),_("You must first select a partner !") ) if not product: if type in ('in_invoice', 'in_refund'): return {'domain':{'product_uom':[]}} else: return {'value': {'price_unit': 0.0}, 'domain':{'product_uom':[]}} part = self.pool.get('res.partner').browse(cr, uid, partner_id) fpos = fposition_id and self.pool.get('account.fiscal.position').browse(cr, uid, fposition_id) or False
468,378
def price_get(self, cr, uid, ids, prod_id, qty, partner=None, context=None): ''' context = { 'uom': Unit of Measure (int), 'partner': Partner ID (int), 'date': Date of the pricelist (%Y-%m-%d), } ''' price=False item_id=0 context = context or {} currency_obj = self.pool.get('res.currency') product_obj = self.pool.get('product.product') supplierinfo_obj = self.pool.get('product.supplierinfo') price_type_obj = self.pool.get('product.price.type')
def price_get(self, cr, uid, ids, prod_id, qty, partner=None, context=None): ''' context = { 'uom': Unit of Measure (int), 'partner': Partner ID (int), 'date': Date of the pricelist (%Y-%m-%d), } ''' price=False item_id=0 context = context or {} currency_obj = self.pool.get('res.currency') product_obj = self.pool.get('product.product') supplierinfo_obj = self.pool.get('product.supplierinfo') price_type_obj = self.pool.get('product.price.type')
468,379
def _number_packages(self, cr, uid, ids, field_name, arg, context): res = {} for line in self.browse(cr, uid, ids): try: res[line.id] = int(line.product_uom_qty / line.product_packaging.qty) except: res[line.id] = 1 return res
def _number_packages(self, cr, uid, ids, field_name, arg, context): res = {} for line in self.browse(cr, uid, ids): try: res[line.id] = int(line.product_uom_qty / line.product_packaging.qty) except: res[line.id] = 1 return res
468,380
def _number_packages(self, cr, uid, ids, field_name, arg, context): res = {} for line in self.browse(cr, uid, ids): try: res[line.id] = int(line.product_uom_qty / line.product_packaging.qty) except: res[line.id] = 1 return res
def _number_packages(self, cr, uid, ids, field_name, arg, context): res = {} for line in self.browse(cr, uid, ids): try: res[line.id] = int(line.product_uom_qty / line.product_packaging.qty) except: res[line.id] = 1 return res
468,381
def _number_packages(self, cr, uid, ids, field_name, arg, context): res = {} for line in self.browse(cr, uid, ids): try: res[line.id] = int(line.product_uom_qty / line.product_packaging.qty) except: res[line.id] = 1 return res
def _number_packages(self, cr, uid, ids, field_name, arg, context): res = {} for line in self.browse(cr, uid, ids): try: res[line.id] = int(line.product_uom_qty / line.product_packaging.qty) except: res[line.id] = 1 return res
468,382
def _number_packages(self, cr, uid, ids, field_name, arg, context): res = {} for line in self.browse(cr, uid, ids): try: res[line.id] = int(line.product_uom_qty / line.product_packaging.qty) except: res[line.id] = 1 return res
def _number_packages(self, cr, uid, ids, field_name, arg, context): res = {} for line in self.browse(cr, uid, ids): try: res[line.id] = int(line.product_uom_qty / line.product_packaging.qty) except: res[line.id] = 1 return res
468,383
def _number_packages(self, cr, uid, ids, field_name, arg, context): res = {} for line in self.browse(cr, uid, ids): try: res[line.id] = int(line.product_uom_qty / line.product_packaging.qty) except: res[line.id] = 1 return res
def _number_packages(self, cr, uid, ids, field_name, arg, context): res = {} for line in self.browse(cr, uid, ids): try: res[line.id] = int(line.product_uom_qty / line.product_packaging.qty) except: res[line.id] = 1 return res
468,384
def _number_packages(self, cr, uid, ids, field_name, arg, context): res = {} for line in self.browse(cr, uid, ids): try: res[line.id] = int(line.product_uom_qty / line.product_packaging.qty) except: res[line.id] = 1 return res
def _number_packages(self, cr, uid, ids, field_name, arg, context): res = {} for line in self.browse(cr, uid, ids): try: res[line.id] = int(line.product_uom_qty / line.product_packaging.qty) except: res[line.id] = 1 return res
468,385
def _number_packages(self, cr, uid, ids, field_name, arg, context): res = {} for line in self.browse(cr, uid, ids): try: res[line.id] = int(line.product_uom_qty / line.product_packaging.qty) except: res[line.id] = 1 return res
def _number_packages(self, cr, uid, ids, field_name, arg, context): res = {} for line in self.browse(cr, uid, ids): try: res[line.id] = int(line.product_uom_qty / line.product_packaging.qty) except: res[line.id] = 1 return res
468,386
def copy(self, cr, uid, id, default=None,context=None): if not default: default = {} default.update({ 'name': self.pool.get('ir.sequence').get(cr, uid, 'mrp.production'), 'move_lines' : [], 'move_created_ids': [], 'state': 'draft' }) return super(mrp_production, self).copy(cr, uid, id, default, context)
def copy(self, cr, uid, id, default=None,context=None): if not default: default = {} default.update({ 'name': self.pool.get('ir.sequence').get(cr, uid, 'mrp.production'), 'move_lines' : [], 'move_lines2' : [], 'move_created_ids' : [], 'move_created_ids2' : [], 'product_lines' : [], 'state': 'draft', 'picking_id': False }) return super(mrp_production, self).copy(cr, uid, id, default, context)
468,387
def _fnct_read(self, obj, cr, uid, ids, prop, val, context=None): if not context: context = {} property = obj.pool.get('ir.property') definition_id = self._field_get(cr, uid, obj._name, prop)
def _fnct_read(self, obj, cr, uid, ids, prop, val, context=None): if not context: context = {} property = obj.pool.get('ir.property') definition_id = self._field_get(cr, uid, obj._name, prop)
468,388
def _child_get(self, cr, name = None, domain=None): """ return virtual children of resource, based on the foreign object.
def _child_get(self, cr, name = None, domain=None): """ return virtual children of resource, based on the foreign object.
468,389
def _child_get(self, cr, name = None, domain=None): """ return virtual children of resource, based on the foreign object.
def _child_get(self, cr, name = None, domain=None): """ return virtual children of resource, based on the foreign object.
468,390
def _child_get(self, cr, name = None, domain=None): """ return virtual children of resource, based on the foreign object.
def _child_get(self, cr, name = None, domain=None): """ return virtual children of resource, based on the foreign object.
468,391
def _child_get(self, cr, name=None, domain=None): dirobj = self.context._dirobj
def _child_get(self, cr, name=None, domain=None): dirobj = self.context._dirobj
468,392
def _make_packing(obj, cursor, user, data, context): wkf_service = netsvc.LocalService('workflow') pool = pooler.get_pool(cursor.dbname) picking_obj = pool.get('stock.picking') ids = data['form']['pickings'][0][2] print"-------ids--------",ids picking_obj.force_assign(cursor, user, ids) picking_obj.action_move(cursor, user, ids) for picking_id in ids: wkf_service.trg_validate(user, 'stock.picking', picking_id, 'button_done', cursor) return {}
def _make_packing(obj, cursor, user, data, context): wkf_service = netsvc.LocalService('workflow') pool = pooler.get_pool(cursor.dbname) picking_obj = pool.get('stock.picking') ids = data['form']['pickings'][0][2] print"-------ids--------",ids picking_obj.force_assign(cursor, user, ids) picking_obj.action_move(cursor, user, ids) for picking_id in ids: wkf_service.trg_validate(user, 'stock.picking', picking_id, 'button_done', cursor) return {}
468,393
def _make_packing(obj, cursor, user, data, context): wkf_service = netsvc.LocalService('workflow') pool = pooler.get_pool(cursor.dbname) picking_obj = pool.get('stock.picking') ids = data['form']['pickings'][0][2] print"-------ids--------",ids picking_obj.force_assign(cursor, user, ids) picking_obj.action_move(cursor, user, ids) for picking_id in ids: wkf_service.trg_validate(user, 'stock.picking', picking_id, 'button_done', cursor) return {}
def_make_packing(obj,cursor,user,data,context):wkf_service=netsvc.LocalService('workflow')pool=pooler.get_pool(cursor.dbname)picking_obj=pool.get('stock.picking')ids=data['form']['pickings'][0][2]print"-------ids--------",idspicking_obj.force_assign(cursor,user,ids)picking_obj.action_move(cursor,user,ids)forpicking_idinids:wkf_service.trg_validate(user,'stock.picking',picking_id,'button_done',cursor)return{}
468,394
def generate_configurable_chart(self, cr, uid, ids, context=None): obj_acc = self.pool.get('account.account') obj_acc_tax = self.pool.get('account.tax') obj_journal = self.pool.get('account.journal') obj_sequence = self.pool.get('ir.sequence') obj_acc_template = self.pool.get('account.account.template') obj_fiscal_position_template = self.pool.get('account.fiscal.position.template') obj_fiscal_position = self.pool.get('account.fiscal.position') mod_obj = self.pool.get('ir.model.data') analytic_journal_obj = self.pool.get('account.analytic.journal')
def generate_configurable_chart(self, cr, uid, ids, context=None): obj_acc = self.pool.get('account.account') obj_acc_tax = self.pool.get('account.tax') obj_journal = self.pool.get('account.journal') obj_sequence = self.pool.get('ir.sequence') obj_acc_template = self.pool.get('account.account.template') obj_fiscal_position_template = self.pool.get('account.fiscal.position.template') obj_fiscal_position = self.pool.get('account.fiscal.position') mod_obj = self.pool.get('ir.model.data') analytic_journal_obj = self.pool.get('account.analytic.journal')
468,395
def format_body(self, body): return body and tools.ustr(body.encode('ascii', 'replace')) or ''
def format_body(self, body): return body and tools.ustr(body.encode('ascii', 'replace')) or ''
468,396
def ustr(value, hint_encoding='utf-8'): """This method is similar to the builtin `str` method, except it will return unicode() string. @param value: the value to convert @param hint_encoding: an optional encoding that was detected upstream and should be tried first to decode ``value``. @rtype: unicode @return: unicode string """ orig = value if isinstance(value, Exception): return exception_to_unicode(value) if isinstance(value, unicode): return value for ln in get_encodings(hint_encoding): try: return unicode(value, ln) except Exception: pass raise UnicodeError('unable de to convert %r' % (orig,))
def ustr(value, hint_encoding='utf-8'): """This method is similar to the builtin `str` method, except it will return unicode() string. @param value: the value to convert @param hint_encoding: an optional encoding that was detected upstream and should be tried first to decode ``value``. @rtype: unicode @return: unicode string """ if isinstance(value, Exception): return exception_to_unicode(value) if isinstance(value, unicode): return value for ln in get_encodings(hint_encoding): try: return unicode(value, ln) except Exception: pass raise UnicodeError('unable de to convert %r' % (orig,))
468,397
def ustr(value, hint_encoding='utf-8'): """This method is similar to the builtin `str` method, except it will return unicode() string. @param value: the value to convert @param hint_encoding: an optional encoding that was detected upstream and should be tried first to decode ``value``. @rtype: unicode @return: unicode string """ orig = value if isinstance(value, Exception): return exception_to_unicode(value) if isinstance(value, unicode): return value for ln in get_encodings(hint_encoding): try: return unicode(value, ln) except Exception: pass raise UnicodeError('unable de to convert %r' % (orig,))
def ustr(value, hint_encoding='utf-8'): """This method is similar to the builtin `str` method, except it will return unicode() string. @param value: the value to convert @param hint_encoding: an optional encoding that was detected upstream and should be tried first to decode ``value``. @rtype: unicode @return: unicode string """ orig = value if isinstance(value, Exception): return exception_to_unicode(value) if isinstance(value, unicode): return value for ln in get_encodings(hint_encoding): try: return unicode(value, ln) except Exception: pass raise UnicodeError('unable de to convert %r' % (value,))
468,398
def _get_source(self, cr, uid, name, types, lang, source=None): """ Returns the translation for the given combination of name, type, language and source. All values passed to this method should be unicode (not byte strings), especially ``source``.
def _get_source(self, cr, uid, name, types, lang, source=None): """ Returns the translation for the given combination of name, type, language and source. All values passed to this method should be unicode (not byte strings), especially ``source``.
468,399