rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
else: logger.notifyChannel('init', netsvc.LOG_WARNING, 'module %s: not installable, skipped' % (module))
def upgrade_graph(graph, cr, module_list, force=None): if force is None: force = [] packages = [] len_graph = len(graph) for module in module_list: mod_path = get_module_path(module) terp_file = get_module_resource(module, '__openerp__.py') if not terp_file or not os.path.isfile(terp_file): terp_file = get_module_resou...
75d569cc6c5ed18f920052415c23e7b838e3b6a4 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/75d569cc6c5ed18f920052415c23e7b838e3b6a4/__init__.py
global not_loaded if not_loaded: not_loaded = [] return
def check_module_name(cr, mods, state): for mod in mods: id = modobj.search(cr, 1, ['&', ('state', '=', state), ('name', '=', mod)]) if id: getattr(modobj, states[state])(cr, 1, id) elif mod != 'all': logger.notifyChannel('init', netsvc.LOG_WARNING, 'module %s: invalid module name!' % (mod))
75d569cc6c5ed18f920052415c23e7b838e3b6a4 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/75d569cc6c5ed18f920052415c23e7b838e3b6a4/__init__.py
case when uom.category_id != puom.category_id then pt.weight_net * inv_line.quantity else case when uom.factor_inv_data > 0 then pt.weight_net * inv_line.quantity * uom.factor_inv_data else pt.weight_net * inv_line.quantity / uom.factor end end
case when uom.category_id != puom.category_id then (pt.weight_net * inv_line.quantity) else (pt.weight_net * inv_line.quantity * uom.factor) end
def init(self, cr): drop_view_if_exists(cr, 'report_intrastat') cr.execute(""" create or replace view report_intrastat as ( select to_char(inv.create_date, 'YYYY') as name, to_char(inv.create_date, 'MM') as month, min(inv_line.id) as id, intrastat.id as intrastat_id, upper(inv_country.code) as code, sum(case when inv_l...
d0a6aeebff76728a5f850b59cb87990b97cd3780 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/d0a6aeebff76728a5f850b59cb87990b97cd3780/report_intrastat.py
else case when uom.factor_inv_data > 0 then inv_line.quantity * uom.factor_inv_data else inv_line.quantity / uom.factor end end
else (inv_line.quantity * uom.factor) end
def init(self, cr): drop_view_if_exists(cr, 'report_intrastat') cr.execute(""" create or replace view report_intrastat as ( select to_char(inv.create_date, 'YYYY') as name, to_char(inv.create_date, 'MM') as month, min(inv_line.id) as id, intrastat.id as intrastat_id, upper(inv_country.code) as code, sum(case when inv_l...
d0a6aeebff76728a5f850b59cb87990b97cd3780 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/d0a6aeebff76728a5f850b59cb87990b97cd3780/report_intrastat.py
if picking_id: wf_service.trg_validate(uid, 'stock.picking', picking_id, 'button_confirm', cr)
def action_ship_create(self, cr, uid, ids, *args): wf_service = netsvc.LocalService("workflow") picking_id = False move_obj = self.pool.get('stock.move') proc_obj = self.pool.get('procurement.order') company = self.pool.get('res.users').browse(cr, uid, uid).company_id for order in self.browse(cr, uid, ids, context={}):...
bf00ee7f5cbd05edf189e1e1c7e9743b26a1d6c6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/bf00ee7f5cbd05edf189e1e1c7e9743b26a1d6c6/sale.py
'account_id': a,
'account_id': account_id,
def action_invoice_create(self, cr, uid, ids, group=False, context=None): """ Creates invoice(s) for repair order. @param group: It is set to true when group invoice is to be generated. @return: Invoice Ids. """ res = {} invoices_group = {} inv_line_obj = self.pool.get('account.invoice.line') inv_obj = self.pool.get('a...
8ee7af483dc8860e76ca1e7c8fb3e4cbb01f0bed /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/8ee7af483dc8860e76ca1e7c8fb3e4cbb01f0bed/mrp_repair.py
for dirname in rl_config.TTFSearchPath: abp = os.path.abspath(dirname) if os.path.isdir(abp): dirpath.append(abp)
searchpath = [] if config.get_misc('ttfonts', 'search_path', False): searchpath += map(str.strip, config.get_misc('ttfonts', 'search_path').split(',')) if os.name == 'nt': pass elif os.uname()[0] == 'Linux': searchpath += TTFSearchPath_Linux else: pass if config.get_misc('ttfonts', 'use_default_path', True): search...
def FindCustomFonts(): """Fill the __foundFonts list with those filenames, whose fonts can be found in the reportlab ttf font path. This process needs only be done once per loading of this module, it is cached. But, if the system admin adds some font in the meanwhile, the server must be restarted eventually. """ dirpa...
7c55e521a3b6aa0e45599c67158cf392e57173ea /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/7c55e521a3b6aa0e45599c67158cf392e57173ea/customfonts.py
def FindCustomFonts(): """Fill the __foundFonts list with those filenames, whose fonts can be found in the reportlab ttf font path. This process needs only be done once per loading of this module, it is cached. But, if the system admin adds some font in the meanwhile, the server must be restarted eventually. """ dirpa...
7c55e521a3b6aa0e45599c67158cf392e57173ea /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/7c55e521a3b6aa0e45599c67158cf392e57173ea/customfonts.py
sid = inv.journal_id.invoice_sequence_id.id number = self.pool.get('ir.sequence').get_id(cr, uid, sid, 'id', {'fiscalyear_id': inv.period_id.fiscalyear_id.id})
sequence_id = inv.journal_id.invoice_sequence_id.id number = self.pool.get('ir.sequence').get_id(cr, uid, sequence_id, 'id', context=tmp_context)
def action_number(self, cr, uid, ids, *args): cr.execute('SELECT id, type, number, move_id, reference ' \ 'FROM account_invoice ' \ 'WHERE id IN %s', (tuple(ids),)) inv = self.browse(cr, uid, ids)[0] for (id, invtype, number, move_id, reference) in cr.fetchall(): if not number: tmp_context = { 'fiscalyear_id': inv.peri...
3dec5629c96aab45601f8277e2c1264fcca32d3b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/3dec5629c96aab45601f8277e2c1264fcca32d3b/invoice.py
number = obj_seq.get_id(cr, uid, 'account.invoice.%s' % invtype, 'code=%s', context=tmp_context)
number = self.pool.get('ir.sequence').get_id(cr, uid, 'account.invoice.%s' % invtype, 'code', context=tmp_context)
def action_number(self, cr, uid, ids, *args): cr.execute('SELECT id, type, number, move_id, reference ' \ 'FROM account_invoice ' \ 'WHERE id IN %s', (tuple(ids),)) inv = self.browse(cr, uid, ids)[0] for (id, invtype, number, move_id, reference) in cr.fetchall(): if not number: tmp_context = { 'fiscalyear_id': inv.peri...
3dec5629c96aab45601f8277e2c1264fcca32d3b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/3dec5629c96aab45601f8277e2c1264fcca32d3b/invoice.py
data_id = dataobj._get_id(cr, 1, 'base', 'group_user') return data_id and [data_id] or False
dummy,group_id = dataobj.get_object_reference(cr, 1, 'base', 'group_user') return [group_id] or False
def _get_group(self,cr, uid, context=None): dataobj = self.pool.get('ir.model.data') data_id = dataobj._get_id(cr, 1, 'base', 'group_user') return data_id and [data_id] or False
55da21f5b634485b520adc10e2f5afc60ce231aa /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/55da21f5b634485b520adc10e2f5afc60ce231aa/res_user.py
new_picking=picking_obj.copy(cr, uid, order_id.last_out_picking.id, {'name':'%s (return)' % order_id.name, 'move_lines':[], 'state':'draft', 'type':'in', 'type':'in', 'date':date_cur, }) new_order=order_obj.copy(cr,uid,order_id.id, {'name': 'Refund %s'%order_id.name, 'lines':[], 'statement_ids':[], 'last_out_picking...
if order_id.last_out_picking.id: new_picking=picking_obj.copy(cr, uid, order_id.last_out_picking.id, {'name':'%s (return)' % order_id.name, 'move_lines':[], 'state':'draft', 'type':'in', 'type':'in', 'date':date_cur, }) new_order=order_obj.copy(cr,uid,order_id.id, {'name': 'Refund %s'%order_id.name, 'lines':[], 'stat...
def _create_returns2(self, cr, uid, data, context): pool = pooler.get_pool(cr.dbname) order_obj = pool.get('pos.order') line_obj = pool.get('pos.order.line') picking_obj = pool.get('stock.picking') stock_move_obj = pool.get('stock.move') picking_ids = picking_obj.search(cr, uid, [('pos_order', 'in', data['ids']), ('sta...
1b2f939266031a4b013f02cde4e30074531f82d5 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/1b2f939266031a4b013f02cde4e30074531f82d5/wizard_return.py
'amount': fields.float('Amount', required=True, digits_compute=dp.get_precision('Account'), help="For taxes of type percentage, enter % ratio between 0-1."),
'amount': fields.float('Amount', required=True, digits_compute=get_precision_tax(), help="For taxes of type percentage, enter % ratio between 0-1."),
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)
8e2d576a8b13f18a1bbaeb00e2c058d18dd8aa12 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/8e2d576a8b13f18a1bbaeb00e2c058d18dd8aa12/account.py
totalin = totalex = round(price_unit * quantity, precision)
def compute_all(self, cr, uid, taxes, price_unit, quantity, address_id=None, product=None, partner=None): """ RETURN: { 'total': 0.0, # Total without taxes 'total_included: 0.0, # Total with taxes 'taxes': [] # List of taxes, see compute for the format } """ precision = self.pool....
eca497d46b7159a9ff5fd5fdd6f74368d026c287 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/eca497d46b7159a9ff5fd5fdd6f74368d026c287/account.py
tex = self._compute(cr, uid, tex, price_unit, quantity, address_id=address_id, product=product, partner=partner)
def compute_all(self, cr, uid, taxes, price_unit, quantity, address_id=None, product=None, partner=None): """ RETURN: { 'total': 0.0, # Total without taxes 'total_included: 0.0, # Total with taxes 'taxes': [] # List of taxes, see compute for the format } """ precision = self.pool....
eca497d46b7159a9ff5fd5fdd6f74368d026c287 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/eca497d46b7159a9ff5fd5fdd6f74368d026c287/account.py
print "Deprecated, use compute_all(...)['taxes'] instead of compute(...) to manage prices with tax included"
logger = netsvc.Logger() logger.notifyChannel("warning", netsvc.LOG_WARNING, "Deprecated, use compute_all(...)['taxes'] instead of compute(...) to manage prices with tax included")
def compute(self, cr, uid, taxes, price_unit, quantity, address_id=None, product=None, partner=None): print "Deprecated, use compute_all(...)['taxes'] instead of compute(...) to manage prices with tax included" return self._compute(cr, uid, taxes, price_unit, quantity, address_id, product, partner)
eca497d46b7159a9ff5fd5fdd6f74368d026c287 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/eca497d46b7159a9ff5fd5fdd6f74368d026c287/account.py
today = (last_month_date- 1).strftime('%Y-%m-%d')
today = (last_month_date- relativedelta(days=1)).strftime('%Y-%m-%d')
def init(self, cr, uid=1): """ This view will be used in dashboard The reason writing this code here is, we need to check date range from today to first date of fiscal year. """ pool_obj_fy = pooler.get_pool(cr.dbname).get('account.fiscalyear') today = time.strftime('%Y-%m-%d') fy_id = pool_obj_fy.find(cr, uid, excepti...
7b4cae7e4cbcfe64d3c1c2b48dd21d7c463bc313 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/7b4cae7e4cbcfe64d3c1c2b48dd21d7c463bc313/account_report.py
<table width="100%"> <tr> <td width=60% style="padding-right:8px;"> <input id="sidebar_pad_datas" name="pad_name" size="5" /> </td> <td> <button>${_("Ok")}</button> </td> </tr> </table>
<input id="sidebar_pad_datas" name="pad_name" size="5" /> <button>${_("Ok")}</button>
def edit(self, template, template_text): output = super(SidebarTemplateEditor, self).edit(template, template_text)
13c8d859d3506703afe1751d8114f438637a8649 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/13c8d859d3506703afe1751d8114f438637a8649/editors.py
'attendances_ids' : one2many_mod2('hr.attendance', 'sheet_id', 'Attendances', readonly=True, states={'draft':[('readonly',False)],'new':[('readonly',False)]}),
'attendances_ids' : one2many_mod2('hr.attendance', 'sheet_id', 'Attendances', readonly=True,),
def sign_out(self, cr, uid, ids, context=None): emp_obj = self.pool.get('hr.employee') if context is None: context = {} if not self.browse(cr, uid, ids, context=context)[0].date_current == time.strftime('%Y-%m-%d'): raise osv.except_osv(_('Error !'), _('You can not sign out from an other date than today')) emp_ids = em...
e20452310d64f6c8c07fc3e7830c4ddb88e8d8fd /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/e20452310d64f6c8c07fc3e7830c4ddb88e8d8fd/hr_timesheet_sheet.py
def _get_analytic_lines(self, cr, uid, id): inv = self.browse(cr, uid, [id])[0] cur_obj = self.pool.get('res.currency')
6bf8e8540e15556d4f6de35150e5b4b6a0e54466 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6bf8e8540e15556d4f6de35150e5b4b6a0e54466/account_analytic_plans.py
if il['analytics_id']:
if il.get('analytics_id', False):
def _get_analytic_lines(self, cr, uid, id): inv = self.browse(cr, uid, [id])[0] cur_obj = self.pool.get('res.currency')
6bf8e8540e15556d4f6de35150e5b4b6a0e54466 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6bf8e8540e15556d4f6de35150e5b4b6a0e54466/account_analytic_plans.py
il['analytic_lines']=[]
il['analytic_lines'] = []
def _get_analytic_lines(self, cr, uid, id): inv = self.browse(cr, uid, [id])[0] cur_obj = self.pool.get('res.currency')
6bf8e8540e15556d4f6de35150e5b4b6a0e54466 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6bf8e8540e15556d4f6de35150e5b4b6a0e54466/account_analytic_plans.py
def invoice_line_create(self, cr, uid, ids, context=None): create_ids = super(sale_order_line,self).invoice_line_create(cr, uid, ids, context) if ids: sale_line = self.browse(cr, uid, ids[0], context) inv_line_obj = self.pool.get('account.invoice.line') acct_anal_def_obj = self.pool.get('account.analytic.default')
6bf8e8540e15556d4f6de35150e5b4b6a0e54466 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6bf8e8540e15556d4f6de35150e5b4b6a0e54466/account_analytic_plans.py
repair_order = self.pool.get('mrp.repair').browse(cr, uid, record_id) if not repair_order.invoiced: res['arch'] = """ <form string="Cancel Repair" colspan="4"> <group col="2" colspan="2"> <label string="Do you want to continue?" colspan="4"/> <separator colspan="4"/> <button icon="gtk-cancel" special="cancel" string="N...
try: repair_order = self.pool.get('mrp.repair').browse(cr, uid, record_id) if not repair_order.invoiced: res['arch'] = """ <form string="Cancel Repair" colspan="4"> <group col="2" colspan="2"> <label string="Do you want to continue?" colspan="4"/> <separator colspan="4"/> <button icon="gtk-cancel" special="cancel" stri...
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): """ Changes the view dynamically @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param context: A standard dictionary @return: New arch of view....
60e601b49a0ccd670ade65dfe13553a978b7dfeb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/60e601b49a0ccd670ade65dfe13553a978b7dfeb/cancel_repair.py
journal_id = inv.journal_id.id
journal_id = inv.journal_id.id
def action_move_create(self, cr, uid, ids, *args): """Creates invoice related analytics and financial move lines""" ait_obj = self.pool.get('account.invoice.tax') cur_obj = self.pool.get('res.currency') context = {} for inv in self.browse(cr, uid, ids): if not inv.journal_id.sequence_id: raise osv.except_osv(_('Error !...
c38d1e200acb560a320e4195af9387b261388786 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c38d1e200acb560a320e4195af9387b261388786/invoice.py
company_currency=False
company_currency = False tax_amount = self.read(cr, uid, ids[0], ['tax_amount'])['tax_amount'] tax_sign=1 if tax_amount < 0: tax_sign = -1 elif tax_amount == 0: tax_sign = 0
def amount_change(self, cr, uid, ids, amount, currency_id=False, company_id=False, date_invoice=False): cur_obj = self.pool.get('res.currency') company_obj = self.pool.get('res.company') company_currency=False if company_id: company_currency = company_obj.read(cr, uid, [company_id], ['currency_id'])[0]['currency_id'][0...
c38d1e200acb560a320e4195af9387b261388786 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c38d1e200acb560a320e4195af9387b261388786/invoice.py
amount = cur_obj.compute(cr, uid, currency_id, company_currency, amount, context={'date': date_invoice or time.strftime('%Y-%m-%d')}, round=False) return {'value': {'tax_amount':amount}}
amount = cur_obj.compute(cr, uid, currency_id, company_currency, amount*tax_sign, context={'date': date_invoice or time.strftime('%Y-%m-%d')}, round=False) return {'value': {'tax_amount': amount}}
def amount_change(self, cr, uid, ids, amount, currency_id=False, company_id=False, date_invoice=False): cur_obj = self.pool.get('res.currency') company_obj = self.pool.get('res.company') company_currency=False if company_id: company_currency = company_obj.read(cr, uid, [company_id], ['currency_id'])[0]['currency_id'][0...
c38d1e200acb560a320e4195af9387b261388786 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c38d1e200acb560a320e4195af9387b261388786/invoice.py
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'account.analytic.line', c),
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'account.analytic.line', context=c),
def _get_account_line(self, cr, uid, ids, context={}): aac_ids = {} for acc in self.pool.get('account.analytic.account').browse(cr, uid, ids): aac_ids[acc.id] = True aal_ids = [] if aac_ids: aal_ids = self.pool.get('account.analytic.line').search(cr, uid, [('account_id','in',aac_ids.keys())], context=context) return aa...
47a7f86d3162d81e28573378e26d8d92e0961425 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/47a7f86d3162d81e28573378e26d8d92e0961425/project.py
print history_type
def _get_case_history(self, cr, uid, history_type, res_id, context=None): if not res_id: return
80f26e7878e033ff9efe81eb3554203b32c95b48 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/80f26e7878e033ff9efe81eb3554203b32c95b48/crm_forward_to_partner.py
return False if type(self) != type(other):
def __eq__(self, other): if not self.context == other.context: return False if type(self) != type(other): return False # Two directory nodes, for the same document.directory, may have a # different context! (dynamic folders) if self.dctx != other.dctx: return False return self.dir_id == other.dir_id
9cdbcbfee1d356ebaab68e17e75aa0bf1eb16b5d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/9cdbcbfee1d356ebaab68e17e75aa0bf1eb16b5d/nodes.py
return False if type(self) != type(other):
def __eq__(self, other): if not self.context == other.context: return False if type(self) != type(other): return False # Two nodes, for the same document.directory, may have a # different context! (dynamic folders) if self.dctx != other.dctx: return False return self.dir_id == other.dir_id
9cdbcbfee1d356ebaab68e17e75aa0bf1eb16b5d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/9cdbcbfee1d356ebaab68e17e75aa0bf1eb16b5d/nodes.py
return False if type(self) != type(other):
def __eq__(self, other): if not self.context == other.context: return False if type(self) != type(other): return False if not self.res_model == other.res_model: return False if not self.res_id == other.res_id: return False if self.domain != other.domain: return False if self.dctx != other.dctx: return False return self...
9cdbcbfee1d356ebaab68e17e75aa0bf1eb16b5d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/9cdbcbfee1d356ebaab68e17e75aa0bf1eb16b5d/nodes.py
return False if type(self) != type(other):
def __eq__(self, other): if not self.context == other.context: return False if type(self) != type(other): return False if self.dctx != other.dctx: return False return self.file_id == other.file_id
9cdbcbfee1d356ebaab68e17e75aa0bf1eb16b5d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/9cdbcbfee1d356ebaab68e17e75aa0bf1eb16b5d/nodes.py
entry_type = 'journal_pur_voucher' if invoice.type == 'in_refund': entry_type = 'cont_voucher'
def pay_and_reconcile(self, cr, uid, ids, pay_amount, pay_account_id, period_id, pay_journal_id, writeoff_acc_id, writeoff_period_id, writeoff_journal_id, context=None, name=''): if context is None: context = {} #TODO check if we can use different period for payment and the writeoff line assert len(ids)==1, "Can only p...
d7e0e18d7f7499b0129cf7f9c1cd233481fe5ec4 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/d7e0e18d7f7499b0129cf7f9c1cd233481fe5ec4/invoice.py
entry_type = 'journal_sale_vou' if invoice.type == 'out_refund': entry_type = 'cont_voucher'
def pay_and_reconcile(self, cr, uid, ids, pay_amount, pay_account_id, period_id, pay_journal_id, writeoff_acc_id, writeoff_period_id, writeoff_journal_id, context=None, name=''): if context is None: context = {} #TODO check if we can use different period for payment and the writeoff line assert len(ids)==1, "Can only p...
d7e0e18d7f7499b0129cf7f9c1cd233481fe5ec4 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/d7e0e18d7f7499b0129cf7f9c1cd233481fe5ec4/invoice.py
@return: True
@return: True
def subscribe(self, cr, uid, ids, *args): """ Subscribe Rule for auditing changes on object and apply shortcut for logs on that object. @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of Auddittrail Rule’s IDs. @return: True """ obj_action = ...
db704adb67985bd6eaad8c1dd3c5eac480aaa2ec /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/db704adb67985bd6eaad8c1dd3c5eac480aaa2ec/audittrail.py
_('WARNING: audittrail is not part of the pool'),
_('WARNING: audittrail is not part of the pool'),
def subscribe(self, cr, uid, ids, *args): """ Subscribe Rule for auditing changes on object and apply shortcut for logs on that object. @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of Auddittrail Rule’s IDs. @return: True """ obj_action = ...
db704adb67985bd6eaad8c1dd3c5eac480aaa2ec /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/db704adb67985bd6eaad8c1dd3c5eac480aaa2ec/audittrail.py
"name": 'View Log', "res_model": 'audittrail.log', "src_model": thisrule.object_id.model,
"name": 'View Log', "res_model": 'audittrail.log', "src_model": thisrule.object_id.model,
def subscribe(self, cr, uid, ids, *args): """ Subscribe Rule for auditing changes on object and apply shortcut for logs on that object. @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of Auddittrail Rule’s IDs. @return: True """ obj_action = ...
db704adb67985bd6eaad8c1dd3c5eac480aaa2ec /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/db704adb67985bd6eaad8c1dd3c5eac480aaa2ec/audittrail.py
id = obj_action.create(cr, uid, val) self.write(cr, uid, [thisrule.id], {"state": "subscribed", "action_id": id})
action_id = obj_action.create(cr, uid, val) self.write(cr, uid, [thisrule.id], {"state": "subscribed", "action_id": action_id})
def subscribe(self, cr, uid, ids, *args): """ Subscribe Rule for auditing changes on object and apply shortcut for logs on that object. @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of Auddittrail Rule’s IDs. @return: True """ obj_action = ...
db704adb67985bd6eaad8c1dd3c5eac480aaa2ec /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/db704adb67985bd6eaad8c1dd3c5eac480aaa2ec/audittrail.py
value = 'ir.actions.act_window,' + str(id)
value = 'ir.actions.act_window,' + str(action_id)
def subscribe(self, cr, uid, ids, *args): """ Subscribe Rule for auditing changes on object and apply shortcut for logs on that object. @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of Auddittrail Rule’s IDs. @return: True """ obj_action = ...
db704adb67985bd6eaad8c1dd3c5eac480aaa2ec /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/db704adb67985bd6eaad8c1dd3c5eac480aaa2ec/audittrail.py
@return: True
@return: True
def unsubscribe(self, cr, uid, ids, *args): """ Unsubscribe Auditing Rule on object @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of Auddittrail Rule’s IDs. @return: True """ obj_action = self.pool.get('ir.actions.act_window') val_obj = sel...
db704adb67985bd6eaad8c1dd3c5eac480aaa2ec /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/db704adb67985bd6eaad8c1dd3c5eac480aaa2ec/audittrail.py
"name": fields.char("Name", size=32), "object_id": fields.many2one('ir.model', 'Object'), "user_id": fields.many2one('res.users', 'User'), "method": fields.selection((('read', 'Read'), ('write', 'Write'), ('unlink', 'Delete'), ('create', 'Create')), "Method"), "timestamp": fields.datetime("Date"), "res_id": fields.inte...
"name": fields.char("Resource Name",size=64), "object_id": fields.many2one('ir.model', 'Object'), "user_id": fields.many2one('res.users', 'User'), "method": fields.char("Method", size=64), "timestamp": fields.datetime("Date"), "res_id": fields.integer('Resource Id'), "line_ids": fields.one2many('audittrail.log.line', ...
def unsubscribe(self, cr, uid, ids, *args): """ Unsubscribe Auditing Rule on object @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of Auddittrail Rule’s IDs. @return: True """ obj_action = self.pool.get('ir.actions.act_window') val_obj = sel...
db704adb67985bd6eaad8c1dd3c5eac480aaa2ec /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/db704adb67985bd6eaad8c1dd3c5eac480aaa2ec/audittrail.py
'field_id': fields.many2one('ir.model.fields', 'Fields', required=True), 'log_id': fields.many2one('audittrail.log', 'Log'), 'log': fields.integer("Log ID"), 'old_value': fields.text("Old Value"), 'new_value': fields.text("New Value"), 'old_value_text': fields.text('Old value Text'), 'new_value_text': fields.text('New ...
'field_id': fields.many2one('ir.model.fields', 'Fields', required=True), 'log_id': fields.many2one('audittrail.log', 'Log'), 'log': fields.integer("Log ID"), 'old_value': fields.text("Old Value"), 'new_value': fields.text("New Value"), 'old_value_text': fields.text('Old value Text'), 'new_value_text': fields.text('New ...
def unsubscribe(self, cr, uid, ids, *args): """ Unsubscribe Auditing Rule on object @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of Auddittrail Rule’s IDs. @return: True """ obj_action = self.pool.get('ir.actions.act_window') val_obj = sel...
db704adb67985bd6eaad8c1dd3c5eac480aaa2ec /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/db704adb67985bd6eaad8c1dd3c5eac480aaa2ec/audittrail.py
def get_value_text(self, cr, uid, field_name, values, object, context=None):
def get_value_text(self, cr, uid, field_name, values, model, context=None):
def unsubscribe(self, cr, uid, ids, *args): """ Unsubscribe Auditing Rule on object @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of Auddittrail Rule’s IDs. @return: True """ obj_action = self.pool.get('ir.actions.act_window') val_obj = sel...
db704adb67985bd6eaad8c1dd3c5eac480aaa2ec /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/db704adb67985bd6eaad8c1dd3c5eac480aaa2ec/audittrail.py
@param field_name: List of fields for text values @param values: Values for field to be converted into textual values @return: values: List of textual values for given fields
@param field_name: List of fields for text values @param values: Values for field to be converted into textual values @return: values: List of textual values for given fields
def get_value_text(self, cr, uid, field_name, values, object, context=None): """ Gets textual values for the fields e.g.: For field of type many2one it gives its name value instead of id
db704adb67985bd6eaad8c1dd3c5eac480aaa2ec /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/db704adb67985bd6eaad8c1dd3c5eac480aaa2ec/audittrail.py
f_id = pool.get('ir.model.fields').search(cr, uid, [('name', '=', field_name), ('model_id', '=', object.id)]) if f_id: field = pool.get('ir.model.fields').read(cr, uid, f_id)[0] model = field['relation'] if field['ttype'] == 'many2one': if values: if type(values) == tuple: values = values[0] val = pool.get(model).read...
field_pool = pool.get('ir.model.fields') model_pool = pool.get('ir.model') obj_pool = pool.get(model.model) if obj_pool._inherits: inherits_ids = model_pool.search(cr, uid, [('model', '=', obj_pool._inherits.keys()[0])]) field_ids = field_pool.search(cr, uid, [('name', '=', field_name), ('model_id', 'in', (model.id, in...
def get_value_text(self, cr, uid, field_name, values, object, context=None): """ Gets textual values for the fields e.g.: For field of type many2one it gives its name value instead of id
db704adb67985bd6eaad8c1dd3c5eac480aaa2ec /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/db704adb67985bd6eaad8c1dd3c5eac480aaa2ec/audittrail.py
@param object: Object who's values are being changed
@param model: Object who's values are being changed
def create_log_line(self, cr, uid, id, object, lines=[]): """ Creates lines for changed fields with its old and new values
db704adb67985bd6eaad8c1dd3c5eac480aaa2ec /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/db704adb67985bd6eaad8c1dd3c5eac480aaa2ec/audittrail.py
def create_log_line(self, cr, uid, id, object, lines=[]): """ Creates lines for changed fields with its old and new values
db704adb67985bd6eaad8c1dd3c5eac480aaa2ec /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/db704adb67985bd6eaad8c1dd3c5eac480aaa2ec/audittrail.py
obj = pool.get(object.model)
obj_pool = pool.get(model.model) model_pool = pool.get('ir.model') field_pool = pool.get('ir.model.fields') log_line_pool = pool.get('audittrail.log.line')
def create_log_line(self, cr, uid, id, object, lines=[]): """ Creates lines for changed fields with its old and new values
db704adb67985bd6eaad8c1dd3c5eac480aaa2ec /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/db704adb67985bd6eaad8c1dd3c5eac480aaa2ec/audittrail.py
if obj._inherits: inherits_ids = pool.get('ir.model').search(cr, uid, [('model', '=', obj._inherits.keys()[0])]) f_id = pool.get('ir.model.fields').search(cr, uid, [('name', '=', line['name']), ('model_id', 'in', (object.id, inherits_ids[0]))])
if obj_pool._inherits: inherits_ids = model_pool.search(cr, uid, [('model', '=', obj_pool._inherits.keys()[0])]) field_ids = field_pool.search(cr, uid, [('name', '=', line['name']), ('model_id', 'in', (model.id, inherits_ids[0]))])
def create_log_line(self, cr, uid, id, object, lines=[]): """ Creates lines for changed fields with its old and new values
db704adb67985bd6eaad8c1dd3c5eac480aaa2ec /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/db704adb67985bd6eaad8c1dd3c5eac480aaa2ec/audittrail.py
f_id = pool.get('ir.model.fields').search(cr, uid, [('name', '=', line['name']), ('model_id', '=', object.id)]) if f_id: fields = pool.get('ir.model.fields').read(cr, uid, f_id) old_value = 'old_value' in line and line['old_value'] or '' new_value = 'new_value' in line and line['new_value'] or '' old_value_text = 'ol...
field_ids = field_pool.search(cr, uid, [('name', '=', line['name']), ('model_id', '=', model.id)]) field_id = field_ids and field_ids[0] or False assert field_id, _("'%s' field is not exits in '%s' model" %(line['name'], model.model)) field = field_pool.read(cr, uid, field_id) old_value = 'old_value' in line and line...
def create_log_line(self, cr, uid, id, object, lines=[]): """ Creates lines for changed fields with its old and new values
db704adb67985bd6eaad8c1dd3c5eac480aaa2ec /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/db704adb67985bd6eaad8c1dd3c5eac480aaa2ec/audittrail.py
def log_fct(self, db, uid, object, method, fct_src, *args):
def log_fct(self, db, uid, model, method, fct_src, *args):
def log_fct(self, db, uid, object, method, fct_src, *args): """ Logging function: This function is performs logging oprations according to method @param db: the current database @param uid: the current user’s ID for security checks, @param object: Object who's values are being changed @param method: method to log: crea...
db704adb67985bd6eaad8c1dd3c5eac480aaa2ec /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/db704adb67985bd6eaad8c1dd3c5eac480aaa2ec/audittrail.py
@param method: method to log: create, read, write, unlink
@param method: method to log: create, read, write, unlink
def log_fct(self, db, uid, object, method, fct_src, *args): """ Logging function: This function is performs logging oprations according to method @param db: the current database @param uid: the current user’s ID for security checks, @param object: Object who's values are being changed @param method: method to log: crea...
db704adb67985bd6eaad8c1dd3c5eac480aaa2ec /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/db704adb67985bd6eaad8c1dd3c5eac480aaa2ec/audittrail.py
@return: Returns result as per method of Object proxy """ logged_uids = []
@return: Returns result as per method of Object proxy """ res2 = args
def log_fct(self, db, uid, object, method, fct_src, *args): """ Logging function: This function is performs logging oprations according to method @param db: the current database @param uid: the current user’s ID for security checks, @param object: Object who's values are being changed @param method: method to log: crea...
db704adb67985bd6eaad8c1dd3c5eac480aaa2ec /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/db704adb67985bd6eaad8c1dd3c5eac480aaa2ec/audittrail.py
obj_ids = pool.get('ir.model').search(cr, uid, [('model', '=', object)]) model_object = pool.get('ir.model').browse(cr, uid, obj_ids)[0]
resource_pool = pool.get(model) log_pool = pool.get('audittrail.log') model_pool = pool.get('ir.model') model_ids = model_pool.search(cr, uid, [('model', '=', model)]) model_id = model_ids and model_ids[0] or False assert model_id, _("'%s' Model is not exits..." %(model)) model = model_pool.browse(cr, uid, model_id)
def log_fct(self, db, uid, object, method, fct_src, *args): """ Logging function: This function is performs logging oprations according to method @param db: the current database @param uid: the current user’s ID for security checks, @param object: Object who's values are being changed @param method: method to log: crea...
db704adb67985bd6eaad8c1dd3c5eac480aaa2ec /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/db704adb67985bd6eaad8c1dd3c5eac480aaa2ec/audittrail.py
res_id = fct_src(db, uid, object, method, *args)
res_id = fct_src(db, uid, model.model, method, *args)
def log_fct(self, db, uid, object, method, fct_src, *args): """ Logging function: This function is performs logging oprations according to method @param db: the current database @param uid: the current user’s ID for security checks, @param object: Object who's values are being changed @param method: method to log: crea...
db704adb67985bd6eaad8c1dd3c5eac480aaa2ec /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/db704adb67985bd6eaad8c1dd3c5eac480aaa2ec/audittrail.py
new_value = pool.get(model_object.model).read(cr, uid, [res_id], args[0].keys())[0] if 'id' in new_value: del new_value['id'] if not logged_uids or uid in logged_uids: resource_name = pool.get(model_object.model).name_get(cr, uid, [res_id]) resource_name = resource_name and resource_name[0][1] or '' vals = { "method": ...
resource = resource_pool.read(cr, uid, res_id, args[0].keys()) vals = { "method": method, "object_id": model.id, "user_id": uid, "res_id": resource['id'], } if 'id' in resource: del resource['id'] log_id = log_pool.create(cr, uid, vals) lines = [] for field in resource: line = { 'name': field, 'new_value': resource[fie...
def log_fct(self, db, uid, object, method, fct_src, *args): """ Logging function: This function is performs logging oprations according to method @param db: the current database @param uid: the current user’s ID for security checks, @param object: Object who's values are being changed @param method: method to log: crea...
db704adb67985bd6eaad8c1dd3c5eac480aaa2ec /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/db704adb67985bd6eaad8c1dd3c5eac480aaa2ec/audittrail.py
if method in ('write'): res_ids = args[0] for res_id in res_ids: old_values = pool.get(model_object.model).read(cr, uid, res_id, args[1].keys()) old_values_text = {} for field in args[1].keys(): old_values_text[field] = self.get_value_text(cr, uid, field, old_values[field], model_object) res = fct_src(db, uid, object, ...
elif method in ('read'):
def log_fct(self, db, uid, object, method, fct_src, *args): """ Logging function: This function is performs logging oprations according to method @param db: the current database @param uid: the current user’s ID for security checks, @param object: Object who's values are being changed @param method: method to log: crea...
db704adb67985bd6eaad8c1dd3c5eac480aaa2ec /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/db704adb67985bd6eaad8c1dd3c5eac480aaa2ec/audittrail.py
res = fct_src(db, uid, object, method, *args)
res = fct_src(db, uid, model.model, method, *args)
def log_fct(self, db, uid, object, method, fct_src, *args): """ Logging function: This function is performs logging oprations according to method @param db: the current database @param uid: the current user’s ID for security checks, @param object: Object who's values are being changed @param method: method to log: crea...
db704adb67985bd6eaad8c1dd3c5eac480aaa2ec /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/db704adb67985bd6eaad8c1dd3c5eac480aaa2ec/audittrail.py
def log_fct(self, db, uid, object, method, fct_src, *args): """ Logging function: This function is performs logging oprations according to method @param db: the current database @param uid: the current user’s ID for security checks, @param object: Object who's values are being changed @param method: method to log: crea...
db704adb67985bd6eaad8c1dd3c5eac480aaa2ec /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/db704adb67985bd6eaad8c1dd3c5eac480aaa2ec/audittrail.py
if not logged_uids or uid in logged_uids: resource_name = pool.get(model_object.model).name_get(cr, uid, [res_id]) resource_name = resource_name and resource_name[0][1] or '' id = pool.get('audittrail.log').create(cr, uid, {"method": method, "object_id": model_object.id, "user_id": uid, "res_id": res_id, "name": resour...
vals = { "method": method, "object_id": model.id, "user_id": uid, "res_id": res_id, } log_id = log_pool.create(cr, uid, vals) lines = [] for field in old_values[res_id]: line = { 'name': field, 'old_value': old_values[res_id][field], 'old_value_text': self.get_value_text(cr, uid, field, old_values[res_id][field], mode...
def log_fct(self, db, uid, object, method, fct_src, *args): """ Logging function: This function is performs logging oprations according to method @param db: the current database @param uid: the current user’s ID for security checks, @param object: Object who's values are being changed @param method: method to log: crea...
db704adb67985bd6eaad8c1dd3c5eac480aaa2ec /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/db704adb67985bd6eaad8c1dd3c5eac480aaa2ec/audittrail.py
if method in ('unlink'):
elif method in ('unlink'):
def log_fct(self, db, uid, object, method, fct_src, *args): """ Logging function: This function is performs logging oprations according to method @param db: the current database @param uid: the current user’s ID for security checks, @param object: Object who's values are being changed @param method: method to log: crea...
db704adb67985bd6eaad8c1dd3c5eac480aaa2ec /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/db704adb67985bd6eaad8c1dd3c5eac480aaa2ec/audittrail.py
old_values[res_id] = pool.get(model_object.model).read(cr, uid, res_id, [])
old_values[res_id] = resource_pool.read(cr, uid, res_id)
def log_fct(self, db, uid, object, method, fct_src, *args): """ Logging function: This function is performs logging oprations according to method @param db: the current database @param uid: the current user’s ID for security checks, @param object: Object who's values are being changed @param method: method to log: crea...
db704adb67985bd6eaad8c1dd3c5eac480aaa2ec /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/db704adb67985bd6eaad8c1dd3c5eac480aaa2ec/audittrail.py
if not logged_uids or uid in logged_uids: resource_name = pool.get(model_object.model).name_get(cr, uid, [res_id]) resource_name = resource_name and resource_name[0][1] or '' id = pool.get('audittrail.log').create(cr, uid, {"method": method, "object_id": model_object.id, "user_id": uid, "res_id": res_id, "name": resour...
vals = { "method": method, "object_id": model.id, "user_id": uid, "res_id": res_id, } log_id = log_pool.create(cr, uid, vals) lines = [] for field in old_values[res_id]: if field in ('id'): continue line = { 'name': field, 'old_value': old_values[res_id][field], 'old_value_text': self.get_value_text(cr, uid, field, ol...
def log_fct(self, db, uid, object, method, fct_src, *args): """ Logging function: This function is performs logging oprations according to method @param db: the current database @param uid: the current user’s ID for security checks, @param object: Object who's values are being changed @param method: method to log: crea...
db704adb67985bd6eaad8c1dd3c5eac480aaa2ec /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/db704adb67985bd6eaad8c1dd3c5eac480aaa2ec/audittrail.py
for field in old_values[res_id]: if old_values[res_id][field]: line = { 'name': field, 'old_value': old_values[res_id][field], 'old_value_text': self.get_value_text(cr, uid, field, old_values[res_id][field], model_object) } lines.append(line) cr.commit() self.create_log_line(cr, uid, id, model_object, lines) res = fct_...
for field in resource.keys(): line = { 'name': field, 'new_value': resource[field], 'old_value': old_values[resource_id]['value'][field], 'new_value_text': self.get_value_text(cr, uid, field, resource[field], model), 'old_value_text': old_values[resource_id]['text'][field] } lines.append(line) self.create_log_line(cr,...
def log_fct(self, db, uid, object, method, fct_src, *args): """ Logging function: This function is performs logging oprations according to method @param db: the current database @param uid: the current user’s ID for security checks, @param object: Object who's values are being changed @param method: method to log: crea...
db704adb67985bd6eaad8c1dd3c5eac480aaa2ec /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/db704adb67985bd6eaad8c1dd3c5eac480aaa2ec/audittrail.py
cr.close() def execute(self, db, uid, object, method, *args, **kw):
return True def execute(self, db, uid, model, method, *args, **kw):
def log_fct(self, db, uid, object, method, fct_src, *args): """ Logging function: This function is performs logging oprations according to method @param db: the current database @param uid: the current user’s ID for security checks, @param object: Object who's values are being changed @param method: method to log: crea...
db704adb67985bd6eaad8c1dd3c5eac480aaa2ec /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/db704adb67985bd6eaad8c1dd3c5eac480aaa2ec/audittrail.py
@param method: method to log: create, read, write, unlink @return: Returns result as per method of Object proxy """
@param method: get any method and create log @return: Returns result as per method of Object proxy """ pool = pooler.get_pool(db) model_pool = pool.get('ir.model') rule_pool = pool.get('audittrail.rule') cr = pooler.get_db(db).cursor() cr.autocommit(True) logged_uids = [] fct_src = super(audittrail_objects_proxy, self...
def execute(self, db, uid, object, method, *args, **kw): """ Overrides Object Proxy execute method @param db: the current database @param uid: the current user’s ID for security checks, @param object: Object who's values are being changed @param method: method to log: create, read, write, unlink @return: Returns resul...
db704adb67985bd6eaad8c1dd3c5eac480aaa2ec /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/db704adb67985bd6eaad8c1dd3c5eac480aaa2ec/audittrail.py
fct_src = super(audittrail_objects_proxy, self).execute def my_fct(db, uid, object, method, *args): field = method rule = False obj_ids = pool.get('ir.model').search(cr, uid, [('model', '=', object)]) for obj_name in pool.obj_list(): if obj_name == 'audittrail.rule': rule = True if not rule: return fct_src(db, uid, ob...
fct_src = super(audittrail_objects_proxy, self).exec_workflow field = method rule = False model_pool = pool.get('ir.model') rule_pool = pool.get('audittrail.rule') model_ids = model_pool.search(cr, uid, [('model', '=', model)]) for obj_name in pool.obj_list(): if obj_name == 'audittrail.rule': rule = True if not rule: ...
def execute(self, db, uid, object, method, *args, **kw): """ Overrides Object Proxy execute method @param db: the current database @param uid: the current user’s ID for security checks, @param object: Object who's values are being changed @param method: method to log: create, read, write, unlink @return: Returns resul...
db704adb67985bd6eaad8c1dd3c5eac480aaa2ec /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/db704adb67985bd6eaad8c1dd3c5eac480aaa2ec/audittrail.py
return res
return True
def my_fct(db, uid, object, method, *args): field = method rule = False obj_ids = pool.get('ir.model').search(cr, uid, [('model', '=', object)]) for obj_name in pool.obj_list(): if obj_name == 'audittrail.rule': rule = True if not rule: return fct_src(db, uid, object, method, *args) if not obj_ids: return fct_src(db, u...
db704adb67985bd6eaad8c1dd3c5eac480aaa2ec /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/db704adb67985bd6eaad8c1dd3c5eac480aaa2ec/audittrail.py
def default_vat_check(cn, vn): # by default, a VAT number is valid if: # it starts with 2 letters # has more than 3 characters return cn[0] in string.ascii_lowercase and cn[1] in string.ascii_lowercase
1394a3272fefe6dd7f4fefe67cbedf3a27118ae5 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/1394a3272fefe6dd7f4fefe67cbedf3a27118ae5/base_vat.py
if int(vat[7:10]) > 121: return False
def check_vat_it(self, vat): ''' Check Italy VAT number. ''' if len(vat) != 11: return False try: int(vat) except: return False if int(vat[0:7]) <= 0: return False if int(vat[7:10]) <= 0: return False if int(vat[7:10]) > 100 and int(vat[7:10]) < 120: return False if int(vat[7:10]) > 121: return False
1394a3272fefe6dd7f4fefe67cbedf3a27118ae5 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/1394a3272fefe6dd7f4fefe67cbedf3a27118ae5/base_vat.py
return source cr = frame.f_locals.get('cr') try: lang = (frame.f_locals.get('context') or {}).get('lang', False) if not (cr and lang): args = frame.f_locals.get('args',False) if args: lang = args[-1].get('lang',False) if frame.f_globals.get('pooler',False): cr = pooler.get_db(frame.f_globals['pooler'].pool_dic.keys()[...
logger.warn('translation went wrong for string %s', repr(source)) finally: if is_new_cr: cr.close() return res
def __call__(self, source): try: frame = inspect.stack()[1][0] except: return source
34577af85f3d9b2a4f578e66cf47d86e5de7a3aa /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/34577af85f3d9b2a4f578e66cf47d86e5de7a3aa/translate.py
help="Total of Prospect Registrations"),
help="Total of Prospect Registrati./event/event.py:41:ons"),
def write(self, cr, uid, ids, vals, context=None): """ Writes values in one or several fields. @param ids: List of Event registration type's IDs @param vals: dictionary with values to update. @return: True """ register_pool = self.pool.get('event.registration') res = super(event_event, self).write(cr, uid, ids, vals, c...
54e6589b272a82a0b1d1c2963f27837ff52f3066 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/54e6589b272a82a0b1d1c2963f27837ff52f3066/event.py
(_check_recursion, 'Error ! You cannot create recursive event.', ['parent_id'])
(_check_recursion, 'Error ! You cannot create recursive event.', ['parent_id']), (_check_closing_date, 'Error ! Closing Date cannot be set before Beginning Date.', ['date_end']),
def _check_recursion(self, cr, uid, ids): """ Checks for recursion level for event """ level = 100
54e6589b272a82a0b1d1c2963f27837ff52f3066 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/54e6589b272a82a0b1d1c2963f27837ff52f3066/event.py
prod_obj = self.pool.get('product.template') location_obj = self.pool.get('stock.location') lot_obj = self.pool.get('stock.report.prodlots') move_obj = self.pool.get('account.move') move_line_obj = self.pool.get('account.move.line') data_obj = self.pool.get('ir.model.data') res = self.read(cr, uid, ids[0], ['new_price...
assert rec_id, _('Active ID is not set in Context') prod_obj = self.pool.get('product.product') res = self.browse(cr, uid, ids) datas = { 'new_price' : res[0].new_price, 'stock_output_account' : res[0].stock_account_output.id, 'stock_input_account' : res[0].stock_account_input.id, 'stock_journal' : res[0].stock_journal...
def change_price(self, cr, uid, ids, context): """ Changes the Standard Price of Product. And creates an account move accordingly. @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param ids: List of IDs selected @param context: A standard dictionary @return...
e069d37fb1a47c9278cf9be48d42e11174e93f5a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/e069d37fb1a47c9278cf9be48d42e11174e93f5a/stock_change_standard_price.py
return {}
return {}
def change_price(self, cr, uid, ids, context): """ Changes the Standard Price of Product. And creates an account move accordingly. @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param ids: List of IDs selected @param context: A standard dictionary @return...
e069d37fb1a47c9278cf9be48d42e11174e93f5a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/e069d37fb1a47c9278cf9be48d42e11174e93f5a/stock_change_standard_price.py
def draft_validate(self, cr, uid, ids, *args):
def draft_validate(self, cr, uid, ids, context=None):
def draft_validate(self, cr, uid, ids, *args): """ Validates picking directly from draft state. @return: True """ wf_service = netsvc.LocalService("workflow") self.draft_force_assign(cr, uid, ids) for pick in self.browse(cr, uid, ids): move_ids = [x.id for x in pick.move_lines] self.pool.get('stock.move').force_assign(...
cff45072e7024a39ec3df798a8103499e8f412c0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/cff45072e7024a39ec3df798a8103499e8f412c0/stock.py
self.action_move(cr, uid, [pick.id]) wf_service.trg_validate(uid, 'stock.picking', pick.id, 'button_done', cr) return True
context.update({'active_ids':ids}) return { 'name': 'Make Picking', 'view_type': 'form', 'view_mode': 'form', 'res_model': 'stock.partial.picking', 'type': 'ir.actions.act_window', 'target': 'new', 'nodestroy': True, 'context':context }
def draft_validate(self, cr, uid, ids, *args): """ Validates picking directly from draft state. @return: True """ wf_service = netsvc.LocalService("workflow") self.draft_force_assign(cr, uid, ids) for pick in self.browse(cr, uid, ids): move_ids = [x.id for x in pick.move_lines] self.pool.get('stock.move').force_assign(...
cff45072e7024a39ec3df798a8103499e8f412c0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/cff45072e7024a39ec3df798a8103499e8f412c0/stock.py
WHERE emp.id IN %s', (tuple(parent_ids),)) parent_ids = [x[0] for x in cr.fetchall() if x[0]]
WHERE emp.id IN %s AND res.user_id IS NOT NULL', (tuple(parent_ids),)) parent_ids = [x[0] for x in cr.fetchall()]
def _parent_compute(self, cr, uid, ids, name, args, context=None): if context is None: context = {} result = {} obj_dept = self.pool.get('hr.department') for user_id in ids: emp_ids = self.pool.get('hr.employee').search(cr, uid, [('user_id', '=', user_id)], context=context) cr.execute('SELECT emp.department_id FROM hr_...
7d9d5287846fb261b6844229d4bf17cbf87e18b1 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/7d9d5287846fb261b6844229d4bf17cbf87e18b1/hr_department.py
cols = intersect(self._inherit_fields.keys(), set(fields_to_read) - set(self._columns.keys()))
cols = [x for x in intersect(self._inherit_fields.keys(), fields_to_read) if x not in self._columns.keys()]
def convert_field(f): f_qual = "%s.%s" % (self._table, f) # need fully-qualified references in case len(tables) > 1 if f in ('create_date', 'write_date'): return "date_trunc('second', %s) as %s" % (f_qual, f) if f == self.CONCURRENCY_CHECK_FIELD: if self._log_access: return "COALESCE(%s.write_date, %s.create_date, now(...
e15952531b7825b653b7fee6847170446715dab6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/e15952531b7825b653b7fee6847170446715dab6/orm.py
class record(yaml.YAMLObject): yaml_tag = u'!record' def __init__(self, model, id=None, attrs={}): self.model = model self.id = id self.attrs=attrs def __repr__(self): return '!record {model: %s, id: %s}:' % (str(self.model,), str(self.id,)) class workflow(yaml.YAMLObject): yaml_tag = u'!workflow' def __init__(self, ...
from tools import yaml_tag
def doc_createXElement(xdoc, tagName): e = xElement(tagName) e.ownerDocument = xdoc return e
06b12c0192ce16139fc7f80b193698cffb7b3a8b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/06b12c0192ce16139fc7f80b193698cffb7b3a8b/base_module_record.py
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 = ...
e235f2a631a9eaa1c957dbbe638c0d85c0e21040 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/e235f2a631a9eaa1c957dbbe638c0d85c0e21040/account_move_line.py
ids = ','.join([str(x) for x in context['periods']]) query = obj+".state<>'draft' AND "+obj+".period_id in (SELECT id from account_period WHERE fiscalyear_id in (%s) AND id in (%s)) %s %s" % (fiscalyear_clause, ids, where_move_state, where_move_lines_by_date)
if initial_bal: query = obj+".state<>'draft' AND "+obj+".period_id in (SELECT id from account_period WHERE fiscalyear_id in (%s) %s %s)" % (fiscalyear_clause, where_move_state, where_move_lines_by_date) period_ids = fiscalperiod_obj.search(cr, uid, [('id', 'in', context['periods'])], order='date_start', limit=1) if per...
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 = ...
e235f2a631a9eaa1c957dbbe638c0d85c0e21040 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/e235f2a631a9eaa1c957dbbe638c0d85c0e21040/account_move_line.py
def check_group(node): if node.get('groups'): groups = node.get('groups').split(',') access_pool = self.pool.get('ir.model.access') can_see = any(access_pool.check_groups(cr, user, group) for group in groups) if not can_see: node.set('invisible', '1') if 'attrs' in node.attrib: del(node.attrib['attrs']) #avoid making f...
211d9c1d79f825dfa396607c6d05f674e15f5941 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/211d9c1d79f825dfa396607c6d05f674e15f5941/orm.py
attrs['selection'] = relation._name_search(cr, user, '', dom, context=search_context, limit=None, name_get_uid=1)
attrs['selection'] = relation._name_search(cr, 1, '', dom, context=search_context, limit=None, name_get_uid=1)
def check_group(node): if node.get('groups'): groups = node.get('groups').split(',') access_pool = self.pool.get('ir.model.access') can_see = any(access_pool.check_groups(cr, user, group) for group in groups) if not can_see: node.set('invisible', '1') if 'attrs' in node.attrib: del(node.attrib['attrs']) #avoid making f...
211d9c1d79f825dfa396607c6d05f674e15f5941 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/211d9c1d79f825dfa396607c6d05f674e15f5941/orm.py
res.update({'trans_nbr':data['credit']})
res.update({'credit':data['credit']})
def default_get(self, cr, uid, fields, context=None): res = super(account_move_line_reconcile, self).default_get(cr, uid, fields, context=context) data = self.trans_rec_get(cr, uid, context['active_ids'], context) if 'trans_nbr' in fields: res.update({'trans_nbr':data['trans_nbr']}) if 'credit' in fields: res.update({'...
2deeca8f09cb50cfb2244c842522ba638a05f5ac /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/2deeca8f09cb50cfb2244c842522ba638a05f5ac/account_reconcile.py
res.update({'trans_nbr':data['debit']})
res.update({'debit':data['debit']})
def default_get(self, cr, uid, fields, context=None): res = super(account_move_line_reconcile, self).default_get(cr, uid, fields, context=context) data = self.trans_rec_get(cr, uid, context['active_ids'], context) if 'trans_nbr' in fields: res.update({'trans_nbr':data['trans_nbr']}) if 'credit' in fields: res.update({'...
2deeca8f09cb50cfb2244c842522ba638a05f5ac /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/2deeca8f09cb50cfb2244c842522ba638a05f5ac/account_reconcile.py
res.update({'trans_nbr':data['writeoff']})
res.update({'writeoff':data['writeoff']})
def default_get(self, cr, uid, fields, context=None): res = super(account_move_line_reconcile, self).default_get(cr, uid, fields, context=context) data = self.trans_rec_get(cr, uid, context['active_ids'], context) if 'trans_nbr' in fields: res.update({'trans_nbr':data['trans_nbr']}) if 'credit' in fields: res.update({'...
2deeca8f09cb50cfb2244c842522ba638a05f5ac /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/2deeca8f09cb50cfb2244c842522ba638a05f5ac/account_reconcile.py
'allounce':round(allow), 'deduction':round(deduct), 'grows':round(rs.basic + allow), 'net':round(rs.basic + allow - deduct),
'allounce':allow, 'deduction':deduct, 'grows':rs.basic + allow, 'net':rs.basic + allow - deduct,
def _calculate(self, cr, uid, ids, field_names, arg, context=None): slip_line_obj = self.pool.get('hr.payslip.line') if context is None: context = {} res = {} for rs in self.browse(cr, uid, ids, context=context): allow = 0.0 deduct = 0.0 others = 0.0 obj = {'basic':rs.basic} if rs.igross > 0: obj['gross'] = rs.igross i...
e0bd6974e23888d11f0954c282c2f73add98d1f2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/e0bd6974e23888d11f0954c282c2f73add98d1f2/hr_payroll.py
'total_pay':round(rs.basic + allow - deduct)
'total_pay':rs.basic + allow - deduct
def _calculate(self, cr, uid, ids, field_names, arg, context=None): slip_line_obj = self.pool.get('hr.payslip.line') if context is None: context = {} res = {} for rs in self.browse(cr, uid, ids, context=context): allow = 0.0 deduct = 0.0 others = 0.0 obj = {'basic':rs.basic} if rs.igross > 0: obj['gross'] = rs.igross i...
e0bd6974e23888d11f0954c282c2f73add98d1f2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/e0bd6974e23888d11f0954c282c2f73add98d1f2/hr_payroll.py
'basic_before_leaves': fields.float('Basic Salary', readonly=True, digits=(16, 2)), 'leaves': fields.float('Leave Deductions', readonly=True, digits=(16, 2)), 'basic': fields.float('Net Basic', readonly=True, digits=(16, 2)), 'grows': fields.function(_calculate, method=True, store=True, multi='dc', string='Gross Sal...
'basic_before_leaves': fields.float('Basic Salary', readonly=True, digits_compute=dp.get_precision('Account')), 'leaves': fields.float('Leave Deductions', readonly=True, digits_compute=dp.get_precision('Account')), 'basic': fields.float('Net Basic', readonly=True, digits_compute=dp.get_precision('Account')), 'grows'...
def _calculate(self, cr, uid, ids, field_names, arg, context=None): slip_line_obj = self.pool.get('hr.payslip.line') if context is None: context = {} res = {} for rs in self.browse(cr, uid, ids, context=context): allow = 0.0 deduct = 0.0 others = 0.0 obj = {'basic':rs.basic} if rs.igross > 0: obj['gross'] = rs.igross i...
e0bd6974e23888d11f0954c282c2f73add98d1f2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/e0bd6974e23888d11f0954c282c2f73add98d1f2/hr_payroll.py
'total': fields.float('Sub Total', readonly=True, digits=(16, 4)),
'total': fields.float('Sub Total', readonly=True, digits_compute=dp.get_precision('Account')),
def onchange_amount(self, cr, uid, ids, amount, typ): amt = amount if typ and typ == 'per': if int(amt) > 0: amt = amt / 100 return {'value':{'amount':amt}}
e0bd6974e23888d11f0954c282c2f73add98d1f2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/e0bd6974e23888d11f0954c282c2f73add98d1f2/hr_payroll.py
dataobj = self.pool.get('ir.model.data') data_id = dataobj._get_id(cr, 1, 'base', 'group_user')
data_pool = self.pool.get('ir.model.data') res = data_pool.get_object_reference(cr, 1, 'base', 'group_user') data_id = res and res[1] or False
def _get_group(self,cr, uid, context=None): dataobj = self.pool.get('ir.model.data') data_id = dataobj._get_id(cr, 1, 'base', 'group_user') return data_id and [data_id] or False
b153bdce7088c24acb75ba3de83ad1167ba68a08 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/b153bdce7088c24acb75ba3de83ad1167ba68a08/res_user.py
def _ca_invoiced_calc(self, cr, uid, ids, name, arg, context=None): res = {} parent_ids = tuple(self.search(cr, uid, [('parent_id', 'child_of', ids)])) if parent_ids: cr.execute("select account_analytic_line.account_id, COALESCE(sum(amount_currency),0.0) \ from account_analytic_line \ join account_analytic_journal \ on...
c5d41a033c771d541bb8180ab97ee58fb5b17bb5 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c5d41a033c771d541bb8180ab97ee58fb5b17bb5/account_analytic_analysis.py
def _total_cost_calc(self, cr, uid, ids, name, arg, context=None): res = {} parent_ids = tuple(self.search(cr, uid, [('parent_id', 'child_of', ids)])) if parent_ids: cr.execute("""select account_analytic_line.account_id,COALESCE(sum(amount_currency),0.0) \
c5d41a033c771d541bb8180ab97ee58fb5b17bb5 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c5d41a033c771d541bb8180ab97ee58fb5b17bb5/account_analytic_analysis.py
def _ca_theorical_calc(self, cr, uid, ids, name, arg, context=None): res = {} res2 = {} parent_ids = tuple(self.search(cr, uid, [('parent_id', 'child_of', ids)])) # Warning # This computation doesn't take care of pricelist ! # Just consider list_price if parent_ids: cr.execute("""select account_analytic_line.account_id...
c5d41a033c771d541bb8180ab97ee58fb5b17bb5 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c5d41a033c771d541bb8180ab97ee58fb5b17bb5/account_analytic_analysis.py
def _ca_theorical_calc(self, cr, uid, ids, name, arg, context=None): res = {} res2 = {} parent_ids = tuple(self.search(cr, uid, [('parent_id', 'child_of', ids)])) # Warning # This computation doesn't take care of pricelist ! # Just consider list_price if parent_ids: cr.execute("""select account_analytic_line.account_id...
c5d41a033c771d541bb8180ab97ee58fb5b17bb5 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c5d41a033c771d541bb8180ab97ee58fb5b17bb5/account_analytic_analysis.py
def _user(self, cr, uid, ids, name, arg, context=None): res = {} cr.execute('SELECT MAX(id) FROM res_users') max_user = cr.fetchone()[0] for id in ids: parent_ids = tuple(self.search(cr, uid, [('parent_id', 'child_of', ids)])) if parent_ids: cr.execute('SELECT DISTINCT("user") FROM account_analytic_analysis_summary_use...
c5d41a033c771d541bb8180ab97ee58fb5b17bb5 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c5d41a033c771d541bb8180ab97ee58fb5b17bb5/account_analytic_analysis.py
parent_ids = tuple(self.search(cr, uid, [('parent_id', 'child_of', account_ids)]))
parent_ids = tuple(account_obj.search(cr, uid, [('parent_id', 'child_of', account_ids)]))
def _unit_amount(self, cr, uid, ids, name, arg, context=None): res = {} account_obj = self.pool.get('account.analytic.account') cr.execute('SELECT MAX(id) FROM res_users') max_user = cr.fetchone()[0] account_ids = [int(str(x/max_user - (x%max_user == 0 and 1 or 0))) for x in ids] user_ids = [int(str(x-((x/max_user - (x...
c5d41a033c771d541bb8180ab97ee58fb5b17bb5 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c5d41a033c771d541bb8180ab97ee58fb5b17bb5/account_analytic_analysis.py
'AND "user" IN %s',(parent_ids, user_ids,))
'AND "user" IN %s',(parent_ids, tuple(user_ids),))
def _unit_amount(self, cr, uid, ids, name, arg, context=None): res = {} account_obj = self.pool.get('account.analytic.account') cr.execute('SELECT MAX(id) FROM res_users') max_user = cr.fetchone()[0] account_ids = [int(str(x/max_user - (x%max_user == 0 and 1 or 0))) for x in ids] user_ids = [int(str(x-((x/max_user - (x...
c5d41a033c771d541bb8180ab97ee58fb5b17bb5 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c5d41a033c771d541bb8180ab97ee58fb5b17bb5/account_analytic_analysis.py