rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
styles = reportlab.lib.styles.getSampleStyleSheet() style = styles['Normal'] style.__dict__.update(self._para_style_update(node))
style = self.default_style['Normal'] para_update = self._para_style_update(node) if para_update: style = copy.deepcopy(style) style.__dict__.update(para_update)
def para_style_get(self, node): style = False if node.get('style'): if node.get('style') in self.styles: styles = reportlab.lib.styles.getSampleStyleSheet() sname = node.get('style') style = reportlab.lib.styles.ParagraphStyle(sname, styles["Normal"], **self.styles[sname]) else: sys.stderr.write('Warning: style not found, %s - setting default!\n' % (node.get('style'),) ) if not style: styles = reportlab.lib.styles.getSampleStyleSheet() style = styles['Normal'] style.__dict__.update(self._para_style_update(node)) return style
1bfd4b60d0c9062ff808b28698b1b334ffd59186 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/1bfd4b60d0c9062ff808b28698b1b334ffd59186/trml2pdf.py
if not view_id and context.get('invoice_type', False):
if not view_id:
def fields_view_get(self, cr, uid, view_id=None, view_type=False, context=None, toolbar=False, submenu=False): if not view_id and context.get('invoice_type', False): mod_obj = self.pool.get('ir.model.data') if context.get('invoice_type') in ('out_invoice', 'out_refund'): result = mod_obj.get_object_reference(cr, uid, 'account_voucher', 'view_vendor_receipt_form') else: result = mod_obj.get_object_reference(cr, uid, 'account_voucher', 'view_vendor_payment_form') result = result and result[1] or False view_id = result res = super(account_voucher, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu) doc = etree.XML(res['arch']) nodes = doc.xpath("//field[@name='partner_id']") if context.get('type', 'sale') in ('purchase', 'payment'): for node in nodes: node.set('domain', "[('supplier', '=', True)]") res['arch'] = etree.tostring(doc) return res
72c6bc7ac5408996ee010a65afb7f57a35697c6e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/72c6bc7ac5408996ee010a65afb7f57a35697c6e/account_voucher.py
if context.get('invoice_type') in ('out_invoice', 'out_refund'):
if context.get('invoice_type', False) in ('out_invoice', 'out_refund') or context.get('line_type', False) == 'customer':
def fields_view_get(self, cr, uid, view_id=None, view_type=False, context=None, toolbar=False, submenu=False): if not view_id and context.get('invoice_type', False): mod_obj = self.pool.get('ir.model.data') if context.get('invoice_type') in ('out_invoice', 'out_refund'): result = mod_obj.get_object_reference(cr, uid, 'account_voucher', 'view_vendor_receipt_form') else: result = mod_obj.get_object_reference(cr, uid, 'account_voucher', 'view_vendor_payment_form') result = result and result[1] or False view_id = result res = super(account_voucher, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu) doc = etree.XML(res['arch']) nodes = doc.xpath("//field[@name='partner_id']") if context.get('type', 'sale') in ('purchase', 'payment'): for node in nodes: node.set('domain', "[('supplier', '=', True)]") res['arch'] = etree.tostring(doc) return res
72c6bc7ac5408996ee010a65afb7f57a35697c6e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/72c6bc7ac5408996ee010a65afb7f57a35697c6e/account_voucher.py
xml_id = 'action_invoice_tree5'
xml_id = 'action_invoice_tree1'
def _create_invoice(obj, cr, uid, data, context): if data['form'].get('new_picking', False): data['id'] = data['form']['new_picking'] data['ids'] = [data['form']['new_picking']] pool = pooler.get_pool(cr.dbname) picking_obj = pooler.get_pool(cr.dbname).get('stock.picking') mod_obj = pool.get('ir.model.data') act_obj = pool.get('ir.actions.act_window') type = data['form']['type'] context['date_inv'] = data['form']['invoice_date'] res = picking_obj.action_invoice_create(cr, uid, data['ids'], journal_id = data['form']['journal_id'], group=data['form']['group'], type=type, context= context) invoice_ids = res.values() if not invoice_ids: raise wizard.except_wizard(_('Error'), _('Invoice is not created')) if type == 'out_invoice': xml_id = 'action_invoice_tree5' elif type == 'in_invoice': xml_id = 'action_invoice_tree8' elif type == 'out_refund': xml_id = 'action_invoice_tree10' else: xml_id = 'action_invoice_tree12' result = mod_obj._get_id(cr, uid, 'account', xml_id) id = mod_obj.read(cr, uid, result, ['res_id']) result = act_obj.read(cr, uid, id['res_id']) result['res_id'] = invoice_ids return result
9465f58df63b1450858837a380ef993442a757d5 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/9465f58df63b1450858837a380ef993442a757d5/wizard_invoice_onshipping.py
xml_id = 'action_invoice_tree8'
xml_id = 'action_invoice_tree2'
def _create_invoice(obj, cr, uid, data, context): if data['form'].get('new_picking', False): data['id'] = data['form']['new_picking'] data['ids'] = [data['form']['new_picking']] pool = pooler.get_pool(cr.dbname) picking_obj = pooler.get_pool(cr.dbname).get('stock.picking') mod_obj = pool.get('ir.model.data') act_obj = pool.get('ir.actions.act_window') type = data['form']['type'] context['date_inv'] = data['form']['invoice_date'] res = picking_obj.action_invoice_create(cr, uid, data['ids'], journal_id = data['form']['journal_id'], group=data['form']['group'], type=type, context= context) invoice_ids = res.values() if not invoice_ids: raise wizard.except_wizard(_('Error'), _('Invoice is not created')) if type == 'out_invoice': xml_id = 'action_invoice_tree5' elif type == 'in_invoice': xml_id = 'action_invoice_tree8' elif type == 'out_refund': xml_id = 'action_invoice_tree10' else: xml_id = 'action_invoice_tree12' result = mod_obj._get_id(cr, uid, 'account', xml_id) id = mod_obj.read(cr, uid, result, ['res_id']) result = act_obj.read(cr, uid, id['res_id']) result['res_id'] = invoice_ids return result
9465f58df63b1450858837a380ef993442a757d5 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/9465f58df63b1450858837a380ef993442a757d5/wizard_invoice_onshipping.py
xml_id = 'action_invoice_tree10'
xml_id = 'action_invoice_tree3'
def _create_invoice(obj, cr, uid, data, context): if data['form'].get('new_picking', False): data['id'] = data['form']['new_picking'] data['ids'] = [data['form']['new_picking']] pool = pooler.get_pool(cr.dbname) picking_obj = pooler.get_pool(cr.dbname).get('stock.picking') mod_obj = pool.get('ir.model.data') act_obj = pool.get('ir.actions.act_window') type = data['form']['type'] context['date_inv'] = data['form']['invoice_date'] res = picking_obj.action_invoice_create(cr, uid, data['ids'], journal_id = data['form']['journal_id'], group=data['form']['group'], type=type, context= context) invoice_ids = res.values() if not invoice_ids: raise wizard.except_wizard(_('Error'), _('Invoice is not created')) if type == 'out_invoice': xml_id = 'action_invoice_tree5' elif type == 'in_invoice': xml_id = 'action_invoice_tree8' elif type == 'out_refund': xml_id = 'action_invoice_tree10' else: xml_id = 'action_invoice_tree12' result = mod_obj._get_id(cr, uid, 'account', xml_id) id = mod_obj.read(cr, uid, result, ['res_id']) result = act_obj.read(cr, uid, id['res_id']) result['res_id'] = invoice_ids return result
9465f58df63b1450858837a380ef993442a757d5 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/9465f58df63b1450858837a380ef993442a757d5/wizard_invoice_onshipping.py
xml_id = 'action_invoice_tree12'
xml_id = 'action_invoice_tree4'
def _create_invoice(obj, cr, uid, data, context): if data['form'].get('new_picking', False): data['id'] = data['form']['new_picking'] data['ids'] = [data['form']['new_picking']] pool = pooler.get_pool(cr.dbname) picking_obj = pooler.get_pool(cr.dbname).get('stock.picking') mod_obj = pool.get('ir.model.data') act_obj = pool.get('ir.actions.act_window') type = data['form']['type'] context['date_inv'] = data['form']['invoice_date'] res = picking_obj.action_invoice_create(cr, uid, data['ids'], journal_id = data['form']['journal_id'], group=data['form']['group'], type=type, context= context) invoice_ids = res.values() if not invoice_ids: raise wizard.except_wizard(_('Error'), _('Invoice is not created')) if type == 'out_invoice': xml_id = 'action_invoice_tree5' elif type == 'in_invoice': xml_id = 'action_invoice_tree8' elif type == 'out_refund': xml_id = 'action_invoice_tree10' else: xml_id = 'action_invoice_tree12' result = mod_obj._get_id(cr, uid, 'account', xml_id) id = mod_obj.read(cr, uid, result, ['res_id']) result = act_obj.read(cr, uid, id['res_id']) result['res_id'] = invoice_ids return result
9465f58df63b1450858837a380ef993442a757d5 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/9465f58df63b1450858837a380ef993442a757d5/wizard_invoice_onshipping.py
partner_id = partner_rec.id or False
partner_id = partner.id or False
def make_po(self, cr, uid, ids, context={}): """ Make purchase order from procurement @return: New created Purchase Orders procurement wise """ res = {} company = self.pool.get('res.users').browse(cr, uid, uid, context).company_id partner_obj = self.pool.get('res.partner') uom_obj = self.pool.get('product.uom') pricelist_obj = self.pool.get('product.pricelist') prod_obj = self.pool.get('product.product') acc_pos_obj = self.pool.get('account.fiscal.position') po_obj = self.pool.get('purchase.order') for procurement in self.browse(cr, uid, ids): res_id = procurement.move_id.id partner_list = sorted([(partner_id.sequence, partner_id) for partner_id in procurement.product_id.seller_ids if partner_id]) partner_rec = partner_list and partner_list[0] and partner_list[0][1] or False partner = partner_rec.name or False partner_id = partner_rec.id or False address_id = partner_obj.address_get(cr, uid, [partner_id], ['delivery'])['delivery'] pricelist_id = partner.property_product_pricelist_purchase.id
b43768931986ad245f285eac36d08c6dce1ea460 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/b43768931986ad245f285eac36d08c6dce1ea460/purchase.py
self.log(cr, uid, lead.id,
leads.log(cr, uid, lead.id,
def action_apply(self, cr, uid, ids, context=None): """ This converts lead to opportunity and opens Opportunity view @param ids: ids of the leads to convert to opportunities
c2c55d4ddca94d5c6d0e55c14b12acd4b8cd6bf0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c2c55d4ddca94d5c6d0e55c14b12acd4b8cd6bf0/crm_lead_to_opportunity.py
avg(extract('epoch' from (date_closed-c.create_date)))/3600 as delay_close
avg(extract('epoch' from (date_closed-c.create_date)))/(3600*24) as delay_close
def init(self, cr): """ Display Est.Revenue , Average Probability ,Est.Revenue Probability @param cr: the current row, from the database cursor """
94286586e358b95a5e7ad0ed70528b090428707b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/94286586e358b95a5e7ad0ed70528b090428707b/crm_opportunity_report.py
self.write(cr, uid, [t.id], {'state': 'open', 'date_start': time.strftime('%Y-%m-%d %H:%M:%S'),})
data = {'state': 'open'} if not t.date_start: data['date_start'] = time.strftime('%Y-%m-%d %H:%M:%S') self.write(cr, uid, [t.id], data)
def do_open(self, cr, uid, ids, *args): tasks= self.browse(cr,uid,ids) for t in tasks: self.write(cr, uid, [t.id], {'state': 'open', 'date_start': time.strftime('%Y-%m-%d %H:%M:%S'),}) message = _('Task ') + " '" + t.name + "' "+ _("is Open.") self.log(cr, uid, t.id, message) return True
12ca3adb5157b08fef65b4b692b747f895eeb645 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/12ca3adb5157b08fef65b4b692b747f895eeb645/project.py
new_ids = [] if (data['model'] == 'account.account'): new_ids = 'active_ids' in data['form']['context'] and data['form']['context']['active_ids'] or [] else: new_ids.append(data['form']['chart_account_id'])
new_ids = ids if (data['model'] == 'ir.ui.menu'): new_ids = [data['form']['chart_account_id']]
def set_context(self, objects, data, ids, report_type=None): self.borne_date = self.get_min_date(data['form']) new_ids = [] if (data['model'] == 'account.account'): new_ids = 'active_ids' in data['form']['context'] and data['form']['context']['active_ids'] or [] else: new_ids.append(data['form']['chart_account_id']) objects = self.pool.get('account.account').browse(self.cr, self.uid, new_ids) super(general_ledger, self).set_context(objects, data, new_ids, report_type)
c2b97a42a63e5100202e2a5e25db7331c63b73b5 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c2b97a42a63e5100202e2a5e25db7331c63b73b5/general_ledger.py
'product_uos_qty': uos_qty, 'state': move.state,
'product_uos_qty': uos_qty, 'state': move.state,
def consume_moves(self, cr, uid, ids, quantity, location_id=False, location_dest_id=False, consume=True, context=None): if not context: context = {} if quantity <= 0: raise osv.except_osv(_('Warning!'), _('Please provide Proper Quantity !'))
57b92258d91762c1152280783171e1fcfb8afdcb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/57b92258d91762c1152280783171e1fcfb8afdcb/stock.py
default_val.update({'location_dest_id':location_dest_id})
default_val.update({'location_dest_id': location_dest_id})
def consume_moves(self, cr, uid, ids, quantity, location_id=False, location_dest_id=False, consume=True, context=None): if not context: context = {} if quantity <= 0: raise osv.except_osv(_('Warning!'), _('Please provide Proper Quantity !'))
57b92258d91762c1152280783171e1fcfb8afdcb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/57b92258d91762c1152280783171e1fcfb8afdcb/stock.py
default_val.update({'location_id':location_id})
default_val.update({'location_id': location_id})
def consume_moves(self, cr, uid, ids, quantity, location_id=False, location_dest_id=False, consume=True, context=None): if not context: context = {} if quantity <= 0: raise osv.except_osv(_('Warning!'), _('Please provide Proper Quantity !'))
57b92258d91762c1152280783171e1fcfb8afdcb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/57b92258d91762c1152280783171e1fcfb8afdcb/stock.py
update_val['product_uos_qty'] = uos_qty_rest
update_val['product_uos_qty'] = uos_qty_rest if location_dest_id: update_val.update({'location_dest_id': location_dest_id}) if location_id: update_val.update({'location_id': location_id})
def consume_moves(self, cr, uid, ids, quantity, location_id=False, location_dest_id=False, consume=True, context=None): if not context: context = {} if quantity <= 0: raise osv.except_osv(_('Warning!'), _('Please provide Proper Quantity !'))
57b92258d91762c1152280783171e1fcfb8afdcb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/57b92258d91762c1152280783171e1fcfb8afdcb/stock.py
class report_products_to_received_planned(osv.osv): _name = "report.products.to.received.planned" _description = "Received Products vs Planned" _auto = False _columns = { 'date':fields.date('Date'), 'qty': fields.float('Actual Qty', digits_compute=dp.get_precision('Product UoM')), 'planned_qty': fields.float('Planned Qty', digits_compute=dp.get_precision('Product UoM')), } def init(self, cr): tools.drop_view_if_exists(cr, 'report_products_to_received_planned') cr.execute(""" create or replace view report_products_to_received_planned as ( select stock.create_date as date, min(stock.id) as id, sum(stock.product_qty) as qty, 0 as planned_qty from stock_picking picking inner join stock_move stock on picking.id = stock.picking_id and picking.type = 'in' where stock.create_date between (select cast(date_trunc('week', current_date) as date)) and (select cast(date_trunc('week', current_date) as date) + 7) group by stock.create_date union select stock.date as date , min(stock.id) as id, 0 as actual_qty, sum(stock.product_qty) as planned_qty from stock_picking picking inner join stock_move stock on picking.id = stock.picking_id and picking.type = 'in' where stock.date between (select cast(date_trunc('week', current_date) as date)) and (select cast(date_trunc('week', current_date) as date) + 7) group by stock.date ) """) report_products_to_received_planned() class report_delivery_products_planned(osv.osv): _name = "report.delivery.products.planned" _description = "Delivered products vs Planned" _auto = False _columns = { 'date':fields.date('Date'), 'qty': fields.float('Actual Qty', digits_compute=dp.get_precision('Product UoM')), 'planned_qty': fields.float('Planned Qty', digits_compute=dp.get_precision('Product UoM')), } def init(self, cr): tools.drop_view_if_exists(cr, 'report_delivery_products_planned') cr.execute(""" create or replace view report_delivery_products_planned as ( select stock.create_date as date, min(stock.id) as id, sum(stock.product_qty) as qty, 0 as planned_qty from stock_picking picking inner join stock_move stock on picking.id = stock.picking_id and picking.type = 'out' where stock.create_date between (select cast(date_trunc('week', current_date) as date)) and (select cast(date_trunc('week', current_date) as date) + 7) group by stock.create_date union select stock.date as date, min(stock.id), 0 as actual_qty, sum(stock.product_qty) as planned_qty from stock_picking picking inner join stock_move stock on picking.id = stock.picking_id and picking.type = 'out' where stock.date between (select cast(date_trunc('week', current_date) as date)) and (select cast(date_trunc('week', current_date) as date) + 7) group by stock.date ) """) report_delivery_products_planned()
def action_move(self, cr, uid, ids, context=None): move_obj = self.pool.get('stock.move') picking_obj = self.pool.get('stock.picking') account_move_obj = self.pool.get('account.move') for act in self.read(cr, uid, ids): move_lines = move_obj.browse(cr, uid, act['move_ids']) for line in move_lines: if line.picking_id: picking_obj.write(cr, uid, [line.picking_id.id], {'move_lines': [(1, line.id, {'picking_id': act['picking_id']})]}) picking_obj.write(cr, uid, [act['picking_id']], {'move_lines': [(1, line.id, {'picking_id': act['picking_id']})]}) old_picking = picking_obj.read(cr, uid, [line.picking_id.id])[0] if not len(old_picking['move_lines']): picking_obj.write(cr, uid, [old_picking['id']], {'state': 'done'}) else: raise osv.except_osv(_('UserError'), _('You can not create new moves.')) return {'type': 'ir.actions.act_window_close'}
29f101668dae52eba19a58e9f1a35634488c9edd /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/29f101668dae52eba19a58e9f1a35634488c9edd/stock.py
def fields_get(self, cr, uid, fields=None, context=None): res = super(payment_line, self).fields_get(cr, uid, fields, context) if 'communication2' in res: res['communication2'].setdefault('states', {}) res['communication2']['states']['structured'] = [('readonly', True)] res['communication2']['states']['normal'] = [('readonly', False)] return res
99c52b7b8b7b09fa4736619f5bb23b2a694d81ab /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/99c52b7b8b7b09fa4736619f5bb23b2a694d81ab/account_payment.py
FROM res_partner,account_move_line AS l, account_account\
FROM res_partner,account_move_line AS l, account_account, account_move am\
def _get_lines(self, form): res = [] self.cr.execute('SELECT DISTINCT res_partner.id AS id,\ res_partner.name AS name \ FROM res_partner,account_move_line AS l, account_account\ WHERE (l.account_id=account_account.id) \ AND ((reconcile_id IS NULL)\ OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\ AND (l.partner_id=res_partner.id)\ AND ' + self.query + ' \ ORDER BY res_partner.name', (self.date_from,)) partners = self.cr.dictfetchall() ## mise a 0 du total for i in range(7): self.total_account.append(0) # # Build a string like (1,2,3) for easy use in SQL query partner_ids = [x['id'] for x in partners] if not partner_ids: return [] # This dictionary will store the debit-credit for all partners, using partner_id as key. move_state = ['draft','posted'] if self.target_move == 'posted': move_state = ['posted']
e33b0323f7d3bcc8461ccb90e8996b9fa5978836 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/e33b0323f7d3bcc8461ccb90e8996b9fa5978836/account_aged_partner_balance.py
OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\
OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\
def _get_lines(self, form): res = [] self.cr.execute('SELECT DISTINCT res_partner.id AS id,\ res_partner.name AS name \ FROM res_partner,account_move_line AS l, account_account\ WHERE (l.account_id=account_account.id) \ AND ((reconcile_id IS NULL)\ OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\ AND (l.partner_id=res_partner.id)\ AND ' + self.query + ' \ ORDER BY res_partner.name', (self.date_from,)) partners = self.cr.dictfetchall() ## mise a 0 du total for i in range(7): self.total_account.append(0) # # Build a string like (1,2,3) for easy use in SQL query partner_ids = [x['id'] for x in partners] if not partner_ids: return [] # This dictionary will store the debit-credit for all partners, using partner_id as key. move_state = ['draft','posted'] if self.target_move == 'posted': move_state = ['posted']
e33b0323f7d3bcc8461ccb90e8996b9fa5978836 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/e33b0323f7d3bcc8461ccb90e8996b9fa5978836/account_aged_partner_balance.py
ORDER BY res_partner.name', (self.date_from,))
ORDER BY res_partner.name', (tuple(move_state), tuple(self.ACCOUNT_TYPE), self.date_from, self.date_from,))
def _get_lines(self, form): res = [] self.cr.execute('SELECT DISTINCT res_partner.id AS id,\ res_partner.name AS name \ FROM res_partner,account_move_line AS l, account_account\ WHERE (l.account_id=account_account.id) \ AND ((reconcile_id IS NULL)\ OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\ AND (l.partner_id=res_partner.id)\ AND ' + self.query + ' \ ORDER BY res_partner.name', (self.date_from,)) partners = self.cr.dictfetchall() ## mise a 0 du total for i in range(7): self.total_account.append(0) # # Build a string like (1,2,3) for easy use in SQL query partner_ids = [x['id'] for x in partners] if not partner_ids: return [] # This dictionary will store the debit-credit for all partners, using partner_id as key. move_state = ['draft','posted'] if self.target_move == 'posted': move_state = ['posted']
e33b0323f7d3bcc8461ccb90e8996b9fa5978836 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/e33b0323f7d3bcc8461ccb90e8996b9fa5978836/account_aged_partner_balance.py
move_state = ['draft','posted'] if self.target_move == 'posted': move_state = ['posted']
def _get_lines(self, form): res = [] self.cr.execute('SELECT DISTINCT res_partner.id AS id,\ res_partner.name AS name \ FROM res_partner,account_move_line AS l, account_account\ WHERE (l.account_id=account_account.id) \ AND ((reconcile_id IS NULL)\ OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\ AND (l.partner_id=res_partner.id)\ AND ' + self.query + ' \ ORDER BY res_partner.name', (self.date_from,)) partners = self.cr.dictfetchall() ## mise a 0 du total for i in range(7): self.total_account.append(0) # # Build a string like (1,2,3) for easy use in SQL query partner_ids = [x['id'] for x in partners] if not partner_ids: return [] # This dictionary will store the debit-credit for all partners, using partner_id as key. move_state = ['draft','posted'] if self.target_move == 'posted': move_state = ['posted']
e33b0323f7d3bcc8461ccb90e8996b9fa5978836 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/e33b0323f7d3bcc8461ccb90e8996b9fa5978836/account_aged_partner_balance.py
GROUP BY l.partner_id ', (tuple(move_state), tuple(self.ACCOUNT_TYPE), tuple(partner_ids), self.date_from))
AND (l.date <= %s)\ GROUP BY l.partner_id ', (tuple(move_state), tuple(self.ACCOUNT_TYPE), tuple(partner_ids), self.date_from, self.date_from,))
def _get_lines(self, form): res = [] self.cr.execute('SELECT DISTINCT res_partner.id AS id,\ res_partner.name AS name \ FROM res_partner,account_move_line AS l, account_account\ WHERE (l.account_id=account_account.id) \ AND ((reconcile_id IS NULL)\ OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\ AND (l.partner_id=res_partner.id)\ AND ' + self.query + ' \ ORDER BY res_partner.name', (self.date_from,)) partners = self.cr.dictfetchall() ## mise a 0 du total for i in range(7): self.total_account.append(0) # # Build a string like (1,2,3) for easy use in SQL query partner_ids = [x['id'] for x in partners] if not partner_ids: return [] # This dictionary will store the debit-credit for all partners, using partner_id as key. move_state = ['draft','posted'] if self.target_move == 'posted': move_state = ['posted']
e33b0323f7d3bcc8461ccb90e8996b9fa5978836 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/e33b0323f7d3bcc8461ccb90e8996b9fa5978836/account_aged_partner_balance.py
GROUP BY l.partner_id', (tuple(move_state), tuple(self.ACCOUNT_TYPE), self.date_from, tuple(partner_ids),self.date_from))
AND (l.date <= %s)\ GROUP BY l.partner_id', (tuple(move_state), tuple(self.ACCOUNT_TYPE), self.date_from, tuple(partner_ids),self.date_from, self.date_from,))
def _get_lines(self, form): res = [] self.cr.execute('SELECT DISTINCT res_partner.id AS id,\ res_partner.name AS name \ FROM res_partner,account_move_line AS l, account_account\ WHERE (l.account_id=account_account.id) \ AND ((reconcile_id IS NULL)\ OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\ AND (l.partner_id=res_partner.id)\ AND ' + self.query + ' \ ORDER BY res_partner.name', (self.date_from,)) partners = self.cr.dictfetchall() ## mise a 0 du total for i in range(7): self.total_account.append(0) # # Build a string like (1,2,3) for easy use in SQL query partner_ids = [x['id'] for x in partners] if not partner_ids: return [] # This dictionary will store the debit-credit for all partners, using partner_id as key. move_state = ['draft','posted'] if self.target_move == 'posted': move_state = ['posted']
e33b0323f7d3bcc8461ccb90e8996b9fa5978836 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/e33b0323f7d3bcc8461ccb90e8996b9fa5978836/account_aged_partner_balance.py
GROUP BY l.partner_id', (tuple(move_state), tuple(self.ACCOUNT_TYPE), self.date_from, tuple(partner_ids), self.date_from))
AND (l.date <= %s)\ GROUP BY l.partner_id', (tuple(move_state), tuple(self.ACCOUNT_TYPE), self.date_from, tuple(partner_ids), self.date_from, self.date_from,))
def _get_lines(self, form): res = [] self.cr.execute('SELECT DISTINCT res_partner.id AS id,\ res_partner.name AS name \ FROM res_partner,account_move_line AS l, account_account\ WHERE (l.account_id=account_account.id) \ AND ((reconcile_id IS NULL)\ OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\ AND (l.partner_id=res_partner.id)\ AND ' + self.query + ' \ ORDER BY res_partner.name', (self.date_from,)) partners = self.cr.dictfetchall() ## mise a 0 du total for i in range(7): self.total_account.append(0) # # Build a string like (1,2,3) for easy use in SQL query partner_ids = [x['id'] for x in partners] if not partner_ids: return [] # This dictionary will store the debit-credit for all partners, using partner_id as key. move_state = ['draft','posted'] if self.target_move == 'posted': move_state = ['posted']
e33b0323f7d3bcc8461ccb90e8996b9fa5978836 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/e33b0323f7d3bcc8461ccb90e8996b9fa5978836/account_aged_partner_balance.py
self.cr.execute('SELECT l.partner_id, SUM(l.debit-l.credit)\ FROM account_move_line AS l, account_account, account_move am \ WHERE (l.account_id = account_account.id) AND (l.move_id=am.id)\ AND (am.state IN %s)\ AND (account_account.type IN %s)\ AND (l.partner_id IN %s)\ AND ((l.reconcile_id IS NULL)\ OR (l.reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\ AND '+ self.query + '\ AND account_account.active\ AND ' + dates_query + '\ GROUP BY l.partner_id', args_list)
args_list += (self.date_from,) self.cr.execute('''SELECT l.partner_id, SUM(l.debit-l.credit) FROM account_move_line AS l, account_account, account_move am WHERE (l.account_id = account_account.id) AND (l.move_id=am.id) AND (am.state IN %s) AND (account_account.type IN %s) AND (l.partner_id IN %s) AND ((l.reconcile_id IS NULL) OR (l.reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s ))) AND ''' + self.query + ''' AND account_account.active AND ''' + dates_query + ''' AND (l.date <= %s) GROUP BY l.partner_id''', args_list)
def _get_lines(self, form): res = [] self.cr.execute('SELECT DISTINCT res_partner.id AS id,\ res_partner.name AS name \ FROM res_partner,account_move_line AS l, account_account\ WHERE (l.account_id=account_account.id) \ AND ((reconcile_id IS NULL)\ OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\ AND (l.partner_id=res_partner.id)\ AND ' + self.query + ' \ ORDER BY res_partner.name', (self.date_from,)) partners = self.cr.dictfetchall() ## mise a 0 du total for i in range(7): self.total_account.append(0) # # Build a string like (1,2,3) for easy use in SQL query partner_ids = [x['id'] for x in partners] if not partner_ids: return [] # This dictionary will store the debit-credit for all partners, using partner_id as key. move_state = ['draft','posted'] if self.target_move == 'posted': move_state = ['posted']
e33b0323f7d3bcc8461ccb90e8996b9fa5978836 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/e33b0323f7d3bcc8461ccb90e8996b9fa5978836/account_aged_partner_balance.py
if values['total']: res.append(values)
res.append(values)
def _get_lines(self, form): res = [] self.cr.execute('SELECT DISTINCT res_partner.id AS id,\ res_partner.name AS name \ FROM res_partner,account_move_line AS l, account_account\ WHERE (l.account_id=account_account.id) \ AND ((reconcile_id IS NULL)\ OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\ AND (l.partner_id=res_partner.id)\ AND ' + self.query + ' \ ORDER BY res_partner.name', (self.date_from,)) partners = self.cr.dictfetchall() ## mise a 0 du total for i in range(7): self.total_account.append(0) # # Build a string like (1,2,3) for easy use in SQL query partner_ids = [x['id'] for x in partners] if not partner_ids: return [] # This dictionary will store the debit-credit for all partners, using partner_id as key. move_state = ['draft','posted'] if self.target_move == 'posted': move_state = ['posted']
e33b0323f7d3bcc8461ccb90e8996b9fa5978836 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/e33b0323f7d3bcc8461ccb90e8996b9fa5978836/account_aged_partner_balance.py
AND account_account.active ',(tuple(move_state), tuple(self.ACCOUNT_TYPE), self.date_from))
AND (l.date <= %s)\ AND account_account.active ',(tuple(move_state), tuple(self.ACCOUNT_TYPE), self.date_from, self.date_from,))
def _get_lines_with_out_partner(self, form): res = [] move_state = ['draft','posted'] if self.target_move == 'posted': move_state = ['posted']
e33b0323f7d3bcc8461ccb90e8996b9fa5978836 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/e33b0323f7d3bcc8461ccb90e8996b9fa5978836/account_aged_partner_balance.py
args_list += (self.date_from,)
def _get_lines_with_out_partner(self, form): res = [] move_state = ['draft','posted'] if self.target_move == 'posted': move_state = ['posted']
e33b0323f7d3bcc8461ccb90e8996b9fa5978836 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/e33b0323f7d3bcc8461ccb90e8996b9fa5978836/account_aged_partner_balance.py
def _sheet_search(self, cursor, user, obj, name, args):
def _sheet_search(self, cursor, user, obj, name, args, context={}):
def _sheet_search(self, cursor, user, obj, name, args): if not len(args): return [] sheet_obj = self.pool.get('hr_timesheet_sheet.sheet')
1e8622118905179e2a1f665dabe44d0abad15b4c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/1e8622118905179e2a1f665dabe44d0abad15b4c/hr_timesheet_sheet.py
AND s.user_id = e.user_id) ' + \
AND s.user_id = r.user_id) ' + \
def _sheet_search(self, cursor, user, obj, name, args): if not len(args): return [] sheet_obj = self.pool.get('hr_timesheet_sheet.sheet')
1e8622118905179e2a1f665dabe44d0abad15b4c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/1e8622118905179e2a1f665dabe44d0abad15b4c/hr_timesheet_sheet.py
os.system('python2.5 %sopenerp-server.py --pidfile=openerp.pid --port=%s --net_port=%s --addons-path=%s' %(root_path, str(port),str(netport),addons_path))
os.system('python2.5 %sopenerp-server.py --pidfile=openerp.pid --xmlrpc-port=%s --netrpc-port=%s --addons-path=%s' %(root_path, str(port),str(netport),addons_path))
def start_server(root_path, port, netport, addons_path): os.system('python2.5 %sopenerp-server.py --pidfile=openerp.pid --port=%s --net_port=%s --addons-path=%s' %(root_path, str(port),str(netport),addons_path))
c56c8c6db9e7536e91571d409e23b60d87cb8b20 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c56c8c6db9e7536e91571d409e23b60d87cb8b20/base_quality_interrogation.py
return True
def process_wi_email(self, cr, uid, activity, workitem, context=None): print 'Sending Email Init', activity.name return self.pool.get('email.template').generate_mail(cr, uid, activity.email_template_id.id, [workitem.res_id], context=context)
0f3b579a54684ac68f156d36ac8a311ff74bb684 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/0f3b579a54684ac68f156d36ac8a311ff74bb684/marketing_campaign.py
avil_id = obj.pool.get(value._name).search(cr, uid, [('id','=',value.id)], context=context)
avil_id = obj.pool.get(value._name).exists(cr, uid, value.id)
def _fnct_read(self, obj, cr, uid, ids, prop_name, obj_dest, context=None): properties = obj.pool.get('ir.property') domain = [('fields_id.model', '=', obj._name), ('fields_id.name','in',prop_name)] domain += [('res_id','in', [obj._name + ',' + str(oid) for oid in ids])] nids = properties.search(cr, uid, domain, context=context) default_val,replaces = self._get_defaults(obj, cr, uid, prop_name, context)
7b37895c7f7d807cbf33f3b495ccadb92286965d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/7b37895c7f7d807cbf33f3b495ccadb92286965d/fields.py
return pooler.get_pool(cr.dbname).get('decimal.precision').precision_get(cr, 1, application)
res = pooler.get_pool(cr.dbname).get('decimal.precision').precision_get(cr, 1, application) return (16, res)
def change_digit(cr): return pooler.get_pool(cr.dbname).get('decimal.precision').precision_get(cr, 1, application)
ed42755ea7120cebb121e1be429a8896cc3ddee3 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/ed42755ea7120cebb121e1be429a8896cc3ddee3/decimal_precision.py
"AND debit > 0",
"AND debit > 0 " \ "ORDER BY date_maturity",
def reconcile(self, cr, uid, ids, context=None): move_line_obj = self.pool.get('account.move.line') obj_model = self.pool.get('ir.model.data') if context is None: context = {} form = self.read(cr, uid, ids, [])[0] max_amount = form.get('max_amount', False) and form.get('max_amount') or 0.0 power = form['power'] allow_write_off = form['allow_write_off'] reconciled = unreconciled = 0 if not form['account_ids']: raise osv.except_osv(_('UserError'), _('You must select accounts to reconcile')) for account_id in form['account_ids']: params = (account_id,) if not allow_write_off: query = """SELECT partner_id FROM account_move_line WHERE account_id=%s AND reconcile_id IS NULL AND state <> 'draft' GROUP BY partner_id HAVING ABS(SUM(debit-credit)) = 0.0 AND count(*)>0""" else: query = """SELECT partner_id FROM account_move_line WHERE account_id=%s AND reconcile_id IS NULL AND state <> 'draft' GROUP BY partner_id HAVING ABS(SUM(debit-credit)) < %s AND count(*)>0""" params += (max_amount,) # reconcile automatically all transactions from partners whose balance is 0 cr.execute(query, params) partner_ids = [id for (id,) in cr.fetchall()] for partner_id in partner_ids: cr.execute( "SELECT id " \ "FROM account_move_line " \ "WHERE account_id=%s " \ "AND partner_id=%s " \ "AND state <> 'draft' " \ "AND reconcile_id IS NULL", (account_id, partner_id)) line_ids = [id for (id,) in cr.fetchall()] if len(line_ids): reconciled += len(line_ids) if allow_write_off: move_line_obj.reconcile(cr, uid, line_ids, 'auto', form['writeoff_acc_id'], form['period_id'], form['journal_id'], context) else: move_line_obj.reconcile_partial(cr, uid, line_ids, 'manual', context={})
f2e0e0ead91cbd385adb2972c2382d4381de95d6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/f2e0e0ead91cbd385adb2972c2382d4381de95d6/account_automatic_reconcile.py
"AND credit > 0",
"AND credit > 0 " \ "ORDER BY date_maturity",
def reconcile(self, cr, uid, ids, context=None): move_line_obj = self.pool.get('account.move.line') obj_model = self.pool.get('ir.model.data') if context is None: context = {} form = self.read(cr, uid, ids, [])[0] max_amount = form.get('max_amount', False) and form.get('max_amount') or 0.0 power = form['power'] allow_write_off = form['allow_write_off'] reconciled = unreconciled = 0 if not form['account_ids']: raise osv.except_osv(_('UserError'), _('You must select accounts to reconcile')) for account_id in form['account_ids']: params = (account_id,) if not allow_write_off: query = """SELECT partner_id FROM account_move_line WHERE account_id=%s AND reconcile_id IS NULL AND state <> 'draft' GROUP BY partner_id HAVING ABS(SUM(debit-credit)) = 0.0 AND count(*)>0""" else: query = """SELECT partner_id FROM account_move_line WHERE account_id=%s AND reconcile_id IS NULL AND state <> 'draft' GROUP BY partner_id HAVING ABS(SUM(debit-credit)) < %s AND count(*)>0""" params += (max_amount,) # reconcile automatically all transactions from partners whose balance is 0 cr.execute(query, params) partner_ids = [id for (id,) in cr.fetchall()] for partner_id in partner_ids: cr.execute( "SELECT id " \ "FROM account_move_line " \ "WHERE account_id=%s " \ "AND partner_id=%s " \ "AND state <> 'draft' " \ "AND reconcile_id IS NULL", (account_id, partner_id)) line_ids = [id for (id,) in cr.fetchall()] if len(line_ids): reconciled += len(line_ids) if allow_write_off: move_line_obj.reconcile(cr, uid, line_ids, 'auto', form['writeoff_acc_id'], form['period_id'], form['journal_id'], context) else: move_line_obj.reconcile_partial(cr, uid, line_ids, 'manual', context={})
f2e0e0ead91cbd385adb2972c2382d4381de95d6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/f2e0e0ead91cbd385adb2972c2382d4381de95d6/account_automatic_reconcile.py
success = self.pool.get('hr.employee').attendance_action_change(cr, uid, [emp_id], 'sign_in')
self.pool.get('hr.employee').attendance_action_change(cr, uid, [emp_id], 'sign_in')
def sign_in(self, cr, uid, data, context=None): if context is None: context = {} emp_id = data['emp_id'] if 'last_time' in data: if data['last_time'] > time.strftime('%Y-%m-%d %H:%M:%S'): raise osv.except_osv(_('UserError'), _('The sign-out date must be in the past')) self.pool.get('hr.attendance').create(cr, uid, {'name': data['last_time'], 'action': 'sign_out', 'employee_id': emp_id}, context=context) try: success = self.pool.get('hr.employee').attendance_action_change(cr, uid, [emp_id], 'sign_in') except: raise osv.except_osv(_('UserError'), _('A sign-in must be right after a sign-out !')) return {} # To do: Return Success message
2b91fe5af5923076446397ef22909797db97f37f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/2b91fe5af5923076446397ef22909797db97f37f/hr_attendance_sign_in_out.py
success = self.pool.get('hr.employee').attendance_action_change(cr, uid, [emp_id], 'sign_out')
self.pool.get('hr.employee').attendance_action_change(cr, uid, [emp_id], 'sign_out')
def sign_out(self, cr, uid, data, context=None): emp_id = data['emp_id'] if 'last_time' in data: if data['last_time'] > time.strftime('%Y-%m-%d %H:%M:%S'): raise osv.except_osv(_('UserError'), _('The Sign-in date must be in the past')) self.pool.get('hr.attendance').create(cr, uid, {'name':data['last_time'], 'action':'sign_in', 'employee_id':emp_id}, context=context) try: success = self.pool.get('hr.employee').attendance_action_change(cr, uid, [emp_id], 'sign_out') except: raise osv.except_osv(_('UserError'), _('A sign-out must be right after a sign-in !')) return {} # To do: Return Success message
2b91fe5af5923076446397ef22909797db97f37f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/2b91fe5af5923076446397ef22909797db97f37f/hr_attendance_sign_in_out.py
elif re.match('^h([1-9]+[0-9]*)$', (node.text or '')):
elif re.match('^h([1-9]+[0-9]*)$', (node.tag or '')):
def _flowable(self, node, extra_style=None): if node.tag=='para': style = self.styles.para_style_get(node) if extra_style: style.__dict__.update(extra_style) result = [] for i in self._textual(node).split('\n'): result.append(platypus.Paragraph(i, style, **(utils.attr_get(node, [], {'bulletText':'str'})))) return result elif node.tag=='barCode': try: from reportlab.graphics.barcode import code128 from reportlab.graphics.barcode import code39 from reportlab.graphics.barcode import code93 from reportlab.graphics.barcode import common from reportlab.graphics.barcode import fourstate from reportlab.graphics.barcode import usps except Exception, e: return None args = utils.attr_get(node, [], {'ratio':'float','xdim':'unit','height':'unit','checksum':'int','quiet':'int','width':'unit','stop':'bool','bearers':'int','barWidth':'float','barHeight':'float'}) codes = { 'codabar': lambda x: common.Codabar(x, **args), 'code11': lambda x: common.Code11(x, **args), 'code128': lambda x: code128.Code128(x, **args), 'standard39': lambda x: code39.Standard39(x, **args), 'standard93': lambda x: code93.Standard93(x, **args), 'i2of5': lambda x: common.I2of5(x, **args), 'extended39': lambda x: code39.Extended39(x, **args), 'extended93': lambda x: code93.Extended93(x, **args), 'msi': lambda x: common.MSI(x, **args), 'fim': lambda x: usps.FIM(x, **args), 'postnet': lambda x: usps.POSTNET(x, **args), } code = 'code128' if node.get('code'): code = node.get('code').lower() return codes[code](self._textual(node)) elif node.tag=='name': self.styles.names[ node.get('id')] = node.get('value') return None elif node.tag=='xpre': style = self.styles.para_style_get(node) return platypus.XPreformatted(self._textual(node), style, **(utils.attr_get(node, [], {'bulletText':'str','dedent':'int','frags':'int'}))) elif node.tag=='pre': style = self.styles.para_style_get(node) return platypus.Preformatted(self._textual(node), style, **(utils.attr_get(node, [], {'bulletText':'str','dedent':'int'}))) elif node.tag=='illustration': return self._illustration(node) elif node.tag=='blockTable': return self._table(node) elif node.tag=='title': styles = reportlab.lib.styles.getSampleStyleSheet() style = styles['Title'] return platypus.Paragraph(self._textual(node), style, **(utils.attr_get(node, [], {'bulletText':'str'}))) elif re.match('^h([1-9]+[0-9]*)$', (node.text or '')): styles = reportlab.lib.styles.getSampleStyleSheet() style = styles['Heading'+str(node.get[1:])] return platypus.Paragraph(self._textual(node), style, **(utils.attr_get(node, [], {'bulletText':'str'}))) elif node.tag=='image': if not node.get('file'): if node.get('name'): image_data = self.doc.images[node.get('name')].read() else: import base64 if self.localcontext: newtext = utils._process_text(self, node.text or '') node.text = newtext image_data = base64.decodestring(node.text) if not image_data: return False image = cStringIO.StringIO(image_data) return platypus.Image(image, mask=(250,255,250,255,250,255), **(utils.attr_get(node, ['width','height']))) else: return platypus.Image(node.get('file'), mask=(250,255,250,255,250,255), **(utils.attr_get(node, ['width','height']))) from reportlab.lib.utils import ImageReader name = str(node.get('file')) img = ImageReader(name) (sx,sy) = img.getSize() args = {} for tag in ('width','height'): if node.get(tag): args[tag] = utils.unit_get(node.get(tag)) if ('width' in args) and (not 'height' in args): args['height'] = sy * args['width'] / sx elif ('height' in args) and (not 'width' in args): args['width'] = sx * args['height'] / sy elif ('width' in args) and ('height' in args): if (float(args['width'])/args['height'])>(float(sx)>sy): args['width'] = sx * args['height'] / sy else: args['height'] = sy * args['width'] / sx return platypus.Image(name, mask=(250,255,250,255,250,255), **args) elif node.tag=='spacer': if node.get('width'): width = utils.unit_get(node.get('width')) else: width = utils.unit_get('1cm') length = utils.unit_get(node.get('length')) return platypus.Spacer(width=width, height=length) elif node.tag=='section': return self.render(node) elif node.tag == 'pageNumberReset': return PageReset() elif node.tag in ('pageBreak', 'nextPage'): return platypus.PageBreak() elif node.tag=='condPageBreak': return platypus.CondPageBreak(**(utils.attr_get(node, ['height']))) elif node.tag=='setNextTemplate': return platypus.NextPageTemplate(str(node.get('name'))) elif node.tag=='nextFrame': return platypus.CondPageBreak(1000) # TODO: change the 1000 ! elif node.tag == 'setNextFrame': from reportlab.platypus.doctemplate import NextFrameFlowable return NextFrameFlowable(str(node.get('name'))) elif node.tag == 'currentFrame': from reportlab.platypus.doctemplate import CurrentFrameFlowable return CurrentFrameFlowable(str(node.get('name'))) elif node.tag == 'frameEnd': return EndFrameFlowable() elif node.tag == 'hr': width_hr=node.get('width') or '100%' color_hr=node.get('color') or 'black' thickness_hr=node.get('thickness') or 1 lineCap_hr=node.get('lineCap') or 'round' return platypus.flowables.HRFlowable(width=width_hr,color=color.get(color_hr),thickness=float(thickness_hr),lineCap=str(lineCap_hr)) else: sys.stderr.write('Warning: flowable not yet implemented: %s !\n' % (node.tag,)) return None
9f0fdbdc528dc6371c29fc03f7dfd8b6115de9be /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/9f0fdbdc528dc6371c29fc03f7dfd8b6115de9be/trml2pdf.py
style = styles['Heading'+str(node.get[1:])]
style = styles['Heading'+str(node.tag[1:])]
def _flowable(self, node, extra_style=None): if node.tag=='para': style = self.styles.para_style_get(node) if extra_style: style.__dict__.update(extra_style) result = [] for i in self._textual(node).split('\n'): result.append(platypus.Paragraph(i, style, **(utils.attr_get(node, [], {'bulletText':'str'})))) return result elif node.tag=='barCode': try: from reportlab.graphics.barcode import code128 from reportlab.graphics.barcode import code39 from reportlab.graphics.barcode import code93 from reportlab.graphics.barcode import common from reportlab.graphics.barcode import fourstate from reportlab.graphics.barcode import usps except Exception, e: return None args = utils.attr_get(node, [], {'ratio':'float','xdim':'unit','height':'unit','checksum':'int','quiet':'int','width':'unit','stop':'bool','bearers':'int','barWidth':'float','barHeight':'float'}) codes = { 'codabar': lambda x: common.Codabar(x, **args), 'code11': lambda x: common.Code11(x, **args), 'code128': lambda x: code128.Code128(x, **args), 'standard39': lambda x: code39.Standard39(x, **args), 'standard93': lambda x: code93.Standard93(x, **args), 'i2of5': lambda x: common.I2of5(x, **args), 'extended39': lambda x: code39.Extended39(x, **args), 'extended93': lambda x: code93.Extended93(x, **args), 'msi': lambda x: common.MSI(x, **args), 'fim': lambda x: usps.FIM(x, **args), 'postnet': lambda x: usps.POSTNET(x, **args), } code = 'code128' if node.get('code'): code = node.get('code').lower() return codes[code](self._textual(node)) elif node.tag=='name': self.styles.names[ node.get('id')] = node.get('value') return None elif node.tag=='xpre': style = self.styles.para_style_get(node) return platypus.XPreformatted(self._textual(node), style, **(utils.attr_get(node, [], {'bulletText':'str','dedent':'int','frags':'int'}))) elif node.tag=='pre': style = self.styles.para_style_get(node) return platypus.Preformatted(self._textual(node), style, **(utils.attr_get(node, [], {'bulletText':'str','dedent':'int'}))) elif node.tag=='illustration': return self._illustration(node) elif node.tag=='blockTable': return self._table(node) elif node.tag=='title': styles = reportlab.lib.styles.getSampleStyleSheet() style = styles['Title'] return platypus.Paragraph(self._textual(node), style, **(utils.attr_get(node, [], {'bulletText':'str'}))) elif re.match('^h([1-9]+[0-9]*)$', (node.text or '')): styles = reportlab.lib.styles.getSampleStyleSheet() style = styles['Heading'+str(node.get[1:])] return platypus.Paragraph(self._textual(node), style, **(utils.attr_get(node, [], {'bulletText':'str'}))) elif node.tag=='image': if not node.get('file'): if node.get('name'): image_data = self.doc.images[node.get('name')].read() else: import base64 if self.localcontext: newtext = utils._process_text(self, node.text or '') node.text = newtext image_data = base64.decodestring(node.text) if not image_data: return False image = cStringIO.StringIO(image_data) return platypus.Image(image, mask=(250,255,250,255,250,255), **(utils.attr_get(node, ['width','height']))) else: return platypus.Image(node.get('file'), mask=(250,255,250,255,250,255), **(utils.attr_get(node, ['width','height']))) from reportlab.lib.utils import ImageReader name = str(node.get('file')) img = ImageReader(name) (sx,sy) = img.getSize() args = {} for tag in ('width','height'): if node.get(tag): args[tag] = utils.unit_get(node.get(tag)) if ('width' in args) and (not 'height' in args): args['height'] = sy * args['width'] / sx elif ('height' in args) and (not 'width' in args): args['width'] = sx * args['height'] / sy elif ('width' in args) and ('height' in args): if (float(args['width'])/args['height'])>(float(sx)>sy): args['width'] = sx * args['height'] / sy else: args['height'] = sy * args['width'] / sx return platypus.Image(name, mask=(250,255,250,255,250,255), **args) elif node.tag=='spacer': if node.get('width'): width = utils.unit_get(node.get('width')) else: width = utils.unit_get('1cm') length = utils.unit_get(node.get('length')) return platypus.Spacer(width=width, height=length) elif node.tag=='section': return self.render(node) elif node.tag == 'pageNumberReset': return PageReset() elif node.tag in ('pageBreak', 'nextPage'): return platypus.PageBreak() elif node.tag=='condPageBreak': return platypus.CondPageBreak(**(utils.attr_get(node, ['height']))) elif node.tag=='setNextTemplate': return platypus.NextPageTemplate(str(node.get('name'))) elif node.tag=='nextFrame': return platypus.CondPageBreak(1000) # TODO: change the 1000 ! elif node.tag == 'setNextFrame': from reportlab.platypus.doctemplate import NextFrameFlowable return NextFrameFlowable(str(node.get('name'))) elif node.tag == 'currentFrame': from reportlab.platypus.doctemplate import CurrentFrameFlowable return CurrentFrameFlowable(str(node.get('name'))) elif node.tag == 'frameEnd': return EndFrameFlowable() elif node.tag == 'hr': width_hr=node.get('width') or '100%' color_hr=node.get('color') or 'black' thickness_hr=node.get('thickness') or 1 lineCap_hr=node.get('lineCap') or 'round' return platypus.flowables.HRFlowable(width=width_hr,color=color.get(color_hr),thickness=float(thickness_hr),lineCap=str(lineCap_hr)) else: sys.stderr.write('Warning: flowable not yet implemented: %s !\n' % (node.tag,)) return None
9f0fdbdc528dc6371c29fc03f7dfd8b6115de9be /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/9f0fdbdc528dc6371c29fc03f7dfd8b6115de9be/trml2pdf.py
'res.partner':(_get_partners, ['free_member', 'membership_state'], 10)
'res.partner':(_get_partners, ['free_member', 'membership_state','associate_member'], 10)
def _get_partners(self, cr, uid, ids, context={}): ids2 = ids while ids2: ids2 = self.search(cr, uid, [('associate_member','in',ids2)], context=context) ids+=ids2 return ids
7b5002c8cdaef6d61ad3e703de9807399b8eea97 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/7b5002c8cdaef6d61ad3e703de9807399b8eea97/membership.py
self.logger.log(severity, msg)
def _tag_assert(self, cr, rec, data_node=None): if self.isnoupdate(data_node) and self.mode != 'init': return
4236d93ba505d6771af5373d91ff8d7499622a3c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/4236d93ba505d6771af5373d91ff8d7499622a3c/convert.py
self.logger.log(severity, msg)
def __getitem__(self2, key): if key in brrec: return brrec[key] return dict.__getitem__(self2, key)
4236d93ba505d6771af5373d91ff8d7499622a3c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/4236d93ba505d6771af5373d91ff8d7499622a3c/convert.py
data = {} domain = [('type', '=', stage_type),('section_ids', '=', case.section_id.id)] if case.section_id and case.section_id.stage_ids: domain.append(('id', 'in', map(lambda x: x.id, case.section_id.stage_ids)))
value = {} if case.section_id.id : domain = [('type', '=', stage_type),('section_ids', '=', case.section_id.id)] else : domain = [('type', '=', stage_type)]
def stage_change(self, cr, uid, ids, context=None, order='sequence'): if not context: context = {} stage_pool = self.pool.get('crm.case.stage') stage_type = context and context.get('stage_type','') current_seq = False next_stage_id = False for case in self.browse(cr, uid, ids, context): next_stage = False data = {}
cf13a034f3fe74dbfb01445b84dedc8d9537c58e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/cf13a034f3fe74dbfb01445b84dedc8d9537c58e/crm.py
data = {'stage_id': next_stage.id}
value.update({'stage_id': next_stage.id})
def stage_change(self, cr, uid, ids, context=None, order='sequence'): if not context: context = {} stage_pool = self.pool.get('crm.case.stage') stage_type = context and context.get('stage_type','') current_seq = False next_stage_id = False for case in self.browse(cr, uid, ids, context): next_stage = False data = {}
cf13a034f3fe74dbfb01445b84dedc8d9537c58e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/cf13a034f3fe74dbfb01445b84dedc8d9537c58e/crm.py
data.update({'probability': next_stage.probability}) self.write(cr, uid, [case.id], data, context=context)
value.update({'probability': next_stage.probability}) self.write(cr, uid, [case.id], value, context=context)
def stage_change(self, cr, uid, ids, context=None, order='sequence'): if not context: context = {} stage_pool = self.pool.get('crm.case.stage') stage_type = context and context.get('stage_type','') current_seq = False next_stage_id = False for case in self.browse(cr, uid, ids, context): next_stage = False data = {}
cf13a034f3fe74dbfb01445b84dedc8d9537c58e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/cf13a034f3fe74dbfb01445b84dedc8d9537c58e/crm.py
return next_stage_id
return next_stage_id
def stage_change(self, cr, uid, ids, context=None, order='sequence'): if not context: context = {} stage_pool = self.pool.get('crm.case.stage') stage_type = context and context.get('stage_type','') current_seq = False next_stage_id = False for case in self.browse(cr, uid, ids, context): next_stage = False data = {}
cf13a034f3fe74dbfb01445b84dedc8d9537c58e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/cf13a034f3fe74dbfb01445b84dedc8d9537c58e/crm.py
def _get_payment_term_lines(term_id, amount): term_pool = self.pool.get('account.payment.term') if term_id and amount: terms = term_pool.compute(cr, uid, term_id, amount) return terms return False
d8a9ad298a1f08b31fd3f3b8c03397ed26a6244e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/d8a9ad298a1f08b31fd3f3b8c03397ed26a6244e/voucher.py
if debit < 0: credit = -debit debit = 0.0 if credit < 0: debit = -credit credit = 0.0
def _get_payment_term_lines(term_id, amount): term_pool = self.pool.get('account.payment.term') if term_id and amount: terms = term_pool.compute(cr, uid, term_id, amount) return terms return False
d8a9ad298a1f08b31fd3f3b8c03397ed26a6244e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/d8a9ad298a1f08b31fd3f3b8c03397ed26a6244e/voucher.py
if inv.tax_amount > 0:
if inv.tax_amount:
def _get_payment_term_lines(term_id, amount): term_pool = self.pool.get('account.payment.term') if term_id and amount: terms = term_pool.compute(cr, uid, term_id, amount) return terms return False
d8a9ad298a1f08b31fd3f3b8c03397ed26a6244e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/d8a9ad298a1f08b31fd3f3b8c03397ed26a6244e/voucher.py
if inv.journal_id.type in ('sale','purchase_refund'):
if inv.journal_id.type in ('sale','purchase_refund') and amount > 0:
def _get_payment_term_lines(term_id, amount): term_pool = self.pool.get('account.payment.term') if term_id and amount: terms = term_pool.compute(cr, uid, term_id, amount) return terms return False
d8a9ad298a1f08b31fd3f3b8c03397ed26a6244e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/d8a9ad298a1f08b31fd3f3b8c03397ed26a6244e/voucher.py
return super(Wiki, self).copy_data(cr, uid, id, {'wiki_id': False}, context)
return super(wiki_wiki2, self).copy_data(cr, uid, id, {'wiki_id': False}, context)
def copy_data(self, cr, uid, id, default=None, context=None):
e7837995a5fa985e5381ef0804ed93e6255c2235 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/e7837995a5fa985e5381ef0804ed93e6255c2235/wiki.py
def __getattr__(self, attr): if not attr.startswith('check_vat_'): super(res_partner, self).__getattr__(attr) def default_vat_check(self, cn, vn): # by default, a VAT number is valid if: # it starts with 2 letters # has more than 3 characters return len(vn) > 0 and len(cn) == 2 and cn[0] in string.ascii_lowercase and cn[1] in string.ascii_lowercase
cf02511aa3f6773c0e040c0e548442ca88027dcd /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/cf02511aa3f6773c0e040c0e548442ca88027dcd/partner.py
def vat_change(self, cr, uid, ids, value, context={}): return {'value': {'vat_subjected': bool(value)}}
cf02511aa3f6773c0e040c0e548442ca88027dcd /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/cf02511aa3f6773c0e040c0e548442ca88027dcd/partner.py
def check_vat_se(self, vat): ''' Check Sweden VAT number. ''' if len(vat) != 12: return False try: int(vat) except: return False
cf02511aa3f6773c0e040c0e548442ca88027dcd /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/cf02511aa3f6773c0e040c0e548442ca88027dcd/partner.py
def check_vat_se(self, vat): ''' Check Sweden VAT number. ''' if len(vat) != 12: return False try: int(vat) except: return False
cf02511aa3f6773c0e040c0e548442ca88027dcd /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/cf02511aa3f6773c0e040c0e548442ca88027dcd/partner.py
employee_ids=employee_obj.search(cr, uid, [('parent_id','=',employee.id)], context=context)
def onchange_employee_id(self, cr, uid, ids, employee_id, context=None): if context is None: context = {} evaluation_plan_id=False if employee_id: employee_obj=self.pool.get('hr.employee') for employee in employee_obj.browse(cr, uid, [employee_id], context=context): if employee and employee.evaluation_plan_id and employee.evaluation_plan_id.id: evaluation_plan_id=employee.evaluation_plan_id.id employee_ids=employee_obj.search(cr, uid, [('parent_id','=',employee.id)], context=context) return {'value': {'plan_id':evaluation_plan_id}}
74dc9a43786b367b0c8508e2cf1c46ad50d31e4c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/74dc9a43786b367b0c8508e2cf1c46ad50d31e4c/hr_evaluation.py
apprai_id = []
def button_plan_in_progress(self, cr, uid, ids, context=None): hr_eval_inter_obj = self.pool.get('hr.evaluation.interview') if context is None: context = {} apprai_id = [] for evaluation in self.browse(cr, uid, ids, context=context): wait = False for phase in evaluation.plan_id.phase_ids: childs = [] if phase.action == "bottom-up": childs = evaluation.employee_id.child_ids elif phase.action in ("top-down", "final"): if evaluation.employee_id.parent_id: childs = [evaluation.employee_id.parent_id] elif phase.action == "self": childs = [evaluation.employee_id] for child in childs:
74dc9a43786b367b0c8508e2cf1c46ad50d31e4c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/74dc9a43786b367b0c8508e2cf1c46ad50d31e4c/hr_evaluation.py
res = {}.fromkeys(ids, [])
res = dict([(i, []) for i in ids])
def _fnct_read(self, obj, cr, uid, ids, field_name, args, context=None): self._field_get2(cr, uid, obj, context) if not ids: return {} relation = obj._name if self._type in ('one2many', 'many2many'): res = {}.fromkeys(ids, []) else: res = {}.fromkeys(ids, False)
6acee33b4ea931747895c373cd0b3c352d95f372 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/6acee33b4ea931747895c373cd0b3c352d95f372/fields.py
def msg_new(self, cr, uid, msg, model): print ' MSG NEW' , model
def msg_new(self, cr, uid, msg, model):
def msg_new(self, cr, uid, msg, model): print ' MSG NEW' , model message = self.msg_body_get(msg) res_model = self.pool.get(model) res_id = res_model.msg_new(cr, uid, msg) if res_id: attachments = message['attachment']
89b3475ca51268f2206e383bc4d8586e99a5c156 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/89b3475ca51268f2206e383bc4d8586e99a5c156/mail_gateway.py
warning += [_("Relation not found: %s on '%s'") % (line[i], relation)]
warning += [_("Relation not found: %s on '%s'") % (word, relation)]
def process_liness(self, datas, prefix, current_module, model_name, fields_def, position=0): line = datas[position] row = {} translate = {} todo = [] warning = [] data_id = False data_res_id = False is_xml_id = False is_db_id = False ir_model_data_obj = self.pool.get('ir.model.data') # # Import normal fields # for i in range(len(fields)): if i >= len(line): raise Exception(_('Please check that all your lines have %d columns.') % (len(fields),)) if not line[i]: continue
033179095f647798482f03b29c5f8e4a37003be6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/033179095f647798482f03b29c5f8e4a37003be6/orm.py
_("Relation not found: %s on '%s'") % (line[i], relation))
_("Relation not found: %s on '%s'") % (word, relation))
def process_liness(self, datas, prefix, current_module, model_name, fields_def, position=0): line = datas[position] row = {} translate = {} todo = [] warning = [] data_id = False data_res_id = False is_xml_id = False is_db_id = False ir_model_data_obj = self.pool.get('ir.model.data') # # Import normal fields # for i in range(len(fields)): if i >= len(line): raise Exception(_('Please check that all your lines have %d columns.') % (len(fields),)) if not line[i]: continue
033179095f647798482f03b29c5f8e4a37003be6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/033179095f647798482f03b29c5f8e4a37003be6/orm.py
'title': 'Bad Lot Assignation !', 'message': 'You are moving %.2f products but only %.2f available in this lot.' % (product_qty, prodlot.stock_available or 0.0)
'title': _('Bad Lot Assignation !'), 'message': _('You are moving %.2f products but only %.2f available in this lot.') % (product_qty, prodlot.stock_available or 0.0)
def onchange_lot_id(self, cr, uid, ids, prodlot_id=False, product_qty=False, loc_id=False, product_id=False, context=None): """ On change of production lot gives a warning message. @param prodlot_id: Changed production lot id @param product_qty: Quantity of product @param loc_id: Location id @param product_id: Product id @return: Warning message """ if not prodlot_id or not loc_id: return {} ctx = context and context.copy() or {} ctx['location_id'] = loc_id prodlot = self.pool.get('stock.production.lot').browse(cr, uid, prodlot_id, ctx) location = self.pool.get('stock.location').browse(cr, uid, loc_id) warning = {} if (location.usage == 'internal') and (product_qty > (prodlot.stock_available or 0.0)): warning = { 'title': 'Bad Lot Assignation !', 'message': 'You are moving %.2f products but only %.2f available in this lot.' % (product_qty, prodlot.stock_available or 0.0) } return {'warning': warning}
d6ad4e0e0789f6efabb9155b1d3b3aebb5b3103d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/d6ad4e0e0789f6efabb9155b1d3b3aebb5b3103d/stock.py
'ref_id': fields.many2one('ir.ui.view', 'Original View'), 'user_id': fields.many2one('res.users', 'User'),
'ref_id': fields.many2one('ir.ui.view', 'Original View', select=True), 'user_id': fields.many2one('res.users', 'User', select=True),
def _check_xml(self, cr, uid, ids, context=None): logger = logging.getLogger('init') 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): for error in relaxng.error_log: logger.error(tools.ustr(error)) return False return True
aeed07950ceb164ca8508db93d9c69a9556242bb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/aeed07950ceb164ca8508db93d9c69a9556242bb/ir_ui_view.py
'model': fields.char('Object', size=64, required=True),
'model': fields.char('Object', size=64, required=True, select=True),
def _check_xml(self, cr, uid, ids, context=None): logger = logging.getLogger('init') 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): for error in relaxng.error_log: logger.error(tools.ustr(error)) return False return True
aeed07950ceb164ca8508db93d9c69a9556242bb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/aeed07950ceb164ca8508db93d9c69a9556242bb/ir_ui_view.py
('search','Search')), 'View Type', required=True),
('search','Search')), 'View Type', required=True, select=True),
def _check_xml(self, cr, uid, ids, context=None): logger = logging.getLogger('init') 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): for error in relaxng.error_log: logger.error(tools.ustr(error)) return False return True
aeed07950ceb164ca8508db93d9c69a9556242bb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/aeed07950ceb164ca8508db93d9c69a9556242bb/ir_ui_view.py
'inherit_id': fields.many2one('ir.ui.view', 'Inherited View', ondelete='cascade'),
'inherit_id': fields.many2one('ir.ui.view', 'Inherited View', ondelete='cascade', select=True),
def _check_xml(self, cr, uid, ids, context=None): logger = logging.getLogger('init') 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): for error in relaxng.error_log: logger.error(tools.ustr(error)) return False return True
aeed07950ceb164ca8508db93d9c69a9556242bb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/aeed07950ceb164ca8508db93d9c69a9556242bb/ir_ui_view.py
'user_id': fields.many2one('res.users', 'User Ref.', required=True, ondelete='cascade'), 'resource': fields.char('Resource Name', size=64, required=True) }
'user_id': fields.many2one('res.users', 'User Ref.', required=True, ondelete='cascade', select=True), 'resource': fields.char('Resource Name', size=64, required=True, select=True) } def _auto_init(self, cr, context=None): super(view_sc, self)._auto_init(cr, context) cr.execute('SELECT indexname FROM pg_indexes WHERE indexname = \'ir_ui_view_sc_user_id_resource\'') if not cr.fetchone(): cr.execute('CREATE INDEX ir_ui_view_sc_user_id_resource ON ir_ui_view_sc (user_id, resource)')
def graph_get(self, cr, uid, id, model, node_obj, conn_obj, src_node, des_node,label,scale,context={}): if not label: label = [] nodes=[] nodes_name=[] transitions=[] start=[] tres={} labels={} no_ancester=[] blank_nodes = []
aeed07950ceb164ca8508db93d9c69a9556242bb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/aeed07950ceb164ca8508db93d9c69a9556242bb/ir_ui_view.py
row[field] = (reduce(lambda x, y: x or y, newrow.values()) and \
row[field] = newrow and (reduce(lambda x, y: x or y, newrow.values()) and \
def process_liness(self, datas, prefix, current_module, model_name, fields_def, position=0): line = datas[position] row = {} translate = {} todo = [] warning = [] data_id = False data_res_id = False is_xml_id = False is_db_id = False ir_model_data_obj = self.pool.get('ir.model.data') # # Import normal fields # for i in range(len(fields)): if i >= len(line): raise Exception(_('Please check that all your lines have %d columns.') % (len(fields),)) if not line[i]: continue
d631de7a6865c5e21b21326b4b2cebcaa10e6f43 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/d631de7a6865c5e21b21326b4b2cebcaa10e6f43/orm.py
if reduce(lambda x, y: x or y, newrow.values()):
if newrow and reduce(lambda x, y: x or y, newrow.values()):
def process_liness(self, datas, prefix, current_module, model_name, fields_def, position=0): line = datas[position] row = {} translate = {} todo = [] warning = [] data_id = False data_res_id = False is_xml_id = False is_db_id = False ir_model_data_obj = self.pool.get('ir.model.data') # # Import normal fields # for i in range(len(fields)): if i >= len(line): raise Exception(_('Please check that all your lines have %d columns.') % (len(fields),)) if not line[i]: continue
d631de7a6865c5e21b21326b4b2cebcaa10e6f43 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/d631de7a6865c5e21b21326b4b2cebcaa10e6f43/orm.py
required=True,
required=False,
def _get_charts(self, cr, uid, context=None): modules = self.pool.get('ir.module.module') ids = modules.search(cr, uid, [('category_id','=','Account Charts')]) charts = list( sorted(((m.name, m.shortdesc) for m in modules.browse(cr, uid, ids)), key=itemgetter(1))) charts.insert(0,('configurable','Generic Chart Of Account')) return charts
ea3e980fbb0415b4b3565a788979be07f89582e0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/ea3e980fbb0415b4b3565a788979be07f89582e0/installer.py
data_id = data_pool.search(cr, uid, [('model','=','account.account'), ('name','=','chart0')]) if data_id: data = data_pool.browse(cr, uid, data_id[0]) account_id = data.res_id acc_ids = obj_acc._get_children_and_consol(cr, uid, [account_id]) if acc_ids: cr.execute("update account_account set active='f' where id in " + str(tuple(acc_ids)))
def execute(self, cr, uid, ids, context=None): if context is None: context = {} data_pool = self.pool.get('ir.model.data') obj_acc = self.pool.get('account.account') super(account_installer, self).execute(cr, uid, ids, context=context) record = self.browse(cr, uid, ids, context=context)[0] company_id = self.pool.get('res.users').browse(cr, uid, [uid], context)[0].company_id for res in self.read(cr, uid, ids): if record.charts == 'configurable': mod_obj = self.pool.get('ir.model.data') fp = tools.file_open(opj('account','configurable_account_chart.xml')) tools.convert_xml_import(cr, 'account', fp, {}, 'init',True, None) fp.close() self.generate_configurable_chart(cr, uid, ids, context=context) obj_tax = self.pool.get('account.tax') obj_product = self.pool.get('product.product') ir_values = self.pool.get('ir.values') s_tax = (res.get('sale_tax',0.0))/100 p_tax = (res.get('purchase_tax',0.0))/100 tax_val = {} default_tax = []
ea3e980fbb0415b4b3565a788979be07f89582e0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/ea3e980fbb0415b4b3565a788979be07f89582e0/installer.py
self.rpc(self.model, 'history', [id], 'Receive', True, msg['From'], message['body'], False, False, {'model' : self.model})
self.rpc(self.model, 'history', [id], 'Receive', True, msg_to, message['body'], msg_from, False, {'model' : self.model})
def msg_new(self, msg): message = self.msg_body_get(msg) msg_subject = self._decode_header(msg['Subject']) msg_from = self._decode_header(msg['From']) msg_cc = self._decode_header(msg['Cc'] or '') data = { 'name': msg_subject, 'email_from': msg_from, 'email_cc': msg_cc, 'user_id': False, 'description': message['body'], 'state' : 'draft', } data.update(self.partner_get(msg_from))
9e382c11a7d83e2e5bfd9064d1741b68dec6ce50 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/9e382c11a7d83e2e5bfd9064d1741b68dec6ce50/openerp_mailgate.py
self.rpc(self.model, 'history', [id], 'Send', True, msg['From'], body['body'])
self.rpc(self.model, 'history', [id], 'Send', True, self._decode_header(msg['From']), body['body'])
def msg_user(self, msg, id): body = self.msg_body_get(msg)
9e382c11a7d83e2e5bfd9064d1741b68dec6ce50 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/9e382c11a7d83e2e5bfd9064d1741b68dec6ce50/openerp_mailgate.py
self.rpc(self.model, 'history', [id], 'Send', True, msg['From'], message['body'])
self.rpc(self.model, 'history', [id], 'Send', True, self._decode_header(msg['From']), message['body'])
def msg_partner(self, msg, id): message = self.msg_body_get(msg) body = message['body'] act = 'case_open' self.rpc(self.model, act, [id]) #body2 = '\n'.join(map(lambda l: '> '+l, (body or '').split('\n'))) #data = { # 'description':body, #} #self.rpc(self.model, 'write', [id], data) attachments = message['attachment'] for attach in attachments or []: data_attach = { 'name': str(attach), 'datas': binascii.b2a_base64(str(attachments[attach])), 'datas_fname': str(attach), 'description': 'Mail attachment', 'res_model': self.model, 'res_id': id } self.rpc('ir.attachment', 'create', data_attach) self.rpc(self.model, 'history', [id], 'Send', True, msg['From'], message['body']) return id
9e382c11a7d83e2e5bfd9064d1741b68dec6ce50 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/9e382c11a7d83e2e5bfd9064d1741b68dec6ce50/openerp_mailgate.py
if not context.get('allow_write_off', False):
if not allow_write_off:
def reconcile(self, cr, uid, ids, context=None): move_line_obj = self.pool.get('account.move.line') obj_model = self.pool.get('ir.model.data') if context is None: context = {} form = self.read(cr, uid, ids, [])[0] max_amount = form.get('max_amount', 0.0) power = form['power'] reconciled = unreconciled = 0 if not form['account_ids']: raise osv.except_osv(_('UserError'), _('You must select accounts to reconcile')) for account_id in form['account_ids']: if not context.get('allow_write_off', False): query = "SELECT partner_id FROM account_move_line WHERE account_id=%s AND reconcile_id IS NULL \ AND state <> 'draft' GROUP BY partner_id \ HAVING ABS(SUM(debit-credit)) <> %s AND count(*)>0"%(account_id, 0.0) else: query = "SELECT partner_id FROM account_move_line WHERE account_id=%s AND reconcile_id IS NULL \ AND state <> 'draft' GROUP BY partner_id \ HAVING ABS(SUM(debit-credit)) <= %s AND count(*)>0"%(account_id, max_amount or 0.0) # reconcile automatically all transactions from partners whose balance is 0 cr.execute(query) partner_ids = [id for (id,) in cr.fetchall()] for partner_id in partner_ids: cr.execute( "SELECT id " \ "FROM account_move_line " \ "WHERE account_id=%s " \ "AND partner_id=%s " \ "AND state <> 'draft' " \ "AND reconcile_id IS NULL", (account_id, partner_id)) line_ids = [id for (id,) in cr.fetchall()] if len(line_ids): reconciled += len(line_ids) if not context.get('allow_write_off', False): move_line_obj.reconcile_partial(cr, uid, line_ids, 'manual', context={}) else: move_line_obj.reconcile(cr, uid, line_ids, 'auto', form['writeoff_acc_id'], form['period_id'], form['journal_id'], context)
68464d2e8adc26cc6cbade3f829ab919e98963b0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/68464d2e8adc26cc6cbade3f829ab919e98963b0/account_automatic_reconcile.py
HAVING ABS(SUM(debit-credit)) <> %s AND count(*)>0"%(account_id, 0.0)
HAVING ABS(SUM(debit-credit)) = %s AND count(*)>0"%(account_id, 0.0)
def reconcile(self, cr, uid, ids, context=None): move_line_obj = self.pool.get('account.move.line') obj_model = self.pool.get('ir.model.data') if context is None: context = {} form = self.read(cr, uid, ids, [])[0] max_amount = form.get('max_amount', 0.0) power = form['power'] reconciled = unreconciled = 0 if not form['account_ids']: raise osv.except_osv(_('UserError'), _('You must select accounts to reconcile')) for account_id in form['account_ids']: if not context.get('allow_write_off', False): query = "SELECT partner_id FROM account_move_line WHERE account_id=%s AND reconcile_id IS NULL \ AND state <> 'draft' GROUP BY partner_id \ HAVING ABS(SUM(debit-credit)) <> %s AND count(*)>0"%(account_id, 0.0) else: query = "SELECT partner_id FROM account_move_line WHERE account_id=%s AND reconcile_id IS NULL \ AND state <> 'draft' GROUP BY partner_id \ HAVING ABS(SUM(debit-credit)) <= %s AND count(*)>0"%(account_id, max_amount or 0.0) # reconcile automatically all transactions from partners whose balance is 0 cr.execute(query) partner_ids = [id for (id,) in cr.fetchall()] for partner_id in partner_ids: cr.execute( "SELECT id " \ "FROM account_move_line " \ "WHERE account_id=%s " \ "AND partner_id=%s " \ "AND state <> 'draft' " \ "AND reconcile_id IS NULL", (account_id, partner_id)) line_ids = [id for (id,) in cr.fetchall()] if len(line_ids): reconciled += len(line_ids) if not context.get('allow_write_off', False): move_line_obj.reconcile_partial(cr, uid, line_ids, 'manual', context={}) else: move_line_obj.reconcile(cr, uid, line_ids, 'auto', form['writeoff_acc_id'], form['period_id'], form['journal_id'], context)
68464d2e8adc26cc6cbade3f829ab919e98963b0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/68464d2e8adc26cc6cbade3f829ab919e98963b0/account_automatic_reconcile.py
HAVING ABS(SUM(debit-credit)) <= %s AND count(*)>0"%(account_id, max_amount or 0.0)
HAVING ABS(SUM(debit-credit)) < %s AND count(*)>0"%(account_id, max_amount or 0.0)
def reconcile(self, cr, uid, ids, context=None): move_line_obj = self.pool.get('account.move.line') obj_model = self.pool.get('ir.model.data') if context is None: context = {} form = self.read(cr, uid, ids, [])[0] max_amount = form.get('max_amount', 0.0) power = form['power'] reconciled = unreconciled = 0 if not form['account_ids']: raise osv.except_osv(_('UserError'), _('You must select accounts to reconcile')) for account_id in form['account_ids']: if not context.get('allow_write_off', False): query = "SELECT partner_id FROM account_move_line WHERE account_id=%s AND reconcile_id IS NULL \ AND state <> 'draft' GROUP BY partner_id \ HAVING ABS(SUM(debit-credit)) <> %s AND count(*)>0"%(account_id, 0.0) else: query = "SELECT partner_id FROM account_move_line WHERE account_id=%s AND reconcile_id IS NULL \ AND state <> 'draft' GROUP BY partner_id \ HAVING ABS(SUM(debit-credit)) <= %s AND count(*)>0"%(account_id, max_amount or 0.0) # reconcile automatically all transactions from partners whose balance is 0 cr.execute(query) partner_ids = [id for (id,) in cr.fetchall()] for partner_id in partner_ids: cr.execute( "SELECT id " \ "FROM account_move_line " \ "WHERE account_id=%s " \ "AND partner_id=%s " \ "AND state <> 'draft' " \ "AND reconcile_id IS NULL", (account_id, partner_id)) line_ids = [id for (id,) in cr.fetchall()] if len(line_ids): reconciled += len(line_ids) if not context.get('allow_write_off', False): move_line_obj.reconcile_partial(cr, uid, line_ids, 'manual', context={}) else: move_line_obj.reconcile(cr, uid, line_ids, 'auto', form['writeoff_acc_id'], form['period_id'], form['journal_id'], context)
68464d2e8adc26cc6cbade3f829ab919e98963b0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/68464d2e8adc26cc6cbade3f829ab919e98963b0/account_automatic_reconcile.py
if not context.get('allow_write_off', False):
if allow_write_off: move_line_obj.reconcile(cr, uid, line_ids, 'auto', form['writeoff_acc_id'], form['period_id'], form['journal_id'], context) else:
def reconcile(self, cr, uid, ids, context=None): move_line_obj = self.pool.get('account.move.line') obj_model = self.pool.get('ir.model.data') if context is None: context = {} form = self.read(cr, uid, ids, [])[0] max_amount = form.get('max_amount', 0.0) power = form['power'] reconciled = unreconciled = 0 if not form['account_ids']: raise osv.except_osv(_('UserError'), _('You must select accounts to reconcile')) for account_id in form['account_ids']: if not context.get('allow_write_off', False): query = "SELECT partner_id FROM account_move_line WHERE account_id=%s AND reconcile_id IS NULL \ AND state <> 'draft' GROUP BY partner_id \ HAVING ABS(SUM(debit-credit)) <> %s AND count(*)>0"%(account_id, 0.0) else: query = "SELECT partner_id FROM account_move_line WHERE account_id=%s AND reconcile_id IS NULL \ AND state <> 'draft' GROUP BY partner_id \ HAVING ABS(SUM(debit-credit)) <= %s AND count(*)>0"%(account_id, max_amount or 0.0) # reconcile automatically all transactions from partners whose balance is 0 cr.execute(query) partner_ids = [id for (id,) in cr.fetchall()] for partner_id in partner_ids: cr.execute( "SELECT id " \ "FROM account_move_line " \ "WHERE account_id=%s " \ "AND partner_id=%s " \ "AND state <> 'draft' " \ "AND reconcile_id IS NULL", (account_id, partner_id)) line_ids = [id for (id,) in cr.fetchall()] if len(line_ids): reconciled += len(line_ids) if not context.get('allow_write_off', False): move_line_obj.reconcile_partial(cr, uid, line_ids, 'manual', context={}) else: move_line_obj.reconcile(cr, uid, line_ids, 'auto', form['writeoff_acc_id'], form['period_id'], form['journal_id'], context)
68464d2e8adc26cc6cbade3f829ab919e98963b0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/68464d2e8adc26cc6cbade3f829ab919e98963b0/account_automatic_reconcile.py
else: move_line_obj.reconcile(cr, uid, line_ids, 'auto', form['writeoff_acc_id'], form['period_id'], form['journal_id'], context)
def reconcile(self, cr, uid, ids, context=None): move_line_obj = self.pool.get('account.move.line') obj_model = self.pool.get('ir.model.data') if context is None: context = {} form = self.read(cr, uid, ids, [])[0] max_amount = form.get('max_amount', 0.0) power = form['power'] reconciled = unreconciled = 0 if not form['account_ids']: raise osv.except_osv(_('UserError'), _('You must select accounts to reconcile')) for account_id in form['account_ids']: if not context.get('allow_write_off', False): query = "SELECT partner_id FROM account_move_line WHERE account_id=%s AND reconcile_id IS NULL \ AND state <> 'draft' GROUP BY partner_id \ HAVING ABS(SUM(debit-credit)) <> %s AND count(*)>0"%(account_id, 0.0) else: query = "SELECT partner_id FROM account_move_line WHERE account_id=%s AND reconcile_id IS NULL \ AND state <> 'draft' GROUP BY partner_id \ HAVING ABS(SUM(debit-credit)) <= %s AND count(*)>0"%(account_id, max_amount or 0.0) # reconcile automatically all transactions from partners whose balance is 0 cr.execute(query) partner_ids = [id for (id,) in cr.fetchall()] for partner_id in partner_ids: cr.execute( "SELECT id " \ "FROM account_move_line " \ "WHERE account_id=%s " \ "AND partner_id=%s " \ "AND state <> 'draft' " \ "AND reconcile_id IS NULL", (account_id, partner_id)) line_ids = [id for (id,) in cr.fetchall()] if len(line_ids): reconciled += len(line_ids) if not context.get('allow_write_off', False): move_line_obj.reconcile_partial(cr, uid, line_ids, 'manual', context={}) else: move_line_obj.reconcile(cr, uid, line_ids, 'auto', form['writeoff_acc_id'], form['period_id'], form['journal_id'], context)
68464d2e8adc26cc6cbade3f829ab919e98963b0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/68464d2e8adc26cc6cbade3f829ab919e98963b0/account_automatic_reconcile.py
'nodestroy':True,
def reconcile(self, cr, uid, ids, context=None): move_line_obj = self.pool.get('account.move.line') obj_model = self.pool.get('ir.model.data') if context is None: context = {} form = self.read(cr, uid, ids, [])[0] max_amount = form.get('max_amount', 0.0) power = form['power'] reconciled = unreconciled = 0 if not form['account_ids']: raise osv.except_osv(_('UserError'), _('You must select accounts to reconcile')) for account_id in form['account_ids']: if not context.get('allow_write_off', False): query = "SELECT partner_id FROM account_move_line WHERE account_id=%s AND reconcile_id IS NULL \ AND state <> 'draft' GROUP BY partner_id \ HAVING ABS(SUM(debit-credit)) <> %s AND count(*)>0"%(account_id, 0.0) else: query = "SELECT partner_id FROM account_move_line WHERE account_id=%s AND reconcile_id IS NULL \ AND state <> 'draft' GROUP BY partner_id \ HAVING ABS(SUM(debit-credit)) <= %s AND count(*)>0"%(account_id, max_amount or 0.0) # reconcile automatically all transactions from partners whose balance is 0 cr.execute(query) partner_ids = [id for (id,) in cr.fetchall()] for partner_id in partner_ids: cr.execute( "SELECT id " \ "FROM account_move_line " \ "WHERE account_id=%s " \ "AND partner_id=%s " \ "AND state <> 'draft' " \ "AND reconcile_id IS NULL", (account_id, partner_id)) line_ids = [id for (id,) in cr.fetchall()] if len(line_ids): reconciled += len(line_ids) if not context.get('allow_write_off', False): move_line_obj.reconcile_partial(cr, uid, line_ids, 'manual', context={}) else: move_line_obj.reconcile(cr, uid, line_ids, 'auto', form['writeoff_acc_id'], form['period_id'], form['journal_id'], context)
68464d2e8adc26cc6cbade3f829ab919e98963b0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/68464d2e8adc26cc6cbade3f829ab919e98963b0/account_automatic_reconcile.py
'alert_date': fields.datetime('Alert Date', help="The date signifying an alert to notify about the production lot."),
'alert_date': fields.datetime('Alert Date', help="The date an alert should be notified about the production lot."),
def calc_date(self, cr, uid, context=None): """Compute the limit date for a given date""" if context is None: context = {} if not context.get('product_id', False): date = False else: product = pooler.get_pool(cr.dbname).get('product.product').browse( cr, uid, context['product_id']) duration = getattr(product, dtype) # set date to False when no expiry time specified on the product date = duration and (datetime.datetime.today() + datetime.timedelta(days=duration)) return date and date.strftime('%Y-%m-%d %H:%M:%S')
7dc16e99f2a3657be87c64f7e8fc0102ac3f4eb9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/7dc16e99f2a3657be87c64f7e8fc0102ac3f4eb9/product_expiry.py
for f in ('life_date','use_date','removal_date','alert_date'):
for f in ('life_date', 'use_date', 'removal_date', 'alert_date'):
def create(self, cr, uid, vals, context=None): newid = super(stock_production_lot, self).create(cr, uid, vals, context=context) obj = self.browse(cr, uid, newid, context=context) towrite = [] for f in ('life_date','use_date','removal_date','alert_date'): if not getattr(obj, f): towrite.append(f) context = context or {} context['product_id'] = obj.product_id.id self.write(cr, uid, [obj.id], self.default_get(cr, uid, towrite, context=context)) return newid
7dc16e99f2a3657be87c64f7e8fc0102ac3f4eb9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/7dc16e99f2a3657be87c64f7e8fc0102ac3f4eb9/product_expiry.py
'alert_time': fields.integer('Product Alert Time', help="The number of days after which, needs an alert to notify about the production lot."),
'alert_time': fields.integer('Product Alert Time', help="The number of days after which an alert should be notified about the production lot."),
def create(self, cr, uid, vals, context=None): newid = super(stock_production_lot, self).create(cr, uid, vals, context=context) obj = self.browse(cr, uid, newid, context=context) towrite = [] for f in ('life_date','use_date','removal_date','alert_date'): if not getattr(obj, f): towrite.append(f) context = context or {} context['product_id'] = obj.product_id.id self.write(cr, uid, [obj.id], self.default_get(cr, uid, towrite, context=context)) return newid
7dc16e99f2a3657be87c64f7e8fc0102ac3f4eb9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/7dc16e99f2a3657be87c64f7e8fc0102ac3f4eb9/product_expiry.py
def create(self, cr, uid, vals, context=None): newid = super(stock_production_lot, self).create(cr, uid, vals, context=context) obj = self.browse(cr, uid, newid, context=context) towrite = [] for f in ('life_date','use_date','removal_date','alert_date'): if not getattr(obj, f): towrite.append(f) context = context or {} context['product_id'] = obj.product_id.id self.write(cr, uid, [obj.id], self.default_get(cr, uid, towrite, context=context)) return newid
7dc16e99f2a3657be87c64f7e8fc0102ac3f4eb9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/7dc16e99f2a3657be87c64f7e8fc0102ac3f4eb9/product_expiry.py
record[pos] = res2[record['id']][pos]
multi_fields = res2.get(record['id'],{}) if multi_fields: record[pos] = multi_fields.get(pos,[])
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())::timestamp AS %s" % (self._table, self._table, f,) return "now()::timestamp AS %s" % (f,) if isinstance(self._columns[f], fields.binary) and context.get('bin_size', False): return 'length(%s) as "%s"' % (f_qual, f) return f_qual
acf51057835ee0e12a6e73730217d239bd98a477 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/acf51057835ee0e12a6e73730217d239bd98a477/orm.py
readonly = False
can_see = False
def check_group(node): if node.get('groups'): groups = node.get('groups').split(',') readonly = False access_pool = self.pool.get('ir.model.access') for group in groups: readonly = readonly or access_pool.check_groups(cr, user, group) if not readonly: node.set('invisible', '1') del(node.attrib['groups'])
da17e9c16111f90886f68e1db761e6673b89fa21 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/da17e9c16111f90886f68e1db761e6673b89fa21/orm.py
readonly = readonly or access_pool.check_groups(cr, user, group) if not readonly:
can_see = can_see or access_pool.check_groups(cr, user, group) if can_see: break if not can_see:
def check_group(node): if node.get('groups'): groups = node.get('groups').split(',') readonly = False access_pool = self.pool.get('ir.model.access') for group in groups: readonly = readonly or access_pool.check_groups(cr, user, group) if not readonly: node.set('invisible', '1') del(node.attrib['groups'])
da17e9c16111f90886f68e1db761e6673b89fa21 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/da17e9c16111f90886f68e1db761e6673b89fa21/orm.py
return can_see
def check_group(node): if node.get('groups'): groups = node.get('groups').split(',') readonly = False access_pool = self.pool.get('ir.model.access') for group in groups: readonly = readonly or access_pool.check_groups(cr, user, group) if not readonly: node.set('invisible', '1') del(node.attrib['groups'])
da17e9c16111f90886f68e1db761e6673b89fa21 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/da17e9c16111f90886f68e1db761e6673b89fa21/orm.py
if 'groups' in node.attrib: check_group(node) if node.get('invisible'):
if not check_group(node)
def check_group(node): if node.get('groups'): groups = node.get('groups').split(',') readonly = False access_pool = self.pool.get('ir.model.access') for group in groups: readonly = readonly or access_pool.check_groups(cr, user, group) if not readonly: node.set('invisible', '1') del(node.attrib['groups'])
da17e9c16111f90886f68e1db761e6673b89fa21 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/da17e9c16111f90886f68e1db761e6673b89fa21/orm.py
attrs['selection'] = self.pool.get(relation)._name_search(cr, user, '', dom, context=context,limit=None,name_get_uid=1)
attrs['selection'] = self.pool.get(relation)._name_search(cr, user, '', dom, context=context, limit=None, name_get_uid=1)
def check_group(node): if node.get('groups'): groups = node.get('groups').split(',') readonly = False access_pool = self.pool.get('ir.model.access') for group in groups: readonly = readonly or access_pool.check_groups(cr, user, group) if not readonly: node.set('invisible', '1') del(node.attrib['groups'])
da17e9c16111f90886f68e1db761e6673b89fa21 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/da17e9c16111f90886f68e1db761e6673b89fa21/orm.py
res = self.name_get(cr, name_get_uid, ids, context)
res = self.name_get(cr, name_get_uid or user, ids, context)
def _name_search(self, cr, user, name='', args=None, operator='ilike', context=None, limit=100, name_get_uid=None): if not args: args = [] if not context: context = {} args = args[:] if name: args += [(self._rec_name, operator, name)] ids = self.search(cr, user, args, limit=limit, context=context) res = self.name_get(cr, name_get_uid, ids, context) return res
da17e9c16111f90886f68e1db761e6673b89fa21 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/da17e9c16111f90886f68e1db761e6673b89fa21/orm.py
return self._name_search(cr, user, name, args, operator, context, limit, user)
return self._name_search(cr, user, name, args, operator, context, limit)
def name_search(self, cr, user, name='', args=None, operator='ilike', context=None, limit=100): """
da17e9c16111f90886f68e1db761e6673b89fa21 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/da17e9c16111f90886f68e1db761e6673b89fa21/orm.py
cols = intersect(self._inherit_fields.keys(), fields_to_read)
cols = intersect(self._inherit_fields.keys(), set(fields_to_read) - set(self._columns.keys()))
def convert_field(f): if f in ('create_date', 'write_date'): return "date_trunc('second', %s) as %s" % (f, f) if f == self.CONCURRENCY_CHECK_FIELD: if self._log_access: return "COALESCE(%s.write_date, %s.create_date, now())::timestamp AS %s" % (self._table, self._table, f,) return "now()::timestamp AS %s" % (f,) if isinstance(self._columns[f], fields.binary) and context.get('bin_size', False): return 'length("%s") as "%s"' % (f, f) return '"%s"' % (f,)
209d7cea5125a4a1744483a24100c34a0591927c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/209d7cea5125a4a1744483a24100c34a0591927c/orm.py
sum(planned_revenue) as amount_revenue, sum(planned_cost) as amount_costs, sum(planned_revenue*probability/100)::decimal(16,2) as amount_revenue_prob, avg(probability)::decimal(16,2) as probability,
def init(self, cr): tools.drop_view_if_exists(cr, 'project_issue_report') cr.execute(""" create or replace view project_issue_report as ( select min(c.id) as id, to_char(c.create_date, 'YYYY') as name, to_char(c.create_date, 'MM') as month, c.state, c.user_id, c.section_id, c.categ_id, c.stage_id, count(*) as nbr, sum(planned_revenue) as amount_revenue, sum(planned_cost) as amount_costs, sum(planned_revenue*probability/100)::decimal(16,2) as amount_revenue_prob, avg(probability)::decimal(16,2) as probability, to_char(avg(date_closed-c.create_date), 'DD"d" HH24:MI:SS') as delay_close from project_issue c group by to_char(c.create_date, 'YYYY'), to_char(c.create_date, 'MM'), c.state, c.user_id,c.section_id,c.categ_id,c.stage_id )""")
c3cbfa5cdf128fc68aa1001301738a91ea3a846b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c3cbfa5cdf128fc68aa1001301738a91ea3a846b/project_issue_report.py
for inv in self.browse(cr,uid,ids): move_obj.action_done(cr, uid, [x.id for x in inv.move_ids], context) self.write(cr, uid, [inv.id], {'state':'done'}, context=context)
for inv in self.browse(cr, uid, ids, context=context): move_obj.action_done(cr, uid, [x.id for x in inv.move_ids], context=context) self.write(cr, uid, [inv.id], {'state':'done'}, context=context)
def action_done(self, cr, uid, ids, context=None): move_obj = self.pool.get('stock.move') for inv in self.browse(cr,uid,ids): move_obj.action_done(cr, uid, [x.id for x in inv.move_ids], context) self.write(cr, uid, [inv.id], {'state':'done'}, context=context) return True
3be905a24861fb1f15a1daf9b37c22c09b128ede /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/3be905a24861fb1f15a1daf9b37c22c09b128ede/stock.py
res = False if line[i]: field_name = field[0].split(':')[0] model_rel = fields_def[field_name]['relation'] if fields_def[field[len(prefix)][:-6]]['type']=='many2many': res_id = [] for db_id in line[i].split(config.get('csv_internal_sep')): try: _check_db_id(self, model_rel, db_id) res_id.append(db_id) except Exception,e: warning += [tools.exception_to_unicode(e)] logger.notifyChannel("import", netsvc.LOG_ERROR, tools.exception_to_unicode(e)) if len(res_id): res = [(6, 0, res_id)]
res = False if line[i]: field_name = field[0].split(':')[0] model_rel = fields_def[field_name]['relation'] if fields_def[field[len(prefix)][:-6]]['type']=='many2many': res_id = [] for db_id in line[i].split(config.get('csv_internal_sep')): try: _check_db_id(self, model_rel, db_id) res_id.append(db_id) except Exception,e: warning += [tools.exception_to_unicode(e)] logger.notifyChannel("import", netsvc.LOG_ERROR, tools.exception_to_unicode(e)) if len(res_id): res = [(6, 0, res_id)]
def process_liness(self, datas, prefix, current_module, model_name, fields_def, position=0): line = datas[position] row = {} translate = {} todo = [] warning = [] data_id = False data_res_id = False is_xml_id = False is_db_id = False ir_model_data_obj = self.pool.get('ir.model.data') # # Import normal fields # for i in range(len(fields)): if i >= len(line): raise Exception(_('Please check that all your lines have %d columns.') % (len(fields),)) if not line[i]: continue
827ce83b5767611573e3e504cd882f1684b5bd2a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/827ce83b5767611573e3e504cd882f1684b5bd2a/orm.py
data_ids = ir_model_data_obj.search(cr, uid, [('module','=',module),('model','=',model_name),('res_id','=',is_db_id)]) if not len(data_ids): ir_model_data_obj.create(cr, uid, {'module':module, 'model':model_name, 'name':name, 'res_id':is_db_id}) db_id = is_db_id
data_ids = ir_model_data_obj.search(cr, uid, [('module','=',module),('model','=',model_name),('res_id','=',is_db_id)]) if not len(data_ids): ir_model_data_obj.create(cr, uid, {'module':module, 'model':model_name, 'name':name, 'res_id':is_db_id}) db_id = is_db_id
def process_liness(self, datas, prefix, current_module, model_name, fields_def, position=0): line = datas[position] row = {} translate = {} todo = [] warning = [] data_id = False data_res_id = False is_xml_id = False is_db_id = False ir_model_data_obj = self.pool.get('ir.model.data') # # Import normal fields # for i in range(len(fields)): if i >= len(line): raise Exception(_('Please check that all your lines have %d columns.') % (len(fields),)) if not line[i]: continue
827ce83b5767611573e3e504cd882f1684b5bd2a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/827ce83b5767611573e3e504cd882f1684b5bd2a/orm.py
node_fields=self.pool.get(node.getchildren()[0].get('object')).fields_get(cr, user, fields_def.keys(), context)
node_fields=self.pool.get(node.getchildren()[0].get('object')).fields_get(cr, user, fields_def.keys(), context)
fields_def = self.__view_look_dom(cr, user, node, view_id, context=context)
827ce83b5767611573e3e504cd882f1684b5bd2a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/827ce83b5767611573e3e504cd882f1684b5bd2a/orm.py