bugged
stringlengths 4
228k
| fixed
stringlengths 0
96.3M
| __index_level_0__
int64 0
481k
|
|---|---|---|
def do_partial(self, cr, uid, ids, partial_datas, context=None): """ Makes partial pickings and moves done. @param partial_datas: Dictionary containing details of partial picking like partner_id, address_id, delivery_date, delivery moves with product_id, product_qty, uom """ res = {} picking_obj = self.pool.get('stock.picking') product_obj = self.pool.get('product.product') currency_obj = self.pool.get('res.currency') uom_obj = self.pool.get('product.uom') wf_service = netsvc.LocalService("workflow")
|
def do_partial(self, cr, uid, ids, partial_datas, context=None): """ Makes partial pickings and moves done. @param partial_datas: Dictionary containing details of partial picking like partner_id, address_id, delivery_date, delivery moves with product_id, product_qty, uom """ res = {} picking_obj = self.pool.get('stock.picking') product_obj = self.pool.get('product.product') currency_obj = self.pool.get('res.currency') uom_obj = self.pool.get('product.uom') wf_service = netsvc.LocalService("workflow")
| 471,000
|
def __get_partner_id(self, cr, uid, res_model, res_id, context): """ A helper to retrieve the associated partner from any res_model+id It is a hack that will try to discover if the mentioned record is clearly associated with a partner record. """ obj_model = self.pool.get(res_model) if obj_model._name == 'res.partner': return res_id elif 'partner_id' in obj_model._columns and obj_model._columns['partner_id']._obj == 'res.partner': bro = obj_model.browse(self, cr, uid, res_id, context=context) return bro.partner_id.id elif 'address_id' in obj_model._columns and obj_model._columns['address_id']._obj == 'res.partner.address': bro = obj_model.browse(self, cr, uid, res_id, context=context) return bro.address_id.partner_id.id return False
|
def __get_partner_id(self, cr, uid, res_model, res_id, context): """ A helper to retrieve the associated partner from any res_model+id It is a hack that will try to discover if the mentioned record is clearly associated with a partner record. """ obj_model = self.pool.get(res_model) if obj_model._name == 'res.partner': return res_id elif 'partner_id' in obj_model._columns and obj_model._columns['partner_id']._obj == 'res.partner': bro = obj_model.browse(cr, uid, res_id, context=context) return bro.partner_id.id elif 'address_id' in obj_model._columns and obj_model._columns['address_id']._obj == 'res.partner.address': bro = obj_model.browse(cr, uid, res_id, context=context) return bro.address_id.partner_id.id return False
| 471,001
|
def __get_partner_id(self, cr, uid, res_model, res_id, context): """ A helper to retrieve the associated partner from any res_model+id It is a hack that will try to discover if the mentioned record is clearly associated with a partner record. """ obj_model = self.pool.get(res_model) if obj_model._name == 'res.partner': return res_id elif 'partner_id' in obj_model._columns and obj_model._columns['partner_id']._obj == 'res.partner': bro = obj_model.browse(self, cr, uid, res_id, context=context) return bro.partner_id.id elif 'address_id' in obj_model._columns and obj_model._columns['address_id']._obj == 'res.partner.address': bro = obj_model.browse(self, cr, uid, res_id, context=context) return bro.address_id.partner_id.id return False
|
def __get_partner_id(self, cr, uid, res_model, res_id, context): """ A helper to retrieve the associated partner from any res_model+id It is a hack that will try to discover if the mentioned record is clearly associated with a partner record. """ obj_model = self.pool.get(res_model) if obj_model._name == 'res.partner': return res_id elif 'partner_id' in obj_model._columns and obj_model._columns['partner_id']._obj == 'res.partner': bro = obj_model.browse(cr, uid, res_id, context=context) return bro.partner_id.id elif 'address_id' in obj_model._columns and obj_model._columns['address_id']._obj == 'res.partner.address': bro = obj_model.browse(cr, uid, res_id, context=context) return bro.address_id.partner_id.id return False
| 471,002
|
def read_group(self, cr, uid, domain, fields, groupby, offset=0, limit=None, context=None, orderby=False): """ Get the list of records in list view grouped by the given ``groupby`` fields
|
def read_group(self, cr, uid, domain, fields, groupby, offset=0, limit=None, context=None, orderby=False): """ Get the list of records in list view grouped by the given ``groupby`` fields
| 471,003
|
def action_send(self, cr, uid, ids, context=None): """ This sends an email to ALL the addresses of the selected partners. """
|
def action_send(self, cr, uid, ids, context=None): """ This sends an email to ALL the addresses of the selected partners. """
| 471,004
|
def _end_balance(self, cursor, user, ids, name, attr, context=None): res_currency_obj = self.pool.get('res.currency') res_users_obj = self.pool.get('res.users')
|
def _end_balance(self, cursor, user, ids, name, attr, context=None): res_currency_obj = self.pool.get('res.currency') res_users_obj = self.pool.get('res.users')
| 471,005
|
def _end_balance(self, cursor, user, ids, name, attr, context=None): res_currency_obj = self.pool.get('res.currency') res_users_obj = self.pool.get('res.users')
|
def _end_balance(self, cursor, user, ids, name, attr, context=None): res_currency_obj = self.pool.get('res.currency') res_users_obj = self.pool.get('res.users')
| 471,006
|
def _end_balance(self, cursor, user, ids, name, attr, context=None): res_currency_obj = self.pool.get('res.currency') res_users_obj = self.pool.get('res.users')
|
def _end_balance(self, cursor, user, ids, name, attr, context=None): res_currency_obj = self.pool.get('res.currency') res_users_obj = self.pool.get('res.users')
| 471,007
|
def button_confirm(self, cr, uid, ids, context={}): """ Check the starting and ending detail of statement @return: True """ done = [] res_currency_obj = self.pool.get('res.currency') res_users_obj = self.pool.get('res.users') account_move_obj = self.pool.get('account.move') account_move_line_obj = self.pool.get('account.move.line') account_bank_statement_line_obj = self.pool.get('account.bank.statement.line')
|
def button_confirm(self, cr, uid, ids, context={}): """ Check the starting and ending detail of statement @return: True """ done = [] res_currency_obj = self.pool.get('res.currency') res_users_obj = self.pool.get('res.users') account_move_obj = self.pool.get('account.move') account_move_line_obj = self.pool.get('account.move.line') account_bank_statement_line_obj = self.pool.get('account.bank.statement.line')
| 471,008
|
def __compute(self, cr, uid, ids, field_names, arg, context={}, query=''): #compute the balance/debit/credit accordingly to the value of field_name for the given account ids mapping = { 'balance': "COALESCE(SUM(l.debit),0) - COALESCE(SUM(l.credit), 0) as balance ", 'debit': "COALESCE(SUM(l.debit), 0) as debit ", 'credit': "COALESCE(SUM(l.credit), 0) as credit " } #get all the necessary accounts ids2 = self._get_children_and_consol(cr, uid, ids, context) #compute for each account the balance/debit/credit from the move lines accounts = {} if ids2: aml_query = self.pool.get('account.move.line')._query_get(cr, uid, context=context)
|
def __compute(self, cr, uid, ids, field_names, arg, context={}, query=''): #compute the balance/debit/credit accordingly to the value of field_name for the given account ids mapping = { 'balance': "COALESCE(SUM(l.debit),0) - COALESCE(SUM(l.credit), 0) as balance ", 'debit': "COALESCE(SUM(l.debit), 0) as debit ", 'credit': "COALESCE(SUM(l.credit), 0) as credit " } #get all the necessary accounts ids2 = self._get_children_and_consol(cr, uid, ids, context) #compute for each account the balance/debit/credit from the move lines accounts = {} if ids2: aml_query = self.pool.get('account.move.line')._query_get(cr, uid, context=context)
| 471,009
|
def __getitem__(self, name): if name == 'id': return self._id if name not in self._data[self._id]: # build the list of fields we will fetch
|
def __getitem__(self, name): if name == 'id': return self._id if name not in self._data[self._id]: # build the list of fields we will fetch
| 471,010
|
def __getitem__(self, name): if name == 'id': return self._id if name not in self._data[self._id]: # build the list of fields we will fetch
|
def __getitem__(self, name): if name == 'id': return self._id if name not in self._data[self._id]: # build the list of fields we will fetch
| 471,011
|
def __getitem__(self, name): if name == 'id': return self._id if name not in self._data[self._id]: # build the list of fields we will fetch
|
def __getitem__(self, name): if name == 'id': return self._id if name not in self._data[self._id]: # build the list of fields we will fetch
| 471,012
|
def __getitem__(self, name): if name == 'id': return self._id if name not in self._data[self._id]: # build the list of fields we will fetch
|
def __getitem__(self, name): if name == 'id': return self._id if name not in self._data[self._id]: # build the list of fields we will fetch
| 471,013
|
def _membership_cancel(self, cr, uid, ids, name, args, context=None): '''Return the cancel date of membership''' res = {} member_line_obj = self.pool.get('membership.membership_line') for partner_id in ids: line_id = member_line_obj.search(cr, uid, [('partner', '=', partner_id)], limit=1, order='date_cancel') if line_id: res[partner_id] = member_line_obj.read(cr, uid, line_id[0], ['date_cancel'])['date_cancel'] else: res[partner_id] = False return res
|
def _membership_cancel(self, cr, uid, ids, name, args, context=None): '''Return the cancel date of membership''' res = {} member_line_obj = self.pool.get('membership.membership_line') for partner in self.browse(cr, uid, ids, context=context): if partner.membership_state != 'canceled': res[partner.id] = False else: res[partner_id] = False return res
| 471,014
|
def _membership_cancel(self, cr, uid, ids, name, args, context=None): '''Return the cancel date of membership''' res = {} member_line_obj = self.pool.get('membership.membership_line') for partner_id in ids: line_id = member_line_obj.search(cr, uid, [('partner', '=', partner_id)], limit=1, order='date_cancel') if line_id: res[partner_id] = member_line_obj.read(cr, uid, line_id[0], ['date_cancel'])['date_cancel'] else: res[partner_id] = False return res
|
def _membership_cancel(self, cr, uid, ids, name, args, context=None): '''Return the cancel date of membership''' res = {} member_line_obj = self.pool.get('membership.membership_line') for partner_id in ids: line_id = member_line_obj.search(cr, uid, [('partner', '=', partner_id)], limit=1, order='date_cancel') if line_id: res[partner_id] = member_line_obj.read(cr, uid, line_id[0], ['date_cancel'])['date_cancel'] else: line_id = member_line_obj.search(cr, uid, [('partner', '=', partner.id)],limit=1, order='date_cancel') if line_id: res[partner.id] = member_line_obj.read(cr, uid, line_id[0],['date_cancel'])['date_cancel'] else: res[partner.id] = False return res
| 471,015
|
def _compute_day(self, cr, uid, ids, fields, args, context=None): if context is None: context = {} """ @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of Openday’s IDs @return: difference between current date and log date @param context: A standard dictionary for contextual values """ cal_obj = self.pool.get('resource.calendar') res_obj = self.pool.get('resource.resource')
|
def _compute_day(self, cr, uid, ids, fields, args, context=None): if context is None: context = {} """ @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of Openday’s IDs @return: difference between current date and log date @param context: A standard dictionary for contextual values """ cal_obj = self.pool.get('resource.calendar') res_obj = self.pool.get('resource.resource')
| 471,016
|
def create_order(self, cr, uid, ids, context): """ To Create a purchase orders .
|
def create_order(self, cr, uid, ids, context): """ To Create a purchase orders .
| 471,017
|
def write(self, cr, uid, ids, vals, context=None): resource_calendar_obj = self.pool.get('resource.calendar') resource_obj = self.pool.get('resource.resource') uom_obj = self.pool.get('product.uom') if context is None: context = {} res = super(project_phase, self).write(cr, uid, ids, vals, context=context) if context.get('scheduler',False): return res # Consider calendar and efficiency if the phase is performed by a resource # otherwise consider the project's working calendar
|
def write(self, cr, uid, ids, vals, context=None): resource_calendar_obj = self.pool.get('resource.calendar') resource_obj = self.pool.get('resource.resource') uom_obj = self.pool.get('product.uom') if context is None: context = {} res = super(project_phase, self).write(cr, uid, ids, vals, context=context) if context.get('scheduler',False): return res # Consider calendar and efficiency if the phase is performed by a resource # otherwise consider the project's working calendar
| 471,018
|
def parse_rawline(self): """Parse a request (internal).
|
def parse_rawline(self): """Parse a request (internal).
| 471,019
|
def _amount_all(self, cr, uid, ids, name, args, context=None): tax_obj = self.pool.get('account.tax') res={} for order in self.browse(cr, uid, ids): res[order.id] = { 'amount_paid': 0.0, 'amount_return':0.0, 'amount_tax':0.0, } for payment in order.statement_ids: res[order.id]['amount_paid'] += payment.amount for payment in order.payments: res[order.id]['amount_return'] += (payment.amount < 0 and payment.amount or 0) for line in order.lines: if order.price_type!='tax_excluded': res[order.id]['amount_tax'] = reduce(lambda x, y: x+round(y['amount'], 2), tax_obj.compute_inv(cr, uid, line.product_id.taxes_id, line.price_unit * \ (1-(line.discount or 0.0)/100.0), line.qty), res[order.id]['amount_tax']) else: res[order.id]['amount_tax'] = reduce(lambda x, y: x+round(y['amount'], 2), tax_obj.compute_all(cr, uid, line.product_id.taxes_id, line.price_unit * \ (1-(line.discount or 0.0)/100.0), line.qty)['taxes'], res[order.id]['amount_tax']) return res
|
def _amount_all(self, cr, uid, ids, name, args, context=None): tax_obj = self.pool.get('account.tax') cur_obj = self.pool.get('res.currency') res={} for order in self.browse(cr, uid, ids): res[order.id] = { 'amount_paid': 0.0, 'amount_return':0.0, 'amount_tax':0.0, } for payment in order.statement_ids: res[order.id]['amount_paid'] += payment.amount for payment in order.payments: res[order.id]['amount_return'] += (payment.amount < 0 and payment.amount or 0) for line in order.lines: if order.price_type!='tax_excluded': res[order.id]['amount_tax'] = reduce(lambda x, y: x+round(y['amount'], 2), tax_obj.compute_inv(cr, uid, line.product_id.taxes_id, line.price_unit * \ (1-(line.discount or 0.0)/100.0), line.qty), res[order.id]['amount_tax']) else: res[order.id]['amount_tax'] = reduce(lambda x, y: x+round(y['amount'], 2), tax_obj.compute_all(cr, uid, line.product_id.taxes_id, line.price_unit * \ (1-(line.discount or 0.0)/100.0), line.qty)['taxes'], res[order.id]['amount_tax']) return res
| 471,020
|
def _amount_all(self, cr, uid, ids, name, args, context=None): tax_obj = self.pool.get('account.tax') res={} for order in self.browse(cr, uid, ids): res[order.id] = { 'amount_paid': 0.0, 'amount_return':0.0, 'amount_tax':0.0, } for payment in order.statement_ids: res[order.id]['amount_paid'] += payment.amount for payment in order.payments: res[order.id]['amount_return'] += (payment.amount < 0 and payment.amount or 0) for line in order.lines: if order.price_type!='tax_excluded': res[order.id]['amount_tax'] = reduce(lambda x, y: x+round(y['amount'], 2), tax_obj.compute_inv(cr, uid, line.product_id.taxes_id, line.price_unit * \ (1-(line.discount or 0.0)/100.0), line.qty), res[order.id]['amount_tax']) else: res[order.id]['amount_tax'] = reduce(lambda x, y: x+round(y['amount'], 2), tax_obj.compute_all(cr, uid, line.product_id.taxes_id, line.price_unit * \ (1-(line.discount or 0.0)/100.0), line.qty)['taxes'], res[order.id]['amount_tax']) return res
|
def _amount_all(self, cr, uid, ids, name, args, context=None): tax_obj = self.pool.get('account.tax') res={} for order in self.browse(cr, uid, ids): res[order.id] = { 'amount_paid': 0.0, 'amount_return':0.0, 'amount_tax':0.0, } for payment in order.statement_ids: res[order.id]['amount_paid'] += payment.amount for payment in order.payments: res[order.id]['amount_return'] += (payment.amount < 0 and payment.amount or 0) for line in order.lines: if order.price_type!='tax_excluded': res[order.id]['amount_tax'] = reduce(lambda x, y: x+round(y['amount'], 2), tax_obj.compute_inv(cr, uid, line.product_id.taxes_id, line.price_unit * \ (1-(line.discount or 0.0)/100.0), line.qty), res[order.id]['amount_tax']) else: for c in tax_obj.compute_all(cr, uid, line.product_id.taxes_id, line.price_unit * (1-(line.discount or 0.0)/100.0), line.qty, line.product_id, line.order_id.partner_id)['taxes']: val += c['amount'] res[order.id]['amount_tax'] = cur_obj.round(cr, uid, cur, val) return res
| 471,021
|
def check_access_rule(self, cr, uid, ids, operation, context=None): """Verifies that the operation given by ``operation`` is allowed for the user according to ir.rules.
|
def check_access_rule(self, cr, uid, ids, operation, context=None): """Verifies that the operation given by ``operation`` is allowed for the user according to ir.rules.
| 471,022
|
def check_model(self, cr, uid, ids, context = None): if context is None: context = {} current_rec = self.read(cr, uid, ids, context)[0] if current_rec: model = self.pool.get(current_rec.get('object_id')[1]) if hasattr(model, 'message_new'): return True return False
|
def check_model(self, cr, uid, ids, context = None): if context is None: context = {} current_rec = self.read(cr, uid, ids, context) if current_rec: model = self.pool.get(current_rec.get('object_id')[1]) if hasattr(model, 'message_new'): return True return False
| 471,023
|
def check_model(self, cr, uid, ids, context = None): if context is None: context = {} current_rec = self.read(cr, uid, ids, context)[0] if current_rec: model = self.pool.get(current_rec.get('object_id')[1]) if hasattr(model, 'message_new'): return True return False
|
def check_model(self, cr, uid, ids, context = None): if context is None: context = {} current_rec = self.read(cr, uid, ids, context)[0] if current_rec: current_rec = current_rec[0] model_name = self.pool.get('ir.model').browse(cr, uid, current_rec.get('object_id')[0]).model model = self.pool.get(model_name) if hasattr(model, 'message_new'): return True return False
| 471,024
|
def populate_statement(self, cr, uid, ids, context=None): line_obj = self.pool.get('payment.line') statement_obj = self.pool.get('account.bank.statement') statement_line_obj = self.pool.get('account.bank.statement.line') currency_obj = self.pool.get('res.currency') voucher_obj = self.pool.get('account.voucher') voucher_line_obj = self.pool.get('account.voucher.line')
|
def populate_statement(self, cr, uid, ids, context=None): line_obj = self.pool.get('payment.line') statement_obj = self.pool.get('account.bank.statement') statement_line_obj = self.pool.get('account.bank.statement.line') currency_obj = self.pool.get('res.currency') voucher_obj = self.pool.get('account.voucher') voucher_line_obj = self.pool.get('account.voucher.line')
| 471,025
|
def create(self, cr, uid, vals, context={}): try: res = super(account_invoice, self).create(cr, uid, vals, context) return res except Exception,e: if '"journal_id" viol' in e.args[0]: raise except_orm(_('Configuration Error!'), _('There is no Accounting Journal of type Sale/Purchase defined!')) else: raise except_orm(_('UnknownError'), str(e))
|
def create(self, cr, uid, vals, context={}): try: res = super(account_invoice, self).create(cr, uid, vals, context) return res except Exception,e: if '"journal_id" viol' in e.args[0]: raise orm.except_orm(_('Configuration Error!'), _('There is no Accounting Journal of type Sale/Purchase defined!')) else: raise except_orm(_('UnknownError'), str(e))
| 471,026
|
def create(self, cr, uid, vals, context={}): try: res = super(account_invoice, self).create(cr, uid, vals, context) return res except Exception,e: if '"journal_id" viol' in e.args[0]: raise except_orm(_('Configuration Error!'), _('There is no Accounting Journal of type Sale/Purchase defined!')) else: raise except_orm(_('UnknownError'), str(e))
|
def create(self, cr, uid, vals, context={}): try: res = super(account_invoice, self).create(cr, uid, vals, context) return res except Exception,e: if '"journal_id" viol' in e.args[0]: raise except_orm(_('Configuration Error!'), _('There is no Accounting Journal of type Sale/Purchase defined!')) else: raise except_orm(_('UnknownError'), str(e))
| 471,027
|
def move_line_get(self, cr, uid, invoice_id): res = [] cr.execute('SELECT * FROM account_invoice_tax WHERE invoice_id=%s', (invoice_id,)) for t in cr.dictfetchall(): if not t['amount'] \ and not t['tax_code_id'] \ and not t['tax_amount']: continue res.append({ 'type':'tax', 'name':t['name'], 'price_unit': t['amount'], 'quantity': 1, 'price': t['amount'] or 0.0, 'account_id': t['account_id'], 'tax_code_id': t['tax_code_id'], 'tax_amount': t['tax_amount'] }) return res
|
def move_line_get(self, cr, uid, invoice_id): res = [] cr.execute('SELECT * FROM account_invoice_tax WHERE invoice_id=%s', (invoice_id,)) for t in cr.dictfetchall(): if not t['amount'] \ and not t['tax_code_id'] \ and not t['tax_amount']: continue res.append({ 'type':'tax', 'name':t['name'], 'price_unit': t['amount'], 'quantity': 1, 'price': t['amount'] or 0.0, 'account_id': t['account_id'], 'tax_code_id': t['tax_code_id'], 'tax_amount': t['tax_amount'] }) return res
| 471,028
|
def move_line_get(self, cr, uid, invoice_id): res = [] cr.execute('SELECT * FROM account_invoice_tax WHERE invoice_id=%s', (invoice_id,)) for t in cr.dictfetchall(): if not t['amount'] \ and not t['tax_code_id'] \ and not t['tax_amount']: continue res.append({ 'type':'tax', 'name':t['name'], 'price_unit': t['amount'], 'quantity': 1, 'price': t['amount'] or 0.0, 'account_id': t['account_id'], 'tax_code_id': t['tax_code_id'], 'tax_amount': t['tax_amount'] }) return res
|
def move_line_get(self, cr, uid, invoice_id): res = [] cr.execute('SELECT * FROM account_invoice_tax WHERE invoice_id=%s', (invoice_id,)) for t in cr.dictfetchall(): if not t['amount'] \ and not t['tax_code_id'] \ and not t['tax_amount']: continue res.append({ 'type':'tax', 'name':t['name'], 'price_unit': t['amount'], 'quantity': 1, 'price': t['amount'] or 0.0, 'account_id': t['account_id'], 'tax_code_id': t['tax_code_id'], 'tax_amount': t['tax_amount'] }) return res
| 471,029
|
def button_reset_taxes(self, cr, uid, ids, context=None): if not context: context = {} ait_obj = self.pool.get('account.invoice.tax') for id in ids: cr.execute("DELETE FROM account_invoice_tax WHERE invoice_id=%s", (id,)) partner = self.browse(cr, uid, id, context=context).partner_id if partner.lang: context.update({'lang': partner.lang}) for taxe in ait_obj.compute(cr, uid, id, context=context).values(): ait_obj.create(cr, uid, taxe) # Update the stored value (fields.function), so we write to trigger recompute self.pool.get('account.invoice').write(cr, uid, ids, {'invoice_line':[]}, context=context) return True
|
def button_reset_taxes(self, cr, uid, ids, context=None): if context is None: context = {} ait_obj = self.pool.get('account.invoice.tax') for id in ids: cr.execute("DELETE FROM account_invoice_tax WHERE invoice_id=%s", (id,)) partner = self.browse(cr, uid, id, context=context).partner_id if partner.lang: context.update({'lang': partner.lang}) for taxe in ait_obj.compute(cr, uid, id, context=context).values(): ait_obj.create(cr, uid, taxe) # Update the stored value (fields.function), so we write to trigger recompute self.pool.get('account.invoice').write(cr, uid, ids, {'invoice_line':[]}, context=context) return True
| 471,030
|
def button_reset_taxes(self, cr, uid, ids, context=None): if not context: context = {} ait_obj = self.pool.get('account.invoice.tax') for id in ids: cr.execute("DELETE FROM account_invoice_tax WHERE invoice_id=%s", (id,)) partner = self.browse(cr, uid, id, context=context).partner_id if partner.lang: context.update({'lang': partner.lang}) for taxe in ait_obj.compute(cr, uid, id, context=context).values(): ait_obj.create(cr, uid, taxe) # Update the stored value (fields.function), so we write to trigger recompute self.pool.get('account.invoice').write(cr, uid, ids, {'invoice_line':[]}, context=context) return True
|
def button_reset_taxes(self, cr, uid, ids, context=None): if not context: context = {} ait_obj = self.pool.get('account.invoice.tax') for id in ids: cr.execute("DELETE FROM account_invoice_tax WHERE invoice_id=%s", (id,)) partner = self.browse(cr, uid, id, context=ctx).partner_id if partner.lang: context.update({'lang': partner.lang}) for taxe in ait_obj.compute(cr, uid, id, context=context).values(): ait_obj.create(cr, uid, taxe) # Update the stored value (fields.function), so we write to trigger recompute self.pool.get('account.invoice').write(cr, uid, ids, {'invoice_line':[]}, context=context) return True
| 471,031
|
def button_reset_taxes(self, cr, uid, ids, context=None): if not context: context = {} ait_obj = self.pool.get('account.invoice.tax') for id in ids: cr.execute("DELETE FROM account_invoice_tax WHERE invoice_id=%s", (id,)) partner = self.browse(cr, uid, id, context=context).partner_id if partner.lang: context.update({'lang': partner.lang}) for taxe in ait_obj.compute(cr, uid, id, context=context).values(): ait_obj.create(cr, uid, taxe) # Update the stored value (fields.function), so we write to trigger recompute self.pool.get('account.invoice').write(cr, uid, ids, {'invoice_line':[]}, context=context) return True
|
def button_reset_taxes(self, cr, uid, ids, context=None): if not context: context = {} ait_obj = self.pool.get('account.invoice.tax') for id in ids: cr.execute("DELETE FROM account_invoice_tax WHERE invoice_id=%s", (id,)) partner = self.browse(cr, uid, id, context=context).partner_id if partner.lang: ctx.update({'lang': partner.lang}) for taxe in ait_obj.compute(cr, uid, id, context=ctx).values(): ait_obj.create(cr, uid, taxe) # Update the stored value (fields.function), so we write to trigger recompute self.pool.get('account.invoice').write(cr, uid, ids, {'invoice_line':[]}, context=context) return True
| 471,032
|
def button_reset_taxes(self, cr, uid, ids, context=None): if not context: context = {} ait_obj = self.pool.get('account.invoice.tax') for id in ids: cr.execute("DELETE FROM account_invoice_tax WHERE invoice_id=%s", (id,)) partner = self.browse(cr, uid, id, context=context).partner_id if partner.lang: context.update({'lang': partner.lang}) for taxe in ait_obj.compute(cr, uid, id, context=context).values(): ait_obj.create(cr, uid, taxe) # Update the stored value (fields.function), so we write to trigger recompute self.pool.get('account.invoice').write(cr, uid, ids, {'invoice_line':[]}, context=context) return True
|
def button_reset_taxes(self, cr, uid, ids, context=None): if not context: context = {} ait_obj = self.pool.get('account.invoice.tax') for id in ids: cr.execute("DELETE FROM account_invoice_tax WHERE invoice_id=%s", (id,)) partner = self.browse(cr, uid, id, context=context).partner_id if partner.lang: context.update({'lang': partner.lang}) for taxe in ait_obj.compute(cr, uid, id, context=context).values(): ait_obj.create(cr, uid, taxe) # Update the stored value (fields.function), so we write to trigger recompute self.pool.get('account.invoice').write(cr, uid, ids, {'invoice_line':[]}, context=ctx) return True
| 471,033
|
def _calculate(self, cr, uid, ids, field_names, arg, context): res = {} for rs in self.browse(cr, uid, ids, context): allow = 0.0 deduct = 0.0 others = 0.0 obj = { 'basic':rs.basic } if rs.igross > 0: obj.update({ 'gross':rs.igross }) if rs.inet > 0: obj.update({ 'net':rs.inet }) for line in rs.line_ids: amount = 0.0 if line.amount_type == 'per': try: amount = line.amount * eval(str(line.category_id.base), obj) except Exception, e: raise osv.except_osv(_('Variable Error !'), _('Variable Error : %s ' % (e))) elif line.amount_type in ('fix', 'func'): amount = line.amount
|
def_calculate(self,cr,uid,ids,field_names,arg,context):res={}forrsinself.browse(cr,uid,ids,context):allow=0.0deduct=0.0others=0.0obj={'basic':rs.basic}ifrs.igross>0:obj.update({'gross':rs.igross})ifrs.inet>0:obj.update({'net':rs.inet})forlineinrs.line_ids:amount=0.0ifline.amount_type=='per':try:amount=line.amount*eval(str(line.category_id.base),obj)exceptException,e:raiseosv.except_osv(_('VariableError!'),_('VariableError:%s'%(e)))elifline.amount_typein('fix','func'):amount=line.amount
| 471,034
|
def cancel_sheet(self, cr, uid, ids, context={}): move_pool = self.pool.get('account.move')
|
def cancel_sheet(self, cr, uid, ids, context={}): move_pool = self.pool.get('account.move')
| 471,035
|
def get_contract(self, cr, uid, employee, date, context={}): sql_req= ''' SELECT c.id as id, c.wage as wage, struct_id as function FROM hr_contract c LEFT JOIN hr_employee emp on (c.employee_id=emp.id) LEFT JOIN hr_contract_wage_type cwt on (cwt.id = c.wage_type_id) LEFT JOIN hr_contract_wage_type_period p on (cwt.period_id = p.id) WHERE (emp.id=%s) AND (date_start <= %s) AND (date_end IS NULL OR date_end >= %s) LIMIT 1 ''' cr.execute(sql_req, (employee.id, date, date)) contract = cr.dictfetchone() return contract
|
def get_contract(self, cr, uid, employee, date, context={}): sql_req= ''' SELECT c.id as id, c.wage as wage, struct_id as function FROM hr_contract c LEFT JOIN hr_employee emp on (c.employee_id=emp.id) LEFT JOIN hr_contract_wage_type cwt on (cwt.id = c.wage_type_id) LEFT JOIN hr_contract_wage_type_period p on (cwt.period_id = p.id) WHERE (emp.id=%s) AND (date_start <= %s) AND (date_end IS NULL OR date_end >= %s) LIMIT 1 ''' cr.execute(sql_req, (employee.id, date, date)) contract = cr.dictfetchone() contract = contract and contract or {} return contract
| 471,036
|
def get_days(start, end, month, year, calc_day): count = 0 import datetime for day in range(start, end): if datetime.date(year, month, day).weekday() == calc_day: count += 1 return count
|
defget_days(start,end,month,year,calc_day):count=0importdatetimefordayinrange(start,end):ifdatetime.date(year,month,day).weekday()==calc_day:count+=1returncount
| 471,037
|
def get_days(start, end, month, year, calc_day): count = 0 import datetime for day in range(start, end): if datetime.date(year, month, day).weekday() == calc_day: count += 1 return count
|
def get_days(start, end, month, year, calc_day): count = 0 import datetime for day in range(start, end): if datetime.date(year, month, day).weekday() == calc_day: count += 1 return count
| 471,038
|
def get_days(start, end, month, year, calc_day): count = 0 import datetime for day in range(start, end): if datetime.date(year, month, day).weekday() == calc_day: count += 1 return count
|
def get_days(start, end, month, year, calc_day): count = 0 import datetime for day in range(start, end): if datetime.date(year, month, day).weekday() == calc_day: count += 1 return count
| 471,039
|
def _get_tasks(self, cr, uid, ids, name, args, context=None): if context is None: context = {} users_obj = self.pool.get('res.users') result = {} tm = users_obj.browse(cr, uid, uid, context).company_id.project_time_mode_id if tm and tm.factor: div = tm.factor else: div = 1.0 tm2 = users_obj.browse(cr, uid, uid, context).company_id.planning_time_mode_id if tm2 and tm2.factor: div2 = tm2.factor else: div2 = 1.0 for line in self.browse(cr, uid, ids, context): cr.execute(""" SELECT COALESCE(sum(tasks.remaining_hours),0) FROM project_task tasks WHERE tasks.planning_line_id IN ( SELECT id FROM report_account_analytic_planning_line WHERE planning_id = %s AND account_id=%s )""", (line.planning_id.id,line.account_id.id )) result[line.id] = cr.fetchall()[0][0] / div * div2 return result
|
def _get_tasks(self, cr, uid, ids, name, args, context=None): if context is None: context = {} users_obj = self.pool.get('res.users') result = {} tm = users_obj.browse(cr, uid, uid, context).company_id.project_time_mode_id if tm and tm.factor: div = tm.factor else: div = 1.0 tm2 = users_obj.browse(cr, uid, uid, context).company_id.planning_time_mode_id if tm2 and tm2.factor: div2 = tm2.factor else: div2 = 1.0 for line in self.browse(cr, uid, ids, context): cr.execute(""" SELECT COALESCE(sum(tasks.remaining_hours),0) FROM project_task tasks WHERE tasks.planning_line_id IN ( SELECT id FROM report_account_analytic_planning_line WHERE planning_id = %s AND account_id=%s )""", (line.planning_id.id, line.account_id and line.account_id.id or None)) result[line.id] = cr.fetchall()[0][0] / div * div2 return result
| 471,040
|
def _get_timesheets(self, cr, uid, ids, name, args, context=None): if context is None: context = {} users_obj = self.pool.get('res.users') result = {} tm2 = users_obj.browse(cr, uid, uid, context).company_id.planning_time_mode_id if tm2 and tm2.factor: div2 = tm2.factor else: div2 = 1.0 for line in self.browse(cr, uid, ids, context): cr.execute(""" SELECT SUM(unit_amount/uom.factor) FROM account_analytic_line acc LEFT JOIN product_uom uom ON (uom.id = acc.product_uom_id) WHERE acc.date>=%s and acc.date<=%s and acc.account_id=%s""", (line.planning_id.date_from, line.planning_id.date_to, line.account_id.id, )) res = cr.fetchall()[0][0] if res: result[line.id] = res * div2 else: result[line.id] = 0 return result
|
def _get_timesheets(self, cr, uid, ids, name, args, context=None): if context is None: context = {} users_obj = self.pool.get('res.users') result = {} tm2 = users_obj.browse(cr, uid, uid, context).company_id.planning_time_mode_id if tm2 and tm2.factor: div2 = tm2.factor else: div2 = 1.0 for line in self.browse(cr, uid, ids, context): cr.execute(""" SELECT SUM(unit_amount/uom.factor) FROM account_analytic_line acc LEFT JOIN product_uom uom ON (uom.id = acc.product_uom_id) WHERE acc.date>=%s and acc.date<=%s and acc.account_id=%s""", (line.planning_id.date_from, line.planning_id.date_to, line.account_id and line.account_id.id or None)) res = cr.fetchall()[0][0] if res: result[line.id] = res * div2 else: result[line.id] = 0 return result
| 471,041
|
def _sum_amount_real(self, cr, uid, ids, name, args, context=None): if context is None: context = {} users_obj = self.pool.get('res.users') result = {} tm2 = users_obj.browse(cr, uid, uid, context).company_id.planning_time_mode_id if tm2 and tm2.factor: div2 = tm2.factor else: div2 = 1.0 for line in self.browse(cr, uid, ids, context): if line.user_id: cr.execute('''SELECT sum(acc.unit_amount/uom.factor) FROM account_analytic_line acc LEFT JOIN product_uom uom ON (uom.id = acc.product_uom_id)
|
def _sum_amount_real(self, cr, uid, ids, name, args, context=None): if context is None: context = {} users_obj = self.pool.get('res.users') result = {} tm2 = users_obj.browse(cr, uid, uid, context).company_id.planning_time_mode_id if tm2 and tm2.factor: div2 = tm2.factor else: div2 = 1.0 for line in self.browse(cr, uid, ids, context): if line.user_id: cr.execute('''SELECT sum(acc.unit_amount/uom.factor) FROM account_analytic_line acc LEFT JOIN product_uom uom ON (uom.id = acc.product_uom_id)
| 471,042
|
def _sum_amount_real(self, cr, uid, ids, name, args, context=None): if context is None: context = {} users_obj = self.pool.get('res.users') result = {} tm2 = users_obj.browse(cr, uid, uid, context).company_id.planning_time_mode_id if tm2 and tm2.factor: div2 = tm2.factor else: div2 = 1.0 for line in self.browse(cr, uid, ids, context): if line.user_id: cr.execute('''SELECT sum(acc.unit_amount/uom.factor) FROM account_analytic_line acc LEFT JOIN product_uom uom ON (uom.id = acc.product_uom_id)
|
def _sum_amount_real(self, cr, uid, ids, name, args, context=None): if context is None: context = {} users_obj = self.pool.get('res.users') result = {} tm2 = users_obj.browse(cr, uid, uid, context).company_id.planning_time_mode_id if tm2 and tm2.factor: div2 = tm2.factor else: div2 = 1.0 for line in self.browse(cr, uid, ids, context): if line.user_id: cr.execute('''SELECT sum(acc.unit_amount/uom.factor) FROM account_analytic_line acc LEFT JOIN product_uom uom ON (uom.id = acc.product_uom_id)
| 471,043
|
def _sum_amount_tasks(self, cr, uid, ids, name, args, context=None): if context is None: context = {} users_obj = self.pool.get('res.users') result = {} tm = users_obj.browse(cr, uid, uid, context).company_id.project_time_mode_id if tm and tm.factor: div = tm.factor else: div = 1.0 tm2 = users_obj.browse(cr, uid, uid, context).company_id.planning_time_mode_id if tm2 and tm2.factor: div2 = tm2.factor else: div2 = 1.0 for line in self.browse(cr, uid, ids, context): where = '' if line.user_id: where = 'user_id=' + str(line.user_id.id) + ' and ' cr.execute('''select sum(planned_hours) FROM project_task WHERE ''' + where + ''' project_id IN (select id from project_project where analytic_account_id=%s) AND date_end>=%s AND date_end<=%s''', ( line.account_id.id, line.planning_id.date_from, line.planning_id.date_to) ) sum = cr.fetchone() if sum and sum[0]: result[line.id] = sum[0] /div * div2 return result
|
def _sum_amount_tasks(self, cr, uid, ids, name, args, context=None): if context is None: context = {} users_obj = self.pool.get('res.users') result = {} tm = users_obj.browse(cr, uid, uid, context).company_id.project_time_mode_id if tm and tm.factor: div = tm.factor else: div = 1.0 tm2 = users_obj.browse(cr, uid, uid, context).company_id.planning_time_mode_id if tm2 and tm2.factor: div2 = tm2.factor else: div2 = 1.0 for line in self.browse(cr, uid, ids, context): where = '' if line.user_id: where = 'user_id=' + str(line.user_id.id) + ' and ' cr.execute('''select sum(planned_hours) FROM project_task WHERE ''' + where + ''' project_id IN (select id from project_project where analytic_account_id=%s) AND date_end>=%s AND date_end<=%s''', ( line.account_id and line.account_id.id or None, line.planning_id.date_from, line.planning_id.date_to) ) sum = cr.fetchone() if sum and sum[0]: result[line.id] = sum[0] /div * div2 return result
| 471,044
|
def set_to_zero(self, cr, uid, ids, context):
|
def set_to_zero(self, cr, uid, ids, context):
| 471,045
|
def set_to_zero(self, cr, uid, ids, context):
|
defset_to_zero(self,cr,uid,ids,context):
| 471,046
|
def set_to_zero(self, cr, uid, ids, context):
|
def set_to_zero(self, cr, uid, ids, context):
| 471,047
|
def open_voucher(self, cr, uid, ids, context={}): obj=self.pool.get('account.voucher').browse(cr,uid,ids) total=0 for i in obj[0].payment_ids: total+=i.amount self.write(cr,uid,ids,{'amount':total}) self.write(cr, uid, ids, {'state':'proforma'}) return True
|
def open_voucher(self, cr, uid, ids, context={}): obj=self.pool.get('account.voucher').browse(cr,uid,ids) total=0 for i in obj[0].payment_ids: total+=i.amount if total!=0: self.write(cr,uid,ids,{'amount':total}) self.write(cr, uid, ids, {'state':'proforma'}) else: raise osv.except_osv('Invalid action !', 'You can not post to Pro-Forma a voucher with Total amount = 0') return True
| 471,048
|
def unlink(self, cr, uid, ids, context={}): vouchers = self.read(cr, uid, ids, ['state']) unlink_ids = [] for t in vouchers: if t['state'] in ('draft', 'cancel'): unlink_ids.append(t['id']) else: raise osv.except_osv('Invalid action !', 'Cannot delete invoice(s) which are already opened or paid !') osv.osv.unlink(self, cr, uid, unlink_ids) return True
|
def unlink(self, cr, uid, ids, context={}): vouchers = self.read(cr, uid, ids, ['state']) unlink_ids = [] for t in vouchers: if t['state'] in ('draft', 'cancel'): unlink_ids.append(t['id']) else: raise osv.except_osv('Invalid action !', 'Cannot delete Voucher(s) which are already opened or paid !') osv.osv.unlink(self, cr, uid, unlink_ids) return True
| 471,049
|
def get_wizard(self,mode): if mode == 'dta': return 'l10n_ch', 'action_account_dtr_create_values'
|
def get_wizard(self,mode): if mode == 'dta': return 'l10n_ch', 'action_account_dtr_create_values'
| 471,050
|
def open_attachment(self, cr, uid, ids, context): """ To Open attachments @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param ids: the ID of messages @param context: A standard dictionary """ action_data = False action_pool = self.pool.get('ir.actions.act_window') action_ids = action_pool.search(cr, uid, [('res_model', '=', 'ir.attachment')]) if action_ids: action_data = action_pool.read(cr, uid, action_ids[0], context=context) action_data.update({ 'domain': [('res_id','in',ids),('res_model','=',self._name)], 'nodestroy': True }) return action_data
|
def open_attachment(self, cr, uid, ids, context): """ To Open attachments @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param ids: the ID of messages @param context: A standard dictionary """ action_data = False action_pool = self.pool.get('ir.actions.act_window') action_ids = action_pool.search(cr, uid, [('res_model', '=', 'ir.attachment')]) if action_ids: action_data = action_pool.read(cr, uid, action_ids[0], context=context) action_data.update({ 'domain': [('res_id','=',message_pool.res_id),('res_model','=',message_pool.model)], 'nodestroy': True }) return action_data
| 471,051
|
def _get_info(self, cr, uid, data, context): if not data['id']: return {} pool = pooler.get_pool(cr.dbname) case = pool.get('crm.case').browse(cr,uid,data['ids'])[0] #if not case.email_from: # raise wizard.except_wizard(_('Error'),_('You must put a Partner eMail to use this action!')) if not case.user_id: raise wizard.except_wizard(_('Error'),_('You must define a responsible user for this case in order to use this action!')) return {'to': case.email_from,'subject': case.name,'cc': case.email_cc or ''}
|
def _get_info(self, cr, uid, data, context): if not data['id']: return {} pool = pooler.get_pool(cr.dbname) case = pool.get('crm.case').browse(cr,uid,data['ids'])[0] #if not case.email_from: # raise wizard.except_wizard(_('Error'),_('You must put a Partner eMail to use this action!')) if not case.user_id: raise wizard.except_wizard(_('Error'),_('You must define a responsible user for this case in order to use this action!')) return {'to': case.email_from,'subject': case.name,'cc': case.email_cc or ''}
| 471,052
|
def _get_info(self, cr, uid, data, context): if not data['id']: return {} pool = pooler.get_pool(cr.dbname) case = pool.get('crm.case').browse(cr,uid,data['ids'])[0] #if not case.email_from: # raise wizard.except_wizard(_('Error'),_('You must put a Partner eMail to use this action!')) if not case.user_id: raise wizard.except_wizard(_('Error'),_('You must define a responsible user for this case in order to use this action!')) return {'to': case.email_from,'subject': case.name,'cc': case.email_cc or ''}
|
def _get_info(self, cr, uid, data, context): if not data['id']: return {} pool = pooler.get_pool(cr.dbname) case = pool.get('crm.case').browse(cr,uid,data['ids'])[0] #if not case.email_from: # raise wizard.except_wizard(_('Error'),_('You must put a Partner eMail to use this action!')) if not case.user_id: raise wizard.except_wizard(_('Error'),_('You must define a responsible user for this case in order to use this action!')) return { 'to': case.email_from, 'subject': case.name, 'cc': case.email_cc or '' }
| 471,053
|
def default_iban_check(iban_cn): return iban_cn[0] in string.ascii_lowercase and iban_cn[1] in string.ascii_lowercase
|
def default_iban_check(iban_cn): return iban_cn[0] in string.ascii_lowercase and iban_cn[1] in string.ascii_lowercase
| 471,054
|
def write(self, cr, user, ids, vals, context=None): readonly = None for field in vals.copy(): fobj = None if field in self._columns: fobj = self._columns[field] else: fobj = self._inherit_fields[field][2] if not fobj: continue groups = fobj.write
|
def write(self, cr, user, ids, vals, context=None): readonly = None for field in vals.copy(): fobj = None if field in self._columns: fobj = self._columns[field] else: fobj = self._inherit_fields[field][2] if not fobj: continue groups = fobj.write
| 471,055
|
def _query_get(self, cr, uid, obj='l', context={}): fiscalyear_obj = self.pool.get('account.fiscalyear') fiscalperiod_obj = self.pool.get('account.period') fiscalyear_ids = [] fiscalperiod_ids = [] initial_bal = context.get('initial_bal', False) company_clause = "" if context.get('company_id', False): company_clause = " AND " +obj+".company_id = %s" % context.get('company_id', False) if not context.get('fiscalyear', False): fiscalyear_ids = fiscalyear_obj.search(cr, uid, [('state', '=', 'draft')]) else: if initial_bal: fiscalyear_date_start = fiscalyear_obj.read(cr, uid, context['fiscalyear'], ['date_start'])['date_start'] fiscalyear_ids = fiscalyear_obj.search(cr, uid, [('date_stop', '<', fiscalyear_date_start), ('state', '=', 'draft')], context=context) else: fiscalyear_ids = [context['fiscalyear']]
|
def _query_get(self, cr, uid, obj='l', context={}): fiscalyear_obj = self.pool.get('account.fiscalyear') fiscalperiod_obj = self.pool.get('account.period') fiscalyear_ids = [] fiscalperiod_ids = [] initial_bal = context.get('initial_bal', False) company_clause = "" if context.get('company_id', False): company_clause = " AND " +obj+".company_id = %s" % context.get('company_id', False) if not context.get('fiscalyear', False): fiscalyear_ids = fiscalyear_obj.search(cr, uid, [('state', '=', 'draft')]) else: if initial_bal: fiscalyear_date_start = fiscalyear_obj.read(cr, uid, context['fiscalyear'], ['date_start'])['date_start'] fiscalyear_ids = fiscalyear_obj.search(cr, uid, [('date_stop', '<', fiscalyear_date_start), ('state', '=', 'draft')], context=context) else: fiscalyear_ids = [context['fiscalyear']]
| 471,056
|
def _query_get(self, cr, uid, obj='l', context={}): fiscalyear_obj = self.pool.get('account.fiscalyear') fiscalperiod_obj = self.pool.get('account.period') fiscalyear_ids = [] fiscalperiod_ids = [] initial_bal = context.get('initial_bal', False) company_clause = "" if context.get('company_id', False): company_clause = " AND " +obj+".company_id = %s" % context.get('company_id', False) if not context.get('fiscalyear', False): fiscalyear_ids = fiscalyear_obj.search(cr, uid, [('state', '=', 'draft')]) else: if initial_bal: fiscalyear_date_start = fiscalyear_obj.read(cr, uid, context['fiscalyear'], ['date_start'])['date_start'] fiscalyear_ids = fiscalyear_obj.search(cr, uid, [('date_stop', '<', fiscalyear_date_start), ('state', '=', 'draft')], context=context) else: fiscalyear_ids = [context['fiscalyear']]
|
def _query_get(self, cr, uid, obj='l', context={}): fiscalyear_obj = self.pool.get('account.fiscalyear') fiscalperiod_obj = self.pool.get('account.period') fiscalyear_ids = [] fiscalperiod_ids = [] initial_bal = context.get('initial_bal', False) company_clause = "" if context.get('company_id', False): company_clause = " AND " +obj+".company_id = %s" % context.get('company_id', False) if not context.get('fiscalyear', False): fiscalyear_ids = fiscalyear_obj.search(cr, uid, [('state', '=', 'draft')]) else: if initial_bal: fiscalyear_date_start = fiscalyear_obj.read(cr, uid, context['fiscalyear'], ['date_start'])['date_start'] fiscalyear_ids = fiscalyear_obj.search(cr, uid, [('date_stop', '<', fiscalyear_date_start), ('state', '=', 'draft')], context=context) else: fiscalyear_ids = [context['fiscalyear']]
| 471,057
|
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')
| 471,058
|
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')
| 471,059
|
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')
|
deffields_view_get(self,cr,uid,view_id=None,view_type='form',context={},toolbar=False,submenu=False):journal_pool=self.pool.get('account.journal')
| 471,060
|
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')
|
defattrs.append('string="'+field_it[2]+'"') fields_view_get(self,attrs.append('string="'+field_it[2]+'"') cr,attrs.append('string="'+field_it[2]+'"') uid,attrs.append('string="'+field_it[2]+'"') view_id=None,attrs.append('string="'+field_it[2]+'"') view_type='form',attrs.append('string="'+field_it[2]+'"') context={},attrs.append('string="'+field_it[2]+'"') toolbar=False,attrs.append('string="'+field_it[2]+'"') submenu=False):attrs.append('string="'+field_it[2]+'"') journal_poolattrs.append('string="'+field_it[2]+'"') =attrs.append('string="'+field_it[2]+'"') self.pool.get('account.journal')
| 471,061
|
def __init__(self, obj, fields_id, string='unknown', limit=20, **args): args.update({'parent_field':fields_id}) _column.__init__(self, string=string, **args) self._obj = obj self._fields_id = fields_id self._limit = limit #one2many can't be used as condition for defaults assert(self.change_default != True)
|
def __init__(self, obj, fields_id, string='unknown', limit=None, **args): args.update({'parent_field':fields_id}) _column.__init__(self, string=string, **args) self._obj = obj self._fields_id = fields_id self._limit = limit #one2many can't be used as condition for defaults assert(self.change_default != True)
| 471,062
|
def view_header_get(self, cr, uid, view_id, view_type, context): res = super(res_partner, self).view_header_get(cr, uid, view_id, view_type, context) if res: return res if (not context.get('category_id', False)): return False return _('Partners: ')+self.pool.get('res.partner.category').browse(cr, uid, context['category_id'], context).name
|
def view_header_get(self, cr, uid, view_id, view_type, context): res = super(res_partner, self).view_header_get(cr, uid, view_id, view_type, context) if res: return res if (not context.get('category_id', False)): return False return _('Partners: ')+self.pool.get('res.partner.category').browse(cr, uid, context['category_id'], context).name
| 471,063
|
def _check_reference_type(self, cursor, user, ids): """Check the customer invoice reference type depending on the BVR reference type and the invoice partner bank type""" for invoice in self.browse(cursor, user, ids): if invoice.type in 'in_invoice': if invoice.partner_bank and \ invoice.partner_bank.state in \ ('bvrbank', 'bvrpost') and \ invoice.reference_type != 'bvr': return False return True
|
def _check_reference_type(self, cursor, user, ids): """Check the customer invoice reference type depending on the BVR reference type and the invoice partner bank type""" for invoice in self.browse(cursor, user, ids): if invoice.type in 'in_invoice': if invoice.partner_bank and \ invoice.partner_bank.state in \ ('bvrbank', 'bvrpost') and \ invoice.reference_type != 'bvr': return False return True
| 471,064
|
def onchange_partner_id(self, cr, uid, ids, type, partner_id, date_invoice=False, payment_term=False, partner_bank_id=False): """ Function that is call when the partner of the invoice is changed it will retriev and set the good bank partner bank""" res = super(account_invoice, self).onchange_partner_id( cr, uid, ids, type, partner_id, date_invoice, payment_term ) bank_id = False if partner_id: p = self.pool.get('res.partner').browse(cr, uid, partner_id) if p.bank_ids: bank_id = p.bank_ids[0].id
|
def onchange_partner_id(self, cr, uid, ids, type, partner_id, date_invoice=False, payment_term=False, partner_bank_id=False, company_id=False): """ Function that is call when the partner of the invoice is changed it will retriev and set the good bank partner bank""" res = super(account_invoice, self).onchange_partner_id( cr, uid, ids, type, partner_id, date_invoice, payment_term ) bank_id = False if partner_id: p = self.pool.get('res.partner').browse(cr, uid, partner_id) if p.bank_ids: bank_id = p.bank_ids[0].id
| 471,065
|
def _check_xml(self, cr, uid, ids, context={}): for view in self.browse(cr, uid, ids, context): eview = etree.fromstring(view.arch.encode('utf8')) frng = tools.file_open(os.path.join('base','rng','view.rng')) relaxng_doc = etree.parse(frng) relaxng = etree.RelaxNG(relaxng_doc) if not relaxng.validate(eview): logger = netsvc.Logger() logger.notifyChannel('init', netsvc.LOG_ERROR, 'The view does not fit the required schema !') logger.notifyChannel('init', netsvc.LOG_ERROR, tools.ustr(relaxng.error_log.last_error)) return False return True
|
def _check_xml(self, cr, uid, ids, context={}): for view in self.browse(cr, uid, ids, context): eview = etree.fromstring(view.arch.encode('utf8')) frng = tools.file_open(os.path.join('base','rng','view.rng')) relaxng_doc = etree.parse(frng) relaxng = etree.RelaxNG(relaxng_doc) if not relaxng.validate(eview): logger = netsvc.Logger() logger.notifyChannel('init', netsvc.LOG_ERROR, 'The view does not fit the required schema !') logger.notifyChannel('init', netsvc.LOG_ERROR, tools.ustr(relaxng.error_log.last_error)) return False return True
| 471,066
|
def product_uom_change(self, cursor, user, ids, pricelist, product, qty=0, uom=False, qty_uos=0, uos=False, name='', partner_id=False, lang=False, update_tax=True, date_order=False): res = self.product_id_change(cursor, user, ids, pricelist, product, qty=0, uom=uom, qty_uos=qty_uos, uos=uos, name=name, partner_id=partner_id, lang=lang, update_tax=update_tax, date_order=date_order) if 'product_uom' in res['value']: del res['value']['product_uom'] if not uom: res['value']['price_unit'] = 0.0 return res
|
def product_uom_change(self, cursor, user, ids, pricelist, product, qty=0, uom=False, qty_uos=0, uos=False, name='', partner_id=False, lang=False, update_tax=True, date_order=False): res = self.product_id_change(cursor, user, ids, pricelist, product, qty=qty, uom=uom, qty_uos=qty_uos, uos=uos, name=name, partner_id=partner_id, lang=lang, update_tax=update_tax, date_order=date_order) if 'product_uom' in res['value']: del res['value']['product_uom'] if not uom: res['value']['price_unit'] = 0.0 return res
| 471,067
|
def _amount_line(self, cr, uid, ids, field_name, arg, context=None): tax_obj = self.pool.get('account.tax') cur_obj = self.pool.get('res.currency') res = {} context = context or {} for line in self.browse(cr, uid, ids, context=context): price = line.price_unit * line.product_uom_qty * (1 - (line.discount or 0.0) / 100.0) taxes = tax_obj.compute_all(cr, uid, line.tax_id, line.price_unit, line.product_uom_qty) cur = line.order_id.pricelist_id.currency_id res[line.id] = cur_obj.round(cr, uid, cur, taxes['total']) return res
|
def _amount_line(self, cr, uid, ids, field_name, arg, context=None): tax_obj = self.pool.get('account.tax') cur_obj = self.pool.get('res.currency') res = {} context = context or {} for line in self.browse(cr, uid, ids, context=context): price = line.price_unit * (1 - (line.discount or 0.0) / 100.0) taxes = tax_obj.compute_all(cr, uid, line.tax_id, price, line.product_uom_qty, line.order_id.partner_invoice_id.id, line.product_id, line.order_id.partner_id) cur = line.order_id.pricelist_id.currency_id res[line.id] = cur_obj.round(cr, uid, cur, taxes['total']) return res
| 471,068
|
def create_stock_periods(self, cr, uid, ids, context=None): interval = context.get('interval',0) name = context.get('name','Daily') period_obj = self.pool.get('stock.period') lines = [] for p in self.browse(cr, uid, ids, context=context): dt = p.date_start ds = mx.DateTime.strptime(p.date_start, '%Y-%m-%d') while ds.strftime('%Y-%m-%d') < p.date_stop: if name =='Daily': de = ds + RelativeDateTime(days=interval, minutes =-1) new_name = de.strftime('%Y-%m-%d') ds = ds + RelativeDateTime(days=interval) + 1 if name =="Weekly": de = ds + RelativeDateTime(days=interval, minutes =-1) new_name = de.strftime('%Y, week %W') ds = ds + RelativeDateTime(days=interval) + 1 if name == "Monthly": de = ds + RelativeDateTime(months=interval, minutes=-1) new_name = ds.strftime('%Y/%m') ds = ds + RelativeDateTime(months=interval) lines.append(period_obj.create(cr, uid, { 'name': new_name, 'date_start': ds.strftime('%Y-%m-%d'), 'date_stop': de.strftime('%Y-%m-%d %H:%M:%S'), })) return { 'domain': "[('id','in', ["+','.join(map(str, lines))+"])]", 'view_type': 'form', "view_mode": 'tree, form', 'res_model': 'stock.period', 'type': 'ir.actions.act_window', }
|
def create_stock_periods(self, cr, uid, ids, context=None): interval = context.get('interval',0) name = context.get('name','Daily') period_obj = self.pool.get('stock.period') lines = [] for p in self.browse(cr, uid, ids, context=context): dt = p.date_start ds = mx.DateTime.strptime(p.date_start, '%Y-%m-%d') while ds.strftime('%Y-%m-%d') < p.date_stop: if name =='Daily': de = ds + RelativeDateTime(days=interval, minutes =-1) new_name = de.strftime('%Y-%m-%d') new_id = period_obj.create(cr, uid, { 'name': new_name, 'date_start': ds.strftime('%Y-%m-%d'), 'date_stop': de.strftime('%Y-%m-%d %H:%M:%S'), }) ds = ds + RelativeDateTime(days=interval) if name =="Weekly": de = ds + RelativeDateTime(days=interval, minutes =-1) new_name = de.strftime('%Y, week %W') new_id = period_obj.create(cr, uid, { 'name': new_name, 'date_start': ds.strftime('%Y-%m-%d'), 'date_stop': de.strftime('%Y-%m-%d %H:%M:%S'), }) ds = ds + RelativeDateTime(days=interval) if name == "Monthly": de = ds + RelativeDateTime(months=interval, minutes=-1) new_name = ds.strftime('%Y/%m') ds = ds + RelativeDateTime(months=interval) lines.append(period_obj.create(cr, uid, { 'name': new_name, 'date_start': ds.strftime('%Y-%m-%d'), 'date_stop': de.strftime('%Y-%m-%d %H:%M:%S'), })) return { 'domain': "[('id','in', ["+','.join(map(str, lines))+"])]", 'view_type': 'form', "view_mode": 'tree, form', 'res_model': 'stock.period', 'type': 'ir.actions.act_window', }
| 471,069
|
def create_stock_periods(self, cr, uid, ids, context=None): interval = context.get('interval',0) name = context.get('name','Daily') period_obj = self.pool.get('stock.period') lines = [] for p in self.browse(cr, uid, ids, context=context): dt = p.date_start ds = mx.DateTime.strptime(p.date_start, '%Y-%m-%d') while ds.strftime('%Y-%m-%d') < p.date_stop: if name =='Daily': de = ds + RelativeDateTime(days=interval, minutes =-1) new_name = de.strftime('%Y-%m-%d') ds = ds + RelativeDateTime(days=interval) + 1 if name =="Weekly": de = ds + RelativeDateTime(days=interval, minutes =-1) new_name = de.strftime('%Y, week %W') ds = ds + RelativeDateTime(days=interval) + 1 if name == "Monthly": de = ds + RelativeDateTime(months=interval, minutes=-1) new_name = ds.strftime('%Y/%m') ds = ds + RelativeDateTime(months=interval) lines.append(period_obj.create(cr, uid, { 'name': new_name, 'date_start': ds.strftime('%Y-%m-%d'), 'date_stop': de.strftime('%Y-%m-%d %H:%M:%S'), })) return { 'domain': "[('id','in', ["+','.join(map(str, lines))+"])]", 'view_type': 'form', "view_mode": 'tree, form', 'res_model': 'stock.period', 'type': 'ir.actions.act_window', }
|
def create_stock_periods(self, cr, uid, ids, context=None): interval = context.get('interval',0) name = context.get('name','Daily') period_obj = self.pool.get('stock.period') lines = [] for p in self.browse(cr, uid, ids, context=context): dt = p.date_start ds = mx.DateTime.strptime(p.date_start, '%Y-%m-%d') while ds.strftime('%Y-%m-%d') < p.date_stop: if name =='Daily': de = ds + RelativeDateTime(days=interval, minutes =-1) new_name = de.strftime('%Y-%m-%d') new_id = period_obj.create(cr, uid, { 'name': new_name, 'date_start': ds.strftime('%Y-%m-%d'), 'date_stop': de.strftime('%Y-%m-%d %H:%M:%S'), }) ds = ds + RelativeDateTime(days=interval) if name =="Weekly": de = ds + RelativeDateTime(days=interval, minutes =-1) new_name = de.strftime('%Y, week %W') new_id = period_obj.create(cr, uid, { 'name': new_name, 'date_start': ds.strftime('%Y-%m-%d'), 'date_stop': de.strftime('%Y-%m-%d %H:%M:%S'), }) ds = ds + RelativeDateTime(days=interval) if name == "Monthly": de = ds + RelativeDateTime(months=interval, minutes=-1) new_name = ds.strftime('%Y/%m') ds = ds + RelativeDateTime(months=interval) lines.append(period_obj.create(cr, uid, { 'name': new_name, 'date_start': ds.strftime('%Y-%m-%d'), 'date_stop': de.strftime('%Y-%m-%d %H:%M:%S'), })) return { 'domain': "[('id','in', ["+','.join(map(str, lines))+"])]", 'view_type': 'form', "view_mode": 'tree, form', 'res_model': 'stock.period', 'type': 'ir.actions.act_window', }
| 471,070
|
def create_stock_periods(self, cr, uid, ids, context=None): interval = context.get('interval',0) name = context.get('name','Daily') period_obj = self.pool.get('stock.period') lines = [] for p in self.browse(cr, uid, ids, context=context): dt = p.date_start ds = mx.DateTime.strptime(p.date_start, '%Y-%m-%d') while ds.strftime('%Y-%m-%d') < p.date_stop: if name =='Daily': de = ds + RelativeDateTime(days=interval, minutes =-1) new_name = de.strftime('%Y-%m-%d') ds = ds + RelativeDateTime(days=interval) + 1 if name =="Weekly": de = ds + RelativeDateTime(days=interval, minutes =-1) new_name = de.strftime('%Y, week %W') ds = ds + RelativeDateTime(days=interval) + 1 if name == "Monthly": de = ds + RelativeDateTime(months=interval, minutes=-1) new_name = ds.strftime('%Y/%m') ds = ds + RelativeDateTime(months=interval) lines.append(period_obj.create(cr, uid, { 'name': new_name, 'date_start': ds.strftime('%Y-%m-%d'), 'date_stop': de.strftime('%Y-%m-%d %H:%M:%S'), })) return { 'domain': "[('id','in', ["+','.join(map(str, lines))+"])]", 'view_type': 'form', "view_mode": 'tree, form', 'res_model': 'stock.period', 'type': 'ir.actions.act_window', }
|
def create_stock_periods(self, cr, uid, ids, context=None): interval = context.get('interval',0) name = context.get('name','Daily') period_obj = self.pool.get('stock.period') lines = [] for p in self.browse(cr, uid, ids, context=context): dt = p.date_start ds = mx.DateTime.strptime(p.date_start, '%Y-%m-%d') while ds.strftime('%Y-%m-%d') < p.date_stop: if name =='Daily': de = ds + RelativeDateTime(days=interval, minutes =-1) new_name = de.strftime('%Y-%m-%d') ds = ds + RelativeDateTime(days=interval) + 1 if name =="Weekly": de = ds + RelativeDateTime(days=interval, minutes =-1) new_name = de.strftime('%Y, week %W') ds = ds + RelativeDateTime(days=interval) + 1 if name == "Monthly": de = ds + RelativeDateTime(months=interval, minutes=-1) new_name = ds.strftime('%Y/%m') new_id =period_obj.create(cr, uid, { 'name': new_name, 'date_start': ds.strftime('%Y-%m-%d'), 'date_stop': de.strftime('%Y-%m-%d %H:%M:%S'), })) return { 'domain': "[('id','in', ["+','.join(map(str, lines))+"])]", 'view_type': 'form', "view_mode": 'tree, form', 'res_model': 'stock.period', 'type': 'ir.actions.act_window', }
| 471,071
|
def create_stock_periods(self, cr, uid, ids, context=None): interval = context.get('interval',0) name = context.get('name','Daily') period_obj = self.pool.get('stock.period') lines = [] for p in self.browse(cr, uid, ids, context=context): dt = p.date_start ds = mx.DateTime.strptime(p.date_start, '%Y-%m-%d') while ds.strftime('%Y-%m-%d') < p.date_stop: if name =='Daily': de = ds + RelativeDateTime(days=interval, minutes =-1) new_name = de.strftime('%Y-%m-%d') ds = ds + RelativeDateTime(days=interval) + 1 if name =="Weekly": de = ds + RelativeDateTime(days=interval, minutes =-1) new_name = de.strftime('%Y, week %W') ds = ds + RelativeDateTime(days=interval) + 1 if name == "Monthly": de = ds + RelativeDateTime(months=interval, minutes=-1) new_name = ds.strftime('%Y/%m') ds = ds + RelativeDateTime(months=interval) lines.append(period_obj.create(cr, uid, { 'name': new_name, 'date_start': ds.strftime('%Y-%m-%d'), 'date_stop': de.strftime('%Y-%m-%d %H:%M:%S'), })) return { 'domain': "[('id','in', ["+','.join(map(str, lines))+"])]", 'view_type': 'form', "view_mode": 'tree, form', 'res_model': 'stock.period', 'type': 'ir.actions.act_window', }
|
def create_stock_periods(self, cr, uid, ids, context=None): interval = context.get('interval',0) name = context.get('name','Daily') period_obj = self.pool.get('stock.period') lines = [] for p in self.browse(cr, uid, ids, context=context): dt = p.date_start ds = mx.DateTime.strptime(p.date_start, '%Y-%m-%d') while ds.strftime('%Y-%m-%d') < p.date_stop: if name =='Daily': de = ds + RelativeDateTime(days=interval, minutes =-1) new_name = de.strftime('%Y-%m-%d') ds = ds + RelativeDateTime(days=interval) + 1 if name =="Weekly": de = ds + RelativeDateTime(days=interval, minutes =-1) new_name = de.strftime('%Y, week %W') ds = ds + RelativeDateTime(days=interval) + 1 if name == "Monthly": de = ds + RelativeDateTime(months=interval, minutes=-1) new_name = ds.strftime('%Y/%m') ds = ds + RelativeDateTime(months=interval) lines.append(period_obj.create(cr, uid, { 'name': new_name, 'date_start': ds.strftime('%Y-%m-%d'), 'date_stop': de.strftime('%Y-%m-%d %H:%M:%S'), }) ds = ds + RelativeDateTime(months=interval) lines.append(new_id) return { 'domain': "[('id','in', ["+','.join(map(str, lines))+"])]", 'view_type': 'form', "view_mode": 'tree, form', 'res_model': 'stock.period', 'type': 'ir.actions.act_window', }
| 471,072
|
def _default_get(self, cr, uid, fields, context={}): # Compute simple values data = super(account_move_line, self).default_get(cr, uid, fields, context) # Starts: Manual entry from account.move form if context.get('lines',[]):
|
def _default_get(self, cr, uid, fields, context={}): # Compute simple values data = super(account_move_line, self).default_get(cr, uid, fields, context) # Starts: Manual entry from account.move form if context.get('lines',[]):
| 471,073
|
def _default_get(self, cr, uid, fields, context={}): # Compute simple values data = super(account_move_line, self).default_get(cr, uid, fields, context) # Starts: Manual entry from account.move form if context.get('lines',[]):
|
def _default_get(self, cr, uid, fields, context={}): # Compute simple values data = super(account_move_line, self).default_get(cr, uid, fields, context) # Starts: Manual entry from account.move form if context.get('lines',[]):
| 471,074
|
def _default_get(self, cr, uid, fields, context={}): # Compute simple values data = super(account_move_line, self).default_get(cr, uid, fields, context) # Starts: Manual entry from account.move form if context.get('lines',[]):
|
def_default_get(self,cr,uid,fields,context={}):#Computesimplevaluesdata=super(account_move_line,self).default_get(cr,uid,fields,context)#Starts:Manualentryfromaccount.moveformifcontext.get('lines',[]):
| 471,075
|
def onchange_partner_id(self, cr, uid, ids, move_id, partner_id, account_id=None, debit=0, credit=0, date=False, journal=False): val = {} val['date_maturity'] = False
|
def onchange_partner_id(self, cr, uid, ids, move_id, partner_id, account_id=None, debit=0, credit=0, date=False, journal=False): val = {} val['date_maturity'] = False
| 471,076
|
def onchange_partner_id(self, cr, uid, ids, move_id, partner_id, account_id=None, debit=0, credit=0, date=False, journal=False): val = {} val['date_maturity'] = False
|
def onchange_partner_id(self, cr, uid, ids, move_id, partner_id, account_id=None, debit=0, credit=0, date=False, journal=False): val = {} val['date_maturity'] = False
| 471,077
|
def onchange_partner_id(self, cr, uid, ids, move_id, partner_id, account_id=None, debit=0, credit=0, date=False, journal=False): val = {} val['date_maturity'] = False
|
def onchange_partner_id(self, cr, uid, ids, move_id, partner_id, account_id=None, debit=0, credit=0, date=False, journal=False): val = {} val['date_maturity'] = False
| 471,078
|
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context={}, toolbar=False, submenu=False): result = super(osv.osv, self).fields_view_get(cr, uid, view_id,view_type,context,toolbar=toolbar, submenu=submenu) if view_type != 'tree': return result
|
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context={}, toolbar=False, submenu=False): result = super(osv.osv, self).fields_view_get(cr, uid, view_id,view_type,context,toolbar=toolbar, submenu=submenu) if view_type != 'tree': return result
| 471,079
|
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context={}, toolbar=False, submenu=False): result = super(osv.osv, self).fields_view_get(cr, uid, view_id,view_type,context,toolbar=toolbar, submenu=submenu) if view_type != 'tree': return result
|
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context={}, toolbar=False, submenu=False): result = super(osv.osv, self).fields_view_get(cr, uid, view_id,view_type,context,toolbar=toolbar, submenu=submenu) if view_type != 'tree': return result
| 471,080
|
def do_action(self, cr, uid, action, model_obj, obj, context=None): """ Do Action @param self: The object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param action: pass action @param model_obj: pass Model object @param context: A standard dictionary for contextual values """ if context is None: context = {}
|
def do_action(self, cr, uid, action, model_obj, obj, context=None): """ Do Action @param self: The object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param action: pass action @param model_obj: pass Model object @param context: A standard dictionary for contextual values """ if context is None: context = {}
| 471,081
|
def name_get(self, cr, uid, ids, context=None): if context is None: context = {}
|
def name_get(self, cr, uid, ids, context=None): if context is None: context = {}
| 471,082
|
def default_get(self, cr, uid, fields, context): """ To get default values for the object. @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param fields: List of fields for which we want default values @param context: A standard dictionary @return: A dictionary which of fields with values. """ res = super(stock_return_picking, self).default_get(cr, uid, fields, context=context) record_id = context and context.get('active_id', False) or False pick_obj = self.pool.get('stock.picking') pick = pick_obj.browse(cr, uid, record_id) for m in [line for line in pick.move_lines]: res['return%s'%(m.id)] = m.product_qty if pick.invoice_state=='invoiced': res['invoice_state'] = '2binvoiced' else: res['invoice_state'] = 'none' return res
|
def default_get(self, cr, uid, fields, context): """ To get default values for the object. @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param fields: List of fields for which we want default values @param context: A standard dictionary @return: A dictionary which of fields with values. """ res = super(stock_return_picking, self).default_get(cr, uid, fields, context=context) record_id = context and context.get('active_id', False) or False pick_obj = self.pool.get('stock.picking') pick = pick_obj.browse(cr, uid, record_id) for m in [line for line in pick.move_lines]: res['return%s'%(m.id)] = m.product_qty if pick.invoice_state=='invoiced': res['invoice_state'] = '2binvoiced' else: res['invoice_state'] = 'none' return res
| 471,083
|
def default_get(self, cr, uid, fields, context): """ To get default values for the object. @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param fields: List of fields for which we want default values @param context: A standard dictionary @return: A dictionary which of fields with values. """ res = super(stock_return_picking, self).default_get(cr, uid, fields, context=context) record_id = context and context.get('active_id', False) or False pick_obj = self.pool.get('stock.picking') pick = pick_obj.browse(cr, uid, record_id) for m in [line for line in pick.move_lines]: res['return%s'%(m.id)] = m.product_qty if pick.invoice_state=='invoiced': res['invoice_state'] = '2binvoiced' else: res['invoice_state'] = 'none' return res
|
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 with default values for all field in ``fields`` """ res = super(stock_return_picking, self).default_get(cr, uid, fields, context=context) record_id = context and context.get('active_id', False) or False pick_obj = self.pool.get('stock.picking') pick = pick_obj.browse(cr, uid, record_id) for m in [line for line in pick.move_lines]: res['return%s'%(m.id)] = m.product_qty if pick.invoice_state=='invoiced': res['invoice_state'] = '2binvoiced' else: res['invoice_state'] = 'none' return res
| 471,084
|
def default_get(self, cr, uid, fields, context): """ To get default values for the object. @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param fields: List of fields for which we want default values @param context: A standard dictionary @return: A dictionary which of fields with values. """ res = super(stock_return_picking, self).default_get(cr, uid, fields, context=context) record_id = context and context.get('active_id', False) or False pick_obj = self.pool.get('stock.picking') pick = pick_obj.browse(cr, uid, record_id) for m in [line for line in pick.move_lines]: res['return%s'%(m.id)] = m.product_qty if pick.invoice_state=='invoiced': res['invoice_state'] = '2binvoiced' else: res['invoice_state'] = 'none' return res
|
def default_get(self, cr, uid, fields, context): """ To get default values for the object. @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param fields: List of fields for which we want default values @param context: A standard dictionary @return: A dictionary which of fields with values. """ res = super(stock_return_picking, self).default_get(cr, uid, fields, context=context) record_id = context and context.get('active_id', False) or False pick_obj = self.pool.get('stock.picking') pick = pick_obj.browse(cr, uid, record_id) if pick: if 'invoice_state' in fields: if pick.invoice_state=='invoiced': res['invoice_state'] = '2binvoiced' else: res['invoice_state'] = 'none' for line in pick.move_lines: return_id = 'return%s'%(line.id) if return_id in fields: res[return_id] = line.product_qty return res
| 471,085
|
def default_get(self, cr, uid, fields, context): """ To get default values for the object. @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param fields: List of fields for which we want default values @param context: A standard dictionary @return: A dictionary which of fields with values. """ res = super(stock_return_picking, self).default_get(cr, uid, fields, context=context) record_id = context and context.get('active_id', False) or False pick_obj = self.pool.get('stock.picking') pick = pick_obj.browse(cr, uid, record_id) for m in [line for line in pick.move_lines]: res['return%s'%(m.id)] = m.product_qty if pick.invoice_state=='invoiced': res['invoice_state'] = '2binvoiced' else: res['invoice_state'] = 'none' return res
|
def default_get(self, cr, uid, fields, context): """ To get default values for the object. @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param fields: List of fields for which we want default values @param context: A standard dictionary @return: A dictionary which of fields with values. """ res = super(stock_return_picking, self).default_get(cr, uid, fields, context=context) record_id = context and context.get('active_id', False) or False pick_obj = self.pool.get('stock.picking') pick = pick_obj.browse(cr, uid, record_id) for m in [line for line in pick.move_lines]: res['return%s'%(m.id)] = m.product_qty if pick.invoice_state=='invoiced': res['invoice_state'] = '2binvoiced' else: res['invoice_state'] = 'none' return res
| 471,086
|
def validate(self, cr, uid, ids, context={}): if context and ('__last_update' in context): del context['__last_update'] ok = True for move in self.browse(cr, uid, ids, context): #unlink analytic lines on move_lines for obj_line in move.line_id: for obj in obj_line.analytic_lines: self.pool.get('account.analytic.line').unlink(cr,uid,obj.id)
|
def validate(self, cr, uid, ids, context={}): if context and ('__last_update' in context): del context['__last_update'] ok = True for move in self.browse(cr, uid, ids, context): #unlink analytic lines on move_lines for obj_line in move.line_id: for obj in obj_line.analytic_lines: self.pool.get('account.analytic.line').unlink(cr,uid,obj.id)
| 471,087
|
def button_send_to_master(self, cr, uid, ids, context=None): if context is None: context = {} meeting_id = self.browse(cr, uid, ids)[0] user = self.pool.get('res.users').browse(cr, uid, uid, context=context) if meeting_id and meeting_id.sprint_id.scrum_master_id.user_email: self.email_send(cr, uid, ids, meeting_id.sprint_id.scrum_master_id.user_email) else: raise osv.except_osv(_('Error !'), _('Please provide email address for scrum master defined on sprint.')) return True
|
def button_send_to_master(self, cr, uid, ids, context=None): if context is None: context = {} meeting_id = self.browse(cr, uid, ids)[0] user = self.pool.get('res.users').browse(cr, uid, uid, context=context) if meeting_id and meeting_id.sprint_id.scrum_master_id.user_email: res = self.email_send(cr, uid, ids, meeting_id.sprint_id.scrum_master_id.user_email) if not res: raise osv.except_osv(_('Error !'), _(' Email Not send to the scrum master %s!' % meeting_id.sprint_id.scrum_master_id.name)) else: raise osv.except_osv(_('Error !'), _('Please provide email address for scrum master defined on sprint.')) return True
| 471,088
|
def button_send_product_owner(self, cr, uid, ids, context=None): if context is None: context = {} context.update({'button_send_product_owner': True}) meeting_id = self.browse(cr, uid, ids)[0] if meeting_id.sprint_id.product_owner_id.user_email: self.email_send(cr,uid,ids,meeting_id.sprint_id.product_owner_id.user_email) else: raise osv.except_osv(_('Error !'), _('Please provide email address for product owner defined on sprint.')) return True
|
def button_send_product_owner(self, cr, uid, ids, context=None): if context is None: context = {} context.update({'button_send_product_owner': True}) meeting_id = self.browse(cr, uid, ids)[0] if meeting_id.sprint_id.product_owner_id.user_email: res = self.email_send(cr,uid,ids,meeting_id.sprint_id.product_owner_id.user_email) if not res: raise osv.except_osv(_('Error !'), _(' Email Not send to the product owner %s!' % meeting_id.sprint_id.product_owner_id.name)) else: raise osv.except_osv(_('Error !'), _('Please provide email address for product owner defined on sprint.')) return True
| 471,089
|
def email_send(self, cr, uid, ids, email, context=None): if context is None: context = {} email_from = tools.config.get('email_from', False) meeting_id = self.browse(cr,uid,ids)[0] user = self.pool.get('res.users').browse(cr, uid, uid, context=context) user_email = email_from or user.address_id.email or email_from body = "Hello " + meeting_id.sprint_id.scrum_master_id.name+",\n" +" \nI am sending you Daily Meeting Details of date %s for the Sprint %s \n" % (meeting_id.date, meeting_id.sprint_id.name) body += '\n*Tasks since yesterday: \n_______________________%s' % (meeting_id.question_yesterday) + '\n*Task for Today :\n_______________________ %s\n' % (meeting_id.question_today )+ '\n*Blocks encountered: \n_______________________ %s' % (meeting_id.question_blocks or 'No Blocks') body += "\n\nThank you,\n"+ user.name sub_name = meeting_id.name or 'Scrum Meeting of %s '%meeting_id.date flag = tools.email_send(user_email , [email], sub_name, body, reply_to=None, openobject_id=str(meeting_id.id)) if not flag: if context.get('button_send_product_owner', False): raise osv.except_osv(_('Error !'), _(' Email Not send to the product owner %s!' % meeting_id.sprint_id.product_owner_id.name)) raise osv.except_osv(_('Error !'), _(' Email Not send to the scrum master %s!' % meeting_id.sprint_id.scrum_master_id.name)) if context.get('button_send_product_owner', False): raise osv.except_osv(_('Information !'), _(' Email send successfully to product owner %s!' % meeting_id.sprint_id.product_owner_id.name)) raise osv.except_osv(_('Information!'), _(' Email send successfully to scrum master %s!'% meeting_id.sprint_id.scrum_master_id.name)) return True
|
def email_send(self, cr, uid, ids, email, context=None): if context is None: context = {} email_from = tools.config.get('email_from', False) meeting_id = self.browse(cr,uid,ids)[0] user = self.pool.get('res.users').browse(cr, uid, uid, context=context) user_email = email_from or user.address_id.email or email_from body = "Hello " + meeting_id.sprint_id.scrum_master_id.name+",\n" +" \nI am sending you Daily Meeting Details of date %s for the Sprint %s \n" % (meeting_id.date, meeting_id.sprint_id.name) body += '\n*Tasks since yesterday: \n_______________________%s' % (meeting_id.question_yesterday) + '\n*Task for Today :\n_______________________ %s\n' % (meeting_id.question_today )+ '\n*Blocks encountered: \n_______________________ %s' % (meeting_id.question_blocks or 'No Blocks') body += "\n\nThank you,\n"+ user.name sub_name = meeting_id.name or 'Scrum Meeting of %s '%meeting_id.date flag = tools.email_send(user_email , [email], sub_name, body, reply_to=None, openobject_id=str(meeting_id.id)) if not flag: return False return True
| 471,090
|
def write(self, cr, user, ids, vals, context=None): """ Update records with given ids with the given field values
|
def write(self, cr, user, ids, vals, context=None): """ Update records with given ids with the given field values
| 471,091
|
def _invoiced_rate(self, cursor, user, ids, name, arg, context=None): res = {} for purchase in self.browse(cursor, user, ids, context=context): tot = 0.0 if purchase.invoice_id and purchase.invoice_id.state not in ('draft','cancel'): tot += purchase.invoice_id.amount_untaxed if purchase.amount_untaxed: res[purchase.id] = tot * 100.0 / purchase.amount_untaxed else: res[purchase.id] = 0.0 return res
|
def _invoiced_rate(self, cursor, user, ids, name, arg, context=None): res = {} for purchase in self.browse(cursor, user, ids, context=context): tot = 0.0 for invoice in purchase.invoice_ids: if invoice.state not in ('draft','cancel'): tot += invoice.amount_untaxed if purchase.amount_untaxed: res[purchase.id] = tot * 100.0 / purchase.amount_untaxed else: res[purchase.id] = 0.0 return res
| 471,092
|
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): invoiced = [] for invoice in purchase.invoice_ids: invoiced.append(invoice.reconciled) res[purchase.id] = invoiced return res
| 471,093
|
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
| 471,094
|
def action_invoice_create(self, cr, uid, ids, *args): res = False
|
def action_invoice_create(self, cr, uid, ids, *args): res = False
| 471,095
|
def action_cancel(self, cr, uid, ids, context={}): for purchase in self.browse(cr, uid, ids): for pick in purchase.picking_ids: if pick.state not in ('draft','cancel'): raise osv.except_osv( _('Could not cancel purchase order !'), _('You must first cancel all picking attached to this purchase order.')) for pick in purchase.picking_ids: wf_service = netsvc.LocalService("workflow") wf_service.trg_validate(uid, 'stock.picking', pick.id, 'button_cancel', cr) inv = purchase.invoice_id if inv and inv.state not in ('cancel','draft'): raise osv.except_osv( _('Could not cancel this purchase order !'), _('You must first cancel all invoices attached to this purchase order.')) if inv: wf_service = netsvc.LocalService("workflow") wf_service.trg_validate(uid, 'account.invoice', inv.id, 'invoice_cancel', cr) self.write(cr,uid,ids,{'state':'cancel'}) for (id,name) in self.name_get(cr, uid, ids): message = _("Purchase order '%s' is cancelled.") % name self.log(cr, uid, id, message) return True
|
def action_cancel(self, cr, uid, ids, context={}): for purchase in self.browse(cr, uid, ids): for pick in purchase.picking_ids: if pick.state not in ('draft','cancel'): raise osv.except_osv( _('Could not cancel purchase order !'), _('You must first cancel all picking attached to this purchase order.')) for pick in purchase.picking_ids: wf_service = netsvc.LocalService("workflow") wf_service.trg_validate(uid, 'stock.picking', pick.id, 'button_cancel', cr) for inv in purchase.invoice_ids: if inv and inv.state not in ('cancel','draft'): raise osv.except_osv( _('Could not cancel this purchase order !'), _('You must first cancel all invoices attached to this purchase order.')) if inv: wf_service = netsvc.LocalService("workflow") wf_service.trg_validate(uid, 'account.invoice', inv.id, 'invoice_cancel', cr) self.write(cr,uid,ids,{'state':'cancel'}) for (id,name) in self.name_get(cr, uid, ids): message = _("Purchase order '%s' is cancelled.") % name self.log(cr, uid, id, message) return True
| 471,096
|
def copy(self, cr, uid, id, default=None,context={}): if not default: default = {} default.update({ 'state':'draft', 'shipped':False, 'invoiced':False, 'invoice_id':False, 'picking_ids':[], 'name': self.pool.get('ir.sequence').get(cr, uid, 'purchase.order'), }) return super(purchase_order, self).copy(cr, uid, id, default, context)
|
def copy(self, cr, uid, id, default=None,context={}): if not default: default = {} default.update({ 'state':'draft', 'shipped':False, 'invoiced':False, 'invoice_ids':{}, 'picking_ids':[], 'name': self.pool.get('ir.sequence').get(cr, uid, 'purchase.order'), }) return super(purchase_order, self).copy(cr, uid, id, default, context)
| 471,097
|
def _calculate(self, cr, uid, ids, field_names, arg, context): res = {} allounce = 0.0 deduction = 0.0 net = 0.0 grows = 0.0 for register in self.browse(cr, uid, ids, context): for slip in register.line_ids: allounce += slip.allounce deduction += slip.deduction net += slip.net grows += slip.grows
|
def _calculate(self, cr, uid, ids, field_names, arg, context): res = {} allounce = 0.0 deduction = 0.0 net = 0.0 grows = 0.0 for register in self.browse(cr, uid, ids, context): for slip in register.line_ids: allounce += slip.allounce deduction += slip.deduction net += slip.net grows += slip.grows
| 471,098
|
def cancel_sheet(self, cr, uid, ids, context={}): self.write(cr, uid, ids, {'state':'cancel'}) return True
|
def cancel_sheet(self, cr, uid, ids, context={}): self.write(cr, uid, ids, {'state':'cancel'}) return True
| 471,099
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.