rem
stringlengths 1
322k
| add
stringlengths 0
2.05M
| context
stringlengths 4
228k
| meta
stringlengths 156
215
|
---|---|---|---|
'company_id': fields.many2one('res.company','Company',required=True,select=True), | 'company_id': fields.many2one('res.company', 'Company', required=True, select=True, readonly=True, states={'draft':[('readonly',False)]}), | def do_partial(self, cr, uid, ids, partial_datas, context=None): """ Makes partial pickings and moves done. @param partial_datas: Dictionary containing details of partial picking like partner_id, address_id, delivery_date, delivery moves with product_id, product_qty, uom """ res = {} picking_obj = self.pool.get('stock.picking') product_obj = self.pool.get('product.product') currency_obj = self.pool.get('res.currency') uom_obj = self.pool.get('product.uom') wf_service = netsvc.LocalService("workflow") | d7496a8ea44df329960c6572b94ef3ec72902b69 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/d7496a8ea44df329960c6572b94ef3ec72902b69/stock.py |
bro = obj_model.browse(self, cr, uid, res_id, context=context) | bro = obj_model.browse(cr, uid, res_id, context=context) | def __get_partner_id(self, cr, uid, res_model, res_id, context): """ A helper to retrieve the associated partner from any res_model+id It is a hack that will try to discover if the mentioned record is clearly associated with a partner record. """ obj_model = self.pool.get(res_model) if obj_model._name == 'res.partner': return res_id elif 'partner_id' in obj_model._columns and obj_model._columns['partner_id']._obj == 'res.partner': bro = obj_model.browse(self, cr, uid, res_id, context=context) return bro.partner_id.id elif 'address_id' in obj_model._columns and obj_model._columns['address_id']._obj == 'res.partner.address': bro = obj_model.browse(self, cr, uid, res_id, context=context) return bro.address_id.partner_id.id return False | 22257372f0bb3877830c689c6ce09c9303474be1 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/22257372f0bb3877830c689c6ce09c9303474be1/document.py |
bro = obj_model.browse(self, cr, uid, res_id, context=context) | bro = obj_model.browse(cr, uid, res_id, context=context) | def __get_partner_id(self, cr, uid, res_model, res_id, context): """ A helper to retrieve the associated partner from any res_model+id It is a hack that will try to discover if the mentioned record is clearly associated with a partner record. """ obj_model = self.pool.get(res_model) if obj_model._name == 'res.partner': return res_id elif 'partner_id' in obj_model._columns and obj_model._columns['partner_id']._obj == 'res.partner': bro = obj_model.browse(self, cr, uid, res_id, context=context) return bro.partner_id.id elif 'address_id' in obj_model._columns and obj_model._columns['address_id']._obj == 'res.partner.address': bro = obj_model.browse(self, cr, uid, res_id, context=context) return bro.address_id.partner_id.id return False | 22257372f0bb3877830c689c6ce09c9303474be1 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/22257372f0bb3877830c689c6ce09c9303474be1/document.py |
if groupby and fget[groupby]['type'] == 'many2one': data_ids = self.search(cr, uid, [('id', 'in', alldata.keys())], order=orderby or groupby, context=context) data_ids += filter(lambda x:x not in data_ids, alldata.keys()) data = self.read(cr, uid, data_ids, groupby and [groupby] or ['id'], context=context) data.sort(lambda x,y: cmp(data_ids.index(x['id']), data_ids.index(y['id']))) else: data = self.read(cr, uid, alldata.keys(), groupby and [groupby] or ['id'], context=context) if groupby: data.sort(lambda x,y:cmp(x[groupby],y[groupby])) | data_ids = self.search(cr, uid, [('id', 'in', alldata.keys())], order=orderby or groupby, context=context) data_ids += filter(lambda x:x not in data_ids, alldata.keys()) data = self.read(cr, uid, data_ids, groupby and [groupby] or ['id'], context=context) data.sort(lambda x,y: cmp(data_ids.index(x['id']), data_ids.index(y['id']))) | def read_group(self, cr, uid, domain, fields, groupby, offset=0, limit=None, context=None, orderby=False): """ Get the list of records in list view grouped by the given ``groupby`` fields | 6f0660eaa075fe46b921583bd8e253d6bfd40058 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6f0660eaa075fe46b921583bd8e253d6bfd40058/orm.py |
message_id = case.history_line[0].message_id | message_id = res_id | def action_send(self, cr, uid, ids, context=None): """ This sends an email to ALL the addresses of the selected partners. """ | 78c9835966fceddd3a9ef42924131d79195d575d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/78c9835966fceddd3a9ef42924131d79195d575d/crm_send_email.py |
'balance_start': fields.function(_get_starting_balance, method=True, string='Opening Balance', type='float',digits=(16,2)), 'balance_end_real': fields.float('Closing Balance', digits=(16,2), states={'confirm':[('readonly', True)]}), | 'balance_start': fields.function(_get_starting_balance, method=True, string='Opening Balance', type='float',digits=(16,2), help="Opening balance based on cashBox"), 'balance_end_real': fields.float('Closing Balance', digits=(16,2), states={'confirm':[('readonly', True)]}, help="closing balance entered by the cashbox verifier"), | def _end_balance(self, cursor, user, ids, name, attr, context=None): res_currency_obj = self.pool.get('res.currency') res_users_obj = self.pool.get('res.users') | 550a94721cb521ac6bf116f2a50ee6ee869f1fc8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/550a94721cb521ac6bf116f2a50ee6ee869f1fc8/account_cash_statement.py |
'total_entry_encoding':fields.function(_get_sum_entry_encoding, method=True, string="Cash Transaction"), | 'total_entry_encoding':fields.function(_get_sum_entry_encoding, method=True, string="Cash Transaction", help="Total cash transactions"), | def _end_balance(self, cursor, user, ids, name, attr, context=None): res_currency_obj = self.pool.get('res.currency') res_users_obj = self.pool.get('res.users') | 550a94721cb521ac6bf116f2a50ee6ee869f1fc8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/550a94721cb521ac6bf116f2a50ee6ee869f1fc8/account_cash_statement.py |
'balance_end': fields.function(_end_balance, method=True, string='Balance'), 'balance_end_cash': fields.function(_balance_end_cash, method=True, string='Balance'), | 'balance_end': fields.function(_end_balance, method=True, string='Balance', help="Closing balance based on transactions"), 'balance_end_cash': fields.function(_balance_end_cash, method=True, string='Balance', help="Closing balance based on cashBox"), | def _end_balance(self, cursor, user, ids, name, attr, context=None): res_currency_obj = self.pool.get('res.currency') res_users_obj = self.pool.get('res.users') | 550a94721cb521ac6bf116f2a50ee6ee869f1fc8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/550a94721cb521ac6bf116f2a50ee6ee869f1fc8/account_cash_statement.py |
raise osv.except_osv(_('Error !'), _('Cash balance is not match with closing balance !')) | raise osv.except_osv(_('Error !'), _('Cash balance is not matching with closing balance !')) | def button_confirm(self, cr, uid, ids, context={}): """ Check the starting and ending detail of statement @return: True """ done = [] res_currency_obj = self.pool.get('res.currency') res_users_obj = self.pool.get('res.users') account_move_obj = self.pool.get('account.move') account_move_line_obj = self.pool.get('account.move.line') account_bank_statement_line_obj = self.pool.get('account.bank.statement.line') | 550a94721cb521ac6bf116f2a50ee6ee869f1fc8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/550a94721cb521ac6bf116f2a50ee6ee869f1fc8/account_cash_statement.py |
res[id] = sums[id] | res[id] = sums.get(id, null_result) | def __compute(self, cr, uid, ids, field_names, arg, context={}, query=''): #compute the balance/debit/credit accordingly to the value of field_name for the given account ids mapping = { 'balance': "COALESCE(SUM(l.debit),0) - COALESCE(SUM(l.credit), 0) as balance ", 'debit': "COALESCE(SUM(l.debit), 0) as debit ", 'credit': "COALESCE(SUM(l.credit), 0) as credit " } #get all the necessary accounts ids2 = self._get_children_and_consol(cr, uid, ids, context) #compute for each account the balance/debit/credit from the move lines accounts = {} if ids2: aml_query = self.pool.get('account.move.line')._query_get(cr, uid, context=context) | 1c3118bb1b2ba72e4512f297175f40aa27ef92f2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/1c3118bb1b2ba72e4512f297175f40aa27ef92f2/account.py |
data[n] = browse_record(self._cr, | new_data[n] = browse_record(self._cr, | def __getitem__(self, name): if name == 'id': return self._id if name not in self._data[self._id]: # build the list of fields we will fetch | 8fa3951b8c9c4aab7d9be881181f2cd832ef83b1 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/8fa3951b8c9c4aab7d9be881181f2cd832ef83b1/orm.py |
data[n] = browse_null() | new_data[n] = browse_null() | def __getitem__(self, name): if name == 'id': return self._id if name not in self._data[self._id]: # build the list of fields we will fetch | 8fa3951b8c9c4aab7d9be881181f2cd832ef83b1 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/8fa3951b8c9c4aab7d9be881181f2cd832ef83b1/orm.py |
data[n] = browse_null() | new_data[n] = browse_null() | def __getitem__(self, name): if name == 'id': return self._id if name not in self._data[self._id]: # build the list of fields we will fetch | 8fa3951b8c9c4aab7d9be881181f2cd832ef83b1 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/8fa3951b8c9c4aab7d9be881181f2cd832ef83b1/orm.py |
data[n] = self._list_class([browse_record(self._cr, self._uid, id, self._table.pool.get(f._obj), self._cache, context=self._context, list_class=self._list_class, fields_process=self._fields_process) for id in data[n]], self._context) self._data[data['id']].update(data) | new_data[n] = self._list_class([browse_record(self._cr, self._uid, id, self._table.pool.get(f._obj), self._cache, context=self._context, list_class=self._list_class, fields_process=self._fields_process) for id in data[n]], self._context) else: new_data[n] = data[n] self._data[data['id']].update(new_data) | def __getitem__(self, name): if name == 'id': return self._id if name not in self._data[self._id]: # build the list of fields we will fetch | 8fa3951b8c9c4aab7d9be881181f2cd832ef83b1 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/8fa3951b8c9c4aab7d9be881181f2cd832ef83b1/orm.py |
for partner_id in ids: line_id = member_line_obj.search(cr, uid, [('partner', '=', partner_id)], limit=1, order='date_cancel') if line_id: res[partner_id] = member_line_obj.read(cr, uid, line_id[0], ['date_cancel'])['date_cancel'] | for partner in self.browse(cr, uid, ids, context=context): if partner.membership_state != 'canceled': res[partner.id] = False | def _membership_cancel(self, cr, uid, ids, name, args, context=None): '''Return the cancel date of membership''' res = {} member_line_obj = self.pool.get('membership.membership_line') for partner_id in ids: line_id = member_line_obj.search(cr, uid, [('partner', '=', partner_id)], limit=1, order='date_cancel') if line_id: res[partner_id] = member_line_obj.read(cr, uid, line_id[0], ['date_cancel'])['date_cancel'] else: res[partner_id] = False return res | 10d930b094915ade51e570cf13a3c2a46402a353 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/10d930b094915ade51e570cf13a3c2a46402a353/membership.py |
res[partner_id] = False | line_id = member_line_obj.search(cr, uid, [('partner', '=', partner.id)],limit=1, order='date_cancel') if line_id: res[partner.id] = member_line_obj.read(cr, uid, line_id[0],['date_cancel'])['date_cancel'] else: res[partner.id] = False | def _membership_cancel(self, cr, uid, ids, name, args, context=None): '''Return the cancel date of membership''' res = {} member_line_obj = self.pool.get('membership.membership_line') for partner_id in ids: line_id = member_line_obj.search(cr, uid, [('partner', '=', partner_id)], limit=1, order='date_cancel') if line_id: res[partner_id] = member_line_obj.read(cr, uid, line_id[0], ['date_cancel'])['date_cancel'] else: res[partner_id] = False return res | 10d930b094915ade51e570cf13a3c2a46402a353 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/10d930b094915ade51e570cf13a3c2a46402a353/membership.py |
'date_open': fields.datetime('Opened', readonly=True), | def _compute_day(self, cr, uid, ids, fields, args, context=None): if context is None: 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 values """ cal_obj = self.pool.get('resource.calendar') res_obj = self.pool.get('resource.resource') | 32392534dc1e2a3b947c919fb2706441a17ce1eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/32392534dc1e2a3b947c919fb2706441a17ce1eb/project_issue.py |
|
'date_planned': newdate.strftime('%Y-%m-%d %H:%M:%S'), | 'date_planned': date_planned, | def create_order(self, cr, uid, ids, context): """ To Create a purchase orders . | cc21b0a22177b09f04a2ab6f73039468e9fc1323 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/cc21b0a22177b09f04a2ab6f73039468e9fc1323/purchase_requisition_partner.py |
def write(self, cr, uid, ids, vals, context=None): resource_calendar_obj = self.pool.get('resource.calendar') resource_obj = self.pool.get('resource.resource') uom_obj = self.pool.get('product.uom') if context is None: context = {} res = super(project_phase, self).write(cr, uid, ids, vals, context=context) if context.get('scheduler',False): return res if isinstance(ids, (int, long)): ids = [ids] default_uom_id = self._get_default_uom_id(cr, uid) for phase in self.browse(cr, uid, ids, context=context): calendar_id = phase.project_id.resource_calendar_id and phase.project_id.resource_calendar_id.id or False resource_id = resource_obj.search(cr, uid, [('user_id', '=', phase.responsible_id.id)],context=context) if resource_id: cal_id = resource_obj.browse(cr, uid, resource_id[0], context=context).calendar_id.id if cal_id: calendar_id = cal_id avg_hours = uom_obj._compute_qty(cr, uid, phase.product_uom.id, phase.duration, default_uom_id) if vals.get('date_start', False) and vals['date_start'] < phase.date_start: dt_start = datetime.strptime(vals['date_start'], '%Y-%m-%d') work_times = resource_calendar_obj.interval_get(cr, uid, calendar_id, dt_start, avg_hours or 0.0, resource_id and resource_id[0] or False) if work_times: vals['date_end'] = work_times[-1][1].strftime('%Y-%m-%d') for prv_phase in phase.previous_phase_ids: if prv_phase.id == phase.id: continue self._check_date_start(cr, uid, prv_phase, dt_start, context=context) if vals.get('date_end', False) and vals['date_end'] > phase.date_end: dt_end = datetime.strptime(vals['date_end'], '%Y-%m-%d') work_times = resource_calendar_obj.interval_min_get(cr, uid, calendar_id, dt_end, avg_hours or 0.0, resource_id and resource_id[0] or False) if work_times: vals['date_start'] = work_times[0][0].strftime('%Y-%m-%d') for next_phase in phase.next_phase_ids: if next_phase.id == phase.id: continue self._check_date_end(cr, uid, next_phase, dt_end, context=context) return res | def write(self, cr, uid, ids, vals, context=None): resource_calendar_obj = self.pool.get('resource.calendar') resource_obj = self.pool.get('resource.resource') uom_obj = self.pool.get('product.uom') if context is None: context = {} res = super(project_phase, self).write(cr, uid, ids, vals, context=context) if context.get('scheduler',False): return res # Consider calendar and efficiency if the phase is performed by a resource # otherwise consider the project's working calendar | 224253a44dffed237d4c8a531dae029cb6143118 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/224253a44dffed237d4c8a531dae029cb6143118/project_long_term.py |
|
self.send_error(400, "Bad request syntax (%r)" % requestline) | def parse_rawline(self): """Parse a request (internal). | 84a0a39d23f86c499ed71c4f22b33cb9e893fc2b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/84a0a39d23f86c499ed71c4f22b33cb9e893fc2b/websrv_lib.py |
|
tax_obj = self.pool.get('account.tax') | tax_obj = self.pool.get('account.tax') cur_obj = self.pool.get('res.currency') | def _amount_all(self, cr, uid, ids, name, args, context=None): tax_obj = self.pool.get('account.tax') res={} for order in self.browse(cr, uid, ids): res[order.id] = { 'amount_paid': 0.0, 'amount_return':0.0, 'amount_tax':0.0, } for payment in order.statement_ids: res[order.id]['amount_paid'] += payment.amount for payment in order.payments: res[order.id]['amount_return'] += (payment.amount < 0 and payment.amount or 0) for line in order.lines: if order.price_type!='tax_excluded': res[order.id]['amount_tax'] = reduce(lambda x, y: x+round(y['amount'], 2), tax_obj.compute_inv(cr, uid, line.product_id.taxes_id, line.price_unit * \ (1-(line.discount or 0.0)/100.0), line.qty), res[order.id]['amount_tax']) else: res[order.id]['amount_tax'] = reduce(lambda x, y: x+round(y['amount'], 2), tax_obj.compute_all(cr, uid, line.product_id.taxes_id, line.price_unit * \ (1-(line.discount or 0.0)/100.0), line.qty)['taxes'], res[order.id]['amount_tax']) return res | 6c1521448d481a37b494258c8381d2bf6152dbac /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6c1521448d481a37b494258c8381d2bf6152dbac/pos.py |
res[order.id]['amount_tax'] = reduce(lambda x, y: x+round(y['amount'], 2), tax_obj.compute_all(cr, uid, line.product_id.taxes_id, line.price_unit * \ (1-(line.discount or 0.0)/100.0), line.qty)['taxes'], res[order.id]['amount_tax']) | for c in tax_obj.compute_all(cr, uid, line.product_id.taxes_id, line.price_unit * (1-(line.discount or 0.0)/100.0), line.qty, line.product_id, line.order_id.partner_id)['taxes']: val += c['amount'] res[order.id]['amount_tax'] = cur_obj.round(cr, uid, cur, val) | def _amount_all(self, cr, uid, ids, name, args, context=None): tax_obj = self.pool.get('account.tax') res={} for order in self.browse(cr, uid, ids): res[order.id] = { 'amount_paid': 0.0, 'amount_return':0.0, 'amount_tax':0.0, } for payment in order.statement_ids: res[order.id]['amount_paid'] += payment.amount for payment in order.payments: res[order.id]['amount_return'] += (payment.amount < 0 and payment.amount or 0) for line in order.lines: if order.price_type!='tax_excluded': res[order.id]['amount_tax'] = reduce(lambda x, y: x+round(y['amount'], 2), tax_obj.compute_inv(cr, uid, line.product_id.taxes_id, line.price_unit * \ (1-(line.discount or 0.0)/100.0), line.qty), res[order.id]['amount_tax']) else: res[order.id]['amount_tax'] = reduce(lambda x, y: x+round(y['amount'], 2), tax_obj.compute_all(cr, uid, line.product_id.taxes_id, line.price_unit * \ (1-(line.discount or 0.0)/100.0), line.qty)['taxes'], res[order.id]['amount_tax']) return res | 6c1521448d481a37b494258c8381d2bf6152dbac /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6c1521448d481a37b494258c8381d2bf6152dbac/pos.py |
% (operation, self._name)) | % (operation, self._description)) | def check_access_rule(self, cr, uid, ids, operation, context=None): """Verifies that the operation given by ``operation`` is allowed for the user according to ir.rules. | fed6d90304e5468c1fba39e0686081f8b3766d10 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/fed6d90304e5468c1fba39e0686081f8b3766d10/orm.py |
current_rec = self.read(cr, uid, ids, context)[0] | current_rec = self.read(cr, uid, ids, context) | def check_model(self, cr, uid, ids, context = None): if context is None: context = {} current_rec = self.read(cr, uid, ids, context)[0] if current_rec: model = self.pool.get(current_rec.get('object_id')[1]) if hasattr(model, 'message_new'): return True return False | acacf36ebb8dd7f2d736e19cbfc70ed22b867fdc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/acacf36ebb8dd7f2d736e19cbfc70ed22b867fdc/fetchmail.py |
model = self.pool.get(current_rec.get('object_id')[1]) | current_rec = current_rec[0] model_name = self.pool.get('ir.model').browse(cr, uid, current_rec.get('object_id')[0]).model model = self.pool.get(model_name) | def check_model(self, cr, uid, ids, context = None): if context is None: context = {} current_rec = self.read(cr, uid, ids, context)[0] if current_rec: model = self.pool.get(current_rec.get('object_id')[1]) if hasattr(model, 'message_new'): return True return False | acacf36ebb8dd7f2d736e19cbfc70ed22b867fdc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/acacf36ebb8dd7f2d736e19cbfc70ed22b867fdc/fetchmail.py |
line_obj.write(cr, uid, [line.id], {'bank_statement_line_id': st_line_id}) | line_obj.write(cr, uid, [line.id], {'bank_statement_line_id': st_line_id}) | def populate_statement(self, cr, uid, ids, context=None): line_obj = self.pool.get('payment.line') statement_obj = self.pool.get('account.bank.statement') statement_line_obj = self.pool.get('account.bank.statement.line') currency_obj = self.pool.get('res.currency') voucher_obj = self.pool.get('account.voucher') voucher_line_obj = self.pool.get('account.voucher.line') | 491585cfc27a31741c0fb89535f5b3537733209e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/491585cfc27a31741c0fb89535f5b3537733209e/account_payment_populate_statement.py |
raise except_orm(_('Configuration Error!'), | raise orm.except_orm(_('Configuration Error!'), | def create(self, cr, uid, vals, context={}): try: res = super(account_invoice, self).create(cr, uid, vals, context) return res except Exception,e: if '"journal_id" viol' in e.args[0]: raise except_orm(_('Configuration Error!'), _('There is no Accounting Journal of type Sale/Purchase defined!')) else: raise except_orm(_('UnknownError'), str(e)) | 927cf3adf0e7cd4a6a64a7020c2d8065fcfa849e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/927cf3adf0e7cd4a6a64a7020c2d8065fcfa849e/invoice.py |
raise except_orm(_('UnknownError'), str(e)) | raise orm.except_orm(_('UnknownError'), str(e)) | def create(self, cr, uid, vals, context={}): try: res = super(account_invoice, self).create(cr, uid, vals, context) return res except Exception,e: if '"journal_id" viol' in e.args[0]: raise except_orm(_('Configuration Error!'), _('There is no Accounting Journal of type Sale/Purchase defined!')) else: raise except_orm(_('UnknownError'), str(e)) | 927cf3adf0e7cd4a6a64a7020c2d8065fcfa849e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/927cf3adf0e7cd4a6a64a7020c2d8065fcfa849e/invoice.py |
def move_line_get(self, cr, uid, invoice_id): res = [] cr.execute('SELECT * FROM account_invoice_tax WHERE invoice_id=%s', (invoice_id,)) for t in cr.dictfetchall(): if not t['amount'] \ and not t['tax_code_id'] \ and not t['tax_amount']: continue res.append({ 'type':'tax', 'name':t['name'], 'price_unit': t['amount'], 'quantity': 1, 'price': t['amount'] or 0.0, 'account_id': t['account_id'], 'tax_code_id': t['tax_code_id'], 'tax_amount': t['tax_amount'] }) return res | 927cf3adf0e7cd4a6a64a7020c2d8065fcfa849e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/927cf3adf0e7cd4a6a64a7020c2d8065fcfa849e/invoice.py |
||
'invoice_ids': fields.one2many('account.invoice.line', 'partner_id', 'Invoices'), | 'invoice_ids': fields.one2many('account.invoice.line', 'partner_id', 'Invoices'), | def move_line_get(self, cr, uid, invoice_id): res = [] cr.execute('SELECT * FROM account_invoice_tax WHERE invoice_id=%s', (invoice_id,)) for t in cr.dictfetchall(): if not t['amount'] \ and not t['tax_code_id'] \ and not t['tax_amount']: continue res.append({ 'type':'tax', 'name':t['name'], 'price_unit': t['amount'], 'quantity': 1, 'price': t['amount'] or 0.0, 'account_id': t['account_id'], 'tax_code_id': t['tax_code_id'], 'tax_amount': t['tax_amount'] }) return res | 927cf3adf0e7cd4a6a64a7020c2d8065fcfa849e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/927cf3adf0e7cd4a6a64a7020c2d8065fcfa849e/invoice.py |
if not context: | if context is None: | def button_reset_taxes(self, cr, uid, ids, context=None): if not context: context = {} ait_obj = self.pool.get('account.invoice.tax') for id in ids: cr.execute("DELETE FROM account_invoice_tax WHERE invoice_id=%s", (id,)) partner = self.browse(cr, uid, id, context=context).partner_id if partner.lang: context.update({'lang': partner.lang}) for taxe in ait_obj.compute(cr, uid, id, context=context).values(): ait_obj.create(cr, uid, taxe) # Update the stored value (fields.function), so we write to trigger recompute self.pool.get('account.invoice').write(cr, uid, ids, {'invoice_line':[]}, context=context) return True | 43fe238c96c27d923e41eb6276a02dd700d48ed9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/43fe238c96c27d923e41eb6276a02dd700d48ed9/invoice.py |
partner = self.browse(cr, uid, id, context=context).partner_id | partner = self.browse(cr, uid, id, context=ctx).partner_id | def button_reset_taxes(self, cr, uid, ids, context=None): if not context: context = {} ait_obj = self.pool.get('account.invoice.tax') for id in ids: cr.execute("DELETE FROM account_invoice_tax WHERE invoice_id=%s", (id,)) partner = self.browse(cr, uid, id, context=context).partner_id if partner.lang: context.update({'lang': partner.lang}) for taxe in ait_obj.compute(cr, uid, id, context=context).values(): ait_obj.create(cr, uid, taxe) # Update the stored value (fields.function), so we write to trigger recompute self.pool.get('account.invoice').write(cr, uid, ids, {'invoice_line':[]}, context=context) return True | 43fe238c96c27d923e41eb6276a02dd700d48ed9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/43fe238c96c27d923e41eb6276a02dd700d48ed9/invoice.py |
context.update({'lang': partner.lang}) for taxe in ait_obj.compute(cr, uid, id, context=context).values(): | ctx.update({'lang': partner.lang}) for taxe in ait_obj.compute(cr, uid, id, context=ctx).values(): | def button_reset_taxes(self, cr, uid, ids, context=None): if not context: context = {} ait_obj = self.pool.get('account.invoice.tax') for id in ids: cr.execute("DELETE FROM account_invoice_tax WHERE invoice_id=%s", (id,)) partner = self.browse(cr, uid, id, context=context).partner_id if partner.lang: context.update({'lang': partner.lang}) for taxe in ait_obj.compute(cr, uid, id, context=context).values(): ait_obj.create(cr, uid, taxe) # Update the stored value (fields.function), so we write to trigger recompute self.pool.get('account.invoice').write(cr, uid, ids, {'invoice_line':[]}, context=context) return True | 43fe238c96c27d923e41eb6276a02dd700d48ed9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/43fe238c96c27d923e41eb6276a02dd700d48ed9/invoice.py |
self.pool.get('account.invoice').write(cr, uid, ids, {'invoice_line':[]}, context=context) | self.pool.get('account.invoice').write(cr, uid, ids, {'invoice_line':[]}, context=ctx) | def button_reset_taxes(self, cr, uid, ids, context=None): if not context: context = {} ait_obj = self.pool.get('account.invoice.tax') for id in ids: cr.execute("DELETE FROM account_invoice_tax WHERE invoice_id=%s", (id,)) partner = self.browse(cr, uid, id, context=context).partner_id if partner.lang: context.update({'lang': partner.lang}) for taxe in ait_obj.compute(cr, uid, id, context=context).values(): ait_obj.create(cr, uid, taxe) # Update the stored value (fields.function), so we write to trigger recompute self.pool.get('account.invoice').write(cr, uid, ids, {'invoice_line':[]}, context=context) return True | 43fe238c96c27d923e41eb6276a02dd700d48ed9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/43fe238c96c27d923e41eb6276a02dd700d48ed9/invoice.py |
def _calculate(self, cr, uid, ids, field_names, arg, context): res = {} for rs in self.browse(cr, uid, ids, context): allow = 0.0 deduct = 0.0 others = 0.0 obj = { 'basic':rs.basic } if rs.igross > 0: obj.update({ 'gross':rs.igross }) if rs.inet > 0: obj.update({ 'net':rs.inet }) for line in rs.line_ids: amount = 0.0 if line.amount_type == 'per': try: amount = line.amount * eval(str(line.category_id.base), obj) except Exception, e: raise osv.except_osv(_('Variable Error !'), _('Variable Error : %s ' % (e))) elif line.amount_type in ('fix', 'func'): amount = line.amount | 8a7e4a26173a9e06db8fe443b746014f7b8806d2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/8a7e4a26173a9e06db8fe443b746014f7b8806d2/hr_payroll.py |
||
if slip.move_id: if slip.move_id.state == 'posted': move_pool.button_cancel(cr, uid [slip.move_id.id], context) move_pool.unlink(cr, uid, [slip.move_id.id]) if slip.adj_move_id: if slip.adj_move_id.state == 'posted': move_pool.button_cancel(cr, uid [slip.adj_move_id.id], context) move_pool.unlink(cr, uid, [slip.adj_move_id.id]) if slip.other_move_id: if slip.other_move_id.state == 'posted': move_pool.button_cancel(cr, uid [slip.other_move_id.id], context) move_pool.unlink(cr, uid, [slip.other_move_id.id]) | for line in slip.move_ids: if slip.move_id: if slip.move_id.state == 'posted': move_pool.button_cancel(cr, uid [slip.move_id.id], context) move_pool.unlink(cr, uid, [slip.move_id.id]) | def cancel_sheet(self, cr, uid, ids, context={}): move_pool = self.pool.get('account.move') | 8a7e4a26173a9e06db8fe443b746014f7b8806d2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/8a7e4a26173a9e06db8fe443b746014f7b8806d2/hr_payroll.py |
contract = cr.dictfetchone() | contract = cr.dictfetchone() contract = contract and contract or {} | def get_contract(self, cr, uid, employee, date, context={}): sql_req= ''' SELECT c.id as id, c.wage as wage, struct_id as function FROM hr_contract c LEFT JOIN hr_employee emp on (c.employee_id=emp.id) LEFT JOIN hr_contract_wage_type cwt on (cwt.id = c.wage_type_id) LEFT JOIN hr_contract_wage_type_period p on (cwt.period_id = p.id) WHERE (emp.id=%s) AND (date_start <= %s) AND (date_end IS NULL OR date_end >= %s) LIMIT 1 ''' cr.execute(sql_req, (employee.id, date, date)) contract = cr.dictfetchone() return contract | 8a7e4a26173a9e06db8fe443b746014f7b8806d2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/8a7e4a26173a9e06db8fe443b746014f7b8806d2/hr_payroll.py |
def get_days(start, end, month, year, calc_day): count = 0 import datetime for day in range(start, end): if datetime.date(year, month, day).weekday() == calc_day: count += 1 return count | 8a7e4a26173a9e06db8fe443b746014f7b8806d2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/8a7e4a26173a9e06db8fe443b746014f7b8806d2/hr_payroll.py |
||
basic_before_leaves = basic | if not slip.contract_id : continue basic_before_leaves = slip.basic | def get_days(start, end, month, year, calc_day): count = 0 import datetime for day in range(start, end): if datetime.date(year, month, day).weekday() == calc_day: count += 1 return count | 8a7e4a26173a9e06db8fe443b746014f7b8806d2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/8a7e4a26173a9e06db8fe443b746014f7b8806d2/hr_payroll.py |
def get_days(start, end, month, year, calc_day): count = 0 import datetime for day in range(start, end): if datetime.date(year, month, day).weekday() == calc_day: count += 1 return count | 8a7e4a26173a9e06db8fe443b746014f7b8806d2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/8a7e4a26173a9e06db8fe443b746014f7b8806d2/hr_payroll.py |
||
)""", (line.planning_id.id,line.account_id.id )) | )""", (line.planning_id.id, line.account_id and line.account_id.id or None)) | def _get_tasks(self, cr, uid, ids, name, args, context=None): if context is None: context = {} users_obj = self.pool.get('res.users') result = {} tm = users_obj.browse(cr, uid, uid, context).company_id.project_time_mode_id if tm and tm.factor: div = tm.factor else: div = 1.0 tm2 = users_obj.browse(cr, uid, uid, context).company_id.planning_time_mode_id if tm2 and tm2.factor: div2 = tm2.factor else: div2 = 1.0 for line in self.browse(cr, uid, ids, context): cr.execute(""" SELECT COALESCE(sum(tasks.remaining_hours),0) FROM project_task tasks WHERE tasks.planning_line_id IN ( SELECT id FROM report_account_analytic_planning_line WHERE planning_id = %s AND account_id=%s )""", (line.planning_id.id,line.account_id.id )) result[line.id] = cr.fetchall()[0][0] / div * div2 return result | fda32c5f786ffde71cd82e10185db593657aad7f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/fda32c5f786ffde71cd82e10185db593657aad7f/project_planning.py |
WHERE acc.date>=%s and acc.date<=%s and acc.account_id=%s""", (line.planning_id.date_from, line.planning_id.date_to, line.account_id.id, )) | WHERE acc.date>=%s and acc.date<=%s and acc.account_id=%s""", (line.planning_id.date_from, line.planning_id.date_to, line.account_id and line.account_id.id or None)) | def _get_timesheets(self, cr, uid, ids, name, args, context=None): if context is None: context = {} users_obj = self.pool.get('res.users') result = {} tm2 = users_obj.browse(cr, uid, uid, context).company_id.planning_time_mode_id if tm2 and tm2.factor: div2 = tm2.factor else: div2 = 1.0 for line in self.browse(cr, uid, ids, context): cr.execute(""" SELECT SUM(unit_amount/uom.factor) FROM account_analytic_line acc LEFT JOIN product_uom uom ON (uom.id = acc.product_uom_id) WHERE acc.date>=%s and acc.date<=%s and acc.account_id=%s""", (line.planning_id.date_from, line.planning_id.date_to, line.account_id.id, )) res = cr.fetchall()[0][0] if res: result[line.id] = res * div2 else: result[line.id] = 0 return result | fda32c5f786ffde71cd82e10185db593657aad7f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/fda32c5f786ffde71cd82e10185db593657aad7f/project_planning.py |
WHERE user_id=%s and account_id=%s and date>=%s and date<=%s''', (line.user_id.id, line.account_id.id, line.planning_id.date_from, line.planning_id.date_to)) | WHERE user_id=%s and account_id=%s and date>=%s and date<=%s''', (line.user_id.id, line.account_id and line.account_id.id or None, line.planning_id.date_from, line.planning_id.date_to)) | def _sum_amount_real(self, cr, uid, ids, name, args, context=None): if context is None: context = {} users_obj = self.pool.get('res.users') result = {} tm2 = users_obj.browse(cr, uid, uid, context).company_id.planning_time_mode_id if tm2 and tm2.factor: div2 = tm2.factor else: div2 = 1.0 for line in self.browse(cr, uid, ids, context): if line.user_id: cr.execute('''SELECT sum(acc.unit_amount/uom.factor) FROM account_analytic_line acc LEFT JOIN product_uom uom ON (uom.id = acc.product_uom_id) | fda32c5f786ffde71cd82e10185db593657aad7f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/fda32c5f786ffde71cd82e10185db593657aad7f/project_planning.py |
cr.execute('SELECT sum(unit_amount) FROM account_analytic_line WHERE account_id=%s AND date>=%s AND date<=%s', (line.account_id.id, line.planning_id.date_from, line.planning_id.date_to)) | cr.execute('SELECT sum(unit_amount) FROM account_analytic_line WHERE account_id=%s AND date>=%s AND date<=%s', (line.account_id and line.account_id.id or None, line.planning_id.date_from, line.planning_id.date_to)) | def _sum_amount_real(self, cr, uid, ids, name, args, context=None): if context is None: context = {} users_obj = self.pool.get('res.users') result = {} tm2 = users_obj.browse(cr, uid, uid, context).company_id.planning_time_mode_id if tm2 and tm2.factor: div2 = tm2.factor else: div2 = 1.0 for line in self.browse(cr, uid, ids, context): if line.user_id: cr.execute('''SELECT sum(acc.unit_amount/uom.factor) FROM account_analytic_line acc LEFT JOIN product_uom uom ON (uom.id = acc.product_uom_id) | fda32c5f786ffde71cd82e10185db593657aad7f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/fda32c5f786ffde71cd82e10185db593657aad7f/project_planning.py |
line.account_id.id, | line.account_id and line.account_id.id or None, | def _sum_amount_tasks(self, cr, uid, ids, name, args, context=None): if context is None: context = {} users_obj = self.pool.get('res.users') result = {} tm = users_obj.browse(cr, uid, uid, context).company_id.project_time_mode_id if tm and tm.factor: div = tm.factor else: div = 1.0 tm2 = users_obj.browse(cr, uid, uid, context).company_id.planning_time_mode_id if tm2 and tm2.factor: div2 = tm2.factor else: div2 = 1.0 for line in self.browse(cr, uid, ids, context): where = '' if line.user_id: where = 'user_id=' + str(line.user_id.id) + ' and ' cr.execute('''select sum(planned_hours) FROM project_task WHERE ''' + where + ''' project_id IN (select id from project_project where analytic_account_id=%s) AND date_end>=%s AND date_end<=%s''', ( line.account_id.id, line.planning_id.date_from, line.planning_id.date_to) ) sum = cr.fetchone() if sum and sum[0]: result[line.id] = sum[0] /div * div2 return result | fda32c5f786ffde71cd82e10185db593657aad7f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/fda32c5f786ffde71cd82e10185db593657aad7f/project_planning.py |
def set_to_zero(self, cr, uid, ids, context): | f3684e927475478f03a42684b9389b8c44a4e70a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/f3684e927475478f03a42684b9389b8c44a4e70a/lunch_cashbox_clean.py |
||
def set_to_zero(self, cr, uid, ids, context): | f3684e927475478f03a42684b9389b8c44a4e70a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/f3684e927475478f03a42684b9389b8c44a4e70a/lunch_cashbox_clean.py |
||
for (user_id, box_id, amount) in res: cashmove_ref.create(cr, uid, { 'name': 'Summary for user' + str(user_id), 'amount': amount, 'user_cashmove': user_id, 'box': box_id, 'active': True, }) | def set_to_zero(self, cr, uid, ids, context): | f3684e927475478f03a42684b9389b8c44a4e70a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/f3684e927475478f03a42684b9389b8c44a4e70a/lunch_cashbox_clean.py |
|
self.write(cr,uid,ids,{'amount':total}) self.write(cr, uid, ids, {'state':'proforma'}) | if total!=0: self.write(cr,uid,ids,{'amount':total}) self.write(cr, uid, ids, {'state':'proforma'}) else: raise osv.except_osv('Invalid action !', 'You can not post to Pro-Forma a voucher with Total amount = 0') | def open_voucher(self, cr, uid, ids, context={}): obj=self.pool.get('account.voucher').browse(cr,uid,ids) total=0 for i in obj[0].payment_ids: total+=i.amount self.write(cr,uid,ids,{'amount':total}) self.write(cr, uid, ids, {'state':'proforma'}) return True | 601ae1d14c923398d2a625dc45d4eb65d7b29865 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/601ae1d14c923398d2a625dc45d4eb65d7b29865/voucher.py |
raise osv.except_osv('Invalid action !', 'Cannot delete invoice(s) which are already opened or paid !') | raise osv.except_osv('Invalid action !', 'Cannot delete Voucher(s) which are already opened or paid !') | def unlink(self, cr, uid, ids, context={}): vouchers = self.read(cr, uid, ids, ['state']) unlink_ids = [] for t in vouchers: if t['state'] in ('draft', 'cancel'): unlink_ids.append(t['id']) else: raise osv.except_osv('Invalid action !', 'Cannot delete invoice(s) which are already opened or paid !') osv.osv.unlink(self, cr, uid, unlink_ids) return True | 601ae1d14c923398d2a625dc45d4eb65d7b29865 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/601ae1d14c923398d2a625dc45d4eb65d7b29865/voucher.py |
return 'l10n_ch', 'action_account_dtr_create_values' | return 'l10n_ch', 'action_dta_create' | def get_wizard(self,mode): if mode == 'dta': return 'l10n_ch', 'action_account_dtr_create_values' | d508dfc24919d93f75c9d3ffb0487a6813cdb004 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/d508dfc24919d93f75c9d3ffb0487a6813cdb004/payment.py |
'domain': [('res_id','in',ids),('res_model','=',self._name)], | 'domain': [('res_id','=',message_pool.res_id),('res_model','=',message_pool.model)], | def open_attachment(self, cr, uid, ids, context): """ To Open attachments @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param ids: the ID of messages @param context: A standard dictionary """ action_data = False action_pool = self.pool.get('ir.actions.act_window') action_ids = action_pool.search(cr, uid, [('res_model', '=', 'ir.attachment')]) if action_ids: action_data = action_pool.read(cr, uid, action_ids[0], context=context) action_data.update({ 'domain': [('res_id','in',ids),('res_model','=',self._name)], 'nodestroy': True }) return action_data | 2195f5d9ca68c50d5fe0818a8509d93599489460 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/2195f5d9ca68c50d5fe0818a8509d93599489460/mail_gateway.py |
case = pool.get('crm.case').browse(cr,uid,data['ids'])[0] | case = pool.get('crm.lead').browse(cr, uid, data['id']) | def _get_info(self, cr, uid, data, context): if not data['id']: return {} pool = pooler.get_pool(cr.dbname) case = pool.get('crm.case').browse(cr,uid,data['ids'])[0] #if not case.email_from: # raise wizard.except_wizard(_('Error'),_('You must put a Partner eMail to use this action!')) if not case.user_id: raise wizard.except_wizard(_('Error'),_('You must define a responsible user for this case in order to use this action!')) return {'to': case.email_from,'subject': case.name,'cc': case.email_cc or ''} | 2f352b933502c5136777c1f2d8a6724eb94b9b5a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/2f352b933502c5136777c1f2d8a6724eb94b9b5a/wizard_crm_new_send_email.py |
return {'to': case.email_from,'subject': case.name,'cc': case.email_cc or ''} | return { 'to': case.email_from, 'subject': case.name, 'cc': case.email_cc or '' } | def _get_info(self, cr, uid, data, context): if not data['id']: return {} pool = pooler.get_pool(cr.dbname) case = pool.get('crm.case').browse(cr,uid,data['ids'])[0] #if not case.email_from: # raise wizard.except_wizard(_('Error'),_('You must put a Partner eMail to use this action!')) if not case.user_id: raise wizard.except_wizard(_('Error'),_('You must define a responsible user for this case in order to use this action!')) return {'to': case.email_from,'subject': case.name,'cc': case.email_cc or ''} | 2f352b933502c5136777c1f2d8a6724eb94b9b5a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/2f352b933502c5136777c1f2d8a6724eb94b9b5a/wizard_crm_new_send_email.py |
return _('The IBAN does not seems to be correct. You should have entered something like this %s'), (iban_example) | return _('The IBAN does not seem to be correct. You should have entered something like this %s'), (iban_example) | def default_iban_check(iban_cn): return iban_cn[0] in string.ascii_lowercase and iban_cn[1] in string.ascii_lowercase | 0c41f86c9ba2ce577d533d3b1d538f07f126edf7 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/0c41f86c9ba2ce577d533d3b1d538f07f126edf7/base_iban.py |
src_trans = self.pool.get(self._name).read(cr,user,ids,[f]) self.pool.get('ir.translation')._set_ids(cr, user, self._name+','+f, 'model', context['lang'], ids, vals[f], src_trans[0][f]) | src_trans = self.pool.get(self._name).read(cr,user,ids,[f])[0][f] if not src_trans: src_trans = vals[f] self.write(cr, user, ids, {f:vals[f]}) self.pool.get('ir.translation')._set_ids(cr, user, self._name+','+f, 'model', context['lang'], ids, vals[f], src_trans) | def write(self, cr, user, ids, vals, context=None): readonly = None for field in vals.copy(): fobj = None if field in self._columns: fobj = self._columns[field] else: fobj = self._inherit_fields[field][2] if not fobj: continue groups = fobj.write | b4867291bbdf2e2b59629889706f2f361b26b4f1 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/b4867291bbdf2e2b59629889706f2f361b26b4f1/orm.py |
if context.get('period_from', False) and context.get('periof_from', False) and not context.get('periods', False): | if context.get('period_from', False) and context.get('period_to', False) and not context.get('periods', False): | def _query_get(self, cr, uid, obj='l', context={}): fiscalyear_obj = self.pool.get('account.fiscalyear') fiscalperiod_obj = self.pool.get('account.period') fiscalyear_ids = [] fiscalperiod_ids = [] initial_bal = context.get('initial_bal', False) company_clause = "" if context.get('company_id', False): company_clause = " AND " +obj+".company_id = %s" % context.get('company_id', False) if not context.get('fiscalyear', False): fiscalyear_ids = fiscalyear_obj.search(cr, uid, [('state', '=', 'draft')]) else: if initial_bal: fiscalyear_date_start = fiscalyear_obj.read(cr, uid, context['fiscalyear'], ['date_start'])['date_start'] fiscalyear_ids = fiscalyear_obj.search(cr, uid, [('date_stop', '<', fiscalyear_date_start), ('state', '=', 'draft')], context=context) else: fiscalyear_ids = [context['fiscalyear']] | 819ee1b9a112f0d6ae56179ab1845989fd5baf54 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/819ee1b9a112f0d6ae56179ab1845989fd5baf54/account_move_line.py |
period_company_id = period_obj.browse(cr, uid, data['form']['period_from'], context=context).company_id.id first_period = self.pool.get('account.period').search(cr, uid, [('company_id', '=', period_company_id)], order='date_start', limit=1)[0] context['periods'] = period_obj.build_ctx_periods(cr, uid, first_period, data['form']['period_from']) else: context['periods'] = period_obj.build_ctx_periods(cr, uid, data['form']['period_from'], data['form']['period_to']) | period_company_id = fiscalperiod_obj.browse(cr, uid, context['period_from'], context=context).company_id.id first_period = fiscalperiod_obj.search(cr, uid, [('company_id', '=', period_company_id)], order='date_start', limit=1)[0] context['periods'] = fiscalperiod_obj.build_ctx_periods(cr, uid, first_period, context['period_from']) else: context['periods'] = fiscalperiod_obj.build_ctx_periods(cr, uid, context['period_from'], context['period_to']) | def _query_get(self, cr, uid, obj='l', context={}): fiscalyear_obj = self.pool.get('account.fiscalyear') fiscalperiod_obj = self.pool.get('account.period') fiscalyear_ids = [] fiscalperiod_ids = [] initial_bal = context.get('initial_bal', False) company_clause = "" if context.get('company_id', False): company_clause = " AND " +obj+".company_id = %s" % context.get('company_id', False) if not context.get('fiscalyear', False): fiscalyear_ids = fiscalyear_obj.search(cr, uid, [('state', '=', 'draft')]) else: if initial_bal: fiscalyear_date_start = fiscalyear_obj.read(cr, uid, context['fiscalyear'], ['date_start'])['date_start'] fiscalyear_ids = fiscalyear_obj.search(cr, uid, [('date_stop', '<', fiscalyear_date_start), ('state', '=', 'draft')], context=context) else: fiscalyear_ids = [context['fiscalyear']] | 819ee1b9a112f0d6ae56179ab1845989fd5baf54 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/819ee1b9a112f0d6ae56179ab1845989fd5baf54/account_move_line.py |
fld.append((field.field, field.sequence)) | fld.append((field.field, field.sequence, field.name)) | def fields_view_get(self, cr, uid, view_id=None, view_type='form', context={}, toolbar=False, submenu=False): journal_pool = self.pool.get('account.journal') | 68d68134dadd580d950c241903ac4683faaa99b3 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/68d68134dadd580d950c241903ac4683faaa99b3/account_move_line.py |
fld.append(('period_id', 3)) fld.append(('journal_id', 10)) | fld.append(('period_id', 3, 'Period')) fld.append(('journal_id', 10, 'Journal')) | def fields_view_get(self, cr, uid, view_id=None, view_type='form', context={}, toolbar=False, submenu=False): journal_pool = self.pool.get('account.journal') | 68d68134dadd580d950c241903ac4683faaa99b3 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/68d68134dadd580d950c241903ac4683faaa99b3/account_move_line.py |
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context={}, toolbar=False, submenu=False): journal_pool = self.pool.get('account.journal') | 68d68134dadd580d950c241903ac4683faaa99b3 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/68d68134dadd580d950c241903ac4683faaa99b3/account_move_line.py |
||
attrs.append('string="'+field_it[2]+'"') | def fields_view_get(self, cr, uid, view_id=None, view_type='form', context={}, toolbar=False, submenu=False): journal_pool = self.pool.get('account.journal') | 68d68134dadd580d950c241903ac4683faaa99b3 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/68d68134dadd580d950c241903ac4683faaa99b3/account_move_line.py |
|
def __init__(self, obj, fields_id, string='unknown', limit=20, **args): | def __init__(self, obj, fields_id, string='unknown', limit=None, **args): | def __init__(self, obj, fields_id, string='unknown', limit=20, **args): args.update({'parent_field':fields_id}) _column.__init__(self, string=string, **args) self._obj = obj self._fields_id = fields_id self._limit = limit #one2many can't be used as condition for defaults assert(self.change_default != True) | 85bc0eea767b825c257b1afe08c05fd21c38ccee /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/85bc0eea767b825c257b1afe08c05fd21c38ccee/fields.py |
'company_id': fields.related('partner_id','company_id',type='many2one',relation='res.company',string='Company', store=True), | 'company_id': fields.many2one('res.company', 'Company',select=1), | def view_header_get(self, cr, uid, view_id, view_type, context): res = super(res_partner, self).view_header_get(cr, uid, view_id, view_type, context) if res: return res if (not context.get('category_id', False)): return False return _('Partners: ')+self.pool.get('res.partner.category').browse(cr, uid, context['category_id'], context).name | e685967a93096bcb1c286925875c39b579ea17e9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/e685967a93096bcb1c286925875c39b579ea17e9/partner.py |
def _check_reference_type(self, cursor, user, ids): """Check the customer invoice reference type depending on the BVR reference type and the invoice partner bank type""" for invoice in self.browse(cursor, user, ids): if invoice.type in 'in_invoice': if invoice.partner_bank and \ invoice.partner_bank.state in \ ('bvrbank', 'bvrpost') and \ invoice.reference_type != 'bvr': return False return True | f10bd47d01713067247619964a8c79575ed8d326 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/f10bd47d01713067247619964a8c79575ed8d326/invoice.py |
||
date_invoice=False, payment_term=False, partner_bank_id=False): | date_invoice=False, payment_term=False, partner_bank_id=False, company_id=False): | def onchange_partner_id(self, cr, uid, ids, type, partner_id, date_invoice=False, payment_term=False, partner_bank_id=False): """ Function that is call when the partner of the invoice is changed it will retriev and set the good bank partner bank""" res = super(account_invoice, self).onchange_partner_id( cr, uid, ids, type, partner_id, date_invoice, payment_term ) bank_id = False if partner_id: p = self.pool.get('res.partner').browse(cr, uid, partner_id) if p.bank_ids: bank_id = p.bank_ids[0].id | f10bd47d01713067247619964a8c79575ed8d326 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/f10bd47d01713067247619964a8c79575ed8d326/invoice.py |
def create(self, cr, uid, vals, context={}): if 'inherit_id' in vals and vals['inherit_id']: obj=self.browse(cr,uid,vals['inherit_id']) child=self.pool.get(vals['model']) error="Inherited view model [%s] and \ \n\n base view model [%s] do not match \ \n\n It should be same as base view model " \ %(vals['model'],obj.model) try: if obj.model==child._inherit: pass except: if not obj.model==vals['model']: raise Exception(error) return super(view,self).create(cr, uid, vals, context={}) | def _check_xml(self, cr, uid, ids, context={}): for view in self.browse(cr, uid, ids, context): eview = etree.fromstring(view.arch.encode('utf8')) frng = tools.file_open(os.path.join('base','rng','view.rng')) relaxng_doc = etree.parse(frng) relaxng = etree.RelaxNG(relaxng_doc) if not relaxng.validate(eview): logger = netsvc.Logger() logger.notifyChannel('init', netsvc.LOG_ERROR, 'The view does not fit the required schema !') logger.notifyChannel('init', netsvc.LOG_ERROR, tools.ustr(relaxng.error_log.last_error)) return False return True | 1090285591262f274241a24bb69415ae8c8d4a81 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/1090285591262f274241a24bb69415ae8c8d4a81/ir_ui_view.py |
|
qty=0, uom=uom, qty_uos=qty_uos, uos=uos, name=name, | qty=qty, uom=uom, qty_uos=qty_uos, uos=uos, name=name, | def product_uom_change(self, cursor, user, ids, pricelist, product, qty=0, uom=False, qty_uos=0, uos=False, name='', partner_id=False, lang=False, update_tax=True, date_order=False): res = self.product_id_change(cursor, user, ids, pricelist, product, qty=0, uom=uom, qty_uos=qty_uos, uos=uos, name=name, partner_id=partner_id, lang=lang, update_tax=update_tax, date_order=date_order) if 'product_uom' in res['value']: del res['value']['product_uom'] if not uom: res['value']['price_unit'] = 0.0 return res | 5151509d4e370bba9254b1185b6cd6acd434b283 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/5151509d4e370bba9254b1185b6cd6acd434b283/sale.py |
price = line.price_unit * line.product_uom_qty * (1 - (line.discount or 0.0) / 100.0) taxes = tax_obj.compute_all(cr, uid, line.tax_id, line.price_unit, line.product_uom_qty) | price = line.price_unit * (1 - (line.discount or 0.0) / 100.0) taxes = tax_obj.compute_all(cr, uid, line.tax_id, price, line.product_uom_qty, line.order_id.partner_invoice_id.id, line.product_id, line.order_id.partner_id) | def _amount_line(self, cr, uid, ids, field_name, arg, context=None): tax_obj = self.pool.get('account.tax') cur_obj = self.pool.get('res.currency') res = {} context = context or {} for line in self.browse(cr, uid, ids, context=context): price = line.price_unit * line.product_uom_qty * (1 - (line.discount or 0.0) / 100.0) taxes = tax_obj.compute_all(cr, uid, line.tax_id, line.price_unit, line.product_uom_qty) cur = line.order_id.pricelist_id.currency_id res[line.id] = cur_obj.round(cr, uid, cur, taxes['total']) return res | c8e3e6b5bd58a31fba0c786d16353d87ed81033d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c8e3e6b5bd58a31fba0c786d16353d87ed81033d/sale.py |
ds = ds + RelativeDateTime(days=interval) + 1 | new_id = period_obj.create(cr, uid, { 'name': new_name, 'date_start': ds.strftime('%Y-%m-%d'), 'date_stop': de.strftime('%Y-%m-%d %H:%M:%S'), }) ds = ds + RelativeDateTime(days=interval) | def create_stock_periods(self, cr, uid, ids, context=None): interval = context.get('interval',0) name = context.get('name','Daily') period_obj = self.pool.get('stock.period') lines = [] for p in self.browse(cr, uid, ids, context=context): dt = p.date_start ds = mx.DateTime.strptime(p.date_start, '%Y-%m-%d') while ds.strftime('%Y-%m-%d') < p.date_stop: if name =='Daily': de = ds + RelativeDateTime(days=interval, minutes =-1) new_name = de.strftime('%Y-%m-%d') ds = ds + RelativeDateTime(days=interval) + 1 if name =="Weekly": de = ds + RelativeDateTime(days=interval, minutes =-1) new_name = de.strftime('%Y, week %W') ds = ds + RelativeDateTime(days=interval) + 1 if name == "Monthly": de = ds + RelativeDateTime(months=interval, minutes=-1) new_name = ds.strftime('%Y/%m') ds = ds + RelativeDateTime(months=interval) lines.append(period_obj.create(cr, uid, { 'name': new_name, 'date_start': ds.strftime('%Y-%m-%d'), 'date_stop': de.strftime('%Y-%m-%d %H:%M:%S'), })) return { 'domain': "[('id','in', ["+','.join(map(str, lines))+"])]", 'view_type': 'form', "view_mode": 'tree, form', 'res_model': 'stock.period', 'type': 'ir.actions.act_window', } | ab1e7c45717697130ab37a95290ed38baf1db642 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/ab1e7c45717697130ab37a95290ed38baf1db642/stock_planning_create_periods.py |
ds = ds + RelativeDateTime(days=interval) + 1 | new_id = period_obj.create(cr, uid, { 'name': new_name, 'date_start': ds.strftime('%Y-%m-%d'), 'date_stop': de.strftime('%Y-%m-%d %H:%M:%S'), }) ds = ds + RelativeDateTime(days=interval) | def create_stock_periods(self, cr, uid, ids, context=None): interval = context.get('interval',0) name = context.get('name','Daily') period_obj = self.pool.get('stock.period') lines = [] for p in self.browse(cr, uid, ids, context=context): dt = p.date_start ds = mx.DateTime.strptime(p.date_start, '%Y-%m-%d') while ds.strftime('%Y-%m-%d') < p.date_stop: if name =='Daily': de = ds + RelativeDateTime(days=interval, minutes =-1) new_name = de.strftime('%Y-%m-%d') ds = ds + RelativeDateTime(days=interval) + 1 if name =="Weekly": de = ds + RelativeDateTime(days=interval, minutes =-1) new_name = de.strftime('%Y, week %W') ds = ds + RelativeDateTime(days=interval) + 1 if name == "Monthly": de = ds + RelativeDateTime(months=interval, minutes=-1) new_name = ds.strftime('%Y/%m') ds = ds + RelativeDateTime(months=interval) lines.append(period_obj.create(cr, uid, { 'name': new_name, 'date_start': ds.strftime('%Y-%m-%d'), 'date_stop': de.strftime('%Y-%m-%d %H:%M:%S'), })) return { 'domain': "[('id','in', ["+','.join(map(str, lines))+"])]", 'view_type': 'form', "view_mode": 'tree, form', 'res_model': 'stock.period', 'type': 'ir.actions.act_window', } | ab1e7c45717697130ab37a95290ed38baf1db642 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/ab1e7c45717697130ab37a95290ed38baf1db642/stock_planning_create_periods.py |
ds = ds + RelativeDateTime(months=interval) lines.append(period_obj.create(cr, uid, { | new_id =period_obj.create(cr, uid, { | def create_stock_periods(self, cr, uid, ids, context=None): interval = context.get('interval',0) name = context.get('name','Daily') period_obj = self.pool.get('stock.period') lines = [] for p in self.browse(cr, uid, ids, context=context): dt = p.date_start ds = mx.DateTime.strptime(p.date_start, '%Y-%m-%d') while ds.strftime('%Y-%m-%d') < p.date_stop: if name =='Daily': de = ds + RelativeDateTime(days=interval, minutes =-1) new_name = de.strftime('%Y-%m-%d') ds = ds + RelativeDateTime(days=interval) + 1 if name =="Weekly": de = ds + RelativeDateTime(days=interval, minutes =-1) new_name = de.strftime('%Y, week %W') ds = ds + RelativeDateTime(days=interval) + 1 if name == "Monthly": de = ds + RelativeDateTime(months=interval, minutes=-1) new_name = ds.strftime('%Y/%m') ds = ds + RelativeDateTime(months=interval) lines.append(period_obj.create(cr, uid, { 'name': new_name, 'date_start': ds.strftime('%Y-%m-%d'), 'date_stop': de.strftime('%Y-%m-%d %H:%M:%S'), })) return { 'domain': "[('id','in', ["+','.join(map(str, lines))+"])]", 'view_type': 'form', "view_mode": 'tree, form', 'res_model': 'stock.period', 'type': 'ir.actions.act_window', } | ab1e7c45717697130ab37a95290ed38baf1db642 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/ab1e7c45717697130ab37a95290ed38baf1db642/stock_planning_create_periods.py |
})) | }) ds = ds + RelativeDateTime(months=interval) lines.append(new_id) | def create_stock_periods(self, cr, uid, ids, context=None): interval = context.get('interval',0) name = context.get('name','Daily') period_obj = self.pool.get('stock.period') lines = [] for p in self.browse(cr, uid, ids, context=context): dt = p.date_start ds = mx.DateTime.strptime(p.date_start, '%Y-%m-%d') while ds.strftime('%Y-%m-%d') < p.date_stop: if name =='Daily': de = ds + RelativeDateTime(days=interval, minutes =-1) new_name = de.strftime('%Y-%m-%d') ds = ds + RelativeDateTime(days=interval) + 1 if name =="Weekly": de = ds + RelativeDateTime(days=interval, minutes =-1) new_name = de.strftime('%Y, week %W') ds = ds + RelativeDateTime(days=interval) + 1 if name == "Monthly": de = ds + RelativeDateTime(months=interval, minutes=-1) new_name = ds.strftime('%Y/%m') ds = ds + RelativeDateTime(months=interval) lines.append(period_obj.create(cr, uid, { 'name': new_name, 'date_start': ds.strftime('%Y-%m-%d'), 'date_stop': de.strftime('%Y-%m-%d %H:%M:%S'), })) return { 'domain': "[('id','in', ["+','.join(map(str, lines))+"])]", 'view_type': 'form', "view_mode": 'tree, form', 'res_model': 'stock.period', 'type': 'ir.actions.act_window', } | ab1e7c45717697130ab37a95290ed38baf1db642 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/ab1e7c45717697130ab37a95290ed38baf1db642/stock_planning_create_periods.py |
if total_new>0: | if total_new > 0: | def _default_get(self, cr, uid, fields, context={}): # Compute simple values data = super(account_move_line, self).default_get(cr, uid, fields, context) # Starts: Manual entry from account.move form if context.get('lines',[]): | 639fe80b9dd35657a9352ad7a8a008ea10dc2a93 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/639fe80b9dd35657a9352ad7a8a008ea10dc2a93/account_move_line.py |
if total_new>0: | if total_new > 0: | def _default_get(self, cr, uid, fields, context={}): # Compute simple values data = super(account_move_line, self).default_get(cr, uid, fields, context) # Starts: Manual entry from account.move form if context.get('lines',[]): | 639fe80b9dd35657a9352ad7a8a008ea10dc2a93 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/639fe80b9dd35657a9352ad7a8a008ea10dc2a93/account_move_line.py |
def _default_get(self, cr, uid, fields, context={}): # Compute simple values data = super(account_move_line, self).default_get(cr, uid, fields, context) # Starts: Manual entry from account.move form if context.get('lines',[]): | 639fe80b9dd35657a9352ad7a8a008ea10dc2a93 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/639fe80b9dd35657a9352ad7a8a008ea10dc2a93/account_move_line.py |
||
if jt == 'sale': | if jt in ('sale', 'purchase_refund'): | def onchange_partner_id(self, cr, uid, ids, move_id, partner_id, account_id=None, debit=0, credit=0, date=False, journal=False): val = {} val['date_maturity'] = False | 639fe80b9dd35657a9352ad7a8a008ea10dc2a93 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/639fe80b9dd35657a9352ad7a8a008ea10dc2a93/account_move_line.py |
elif jt == 'purchase': | elif jt in ('purchase', 'sale_refund', 'expense'): | def onchange_partner_id(self, cr, uid, ids, move_id, partner_id, account_id=None, debit=0, credit=0, date=False, journal=False): val = {} val['date_maturity'] = False | 639fe80b9dd35657a9352ad7a8a008ea10dc2a93 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/639fe80b9dd35657a9352ad7a8a008ea10dc2a93/account_move_line.py |
def onchange_partner_id(self, cr, uid, ids, move_id, partner_id, account_id=None, debit=0, credit=0, date=False, journal=False): val = {} val['date_maturity'] = False | 639fe80b9dd35657a9352ad7a8a008ea10dc2a93 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/639fe80b9dd35657a9352ad7a8a008ea10dc2a93/account_move_line.py |
||
if field in ('amount_currency','currency_id'): | elif field == 'statement_id': attrs.append("domain=\"[('state','!=','confirm'),('journal_id.type','=','bank')]\"") if field in ('amount_currency', 'currency_id'): | def fields_view_get(self, cr, uid, view_id=None, view_type='form', context={}, toolbar=False, submenu=False): result = super(osv.osv, self).fields_view_get(cr, uid, view_id,view_type,context,toolbar=toolbar, submenu=submenu) if view_type != 'tree': return result | 639fe80b9dd35657a9352ad7a8a008ea10dc2a93 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/639fe80b9dd35657a9352ad7a8a008ea10dc2a93/account_move_line.py |
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context={}, toolbar=False, submenu=False): result = super(osv.osv, self).fields_view_get(cr, uid, view_id,view_type,context,toolbar=toolbar, submenu=submenu) if view_type != 'tree': return result | 639fe80b9dd35657a9352ad7a8a008ea10dc2a93 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/639fe80b9dd35657a9352ad7a8a008ea10dc2a93/account_move_line.py |
||
'user' : self.pool.get('res.users').browse(cr, uid, uid, context=context) | 'user' : self.pool.get('res.users').browse(cr, uid, uid, context=context), | def do_action(self, cr, uid, action, model_obj, obj, context=None): """ Do Action @param self: The object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param action: pass action @param model_obj: pass Model object @param context: A standard dictionary for contextual values """ if context is None: context = {} | e3f3d97414351fea7a0a2212470eceb67ae4a7e8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/e3f3d97414351fea7a0a2212470eceb67ae4a7e8/base_action_rule.py |
return [(x['id'], tools.ustr(x['name']) + ' (' + tools.ustr(x['symbol']) + ')') for x in reads] | return [(x['id'], tools.ustr(x['name']) + (x['symbol'] and (' (' + tools.ustr(x['symbol']) + ')') or '')) for x in reads] | def name_get(self, cr, uid, ids, context=None): if context is None: context = {} | 8aaf1f2bdc2be08cb276b5ba2f89a41a46e92e5e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/8aaf1f2bdc2be08cb276b5ba2f89a41a46e92e5e/todo.py |
""" | """ | def default_get(self, cr, uid, fields, context): """ To get default values for the object. @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param fields: List of fields for which we want default values @param context: A standard dictionary @return: A dictionary which of fields with values. """ res = super(stock_return_picking, self).default_get(cr, uid, fields, context=context) record_id = context and context.get('active_id', False) or False pick_obj = self.pool.get('stock.picking') pick = pick_obj.browse(cr, uid, record_id) for m in [line for line in pick.move_lines]: res['return%s'%(m.id)] = m.product_qty if pick.invoice_state=='invoiced': res['invoice_state'] = '2binvoiced' else: res['invoice_state'] = 'none' return res | 3b5e198d6fca4e6934ff87ac875ee8b30300e487 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/3b5e198d6fca4e6934ff87ac875ee8b30300e487/stock_return_picking.py |
@param fields: List of fields for which we want default values @param context: A standard dictionary @return: A dictionary which of fields with values. """ | @param fields: List of fields for which we want default values @param context: A standard dictionary @return: A dictionary with default values for all field in ``fields`` """ | def default_get(self, cr, uid, fields, context): """ To get default values for the object. @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param fields: List of fields for which we want default values @param context: A standard dictionary @return: A dictionary which of fields with values. """ res = super(stock_return_picking, self).default_get(cr, uid, fields, context=context) record_id = context and context.get('active_id', False) or False pick_obj = self.pool.get('stock.picking') pick = pick_obj.browse(cr, uid, record_id) for m in [line for line in pick.move_lines]: res['return%s'%(m.id)] = m.product_qty if pick.invoice_state=='invoiced': res['invoice_state'] = '2binvoiced' else: res['invoice_state'] = 'none' return res | 3b5e198d6fca4e6934ff87ac875ee8b30300e487 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/3b5e198d6fca4e6934ff87ac875ee8b30300e487/stock_return_picking.py |
for m in [line for line in pick.move_lines]: res['return%s'%(m.id)] = m.product_qty if pick.invoice_state=='invoiced': res['invoice_state'] = '2binvoiced' else: res['invoice_state'] = 'none' | if pick: if 'invoice_state' in fields: if pick.invoice_state=='invoiced': res['invoice_state'] = '2binvoiced' else: res['invoice_state'] = 'none' for line in pick.move_lines: return_id = 'return%s'%(line.id) if return_id in fields: res[return_id] = line.product_qty | def default_get(self, cr, uid, fields, context): """ To get default values for the object. @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param fields: List of fields for which we want default values @param context: A standard dictionary @return: A dictionary which of fields with values. """ res = super(stock_return_picking, self).default_get(cr, uid, fields, context=context) record_id = context and context.get('active_id', False) or False pick_obj = self.pool.get('stock.picking') pick = pick_obj.browse(cr, uid, record_id) for m in [line for line in pick.move_lines]: res['return%s'%(m.id)] = m.product_qty if pick.invoice_state=='invoiced': res['invoice_state'] = '2binvoiced' else: res['invoice_state'] = 'none' return res | 3b5e198d6fca4e6934ff87ac875ee8b30300e487 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/3b5e198d6fca4e6934ff87ac875ee8b30300e487/stock_return_picking.py |
def default_get(self, cr, uid, fields, context): """ To get default values for the object. @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param fields: List of fields for which we want default values @param context: A standard dictionary @return: A dictionary which of fields with values. """ res = super(stock_return_picking, self).default_get(cr, uid, fields, context=context) record_id = context and context.get('active_id', False) or False pick_obj = self.pool.get('stock.picking') pick = pick_obj.browse(cr, uid, record_id) for m in [line for line in pick.move_lines]: res['return%s'%(m.id)] = m.product_qty if pick.invoice_state=='invoiced': res['invoice_state'] = '2binvoiced' else: res['invoice_state'] = 'none' return res | 3b5e198d6fca4e6934ff87ac875ee8b30300e487 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/3b5e198d6fca4e6934ff87ac875ee8b30300e487/stock_return_picking.py |
||
if abs(amount) < 10 ** -(int(config['price_accuracy'])): | if abs(amount) < 10 ** -(int(config['price_accuracy'])+1): | def validate(self, cr, uid, ids, context={}): if context and ('__last_update' in context): del context['__last_update'] ok = True for move in self.browse(cr, uid, ids, context): #unlink analytic lines on move_lines for obj_line in move.line_id: for obj in obj_line.analytic_lines: self.pool.get('account.analytic.line').unlink(cr,uid,obj.id) | 1864724d6cd498cbe3fe2a2dba0eae6dac017c54 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/1864724d6cd498cbe3fe2a2dba0eae6dac017c54/account.py |
self.email_send(cr, uid, ids, meeting_id.sprint_id.scrum_master_id.user_email) | res = self.email_send(cr, uid, ids, meeting_id.sprint_id.scrum_master_id.user_email) if not res: raise osv.except_osv(_('Error !'), _(' Email Not send to the scrum master %s!' % meeting_id.sprint_id.scrum_master_id.name)) | def button_send_to_master(self, cr, uid, ids, context=None): if context is None: context = {} 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, meeting_id.sprint_id.scrum_master_id.user_email) else: raise osv.except_osv(_('Error !'), _('Please provide email address for scrum master defined on sprint.')) return True | 5498b06e6fcc5604209073d9ffecbec28c475b9e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/5498b06e6fcc5604209073d9ffecbec28c475b9e/scrum.py |
self.email_send(cr,uid,ids,meeting_id.sprint_id.product_owner_id.user_email) | res = self.email_send(cr,uid,ids,meeting_id.sprint_id.product_owner_id.user_email) if not res: raise osv.except_osv(_('Error !'), _(' Email Not send to the product owner %s!' % meeting_id.sprint_id.product_owner_id.name)) | def button_send_product_owner(self, cr, uid, ids, context=None): if context is None: context = {} context.update({'button_send_product_owner': True}) meeting_id = self.browse(cr, uid, ids)[0] if meeting_id.sprint_id.product_owner_id.user_email: self.email_send(cr,uid,ids,meeting_id.sprint_id.product_owner_id.user_email) else: raise osv.except_osv(_('Error !'), _('Please provide email address for product owner defined on sprint.')) return True | 5498b06e6fcc5604209073d9ffecbec28c475b9e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/5498b06e6fcc5604209073d9ffecbec28c475b9e/scrum.py |
if context.get('button_send_product_owner', False): raise osv.except_osv(_('Error !'), _(' Email Not send to the product owner %s!' % meeting_id.sprint_id.product_owner_id.name)) raise osv.except_osv(_('Error !'), _(' Email Not send to the scrum master %s!' % meeting_id.sprint_id.scrum_master_id.name)) if context.get('button_send_product_owner', False): raise osv.except_osv(_('Information !'), _(' Email send successfully to product owner %s!' % meeting_id.sprint_id.product_owner_id.name)) raise osv.except_osv(_('Information!'), _(' Email send successfully to scrum master %s!'% meeting_id.sprint_id.scrum_master_id.name)) | return False | def email_send(self, cr, uid, ids, email, context=None): if context is None: context = {} email_from = tools.config.get('email_from', False) meeting_id = self.browse(cr,uid,ids)[0] user = self.pool.get('res.users').browse(cr, uid, uid, context=context) user_email = email_from or user.address_id.email or email_from body = "Hello " + meeting_id.sprint_id.scrum_master_id.name+",\n" +" \nI am sending you Daily Meeting Details of date %s for the Sprint %s \n" % (meeting_id.date, meeting_id.sprint_id.name) body += '\n*Tasks since yesterday: \n_______________________%s' % (meeting_id.question_yesterday) + '\n*Task for Today :\n_______________________ %s\n' % (meeting_id.question_today )+ '\n*Blocks encountered: \n_______________________ %s' % (meeting_id.question_blocks or 'No Blocks') body += "\n\nThank you,\n"+ user.name sub_name = meeting_id.name or 'Scrum Meeting of %s '%meeting_id.date flag = tools.email_send(user_email , [email], sub_name, body, reply_to=None, openobject_id=str(meeting_id.id)) if not flag: if context.get('button_send_product_owner', False): raise osv.except_osv(_('Error !'), _(' Email Not send to the product owner %s!' % meeting_id.sprint_id.product_owner_id.name)) raise osv.except_osv(_('Error !'), _(' Email Not send to the scrum master %s!' % meeting_id.sprint_id.scrum_master_id.name)) if context.get('button_send_product_owner', False): raise osv.except_osv(_('Information !'), _(' Email send successfully to product owner %s!' % meeting_id.sprint_id.product_owner_id.name)) raise osv.except_osv(_('Information!'), _(' Email send successfully to scrum master %s!'% meeting_id.sprint_id.scrum_master_id.name)) return True | 5498b06e6fcc5604209073d9ffecbec28c475b9e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/5498b06e6fcc5604209073d9ffecbec28c475b9e/scrum.py |
self.pool.get(table).write(cr, user, nids, v, context) | if v: self.pool.get(table).write(cr, user, nids, v, context) | def write(self, cr, user, ids, vals, context=None): """ Update records with given ids with the given field values | 22919bb1de3c44af9a21476d941cb651eee0f2d6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/22919bb1de3c44af9a21476d941cb651eee0f2d6/orm.py |
if purchase.invoice_id and purchase.invoice_id.state not in ('draft','cancel'): tot += purchase.invoice_id.amount_untaxed | for invoice in purchase.invoice_ids: if invoice.state not in ('draft','cancel'): tot += invoice.amount_untaxed | def _invoiced_rate(self, cursor, user, ids, name, arg, context=None): res = {} for purchase in self.browse(cursor, user, ids, context=context): tot = 0.0 if purchase.invoice_id and purchase.invoice_id.state not in ('draft','cancel'): tot += purchase.invoice_id.amount_untaxed if purchase.amount_untaxed: res[purchase.id] = tot * 100.0 / purchase.amount_untaxed else: res[purchase.id] = 0.0 return res | c02056ffb2d9d9ffdf2670cf7d38d3cfb0fe32a0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c02056ffb2d9d9ffdf2670cf7d38d3cfb0fe32a0/purchase.py |
if purchase.invoice_id.reconciled: res[purchase.id] = purchase.invoice_id.reconciled else: res[purchase.id] = False | invoiced = [] for invoice in purchase.invoice_ids: invoiced.append(invoice.reconciled) res[purchase.id] = invoiced | def _invoiced(self, cursor, user, ids, name, arg, context=None): res = {} for purchase in self.browse(cursor, user, ids, context=context): if purchase.invoice_id.reconciled: res[purchase.id] = purchase.invoice_id.reconciled else: res[purchase.id] = False return res | c02056ffb2d9d9ffdf2670cf7d38d3cfb0fe32a0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c02056ffb2d9d9ffdf2670cf7d38d3cfb0fe32a0/purchase.py |
'invoice_id': fields.many2one('account.invoice', 'Invoice', readonly=True, help="An invoice generated for a purchase order"), | 'invoice_ids': fields.function(_get_invoices, method=True, type='many2many', relation="account.invoice", string="Invoice", help="Invoices generated for a purchase order"), | def _invoiced(self, cursor, user, ids, name, arg, context=None): res = {} for purchase in self.browse(cursor, user, ids, context=context): if purchase.invoice_id.reconciled: res[purchase.id] = purchase.invoice_id.reconciled else: res[purchase.id] = False return res | c02056ffb2d9d9ffdf2670cf7d38d3cfb0fe32a0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c02056ffb2d9d9ffdf2670cf7d38d3cfb0fe32a0/purchase.py |
self.write(cr, uid, [o.id], {'invoice_id': inv_id}) | self.write(cr, uid, [o.id], {'invoice_ids': [4, inv_id]}) | def action_invoice_create(self, cr, uid, ids, *args): res = False | c02056ffb2d9d9ffdf2670cf7d38d3cfb0fe32a0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c02056ffb2d9d9ffdf2670cf7d38d3cfb0fe32a0/purchase.py |
inv = purchase.invoice_id if inv and inv.state not in ('cancel','draft'): raise osv.except_osv( _('Could not cancel this purchase order !'), _('You must first cancel all invoices attached to this purchase order.')) if inv: wf_service = netsvc.LocalService("workflow") wf_service.trg_validate(uid, 'account.invoice', inv.id, 'invoice_cancel', cr) | for inv in purchase.invoice_ids: if inv and inv.state not in ('cancel','draft'): raise osv.except_osv( _('Could not cancel this purchase order !'), _('You must first cancel all invoices attached to this purchase order.')) if inv: wf_service = netsvc.LocalService("workflow") wf_service.trg_validate(uid, 'account.invoice', inv.id, 'invoice_cancel', cr) | def action_cancel(self, cr, uid, ids, context={}): for purchase in self.browse(cr, uid, ids): for pick in purchase.picking_ids: if pick.state not in ('draft','cancel'): raise osv.except_osv( _('Could not cancel purchase order !'), _('You must first cancel all picking attached to this purchase order.')) for pick in purchase.picking_ids: wf_service = netsvc.LocalService("workflow") wf_service.trg_validate(uid, 'stock.picking', pick.id, 'button_cancel', cr) inv = purchase.invoice_id if inv and inv.state not in ('cancel','draft'): raise osv.except_osv( _('Could not cancel this purchase order !'), _('You must first cancel all invoices attached to this purchase order.')) if inv: wf_service = netsvc.LocalService("workflow") wf_service.trg_validate(uid, 'account.invoice', inv.id, 'invoice_cancel', cr) self.write(cr,uid,ids,{'state':'cancel'}) for (id,name) in self.name_get(cr, uid, ids): message = _("Purchase order '%s' is cancelled.") % name self.log(cr, uid, id, message) return True | c02056ffb2d9d9ffdf2670cf7d38d3cfb0fe32a0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c02056ffb2d9d9ffdf2670cf7d38d3cfb0fe32a0/purchase.py |
'invoice_id':False, | 'invoice_ids':{}, | def copy(self, cr, uid, id, default=None,context={}): if not default: default = {} default.update({ 'state':'draft', 'shipped':False, 'invoiced':False, 'invoice_id':False, 'picking_ids':[], 'name': self.pool.get('ir.sequence').get(cr, uid, 'purchase.order'), }) return super(purchase_order, self).copy(cr, uid, id, default, context) | c02056ffb2d9d9ffdf2670cf7d38d3cfb0fe32a0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c02056ffb2d9d9ffdf2670cf7d38d3cfb0fe32a0/purchase.py |
'grows': fields.function(_calculate, method=True, store=True, multi='dc', string='Gross Salary', type='float', digits=(16, int(config['price_accuracy']))), 'net': fields.function(_calculate, method=True, store=True, multi='dc', string='Net Salary', digits=(16, int(config['price_accuracy']))), 'allounce': fields.function(_calculate, method=True, store=True, multi='dc', string='Allowance', digits=(16, int(config['price_accuracy']))), 'deduction': fields.function(_calculate, method=True, store=True, multi='dc', string='Deduction', digits=(16, int(config['price_accuracy']))), | 'grows': fields.function(_calculate, method=True, store=True, multi='dc', string='Gross Salary', type='float', digits=(16, 4)), 'net': fields.function(_calculate, method=True, store=True, multi='dc', string='Net Salary', digits=(16, 4)), 'allounce': fields.function(_calculate, method=True, store=True, multi='dc', string='Allowance', digits=(16, 4)), 'deduction': fields.function(_calculate, method=True, store=True, multi='dc', string='Deduction', digits=(16, 4)), | def _calculate(self, cr, uid, ids, field_names, arg, context): res = {} allounce = 0.0 deduction = 0.0 net = 0.0 grows = 0.0 for register in self.browse(cr, uid, ids, context): for slip in register.line_ids: allounce += slip.allounce deduction += slip.deduction net += slip.net grows += slip.grows | 21786ff375c69b960b487a69bd1343b8b77f3dec /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/21786ff375c69b960b487a69bd1343b8b77f3dec/hr_payroll.py |
'amount': fields.float('Amount', digits=(16, int(config['price_accuracy']))), 'bysal': fields.float('By Salary', digits=(16, int(config['price_accuracy']))), | 'amount': fields.float('Amount', digits=(16, 4)), 'bysal': fields.float('By Salary', digits=(16, 4)), | def cancel_sheet(self, cr, uid, ids, context={}): self.write(cr, uid, ids, {'state':'cancel'}) return True | 21786ff375c69b960b487a69bd1343b8b77f3dec /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/21786ff375c69b960b487a69bd1343b8b77f3dec/hr_payroll.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.