bugged
stringlengths 4
228k
| fixed
stringlengths 0
96.3M
| __index_level_0__
int64 0
481k
|
|---|---|---|
def read_group(self, cr, uid, domain, fields, groupby, offset=0, limit=None, context=None): context = context or {} self.pool.get('ir.model.access').check(cr, uid, self._name, 'read', context=context) if not fields: fields = self._columns.keys()
|
def read_group(self, cr, uid, domain, fields, groupby, offset=0, limit=None, context=None): context = context or {} self.pool.get('ir.model.access').check(cr, uid, self._name, 'read', context=context) if not fields: fields = self._columns.keys()
| 467,500
|
def read_group(self, cr, uid, domain, fields, groupby, offset=0, limit=None, context=None): context = context or {} self.pool.get('ir.model.access').check(cr, uid, self._name, 'read', context=context) if not fields: fields = self._columns.keys()
|
def read_group(self, cr, uid, domain, fields, groupby, offset=0, limit=None, context=None): context = context or {} self.pool.get('ir.model.access').check(cr, uid, self._name, 'read', context=context) if not fields: fields = self._columns.keys()
| 467,501
|
def read_group(self, cr, uid, domain, fields, groupby, offset=0, limit=None, context=None): context = context or {} self.pool.get('ir.model.access').check(cr, uid, self._name, 'read', context=context) if not fields: fields = self._columns.keys()
|
def read_group(self, cr, uid, domain, fields, groupby, offset=0, limit=None, context=None): context = context or {} self.pool.get('ir.model.access').check(cr, uid, self._name, 'read', context=context) if not fields: fields = self._columns.keys()
| 467,502
|
def read_group(self, cr, uid, domain, fields, groupby, offset=0, limit=None, context=None): context = context or {} self.pool.get('ir.model.access').check(cr, uid, self._name, 'read', context=context) if not fields: fields = self._columns.keys()
|
def read_group(self, cr, uid, domain, fields, groupby, offset=0, limit=None, context=None): context = context or {} self.pool.get('ir.model.access').check(cr, uid, self._name, 'read', context=context) if not fields: fields = self._columns.keys()
| 467,503
|
def _get_type(self, cr, uid, ids, context=None): if context is None: context = {} return context.get('type', False)
|
def _get_type(self, cr, uid, context=None): if context is None: context = {} return context.get('type', False)
| 467,504
|
def state_running_set(self, cr, uid, ids, *args): campaign = self.browse(cr, uid, ids[0]) if not campaign.activity_ids : raise osv.except_osv("Error", "There is no activitity in the campaign") act_ids = [ act_id.id for act_id in campaign.activity_ids] act_ids = self.pool.get('marketing.campaign.activity').search(cr, uid, [('id', 'in', act_ids), ('start', '=', True)]) if not act_ids : raise osv.except_osv("Error", "There is no starting activitity in the campaign") self.write(cr, uid, ids, {'state': 'running'}) return True
|
def state_running_set(self, cr, uid, ids, *args): campaign = self.browse(cr, uid, ids[0]) if not campaign.activity_ids : raise osv.except_osv("Error", "There is no activitity in the campaign") actvity_ids = [ act_id.id for act_id in campaign.activity_ids] act_obj = self.pool.get('marketing.campaign.activity') act_ids = act_obj.search(cr, uid, [('id', 'in', actvity_ids), ('start', '=', True)]) if not act_ids : raise osv.except_osv("Error", "There is no starting activitity in the campaign") self.write(cr, uid, ids, {'state': 'running'}) return True
| 467,505
|
def __init__(self, *args): self._actions = {'paper' : self.process_wi_report, 'email' : self.process_wi_email, 'server_action' : self.process_wi_action, } return super(marketing_campaign_activity, self).__init__(*args)
|
def __init__(self, *args): self._actions = {'paper' : self.process_wi_report, 'email' : self.process_wi_email, 'action' : self.process_wi_action, } return super(marketing_campaign_activity, self).__init__(*args)
| 467,506
|
def process_wi_email(self, cr, uid, activity, workitem, context=None): return self.pool.get('email.template').generate_mail(cr, uid, activity.email_template_id.id, [workitem.res_id], context=context)
|
def process_wi_email(self, cr, uid, activity, workitem, context=None): return self.pool.get('email.template').generate_mail(cr, uid, activity.email_template_id.id, [workitem.res_id], context=context)
| 467,507
|
def process_wi_action(self, cr, uid, activity, workitem, context={}): context = {} server_obj = self.pool.get('ir.actions.server') server_obj.run(cr, uid, [activity.server_action_id.id], context) return True
|
def process_wi_action(self, cr, uid, activity, workitem, context={}): context = {} server_obj = self.pool.get('ir.actions.server') server_obj.run(cr, uid, [activity.server_action_id.id], context) return True
| 467,508
|
def _res_name_get(self, cr, uid, ids, field_name, arg, context=None): res = {} for obj in self.browse(cr, uid, ids, context=context): if obj.res_id: try: res[obj.id] = self.pool.get(obj.object_id.model).name_get(cr, uid, [obj.res_id], context=context)[0][1] except: res[obj.id] = '/' else: res[obj.id] = '/' return res
|
def _res_name_get(self, cr, uid, ids, field_name, arg, context=None): res = {} for obj in self.browse(cr, uid, ids, context=context): if obj.res_id: try: res[obj.id] = self.pool.get(obj.object_id.model).name_get(cr, uid, [obj.res_id], context=context)[0][1] except: res[obj.id] = '/' else: res[obj.id] = '/' return res
| 467,509
|
def process(self, cr, uid, workitem_ids, context={}): for wi in self.browse(cr, uid, workitem_ids): if wi.state == 'todo': eval_context = { 'pool': self.pool, 'cr': cr, 'uid': uid, 'wi': wi, 'object': wi.activity_id, 'transition': wi.activity_id.to_ids } try: expr = eval(str(wi.activity_id.condition), eval_context) if expr: result = True if wi.campaign_id.mode in ('manual','active'): result = self.pool.get('marketing.campaign.activity').process( cr, uid, wi.activity_id.id, wi.id, context) if result: self.write(cr, uid, wi.id, {'state': 'done'}) self.process_chain(cr, uid, wi.id, context) else: vals = {'state': 'exception'} if type(result) == type({}) and 'error_msg' in result: vals['error_msg'] = result['error_msg'] self.write(cr, uid, wi.id, vals) else: self.write(cr, uid, wi.id, {'state': 'cancelled'}) except Exception,e: self.write(cr, uid, wi.id, {'state': 'exception', 'error_msg': str(e)}) return True
|
def process(self, cr, uid, workitem_ids, context={}): for wi in self.browse(cr, uid, workitem_ids): if wi.state == 'todo': eval_context = { 'pool': self.pool, 'cr': cr, 'uid': uid, 'wi': wi, 'object': wi.activity_id, 'transition': wi.activity_id.to_ids } try: expr = eval(str(wi.activity_id.condition), eval_context) if expr: result = True if wi.campaign_id.mode in ('manual','active'): result = self.pool.get('marketing.campaign.activity').process( cr, uid, wi.activity_id.id, wi.id, context) if result: self.write(cr, uid, wi.id, {'state': 'done'}) self.process_chain(cr, uid, wi.id, context) else: vals = {'state': 'exception'} if type(result) == type({}) and 'error_msg' in result: vals['error_msg'] = result['error_msg'] self.write(cr, uid, wi.id, vals) else: self.write(cr, uid, wi.id, {'state': 'cancelled'}) except Exception,e: self.write(cr, uid, wi.id, {'state': 'exception', 'error_msg': str(e)}) return True
| 467,510
|
def unlink(self, cr, uid, ids, context=None): group_users = [] for record in self.read(cr, uid, ids, ['users'], context=context): if record['users']: group_users.extend(record['users']) if group_users: group_names = [] try: for rec in self.pool.get('res.users').read(cr, uid, group_users, ['name'], context=context): group_names.append(rec['name']) if len(group_names) >=5: group_names = group_names[:5] group_names += '...' except Exception: raise osv.except_osv(_('Warning !'), _('Make sure you have no users linked with the group(s)!')) raise osv.except_osv(_('Warning !'), _('Group(s) cannot be deleted, because user(s) %s participate in them!') % \ ', '.join(group_names)) return super(groups2, self).unlink(cr, uid, ids, context=context)
|
def unlink(self, cr, uid, ids, context=None): group_users = [] for record in self.read(cr, uid, ids, ['users'], context=context): if record['users']: group_users.extend(record['users']) if group_users: group_names = [] try: for rec in self.pool.get('res.users').read(cr, uid, group_users, ['name'], context=context): group_names.append(rec['name']) if len(group_names) >=5: group_names = group_names[:5] group_names += '...' except Exception: raise osv.except_osv(_('Warning !'), _('Make sure you have no users linked with the group(s)!')) raise osv.except_osv(_('Warning !'), _('Group(s) cannot be deleted, because user(s) %s participate in them!') % \ ', '.join(group_names)) return super(groups2, self).unlink(cr, uid, ids, context=context)
| 467,511
|
def unlink(self, cr, uid, ids, context=None): group_users = [] for record in self.read(cr, uid, ids, ['users'], context=context): if record['users']: group_users.extend(record['users']) if group_users: group_names = [] try: for rec in self.pool.get('res.users').read(cr, uid, group_users, ['name'], context=context): group_names.append(rec['name']) if len(group_names) >=5: group_names = group_names[:5] group_names += '...' except Exception: raise osv.except_osv(_('Warning !'), _('Make sure you have no users linked with the group(s)!')) raise osv.except_osv(_('Warning !'), _('Group(s) cannot be deleted, because user(s) %s participate in them!') % \ ', '.join(group_names)) return super(groups2, self).unlink(cr, uid, ids, context=context)
|
def unlink(self, cr, uid, ids, context=None): group_users = [] for record in self.read(cr, uid, ids, ['users'], context=context): if record['users']: group_users.extend(record['users']) if group_users: user_names = [user.name for user in self.pool.get('res.users').browse(cr, uid, group_users, context=context)] if len(user_names) >= 5: user_names = user_names[:5] user_names += '...' raise osv.except_osv(_('Warning !'), _('Group(s) cannot be deleted, because user(s) %s participate in them!') % \ ', '.join(group_names)) return super(groups2, self).unlink(cr, uid, ids, context=context)
| 467,512
|
def unlink(self, cr, uid, ids, context=None): group_users = [] for record in self.read(cr, uid, ids, ['users'], context=context): if record['users']: group_users.extend(record['users']) if group_users: group_names = [] try: for rec in self.pool.get('res.users').read(cr, uid, group_users, ['name'], context=context): group_names.append(rec['name']) if len(group_names) >=5: group_names = group_names[:5] group_names += '...' except Exception: raise osv.except_osv(_('Warning !'), _('Make sure you have no users linked with the group(s)!')) raise osv.except_osv(_('Warning !'), _('Group(s) cannot be deleted, because user(s) %s participate in them!') % \ ', '.join(group_names)) return super(groups2, self).unlink(cr, uid, ids, context=context)
|
def unlink(self, cr, uid, ids, context=None): group_users = [] for record in self.read(cr, uid, ids, ['users'], context=context): if record['users']: group_users.extend(record['users']) if group_users: group_names = [] try: for rec in self.pool.get('res.users').read(cr, uid, group_users, ['name'], context=context): group_names.append(rec['name']) if len(group_names) >=5: group_names = group_names[:5] group_names += '...' except Exception: raise osv.except_osv(_('Warning !'), _('Make sure you have no users linked with the group(s)!')) raise osv.except_osv(_('Warning !'), _('Group(s) cannot be deleted, because some user(s) still belong to them: %s !') % \ ', '.join(user_names)) return super(groups2, self).unlink(cr, uid, ids, context=context)
| 467,513
|
def onchange_partner_id(self, cursor, user, line_id, partner_id, type, currency_id, context=None): res_users_obj = self.pool.get('res.users') res_currency_obj = self.pool.get('res.currency') res = {'value': {}} obj_partner = self.pool.get('res.partner') if context is None: context = {} if not partner_id: return res account_id = False line = self.browse(cursor, user, line_id) if not line or (line and not line[0].account_id): part = obj_partner.browse(cursor, user, partner_id, context=context) if type == 'supplier': account_id = part.property_account_payable.id else: account_id = part.property_account_receivable.id res['value']['account_id'] = account_id
|
def onchange_partner_id(self, cursor, user, line_id, partner_id, type, currency_id, context=None): res_users_obj = self.pool.get('res.users') res_currency_obj = self.pool.get('res.currency') res = {'value': {}} obj_partner = self.pool.get('res.partner') if context is None: context = {} if not partner_id: return res account_id = False line = self.browse(cursor, user, line_id) if not line or (line and not line[0].account_id): part = obj_partner.browse(cursor, user, partner_id, context=context) if type == 'supplier': account_id = part.property_account_payable.id else: account_id = part.property_account_receivable.id res['value']['account_id'] = account_id
| 467,514
|
def copy_data(self, cr, uid, id, default=None, context=None): """ Copy given record's data with all its fields values
|
def copy_data(self, cr, uid, id, default=None, context=None): """ Copy given record's data with all its fields values
| 467,515
|
def copy_data(self, cr, uid, id, default=None, context=None): """ Copy given record's data with all its fields values
|
def copy_data(self, cr, uid, id, default=None, context=None): """ Copy given record's data with all its fields values
| 467,516
|
def copy_data(self, cr, uid, id, default=None, context=None): """ Copy given record's data with all its fields values
|
def copy_data(self, cr, uid, id, default=None, context=None): """ Copy given record's data with all its fields values
| 467,517
|
def copy_data(self, cr, uid, id, default=None, context=None): """ Copy given record's data with all its fields values
|
def copy_data(self, cr, uid, id, default=None, context=None): """ Copy given record's data with all its fields values
| 467,518
|
def copy_data(self, cr, uid, id, default=None, context=None): """ Copy given record's data with all its fields values
|
def copy_data(self, cr, uid, id, default=None, context=None): """ Copy given record's data with all its fields values
| 467,519
|
def copy_data(self, cr, uid, id, default=None, context=None): """ Copy given record's data with all its fields values
|
def copy_data(self, cr, uid, id, default=None, context=None): """ Copy given record's data with all its fields values
| 467,520
|
def copy(self, cr, uid, id, default=None, context=None): """ Duplicate record with given id updating it with default values
|
def copy(self, cr, uid, id, default=None, context=None): """ Duplicate record with given id updating it with default values
| 467,521
|
def copy(self, cr, uid, id, default=None, context=None): """ Duplicate record with given id updating it with default values
|
def copy(self, cr, uid, id, default=None, context=None): """ Duplicate record with given id updating it with default values
| 467,522
|
def _check_product_lot(self, cr, uid, ids): """ Checks whether move is done or not and production lot is assigned to that move. @return: True or False """ for move in self.browse(cr, uid, ids): if move.prodlot_id and move.state == 'done' and (move.prodlot_id.product_id.id != move.product_id.id): return False return True
|
def _check_product_lot(self, cr, uid, ids): """ Checks whether move is done or not and production lot is assigned to that move. @return: True or False """ for move in self.browse(cr, uid, ids): if move.prodlot_id and move.state == 'done' and (move.prodlot_id.product_id.id != move.product_id.id): return False return True
| 467,523
|
def generate(self, cr, uid, ids, datas={}, context={}): move_ids = [] entry = {} account_move_obj = self.pool.get('account.move') account_move_line_obj = self.pool.get('account.move.line') pt_obj = self.pool.get('account.payment.term')
|
def generate(self, cr, uid, ids, datas={}, context={}): move_ids = [] entry = {} account_move_obj = self.pool.get('account.move') account_move_line_obj = self.pool.get('account.move.line') pt_obj = self.pool.get('account.payment.term')
| 467,524
|
def upgrade_module(self, cr, uid, ids, context): pool = pooler.get_pool(cr.dbname) mod_obj = self.pool.get('ir.module.module') data_obj = self.pool.get('ir.model.data') ids = mod_obj.search(cr, uid, [('state', 'in', ['to upgrade', 'to remove', 'to install'])]) unmet_packages = [] mod_dep_obj = pool.get('ir.module.module.dependency') for mod in mod_obj.browse(cr, uid, ids): depends_mod_ids = mod_dep_obj.search(cr, uid, [('module_id', '=', mod.id)]) for dep_mod in mod_dep_obj.browse(cr, uid, depends_mod_ids): if dep_mod.state in ('unknown','uninstalled'): unmet_packages.append(dep_mod.name) if len(unmet_packages): raise osv.except_osv(_('Unmet dependency !'), _('Following modules are uninstalled or unknown. \n\n'+'\n'.join(unmet_packages))) mod_obj.download(cr, uid, ids, context=context) cr.commit() _, pool = pooler.restart_pool(cr.dbname, update_module=True)
|
def upgrade_module(self, cr, uid, ids, context): pool = pooler.get_pool(cr.dbname) mod_obj = self.pool.get('ir.module.module') data_obj = self.pool.get('ir.model.data') ids = mod_obj.search(cr, uid, [('state', 'in', ['to upgrade', 'to remove', 'to install'])]) unmet_packages = [] mod_dep_obj = pool.get('ir.module.module.dependency') for mod in mod_obj.browse(cr, uid, ids): depends_mod_ids = mod_dep_obj.search(cr, uid, [('module_id', '=', mod.id)]) for dep_mod in mod_dep_obj.browse(cr, uid, depends_mod_ids): if dep_mod.state in ('unknown','uninstalled'): unmet_packages.append(dep_mod.name) if len(unmet_packages): raise osv.except_osv(_('Unmet dependency !'), _('Following modules are not installed or unknown: %s') % ('\n\n' + '\n'.join(unmet_packages))) mod_obj.download(cr, uid, ids, context=context) cr.commit() _, pool = pooler.restart_pool(cr.dbname, update_module=True)
| 467,525
|
def action_invoice_create(self, cr, uid, ids): res = False invoice_obj = self.pool.get('account.invoice') property_obj = self.pool.get('ir.property') sequence_obj = self.pool.get('ir.sequence') analytic_journal_obj = self.pool.get('account.analytic.journal') account_journal = self.pool.get('account.journal') for exp in self.browse(cr, uid, ids): lines = [] for l in exp.line_ids: tax_id = [] if l.product_id: acc = l.product_id.product_tmpl_id.property_account_expense if not acc: acc = l.product_id.categ_id.property_account_expense_categ tax_id = [x.id for x in l.product_id.supplier_taxes_id] else: acc = property_obj.get(cr, uid, 'property_account_expense_categ', 'product.category') if not acc: raise osv.except_osv(_('Error !'), _('Please configure Default Expanse account for Product purchase, `property_account_expense_categ`'))
|
def action_invoice_create(self, cr, uid, ids): res = False invoice_obj = self.pool.get('account.invoice') property_obj = self.pool.get('ir.property') sequence_obj = self.pool.get('ir.sequence') analytic_journal_obj = self.pool.get('account.analytic.journal') account_journal = self.pool.get('account.journal') for exp in self.browse(cr, uid, ids): lines = [] for l in exp.line_ids: tax_id = [] if l.product_id: acc = l.product_id.product_tmpl_id.property_account_expense if not acc: acc = l.product_id.categ_id.property_account_expense_categ tax_id = [x.id for x in l.product_id.supplier_taxes_id] else: acc = property_obj.get(cr, uid, 'property_account_expense_categ', 'product.category') if not acc: raise osv.except_osv(_('Error !'), _('Please configure Default Expanse account for Product purchase, `property_account_expense_categ`'))
| 467,526
|
def action_invoice_create(self, cr, uid, ids): res = False invoice_obj = self.pool.get('account.invoice') property_obj = self.pool.get('ir.property') sequence_obj = self.pool.get('ir.sequence') analytic_journal_obj = self.pool.get('account.analytic.journal') account_journal = self.pool.get('account.journal') for exp in self.browse(cr, uid, ids): lines = [] for l in exp.line_ids: tax_id = [] if l.product_id: acc = l.product_id.product_tmpl_id.property_account_expense if not acc: acc = l.product_id.categ_id.property_account_expense_categ tax_id = [x.id for x in l.product_id.supplier_taxes_id] else: acc = property_obj.get(cr, uid, 'property_account_expense_categ', 'product.category') if not acc: raise osv.except_osv(_('Error !'), _('Please configure Default Expanse account for Product purchase, `property_account_expense_categ`'))
|
def action_invoice_create(self, cr, uid, ids): res = False invoice_obj = self.pool.get('account.invoice') property_obj = self.pool.get('ir.property') sequence_obj = self.pool.get('ir.sequence') analytic_journal_obj = self.pool.get('account.analytic.journal') account_journal = self.pool.get('account.journal') for exp in self.browse(cr, uid, ids): lines = [] for l in exp.line_ids: tax_id = [] if l.product_id: acc = l.product_id.product_tmpl_id.property_account_expense if not acc: acc = l.product_id.categ_id.property_account_expense_categ tax_id = [x.id for x in l.product_id.supplier_taxes_id] else: acc = property_obj.get(cr, uid, 'property_account_expense_categ', 'product.category') if not acc: raise osv.except_osv(_('Error !'), _('Please configure Default Expanse account for Product purchase, `property_account_expense_categ`'))
| 467,527
|
def action_invoice_create(self, cr, uid, ids): res = False invoice_obj = self.pool.get('account.invoice') property_obj = self.pool.get('ir.property') sequence_obj = self.pool.get('ir.sequence') analytic_journal_obj = self.pool.get('account.analytic.journal') account_journal = self.pool.get('account.journal') for exp in self.browse(cr, uid, ids): lines = [] for l in exp.line_ids: tax_id = [] if l.product_id: acc = l.product_id.product_tmpl_id.property_account_expense if not acc: acc = l.product_id.categ_id.property_account_expense_categ tax_id = [x.id for x in l.product_id.supplier_taxes_id] else: acc = property_obj.get(cr, uid, 'property_account_expense_categ', 'product.category') if not acc: raise osv.except_osv(_('Error !'), _('Please configure Default Expanse account for Product purchase, `property_account_expense_categ`'))
|
def action_invoice_create(self, cr, uid, ids): res = False invoice_obj = self.pool.get('account.invoice') property_obj = self.pool.get('ir.property') sequence_obj = self.pool.get('ir.sequence') analytic_journal_obj = self.pool.get('account.analytic.journal') account_journal = self.pool.get('account.journal') for exp in self.browse(cr, uid, ids): lines = [] for l in exp.line_ids: tax_id = [] if l.product_id: acc = l.product_id.product_tmpl_id.property_account_expense if not acc: acc = l.product_id.categ_id.property_account_expense_categ tax_id = [x.id for x in l.product_id.supplier_taxes_id] else: acc = property_obj.get(cr, uid, 'property_account_expense_categ', 'product.category') if not acc: raise osv.except_osv(_('Error !'), _('Please configure Default Expanse account for Product purchase, `property_account_expense_categ`'))
| 467,528
|
def init(self, cr): drop_view_if_exists(cr, 'stock_report_prodlots') cr.execute(""" create or replace view stock_report_tracklots as ( select max(id) as id, location_id, product_id, tracking_id, sum(qty) as name from ( select -max(sm.id) as id, sm.location_id, sm.product_id, sm.tracking_id, -sum(sm.product_qty /uo.factor) as qty from stock_move as sm left join stock_location sl on (sl.id = sm.location_id) left join product_uom uo on (uo.id=sm.product_uom) where state = 'done' group by sm.location_id, sm.product_id, sm.product_uom, sm.tracking_id union all select max(sm.id) as id, sm.location_dest_id as location_id, sm.product_id, sm.tracking_id, sum(sm.product_qty /uo.factor) as qty from stock_move as sm left join stock_location sl on (sl.id = sm.location_dest_id) left join product_uom uo on (uo.id=sm.product_uom) where sm.state = 'done' group by sm.location_dest_id, sm.product_id, sm.product_uom, sm.tracking_id ) as report group by location_id, product_id, tracking_id )""")
|
def init(self, cr): drop_view_if_exists(cr, 'stock_report_tracklots') cr.execute(""" create or replace view stock_report_tracklots as ( select max(id) as id, location_id, product_id, tracking_id, sum(qty) as name from ( select -max(sm.id) as id, sm.location_id, sm.product_id, sm.tracking_id, -sum(sm.product_qty /uo.factor) as qty from stock_move as sm left join stock_location sl on (sl.id = sm.location_id) left join product_uom uo on (uo.id=sm.product_uom) where state = 'done' group by sm.location_id, sm.product_id, sm.product_uom, sm.tracking_id union all select max(sm.id) as id, sm.location_dest_id as location_id, sm.product_id, sm.tracking_id, sum(sm.product_qty /uo.factor) as qty from stock_move as sm left join stock_location sl on (sl.id = sm.location_dest_id) left join product_uom uo on (uo.id=sm.product_uom) where sm.state = 'done' group by sm.location_dest_id, sm.product_id, sm.product_uom, sm.tracking_id ) as report group by location_id, product_id, tracking_id )""")
| 467,529
|
def init(self, cr): drop_view_if_exists(cr, 'stock_report_prodlots') cr.execute(""" create or replace view report_stock_lines_date as ( select p.id as id, p.id as product_id, max(s.date) as date from product_product p left outer join stock_inventory_line l on (p.id=l.product_id) left join stock_inventory s on (l.inventory_id=s.id) and s.state = 'done' group by p.id )""")
|
def init(self, cr): drop_view_if_exists(cr, 'report_stock_lines_date') cr.execute(""" create or replace view report_stock_lines_date as ( select p.id as id, p.id as product_id, max(s.date) as date from product_product p left outer join stock_inventory_line l on (p.id=l.product_id) left join stock_inventory s on (l.inventory_id=s.id) and s.state = 'done' group by p.id )""")
| 467,530
|
def case_open(self, cr, uid, ids, *args): """Overrides cancel for crm_case for setting Open Date @param self: The object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of case's Ids @param *args: Give Tuple Value """ old_state = self.read(cr, uid, ids, ['state'])[0]['state'] old_stage_id = self.read(cr, uid, ids, ['stage_id'])[0]['stage_id'] res = super(crm_lead, self).case_open(cr, uid, ids, *args) if old_state == 'draft': value = {} if not old_stage_id: stage_id = super(crm_lead, self).stage_next(cr, uid, ids, *args) if stage_id: value.update({'stage_id': stage_id}) value.update(self.onchange_stage_id(cr, uid, ids, stage_id, context={})['value']) value.update({'date_open': time.strftime('%Y-%m-%d %H:%M:%S')}) self.write(cr, uid, ids, value)
|
def case_open(self, cr, uid, ids, *args): """Overrides cancel for crm_case for setting Open Date @param self: The object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of case's Ids @param *args: Give Tuple Value """ old_state = self.read(cr, uid, ids, ['state'])[0]['state'] old_stage_id = self.read(cr, uid, ids, ['stage_id'])[0]['stage_id'] res = super(crm_lead, self).case_open(cr, uid, ids, *args) if old_state == 'draft': value = {} if not old_stage_id: stage_id = super(crm_lead, self).stage_next(cr, uid, ids, *args) if stage_id: value.update({'stage_id': stage_id}) value.update(self.onchange_stage_id(cr, uid, ids, stage_id, context={})['value']) value.update({'date_open': time.strftime('%Y-%m-%d %H:%M:%S')}) self.write(cr, uid, ids, value)
| 467,531
|
def case_close(self, cr, uid, ids, *args): """Overrides close for crm_case for setting close date @param self: The object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of case Ids @param *args: Tuple Value for additional Params """ res = super(crm_lead, self).case_close(cr, uid, ids, args) self.write(cr, uid, ids, {'date_closed': time.strftime('%Y-%m-%d %H:%M:%S')}) for case in self.browse(cr, uid, ids): n = { 'lead': _('The lead'), 'opportunity': _('The opportunity') }.get(case.type, _('The case')) message = n +" '" + case.name + "' "+ _("has been closed.") self.log(cr, uid, id, message) return res
|
def case_close(self, cr, uid, ids, *args): """Overrides close for crm_case for setting close date @param self: The object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of case Ids @param *args: Tuple Value for additional Params """ res = super(crm_lead, self).case_close(cr, uid, ids, args) self.write(cr, uid, ids, {'date_closed': time.strftime('%Y-%m-%d %H:%M:%S')}) for case in self.browse(cr, uid, ids): n = { 'lead': _('The lead'), 'opportunity': _('The opportunity') }.get(case.type, _('The case')) message = n +" '" + case.name + "' "+ _("has been closed.") self.log(cr, uid, case.id, message) return res
| 467,532
|
def change_prod_qty(self, cr, uid, ids, context): """ Changes the Quantity of Product. @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: """ record_id = context and context.get('active_id',False) assert record_id, _('Active Id is not found') prod_obj = self.pool.get('mrp.production') product_lines_obj = self.pool.get('mrp.production.product.line') bom_obj = self.pool.get('mrp.bom') for wiz_qty in self.browse(cr, uid, ids): prod = prod_obj.browse(cr, uid,record_id) prod_obj.write(cr, uid,prod.id, {'product_qty': wiz_qty.product_qty}) prod_obj.action_compute(cr, uid, [prod.id]) move_lines_obj = self.pool.get('stock.move') for move in prod.move_lines: bom_point = prod.bom_id bom_id = prod.bom_id.id if not bom_point: bom_id = bom_obj._bom_find(cr, uid, prod.product_id.id, prod.product_uom.id) if not bom_id: raise osv.except_osv(_('Error'), _("Couldn't find bill of material for product")) prod_obj.write(cr, uid, [prod.id], {'bom_id': bom_id}) bom_point = bom_obj.browse(cr, uid, [bom_id])[0] if not bom_id: raise osv.except_osv(_('Error'), _("Couldn't find bill of material for product")) factor = prod.product_qty * prod.product_uom.factor / bom_point.product_uom.factor res = bom_obj._bom_explode(cr, uid, bom_point, factor / bom_point.product_qty, []) for r in res[0]: if r['product_id']== move.product_id.id: move_lines_obj.write(cr, uid,move.id, {'product_qty' : r['product_qty']}) for m in prod.move_created_ids: move_lines_obj.write(cr, uid,m.id, {'product_qty': wiz_qty.product_qty}) return {}
|
def change_prod_qty(self, cr, uid, ids, context): """ Changes the Quantity of Product. @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: """ record_id = context and context.get('active_id',False) assert record_id, _('Active Id is not found') prod_obj = self.pool.get('mrp.production') product_lines_obj = self.pool.get('mrp.production.product.line') bom_obj = self.pool.get('mrp.bom') for wiz_qty in self.browse(cr, uid, ids): prod = prod_obj.browse(cr, uid,record_id) prod_obj.write(cr, uid,prod.id, {'product_qty': wiz_qty.product_qty}) prod_obj.action_compute(cr, uid, [prod.id]) move_lines_obj = self.pool.get('stock.move') for move in prod.move_lines: bom_point = prod.bom_id bom_id = prod.bom_id.id if not bom_point: bom_id = bom_obj._bom_find(cr, uid, prod.product_id.id, prod.product_uom.id) if not bom_id: raise osv.except_osv(_('Error'), _("Couldn't find bill of material for product")) prod_obj.write(cr, uid, [prod.id], {'bom_id': bom_id}) bom_point = bom_obj.browse(cr, uid, [bom_id])[0] if not bom_id: raise osv.except_osv(_('Error'), _("Couldn't find bill of material for product")) factor = prod.product_qty * prod.product_uom.factor / bom_point.product_uom.factor res = bom_obj._bom_explode(cr, uid, bom_point, factor / bom_point.product_qty, []) for r in res[0]: if r['product_id'] == move.product_id.id: move_lines_obj.write(cr, uid, [move.id], {'product_qty' : r['product_qty']}) for m in prod.move_created_ids: move_lines_obj.write(cr, uid,m.id, {'product_qty': wiz_qty.product_qty}) return {}
| 467,533
|
def change_prod_qty(self, cr, uid, ids, context): """ Changes the Quantity of Product. @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: """ record_id = context and context.get('active_id',False) assert record_id, _('Active Id is not found') prod_obj = self.pool.get('mrp.production') product_lines_obj = self.pool.get('mrp.production.product.line') bom_obj = self.pool.get('mrp.bom') for wiz_qty in self.browse(cr, uid, ids): prod = prod_obj.browse(cr, uid,record_id) prod_obj.write(cr, uid,prod.id, {'product_qty': wiz_qty.product_qty}) prod_obj.action_compute(cr, uid, [prod.id]) move_lines_obj = self.pool.get('stock.move') for move in prod.move_lines: bom_point = prod.bom_id bom_id = prod.bom_id.id if not bom_point: bom_id = bom_obj._bom_find(cr, uid, prod.product_id.id, prod.product_uom.id) if not bom_id: raise osv.except_osv(_('Error'), _("Couldn't find bill of material for product")) prod_obj.write(cr, uid, [prod.id], {'bom_id': bom_id}) bom_point = bom_obj.browse(cr, uid, [bom_id])[0] if not bom_id: raise osv.except_osv(_('Error'), _("Couldn't find bill of material for product")) factor = prod.product_qty * prod.product_uom.factor / bom_point.product_uom.factor res = bom_obj._bom_explode(cr, uid, bom_point, factor / bom_point.product_qty, []) for r in res[0]: if r['product_id']== move.product_id.id: move_lines_obj.write(cr, uid,move.id, {'product_qty' : r['product_qty']}) for m in prod.move_created_ids: move_lines_obj.write(cr, uid,m.id, {'product_qty': wiz_qty.product_qty}) return {}
|
def change_prod_qty(self, cr, uid, ids, context): """ Changes the Quantity of Product. @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: """ record_id = context and context.get('active_id',False) assert record_id, _('Active Id is not found') prod_obj = self.pool.get('mrp.production') product_lines_obj = self.pool.get('mrp.production.product.line') bom_obj = self.pool.get('mrp.bom') for wiz_qty in self.browse(cr, uid, ids): prod = prod_obj.browse(cr, uid,record_id) prod_obj.write(cr, uid,prod.id, {'product_qty': wiz_qty.product_qty}) prod_obj.action_compute(cr, uid, [prod.id]) move_lines_obj = self.pool.get('stock.move') for move in prod.move_lines: bom_point = prod.bom_id bom_id = prod.bom_id.id if not bom_point: bom_id = bom_obj._bom_find(cr, uid, prod.product_id.id, prod.product_uom.id) if not bom_id: raise osv.except_osv(_('Error'), _("Couldn't find bill of material for product")) prod_obj.write(cr, uid, [prod.id], {'bom_id': bom_id}) bom_point = bom_obj.browse(cr, uid, [bom_id])[0] if not bom_id: raise osv.except_osv(_('Error'), _("Couldn't find bill of material for product")) factor = prod.product_qty * prod.product_uom.factor / bom_point.product_uom.factor res = bom_obj._bom_explode(cr, uid, bom_point, factor / bom_point.product_qty, []) for r in res[0]: if r['product_id']== move.product_id.id: move_lines_obj.write(cr, uid,move.id, {'product_qty' : r['product_qty']}) for m in prod.move_created_ids: move_lines_obj.write(cr, uid, [m.id], {'product_qty': wiz_qty.product_qty}) return {}
| 467,534
|
def _get_line_uom(line): if (line.order_id.invoice_quantity=='order') or not line.procurement_id: if line.product_uos: return line.product_uos.id return line.product_uom.id else: return self.pool.get('procurement.order').uom_get(cr, uid, line.procurement_id.id, context=context)
|
def _get_line_uom(line): if (line.order_id.invoice_quantity=='order') or not line.procurement_id: if line.product_uos: return line.product_uos.id return line.product_uom.id else: return self.pool.get('procurement.order').uom_get(cr, uid, line.procurement_id.id, context=context)
| 467,535
|
def _get_line_uom(line): if (line.order_id.invoice_quantity=='order') or not line.procurement_id: if line.product_uos: return line.product_uos.id return line.product_uom.id else: return self.pool.get('procurement.order').uom_get(cr, uid, line.procurement_id.id, context=context)
|
def _get_line_uom(line): if (line.order_id.invoice_quantity=='order') or not line.procurement_id: if line.product_uos: return line.product_uos.id return line.product_uom.id else: return self.pool.get('procurement.order').uom_get(cr, uid, line.procurement_id.id, context=context)
| 467,536
|
def _check_recursion(self, cr, uid, ids, context=None): if context is None: context = {} level = 100 while len(ids): cr.execute('select distinct parent_id from hr_employee 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
|
def _check_recursion(self, cr, uid, ids, context=None): level = 100 while len(ids): cr.execute('select distinct parent_id from hr_employee 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
| 467,537
|
def _check_recursion(self, cr, uid, ids, context=None): if context is None: context = {} level = 100 while len(ids): cr.execute('select distinct parent_id from hr_employee 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
|
def _check_recursion(self, cr, uid, ids, context=None): if context is None: context = {} level = 100 while len(ids): cr.execute('SELECT DISTINCT parent_id FROM hr_employee WHERE id IN %s AND parent_id!=id',(tuple(ids),)) ids = filter(None, map(lambda x:x[0], cr.fetchall())) if not level: return False level -= 1 return True
| 467,538
|
def get_calendar_objects(self, cr, uid, ids, parent=None, domain=None, context=None): if not context: context = {} if not domain: domain = [] res = [] ctx_res_id = context.get('res_id', None) ctx_model = context.get('model', None) for cal in self.browse(cr, uid, ids): for line in cal.line_ids: if ctx_model and ctx_model != line.object_id.model: continue if line.name in ('valarm', 'attendee'): continue line_domain = eval(line.domain) line_domain += domain if ctx_res_id: line_domain += [('id','=',ctx_res_id)] mod_obj = self.pool.get(line.object_id.model) data_ids = mod_obj.search(cr, uid, line_domain, context=context) for data in mod_obj.browse(cr, uid, data_ids, context): ctx = parent and parent.context or None node = res_node_calendar('%s.ics' %data.id, parent, ctx, data, line.object_id.model, data.id) res.append(node) return res
|
def get_calendar_objects(self, cr, uid, ids, parent=None, domain=None, context=None): if not context: context = {} if not domain: domain = [] res = [] ctx_res_id = context.get('res_id', None) ctx_model = context.get('model', None) for cal in self.browse(cr, uid, ids): for line in cal.line_ids: if ctx_model and ctx_model != line.object_id.model: continue if line.name in ('valarm', 'attendee'): continue line_domain = eval(line.domain or '[]') line_domain += domain if ctx_res_id: line_domain += [('id','=',ctx_res_id)] mod_obj = self.pool.get(line.object_id.model) data_ids = mod_obj.search(cr, uid, line_domain, context=context) for data in mod_obj.browse(cr, uid, data_ids, context): ctx = parent and parent.context or None node = res_node_calendar('%s.ics' %data.id, parent, ctx, data, line.object_id.model, data.id) res.append(node) return res
| 467,539
|
def export_cal(self, cr, uid, ids, vobj='vevent', context=None): """ Export Calendar @param ids: List of calendar’s IDs @param vobj: the type of object to export @return the ical data. """ if not context: context = {} ctx_model = context.get('model', None) ctx_res_id = context.get('res_id', None) ical = vobject.iCalendar() for cal in self.browse(cr, uid, ids): for line in cal.line_ids: if ctx_model and ctx_model != line.object_id.model: continue if line.name in ('valarm', 'attendee'): continue domain = eval(line.domain) if ctx_res_id: domain += [('id','=',ctx_res_id)] mod_obj = self.pool.get(line.object_id.model) data_ids = mod_obj.search(cr, uid, domain, context=context) datas = mod_obj.read(cr, uid, data_ids, context=context) context.update({'model': line.object_id.model, 'calendar_id': cal.id }) self.__attribute__ = get_attribute_mapping(cr, uid, line.name, context) self.create_ics(cr, uid, datas, line.name, ical, context=context) return ical.serialize()
|
def export_cal(self, cr, uid, ids, vobj='vevent', context=None): """ Export Calendar @param ids: List of calendar’s IDs @param vobj: the type of object to export @return the ical data. """ if not context: context = {} ctx_model = context.get('model', None) ctx_res_id = context.get('res_id', None) ical = vobject.iCalendar() for cal in self.browse(cr, uid, ids): for line in cal.line_ids: if ctx_model and ctx_model != line.object_id.model: continue if line.name in ('valarm', 'attendee'): continue domain = eval(line.domain or '[]') if ctx_res_id: domain += [('id','=',ctx_res_id)] mod_obj = self.pool.get(line.object_id.model) data_ids = mod_obj.search(cr, uid, domain, context=context) datas = mod_obj.read(cr, uid, data_ids, context=context) context.update({'model': line.object_id.model, 'calendar_id': cal.id }) self.__attribute__ = get_attribute_mapping(cr, uid, line.name, context) self.create_ics(cr, uid, datas, line.name, ical, context=context) return ical.serialize()
| 467,540
|
def _currency(self, cursor, user, ids, name, args, context=None): res = {} res_currency_obj = self.pool.get('res.currency') res_users_obj = self.pool.get('res.users') default_currency = res_users_obj.browse(cursor, user, user, context=context).company_id.currency_id for statement in self.browse(cursor, user, ids, context=context): currency = statement.journal_id.currency if not currency: currency = default_currency res[statement.id] = currency.id currency_names = {} for currency_id, currency_name in res_currency_obj.name_get(cursor, user, [x for x in res.values()], context=context): currency_names[currency_id] = currency_name for statement_id in res.keys(): currency_id = res[statement_id] res[statement_id] = (currency_id, currency_names[currency_id]) return res
|
def _currency(self, cursor, user, ids, name, args, context=None): res = {} res_currency_obj = self.pool.get('res.currency') res_users_obj = self.pool.get('res.users') default_currency = res_users_obj.browse(cursor, user, user, context=context).company_id.currency_id for statement in self.browse(cursor, user, ids, context=context): currency = statement.journal_id.currency if not currency: currency = default_currency res[statement.id] = currency.id currency_names = {} for currency_id, currency_name in res_currency_obj.name_get(cursor, user, [x for x in res.values()], context=context): currency_names[currency_id] = currency_name for statement_id in res.keys(): currency_id = res[statement_id] res[statement_id] = (currency_id, currency_names[currency_id]) return res
| 467,541
|
def _reconcile_amount(self, cursor, user, ids, name, args, context=None): if not ids: return {} res_currency_obj = self.pool.get('res.currency') res_users_obj = self.pool.get('res.users')
|
def _reconcile_amount(self, cursor, user, ids, name, args, context=None): if not ids: return {} res_currency_obj = self.pool.get('res.currency') res_users_obj = self.pool.get('res.users')
| 467,542
|
def convert_field(f): f_qual = "%s.%s" % (self._table, f) # need fully-qualified references in case len(tables) > 1 if f in ('create_date', 'write_date'): return "date_trunc('second', %s) as %s" % (f_qual, f) if f == self.CONCURRENCY_CHECK_FIELD: if self._log_access: return "COALESCE(%s.write_date, %s.create_date, now())::timestamp AS %s" % (self._table, self._table, f,) return "now()::timestamp AS %s" % (f,) if isinstance(self._columns[f], fields.binary) and context.get('bin_size', False): return 'length("%s") as "%s"' % (f_qual, f) return f_qual
|
def convert_field(f): f_qual = "%s.%s" % (self._table, f) # need fully-qualified references in case len(tables) > 1 if f in ('create_date', 'write_date'): return "date_trunc('second', %s) as %s" % (f_qual, f) if f == self.CONCURRENCY_CHECK_FIELD: if self._log_access: return "COALESCE(%s.write_date, %s.create_date, now())::timestamp AS %s" % (self._table, self._table, f,) return "now()::timestamp AS %s" % (f,) if isinstance(self._columns[f], fields.binary) and context.get('bin_size', False): return 'length(%s) as "%s"' % (f_qual, f) return f_qual
| 467,543
|
def _get_partners_followp(self, cr, uid, ids, context=None): data = {} if context is None: context = {} if ids: data = self.read(cr, uid, ids, [])[0] 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) "\ "AND (l.debit > 0) "\ "ORDER BY l.date") move_lines = cr.fetchall() old = None fups = {} fup_id = 'followup_id' in context and context['followup_id'] or data['followup_id'] date = 'date' in context and context['date'] or data['date']
|
def _get_partners_followp(self, cr, uid, ids, context=None): data = {} if context is None: context = {} if ids: data = self.read(cr, uid, ids, [])[0] 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) "\ "AND (l.debit > 0) "\ "ORDER BY l.date") move_lines = cr.fetchall() old = None fups = {} fup_id = 'followup_id' in context and context['followup_id'] or data['followup_id'] date = 'date' in context and context['date'] or data['date']
| 467,544
|
def _get_partners_followp(self, cr, uid, ids, context=None): data = {} if context is None: context = {} if ids: data = self.read(cr, uid, ids, [])[0] 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) "\ "AND (l.debit > 0) "\ "ORDER BY l.date") move_lines = cr.fetchall() old = None fups = {} fup_id = 'followup_id' in context and context['followup_id'] or data['followup_id'] date = 'date' in context and context['date'] or data['date']
|
def _get_partners_followp(self, cr, uid, ids, context=None): data = {} if context is None: context = {} if ids: data = self.read(cr, uid, ids, [])[0] 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) "\ "AND (l.debit > 0) "\ "ORDER BY l.date") move_lines = cr.fetchall() old = None fups = {} fup_id = 'followup_id' in context and context['followup_id'] or data['followup_id'] date = 'date' in context and context['date'] or data['date']
| 467,545
|
def do_mail(self ,cr, uid, ids, context=None): mod_obj = self.pool.get('ir.model.data') move_obj = self.pool.get('account.move.line') user_obj = self.pool.get('res.users') line_obj = self.pool.get('account_followup.stat')
|
def do_mail(self ,cr, uid, ids, context=None): mod_obj = self.pool.get('ir.model.data') move_obj = self.pool.get('account.move.line') user_obj = self.pool.get('res.users') line_obj = self.pool.get('account_followup.stat')
| 467,546
|
def do_print(self, cr, uid, ids, context=None): if context is None: context = {} data = self.read(cr, uid, ids, [])[0] res = self._get_partners_followp(cr, uid, ids, context)['to_update'] to_update = res data['followup_id'] = 'followup_id' in context and context['followup_id'] or False date = 'date' in context and context['date'] or data['date'] for id in to_update.keys(): if to_update[id]['partner_id'] in data['partner_ids']: cr.execute( "UPDATE account_move_line "\ "SET followup_line_id=%s, followup_date=%s "\ "WHERE id=%s", (to_update[id]['level'], date, int(id),))
|
def do_print(self, cr, uid, ids, context=None): if context is None: context = {} data = self.read(cr, uid, ids, [])[0] res = self._get_partners_followp(cr, uid, ids, context)['to_update'] to_update = res data['followup_id'] = 'followup_id' in context and context['followup_id'] or False date = 'date' in context and context['date'] or data['date'] for id in to_update.keys(): if to_update[id]['partner_id'] in data['partner_ids']: cr.execute( "UPDATE account_move_line "\ "SET followup_line_id=%s, followup_date=%s "\ "WHERE id=%s", (to_update[id]['level'], date, int(id),))
| 467,547
|
def _invoiced(self, cursor, user, ids, name, arg, context=None): res = {} for purchase in self.browse(cursor, user, ids, context=context): if purchase.invoice_id.reconciled: res[purchase.id] = purchase.invoice_id.reconciled else: res[purchase.id] = False return res
|
def _invoiced(self, cursor, user, ids, name, arg, context=None): res = {} for purchase in self.browse(cursor, user, ids, context=context): if purchase.invoice_id.reconciled: res[purchase.id] = purchase.invoice_id.reconciled else: res[purchase.id] = False return res
| 467,548
|
def unlink(self, cr, uid, ids, context=None): purchase_orders = self.read(cr, uid, ids, ['state']) unlink_ids = [] for s in purchase_orders: if s['state'] in ['draft','cancel']: unlink_ids.append(s['id']) else: state_dict = {'wait':'Waiting','confirmed':'Confirmed','approved':'Approved','except_picking': 'Shipping Exception','except_invoice': 'Invoice Exception','done': 'Done'} raise osv.except_osv(_('Invalid action !'), _('Cannot delete Purchase Order(s) which are in %s State!') %_(eval(s['state'],state_dict)))
|
def unlink(self, cr, uid, ids, context=None): purchase_orders = self.read(cr, uid, ids, ['state']) unlink_ids = [] for s in purchase_orders: if s['state'] in ['draft','cancel']: unlink_ids.append(s['id']) else: state_dict = {'wait':'Waiting','confirmed':'Confirmed','approved':'Approved','except_picking': 'Shipping Exception','except_invoice': 'Invoice Exception','done': 'Done'} raise osv.except_osv(_('Invalid action !'), _('Cannot delete Purchase Order(s) which are in %s State!') %_(eval(s['state'],state_dict)))
| 467,549
|
def write(self, cr, uid, ids,vals, *args, **kwargs): if 'date' in vals and vals['date']: data_project = self.browse(cr, uid, ids) for prj in data_project: new_end_date = date(*time.strptime(vals['date'],'%Y-%m-%d')[:3]) if prj.date: old_end_date = date(*time.strptime(prj.date,'%Y-%m-%d')[:3]) for task in prj.tasks: if task.date_start: start_dt = (date(*time.strptime(str(task.date_start),'%Y-%m-%d %H:%M:%S')[:3])+(new_end_date-old_end_date)).strftime('%Y-%m-%d %H:%M:%S') if task.date_deadline: deadline_dt = (datetime(*time.strptime(str(task.date_deadline),'%Y-%m-%d')[:3])+(new_end_date-old_end_date)).strftime('%Y-%m-%d') self.pool.get('project.task').write(cr, uid, task.id, {'date_start':start_dt, 'date_deadline':deadline_dt}) else: self.pool.get('project.task').write(cr, uid, task.id, {'date_start':start_dt}) return super(project_project,self).write(cr, uid, ids, vals, *args, **kwargs)
|
def write(self, cr, uid, ids, vals, *args, **kwargs): if isinstance(ids, (int, long)): ids = [ids] if vals.get('date', False): data_project = self.browse(cr, uid, ids) for prj in data_project: new_end_date = date(*time.strptime(vals['date'],'%Y-%m-%d')[:3]) if prj.date: old_end_date = date(*time.strptime(prj.date,'%Y-%m-%d')[:3]) for task in prj.tasks: if task.date_start: start_dt = (date(*time.strptime(str(task.date_start),'%Y-%m-%d %H:%M:%S')[:3])+(new_end_date-old_end_date)).strftime('%Y-%m-%d %H:%M:%S') if task.date_deadline: deadline_dt = (datetime(*time.strptime(str(task.date_deadline),'%Y-%m-%d')[:3])+(new_end_date-old_end_date)).strftime('%Y-%m-%d') self.pool.get('project.task').write(cr, uid, task.id, {'date_start':start_dt, 'date_deadline':deadline_dt}) else: self.pool.get('project.task').write(cr, uid, task.id, {'date_start':start_dt}) return super(project_project,self).write(cr, uid, ids, vals, *args, **kwargs)
| 467,550
|
def write(self, cr, uid, ids,vals, *args, **kwargs): if 'date' in vals and vals['date']: data_project = self.browse(cr, uid, ids) for prj in data_project: new_end_date = date(*time.strptime(vals['date'],'%Y-%m-%d')[:3]) if prj.date: old_end_date = date(*time.strptime(prj.date,'%Y-%m-%d')[:3]) for task in prj.tasks: if task.date_start: start_dt = (date(*time.strptime(str(task.date_start),'%Y-%m-%d %H:%M:%S')[:3])+(new_end_date-old_end_date)).strftime('%Y-%m-%d %H:%M:%S') if task.date_deadline: deadline_dt = (datetime(*time.strptime(str(task.date_deadline),'%Y-%m-%d')[:3])+(new_end_date-old_end_date)).strftime('%Y-%m-%d') self.pool.get('project.task').write(cr, uid, task.id, {'date_start':start_dt, 'date_deadline':deadline_dt}) else: self.pool.get('project.task').write(cr, uid, task.id, {'date_start':start_dt}) return super(project_project,self).write(cr, uid, ids, vals, *args, **kwargs)
|
def write(self, cr, uid, ids,vals, *args, **kwargs): if 'date' in vals and vals['date']: data_project = self.browse(cr, uid, ids) for prj in data_project: new_end_date = date(*time.strptime(vals['date'],'%Y-%m-%d')[:3]) if prj.date: old_end_date = date(*time.strptime(prj.date,'%Y-%m-%d')[:3]) for task in prj.tasks: if task.date_start: start_dt = (date(*time.strptime(str(task.date_start),'%Y-%m-%d %H:%M:%S')[:3])+(new_end_date-old_end_date)).strftime('%Y-%m-%d %H:%M:%S') if task.date_deadline: deadline_dt = (datetime(*time.strptime(str(task.date_deadline),'%Y-%m-%d')[:3])+(new_end_date-old_end_date)).strftime('%Y-%m-%d') self.pool.get('project.task').write(cr, uid, [task.id], {'date_start':start_dt, 'date_deadline':deadline_dt}) else: self.pool.get('project.task').write(cr, uid, task.id, {'date_start':start_dt}) return super(project_project,self).write(cr, uid, ids, vals, *args, **kwargs)
| 467,551
|
def write(self, cr, uid, ids,vals, *args, **kwargs): if 'date' in vals and vals['date']: data_project = self.browse(cr, uid, ids) for prj in data_project: new_end_date = date(*time.strptime(vals['date'],'%Y-%m-%d')[:3]) if prj.date: old_end_date = date(*time.strptime(prj.date,'%Y-%m-%d')[:3]) for task in prj.tasks: if task.date_start: start_dt = (date(*time.strptime(str(task.date_start),'%Y-%m-%d %H:%M:%S')[:3])+(new_end_date-old_end_date)).strftime('%Y-%m-%d %H:%M:%S') if task.date_deadline: deadline_dt = (datetime(*time.strptime(str(task.date_deadline),'%Y-%m-%d')[:3])+(new_end_date-old_end_date)).strftime('%Y-%m-%d') self.pool.get('project.task').write(cr, uid, task.id, {'date_start':start_dt, 'date_deadline':deadline_dt}) else: self.pool.get('project.task').write(cr, uid, task.id, {'date_start':start_dt}) return super(project_project,self).write(cr, uid, ids, vals, *args, **kwargs)
|
def write(self, cr, uid, ids,vals, *args, **kwargs): if 'date' in vals and vals['date']: data_project = self.browse(cr, uid, ids) for prj in data_project: new_end_date = date(*time.strptime(vals['date'],'%Y-%m-%d')[:3]) if prj.date: old_end_date = date(*time.strptime(prj.date,'%Y-%m-%d')[:3]) for task in prj.tasks: if task.date_start: start_dt = (date(*time.strptime(str(task.date_start),'%Y-%m-%d %H:%M:%S')[:3])+(new_end_date-old_end_date)).strftime('%Y-%m-%d %H:%M:%S') if task.date_deadline: deadline_dt = (datetime(*time.strptime(str(task.date_deadline),'%Y-%m-%d')[:3])+(new_end_date-old_end_date)).strftime('%Y-%m-%d') self.pool.get('project.task').write(cr, uid, task.id, {'date_start':start_dt, 'date_deadline':deadline_dt}) else: self.pool.get('project.task').write(cr, uid, [task.id], {'date_start':start_dt}) return super(project_project,self).write(cr, uid, ids, vals, *args, **kwargs)
| 467,552
|
def setFont(self, node): fname = node.get('name') return self.canvas.setFont(fname, utils.unit_get(node.get('size')))
|
def setFont(self, node): fname = node.get('name') return self.canvas.setFont(fname, utils.unit_get(node.get('size')))
| 467,553
|
def _handle_one_foreign(self,fore, path, auth_provider): """ This method overrides the handle_one_request for *children* handlers. It is required, since the first line should not be read again..
|
def _handle_one_foreign(self,fore, path, auth_provider): """ This method overrides the handle_one_request for *children* handlers. It is required, since the first line should not be read again..
| 467,554
|
def _get_model_recs(self, cr, uid, context=None): if context is None: context = {} #Fills up the selection box which allows records from the selected object to be displayed self.context = context if 'template_id' in context: ref_obj_id = self.pool.get('email.template').read(cr, uid, context['template_id'], ['object_name'], context) ref_obj_name = self.pool.get('ir.model').read(cr, uid, ref_obj_id['object_name'][0], ['model'], context)['model'] model_obj = self.pool.get(ref_obj_name) ref_obj_ids = model_obj.search(cr, uid, [], 0, 20, 'id desc', context=context) if not ref_obj_ids: ref_obj_ids = []
|
def _get_model_recs(self, cr, uid, context=None): if context is None: context = {} #Fills up the selection box which allows records from the selected object to be displayed self.context = context if 'template_id' in context: ref_obj_id = self.pool.get('email.template').read(cr, uid, context['template_id'], ['object_name'], context) ref_obj_name = self.pool.get('ir.model').read(cr, uid, ref_obj_id['object_name'][0], ['model'], context)['model'] model_obj = self.pool.get(ref_obj_name) ref_obj_ids = model_obj.search(cr, uid, [], 0, 20, 'id', context=context) if not ref_obj_ids: ref_obj_ids = []
| 467,555
|
def _sub_total(self, cr, uid, ids, name, arg, context=None): """ Calculates Sub total" @param name: Names of fields. @param arg: User defined arguments @return: Dictionary of values. """ res = {} for obj in self.browse(cr, uid, ids): res[obj.id] = obj.pieces * obj.number return res
|
def _sub_total(self, cr, uid, ids, name, arg, context=None): """ Calculates Sub total @param name: Names of fields. @param arg: User defined arguments @return: Dictionary of values. """ res = {} for obj in self.browse(cr, uid, ids): res[obj.id] = obj.pieces * obj.number return res
| 467,556
|
def inv_line_create(self, cr, uid, a, ol): return (0, False, { 'name': ol.name, 'account_id': a.id, '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 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 or False, })
| 467,557
|
def action_invoice_create(self, cr, uid, ids, *args): res = False
|
def action_invoice_create(self, cr, uid, ids, *args): res = False
| 467,558
|
def _get_payment_term_lines(term_id, amount): term_pool = self.pool.get('account.payment.term') if term_id and amount: terms = term_pool.compute(cr, uid, term_id, amount) return terms return False
|
def _get_payment_term_lines(term_id, amount): term_pool = self.pool.get('account.payment.term') if term_id and amount: terms = term_pool.compute(cr, uid, term_id, amount) return terms return False
| 467,559
|
def _get_payment_term_lines(term_id, amount): term_pool = self.pool.get('account.payment.term') if term_id and amount: terms = term_pool.compute(cr, uid, term_id, amount) return terms return False
|
def _get_payment_term_lines(term_id, amount): term_pool = self.pool.get('account.payment.term') if term_id and amount: terms = term_pool.compute(cr, uid, term_id, amount) return terms return False
| 467,560
|
def _get_payment_term_lines(term_id, amount): term_pool = self.pool.get('account.payment.term') if term_id and amount: terms = term_pool.compute(cr, uid, term_id, amount) return terms return False
|
def _get_payment_term_lines(term_id, amount): term_pool = self.pool.get('account.payment.term') if term_id and amount: terms = term_pool.compute(cr, uid, term_id, amount) return terms return False
| 467,561
|
def _get_payment_term_lines(term_id, amount): term_pool = self.pool.get('account.payment.term') if term_id and amount: terms = term_pool.compute(cr, uid, term_id, amount) return terms return False
|
defsign = debit - credit < 0 and -1 or 1 _get_payment_term_lines(term_id,sign = debit - credit < 0 and -1 or 1 amount):sign = debit - credit < 0 and -1 or 1 term_poolsign = debit - credit < 0 and -1 or 1 =sign = debit - credit < 0 and -1 or 1 self.pool.get('account.payment.term')sign = debit - credit < 0 and -1 or 1 ifsign = debit - credit < 0 and -1 or 1 term_idsign = debit - credit < 0 and -1 or 1 andsign = debit - credit < 0 and -1 or 1 amount:sign = debit - credit < 0 and -1 or 1 termssign = debit - credit < 0 and -1 or 1 =sign = debit - credit < 0 and -1 or 1 term_pool.compute(cr,sign = debit - credit < 0 and -1 or 1 uid,sign = debit - credit < 0 and -1 or 1 term_id,sign = debit - credit < 0 and -1 or 1 amount)sign = debit - credit < 0 and -1 or 1 returnsign = debit - credit < 0 and -1 or 1 termssign = debit - credit < 0 and -1 or 1 returnsign = debit - credit < 0 and -1 or 1 False
| 467,562
|
def _get_payment_term_lines(term_id, amount): term_pool = self.pool.get('account.payment.term') if term_id and amount: terms = term_pool.compute(cr, uid, term_id, amount) return terms return False
|
def _get_payment_term_lines(term_id, amount): term_pool = self.pool.get('account.payment.term') if term_id and amount: terms = term_pool.compute(cr, uid, term_id, amount) return terms return False
| 467,563
|
def _get_payment_term_lines(term_id, amount): term_pool = self.pool.get('account.payment.term') if term_id and amount: terms = term_pool.compute(cr, uid, term_id, amount) return terms return False
|
def _get_payment_term_lines(term_id, amount): term_pool = self.pool.get('account.payment.term') if term_id and amount: terms = term_pool.compute(cr, uid, term_id, amount) return terms return False
| 467,564
|
def _get_payment_term_lines(term_id, amount): term_pool = self.pool.get('account.payment.term') if term_id and amount: terms = term_pool.compute(cr, uid, term_id, amount) return terms return False
|
def _get_payment_term_lines(term_id, amount): term_pool = self.pool.get('account.payment.term') if term_id and amount: terms = term_pool.compute(cr, uid, term_id, amount) return terms return False
| 467,565
|
def default_get(self, cr, user, fields_list, context=None): """ Returns default values for fields @param fields_list: list of fields, for which default values are required to be read @param context: context arguments, like lang, time zone
|
def default_get(self, cr, user, fields_list, context=None): """ Returns default values for fields @param fields_list: list of fields, for which default values are required to be read @param context: context arguments, like lang, time zone
| 467,566
|
def unlink(self, cr, uid, ids, context=None): voucher_obj = self.pool.get('account.voucher') statement_line = self.browse(cr, uid, ids, context) unlink_ids = [] for st_line in statement_line: if st_line.voucher_id: unlink_ids.append(st_line.voucher_id.id) voucher_obj.unlink(cr, uid, unlink_ids, context=context) return super(account_bank_statement_line, self).unlink(cr, uid, ids, context=context)
|
def unlink(self, cr, uid, ids, context=None): voucher_obj = self.pool.get('account.voucher') statement_line = self.browse(cr, uid, ids, context) unlink_ids = [] for st_line in statement_line: if st_line.voucher_id: unlink_ids.append(st_line.voucher_id.id) voucher_obj.unlink(cr, uid, unlink_ids, context=context) return super(account_bank_statement_line, self).unlink(cr, uid, ids, context=context)
| 467,567
|
def default_get(self, cr, uid, fields, context): """ To get default values for the object. @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param fields: List of fields for which we want default values @param context: A standard dictionary @return: A dictionary which of fields with values. """ res = super(pos_make_payment, self).default_get(cr, uid, fields, context=context)
|
defdefault_get(self,cr,uid,fields,context):"""Togetdefaultvaluesfortheobject.@paramself:Theobjectpointer.@paramcr:Adatabasecursor@paramuid:IDoftheusercurrentlyloggedin@paramfields:Listoffieldsforwhichwewantdefaultvalues@paramcontext:Astandarddictionary@return:Adictionarywhichoffieldswithvalues."""res=super(pos_make_payment,self).default_get(cr,uid,fields,context=context)
| 467,568
|
def default_get(self, cr, uid, fields, context): """ To get default values for the object. @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param fields: List of fields for which we want default values @param context: A standard dictionary @return: A dictionary which of fields with values. """ res = super(pos_make_payment, self).default_get(cr, uid, fields, context=context)
|
def default_get(self, cr, uid, fields, context): """ To get default values for the object. @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param fields: List of fields for which we want default values @param context: A standard dictionary @return: A dictionary which of fields with values. """ res = super(pos_make_payment, self).default_get(cr, uid, fields, context=context)
| 467,569
|
def do_invite(self, cr, uid, ids, context={}): datas = self.read(cr, uid, ids)[0] model = False model_field = False if not context or not context.get('model'): return {} else: model = context.get('model') model_field = context.get('attendee_field', False) obj = self.pool.get(model) res_obj = obj.browse(cr, uid, context['active_id']) type = datas.get('type') att_obj = self.pool.get('calendar.attendee') vals = {} mail_to = [] if not model == 'calendar.attendee': vals = {'ref': '%s,%s' % (model, base_calendar_id2real_id(context['active_id']))}
|
def do_invite(self, cr, uid, ids, context={}): datas = self.read(cr, uid, ids)[0] model = False model_field = False if not context or not context.get('model'): return {} else: model = context.get('model') model_field = context.get('attendee_field', False) obj = self.pool.get(model) res_obj = obj.browse(cr, uid, context['active_id']) type = datas.get('type') att_obj = self.pool.get('calendar.attendee') vals = {} mail_to = [] if not model == 'calendar.attendee': vals = {'ref': '%s,%s' % (model, base_calendar_id2real_id(context['active_id']))}
| 467,570
|
def do_invite(self, cr, uid, ids, context={}): datas = self.read(cr, uid, ids)[0] model = False model_field = False if not context or not context.get('model'): return {} else: model = context.get('model') model_field = context.get('attendee_field', False) obj = self.pool.get(model) res_obj = obj.browse(cr, uid, context['active_id']) type = datas.get('type') att_obj = self.pool.get('calendar.attendee') vals = {} mail_to = [] if not model == 'calendar.attendee': vals = {'ref': '%s,%s' % (model, base_calendar_id2real_id(context['active_id']))}
|
def do_invite(self, cr, uid, ids, context={}): datas = self.read(cr, uid, ids)[0] model = False model_field = False if not context or not context.get('model'): return {} else: model = context.get('model') model_field = context.get('attendee_field', False) obj = self.pool.get(model) res_obj = obj.browse(cr, uid, context['active_id']) type = datas.get('type') att_obj = self.pool.get('calendar.attendee') vals = {} mail_to = [] if not model == 'calendar.attendee': vals = {'ref': '%s,%s' % (model, base_calendar_id2real_id(context['active_id']))}
| 467,571
|
def do_invite(self, cr, uid, ids, context={}): datas = self.read(cr, uid, ids)[0] model = False model_field = False if not context or not context.get('model'): return {} else: model = context.get('model') model_field = context.get('attendee_field', False) obj = self.pool.get(model) res_obj = obj.browse(cr, uid, context['active_id']) type = datas.get('type') att_obj = self.pool.get('calendar.attendee') vals = {} mail_to = [] if not model == 'calendar.attendee': vals = {'ref': '%s,%s' % (model, base_calendar_id2real_id(context['active_id']))}
|
defatt_id = att_obj.create(cr, uid, vals) if model_field: obj.write(cr, uid, res_obj.id, {model_field: [(4, att_id)]}) do_invite(self,att_id = att_obj.create(cr, uid, vals) if model_field: obj.write(cr, uid, res_obj.id, {model_field: [(4, att_id)]}) cr,att_id = att_obj.create(cr, uid, vals) if model_field: obj.write(cr, uid, res_obj.id, {model_field: [(4, att_id)]}) uid,att_id = att_obj.create(cr, uid, vals) if model_field: obj.write(cr, uid, res_obj.id, {model_field: [(4, att_id)]}) ids,att_id = att_obj.create(cr, uid, vals) if model_field: obj.write(cr, uid, res_obj.id, {model_field: [(4, att_id)]}) context={}):att_id = att_obj.create(cr, uid, vals) if model_field: obj.write(cr, uid, res_obj.id, {model_field: [(4, att_id)]}) datasatt_id = att_obj.create(cr, uid, vals) if model_field: obj.write(cr, uid, res_obj.id, {model_field: [(4, att_id)]}) =att_id = att_obj.create(cr, uid, vals) if model_field: obj.write(cr, uid, res_obj.id, {model_field: [(4, att_id)]}) self.read(cr,att_id = att_obj.create(cr, uid, vals) if model_field: obj.write(cr, uid, res_obj.id, {model_field: [(4, att_id)]}) uid,att_id = att_obj.create(cr, uid, vals) if model_field: obj.write(cr, uid, res_obj.id, {model_field: [(4, att_id)]}) ids)[0]att_id = att_obj.create(cr, uid, vals) if model_field: obj.write(cr, uid, res_obj.id, {model_field: [(4, att_id)]}) modelatt_id = att_obj.create(cr, uid, vals) if model_field: obj.write(cr, uid, res_obj.id, {model_field: [(4, att_id)]}) =att_id = att_obj.create(cr, uid, vals) if model_field: obj.write(cr, uid, res_obj.id, {model_field: [(4, att_id)]}) Falseatt_id = att_obj.create(cr, uid, vals) if model_field: obj.write(cr, uid, res_obj.id, {model_field: [(4, att_id)]}) model_fieldatt_id = att_obj.create(cr, uid, vals) if model_field: obj.write(cr, uid, res_obj.id, {model_field: [(4, att_id)]}) =att_id = att_obj.create(cr, uid, vals) if model_field: obj.write(cr, uid, res_obj.id, {model_field: [(4, att_id)]}) Falseatt_id = att_obj.create(cr, uid, vals) if model_field: obj.write(cr, uid, res_obj.id, {model_field: [(4, att_id)]}) ifatt_id = att_obj.create(cr, uid, vals) if model_field: obj.write(cr, uid, res_obj.id, {model_field: [(4, att_id)]}) notatt_id = att_obj.create(cr, uid, vals) if model_field: obj.write(cr, uid, res_obj.id, {model_field: [(4, att_id)]}) contextatt_id = att_obj.create(cr, uid, vals) if model_field: obj.write(cr, uid, res_obj.id, {model_field: [(4, att_id)]}) oratt_id = att_obj.create(cr, uid, vals) if model_field: obj.write(cr, uid, res_obj.id, {model_field: [(4, att_id)]}) notatt_id = att_obj.create(cr, uid, vals) if model_field: obj.write(cr, uid, res_obj.id, {model_field: [(4, att_id)]}) context.get('model'):att_id = att_obj.create(cr, uid, vals) if model_field: obj.write(cr, uid, res_obj.id, {model_field: [(4, att_id)]}) returnatt_id = att_obj.create(cr, uid, vals) if model_field: obj.write(cr, uid, res_obj.id, {model_field: [(4, att_id)]}) {}att_id = att_obj.create(cr, uid, vals) if model_field: obj.write(cr, uid, res_obj.id, {model_field: [(4, att_id)]}) else:att_id = att_obj.create(cr, uid, vals) if model_field: obj.write(cr, uid, res_obj.id, {model_field: [(4, att_id)]}) modelatt_id = att_obj.create(cr, uid, vals) if model_field: obj.write(cr, uid, res_obj.id, {model_field: [(4, att_id)]}) =att_id = att_obj.create(cr, uid, vals) if model_field: obj.write(cr, uid, res_obj.id, {model_field: [(4, att_id)]}) context.get('model')att_id = att_obj.create(cr, uid, vals) if model_field: obj.write(cr, uid, res_obj.id, {model_field: [(4, att_id)]}) model_fieldatt_id = att_obj.create(cr, uid, vals) if model_field: obj.write(cr, uid, res_obj.id, {model_field: [(4, att_id)]}) =att_id = att_obj.create(cr, uid, vals) if model_field: obj.write(cr, uid, res_obj.id, {model_field: [(4, att_id)]}) context.get('attendee_field',att_id = att_obj.create(cr, uid, vals) if model_field: obj.write(cr, uid, res_obj.id, {model_field: [(4, att_id)]}) False)att_id = att_obj.create(cr, uid, vals) if model_field: obj.write(cr, uid, res_obj.id, {model_field: [(4, att_id)]}) objatt_id = att_obj.create(cr, uid, vals) if model_field: obj.write(cr, uid, res_obj.id, {model_field: [(4, att_id)]}) =att_id = att_obj.create(cr, uid, vals) if model_field: obj.write(cr, uid, res_obj.id, {model_field: [(4, att_id)]}) self.pool.get(model)att_id = att_obj.create(cr, uid, vals) if model_field: obj.write(cr, uid, res_obj.id, {model_field: [(4, att_id)]}) res_objatt_id = att_obj.create(cr, uid, vals) if model_field: obj.write(cr, uid, res_obj.id, {model_field: [(4, att_id)]}) =att_id = att_obj.create(cr, uid, vals) if model_field: obj.write(cr, uid, res_obj.id, {model_field: [(4, att_id)]}) obj.browse(cr,att_id = att_obj.create(cr, uid, vals) if model_field: obj.write(cr, uid, res_obj.id, {model_field: [(4, att_id)]}) uid,att_id = att_obj.create(cr, uid, vals) if model_field: obj.write(cr, uid, res_obj.id, {model_field: [(4, att_id)]}) context['active_id'])att_id = att_obj.create(cr, uid, vals) if model_field: obj.write(cr, uid, res_obj.id, {model_field: [(4, att_id)]}) typeatt_id = att_obj.create(cr, uid, vals) if model_field: obj.write(cr, uid, res_obj.id, {model_field: [(4, att_id)]}) =att_id = att_obj.create(cr, uid, vals) if model_field: obj.write(cr, uid, res_obj.id, {model_field: [(4, att_id)]}) datas.get('type')att_id = att_obj.create(cr, uid, vals) if model_field: obj.write(cr, uid, res_obj.id, {model_field: [(4, att_id)]}) att_objatt_id = att_obj.create(cr, uid, vals) if model_field: obj.write(cr, uid, res_obj.id, {model_field: [(4, att_id)]}) =att_id = att_obj.create(cr, uid, vals) if model_field: obj.write(cr, uid, res_obj.id, {model_field: [(4, att_id)]}) self.pool.get('calendar.attendee')att_id = att_obj.create(cr, uid, vals) if model_field: obj.write(cr, uid, res_obj.id, {model_field: [(4, att_id)]}) valsatt_id = att_obj.create(cr, uid, vals) if model_field: obj.write(cr, uid, res_obj.id, {model_field: [(4, att_id)]}) =att_id = att_obj.create(cr, uid, vals) if model_field: obj.write(cr, uid, res_obj.id, {model_field: [(4, att_id)]}) {}att_id = att_obj.create(cr, uid, vals) if model_field: obj.write(cr, uid, res_obj.id, {model_field: [(4, att_id)]}) mail_toatt_id = att_obj.create(cr, uid, vals) if model_field: obj.write(cr, uid, res_obj.id, {model_field: [(4, att_id)]}) =att_id = att_obj.create(cr, uid, vals) if model_field: obj.write(cr, uid, res_obj.id, {model_field: [(4, att_id)]}) []att_id = att_obj.create(cr, uid, vals) if model_field: obj.write(cr, uid, res_obj.id, {model_field: [(4, att_id)]}) ifatt_id = att_obj.create(cr, uid, vals) if model_field: obj.write(cr, uid, res_obj.id, {model_field: [(4, att_id)]}) notatt_id = att_obj.create(cr, uid, vals) if model_field: obj.write(cr, uid, res_obj.id, {model_field: [(4, att_id)]}) modelatt_id = att_obj.create(cr, uid, vals) if model_field: obj.write(cr, uid, res_obj.id, {model_field: [(4, att_id)]}) ==att_id = att_obj.create(cr, uid, vals) if model_field: obj.write(cr, uid, res_obj.id, {model_field: [(4, att_id)]}) 'calendar.attendee':att_id = att_obj.create(cr, uid, vals) if model_field: obj.write(cr, uid, res_obj.id, {model_field: [(4, att_id)]}) valsatt_id = att_obj.create(cr, uid, vals) if model_field: obj.write(cr, uid, res_obj.id, {model_field: [(4, att_id)]}) =att_id = att_obj.create(cr, uid, vals) if model_field: obj.write(cr, uid, res_obj.id, {model_field: [(4, att_id)]}) {'ref':att_id = att_obj.create(cr, uid, vals) if model_field: obj.write(cr, uid, res_obj.id, {model_field: [(4, att_id)]}) '%s,%s'att_id = att_obj.create(cr, uid, vals) if model_field: obj.write(cr, uid, res_obj.id, {model_field: [(4, att_id)]}) %att_id = att_obj.create(cr, uid, vals) if model_field: obj.write(cr, uid, res_obj.id, {model_field: [(4, att_id)]}) (model,att_id = att_obj.create(cr, uid, vals) if model_field: obj.write(cr, uid, res_obj.id, {model_field: [(4, att_id)]}) base_calendar_id2real_id(context['active_id']))}
| 467,572
|
def _compute_data(self, cr, uid, ids, name, arg, context): name = name[0] result = {}
|
def _compute_data(self, cr, uid, ids, name, arg, context): name = name[0] result = {}
| 467,573
|
def _compute_data(self, cr, uid, ids, name, arg, context): name = name[0] result = {}
|
def _compute_data(self, cr, uid, ids, name, arg, context): name = name[0] result = {}
| 467,574
|
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context={}, toolbar=False, submenu=False): journal_pool = self.pool.get('account.journal')
|
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context={}, toolbar=False, submenu=False): journal_pool = self.pool.get('account.journal')
| 467,575
|
def _check_uos(self, cursor, user, ids): for product in self.browse(cursor, user, ids): if product.uos_id \ and product.uos_id.category_id.id \ == product.uom_id.category_id.id: return False return True
|
def _check_uos(self, cursor, user, ids): for product in self.browse(cursor, user, ids): if product.uos_id \ and product.uos_id.category_id.id \ == product.uom_id.category_id.id: return False return True
| 467,576
|
def _get_header(self,cr,uid,ids): try : return tools.file_open(os.path.join('base', 'report', 'corporate_rml_header.rml')).read() except: return """
|
def _get_header(self,cr,uid,ids): try : return tools.file_open(os.path.join('base', 'report', 'corporate_rml_header.rml')).read() except: return """
| 467,577
|
def get_delegate_data(user): email = user.address_id and user.address_id.email or '' return self._get_address(user.name, email)
|
def get_delegate_data(user): email = user.address_id and user.address_id.email or '' return self._get_address(user.name, email)
| 467,578
|
def get_delegate_data(user): email = user.address_id and user.address_id.email or '' return self._get_address(user.name, email)
|
def get_delegate_data(user): email = user.address_id and user.address_id.email or '' return self._get_address(user.name, email)
| 467,579
|
def get_delegate_data(user): email = user.address_id and user.address_id.email or '' return self._get_address(user.name, email)
|
def get_delegate_data(user): email = user.address_id and user.address_id.email or '' return self._get_address(user.name, email)
| 467,580
|
def _get_user_avail(self, cr, uid, ids, context=None): current_datetime = datetime.now().strftime('%Y-%m-%d %H:%M:%S') res = {} attendee_obj = self.pool.get('calendar.attendee') attendee_ids = attendee_obj.search(cr, uid, [ ('event_date', '<=', current_datetime), ('event_end_date', '<=', current_datetime), ('state', '=', 'accepted'), ('user_id', 'in', ids) ])
|
def _get_user_avail(self, cr, uid, ids, context=None): current_datetime = datetime.now().strftime('%Y-%m-%d %H:%M:%S') res = {} attendee_obj = self.pool.get('calendar.attendee') attendee_ids = attendee_obj.search(cr, uid, [ ('event_date', '<=', current_datetime), ('event_end_date', '<=', current_datetime), ('state', '=', 'accepted'), ('user_id', 'in', ids) ])
| 467,581
|
def process_imp_ics(self, cr, uid, ids, context=None): """ Process Import ics File. @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of calendar event import’s IDs @return: dictionary of calendar evet import window with Import successful msg. """ if context is None: context = {} else: context = context.copy() context['uid'] = uid
|
def process_imp_ics(self, cr, uid, ids, context=None): """ Process Import ics File. @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of calendar event import’s IDs @return: dictionary of calendar evet import window with Import successful msg. """ if context is None: context = {} else: context = context.copy() context['uid'] = uid
| 467,582
|
def _get_duration(self, cr, uid, ids, name, arg, context): res = {} for meeting in self.browse(cr, uid, ids, context=context): start = datetime.strptime(meeting.date, "%Y-%m-%d %H:%M:%S") end = datetime.strptime(meeting.date_deadline[:19], "%Y-%m-%d %H:%M:%S") diff = end - start duration = float(diff.days)* 24 + (float(diff.seconds) / 3600) res[meeting.id] = round(duration, 2) return res
|
def _get_duration(self, cr, uid, ids, name, arg, context): res = {} for meeting in self.browse(cr, uid, ids, context=context): start = datetime.strptime(meeting.date, "%Y-%m-%d %H:%M:%S") if meeting.date_deadline: end = datetime.strptime(meeting.date_deadline[:19], "%Y-%m-%d %H:%M:%S") diff = end - start duration = float(diff.days)* 24 + (float(diff.seconds) / 3600) res[meeting.id] = round(duration, 2) return res
| 467,583
|
def _progress(self, cr, uid, context=None): total = self.pool.get('ir.actions.todo')\ .search_count(cr, uid, [], context) open = self.pool.get('ir.actions.todo')\ .search_count(cr, uid, [('state','<>','open')], context) if total: return round(open*100./total) return 100.
|
def _progress(self, cr, uid, context=None): total = self.pool.get('ir.actions.todo')\ .search_count(cr, uid, [], context) closed = self.pool.get('ir.actions.todo')\ .search_count(cr, uid, [('state','<>','open')], context) if total: return round(open*100./total) return 100.
| 467,584
|
def _progress(self, cr, uid, context=None): total = self.pool.get('ir.actions.todo')\ .search_count(cr, uid, [], context) open = self.pool.get('ir.actions.todo')\ .search_count(cr, uid, [('state','<>','open')], context) if total: return round(open*100./total) return 100.
|
def _progress(self, cr, uid, context=None): total = self.pool.get('ir.actions.todo')\ .search_count(cr, uid, [], context) open = self.pool.get('ir.actions.todo')\ .search_count(cr, uid, [('state','<>','open')], context) if total: return round(closed*100./total) return 100.
| 467,585
|
def doIndex(self, content, filename=None, content_type=None, realfname = None, debug=False): fobj = None fname = None mime = None if content_type and self.mimes.has_key(content_type): mime = content_type fobj = self.mimes[content_type] elif filename: bname,ext = os.path.splitext(filename) if self.exts.has_key(ext): fobj = self.exts[ext] mime = fobj._getDefMime(ext) if content_type and not fobj: mime,fobj = mime_match(content_type, self.mimes) if not fobj: try: if realfname : fname = realfname else: try: bname,ext = os.path.splitext(filename or 'test.tmp') except Exception: bname, ext = filename, 'tmp' fd, fname = tempfile.mkstemp(suffix=ext) os.write(fd, content) os.close(fd) fp = Popen(['file','-b','--mime',fname], shell=False, stdout=PIPE).stdout try: result = fp.read() finally: fp.close() mime2 = result.split(';')[0] self.__logger.debug('File gave us: %s', mime2) # Note that the temporary file still exists now. mime,fobj = mime_match(mime2, self.mimes) if not mime: mime = mime2 except Exception: self.__logger.exception('Cannot determine mime type') try: if fobj: res = (mime, fobj.indexContent(content,filename,fname or realfname) ) else: self.__logger.debug("Have no object, return (%s, None)", mime) res = (mime, None ) except Exception: self.__logger.exception("Could not index file %s (%s)", filename, fname or realfname) res = None # If we created a tmp file, unlink it now if not realfname and fname: try: os.unlink(fname) except Exception: self.__logger.exception("Could not unlink %s", fname) return res
|
def doIndex(self, content, filename=None, content_type=None, realfname = None, debug=False): fobj = None fname = None mime = None if content_type and self.mimes.has_key(content_type): mime = content_type fobj = self.mimes[content_type] elif filename: bname,ext = os.path.splitext(filename) if self.exts.has_key(ext): fobj = self.exts[ext] mime = fobj._getDefMime(ext) if content_type and not fobj: mime,fobj = mime_match(content_type, self.mimes) if not fobj: try: if realfname : fname = realfname else: try: bname,ext = os.path.splitext(filename or 'test.tmp') except Exception: bname, ext = filename, 'tmp' fd, fname = tempfile.mkstemp(suffix=ext) os.write(fd, content) os.close(fd) pop = Popen(['file','-b','--mime',fname], shell=False, stdout=PIPE) (result, _) = pop.communicate() mime2 = result.split(';')[0] self.__logger.debug('File gave us: %s', mime2) # Note that the temporary file still exists now. mime,fobj = mime_match(mime2, self.mimes) if not mime: mime = mime2 except Exception: self.__logger.exception('Cannot determine mime type') try: if fobj: res = (mime, fobj.indexContent(content,filename,fname or realfname) ) else: self.__logger.debug("Have no object, return (%s, None)", mime) res = (mime, None ) except Exception: self.__logger.exception("Could not index file %s (%s)", filename, fname or realfname) res = None # If we created a tmp file, unlink it now if not realfname and fname: try: os.unlink(fname) except Exception: self.__logger.exception("Could not unlink %s", fname) return res
| 467,586
|
def check(db, uid, passwd): cached_pass = security._uid_cache.get(db, {}).get(uid) if (cached_pass is not None) and cached_pass == passwd: return True cr = pooler.get_db(db).cursor() if passwd not in _salt_cache: cr.execute( 'select login from res_users where id=%s', (uid,) ) stored_login = cr.fetchone() if stored_login: stored_login = stored_login[0] if not login(db,stored_login,passwd): return security.ExceptionNoTb('AccessDenied') salt = _salt_cache[passwd] cr.execute(' select count(*) from res_users where id=%s and password=%s', (int(uid), encrypt_md5( passwd, salt )) ) res = cr.fetchone()[0] cr.close() if not bool(res): raise security.ExceptionNoTb('AccessDenied') if res: security._uid_cache[uid] = passwd return bool(res)
|
def check(db, uid, passwd): cached_pass = security._uid_cache.get(db, {}).get(uid) if (cached_pass is not None) and cached_pass == passwd: return True cr = pooler.get_db(db).cursor() if passwd not in _salt_cache: cr.execute( 'select login from res_users where id=%s', (uid,) ) stored_login = cr.fetchone() if stored_login: stored_login = stored_login[0] if not login(db,stored_login,passwd): raise security.ExceptionNoTb('AccessDenied') salt = _salt_cache[passwd] cr.execute(' select count(*) from res_users where id=%s and password=%s', (int(uid), encrypt_md5( passwd, salt )) ) res = cr.fetchone()[0] cr.close() if not bool(res): raise security.ExceptionNoTb('AccessDenied') if res: security._uid_cache[uid] = passwd return bool(res)
| 467,587
|
def _ca_invoiced_calc(self, cr, uid, ids, name, arg, context=None): res = {} parent_ids = tuple(self.search(cr, uid, [('parent_id', 'child_of', ids)], context=context)) if parent_ids: cr.execute("SELECT account_analytic_line.account_id, COALESCE(SUM(amount_currency), 0.0) \ FROM account_analytic_line \ JOIN account_analytic_journal \ ON account_analytic_line.journal_id = account_analytic_journal.id \ WHERE account_analytic_line.account_id IN %s \ AND account_analytic_journal.type = 'sale' \ GROUP BY account_analytic_line.account_id", (parent_ids,)) for account_id, sum in cr.fetchall(): res[account_id] = round(sum,2) return self._compute_currency_for_level_tree(cr, uid, ids, parent_ids, res, context=context)
|
def _ca_invoiced_calc(self, cr, uid, ids, name, arg, context=None): res = {} res_final = {} child_ids = tuple(self.search(cr, uid, [('parent_id', 'child_of', ids)], context=context)) for i in child_ids: res[i] = {} for n in [name]: res[i][n] = 0.0 if not child_ids: return res if child_ids: cr.execute("SELECT account_analytic_line.account_id, COALESCE(SUM(amount), 0.0) \ FROM account_analytic_line \ JOIN account_analytic_journal \ ON account_analytic_line.journal_id = account_analytic_journal.id \ WHERE account_analytic_line.account_id IN %s \ AND account_analytic_journal.type = 'sale' \ GROUP BY account_analytic_line.account_id", (parent_ids,)) for account_id, sum in cr.fetchall(): res[account_id] = round(sum,2) return self._compute_currency_for_level_tree(cr, uid, ids, parent_ids, res, context=context)
| 467,588
|
def _ca_invoiced_calc(self, cr, uid, ids, name, arg, context=None): res = {} parent_ids = tuple(self.search(cr, uid, [('parent_id', 'child_of', ids)], context=context)) if parent_ids: cr.execute("SELECT account_analytic_line.account_id, COALESCE(SUM(amount_currency), 0.0) \ FROM account_analytic_line \ JOIN account_analytic_journal \ ON account_analytic_line.journal_id = account_analytic_journal.id \ WHERE account_analytic_line.account_id IN %s \ AND account_analytic_journal.type = 'sale' \ GROUP BY account_analytic_line.account_id", (parent_ids,)) for account_id, sum in cr.fetchall(): res[account_id] = round(sum,2) return self._compute_currency_for_level_tree(cr, uid, ids, parent_ids, res, context=context)
|
def _ca_invoiced_calc(self, cr, uid, ids, name, arg, context=None): res = {} parent_ids = tuple(self.search(cr, uid, [('parent_id', 'child_of', ids)], context=context)) if parent_ids: cr.execute("SELECT account_analytic_line.account_id, COALESCE(SUM(amount_currency), 0.0) \ FROM account_analytic_line \ JOIN account_analytic_journal \ ON account_analytic_line.journal_id = account_analytic_journal.id \ WHERE account_analytic_line.account_id IN %s \ AND account_analytic_journal.type = 'sale' \ GROUP BY account_analytic_line.account_id", (child_ids,)) for account_id, sum in cr.fetchall(): res[account_id] = round(sum,2) return self._compute_currency_for_level_tree(cr, uid, ids, parent_ids, res, context=context)
| 467,589
|
def _ca_invoiced_calc(self, cr, uid, ids, name, arg, context=None): res = {} parent_ids = tuple(self.search(cr, uid, [('parent_id', 'child_of', ids)], context=context)) if parent_ids: cr.execute("SELECT account_analytic_line.account_id, COALESCE(SUM(amount_currency), 0.0) \ FROM account_analytic_line \ JOIN account_analytic_journal \ ON account_analytic_line.journal_id = account_analytic_journal.id \ WHERE account_analytic_line.account_id IN %s \ AND account_analytic_journal.type = 'sale' \ GROUP BY account_analytic_line.account_id", (parent_ids,)) for account_id, sum in cr.fetchall(): res[account_id] = round(sum,2) return self._compute_currency_for_level_tree(cr, uid, ids, parent_ids, res, context=context)
|
def _ca_invoiced_calc(self, cr, uid, ids, name, arg, context=None): res = {} parent_ids = tuple(self.search(cr, uid, [('parent_id', 'child_of', ids)], context=context)) if parent_ids: cr.execute("SELECT account_analytic_line.account_id, COALESCE(SUM(amount_currency), 0.0) \ FROM account_analytic_line \ JOIN account_analytic_journal \ ON account_analytic_line.journal_id = account_analytic_journal.id \ WHERE account_analytic_line.account_id IN %s \ AND account_analytic_journal.type = 'sale' \ GROUP BY account_analytic_line.account_id", (parent_ids,)) for account_id, sum in cr.fetchall(): res[account_id] = round(sum,2) return self._compute_currency_for_level_tree(cr, uid, ids, parent_ids, res, context=context)
| 467,590
|
def _total_cost_calc(self, cr, uid, ids, name, arg, context=None): res = {} parent_ids = tuple(self.search(cr, uid, [('parent_id', 'child_of', ids)], context=context)) if parent_ids: cr.execute("""SELECT account_analytic_line.account_id, COALESCE(SUM(amount_currency), 0.0) \ FROM account_analytic_line \ JOIN account_analytic_journal \ ON account_analytic_line.journal_id = account_analytic_journal.id \ WHERE account_analytic_line.account_id IN %s \ AND amount<0 \ GROUP BY account_analytic_line.account_id""",(parent_ids,)) for account_id, sum in cr.fetchall(): res[account_id] = round(sum,2) return self._compute_currency_for_level_tree(cr, uid, ids, parent_ids, res, context=context)
|
def _total_cost_calc(self, cr, uid, ids, name, arg, context=None): res = {} res_final = {} child_ids = tuple(self.search(cr, uid, [('parent_id', 'child_of', ids)], context=context)) for i in child_ids: res[i] = {} for n in [name]: res[i][n] = 0.0 if not child_ids: return res if child_ids: cr.execute("""SELECT account_analytic_line.account_id, COALESCE(SUM(amount), 0.0) \ FROM account_analytic_line \ JOIN account_analytic_journal \ ON account_analytic_line.journal_id = account_analytic_journal.id \ WHERE account_analytic_line.account_id IN %s \ AND amount<0 \ GROUP BY account_analytic_line.account_id""",(parent_ids,)) for account_id, sum in cr.fetchall(): res[account_id] = round(sum,2) return self._compute_currency_for_level_tree(cr, uid, ids, parent_ids, res, context=context)
| 467,591
|
def _total_cost_calc(self, cr, uid, ids, name, arg, context=None): res = {} parent_ids = tuple(self.search(cr, uid, [('parent_id', 'child_of', ids)], context=context)) if parent_ids: cr.execute("""SELECT account_analytic_line.account_id, COALESCE(SUM(amount_currency), 0.0) \ FROM account_analytic_line \ JOIN account_analytic_journal \ ON account_analytic_line.journal_id = account_analytic_journal.id \ WHERE account_analytic_line.account_id IN %s \ AND amount<0 \ GROUP BY account_analytic_line.account_id""",(parent_ids,)) for account_id, sum in cr.fetchall(): res[account_id] = round(sum,2) return self._compute_currency_for_level_tree(cr, uid, ids, parent_ids, res, context=context)
|
def _total_cost_calc(self, cr, uid, ids, name, arg, context=None): res = {} parent_ids = tuple(self.search(cr, uid, [('parent_id', 'child_of', ids)], context=context)) if parent_ids: cr.execute("""SELECT account_analytic_line.account_id, COALESCE(SUM(amount_currency), 0.0) \ FROM account_analytic_line \ JOIN account_analytic_journal \ ON account_analytic_line.journal_id = account_analytic_journal.id \ WHERE account_analytic_line.account_id IN %s \ AND amount<0 \ GROUP BY account_analytic_line.account_id""",(child_ids,)) for account_id, sum in cr.fetchall(): res[account_id] = round(sum,2) return self._compute_currency_for_level_tree(cr, uid, ids, parent_ids, res, context=context)
| 467,592
|
def _total_cost_calc(self, cr, uid, ids, name, arg, context=None): res = {} parent_ids = tuple(self.search(cr, uid, [('parent_id', 'child_of', ids)], context=context)) if parent_ids: cr.execute("""SELECT account_analytic_line.account_id, COALESCE(SUM(amount_currency), 0.0) \ FROM account_analytic_line \ JOIN account_analytic_journal \ ON account_analytic_line.journal_id = account_analytic_journal.id \ WHERE account_analytic_line.account_id IN %s \ AND amount<0 \ GROUP BY account_analytic_line.account_id""",(parent_ids,)) for account_id, sum in cr.fetchall(): res[account_id] = round(sum,2) return self._compute_currency_for_level_tree(cr, uid, ids, parent_ids, res, context=context)
|
def _total_cost_calc(self, cr, uid, ids, name, arg, context=None): res = {} parent_ids = tuple(self.search(cr, uid, [('parent_id', 'child_of', ids)], context=context)) if parent_ids: cr.execute("""SELECT account_analytic_line.account_id, COALESCE(SUM(amount_currency), 0.0) \ FROM account_analytic_line \ JOIN account_analytic_journal \ ON account_analytic_line.journal_id = account_analytic_journal.id \ WHERE account_analytic_line.account_id IN %s \ AND amount<0 \ GROUP BY account_analytic_line.account_id""",(parent_ids,)) for account_id, sum in cr.fetchall(): res[account_id] = round(sum,2) return self._compute_currency_for_level_tree(cr, uid, ids, parent_ids, res, context=context)
| 467,593
|
def _get_ref(self, voucher_id, move_ids): voucher_line = self.pool.get('account.voucher.line').search(self.cr, self.uid, [('partner_id','=',move_ids.partner_id.id), ('voucher_id','=',voucher_id)]) if voucher_line: voucher = self.pool.get('account.voucher.line').browse(self.cr, self.uid, voucher_line)[0] return voucher.ref else: return
|
def _get_ref(self, voucher_id, move_ids): voucher_line = self.pool.get('account.voucher.line').search(self.cr, self.uid, [('partner_id','=',move_ids.partner_id.id), ('voucher_id','=',voucher_id)]) if voucher_line: voucher = self.pool.get('account.voucher.line').browse(self.cr, self.uid, voucher_line)[0] return voucher.name else: return
| 467,594
|
def get_file(self, cr, uid, id, file_node, mode, context=None): """ Return a file-like object for the contents of some node """ if context is None: context = {} boo = self.browse(cr, uid, id, context) if not boo.online: raise IOError(errno.EREMOTE, 'medium offline') if boo.readonly and mode not in ('r', 'rb'): raise IOError(errno.EPERM, "Readonly medium") ira = self.pool.get('ir.attachment').browse(cr, uid, file_node.file_id, context=context) if boo.type == 'filestore': if not ira.store_fname: # On a migrated db, some files may have the wrong storage type # try to fix their directory. if mode in ('r','r+'): if ira.file_size: self._doclog.warning( "ir.attachment #%d does not have a filename, but is at filestore, fix it!" % ira.id) raise IOError(errno.ENOENT, 'No file can be located') else: store_fname = self.__get_random_fname(boo.path) cr.execute('UPDATE ir_attachment SET store_fname = %s WHERE id = %s', (store_fname, ira.id)) fpath = os.path.join(boo.path, store_fname) else: fpath = os.path.join(boo.path, ira.store_fname) return nodefd_file(file_node, path=fpath, mode=mode)
|
def get_file(self, cr, uid, id, file_node, mode, context=None): """ Return a file-like object for the contents of some node """ if context is None: context = {} boo = self.browse(cr, uid, id, context) if not boo.online: raise IOError(errno.EREMOTE, 'medium offline') if boo.readonly and mode not in ('r', 'rb'): raise IOError(errno.EPERM, "Readonly medium") ira = self.pool.get('ir.attachment').browse(cr, uid, file_node.file_id, context=context) if boo.type == 'filestore': if not ira.store_fname: # On a migrated db, some files may have the wrong storage type # try to fix their directory. if mode in ('r','r+'): if ira.file_size: self._doclog.warning( "ir.attachment #%d does not have a filename, but is at filestore, fix it!" % ira.id) raise IOError(errno.ENOENT, 'No file can be located') else: store_fname = self.__get_random_fname(boo.path) cr.execute('UPDATE ir_attachment SET store_fname = %s WHERE id = %s', (store_fname, ira.id)) fpath = os.path.join(boo.path, store_fname) else: fpath = os.path.join(boo.path, ira.store_fname) return nodefd_file(file_node, path=fpath, mode=mode)
| 467,595
|
def get_file(self, cr, uid, id, file_node, mode, context=None): """ Return a file-like object for the contents of some node """ if context is None: context = {} boo = self.browse(cr, uid, id, context) if not boo.online: raise IOError(errno.EREMOTE, 'medium offline') if boo.readonly and mode not in ('r', 'rb'): raise IOError(errno.EPERM, "Readonly medium") ira = self.pool.get('ir.attachment').browse(cr, uid, file_node.file_id, context=context) if boo.type == 'filestore': if not ira.store_fname: # On a migrated db, some files may have the wrong storage type # try to fix their directory. if mode in ('r','r+'): if ira.file_size: self._doclog.warning( "ir.attachment #%d does not have a filename, but is at filestore, fix it!" % ira.id) raise IOError(errno.ENOENT, 'No file can be located') else: store_fname = self.__get_random_fname(boo.path) cr.execute('UPDATE ir_attachment SET store_fname = %s WHERE id = %s', (store_fname, ira.id)) fpath = os.path.join(boo.path, store_fname) else: fpath = os.path.join(boo.path, ira.store_fname) return nodefd_file(file_node, path=fpath, mode=mode)
|
def get_file(self, cr, uid, id, file_node, mode, context=None): """ Return a file-like object for the contents of some node """ if context is None: context = {} boo = self.browse(cr, uid, id, context) if not boo.online: raise IOError(errno.EREMOTE, 'medium offline') if boo.readonly and mode not in ('r', 'rb'): raise IOError(errno.EPERM, "Readonly medium") ira = self.pool.get('ir.attachment').browse(cr, uid, file_node.file_id, context=context) if boo.type == 'filestore': if not ira.store_fname: # On a migrated db, some files may have the wrong storage type # try to fix their directory. if mode in ('r','r+'): if ira.file_size: self._doclog.warning( "ir.attachment #%d does not have a filename, but is at filestore, fix it!" % ira.id) raise IOError(errno.ENOENT, 'No file can be located') else: store_fname = self.__get_random_fname(boo.path) cr.execute('UPDATE ir_attachment SET store_fname = %s WHERE id = %s', (store_fname, ira.id)) fpath = os.path.join(boo.path, store_fname) else: fpath = os.path.join(boo.path, ira.store_fname) return nodefd_file(file_node, path=fpath, mode=mode)
| 467,596
|
def get_file(self, cr, uid, id, file_node, mode, context=None): """ Return a file-like object for the contents of some node """ if context is None: context = {} boo = self.browse(cr, uid, id, context) if not boo.online: raise IOError(errno.EREMOTE, 'medium offline') if boo.readonly and mode not in ('r', 'rb'): raise IOError(errno.EPERM, "Readonly medium") ira = self.pool.get('ir.attachment').browse(cr, uid, file_node.file_id, context=context) if boo.type == 'filestore': if not ira.store_fname: # On a migrated db, some files may have the wrong storage type # try to fix their directory. if mode in ('r','r+'): if ira.file_size: self._doclog.warning( "ir.attachment #%d does not have a filename, but is at filestore, fix it!" % ira.id) raise IOError(errno.ENOENT, 'No file can be located') else: store_fname = self.__get_random_fname(boo.path) cr.execute('UPDATE ir_attachment SET store_fname = %s WHERE id = %s', (store_fname, ira.id)) fpath = os.path.join(boo.path, store_fname) else: fpath = os.path.join(boo.path, ira.store_fname) return nodefd_file(file_node, path=fpath, mode=mode)
|
def get_file(self, cr, uid, id, file_node, mode, context=None): """ Return a file-like object for the contents of some node """ if context is None: context = {} boo = self.browse(cr, uid, id, context) if not boo.online: raise IOError(errno.EREMOTE, 'medium offline') if boo.readonly and mode not in ('r', 'rb'): raise IOError(errno.EPERM, "Readonly medium") ira = self.pool.get('ir.attachment').browse(cr, uid, file_node.file_id, context=context) if boo.type == 'filestore': if not ira.store_fname: # On a migrated db, some files may have the wrong storage type # try to fix their directory. if mode in ('r','r+'): if ira.file_size: self._doclog.warning( "ir.attachment #%d does not have a filename, but is at filestore, fix it!" % ira.id) raise IOError(errno.ENOENT, 'No file can be located') else: store_fname = self.__get_random_fname(boo.path) cr.execute('UPDATE ir_attachment SET store_fname = %s WHERE id = %s', (store_fname, ira.id)) fpath = os.path.join(boo.path, store_fname) else: fpath = os.path.join(boo.path, ira.store_fname) return nodefd_file(file_node, path=fpath, mode=mode)
| 467,597
|
def simple_move(self, cr, uid, file_node, ndir_bro, context=None): """ A preparation for a file move. It will not affect the database, but merely check and perhaps move the realstore file. @param ndir_bro a browse object of document.directory, where this file should move to. @return the dict of values that can safely be be stored in the db. """ sbro = self.browse(cr, uid, file_node.storage_id, context=context) assert sbro, "The file #%d didn't provide storage" % file_node.file_id
|
def simple_move(self, cr, uid, file_node, ndir_bro, context=None): """ A preparation for a file move. It will not affect the database, but merely check and perhaps move the realstore file. @param ndir_bro a browse object of document.directory, where this file should move to. @return the dict of values that can safely be be stored in the db. """ sbro = self.browse(cr, uid, file_node.storage_id, context=context) assert sbro, "The file #%d didn't provide storage" % file_node.file_id
| 467,598
|
def simple_move(self, cr, uid, file_node, ndir_bro, context=None): """ A preparation for a file move. It will not affect the database, but merely check and perhaps move the realstore file. @param ndir_bro a browse object of document.directory, where this file should move to. @return the dict of values that can safely be be stored in the db. """ sbro = self.browse(cr, uid, file_node.storage_id, context=context) assert sbro, "The file #%d didn't provide storage" % file_node.file_id
|
def simple_move(self, cr, uid, file_node, ndir_bro, context=None): """ A preparation for a file move. It will not affect the database, but merely check and perhaps move the realstore file. @param ndir_bro a browse object of document.directory, where this file should move to. @return the dict of values that can safely be be stored in the db. """ sbro = self.browse(cr, uid, file_node.storage_id, context=context) assert sbro, "The file #%d didn't provide storage" % file_node.file_id
| 467,599
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.