rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
keys = ['language', 'translate_out', 'translate_in', 'debug_mode',
keys = ['language', 'translate_out', 'translate_in', 'debug_mode', 'smtp_ssl'
def die(cond, msg): if cond: print msg sys.exit(1)
417f87440ec5b4bc42abe1f51f61b2309e111672 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/417f87440ec5b4bc42abe1f51f61b2309e111672/config.py
'list_db', 'server_actions_allow_code', 'xmlrpcs',
'list_db', 'server_actions_allow_code', 'xmlrpcs',
def die(cond, msg): if cond: print msg sys.exit(1)
417f87440ec5b4bc42abe1f51f61b2309e111672 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/417f87440ec5b4bc42abe1f51f61b2309e111672/config.py
cr.execute( "UPDATE account_move_line "\ "SET followup_line_id=%s, followup_date=%s "\ "WHERE id=%s", (to_update[id], data['form']['date'], int(id),))
if to_update[id]['partner_id'] in data['form']['partner_ids'][0][2]: cr.execute( "UPDATE account_move_line "\ "SET followup_line_id=%s, followup_date=%s "\ "WHERE id=%s", (to_update[id]['level'], data['form']['date'], int(id),))
def _update_partners(self, cr, uid, data, context): to_update = data['form']['to_update'] for id in to_update.keys(): cr.execute( "UPDATE account_move_line "\ "SET followup_line_id=%s, followup_date=%s "\ "WHERE id=%s", (to_update[id], data['form']['date'], int(id),)) return {}
92a3af46d483733f37d9443e1a110cef1ca59b5e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/92a3af46d483733f37d9443e1a110cef1ca59b5e/wizard_followup_print.py
to_update[str(id)] = fups[followup_line_id][1]
to_update[str(id)]= {'level': fups[followup_line_id][1], 'partner_id': partner_id}
def _get_partners(self, cr, uid, data, context): pool = pooler.get_pool(cr.dbname) cr.execute( "SELECT l.partner_id, l.followup_line_id,l.date_maturity, l.date, l.id "\ "FROM account_move_line AS l "\ "LEFT JOIN account_account AS a "\ "ON (l.account_id=a.id) "\ "WHERE (l.reconcile_id IS NULL) "\ "AND (a.type='receivable') "\ "AND (l.state<>'draft') "\ "AND (l.partner_id is NOT NULL) "\ "AND (a.active) "\ "ORDER BY l.date") move_lines = cr.fetchall() old = None fups = {} fup_id = data['form']['followup_id']
92a3af46d483733f37d9443e1a110cef1ca59b5e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/92a3af46d483733f37d9443e1a110cef1ca59b5e/wizard_followup_print.py
to_update[str(id)] = fups[followup_line_id][1]
to_update[str(id)]= {'level': fups[followup_line_id][1], 'partner_id': partner_id}
def _get_partners(self, cr, uid, data, context): pool = pooler.get_pool(cr.dbname) cr.execute( "SELECT l.partner_id, l.followup_line_id,l.date_maturity, l.date, l.id "\ "FROM account_move_line AS l "\ "LEFT JOIN account_account AS a "\ "ON (l.account_id=a.id) "\ "WHERE (l.reconcile_id IS NULL) "\ "AND (a.type='receivable') "\ "AND (l.state<>'draft') "\ "AND (l.partner_id is NOT NULL) "\ "AND (a.active) "\ "ORDER BY l.date") move_lines = cr.fetchall() old = None fups = {} fup_id = data['form']['followup_id']
92a3af46d483733f37d9443e1a110cef1ca59b5e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/92a3af46d483733f37d9443e1a110cef1ca59b5e/wizard_followup_print.py
_order = "sequence"
def unlink(self, cr, uid, ids, *args, **kwargs): for proj in self.browse(cr, uid, ids): if proj.tasks: raise osv.except_osv(_('Operation Not Permitted !'), _('You can not delete a project with tasks. I suggest you to deactivate it.')) return super(project, self).unlink(cr, uid, ids, *args, **kwargs)
34cbb6821f97cb182cbb39a6e0dce9369a608d39 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/34cbb6821f97cb182cbb39a6e0dce9369a608d39/project.py
for val in self.browse(cr, uid, ids,context=context):
for val in self.browse(cr, uid, ids, context=context):
def _product_margin(self, cr, uid, ids, field_names, arg, context=None): res = {} if context is None: context = {} for val in self.browse(cr, uid, ids,context=context): res[val.id] = {} date_from = context.get('date_from', time.strftime('%Y-01-01')) date_to = context.get('date_to', time.strftime('%Y-12-31')) invoice_state = context.get('invoice_state', 'open_paid') if 'date_from' in field_names: res[val.id]['date_from']=date_from if 'date_to' in field_names: res[val.id]['date_to']=date_to if 'invoice_state' in field_names: res[val.id]['invoice_state']=invoice_state invoice_types = () states = () if invoice_state=='paid': states=('paid',) elif invoice_state=='open_paid': states=('open','paid') elif invoice_state=='draft_open_paid': states=('draft','open','paid')
c5de222c6616c268ab9364a76ab481c145c8110b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c5de222c6616c268ab9364a76ab481c145c8110b/product_margin.py
res[val.id]['date_from']=date_from
res[val.id]['date_from'] = date_from
def _product_margin(self, cr, uid, ids, field_names, arg, context=None): res = {} if context is None: context = {} for val in self.browse(cr, uid, ids,context=context): res[val.id] = {} date_from = context.get('date_from', time.strftime('%Y-01-01')) date_to = context.get('date_to', time.strftime('%Y-12-31')) invoice_state = context.get('invoice_state', 'open_paid') if 'date_from' in field_names: res[val.id]['date_from']=date_from if 'date_to' in field_names: res[val.id]['date_to']=date_to if 'invoice_state' in field_names: res[val.id]['invoice_state']=invoice_state invoice_types = () states = () if invoice_state=='paid': states=('paid',) elif invoice_state=='open_paid': states=('open','paid') elif invoice_state=='draft_open_paid': states=('draft','open','paid')
c5de222c6616c268ab9364a76ab481c145c8110b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c5de222c6616c268ab9364a76ab481c145c8110b/product_margin.py
res[val.id]['date_to']=date_to
res[val.id]['date_to'] = date_to
def _product_margin(self, cr, uid, ids, field_names, arg, context=None): res = {} if context is None: context = {} for val in self.browse(cr, uid, ids,context=context): res[val.id] = {} date_from = context.get('date_from', time.strftime('%Y-01-01')) date_to = context.get('date_to', time.strftime('%Y-12-31')) invoice_state = context.get('invoice_state', 'open_paid') if 'date_from' in field_names: res[val.id]['date_from']=date_from if 'date_to' in field_names: res[val.id]['date_to']=date_to if 'invoice_state' in field_names: res[val.id]['invoice_state']=invoice_state invoice_types = () states = () if invoice_state=='paid': states=('paid',) elif invoice_state=='open_paid': states=('open','paid') elif invoice_state=='draft_open_paid': states=('draft','open','paid')
c5de222c6616c268ab9364a76ab481c145c8110b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c5de222c6616c268ab9364a76ab481c145c8110b/product_margin.py
res[val.id]['invoice_state']=invoice_state
res[val.id]['invoice_state'] = invoice_state
def _product_margin(self, cr, uid, ids, field_names, arg, context=None): res = {} if context is None: context = {} for val in self.browse(cr, uid, ids,context=context): res[val.id] = {} date_from = context.get('date_from', time.strftime('%Y-01-01')) date_to = context.get('date_to', time.strftime('%Y-12-31')) invoice_state = context.get('invoice_state', 'open_paid') if 'date_from' in field_names: res[val.id]['date_from']=date_from if 'date_to' in field_names: res[val.id]['date_to']=date_to if 'invoice_state' in field_names: res[val.id]['invoice_state']=invoice_state invoice_types = () states = () if invoice_state=='paid': states=('paid',) elif invoice_state=='open_paid': states=('open','paid') elif invoice_state=='draft_open_paid': states=('draft','open','paid')
c5de222c6616c268ab9364a76ab481c145c8110b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c5de222c6616c268ab9364a76ab481c145c8110b/product_margin.py
if invoice_state=='paid': states=('paid',) elif invoice_state=='open_paid': states=('open','paid') elif invoice_state=='draft_open_paid': states=('draft','open','paid')
if invoice_state == 'paid': states = ('paid',) elif invoice_state == 'open_paid': states = ('open', 'paid') elif invoice_state == 'draft_open_paid': states = ('draft', 'open', 'paid')
def _product_margin(self, cr, uid, ids, field_names, arg, context=None): res = {} if context is None: context = {} for val in self.browse(cr, uid, ids,context=context): res[val.id] = {} date_from = context.get('date_from', time.strftime('%Y-01-01')) date_to = context.get('date_to', time.strftime('%Y-12-31')) invoice_state = context.get('invoice_state', 'open_paid') if 'date_from' in field_names: res[val.id]['date_from']=date_from if 'date_to' in field_names: res[val.id]['date_to']=date_to if 'invoice_state' in field_names: res[val.id]['invoice_state']=invoice_state invoice_types = () states = () if invoice_state=='paid': states=('paid',) elif invoice_state=='open_paid': states=('open','paid') elif invoice_state=='draft_open_paid': states=('draft','open','paid')
c5de222c6616c268ab9364a76ab481c145c8110b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c5de222c6616c268ab9364a76ab481c145c8110b/product_margin.py
invoice_types=('out_invoice','in_refund')
invoice_types = ('out_invoice', 'in_refund')
def _product_margin(self, cr, uid, ids, field_names, arg, context=None): res = {} if context is None: context = {} for val in self.browse(cr, uid, ids,context=context): res[val.id] = {} date_from = context.get('date_from', time.strftime('%Y-01-01')) date_to = context.get('date_to', time.strftime('%Y-12-31')) invoice_state = context.get('invoice_state', 'open_paid') if 'date_from' in field_names: res[val.id]['date_from']=date_from if 'date_to' in field_names: res[val.id]['date_to']=date_to if 'invoice_state' in field_names: res[val.id]['invoice_state']=invoice_state invoice_types = () states = () if invoice_state=='paid': states=('paid',) elif invoice_state=='open_paid': states=('open','paid') elif invoice_state=='draft_open_paid': states=('draft','open','paid')
c5de222c6616c268ab9364a76ab481c145c8110b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c5de222c6616c268ab9364a76ab481c145c8110b/product_margin.py
invoice_types=('in_invoice','out_refund')
invoice_types = ('in_invoice', 'out_refund')
def _product_margin(self, cr, uid, ids, field_names, arg, context=None): res = {} if context is None: context = {} for val in self.browse(cr, uid, ids,context=context): res[val.id] = {} date_from = context.get('date_from', time.strftime('%Y-01-01')) date_to = context.get('date_to', time.strftime('%Y-12-31')) invoice_state = context.get('invoice_state', 'open_paid') if 'date_from' in field_names: res[val.id]['date_from']=date_from if 'date_to' in field_names: res[val.id]['date_to']=date_to if 'invoice_state' in field_names: res[val.id]['invoice_state']=invoice_state invoice_types = () states = () if invoice_state=='paid': states=('paid',) elif invoice_state=='open_paid': states=('open','paid') elif invoice_state=='draft_open_paid': states=('draft','open','paid')
c5de222c6616c268ab9364a76ab481c145c8110b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c5de222c6616c268ab9364a76ab481c145c8110b/product_margin.py
""",(val.id,states,invoice_types,date_from,date_to)) result=cr.fetchall()[0]
""", (val.id, states, invoice_types, date_from, date_to)) result = cr.fetchall()[0]
def _product_margin(self, cr, uid, ids, field_names, arg, context=None): res = {} if context is None: context = {} for val in self.browse(cr, uid, ids,context=context): res[val.id] = {} date_from = context.get('date_from', time.strftime('%Y-01-01')) date_to = context.get('date_to', time.strftime('%Y-12-31')) invoice_state = context.get('invoice_state', 'open_paid') if 'date_from' in field_names: res[val.id]['date_from']=date_from if 'date_to' in field_names: res[val.id]['date_to']=date_to if 'invoice_state' in field_names: res[val.id]['invoice_state']=invoice_state invoice_types = () states = () if invoice_state=='paid': states=('paid',) elif invoice_state=='open_paid': states=('open','paid') elif invoice_state=='draft_open_paid': states=('draft','open','paid')
c5de222c6616c268ab9364a76ab481c145c8110b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c5de222c6616c268ab9364a76ab481c145c8110b/product_margin.py
res[val.id]['sale_avg_price']=result[0] and result[0] or 0.0 res[val.id]['sale_num_invoiced']=result[1] and result[1] or 0.0 res[val.id]['turnover']=result[2] and result[2] or 0.0 res[val.id]['sale_expected']=result[3] and result[3] or 0.0 res[val.id]['sales_gap']=res[val.id]['sale_expected']-res[val.id]['turnover']
res[val.id]['sale_avg_price'] = result[0] and result[0] or 0.0 res[val.id]['sale_num_invoiced'] = result[1] and result[1] or 0.0 res[val.id]['turnover'] = result[2] and result[2] or 0.0 res[val.id]['sale_expected'] = result[3] and result[3] or 0.0 res[val.id]['sales_gap'] = res[val.id]['sale_expected']-res[val.id]['turnover']
def _product_margin(self, cr, uid, ids, field_names, arg, context=None): res = {} if context is None: context = {} for val in self.browse(cr, uid, ids,context=context): res[val.id] = {} date_from = context.get('date_from', time.strftime('%Y-01-01')) date_to = context.get('date_to', time.strftime('%Y-12-31')) invoice_state = context.get('invoice_state', 'open_paid') if 'date_from' in field_names: res[val.id]['date_from']=date_from if 'date_to' in field_names: res[val.id]['date_to']=date_to if 'invoice_state' in field_names: res[val.id]['invoice_state']=invoice_state invoice_types = () states = () if invoice_state=='paid': states=('paid',) elif invoice_state=='open_paid': states=('open','paid') elif invoice_state=='draft_open_paid': states=('draft','open','paid')
c5de222c6616c268ab9364a76ab481c145c8110b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c5de222c6616c268ab9364a76ab481c145c8110b/product_margin.py
res[val.id]['purchase_avg_price']=result[0] and result[0] or 0.0 res[val.id]['purchase_num_invoiced']=result[1] and result[1] or 0.0 res[val.id]['total_cost']=result[2] and result[2] or 0.0 res[val.id]['normal_cost']=result[4] and result[4] or 0.0 res[val.id]['purchase_gap']=res[val.id]['normal_cost']-res[val.id]['total_cost']
res[val.id]['purchase_avg_price'] = result[0] and result[0] or 0.0 res[val.id]['purchase_num_invoiced'] = result[1] and result[1] or 0.0 res[val.id]['total_cost'] = result[2] and result[2] or 0.0 res[val.id]['normal_cost'] = result[4] and result[4] or 0.0 res[val.id]['purchase_gap'] = res[val.id]['normal_cost']-res[val.id]['total_cost']
def _product_margin(self, cr, uid, ids, field_names, arg, context=None): res = {} if context is None: context = {} for val in self.browse(cr, uid, ids,context=context): res[val.id] = {} date_from = context.get('date_from', time.strftime('%Y-01-01')) date_to = context.get('date_to', time.strftime('%Y-12-31')) invoice_state = context.get('invoice_state', 'open_paid') if 'date_from' in field_names: res[val.id]['date_from']=date_from if 'date_to' in field_names: res[val.id]['date_to']=date_to if 'invoice_state' in field_names: res[val.id]['invoice_state']=invoice_state invoice_types = () states = () if invoice_state=='paid': states=('paid',) elif invoice_state=='open_paid': states=('open','paid') elif invoice_state=='draft_open_paid': states=('draft','open','paid')
c5de222c6616c268ab9364a76ab481c145c8110b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c5de222c6616c268ab9364a76ab481c145c8110b/product_margin.py
res[val.id]['total_margin']=val.turnover-val.standard_price
res[val.id]['total_margin'] = val.turnover - val.standard_price
def _product_margin(self, cr, uid, ids, field_names, arg, context=None): res = {} if context is None: context = {} for val in self.browse(cr, uid, ids,context=context): res[val.id] = {} date_from = context.get('date_from', time.strftime('%Y-01-01')) date_to = context.get('date_to', time.strftime('%Y-12-31')) invoice_state = context.get('invoice_state', 'open_paid') if 'date_from' in field_names: res[val.id]['date_from']=date_from if 'date_to' in field_names: res[val.id]['date_to']=date_to if 'invoice_state' in field_names: res[val.id]['invoice_state']=invoice_state invoice_types = () states = () if invoice_state=='paid': states=('paid',) elif invoice_state=='open_paid': states=('open','paid') elif invoice_state=='draft_open_paid': states=('draft','open','paid')
c5de222c6616c268ab9364a76ab481c145c8110b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c5de222c6616c268ab9364a76ab481c145c8110b/product_margin.py
res[val.id]['expected_margin']=val.sale_expected-val.normal_cost
res[val.id]['expected_margin'] = val.sale_expected - val.normal_cost
def _product_margin(self, cr, uid, ids, field_names, arg, context=None): res = {} if context is None: context = {} for val in self.browse(cr, uid, ids,context=context): res[val.id] = {} date_from = context.get('date_from', time.strftime('%Y-01-01')) date_to = context.get('date_to', time.strftime('%Y-12-31')) invoice_state = context.get('invoice_state', 'open_paid') if 'date_from' in field_names: res[val.id]['date_from']=date_from if 'date_to' in field_names: res[val.id]['date_to']=date_to if 'invoice_state' in field_names: res[val.id]['invoice_state']=invoice_state invoice_types = () states = () if invoice_state=='paid': states=('paid',) elif invoice_state=='open_paid': states=('open','paid') elif invoice_state=='draft_open_paid': states=('draft','open','paid')
c5de222c6616c268ab9364a76ab481c145c8110b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c5de222c6616c268ab9364a76ab481c145c8110b/product_margin.py
res[val.id]['total_margin_rate']=val.turnover and val.total_margin * 100 / val.turnover or 0.0
res[val.id]['total_margin_rate'] = val.turnover and val.total_margin * 100 / val.turnover or 0.0
def _product_margin(self, cr, uid, ids, field_names, arg, context=None): res = {} if context is None: context = {} for val in self.browse(cr, uid, ids,context=context): res[val.id] = {} date_from = context.get('date_from', time.strftime('%Y-01-01')) date_to = context.get('date_to', time.strftime('%Y-12-31')) invoice_state = context.get('invoice_state', 'open_paid') if 'date_from' in field_names: res[val.id]['date_from']=date_from if 'date_to' in field_names: res[val.id]['date_to']=date_to if 'invoice_state' in field_names: res[val.id]['invoice_state']=invoice_state invoice_types = () states = () if invoice_state=='paid': states=('paid',) elif invoice_state=='open_paid': states=('open','paid') elif invoice_state=='draft_open_paid': states=('draft','open','paid')
c5de222c6616c268ab9364a76ab481c145c8110b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c5de222c6616c268ab9364a76ab481c145c8110b/product_margin.py
res[val.id]['expected_margin_rate']=val.sale_expected and val.expected_margin * 100 / val.sale_expected or 0.0
res[val.id]['expected_margin_rate'] = val.sale_expected and val.expected_margin * 100 / val.sale_expected or 0.0
def _product_margin(self, cr, uid, ids, field_names, arg, context=None): res = {} if context is None: context = {} for val in self.browse(cr, uid, ids,context=context): res[val.id] = {} date_from = context.get('date_from', time.strftime('%Y-01-01')) date_to = context.get('date_to', time.strftime('%Y-12-31')) invoice_state = context.get('invoice_state', 'open_paid') if 'date_from' in field_names: res[val.id]['date_from']=date_from if 'date_to' in field_names: res[val.id]['date_to']=date_to if 'invoice_state' in field_names: res[val.id]['invoice_state']=invoice_state invoice_types = () states = () if invoice_state=='paid': states=('paid',) elif invoice_state=='open_paid': states=('open','paid') elif invoice_state=='draft_open_paid': states=('draft','open','paid')
c5de222c6616c268ab9364a76ab481c145c8110b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c5de222c6616c268ab9364a76ab481c145c8110b/product_margin.py
'date_from': fields.function(_product_margin, method=True, type='date', string='From Date', multi=True), 'date_to': fields.function(_product_margin, method=True, type='date', string='To Date', multi=True),
'date_from': fields.function(_product_margin, method=True, type='date', string='From Date', multi='product_margin'), 'date_to': fields.function(_product_margin, method=True, type='date', string='To Date', multi='product_margin'),
def _product_margin(self, cr, uid, ids, field_names, arg, context=None): res = {} if context is None: context = {} for val in self.browse(cr, uid, ids,context=context): res[val.id] = {} date_from = context.get('date_from', time.strftime('%Y-01-01')) date_to = context.get('date_to', time.strftime('%Y-12-31')) invoice_state = context.get('invoice_state', 'open_paid') if 'date_from' in field_names: res[val.id]['date_from']=date_from if 'date_to' in field_names: res[val.id]['date_to']=date_to if 'invoice_state' in field_names: res[val.id]['invoice_state']=invoice_state invoice_types = () states = () if invoice_state=='paid': states=('paid',) elif invoice_state=='open_paid': states=('open','paid') elif invoice_state=='draft_open_paid': states=('draft','open','paid')
c5de222c6616c268ab9364a76ab481c145c8110b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c5de222c6616c268ab9364a76ab481c145c8110b/product_margin.py
('paid','Paid'),('open_paid','Open and Paid'),('draft_open_paid','Draft, Open and Paid') ], string='Invoice State',multi=True, readonly=True), 'sale_avg_price' : fields.function(_product_margin, method=True, type='float', string='Avg. Unit Price', multi='sale',help="Avg. Price in Customer Invoices)"), 'purchase_avg_price' : fields.function(_product_margin, method=True, type='float', string='Avg. Unit Price', multi='purchase',help="Avg. Price in Supplier Invoices "), 'sale_num_invoiced' : fields.function(_product_margin, method=True, type='float', string=' 'purchase_num_invoiced' : fields.function(_product_margin, method=True, type='float', string=' 'sales_gap' : fields.function(_product_margin, method=True, type='float', string='Sales Gap', multi='sale',help="Expected Sale - Turn Over"), 'purchase_gap' : fields.function(_product_margin, method=True, type='float', string='Purchase Gap', multi='purchase',help="Normal Cost - Total Cost"), 'turnover' : fields.function(_product_margin, method=True, type='float', string='Turnover' ,multi='sale',help="Sum of Multification of Invoice price and quantity of Customer Invoices"), 'total_cost' : fields.function(_product_margin, method=True, type='float', string='Total Cost', multi='purchase',help="Sum of Multification of Invoice price and quantity of Supplier Invoices "), 'sale_expected' : fields.function(_product_margin, method=True, type='float', string='Expected Sale', multi='sale',help="Sum of Multification of Sale Catalog price and quantity of Customer Invoices"), 'normal_cost' : fields.function(_product_margin, method=True, type='float', string='Normal Cost', multi='purchase',help="Sum of Multification of Cost price and quantity of Supplier Invoices"), 'total_margin' : fields.function(_product_margin, method=True, type='float', string='Total Margin', multi='total',help="Turnorder - Standard price"), 'expected_margin' : fields.function(_product_margin, method=True, type='float', string='Expected Margin', multi='total',help="Expected Sale - Normal Cost"), 'total_margin_rate' : fields.function(_product_margin, method=True, type='float', string='Total Margin (%)', multi='margin',help="Total margin * 100 / Turnover"), 'expected_margin_rate' : fields.function(_product_margin, method=True, type='float', string='Expected Margin (%)', multi='margin',help="Expected margin * 100 / Expected Sale"),
('paid','Paid'),('open_paid','Open and Paid'),('draft_open_paid','Draft, Open and Paid') ], string='Invoice State',multi='product_margin', readonly=True), 'sale_avg_price' : fields.function(_product_margin, method=True, type='float', string='Avg. Unit Price', multi='product_margin', help="Avg. Price in Customer Invoices)"), 'purchase_avg_price' : fields.function(_product_margin, method=True, type='float', string='Avg. Unit Price', multi='product_margin', help="Avg. Price in Supplier Invoices "), 'sale_num_invoiced' : fields.function(_product_margin, method=True, type='float', string=' help="Sum of Quantity in Customer Invoices"), 'purchase_num_invoiced' : fields.function(_product_margin, method=True, type='float', string=' help="Sum of Quantity in Supplier Invoices"), 'sales_gap' : fields.function(_product_margin, method=True, type='float', string='Sales Gap', multi='product_margin', help="Expected Sale - Turn Over"), 'purchase_gap' : fields.function(_product_margin, method=True, type='float', string='Purchase Gap', multi='product_margin', help="Normal Cost - Total Cost"), 'turnover' : fields.function(_product_margin, method=True, type='float', string='Turnover' ,multi='product_margin', help="Sum of Multification of Invoice price and quantity of Customer Invoices"), 'total_cost' : fields.function(_product_margin, method=True, type='float', string='Total Cost', multi='product_margin', help="Sum of Multification of Invoice price and quantity of Supplier Invoices "), 'sale_expected' : fields.function(_product_margin, method=True, type='float', string='Expected Sale', multi='product_margin', help="Sum of Multification of Sale Catalog price and quantity of Customer Invoices"), 'normal_cost' : fields.function(_product_margin, method=True, type='float', string='Normal Cost', multi='product_margin', help="Sum of Multification of Cost price and quantity of Supplier Invoices"), 'total_margin' : fields.function(_product_margin, method=True, type='float', string='Total Margin', multi='product_margin', help="Turnorder - Standard price"), 'expected_margin' : fields.function(_product_margin, method=True, type='float', string='Expected Margin', multi='product_margin', help="Expected Sale - Normal Cost"), 'total_margin_rate' : fields.function(_product_margin, method=True, type='float', string='Total Margin (%)', multi='product_margin', help="Total margin * 100 / Turnover"), 'expected_margin_rate' : fields.function(_product_margin, method=True, type='float', string='Expected Margin (%)', multi='product_margin', help="Expected margin * 100 / Expected Sale"),
def _product_margin(self, cr, uid, ids, field_names, arg, context=None): res = {} if context is None: context = {} for val in self.browse(cr, uid, ids,context=context): res[val.id] = {} date_from = context.get('date_from', time.strftime('%Y-01-01')) date_to = context.get('date_to', time.strftime('%Y-12-31')) invoice_state = context.get('invoice_state', 'open_paid') if 'date_from' in field_names: res[val.id]['date_from']=date_from if 'date_to' in field_names: res[val.id]['date_to']=date_to if 'invoice_state' in field_names: res[val.id]['invoice_state']=invoice_state invoice_types = () states = () if invoice_state=='paid': states=('paid',) elif invoice_state=='open_paid': states=('open','paid') elif invoice_state=='draft_open_paid': states=('draft','open','paid')
c5de222c6616c268ab9364a76ab481c145c8110b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c5de222c6616c268ab9364a76ab481c145c8110b/product_margin.py
'account_id': a,
'account_id': a.id,
def inv_line_create(self, cr, uid, a, ol): return (0, False, { 'name': ol.name, 'account_id': a, 'price_unit': ol.price_unit or 0.0, 'quantity': ol.product_qty, 'product_id': ol.product_id.id or False, 'uos_id': ol.product_uom.id or False, 'invoice_line_tax_id': [(6, 0, [x.id for x in ol.taxes_id])], 'account_analytic_id': ol.account_analytic_id.id, })
4054773cc71ad9fda46b578cf7362877537be12e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/4054773cc71ad9fda46b578cf7362877537be12e/purchase.py
'account_analytic_id': ol.account_analytic_id.id,
'account_analytic_id': ol.account_analytic_id.id or False,
def inv_line_create(self, cr, uid, a, ol): return (0, False, { 'name': ol.name, 'account_id': a, 'price_unit': ol.price_unit or 0.0, 'quantity': ol.product_qty, 'product_id': ol.product_id.id or False, 'uos_id': ol.product_uom.id or False, 'invoice_line_tax_id': [(6, 0, [x.id for x in ol.taxes_id])], 'account_analytic_id': ol.account_analytic_id.id, })
4054773cc71ad9fda46b578cf7362877537be12e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/4054773cc71ad9fda46b578cf7362877537be12e/purchase.py
return ids
return ids and ids[0] or False
def find(self, cr, uid, dt=None, context={}): if not dt: dt = time.strftime('%Y-%m-%d')
39b8bdd07eb4b872fe8572fe0aa04d860eb72aa8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/39b8bdd07eb4b872fe8572fe0aa04d860eb72aa8/account.py
info.get('description', ''), p_id, state, info.get('certificate')))
info.get('description', ''), p_id, state, info.get('certificate') or None))
def init_db(cr): import addons f = addons.get_module_resource('base', 'base.sql') for line in file_open(f).read().split(';'): if (len(line)>0) and (not line.isspace()): cr.execute(line) cr.commit() for i in addons.get_modules(): mod_path = addons.get_module_path(i) if not mod_path: continue info = addons.load_information_from_description_file(i) if not info: continue categs = info.get('category', 'Uncategorized').split('/') p_id = None while categs: if p_id is not None: cr.execute('select id \ from ir_module_category \ where name=%s and parent_id=%s', (categs[0], p_id)) else: cr.execute('select id \ from ir_module_category \ where name=%s and parent_id is NULL', (categs[0],)) c_id = cr.fetchone() if not c_id: cr.execute('select nextval(\'ir_module_category_id_seq\')') c_id = cr.fetchone()[0] cr.execute('insert into ir_module_category \ (id, name, parent_id) \ values (%s, %s, %s)', (c_id, categs[0], p_id)) else: c_id = c_id[0] p_id = c_id categs = categs[1:] active = info.get('active', False) installable = info.get('installable', True) if installable: if active: state = 'to install' else: state = 'uninstalled' else: state = 'uninstallable' cr.execute('select nextval(\'ir_module_module_id_seq\')') id = cr.fetchone()[0] cr.execute('insert into ir_module_module \ (id, author, website, name, shortdesc, description, \ category_id, state, certificate) \ values (%s, %s, %s, %s, %s, %s, %s, %s, %s)', ( id, info.get('author', ''), info.get('website', ''), i, info.get('name', False), info.get('description', ''), p_id, state, info.get('certificate'))) cr.execute('insert into ir_model_data \ (name,model,module, res_id, noupdate) values (%s,%s,%s,%s,%s)', ( 'module_meta_information', 'ir.module.module', i, id, True)) dependencies = info.get('depends', []) for d in dependencies: cr.execute('insert into ir_module_module_dependency \ (module_id,name) values (%s, %s)', (id, d)) cr.commit()
d943997892b0fa69ed41474069ae8b099cc83a13 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/d943997892b0fa69ed41474069ae8b099cc83a13/misc.py
cr.execute('SELECT db_datas FROM ir_attachment WHERE id = %s', ira_browse.id)
cr = ira_browse._cr cr.execute('SELECT db_datas FROM ir_attachment WHERE id = %s',(ira_browse.id,))
def __init__(self, parent, ira_browse, mode): nodes.node_descriptor.__init__(self, parent) if mode.endswith('b'): mode = mode[:-1] if mode in ('r', 'r+'): cr.execute('SELECT db_datas FROM ir_attachment WHERE id = %s', ira_browse.id) data = cr.fetchone()[0] StringIO.__init__(self, data) elif mode in ('w', 'w+'): StringIO.__init__(self, None) # at write, we start at 0 (= overwrite), but have the original # data available, in case of a seek() elif mode == 'a': StringIO.__init__(self, None) else: logging.getLogger('document.storage').error("Incorrect mode %s specified", mode) raise IOError(errno.EINVAL, "Invalid file mode") self.mode = mode
60727b0cb09a5065661df836fc01f83b5c407e95 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/60727b0cb09a5065661df836fc01f83b5c407e95/document_storage.py
out = self.getvalue() cr.execute("UPDATE ir_attachment SET db_datas = decode(%s,'escape'), file_size=%s WHERE id = %s", (out, len(out), par.file_id))
data = self.getvalue() out = psycopg2.Binary(data) cr.execute("UPDATE ir_attachment SET db_datas = %s, file_size=%s WHERE id = %s", (out, len(data), par.file_id))
def close(self): # we now open a *separate* cursor, to update the data. # FIXME: this may be improved, for concurrency handling par = self._get_parent() uid = par.context.uid cr = pooler.get_db(par.context.dbname).cursor() try: if self.mode in ('w', 'w+', 'r+'): out = self.getvalue() cr.execute("UPDATE ir_attachment SET db_datas = decode(%s,'escape'), file_size=%s WHERE id = %s", (out, len(out), par.file_id)) elif self.mode == 'a': out = self.getvalue() cr.execute("UPDATE ir_attachment " \ "SET db_datas = COALESCE(db_datas,'') || decode(%s, 'escape'), " \ " file_size = COALESCE(file_size, 0) + %s " \ " WHERE id = %s", (out, len(out), par.file_id)) cr.commit() except Exception, e: logging.getLogger('document.storage').exception('Cannot update db file #%d for close:', par.file_id) raise finally: cr.close() StringIO.close(self)
60727b0cb09a5065661df836fc01f83b5c407e95 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/60727b0cb09a5065661df836fc01f83b5c407e95/document_storage.py
out = self.getvalue()
data = self.getvalue() out = psycopg2.Binary(data)
def close(self): # we now open a *separate* cursor, to update the data. # FIXME: this may be improved, for concurrency handling par = self._get_parent() uid = par.context.uid cr = pooler.get_db(par.context.dbname).cursor() try: if self.mode in ('w', 'w+', 'r+'): out = self.getvalue() cr.execute("UPDATE ir_attachment SET db_datas = decode(%s,'escape'), file_size=%s WHERE id = %s", (out, len(out), par.file_id)) elif self.mode == 'a': out = self.getvalue() cr.execute("UPDATE ir_attachment " \ "SET db_datas = COALESCE(db_datas,'') || decode(%s, 'escape'), " \ " file_size = COALESCE(file_size, 0) + %s " \ " WHERE id = %s", (out, len(out), par.file_id)) cr.commit() except Exception, e: logging.getLogger('document.storage').exception('Cannot update db file #%d for close:', par.file_id) raise finally: cr.close() StringIO.close(self)
60727b0cb09a5065661df836fc01f83b5c407e95 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/60727b0cb09a5065661df836fc01f83b5c407e95/document_storage.py
"SET db_datas = COALESCE(db_datas,'') || decode(%s, 'escape'), " \
"SET db_datas = COALESCE(db_datas,'') || %s, " \
def close(self): # we now open a *separate* cursor, to update the data. # FIXME: this may be improved, for concurrency handling par = self._get_parent() uid = par.context.uid cr = pooler.get_db(par.context.dbname).cursor() try: if self.mode in ('w', 'w+', 'r+'): out = self.getvalue() cr.execute("UPDATE ir_attachment SET db_datas = decode(%s,'escape'), file_size=%s WHERE id = %s", (out, len(out), par.file_id)) elif self.mode == 'a': out = self.getvalue() cr.execute("UPDATE ir_attachment " \ "SET db_datas = COALESCE(db_datas,'') || decode(%s, 'escape'), " \ " file_size = COALESCE(file_size, 0) + %s " \ " WHERE id = %s", (out, len(out), par.file_id)) cr.commit() except Exception, e: logging.getLogger('document.storage').exception('Cannot update db file #%d for close:', par.file_id) raise finally: cr.close() StringIO.close(self)
60727b0cb09a5065661df836fc01f83b5c407e95 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/60727b0cb09a5065661df836fc01f83b5c407e95/document_storage.py
(out, len(out), par.file_id))
(out, len(data), par.file_id))
def close(self): # we now open a *separate* cursor, to update the data. # FIXME: this may be improved, for concurrency handling par = self._get_parent() uid = par.context.uid cr = pooler.get_db(par.context.dbname).cursor() try: if self.mode in ('w', 'w+', 'r+'): out = self.getvalue() cr.execute("UPDATE ir_attachment SET db_datas = decode(%s,'escape'), file_size=%s WHERE id = %s", (out, len(out), par.file_id)) elif self.mode == 'a': out = self.getvalue() cr.execute("UPDATE ir_attachment " \ "SET db_datas = COALESCE(db_datas,'') || decode(%s, 'escape'), " \ " file_size = COALESCE(file_size, 0) + %s " \ " WHERE id = %s", (out, len(out), par.file_id)) cr.commit() except Exception, e: logging.getLogger('document.storage').exception('Cannot update db file #%d for close:', par.file_id) raise finally: cr.close() StringIO.close(self)
60727b0cb09a5065661df836fc01f83b5c407e95 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/60727b0cb09a5065661df836fc01f83b5c407e95/document_storage.py
(data, file_node.file_id))
(out, file_node.file_id))
def set_data(self, cr, uid, id, file_node, data, context=None, fil_obj=None): """ store the data. This function MUST be used from an ir.attachment. It wouldn't make sense to store things persistently for other types (dynamic). """ if not context: context = {} boo = self.browse(cr, uid, id, context) if fil_obj: ira = fil_obj else: ira = self.pool.get('ir.attachment').browse(cr, uid, file_node.file_id, context=context)
60727b0cb09a5065661df836fc01f83b5c407e95 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/60727b0cb09a5065661df836fc01f83b5c407e95/document_storage.py
'priority': lambda *a: crm.AVAILABLE_PRIORITIES[2][0],
'priority': crm.AVAILABLE_PRIORITIES[2][0], 'type': 'opportunity',
def onchange_stage_id(self, cr, uid, ids, stage_id, context={}):
c3ac979a284e51055a7cf66356fe7ef140b8db6a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c3ac979a284e51055a7cf66356fe7ef140b8db6a/crm_opportunity.py
'name': fields.char('Marital Status', size=32, required=True),
'name': fields.char('Marital Status', size=32, required=True, translate=True),
def _check_recursion(self, cr, uid, ids, context=None): level = 100 while len(ids): cr.execute('select distinct parent_id from hr_employee_category where id IN %s', (tuple(ids), )) ids = filter(None, map(lambda x:x[0], cr.fetchall())) if not level: return False level -= 1 return True
87495c5972a0277359ec13b6e5ad6341e55ebd0d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/87495c5972a0277359ec13b6e5ad6341e55ebd0d/hr.py
def action_move_create(self, cr, uid, ids, *args): """Creates invoice related analytics and financial move lines""" ait_obj = self.pool.get('account.invoice.tax') cur_obj = self.pool.get('res.currency') context = {} for inv in self.browse(cr, uid, ids): if not inv.journal_id.invoice_sequence_id: raise osv.except_osv(_('Error !'), _('Please define invoice sequence on invoice journal')) if not inv.invoice_line: raise osv.except_osv(_('No Invoice Lines !'), _('Please create some invoice lines.')) if inv.move_id: continue
e3606ed329a77235988b82c2185830160f907f86 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/e3606ed329a77235988b82c2185830160f907f86/invoice.py
'fiscalyear_id': inv.period_id.fiscalyear_id.id
'fiscalyear_id': obj_inv.period_id.fiscalyear_id.id
def action_number(self, cr, uid, ids, *args): for obj_inv in self.browse(cr, uid, ids): id = obj_inv.id invtype = obj_inv.type number = obj_inv.number move_id = obj_inv.move_id and obj_inv.move_id.id or False reference = obj_inv.reference if not number: tmp_context = { 'fiscalyear_id': inv.period_id.fiscalyear_id.id } if inv.journal_id.invoice_sequence_id: sequence_id = inv.journal_id.invoice_sequence_id.id number = self.pool.get('ir.sequence').get_id(cr, uid, sequence_id, 'id', context=tmp_context) else: number = self.pool.get('ir.sequence').get_id(cr, uid, 'account.invoice.%s' % invtype, 'code', context=tmp_context) if invtype in ('in_invoice', 'in_refund'): ref = reference else: ref = self._convert_ref(cr, uid, number) cr.execute('UPDATE account_invoice SET number=%s ' \ 'WHERE id=%s', (number, id)) cr.execute('UPDATE account_move SET ref=%s ' \ 'WHERE id=%s AND (ref is null OR ref = \'\')', (ref, move_id)) cr.execute('UPDATE account_move_line SET ref=%s ' \ 'WHERE move_id=%s AND (ref is null OR ref = \'\')', (ref, move_id)) cr.execute('UPDATE account_analytic_line SET ref=%s ' \ 'FROM account_move_line ' \ 'WHERE account_move_line.move_id = %s ' \ 'AND account_analytic_line.move_id = account_move_line.id', (ref, move_id)) message = _('Invoice ') + " '" + number + "' "+ _("is confirm") self.log(cr, uid, id, message) return True
e3606ed329a77235988b82c2185830160f907f86 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/e3606ed329a77235988b82c2185830160f907f86/invoice.py
if inv.journal_id.invoice_sequence_id: sequence_id = inv.journal_id.invoice_sequence_id.id number = self.pool.get('ir.sequence').get_id(cr, uid,
if obj_inv.journal_id.invoice_sequence_id: sequence_id = obj_inv.journal_id.invoice_sequence_id.id number = self.pool.get('ir.sequence').get_id(cr, uid,
def action_number(self, cr, uid, ids, *args): for obj_inv in self.browse(cr, uid, ids): id = obj_inv.id invtype = obj_inv.type number = obj_inv.number move_id = obj_inv.move_id and obj_inv.move_id.id or False reference = obj_inv.reference if not number: tmp_context = { 'fiscalyear_id': inv.period_id.fiscalyear_id.id } if inv.journal_id.invoice_sequence_id: sequence_id = inv.journal_id.invoice_sequence_id.id number = self.pool.get('ir.sequence').get_id(cr, uid, sequence_id, 'id', context=tmp_context) else: number = self.pool.get('ir.sequence').get_id(cr, uid, 'account.invoice.%s' % invtype, 'code', context=tmp_context) if invtype in ('in_invoice', 'in_refund'): ref = reference else: ref = self._convert_ref(cr, uid, number) cr.execute('UPDATE account_invoice SET number=%s ' \ 'WHERE id=%s', (number, id)) cr.execute('UPDATE account_move SET ref=%s ' \ 'WHERE id=%s AND (ref is null OR ref = \'\')', (ref, move_id)) cr.execute('UPDATE account_move_line SET ref=%s ' \ 'WHERE move_id=%s AND (ref is null OR ref = \'\')', (ref, move_id)) cr.execute('UPDATE account_analytic_line SET ref=%s ' \ 'FROM account_move_line ' \ 'WHERE account_move_line.move_id = %s ' \ 'AND account_analytic_line.move_id = account_move_line.id', (ref, move_id)) message = _('Invoice ') + " '" + number + "' "+ _("is confirm") self.log(cr, uid, id, message) return True
e3606ed329a77235988b82c2185830160f907f86 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/e3606ed329a77235988b82c2185830160f907f86/invoice.py
res = [tax.name for tax in pooler.get_pool(cr.dbname).get('account.tax').browse(self.cr, self.uid, tax_ids)]
res = [tax.name for tax in pooler.get_pool(self.cr.dbname).get('account.tax').browse(self.cr, self.uid, tax_ids)]
def _get_line_tax(self, line_obj): self.cr.execute("SELECT tax_id FROM purchase_order_taxe WHERE order_line_id=%s", (line_obj.id)) res = self.cr.fetchall() or None if not res: return "" if isinstance(res, list): tax_ids = [t[0] for t in res] else: tax_ids = res[0] res = [tax.name for tax in pooler.get_pool(cr.dbname).get('account.tax').browse(self.cr, self.uid, tax_ids)] return ",\n ".join(res)
0f4c0f45c2bbee3aa6068412b467908e3c66db52 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/0f4c0f45c2bbee3aa6068412b467908e3c66db52/order.py
tax_obj = pooler.get_pool(cr.dbname).get('account.tax')
tax_obj = pooler.get_pool(self.cr.dbname).get('account.tax')
def _get_tax(self, order_obj): self.cr.execute("SELECT DISTINCT tax_id FROM purchase_order_taxe, purchase_order_line, purchase_order \ WHERE (purchase_order_line.order_id=purchase_order.id) AND (purchase_order.id=%s)", (order_obj.id)) res = self.cr.fetchall() or None if not res: return [] if isinstance(res, list): tax_ids = [t[0] for t in res] else: tax_ids = res[0] tax_obj = pooler.get_pool(cr.dbname).get('account.tax') res = [] for tax in tax_obj.browse(self.cr, self.uid, tax_ids): self.cr.execute("SELECT DISTINCT order_line_id FROM purchase_order_line, purchase_order_taxe \ WHERE (purchase_order_taxe.tax_id=%s) AND (purchase_order_line.order_id=%s)", (tax.id, order_obj.id)) lines = self.cr.fetchall() or None if lines: if isinstance(lines, list): line_ids = [l[0] for l in lines] else: line_ids = lines[0] base = 0 for line in pooler.get_pool(cr.dbname).get('purchase.order.line').browse(self.cr, self.uid, line_ids): base += line.price_subtotal res.append({'code':tax.name, 'base':base, 'amount':base*tax.amount}) return res
0f4c0f45c2bbee3aa6068412b467908e3c66db52 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/0f4c0f45c2bbee3aa6068412b467908e3c66db52/order.py
for line in pooler.get_pool(cr.dbname).get('purchase.order.line').browse(self.cr, self.uid, line_ids):
for line in pooler.get_pool(self.cr.dbname).get('purchase.order.line').browse(self.cr, self.uid, line_ids):
def _get_tax(self, order_obj): self.cr.execute("SELECT DISTINCT tax_id FROM purchase_order_taxe, purchase_order_line, purchase_order \ WHERE (purchase_order_line.order_id=purchase_order.id) AND (purchase_order.id=%s)", (order_obj.id)) res = self.cr.fetchall() or None if not res: return [] if isinstance(res, list): tax_ids = [t[0] for t in res] else: tax_ids = res[0] tax_obj = pooler.get_pool(cr.dbname).get('account.tax') res = [] for tax in tax_obj.browse(self.cr, self.uid, tax_ids): self.cr.execute("SELECT DISTINCT order_line_id FROM purchase_order_line, purchase_order_taxe \ WHERE (purchase_order_taxe.tax_id=%s) AND (purchase_order_line.order_id=%s)", (tax.id, order_obj.id)) lines = self.cr.fetchall() or None if lines: if isinstance(lines, list): line_ids = [l[0] for l in lines] else: line_ids = lines[0] base = 0 for line in pooler.get_pool(cr.dbname).get('purchase.order.line').browse(self.cr, self.uid, line_ids): base += line.price_subtotal res.append({'code':tax.name, 'base':base, 'amount':base*tax.amount}) return res
0f4c0f45c2bbee3aa6068412b467908e3c66db52 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/0f4c0f45c2bbee3aa6068412b467908e3c66db52/order.py
'picking_ids': fields.one2many('stock.picking', 'sale_id', 'Related Picking', readonly=True, help="This is the list of picking list that have been generated for this invoice"),
'picking_ids': fields.one2many('stock.picking', 'sale_id', 'Related Picking', readonly=True, help="This is a list of picking that has been generated for this sale order"),
def _get_order(self, cr, uid, ids, context=None): if context is None: context = {} result = {} for line in self.pool.get('sale.order.line').browse(cr, uid, ids, context=context): result[line.order_id.id] = True return result.keys()
2a31884f706e3ead9783dca564663475a471a03d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/2a31884f706e3ead9783dca564663475a471a03d/sale.py
self.unlink(cr, uid, tounlink)
self.unlink(cr, 1, tounlink)
def vaccum(self, cr, uid): self.check_id += 1 if self.check_id % self._check_time: return True tounlink = [] max = time.time() - self._max_hours * 60 * 60 for id in self.datas: if self.datas[id]['internal.date_access'] < max: tounlink.append(id) self.unlink(cr, uid, tounlink) if len(self.datas)>self._max_count: sorted = map(lambda x: (x[1]['internal.date_access'], x[0]), self.datas.items()) sorted.sort() ids = map(lambda x: x[1], sorted[:len(self.datas)-self._max_count]) self.unlink(cr, uid, ids) return True
594338f9df61b4a967b525fa0a7794eab63514f3 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/594338f9df61b4a967b525fa0a7794eab63514f3/orm.py
def __init__(self, string='unknown', required=False, readonly=False, domain=None, context='', states=None, priority=0, change_default=False, size=None, ondelete="set null", translate=False, select=False, **args):
def __init__(self, string='unknown', required=False, readonly=False, domain=None, context={}, states=None, priority=0, change_default=False, size=None, ondelete="set null", translate=False, select=False, **args):
def __init__(self, string='unknown', required=False, readonly=False, domain=None, context='', states=None, priority=0, change_default=False, size=None, ondelete="set null", translate=False, select=False, **args): self.states = states or {} self.string = string self.readonly = readonly self.required = required self.size = size self.help = args.get('help', '') self.priority = priority self.change_default = change_default self.ondelete = ondelete self.translate = translate self._domain = domain or [] self._context = context self.write = False self.read = False self.view_load = 0 self.select = select self.selectable = True self.group_operator = args.get('group_operator', False) for a in args: if args[a]: setattr(self, a, args[a])
93832f58e8d9edaf3d2bea61528eb1e307a81a1b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/93832f58e8d9edaf3d2bea61528eb1e307a81a1b/fields.py
"""
"""
def view_init(self, cr, uid, fields_list, context=None): """ Creates view dynamically and adding fields at runtime. @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param context: A standard dictionary @return: New arch of view with new columns. """ res = super(stock_return_picking, self).view_init(cr, uid, fields_list, context=context) record_id = context and context.get('active_id', False) if record_id: pick_obj = self.pool.get('stock.picking') pick = pick_obj.browse(cr, uid, record_id) if pick.state not in ['done','confirmed','assigned']: raise osv.except_osv(_('Warning !'), _("You may only return pickings that are Confirmed, Available or Done!")) return_history = {} valid_lines = 0 for m in [line for line in pick.move_lines]: if m.state == 'done': return_history[m.id] = 0 for rec in m.move_history_ids2: return_history[m.id] += (rec.product_qty * rec.product_uom.factor) if m.product_qty * m.product_uom.factor > return_history[m.id]: valid_lines += 1 if 'return%s'%(m.id) not in self._columns: self._columns['return%s'%(m.id)] = fields.float(string=m.name, required=True) if 'invoice_state' not in self._columns: self._columns['invoice_state'] = fields.selection([('2binvoiced', 'To be refunded/invoiced'), ('none', 'No invoicing')], string='Invoicing', required=True) if not valid_lines: raise osv.except_osv(_('Warning !'), _("There are no products to return (only lines in Done state and not fully returned yet can be returned)!")) return res
efa0acb9cd92500502f3689f3efb3b43430de046 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/efa0acb9cd92500502f3689f3efb3b43430de046/stock_return_picking.py
@param context: A standard dictionary
@param context: A standard dictionary
def view_init(self, cr, uid, fields_list, context=None): """ Creates view dynamically and adding fields at runtime. @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param context: A standard dictionary @return: New arch of view with new columns. """ res = super(stock_return_picking, self).view_init(cr, uid, fields_list, context=context) record_id = context and context.get('active_id', False) if record_id: pick_obj = self.pool.get('stock.picking') pick = pick_obj.browse(cr, uid, record_id) if pick.state not in ['done','confirmed','assigned']: raise osv.except_osv(_('Warning !'), _("You may only return pickings that are Confirmed, Available or Done!")) return_history = {} valid_lines = 0 for m in [line for line in pick.move_lines]: if m.state == 'done': return_history[m.id] = 0 for rec in m.move_history_ids2: return_history[m.id] += (rec.product_qty * rec.product_uom.factor) if m.product_qty * m.product_uom.factor > return_history[m.id]: valid_lines += 1 if 'return%s'%(m.id) not in self._columns: self._columns['return%s'%(m.id)] = fields.float(string=m.name, required=True) if 'invoice_state' not in self._columns: self._columns['invoice_state'] = fields.selection([('2binvoiced', 'To be refunded/invoiced'), ('none', 'No invoicing')], string='Invoicing', required=True) if not valid_lines: raise osv.except_osv(_('Warning !'), _("There are no products to return (only lines in Done state and not fully returned yet can be returned)!")) return res
efa0acb9cd92500502f3689f3efb3b43430de046 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/efa0acb9cd92500502f3689f3efb3b43430de046/stock_return_picking.py
record_id = context and context.get('active_id', False)
record_id = context and context.get('active_id', False)
def view_init(self, cr, uid, fields_list, context=None): """ Creates view dynamically and adding fields at runtime. @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param context: A standard dictionary @return: New arch of view with new columns. """ res = super(stock_return_picking, self).view_init(cr, uid, fields_list, context=context) record_id = context and context.get('active_id', False) if record_id: pick_obj = self.pool.get('stock.picking') pick = pick_obj.browse(cr, uid, record_id) if pick.state not in ['done','confirmed','assigned']: raise osv.except_osv(_('Warning !'), _("You may only return pickings that are Confirmed, Available or Done!")) return_history = {} valid_lines = 0 for m in [line for line in pick.move_lines]: if m.state == 'done': return_history[m.id] = 0 for rec in m.move_history_ids2: return_history[m.id] += (rec.product_qty * rec.product_uom.factor) if m.product_qty * m.product_uom.factor > return_history[m.id]: valid_lines += 1 if 'return%s'%(m.id) not in self._columns: self._columns['return%s'%(m.id)] = fields.float(string=m.name, required=True) if 'invoice_state' not in self._columns: self._columns['invoice_state'] = fields.selection([('2binvoiced', 'To be refunded/invoiced'), ('none', 'No invoicing')], string='Invoicing', required=True) if not valid_lines: raise osv.except_osv(_('Warning !'), _("There are no products to return (only lines in Done state and not fully returned yet can be returned)!")) return res
efa0acb9cd92500502f3689f3efb3b43430de046 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/efa0acb9cd92500502f3689f3efb3b43430de046/stock_return_picking.py
def fields_view_get(self, cr, uid, view_id=None, view_type='form',
def fields_view_get(self, cr, uid, view_id=None, view_type='form',
def view_init(self, cr, uid, fields_list, context=None): """ Creates view dynamically and adding fields at runtime. @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param context: A standard dictionary @return: New arch of view with new columns. """ res = super(stock_return_picking, self).view_init(cr, uid, fields_list, context=context) record_id = context and context.get('active_id', False) if record_id: pick_obj = self.pool.get('stock.picking') pick = pick_obj.browse(cr, uid, record_id) if pick.state not in ['done','confirmed','assigned']: raise osv.except_osv(_('Warning !'), _("You may only return pickings that are Confirmed, Available or Done!")) return_history = {} valid_lines = 0 for m in [line for line in pick.move_lines]: if m.state == 'done': return_history[m.id] = 0 for rec in m.move_history_ids2: return_history[m.id] += (rec.product_qty * rec.product_uom.factor) if m.product_qty * m.product_uom.factor > return_history[m.id]: valid_lines += 1 if 'return%s'%(m.id) not in self._columns: self._columns['return%s'%(m.id)] = fields.float(string=m.name, required=True) if 'invoice_state' not in self._columns: self._columns['invoice_state'] = fields.selection([('2binvoiced', 'To be refunded/invoiced'), ('none', 'No invoicing')], string='Invoicing', required=True) if not valid_lines: raise osv.except_osv(_('Warning !'), _("There are no products to return (only lines in Done state and not fully returned yet can be returned)!")) return res
efa0acb9cd92500502f3689f3efb3b43430de046 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/efa0acb9cd92500502f3689f3efb3b43430de046/stock_return_picking.py
"""
"""
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): """ Changes the view dynamically @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param context: A standard dictionary @return: New arch of view. """ res = super(stock_return_picking, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar,submenu=False) record_id = context and context.get('active_id', False) active_model = context.get('active_model') if active_model != 'stock.picking': return res if record_id: pick_obj = self.pool.get('stock.picking') pick = pick_obj.browse(cr, uid, record_id) return_history = {} res['fields'].clear() arch_lst=['<?xml version="1.0"?>', '<form string="%s">' % _('Return lines'), '<label string="%s" colspan="4"/>' % _('Provide the quantities of the returned products.')] for m in pick.move_lines: return_history[m.id] = 0 for rec in m.move_history_ids2: return_history[m.id] += rec.product_qty quantity = m.product_qty if m.state=='done' and quantity > return_history[m.id]: arch_lst.append('<field name="return%s"/>\n<newline/>' % (m.id,)) res['fields']['return%s' % m.id]={'string':m.name, 'type':'float', 'required':True} res.setdefault('returns', []).append(m.id) arch_lst.append('<field name="invoice_state"/>\n<newline/>') res['fields']['invoice_state']={'string':_('Invoicing'), 'type':'selection','required':True, 'selection':[('2binvoiced', _('To be refunded/invoiced')), ('none', _('No invoicing'))]} arch_lst.append('<group col="2" colspan="4">') arch_lst.append('<button icon="gtk-cancel" special="cancel" string="Cancel" />') arch_lst.append('<button name="create_returns" string="Return" colspan="1" type="object" icon="gtk-apply" />') arch_lst.append('</group>') arch_lst.append('</form>') res['arch'] = '\n'.join(arch_lst) return res
efa0acb9cd92500502f3689f3efb3b43430de046 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/efa0acb9cd92500502f3689f3efb3b43430de046/stock_return_picking.py
@param context: A standard dictionary
@param context: A standard dictionary
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): """ Changes the view dynamically @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param context: A standard dictionary @return: New arch of view. """ res = super(stock_return_picking, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar,submenu=False) record_id = context and context.get('active_id', False) active_model = context.get('active_model') if active_model != 'stock.picking': return res if record_id: pick_obj = self.pool.get('stock.picking') pick = pick_obj.browse(cr, uid, record_id) return_history = {} res['fields'].clear() arch_lst=['<?xml version="1.0"?>', '<form string="%s">' % _('Return lines'), '<label string="%s" colspan="4"/>' % _('Provide the quantities of the returned products.')] for m in pick.move_lines: return_history[m.id] = 0 for rec in m.move_history_ids2: return_history[m.id] += rec.product_qty quantity = m.product_qty if m.state=='done' and quantity > return_history[m.id]: arch_lst.append('<field name="return%s"/>\n<newline/>' % (m.id,)) res['fields']['return%s' % m.id]={'string':m.name, 'type':'float', 'required':True} res.setdefault('returns', []).append(m.id) arch_lst.append('<field name="invoice_state"/>\n<newline/>') res['fields']['invoice_state']={'string':_('Invoicing'), 'type':'selection','required':True, 'selection':[('2binvoiced', _('To be refunded/invoiced')), ('none', _('No invoicing'))]} arch_lst.append('<group col="2" colspan="4">') arch_lst.append('<button icon="gtk-cancel" special="cancel" string="Cancel" />') arch_lst.append('<button name="create_returns" string="Return" colspan="1" type="object" icon="gtk-apply" />') arch_lst.append('</group>') arch_lst.append('</form>') res['arch'] = '\n'.join(arch_lst) return res
efa0acb9cd92500502f3689f3efb3b43430de046 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/efa0acb9cd92500502f3689f3efb3b43430de046/stock_return_picking.py
res['fields']['return%s' % m.id]={'string':m.name, 'type':'float', 'required':True}
res['fields']['return%s' % m.id]={'string':m.name, 'type':'float', 'required':True}
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): """ Changes the view dynamically @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param context: A standard dictionary @return: New arch of view. """ res = super(stock_return_picking, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar,submenu=False) record_id = context and context.get('active_id', False) active_model = context.get('active_model') if active_model != 'stock.picking': return res if record_id: pick_obj = self.pool.get('stock.picking') pick = pick_obj.browse(cr, uid, record_id) return_history = {} res['fields'].clear() arch_lst=['<?xml version="1.0"?>', '<form string="%s">' % _('Return lines'), '<label string="%s" colspan="4"/>' % _('Provide the quantities of the returned products.')] for m in pick.move_lines: return_history[m.id] = 0 for rec in m.move_history_ids2: return_history[m.id] += rec.product_qty quantity = m.product_qty if m.state=='done' and quantity > return_history[m.id]: arch_lst.append('<field name="return%s"/>\n<newline/>' % (m.id,)) res['fields']['return%s' % m.id]={'string':m.name, 'type':'float', 'required':True} res.setdefault('returns', []).append(m.id) arch_lst.append('<field name="invoice_state"/>\n<newline/>') res['fields']['invoice_state']={'string':_('Invoicing'), 'type':'selection','required':True, 'selection':[('2binvoiced', _('To be refunded/invoiced')), ('none', _('No invoicing'))]} arch_lst.append('<group col="2" colspan="4">') arch_lst.append('<button icon="gtk-cancel" special="cancel" string="Cancel" />') arch_lst.append('<button name="create_returns" string="Return" colspan="1" type="object" icon="gtk-apply" />') arch_lst.append('</group>') arch_lst.append('</form>') res['arch'] = '\n'.join(arch_lst) return res
efa0acb9cd92500502f3689f3efb3b43430de046 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/efa0acb9cd92500502f3689f3efb3b43430de046/stock_return_picking.py
"""
"""
def create_returns(self, cr, uid, ids, context): """ Creates return picking. @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param ids: List of ids selected @param context: A standard dictionary @return: A dictionary which of fields with values. """ record_id = context and context.get('active_id', False) or False move_obj = self.pool.get('stock.move') pick_obj = self.pool.get('stock.picking') uom_obj = self.pool.get('product.uom') wf_service = netsvc.LocalService("workflow") pick = pick_obj.browse(cr, uid, record_id) data = self.read(cr, uid, ids[0]) new_picking = None date_cur = time.strftime('%Y-%m-%d %H:%M:%S') set_invoice_state_to_none = True returned_lines = 0 for move in pick.move_lines: if not new_picking: if pick.type=='out': new_type = 'in' elif pick.type=='in': new_type = 'out' else: new_type = 'internal' new_picking = pick_obj.copy(cr, uid, pick.id, {'name':'%s (return)' % pick.name, 'move_lines':[], 'state':'draft', 'type':new_type, 'date':date_cur, 'invoice_state':data['invoice_state'],}) new_location=move.location_dest_id.id if move.state=='done': new_qty = data['return%s' % move.id] returned_qty = move.product_qty for rec in move.move_history_ids2: returned_qty -= rec.product_qty if returned_qty != new_qty: set_invoice_state_to_none = False
efa0acb9cd92500502f3689f3efb3b43430de046 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/efa0acb9cd92500502f3689f3efb3b43430de046/stock_return_picking.py
@param ids: List of ids selected @param context: A standard dictionary @return: A dictionary which of fields with values. """
@param ids: List of ids selected @param context: A standard dictionary @return: A dictionary which of fields with values. """
def create_returns(self, cr, uid, ids, context): """ Creates return picking. @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param ids: List of ids selected @param context: A standard dictionary @return: A dictionary which of fields with values. """ record_id = context and context.get('active_id', False) or False move_obj = self.pool.get('stock.move') pick_obj = self.pool.get('stock.picking') uom_obj = self.pool.get('product.uom') wf_service = netsvc.LocalService("workflow") pick = pick_obj.browse(cr, uid, record_id) data = self.read(cr, uid, ids[0]) new_picking = None date_cur = time.strftime('%Y-%m-%d %H:%M:%S') set_invoice_state_to_none = True returned_lines = 0 for move in pick.move_lines: if not new_picking: if pick.type=='out': new_type = 'in' elif pick.type=='in': new_type = 'out' else: new_type = 'internal' new_picking = pick_obj.copy(cr, uid, pick.id, {'name':'%s (return)' % pick.name, 'move_lines':[], 'state':'draft', 'type':new_type, 'date':date_cur, 'invoice_state':data['invoice_state'],}) new_location=move.location_dest_id.id if move.state=='done': new_qty = data['return%s' % move.id] returned_qty = move.product_qty for rec in move.move_history_ids2: returned_qty -= rec.product_qty if returned_qty != new_qty: set_invoice_state_to_none = False
efa0acb9cd92500502f3689f3efb3b43430de046 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/efa0acb9cd92500502f3689f3efb3b43430de046/stock_return_picking.py
def create_returns(self, cr, uid, ids, context): """ Creates return picking. @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param ids: List of ids selected @param context: A standard dictionary @return: A dictionary which of fields with values. """ record_id = context and context.get('active_id', False) or False move_obj = self.pool.get('stock.move') pick_obj = self.pool.get('stock.picking') uom_obj = self.pool.get('product.uom') wf_service = netsvc.LocalService("workflow") pick = pick_obj.browse(cr, uid, record_id) data = self.read(cr, uid, ids[0]) new_picking = None date_cur = time.strftime('%Y-%m-%d %H:%M:%S') set_invoice_state_to_none = True returned_lines = 0 for move in pick.move_lines: if not new_picking: if pick.type=='out': new_type = 'in' elif pick.type=='in': new_type = 'out' else: new_type = 'internal' new_picking = pick_obj.copy(cr, uid, pick.id, {'name':'%s (return)' % pick.name, 'move_lines':[], 'state':'draft', 'type':new_type, 'date':date_cur, 'invoice_state':data['invoice_state'],}) new_location=move.location_dest_id.id if move.state=='done': new_qty = data['return%s' % move.id] returned_qty = move.product_qty for rec in move.move_history_ids2: returned_qty -= rec.product_qty if returned_qty != new_qty: set_invoice_state_to_none = False
efa0acb9cd92500502f3689f3efb3b43430de046 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/efa0acb9cd92500502f3689f3efb3b43430de046/stock_return_picking.py
def create_returns(self, cr, uid, ids, context): """ Creates return picking. @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param ids: List of ids selected @param context: A standard dictionary @return: A dictionary which of fields with values. """ record_id = context and context.get('active_id', False) or False move_obj = self.pool.get('stock.move') pick_obj = self.pool.get('stock.picking') uom_obj = self.pool.get('product.uom') wf_service = netsvc.LocalService("workflow") pick = pick_obj.browse(cr, uid, record_id) data = self.read(cr, uid, ids[0]) new_picking = None date_cur = time.strftime('%Y-%m-%d %H:%M:%S') set_invoice_state_to_none = True returned_lines = 0 for move in pick.move_lines: if not new_picking: if pick.type=='out': new_type = 'in' elif pick.type=='in': new_type = 'out' else: new_type = 'internal' new_picking = pick_obj.copy(cr, uid, pick.id, {'name':'%s (return)' % pick.name, 'move_lines':[], 'state':'draft', 'type':new_type, 'date':date_cur, 'invoice_state':data['invoice_state'],}) new_location=move.location_dest_id.id if move.state=='done': new_qty = data['return%s' % move.id] returned_qty = move.product_qty for rec in move.move_history_ids2: returned_qty -= rec.product_qty if returned_qty != new_qty: set_invoice_state_to_none = False
efa0acb9cd92500502f3689f3efb3b43430de046 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/efa0acb9cd92500502f3689f3efb3b43430de046/stock_return_picking.py
new_picking = pick_obj.copy(cr, uid, pick.id, {'name':'%s (return)' % pick.name,
new_picking = pick_obj.copy(cr, uid, pick.id, {'name':'%s-return' % pick.name,
def create_returns(self, cr, uid, ids, context): """ Creates return picking. @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param ids: List of ids selected @param context: A standard dictionary @return: A dictionary which of fields with values. """ record_id = context and context.get('active_id', False) or False move_obj = self.pool.get('stock.move') pick_obj = self.pool.get('stock.picking') uom_obj = self.pool.get('product.uom') wf_service = netsvc.LocalService("workflow") pick = pick_obj.browse(cr, uid, record_id) data = self.read(cr, uid, ids[0]) new_picking = None date_cur = time.strftime('%Y-%m-%d %H:%M:%S') set_invoice_state_to_none = True returned_lines = 0 for move in pick.move_lines: if not new_picking: if pick.type=='out': new_type = 'in' elif pick.type=='in': new_type = 'out' else: new_type = 'internal' new_picking = pick_obj.copy(cr, uid, pick.id, {'name':'%s (return)' % pick.name, 'move_lines':[], 'state':'draft', 'type':new_type, 'date':date_cur, 'invoice_state':data['invoice_state'],}) new_location=move.location_dest_id.id if move.state=='done': new_qty = data['return%s' % move.id] returned_qty = move.product_qty for rec in move.move_history_ids2: returned_qty -= rec.product_qty if returned_qty != new_qty: set_invoice_state_to_none = False
efa0acb9cd92500502f3689f3efb3b43430de046 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/efa0acb9cd92500502f3689f3efb3b43430de046/stock_return_picking.py
def create_returns(self, cr, uid, ids, context): """ Creates return picking. @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param ids: List of ids selected @param context: A standard dictionary @return: A dictionary which of fields with values. """ record_id = context and context.get('active_id', False) or False move_obj = self.pool.get('stock.move') pick_obj = self.pool.get('stock.picking') uom_obj = self.pool.get('product.uom') wf_service = netsvc.LocalService("workflow") pick = pick_obj.browse(cr, uid, record_id) data = self.read(cr, uid, ids[0]) new_picking = None date_cur = time.strftime('%Y-%m-%d %H:%M:%S') set_invoice_state_to_none = True returned_lines = 0 for move in pick.move_lines: if not new_picking: if pick.type=='out': new_type = 'in' elif pick.type=='in': new_type = 'out' else: new_type = 'internal' new_picking = pick_obj.copy(cr, uid, pick.id, {'name':'%s (return)' % pick.name, 'move_lines':[], 'state':'draft', 'type':new_type, 'date':date_cur, 'invoice_state':data['invoice_state'],}) new_location=move.location_dest_id.id if move.state=='done': new_qty = data['return%s' % move.id] returned_qty = move.product_qty for rec in move.move_history_ids2: returned_qty -= rec.product_qty if returned_qty != new_qty: set_invoice_state_to_none = False
efa0acb9cd92500502f3689f3efb3b43430de046 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/efa0acb9cd92500502f3689f3efb3b43430de046/stock_return_picking.py
def create_returns(self, cr, uid, ids, context): """ Creates return picking. @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param ids: List of ids selected @param context: A standard dictionary @return: A dictionary which of fields with values. """ record_id = context and context.get('active_id', False) or False move_obj = self.pool.get('stock.move') pick_obj = self.pool.get('stock.picking') uom_obj = self.pool.get('product.uom') wf_service = netsvc.LocalService("workflow") pick = pick_obj.browse(cr, uid, record_id) data = self.read(cr, uid, ids[0]) new_picking = None date_cur = time.strftime('%Y-%m-%d %H:%M:%S') set_invoice_state_to_none = True returned_lines = 0 for move in pick.move_lines: if not new_picking: if pick.type=='out': new_type = 'in' elif pick.type=='in': new_type = 'out' else: new_type = 'internal' new_picking = pick_obj.copy(cr, uid, pick.id, {'name':'%s (return)' % pick.name, 'move_lines':[], 'state':'draft', 'type':new_type, 'date':date_cur, 'invoice_state':data['invoice_state'],}) new_location=move.location_dest_id.id if move.state=='done': new_qty = data['return%s' % move.id] returned_qty = move.product_qty for rec in move.move_history_ids2: returned_qty -= rec.product_qty if returned_qty != new_qty: set_invoice_state_to_none = False
efa0acb9cd92500502f3689f3efb3b43430de046 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/efa0acb9cd92500502f3689f3efb3b43430de046/stock_return_picking.py
returned_lines += 1
returned_lines += 1
def create_returns(self, cr, uid, ids, context): """ Creates return picking. @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param ids: List of ids selected @param context: A standard dictionary @return: A dictionary which of fields with values. """ record_id = context and context.get('active_id', False) or False move_obj = self.pool.get('stock.move') pick_obj = self.pool.get('stock.picking') uom_obj = self.pool.get('product.uom') wf_service = netsvc.LocalService("workflow") pick = pick_obj.browse(cr, uid, record_id) data = self.read(cr, uid, ids[0]) new_picking = None date_cur = time.strftime('%Y-%m-%d %H:%M:%S') set_invoice_state_to_none = True returned_lines = 0 for move in pick.move_lines: if not new_picking: if pick.type=='out': new_type = 'in' elif pick.type=='in': new_type = 'out' else: new_type = 'internal' new_picking = pick_obj.copy(cr, uid, pick.id, {'name':'%s (return)' % pick.name, 'move_lines':[], 'state':'draft', 'type':new_type, 'date':date_cur, 'invoice_state':data['invoice_state'],}) new_location=move.location_dest_id.id if move.state=='done': new_qty = data['return%s' % move.id] returned_qty = move.product_qty for rec in move.move_history_ids2: returned_qty -= rec.product_qty if returned_qty != new_qty: set_invoice_state_to_none = False
efa0acb9cd92500502f3689f3efb3b43430de046 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/efa0acb9cd92500502f3689f3efb3b43430de046/stock_return_picking.py
(lang, tt, tools.ustr(name), source))
(lang or '', tt, tools.ustr(name), source))
def _get_source(self, cr, uid, name, tt, lang, source=None): if not lang: return '' if source: #if isinstance(source, unicode): # source = source.encode('utf8') cr.execute('select value ' \ 'from ir_translation ' \ 'where lang=%s ' \ 'and type=%s ' \ 'and name=%s ' \ 'and src=%s', (lang, tt, tools.ustr(name), source)) else: cr.execute('select value ' \ 'from ir_translation ' \ 'where lang=%s ' \ 'and type=%s ' \ 'and name=%s', (lang, tt, tools.ustr(name))) res = cr.fetchone() trad = res and res[0] or '' return trad
0e776c38ea594a7fee45aac2aea58a6d38e911d6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/0e776c38ea594a7fee45aac2aea58a6d38e911d6/ir_translation.py
(lang, tt, tools.ustr(name)))
(lang or '', tt, tools.ustr(name)))
def _get_source(self, cr, uid, name, tt, lang, source=None): if not lang: return '' if source: #if isinstance(source, unicode): # source = source.encode('utf8') cr.execute('select value ' \ 'from ir_translation ' \ 'where lang=%s ' \ 'and type=%s ' \ 'and name=%s ' \ 'and src=%s', (lang, tt, tools.ustr(name), source)) else: cr.execute('select value ' \ 'from ir_translation ' \ 'where lang=%s ' \ 'and type=%s ' \ 'and name=%s', (lang, tt, tools.ustr(name))) res = cr.fetchone() trad = res and res[0] or '' return trad
0e776c38ea594a7fee45aac2aea58a6d38e911d6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/0e776c38ea594a7fee45aac2aea58a6d38e911d6/ir_translation.py
_name = 'report.account.tax.code.entries'
def _record_to_report_line(record): return {'date': record.date, 'ref': record.ref, 'acode': record.account_id.code, 'name': record.name, 'debit': record.debit, 'credit': record.credit, 'pname': record.partner_id and record.partner_id.name or '', 'country': _get_country(record) }
a33d6ea2efdb65c1b1ee3a69d5fc7e3ea5ef6b2c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/a33d6ea2efdb65c1b1ee3a69d5fc7e3ea5ef6b2c/account_tax_code.py
return {'nodestroy':True,}
return {}
def create_payment(self, cr, uid, ids, context=None): order_obj = self.pool.get('payment.order') line_obj = self.pool.get('account.move.line') payment_obj = self.pool.get('payment.line') if context is None: context = {} data = self.read(cr, uid, ids, [])[0] line_ids = data['entries'] if not line_ids: return {}
8cfbb441d21e7a6fa95d1b9fb8e39853904a9bfe /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/8cfbb441d21e7a6fa95d1b9fb8e39853904a9bfe/account_payment_order.py
fields[field.field] = [None, journal.id]
fields[field.field] = [journal.id]
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context={}, toolbar=False, submenu=False): result = super(osv.osv, self).fields_view_get(cr, uid, view_id,view_type,context,toolbar=toolbar, submenu=submenu) if view_type != 'tree': return result
df9590fe959d60070a811fe2c2d87002e7fcb5af /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/df9590fe959d60070a811fe2c2d87002e7fcb5af/account_move_line.py
pdt = datetime.datetime.strftime(date_dt,"%Y-%m-%d %H:%M") class user(Resource): pass
dt = datetime.datetime.strftime(date_dt,"%Y-%m-%d %H:%M")
def _compute_date(self, cr, uid, data, context):
afacda2c1dc8e7495aa88496b9db7c3ac70bf127 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/afacda2c1dc8e7495aa88496b9db7c3ac70bf127/compute_tasks_date.py
resource_obj = pooler.get_pool(cr.dbname).get('resource.resource').browse(cr,uid,resource_id)[0] if resource_obj.calendar_id:
if resource_id : resource_obj = pooler.get_pool(cr.dbname).get('resource.resource').browse(cr,uid,resource_id)[0] if resource_obj.calendar_id: calendar_id = resource_obj.calendar_id.id resource_leave_ids = pooler.get_pool(cr.dbname).get('resource.calendar.leaves').search(cr,uid,[('resource_id','=',resource_id)]) else: calendar_id = project.resource_calendar_id.id resource_leave_ids = pooler.get_pool(cr.dbname).get('resource.calendar.leaves').search(cr,uid,[('calendar_id','=',project.resource_calendar_id.id)])
def _compute_date(self, cr, uid, data, context):
afacda2c1dc8e7495aa88496b9db7c3ac70bf127 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/afacda2c1dc8e7495aa88496b9db7c3ac70bf127/compute_tasks_date.py
b = ""
non_working = ""
def _compute_date(self, cr, uid, data, context):
afacda2c1dc8e7495aa88496b9db7c3ac70bf127 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/afacda2c1dc8e7495aa88496b9db7c3ac70bf127/compute_tasks_date.py
week_ids = pooler.get_pool(cr.dbname).get('resource.calendar.week').search(cr,uid,[('calendar_id','=',resource_obj.calendar_id.id)])
week_ids = pooler.get_pool(cr.dbname).get('resource.calendar.week').search(cr,uid,[('calendar_id','=',calendar_id)])
def _compute_date(self, cr, uid, data, context):
afacda2c1dc8e7495aa88496b9db7c3ac70bf127 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/afacda2c1dc8e7495aa88496b9db7c3ac70bf127/compute_tasks_date.py
b += v + ',' final_lst.append((b[:-1],time_range)) print 'Final Tlist:::',tlist
non_working += v + ',' if non_working: final_lst.append((non_working[:-1],time_range)) print 'Final list After Adding Non-Working:::',final_lst
def _compute_date(self, cr, uid, data, context):
afacda2c1dc8e7495aa88496b9db7c3ac70bf127 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/afacda2c1dc8e7495aa88496b9db7c3ac70bf127/compute_tasks_date.py
resource_leave_ids = pooler.get_pool(cr.dbname).get('resource.calendar.leaves').search(cr,uid,[('resource_id','=',resource_id)])
def _compute_date(self, cr, uid, data, context):
afacda2c1dc8e7495aa88496b9db7c3ac70bf127 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/afacda2c1dc8e7495aa88496b9db7c3ac70bf127/compute_tasks_date.py
ndt = pdt
new_dt = dt
def _compute_date(self, cr, uid, data, context):
afacda2c1dc8e7495aa88496b9db7c3ac70bf127 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/afacda2c1dc8e7495aa88496b9db7c3ac70bf127/compute_tasks_date.py
ndt = data['date_end'][0:16]
new_dt = data['date_end'][0:16]
def _compute_date(self, cr, uid, data, context):
afacda2c1dc8e7495aa88496b9db7c3ac70bf127 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/afacda2c1dc8e7495aa88496b9db7c3ac70bf127/compute_tasks_date.py
start = ndt
start = new_dt
def Project_1(): resource = user title = project.name start = ndt effort = hours
afacda2c1dc8e7495aa88496b9db7c3ac70bf127 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/afacda2c1dc8e7495aa88496b9db7c3ac70bf127/compute_tasks_date.py
start = ndt
start = new_dt
def task1(): start = ndt effort = hours title = task_obj[i].name
afacda2c1dc8e7495aa88496b9db7c3ac70bf127 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/afacda2c1dc8e7495aa88496b9db7c3ac70bf127/compute_tasks_date.py
super(Workflow, self).__init__(**kwargs)
super(ActWindow, self).__init__(**kwargs)
def __init__(self, model, action, **kwargs): self.model = model self.action = action super(Workflow, self).__init__(**kwargs)
434c1fb2cacbe323338e631d13d1cbc9fec6bf4a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/434c1fb2cacbe323338e631d13d1cbc9fec6bf4a/yaml_test.py
class Ref(YamlTag): def __init__(self, xmlid): self.xmlid = xmlid super(Ref, self).__init__()
class IrSet(YamlTag): def __init__(self): super(IrSet, self).__init__()
def __init__(self, expression): self.expression = expression super(Eval, self).__init__()
434c1fb2cacbe323338e631d13d1cbc9fec6bf4a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/434c1fb2cacbe323338e631d13d1cbc9fec6bf4a/yaml_test.py
def ref_constructor(loader, node): xmlid = loader.construct_scalar(node) return Ref(xmlid)
def ir_set_constructor(loader, node): kwargs = loader.construct_mapping(node) return IrSet(**kwargs)
def ref_constructor(loader, node): xmlid = loader.construct_scalar(node) return Ref(xmlid)
434c1fb2cacbe323338e631d13d1cbc9fec6bf4a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/434c1fb2cacbe323338e631d13d1cbc9fec6bf4a/yaml_test.py
yaml.add_constructor(u"!ref", ref_constructor)
yaml.add_constructor(u"!ir_set", ir_set_constructor)
def ref_constructor(loader, node): xmlid = loader.construct_scalar(node) return Ref(xmlid)
434c1fb2cacbe323338e631d13d1cbc9fec6bf4a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/434c1fb2cacbe323338e631d13d1cbc9fec6bf4a/yaml_test.py
def is_ref(node): return isinstance(node, Ref)
def is_ir_set(node): return _is_yaml_mapping(node, IrSet)
def is_ref(node): return isinstance(node, Ref)
434c1fb2cacbe323338e631d13d1cbc9fec6bf4a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/434c1fb2cacbe323338e631d13d1cbc9fec6bf4a/yaml_test.py
paths = tools.config['addons_path'].split(",") for path in paths: full_path = os.path.join(path, 'hr/image', 'photo.png') if os.path.exists(full_path): return open(full_path,'rb') .read().encode('base64') raise Exception("photo.png could not be found")
res_path = addons.get_module_resource("hr","image/photo.png") return open(res_path,'rb').read().encode('base64')
def _get_photo(self, cr, uid, context=None): paths = tools.config['addons_path'].split(",") for path in paths: full_path = os.path.join(path, 'hr/image', 'photo.png') if os.path.exists(full_path): return open(full_path,'rb') .read().encode('base64') raise Exception("photo.png could not be found")
53d9dc8d8119728a7091d7c99eba83c1065ac7be /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/53d9dc8d8119728a7091d7c99eba83c1065ac7be/hr.py
menu_id = dataobj._get_id(cr, uid, 'base', 'menu_administration_shortcut', context) shortcut_menu_id = int(dataobj.read(cr, uid, menu_id, ['res_id'], context)['res_id']) action_id = self.pool.get('ir.actions.act_window').create(cr, uid, values, context)
new_context = context.copy() for key in context: if key.startswith('default_'): del new_context[key] menu_id = dataobj._get_id(cr, uid, 'base', 'menu_administration_shortcut', new_context) shortcut_menu_id = int(dataobj.read(cr, uid, menu_id, ['res_id'], new_context)['res_id']) action_id = self.pool.get('ir.actions.act_window').create(cr, uid, values, new_context)
def create_shortcut(self, cr, uid, values, context={}): dataobj = self.pool.get('ir.model.data') menu_id = dataobj._get_id(cr, uid, 'base', 'menu_administration_shortcut', context) shortcut_menu_id = int(dataobj.read(cr, uid, menu_id, ['res_id'], context)['res_id']) action_id = self.pool.get('ir.actions.act_window').create(cr, uid, values, context) menu_data = {'name':values['name'], 'sequence':10, 'action':'ir.actions.act_window,'+str(action_id), 'parent_id':shortcut_menu_id, 'icon':'STOCK_JUSTIFY_FILL'} menu_id = self.pool.get('ir.ui.menu').create(cr, uid, menu_data) sc_data= {'name':values['name'], 'sequence': 1,'res_id': menu_id } sc_menu_id = self.pool.get('ir.ui.view_sc').create(cr, uid, sc_data, context)
658d2ba6256d12d5e170246819401beb72c19d2d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/658d2ba6256d12d5e170246819401beb72c19d2d/ir_ui_menu.py
sc_menu_id = self.pool.get('ir.ui.view_sc').create(cr, uid, sc_data, context)
sc_menu_id = self.pool.get('ir.ui.view_sc').create(cr, uid, sc_data, new_context)
def create_shortcut(self, cr, uid, values, context={}): dataobj = self.pool.get('ir.model.data') menu_id = dataobj._get_id(cr, uid, 'base', 'menu_administration_shortcut', context) shortcut_menu_id = int(dataobj.read(cr, uid, menu_id, ['res_id'], context)['res_id']) action_id = self.pool.get('ir.actions.act_window').create(cr, uid, values, context) menu_data = {'name':values['name'], 'sequence':10, 'action':'ir.actions.act_window,'+str(action_id), 'parent_id':shortcut_menu_id, 'icon':'STOCK_JUSTIFY_FILL'} menu_id = self.pool.get('ir.ui.menu').create(cr, uid, menu_data) sc_data= {'name':values['name'], 'sequence': 1,'res_id': menu_id } sc_menu_id = self.pool.get('ir.ui.view_sc').create(cr, uid, sc_data, context)
658d2ba6256d12d5e170246819401beb72c19d2d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/658d2ba6256d12d5e170246819401beb72c19d2d/ir_ui_menu.py
_order = 'default_code'
_order = 'default_code,name_template'
def _product_partner_ref(self, cr, uid, ids, name, arg, context=None): res = {} if context is None: context = {} for p in self.browse(cr, uid, ids, context=context): data = self._get_partner_code_name(cr, uid, [], p, context.get('partner_id', None), context=context) if not data['variants']: data['variants'] = p.variants if not data['code']: data['code'] = p.code if not data['name']: data['name'] = p.name res[p.id] = (data['code'] and ('['+data['code']+'] ') or '') + \ (data['name'] or '') + (data['variants'] and (' - '+data['variants']) or '') return res
24b332f5f854fe93c6870e0d2553af9c033ff561 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/24b332f5f854fe93c6870e0d2553af9c033ff561/product.py
def onchange_partner_id(self, cr, uid, ids, partner_id, journal_id=False, price=0.0, ttype=False, context={}):
def onchange_partner_id(self, cr, uid, ids, partner_id, journal_id=False, price=0.0, currency_id=False, ttype=False, context={}):
def onchange_partner_id(self, cr, uid, ids, partner_id, journal_id=False, price=0.0, ttype=False, context={}): """price Returns a dict that contains new values and context @param partner_id: latest value from user input for field partner_id @param args: other arguments @param context: context arguments, like lang, time zone @return: Returns a dict which contains new values, and context """ if not journal_id: return {} move_pool = self.pool.get('account.move') line_pool = self.pool.get('account.voucher.line') move_line_pool = self.pool.get('account.move.line') partner_pool = self.pool.get('res.partner') journal_pool = self.pool.get('account.journal') default = { 'value':{'line_ids':[], 'line_dr_ids':[], 'line_cr_ids':[], 'pre_line': False}, }
b8fd400367988e205e907cf20e67b12b1b398cc1 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/b8fd400367988e205e907cf20e67b12b1b398cc1/voucher.py
rs['amount'] = min(line.amount_unreconciled, total_debit) total_debit -= rs['amount']
amount = min(line.amount_unreconciled, total_debit) rs['amount'] = currency_pool.compute(cr, uid, company_currency, currency_id, amount) total_debit -= amount
def onchange_partner_id(self, cr, uid, ids, partner_id, journal_id=False, price=0.0, ttype=False, context={}): """price Returns a dict that contains new values and context @param partner_id: latest value from user input for field partner_id @param args: other arguments @param context: context arguments, like lang, time zone @return: Returns a dict which contains new values, and context """ if not journal_id: return {} move_pool = self.pool.get('account.move') line_pool = self.pool.get('account.voucher.line') move_line_pool = self.pool.get('account.move.line') partner_pool = self.pool.get('res.partner') journal_pool = self.pool.get('account.journal') default = { 'value':{'line_ids':[], 'line_dr_ids':[], 'line_cr_ids':[], 'pre_line': False}, }
b8fd400367988e205e907cf20e67b12b1b398cc1 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/b8fd400367988e205e907cf20e67b12b1b398cc1/voucher.py
rs['amount'] = min(line.amount_unreconciled, total_credit) total_credit -= rs['amount']
amount = min(line.amount_unreconciled, total_credit) rs['amount'] = currency_pool.compute(cr, uid, company_currency, currency_id, amount) total_credit -= amount
def onchange_partner_id(self, cr, uid, ids, partner_id, journal_id=False, price=0.0, ttype=False, context={}): """price Returns a dict that contains new values and context @param partner_id: latest value from user input for field partner_id @param args: other arguments @param context: context arguments, like lang, time zone @return: Returns a dict which contains new values, and context """ if not journal_id: return {} move_pool = self.pool.get('account.move') line_pool = self.pool.get('account.voucher.line') move_line_pool = self.pool.get('account.move.line') partner_pool = self.pool.get('res.partner') journal_pool = self.pool.get('account.journal') default = { 'value':{'line_ids':[], 'line_dr_ids':[], 'line_cr_ids':[], 'pre_line': False}, }
b8fd400367988e205e907cf20e67b12b1b398cc1 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/b8fd400367988e205e907cf20e67b12b1b398cc1/voucher.py
val={} dom={}
val = {} dom = {} obj_journal = self.pool.get('account.journal')
def onchange_company_id(self, cr, uid, ids, company_id, part_id, type, invoice_line, currency_id): val={} dom={} if company_id and part_id and type: acc_id = False partner_obj = self.pool.get('res.partner').browse(cr,uid,part_id) if partner_obj.property_account_payable and partner_obj.property_account_receivable: if partner_obj.property_account_payable.company_id.id != company_id and partner_obj.property_account_receivable.company_id.id != company_id: rec_pro_id = self.pool.get('ir.property').search(cr,uid,[('name','=','property_account_receivable'),('res_id','=','res.partner,'+str(part_id)+''),('company_id','=',company_id)]) pay_pro_id = self.pool.get('ir.property').search(cr,uid,[('name','=','property_account_payable'),('res_id','=','res.partner,'+str(part_id)+''),('company_id','=',company_id)]) if not rec_pro_id: rec_pro_id = self.pool.get('ir.property').search(cr,uid,[('name','=','property_account_receivable'),('company_id','=',company_id)]) if not pay_pro_id: pay_pro_id = self.pool.get('ir.property').search(cr,uid,[('name','=','property_account_payable'),('company_id','=',company_id)]) rec_line_data = self.pool.get('ir.property').read(cr,uid,rec_pro_id,['name','value','res_id']) pay_line_data = self.pool.get('ir.property').read(cr,uid,pay_pro_id,['name','value','res_id']) rec_res_id = rec_line_data and int(rec_line_data[0]['value'].split(',')[1]) or False pay_res_id = pay_line_data and int(pay_line_data[0]['value'].split(',')[1]) or False if not rec_res_id and not rec_res_id: raise osv.except_osv(_('Configration Error !'), _('Can not find account chart for this company, Please Create account.')) if type in ('out_invoice', 'out_refund'): acc_id = rec_res_id else: acc_id = pay_res_id val= {'account_id': acc_id} if ids: if company_id: inv_obj = self.browse(cr,uid,ids) for line in inv_obj[0].invoice_line: if line.account_id: if line.account_id.company_id.id != company_id: result_id = self.pool.get('account.account').search(cr,uid,[('name','=',line.account_id.name),('company_id','=',company_id)]) if not result_id: raise osv.except_osv(_('Configration Error !'), _('Can not find account chart for this company in invoice line account, Please Create account.')) r_id = self.pool.get('account.invoice.line').write(cr,uid,[line.id],{'account_id': result_id[0]}) else: if invoice_line: for inv_line in invoice_line: obj_l = self.pool.get('account.account').browse(cr,uid,inv_line[2]['account_id']) if obj_l.company_id.id != company_id: raise osv.except_osv(_('Configration Error !'), _('invoice line account company is not match with invoice company.')) else: continue if company_id: val['journal_id']=False journal_ids=self.pool.get('account.journal').search(cr,uid,[('company_id','=',company_id)]) dom={'journal_id': [('id','in',journal_ids)]} else: journal_ids=self.pool.get('account.journal').search(cr,uid,[]) dom={'journal_id': [('id','in',journal_ids)]}
72ad145ae82c0f01e66378f04ed2483828553a1d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/72ad145ae82c0f01e66378f04ed2483828553a1d/invoice.py
if company_id: val['journal_id']=False journal_ids=self.pool.get('account.journal').search(cr,uid,[('company_id','=',company_id)]) dom={'journal_id': [('id','in',journal_ids)]}
if company_id and type: if type in ('out_invoice', 'out_refund'): journal_type = 'sale' else: journal_type = 'purchase' journal_ids = obj_journal.search(cr, uid, [('company_id','=',company_id), ('type', '=', journal_type)]) if journal_ids: val['journal_id'] = journal_ids[0] else: raise osv.except_osv(_('Configration Error !'), _('Can not find account journal for this company in invoice, Please Create journal.')) dom = {'journal_id': [('id', 'in', journal_ids)]}
def onchange_company_id(self, cr, uid, ids, company_id, part_id, type, invoice_line, currency_id): val={} dom={} if company_id and part_id and type: acc_id = False partner_obj = self.pool.get('res.partner').browse(cr,uid,part_id) if partner_obj.property_account_payable and partner_obj.property_account_receivable: if partner_obj.property_account_payable.company_id.id != company_id and partner_obj.property_account_receivable.company_id.id != company_id: rec_pro_id = self.pool.get('ir.property').search(cr,uid,[('name','=','property_account_receivable'),('res_id','=','res.partner,'+str(part_id)+''),('company_id','=',company_id)]) pay_pro_id = self.pool.get('ir.property').search(cr,uid,[('name','=','property_account_payable'),('res_id','=','res.partner,'+str(part_id)+''),('company_id','=',company_id)]) if not rec_pro_id: rec_pro_id = self.pool.get('ir.property').search(cr,uid,[('name','=','property_account_receivable'),('company_id','=',company_id)]) if not pay_pro_id: pay_pro_id = self.pool.get('ir.property').search(cr,uid,[('name','=','property_account_payable'),('company_id','=',company_id)]) rec_line_data = self.pool.get('ir.property').read(cr,uid,rec_pro_id,['name','value','res_id']) pay_line_data = self.pool.get('ir.property').read(cr,uid,pay_pro_id,['name','value','res_id']) rec_res_id = rec_line_data and int(rec_line_data[0]['value'].split(',')[1]) or False pay_res_id = pay_line_data and int(pay_line_data[0]['value'].split(',')[1]) or False if not rec_res_id and not rec_res_id: raise osv.except_osv(_('Configration Error !'), _('Can not find account chart for this company, Please Create account.')) if type in ('out_invoice', 'out_refund'): acc_id = rec_res_id else: acc_id = pay_res_id val= {'account_id': acc_id} if ids: if company_id: inv_obj = self.browse(cr,uid,ids) for line in inv_obj[0].invoice_line: if line.account_id: if line.account_id.company_id.id != company_id: result_id = self.pool.get('account.account').search(cr,uid,[('name','=',line.account_id.name),('company_id','=',company_id)]) if not result_id: raise osv.except_osv(_('Configration Error !'), _('Can not find account chart for this company in invoice line account, Please Create account.')) r_id = self.pool.get('account.invoice.line').write(cr,uid,[line.id],{'account_id': result_id[0]}) else: if invoice_line: for inv_line in invoice_line: obj_l = self.pool.get('account.account').browse(cr,uid,inv_line[2]['account_id']) if obj_l.company_id.id != company_id: raise osv.except_osv(_('Configration Error !'), _('invoice line account company is not match with invoice company.')) else: continue if company_id: val['journal_id']=False journal_ids=self.pool.get('account.journal').search(cr,uid,[('company_id','=',company_id)]) dom={'journal_id': [('id','in',journal_ids)]} else: journal_ids=self.pool.get('account.journal').search(cr,uid,[]) dom={'journal_id': [('id','in',journal_ids)]}
72ad145ae82c0f01e66378f04ed2483828553a1d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/72ad145ae82c0f01e66378f04ed2483828553a1d/invoice.py
journal_ids=self.pool.get('account.journal').search(cr,uid,[]) dom={'journal_id': [('id','in',journal_ids)]}
journal_ids = obj_journal.search(cr, uid, [])
def onchange_company_id(self, cr, uid, ids, company_id, part_id, type, invoice_line, currency_id): val={} dom={} if company_id and part_id and type: acc_id = False partner_obj = self.pool.get('res.partner').browse(cr,uid,part_id) if partner_obj.property_account_payable and partner_obj.property_account_receivable: if partner_obj.property_account_payable.company_id.id != company_id and partner_obj.property_account_receivable.company_id.id != company_id: rec_pro_id = self.pool.get('ir.property').search(cr,uid,[('name','=','property_account_receivable'),('res_id','=','res.partner,'+str(part_id)+''),('company_id','=',company_id)]) pay_pro_id = self.pool.get('ir.property').search(cr,uid,[('name','=','property_account_payable'),('res_id','=','res.partner,'+str(part_id)+''),('company_id','=',company_id)]) if not rec_pro_id: rec_pro_id = self.pool.get('ir.property').search(cr,uid,[('name','=','property_account_receivable'),('company_id','=',company_id)]) if not pay_pro_id: pay_pro_id = self.pool.get('ir.property').search(cr,uid,[('name','=','property_account_payable'),('company_id','=',company_id)]) rec_line_data = self.pool.get('ir.property').read(cr,uid,rec_pro_id,['name','value','res_id']) pay_line_data = self.pool.get('ir.property').read(cr,uid,pay_pro_id,['name','value','res_id']) rec_res_id = rec_line_data and int(rec_line_data[0]['value'].split(',')[1]) or False pay_res_id = pay_line_data and int(pay_line_data[0]['value'].split(',')[1]) or False if not rec_res_id and not rec_res_id: raise osv.except_osv(_('Configration Error !'), _('Can not find account chart for this company, Please Create account.')) if type in ('out_invoice', 'out_refund'): acc_id = rec_res_id else: acc_id = pay_res_id val= {'account_id': acc_id} if ids: if company_id: inv_obj = self.browse(cr,uid,ids) for line in inv_obj[0].invoice_line: if line.account_id: if line.account_id.company_id.id != company_id: result_id = self.pool.get('account.account').search(cr,uid,[('name','=',line.account_id.name),('company_id','=',company_id)]) if not result_id: raise osv.except_osv(_('Configration Error !'), _('Can not find account chart for this company in invoice line account, Please Create account.')) r_id = self.pool.get('account.invoice.line').write(cr,uid,[line.id],{'account_id': result_id[0]}) else: if invoice_line: for inv_line in invoice_line: obj_l = self.pool.get('account.account').browse(cr,uid,inv_line[2]['account_id']) if obj_l.company_id.id != company_id: raise osv.except_osv(_('Configration Error !'), _('invoice line account company is not match with invoice company.')) else: continue if company_id: val['journal_id']=False journal_ids=self.pool.get('account.journal').search(cr,uid,[('company_id','=',company_id)]) dom={'journal_id': [('id','in',journal_ids)]} else: journal_ids=self.pool.get('account.journal').search(cr,uid,[]) dom={'journal_id': [('id','in',journal_ids)]}
72ad145ae82c0f01e66378f04ed2483828553a1d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/72ad145ae82c0f01e66378f04ed2483828553a1d/invoice.py
'addons/account/report/account_profit_horizontal.rml.rml',parser=report_pl_account_horizontal, header='internal')
'addons/account/report/account_profit_horizontal.rml',parser=report_pl_account_horizontal, header='internal')
def get_lines_another(self, group): return self.result.get(group, [])
df62f827f5a0f5fb9dfc3c1efdca7b5f2b8a02ec /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/df62f827f5a0f5fb9dfc3c1efdca7b5f2b8a02ec/account_profit_loss.py
'parent_id': fields.many2one('res.partner.category', 'Parent Category', select=True),
'parent_id': fields.many2one('res.partner.category', 'Parent Category', select=True, ondelete='cascade'),
def _name_get_fnc(self, cr, uid, ids, prop, unknow_none, context=None): res = self.name_get(cr, uid, ids, context=context) return dict(res)
aaa3047bed9dd663ce80dc3e0f08c9ee35afc25e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/aaa3047bed9dd663ce80dc3e0f08c9ee35afc25e/partner.py
_order = 'parent_id,name'
_parent_store = True _parent_order = 'name' _order = 'parent_left'
def _name_get_fnc(self, cr, uid, ids, prop, unknow_none, context=None): res = self.name_get(cr, uid, ids, context=context) return dict(res)
aaa3047bed9dd663ce80dc3e0f08c9ee35afc25e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/aaa3047bed9dd663ce80dc3e0f08c9ee35afc25e/partner.py
'outlook':fields.boolean('Outlook Plug-in ', help="Allows you to select an object that you’d like to add to your email and its attachments."),
'outlook':fields.boolean('Outlook Plug-in ', help="Allows you to select an object that you would like to add to your email and its attachments."),
def default_get(self, cr, uid, fields, context=None): data = super(outlook_installer, self).default_get(cr, uid, fields, context=context) data['doc_file'] = 'http://doc.openerp.com/book/2/2_6_Comms/2_6_Comms_outlook.html' file = open(addons.get_module_resource('outlook','plugin','openerp-outlook-addin.exe'), 'r') data['plugin_file'] = base64.encodestring(file.read()) return data
ae8d972baf25a1c2183e6c299571e417ac3afd50 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/ae8d972baf25a1c2183e6c299571e417ac3afd50/installer.py
api_id = '' text = action.sms to = self.get_mobile(cr, uid, action, context) if tools.sms_send(user, password, api_id, text, to) == True: logger.notifyChannel('sms', netsvc.LOG_INFO, 'SMS successfully send to : %s' % (action.address)) else: logger.notifyChannel('sms', netsvc.LOG_ERROR, 'Failed to send SMS to : %s' % (action.address))
logger.notifyChannel('sms', netsvc.LOG_ERROR, 'SMS Facility has not been implemented yet. Use smsclient module!')
def run(self, cr, uid, ids, context={}): logger = netsvc.Logger() for action in self.browse(cr, uid, ids, context): obj_pool = self.pool.get(action.model_id.model) obj = obj_pool.browse(cr, uid, context['active_id'], context=context) cxt = { 'context':context, 'object': obj, 'time':time, 'cr': cr, 'pool' : self.pool, 'uid' : uid } expr = eval(str(action.condition), cxt) if not expr: continue if action.state=='client_action': if not action.action_id: raise osv.except_osv(_('Error'), _("Please specify an action to launch !")) result = self.pool.get(action.action_id.type).read(cr, uid, action.action_id.id, context=context) return result
3b4d5593c18becc0a688f64a54450e284c7fa8f9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/3b4d5593c18becc0a688f64a54450e284c7fa8f9/ir_actions.py
dim_obj = self.pool.get('olap.dimension').browse(cr, uid, int(['d_id']))
dim_obj = self.pool.get('olap.dimension').browse(cr, uid, int(context['d_id']))
def search(self, cr, uid, args, offset = 0, limit = None, order = None, context = None, count = False): if context and context.has_key('parent_schema_id'): args = [('schema_id', '=', context['parent_schema_id'])]
a144956e2871184786b6641d77836135842bdcec /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/a144956e2871184786b6641d77836135842bdcec/olap.py
if wiz_id not in self.wiz_uid: super(virtual_wizard,self).exp_create(db, uid, wiz_name, datas)
def exp_execute(self, db, uid, wiz_id, datas, action='init', context=None): if wiz_id not in self.wiz_uid: # TODO: To Check why need it #if wiz_id == 1: # wiz_name ='base_setup.base_setup' #if wiz_id == 2: # wiz_name ='module.upgrade' super(virtual_wizard,self).exp_create(db, uid, wiz_name, datas) new_ids = [] if 'id' in datas: datas['id'] = caldevIDs2readIDs(datas['id']) for id in datas['ids']: new_ids.append(caldevIDs2readIDs(id)) datas['ids'] = new_ids res=super(virtual_wizard, self).exp_execute(db, uid, wiz_id, datas, action, context) return res
0e12d8722a838d7c1a3ca3814ea852151237a962 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/0e12d8722a838d7c1a3ca3814ea852151237a962/common.py
'pos':fields.boolean('Point of Sales'),
'point_of_sale':fields.boolean('Point of Sales'),
def _if_account(self, cr, uid, ids, context=None): chart = self.read(cr, uid, ids, ['charts'], context=context)[0]['charts'] self.logger.notifyChannel( 'installer', netsvc.LOG_DEBUG, 'Addon "account" selected, installing chart of accounts %s'%chart) return [chart]
76cb20b5caba757923cc7afd8e8097a87aa11017 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/76cb20b5caba757923cc7afd8e8097a87aa11017/installer.py
message = type_list.get(vals.get('type', False), _('Picking')) + " '" + (vals.get('name', 'n/a')) + _(" with origin")+" '" + vals.get('origin', 'n/a') + "' "+ _("is created.")
message = type_list.get(vals.get('type', ''), _('Picking') + " '" + vals.get('name', 'n/a') + _(" with origin")+" '" + (vals.get('origin', '') or 'n/a') + "' "+ _("is created."))
def create(self, cr, user, vals, context=None): if ('name' not in vals) or (vals.get('name')=='/'): seq_obj_name = 'stock.picking.' + vals['type'] vals['name'] = self.pool.get('ir.sequence').get(cr, user, seq_obj_name) type_list = { 'out':_('Packing List'), 'in':_('Reception'), 'internal': _('Internal picking'), 'delivery': _('Delivery order') } new_id = super(stock_picking, self).create(cr, user, vals, context) if not vals.get('auto_picking', False): message = type_list.get(vals.get('type', False), _('Picking')) + " '" + (vals.get('name', 'n/a')) + _(" with origin")+" '" + vals.get('origin', 'n/a') + "' "+ _("is created.") self.log(cr, user, new_id, message) return new_id
c5e5a3b2625cf50a345907edf0b320e1f719ecfa /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/c5e5a3b2625cf50a345907edf0b320e1f719ecfa/stock.py
('real_time','Real Time (automatized)'),], 'Stock Valuation', help="Decide if the system must automatically creates account moves based on stock moves", required=True),
('real_time','Real Time (automatized)'),], 'Stock Valuation', help="Decide if the system must automatically create account moves based on stock moves", required=True),
def _product_available(self, cr, uid, ids, field_names=None, arg=False, context=None): """ Finds the incoming and outgoing quantity of product. @return: Dictionary of values """ if not field_names: field_names = [] if context is None: context = {} res = {} for id in ids: res[id] = {}.fromkeys(field_names, 0.0) for f in field_names: c = context.copy() if f == 'qty_available': c.update({ 'states': ('done',), 'what': ('in', 'out') }) if f == 'virtual_available': c.update({ 'states': ('confirmed','waiting','assigned','done'), 'what': ('in', 'out') }) if f == 'incoming_qty': c.update({ 'states': ('confirmed','waiting','assigned'), 'what': ('in',) }) if f == 'outgoing_qty': c.update({ 'states': ('confirmed','waiting','assigned'), 'what': ('out',) }) stock = self.get_product_available(cr, uid, ids, context=c) for id in ids: res[id][f] = stock.get(id, 0.0) return res
f4927a835d95f1f943594612c3a3d45c629ef50b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/f4927a835d95f1f943594612c3a3d45c629ef50b/product.py
if m.product_qty * m.product_uom.factor > return_history[m.id]:
if m.product_qty * m.product_uom.factor >= return_history[m.id]:
def view_init(self, cr, uid, fields_list, context=None): """ Creates view dynamically and adding fields at runtime. @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param context: A standard dictionary @return: New arch of view with new columns. """ res = super(stock_return_picking, self).view_init(cr, uid, fields_list, context=context) record_id = context and context.get('active_id', False) if record_id: pick_obj = self.pool.get('stock.picking') pick = pick_obj.browse(cr, uid, record_id) if pick.state not in ['done','confirmed','assigned']: raise osv.except_osv(_('Warning !'), _("You may only return pickings that are Confirmed, Available or Done!")) return_history = {} valid_lines = 0 for m in [line for line in pick.move_lines]: if m.state == 'done': return_history[m.id] = 0 for rec in m.move_history_ids2: return_history[m.id] += (rec.product_qty * rec.product_uom.factor) if m.product_qty * m.product_uom.factor > return_history[m.id]: valid_lines += 1 if 'return%s'%(m.id) not in self._columns: self._columns['return%s'%(m.id)] = fields.float(string=m.name, required=True) if 'invoice_state' not in self._columns: self._columns['invoice_state'] = fields.selection([('2binvoiced', 'To be refunded/invoiced'), ('none', 'No invoicing')], string='Invoicing', required=True) if not valid_lines: raise osv.except_osv(_('Warning !'), _("There are no products to return (only lines in Done state and not fully returned yet can be returned)!")) return res
04adabc7f627b74f1fbe71b4f6223cad6f2cdde2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/04adabc7f627b74f1fbe71b4f6223cad6f2cdde2/stock_return_picking.py
def onchange_uos_quantity(self, cr, uid, ids, product_id, product_uos_qty, product_uos, product_uom): """ On change of product quantity finds UoM and UoS quantities @param product_id: Product id @param product_uos_qty: Changed UoS Quantity of product @param product_uom: Unit of measure of product @param product_uos: Unit of sale of product @return: Dictionary of values """ result = { 'product_qty': 0.00 }
d7496a8ea44df329960c6572b94ef3ec72902b69 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/d7496a8ea44df329960c6572b94ef3ec72902b69/stock.py