bugged
stringlengths
4
228k
fixed
stringlengths
0
96.3M
__index_level_0__
int64
0
481k
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
467,800
def action_move_line_create(self, cr, uid, ids, *args): for inv in self.browse(cr, uid, ids): if inv.move_id: continue company_currency = inv.company_id.currency_id.id
def action_move_line_create(self, cr, uid, ids, *args): for inv in self.browse(cr, uid, ids): if inv.move_id: continue company_currency = inv.company_id.currency_id.id
467,801
def default_get(self, cr, uid, fields, context={}): data = super(VoucherLine, self).default_get(cr, uid, fields, context) self.voucher_context = context return data
def default_get(self, cr, uid, fields, context={}): data = super(account_voucher_line, self).default_get(cr, uid, fields, context) self.voucher_context = context return data
467,802
def default_get(self, cr, uid, fields, context={}): data = super(VoucherLine, self).default_get(cr, uid, fields, context) self.voucher_context = context return data
defdefault_get(self,cr,uid,fields,context={}):data=super(VoucherLine,self).default_get(cr,uid,fields,context)self.voucher_context=contextreturndata
467,803
def move_line_get_item(self, cr, uid, line, context={}): res = super(VoucherLine, self).move_line_get_item(cr, uid, line, context) res['invoice'] = line.invoice_id or False return res
def move_line_get_item(self, cr, uid, line, context={}): res = super(account_voucher_line, self).move_line_get_item(cr, uid, line, context) res['invoice'] = line.invoice_id or False return res
467,804
def onchange_line_account(self, cr, uid, ids, account_id, type, type1): if not account_id: return {'value' : {'account_id' : False, 'type' : False ,'amount':False}} obj = self.pool.get('account.account') acc_id = False if type1 in ('rec_voucher','bank_rec_voucher', 'journal_voucher'): acc_id = obj.browse(cr, uid, account_id) balance = acc_id.credit type = 'cr' elif type1 in ('pay_voucher','bank_pay_voucher','cont_voucher') : acc_id = obj.browse(cr, uid, account_id) balance = acc_id.debit type = 'dr' elif type1 in ('journal_sale_vou') : acc_id = obj.browse(cr, uid, account_id) balance = acc_id.credit type = 'dr' elif type1 in ('journal_pur_voucher') : acc_id = obj.browse(cr, uid, account_id) balance = acc_id.debit type = 'cr'
def onchange_line_account(self, cr, uid, ids, account_id, type, type1): if not account_id: return {'value' : {'account_id' : False, 'type' : False ,'amount':False}} obj = self.pool.get('account.account') acc_id = False if type1 in ('rec_voucher','bank_rec_voucher', 'journal_voucher'): acc_id = obj.browse(cr, uid, account_id) balance = acc_id.credit type = 'cr' elif type1 in ('pay_voucher','bank_pay_voucher','cont_voucher') : acc_id = obj.browse(cr, uid, account_id) balance = acc_id.debit type = 'dr' elif type1 in ('journal_sale_vou') : acc_id = obj.browse(cr, uid, account_id) balance = acc_id.credit type = 'dr' elif type1 in ('journal_pur_voucher') : acc_id = obj.browse(cr, uid, account_id) balance = acc_id.debit type = 'cr'
467,805
def action_cancel(self, cr, uid, ids, *args): res = super(account_invoice, self).action_cancel(cr, uid, ids, *args) invoices = self.read(cr, uid, ids, ['move_id']) voucher_db = self.pool.get('account.voucher') voucher_ids = voucher_db.search(cr, uid, []) voucher_obj = voucher_db.browse(cr, uid, voucher_ids) move_db = self.pool.get('account.move') move_ids = move_db.search(cr, uid, []) move_obj = move_db.browse(cr, uid, move_ids) return res
defaction_cancel(self,cr,uid,ids,*args):res=super(account_invoice,self).action_cancel(cr,uid,ids,*args)invoices=self.read(cr,uid,ids,['move_id'])voucher_db=self.pool.get('account.voucher')voucher_ids=voucher_db.search(cr,uid,[])voucher_obj=voucher_db.browse(cr,uid,voucher_ids)move_db=self.pool.get('account.move')move_ids=move_db.search(cr,uid,[])move_obj=move_db.browse(cr,uid,move_ids)returnres
467,806
def action_cancel(self, cr, uid, ids, *args): res = super(account_invoice, self).action_cancel(cr, uid, ids, *args) invoices = self.read(cr, uid, ids, ['move_id']) voucher_db = self.pool.get('account.voucher') voucher_ids = voucher_db.search(cr, uid, []) voucher_obj = voucher_db.browse(cr, uid, voucher_ids) move_db = self.pool.get('account.move') move_ids = move_db.search(cr, uid, []) move_obj = move_db.browse(cr, uid, move_ids) return res
defaction_cancel(self,cr,uid,ids,*args):res=super(account_invoice,self).action_cancel(cr,uid,ids,*args)invoices=self.read(cr,uid,ids,['move_id'])voucher_db=self.pool.get('account.voucher')voucher_ids=voucher_db.search(cr,uid,[])voucher_obj=voucher_db.browse(cr,uid,voucher_ids)move_db=self.pool.get('account.move')move_ids=move_db.search(cr,uid,[])move_obj=move_db.browse(cr,uid,move_ids)returnres
467,807
def action_cancel(self, cr, uid, ids, *args): res = super(account_invoice, self).action_cancel(cr, uid, ids, *args) invoices = self.read(cr, uid, ids, ['move_id']) voucher_db = self.pool.get('account.voucher') voucher_ids = voucher_db.search(cr, uid, []) voucher_obj = voucher_db.browse(cr, uid, voucher_ids) move_db = self.pool.get('account.move') move_ids = move_db.search(cr, uid, []) move_obj = move_db.browse(cr, uid, move_ids) return res
defaction_cancel(self,cr,uid,ids,*args):res=super(account_invoice,self).action_cancel(cr,uid,ids,*args)invoices=self.read(cr,uid,ids,['move_id'])voucher_db=self.pool.get('account.voucher')voucher_ids=voucher_db.search(cr,uid,[])voucher_obj=voucher_db.browse(cr,uid,voucher_ids)move_db=self.pool.get('account.move')move_ids=move_db.search(cr,uid,[])move_obj=move_db.browse(cr,uid,move_ids)returnres
467,808
def write(self, cr, uid, ids,vals,context=None): if context is None: context = {} if (vals.has_key('project_id') and vals['project_id']) or (vals.has_key('name') and vals['name']): vals_line = {} hr_anlytic_timesheet = self.pool.get('hr.analytic.timesheet') task_obj_l = self.browse(cr, uid, ids, context) if (vals.has_key('project_id') and vals['project_id']): project_obj = self.pool.get('project.project').browse(cr, uid, vals['project_id']) acc_id = project_obj.analytic_account_id.id
def write(self, cr, uid, ids,vals,context=None): if context is None: context = {} if vals.get('project_id',False) or vals.get('name',False): vals_line = {} hr_anlytic_timesheet = self.pool.get('hr.analytic.timesheet') task_obj_l = self.browse(cr, uid, ids, context) if (vals.has_key('project_id') and vals['project_id']): project_obj = self.pool.get('project.project').browse(cr, uid, vals['project_id']) acc_id = project_obj.analytic_account_id.id
467,809
def write(self, cr, uid, ids,vals,context=None): if context is None: context = {} if (vals.has_key('project_id') and vals['project_id']) or (vals.has_key('name') and vals['name']): vals_line = {} hr_anlytic_timesheet = self.pool.get('hr.analytic.timesheet') task_obj_l = self.browse(cr, uid, ids, context) if (vals.has_key('project_id') and vals['project_id']): project_obj = self.pool.get('project.project').browse(cr, uid, vals['project_id']) acc_id = project_obj.analytic_account_id.id
def write(self, cr, uid, ids,vals,context=None): if context is None: context = {} if (vals.has_key('project_id') and vals['project_id']) or (vals.has_key('name') and vals['name']): vals_line = {} hr_anlytic_timesheet = self.pool.get('hr.analytic.timesheet') task_obj_l = self.browse(cr, uid, ids, context) if vals.get('project_id',False): project_obj = self.pool.get('project.project').browse(cr, uid, vals['project_id']) acc_id = project_obj.analytic_account_id.id
467,810
def write(self, cr, uid, ids,vals,context=None): if context is None: context = {} if (vals.has_key('project_id') and vals['project_id']) or (vals.has_key('name') and vals['name']): vals_line = {} hr_anlytic_timesheet = self.pool.get('hr.analytic.timesheet') task_obj_l = self.browse(cr, uid, ids, context) if (vals.has_key('project_id') and vals['project_id']): project_obj = self.pool.get('project.project').browse(cr, uid, vals['project_id']) acc_id = project_obj.analytic_account_id.id
def write(self, cr, uid, ids,vals,context=None): if context is None: context = {} if (vals.has_key('project_id') and vals['project_id']) or (vals.has_key('name') and vals['name']): vals_line = {} hr_anlytic_timesheet = self.pool.get('hr.analytic.timesheet') task_obj_l = self.browse(cr, uid, ids, context) if (vals.has_key('project_id') and vals['project_id']): project_obj = self.pool.get('project.project').browse(cr, uid, vals['project_id']) acc_id = project_obj.analytic_account_id.id
467,811
def write(self, cr, uid, ids,vals,context=None): if context is None: context = {} if (vals.has_key('project_id') and vals['project_id']) or (vals.has_key('name') and vals['name']): vals_line = {} hr_anlytic_timesheet = self.pool.get('hr.analytic.timesheet') task_obj_l = self.browse(cr, uid, ids, context) if (vals.has_key('project_id') and vals['project_id']): project_obj = self.pool.get('project.project').browse(cr, uid, vals['project_id']) acc_id = project_obj.analytic_account_id.id
def write(self, cr, uid, ids,vals,context=None): if context is None: context = {} if (vals.has_key('project_id') and vals['project_id']) or (vals.has_key('name') and vals['name']): vals_line = {} hr_anlytic_timesheet = self.pool.get('hr.analytic.timesheet') task_obj_l = self.browse(cr, uid, ids, context) if (vals.has_key('project_id') and vals['project_id']): project_obj = self.pool.get('project.project').browse(cr, uid, vals['project_id']) acc_id = project_obj.analytic_account_id.id
467,812
def _lines_g(self, account_id, date1, date2): account_analytic_obj = self.pool.get('account.analytic.account') ids = account_analytic_obj.search(self.cr, self.uid, [('parent_id', 'child_of', [account_id])]) self.cr.execute("SELECT aa.name AS name, aa.code AS code, \ sum(aal.amount) AS balance, sum(aal.unit_amount) AS quantity \ FROM account_analytic_line AS aal, account_account AS aa \ WHERE (aal.general_account_id=aa.id) \ AND (aal.account_id IN aal.account_id IN %s)\ AND (date>=%s) AND (date<=%s) AND aa.active \ GROUP BY aal.general_account_id, aa.name, aa.code, aal.code \ ORDER BY aal.code", (tuple(ids), date1, date2)) res = self.cr.dictfetchall()
def _lines_g(self, account_id, date1, date2): account_analytic_obj = self.pool.get('account.analytic.account') ids = account_analytic_obj.search(self.cr, self.uid, [('parent_id', 'child_of', [account_id])]) self.cr.execute("SELECT aa.name AS name, aa.code AS code, \ sum(aal.amount) AS balance, sum(aal.unit_amount) AS quantity \ FROM account_analytic_line AS aal, account_account AS aa \ WHERE (aal.general_account_id=aa.id) \ AND (aal.account_id IN %s)\ AND (date>=%s) AND (date<=%s) AND aa.active \ GROUP BY aal.general_account_id, aa.name, aa.code, aal.code \ ORDER BY aal.code", (tuple(ids), date1, date2)) res = self.cr.dictfetchall()
467,813
def _move_sum(self, account_id, date1, date2, option): if account_id not in self.acc_data_dict: account_analytic_obj = self.pool.get('account.analytic.account') ids = account_analytic_obj.search(self.cr, self.uid,[('parent_id', 'child_of', [account_id])]) self.acc_data_dict[account_id] = ids else: ids = self.acc_data_dict[account_id] query_params = (tuple(ids), date1, date2) if option == "credit" : self.cr.execute("SELECT -sum(amount) FROM account_analytic_line \ WHERE account_id IN %s AND date>=%s AND date<=%s AND amount<0",query_params) elif option == "debit" : self.cr.execute("SELECT sum(amount) FROM account_analytic_line \ WHERE account_id IN %s\ AND date>=%s AND date<=%s AND amount>0",query_params) elif option == "quantity" : self.cr.execute("SELECT sum(unit_amount) FROM account_analytic_line \ WHERE account_id IN %s\ AND date>=%s AND date<=%s",query_params) return self.cr.fetchone()[0] or 0.0
def _move_sum(self, account_id, date1, date2, option): if account_id not in self.acc_data_dict: account_analytic_obj = self.pool.get('account.analytic.account') ids = account_analytic_obj.search(self.cr, self.uid,[('parent_id', 'child_of', [account_id])]) self.acc_data_dict[account_id] = ids else: ids = self.acc_data_dict[account_id] query_params = (tuple(ids), date1, date2) if option == "credit" : self.cr.execute("SELECT -sum(amount) FROM account_analytic_line \ WHERE account_id IN %s AND date>=%s AND date<=%s AND amount<0",query_params) elif option == "debit" : self.cr.execute("SELECT sum(amount) FROM account_analytic_line \ WHERE account_id IN %s\ AND date>=%s AND date<=%s AND amount>0",query_params) elif option == "quantity" : self.cr.execute("SELECT sum(unit_amount) FROM account_analytic_line \ WHERE account_id IN %s\ AND date>=%s AND date<=%s",query_params) return self.cr.fetchone()[0] or 0.0
467,814
def unlink(self, cr, uid, ids, context=None): procurements = self.read(cr, uid, ids, ['state']) unlink_ids = [] for s in procurements: if s['state'] in ['draft','cancel']: unlink_ids.append(s['id']) else: raise osv.except_osv(_('Invalid action !'), _('Cannot delete Procurement Order(s) which are in %s State!') % \ s['state']) return osv.osv.unlink(self, cr, uid, unlink_ids, context=context)
def unlink(self, cr, uid, ids, context=None): procurements = self.read(cr, uid, ids, ['state']) unlink_ids = [] for s in procurements: if s['state'] in ['draft','cancel']: unlink_ids.append(s['id']) else: raise osv.except_osv(_('Invalid action !'), _('Cannot delete Procurement Order(s) which are in %s State!') % \ s['state']) return osv.osv.unlink(self, cr, uid, unlink_ids, context=context)
467,815
def check_move_done(self, cr, uid, ids, context={}): """ Checks if move is done or not. @return: True or False. """ return all(procurement.move_id.state == 'done' for procurement in self.browse(cr, uid, ids))
def check_move_done(self, cr, uid, ids, context={}): """ Checks if move is done or not. @return: True or False. """ return all(procurement.move_id.state == 'done' for procurement in self.browse(cr, uid, ids))
467,816
def check_buy(self, cr, uid, ids): """ Checks product type. @return: True or Product Id. """ user = self.pool.get('res.users').browse(cr, uid, uid) partner_obj = self.pool.get('res.partner') for procurement in self.browse(cr, uid, ids): if procurement.product_id.product_tmpl_id.supply_method <> 'buy': return False if not procurement.product_id.seller_ids: cr.execute('update procurement_order set message=%s where id=%s', (_('No supplier defined for this product !'), procurement.id)) return False partner = procurement.product_id.seller_id #Taken Main Supplier of Product of Procurement.
def check_buy(self, cr, uid, ids): """ Checks product type. @return: True or Product Id. """ user = self.pool.get('res.users').browse(cr, uid, uid) partner_obj = self.pool.get('res.partner') for procurement in self.browse(cr, uid, ids): if procurement.product_id.product_tmpl_id.supply_method <> 'buy': return False if not procurement.product_id.seller_ids: cr.execute('update procurement_order set message=%s where id=%s', (_('No supplier defined for this product !'), procurement.id)) return False partner = procurement.product_id.seller_id #Taken Main Supplier of Product of Procurement.
467,817
def check_buy(self, cr, uid, ids): """ Checks product type. @return: True or Product Id. """ user = self.pool.get('res.users').browse(cr, uid, uid) partner_obj = self.pool.get('res.partner') for procurement in self.browse(cr, uid, ids): if procurement.product_id.product_tmpl_id.supply_method <> 'buy': return False if not procurement.product_id.seller_ids: cr.execute('update procurement_order set message=%s where id=%s', (_('No supplier defined for this product !'), procurement.id)) return False partner = procurement.product_id.seller_id #Taken Main Supplier of Product of Procurement.
def check_buy(self, cr, uid, ids): """ Checks product type. @return: True or Product Id. """ user = self.pool.get('res.users').browse(cr, uid, uid) partner_obj = self.pool.get('res.partner') for procurement in self.browse(cr, uid, ids): if procurement.product_id.product_tmpl_id.supply_method <> 'buy': return False if not procurement.product_id.seller_ids: cr.execute('update procurement_order set message=%s where id=%s', (_('No supplier defined for this product !'), procurement.id)) return False partner = procurement.product_id.seller_id #Taken Main Supplier of Product of Procurement.
467,818
def action_confirm(self, cr, uid, ids, context={}): """ Confirms procurement and writes exception message if any. @return: True """ move_obj = self.pool.get('stock.move') for procurement in self.browse(cr, uid, ids): if procurement.product_qty <= 0.00: raise osv.except_osv(_('Data Insufficient !'), _('Please check the Quantity in Procurement Order(s), it should not be less than 1!')) if procurement.product_id.type in ('product', 'consu'): if not procurement.move_id: source = procurement.location_id.id if procurement.procure_method == 'make_to_order': source = procurement.product_id.product_tmpl_id.property_stock_procurement.id id = move_obj.create(cr, uid, { 'name': procurement.name, 'location_id': source, 'location_dest_id': procurement.location_id.id, 'product_id': procurement.product_id.id, 'product_qty': procurement.product_qty, 'product_uom': procurement.product_uom.id, 'date_expected': procurement.date_planned, 'state': 'draft', 'company_id': procurement.company_id.id, 'auto_validate': True, }) move_obj.action_confirm(cr, uid, [id], context=context) self.write(cr, uid, [procurement.id], {'move_id': id, 'close_move': 1}) self.write(cr, uid, ids, {'state': 'confirmed', 'message': ''}) return True
def action_confirm(self, cr, uid, ids, context={}): """ Confirms procurement and writes exception message if any. @return: True """ move_obj = self.pool.get('stock.move') for procurement in self.browse(cr, uid, ids): if procurement.product_qty <= 0.00: raise osv.except_osv(_('Data Insufficient !'), _('Please check the Quantity in Procurement Order(s), it should not be less than 1!')) if procurement.product_id.type in ('product', 'consu'): if not procurement.move_id: source = procurement.location_id.id if procurement.procure_method == 'make_to_order': source = procurement.product_id.product_tmpl_id.property_stock_procurement.id id = move_obj.create(cr, uid, { 'name': procurement.name, 'location_id': source, 'location_dest_id': procurement.location_id.id, 'product_id': procurement.product_id.id, 'product_qty': procurement.product_qty, 'product_uom': procurement.product_uom.id, 'date_expected': procurement.date_planned, 'state': 'draft', 'company_id': procurement.company_id.id, 'auto_validate': True, }) move_obj.action_confirm(cr, uid, [id], context=context) self.write(cr, uid, [procurement.id], {'move_id': id, 'close_move': 1}) self.write(cr, uid, ids, {'state': 'confirmed', 'message': ''}) return True
467,819
def action_move_assigned(self, cr, uid, ids, context={}): """ Changes procurement state to Running and writes message. @return: True """ self.write(cr, uid, ids, {'state': 'running', 'message': _('from stock: products assigned.')}) return True
def action_move_assigned(self, cr, uid, ids, context={}): """ Changes procurement state to Running and writes message. @return: True """ self.write(cr, uid, ids, {'state': 'running', 'message': _('from stock: products assigned.')}) return True
467,820
def _check_make_to_stock_product(self, cr, uid, procurement, context={}): """ Checks procurement move state. @param procurement: Current procurement. @return: True or move id. """ ok = True if procurement.move_id: id = procurement.move_id.id if not (procurement.move_id.state in ('done','assigned','cancel')): ok = ok and self.pool.get('stock.move').action_assign(cr, uid, [id]) cr.execute('select count(id) from stock_warehouse_orderpoint where product_id=%s', (procurement.product_id.id,)) if not cr.fetchone()[0]: cr.execute('update procurement_order set message=%s where id=%s', (_('Not enough stock and no minimum orderpoint rule defined.'), procurement.id)) message = _("Procurement '%s' is in exception: not enough stock.") % \ (procurement.name,) self.log(cr, uid, procurement.id, message) return ok
def _check_make_to_stock_product(self, cr, uid, procurement, context={}): """ Checks procurement move state. @param procurement: Current procurement. @return: True or move id. """ ok = True if procurement.move_id: id = procurement.move_id.id if not (procurement.move_id.state in ('done','assigned','cancel')): ok = ok and self.pool.get('stock.move').action_assign(cr, uid, [id]) cr.execute('select count(id) from stock_warehouse_orderpoint where product_id=%s', (procurement.product_id.id,)) if not cr.fetchone()[0]: cr.execute('update procurement_order set message=%s where id=%s', (_('Not enough stock and no minimum orderpoint rule defined.'), procurement.id)) message = _("Procurement '%s' is in exception: not enough stock.") % \ (procurement.name,) self.log(cr, uid, procurement.id, message) return ok
467,821
def test_finished(self, cursor, user, ids): wf_service = netsvc.LocalService("workflow") res = super(StockPicking, self).test_finished(cursor, user, ids) for picking in self.browse(cursor, user, ids): for move in picking.move_lines: if move.state == 'done' and move.procurements: for procurement in move.procurements: wf_service.trg_validate(user, 'procurement.order', procurement.id, 'button_check', cursor) return res
def test_finished(self, cursor, user, ids): wf_service = netsvc.LocalService("workflow") res = super(StockPicking, self).test_finished(cursor, user, ids) for picking in self.browse(cursor, user, ids): for move in picking.move_lines: if move.state == 'done' and move.procurements: for procurement in move.procurements: wf_service.trg_validate(user, 'procurement.order', procurement.id, 'button_check', cursor) return res
467,822
def test_finished(self, cursor, user, ids): wf_service = netsvc.LocalService("workflow") res = super(StockPicking, self).test_finished(cursor, user, ids) for picking in self.browse(cursor, user, ids): for move in picking.move_lines: if move.state == 'done' and move.procurements: for procurement in move.procurements: wf_service.trg_validate(user, 'procurement.order', procurement.id, 'button_check', cursor) return res
def test_finished(self, cursor, user, ids): wf_service = netsvc.LocalService("workflow") res = super(StockPicking, self).test_finished(cursor, user, ids) for picking in self.browse(cursor, user, ids): for move in picking.move_lines: if move.state == 'done' and move.procurements: for procurement in move.procurements: wf_service.trg_validate(user, 'procurement.order', procurement.id, 'button_check', cursor) return res
467,823
def onchange_warehouse_id(self, cr, uid, ids, warehouse_id, context={}): """ Finds location id for changed warehouse. @param warehouse_id: Changed id of warehouse. @return: Dictionary of values. """ if warehouse_id: w = self.pool.get('stock.warehouse').browse(cr, uid, warehouse_id, context) v = {'location_id': w.lot_stock_id.id} return {'value': v} return {}
def onchange_warehouse_id(self, cr, uid, ids, warehouse_id, context={}): """ Finds location id for changed warehouse. @param warehouse_id: Changed id of warehouse. @return: Dictionary of values. """ if warehouse_id: w = self.pool.get('stock.warehouse').browse(cr, uid, warehouse_id, context) v = {'location_id': w.lot_stock_id.id} return {'value': v} return {}
467,824
def onchange_product_id(self, cr, uid, ids, product_id, context={}): """ Finds UoM for changed product. @param product_id: Changed id of product. @return: Dictionary of values. """ if product_id: prod = self.pool.get('product.product').browse(cr,uid,product_id) v = {'product_uom': prod.uom_id.id} return {'value': v} return {}
def onchange_product_id(self, cr, uid, ids, product_id, context={}): """ Finds UoM for changed product. @param product_id: Changed id of product. @return: Dictionary of values. """ if product_id: prod = self.pool.get('product.product').browse(cr,uid,product_id) v = {'product_uom': prod.uom_id.id} return {'value': v} return {}
467,825
def copy(self, cr, uid, id, default=None,context={}): if not default: default = {} default.update({ 'name': self.pool.get('ir.sequence').get(cr, uid, 'stock.orderpoint') or '', }) return super(stock_warehouse_orderpoint, self).copy(cr, uid, id, default, context)
def copy(self, cr, uid, id, default=None,context={}): if not default: default = {} default.update({ 'name': self.pool.get('ir.sequence').get(cr, uid, 'stock.orderpoint') or '', }) return super(stock_warehouse_orderpoint, self).copy(cr, uid, id, default, context)
467,826
def _total(self, cr, uid, ids, field_names, arg, context=None): if context is None: context = {} res={} for line in self.browse(cr, uid, ids, context=context): res[line.id] = line.emp_deduction + line.comp_deduction return res
def _total(self, cr, uid, ids, field_names, arg, context=None): if context is None: context = {} res={} for line in self.browse(cr, uid, ids, context=context): res[line.id] = line.emp_deduction + line.comp_deduction return res
467,827
def compute(self, cr, uid, id, value, context={}): contrib = self.browse(cr, uid, id, context) if contrib.amount_type == 'fix': return contrib.contribute_per elif contrib.amount_type == 'per': return value * contrib.contribute_per elif contrib.amount_type == 'func': return self._execute_function(cr, uid, id, value, context) return 0.0
def compute(self, cr, uid, id, value, context={}): contrib = self.browse(cr, uid, id, context) if contrib.amount_type == 'fix': return contrib.contribute_per elif contrib.amount_type == 'per': return value * contrib.contribute_per elif contrib.amount_type == 'func': return self._execute_function(cr, uid, id, value, context) return 0.0
467,828
def onchange_amount(self, cr, uid, ids, amount, typ): amt = amount if typ and typ == 'per': if int(amt) > 0: amt = amt / 100 return {'value':{'amount':amt}}
def onchange_amount(self, cr, uid, ids, amount, typ): amt = amount if typ and typ == 'per': if int(amt) > 0: amt = amt / 100 return {'value':{'amount':amt}}
467,829
def onchange_amount(self, cr, uid, ids, amount, typ): amt = amount if typ and typ == 'per': if int(amt) > 0: amt = amt / 100 return {'value':{'amount':amt}}
def onchange_amount(self, cr, uid, ids, amount, typ): amt = amount if typ and typ == 'per': if int(amt) > 0: amt = amt / 100 return {'value':{'amount':amt}}
467,830
def onchange_amount(self, cr, uid, ids, amount, typ): amt = amount if typ and typ == 'per': if int(amt) > 0: amt = amt / 100 return {'value':{'amount':amt}}
def onchange_amount(self, cr, uid, ids, amount, typ): amt = amount if typ and typ == 'per': if int(amt) > 0: amt = amt / 100 return {'value':{'amount':amt}}
467,831
def _result_get(x, keys): if x[1] in keys: return False keys.append(x[1]) if x[3]: model,id = x[2].split(',') id = int(id) fields = self.pool.get(model).fields_get_keys(cr, uid) pos = 0 while pos<len(fields): if fields[pos] in ('report_sxw_content', 'report_rml_content', 'report_sxw', 'report_rml', 'report_sxw_content_data', 'report_rml_content_data'): del fields[pos] else: pos+=1 try: datas = self.pool.get(model).read(cr, uid, [id], fields, context) except except_orm, e: return False datas= datas and datas[0] or None if not datas: #ir_del(cr, uid, x[0]) return False else: datas = pickle.loads(str(x[2].encode('utf-8'))) if meta: meta2 = pickle.loads(x[4]) return (x[0],x[1],datas,meta2) return (x[0],x[1],datas)
def _result_get(x, keys): if x[1] in keys: return False keys.append(x[1]) if x[3]: model,id = x[2].split(',') id = int(id) fields = self.pool.get(model).fields_get_keys(cr, uid) pos = 0 while pos<len(fields): if fields[pos] in ('report_sxw_content', 'report_rml_content', 'report_sxw', 'report_rml', 'report_sxw_content_data', 'report_rml_content_data'): del fields[pos] else: pos+=1 try: datas = self.pool.get(model).read(cr, uid, [id], fields, context) except except_orm, e: return False datas= datas and datas[0] or None if not datas: #ir_del(cr, uid, x[0]) return False else: datas = pickle.loads(str(x[2].encode('utf-8'))) if meta: meta2 = pickle.loads(x[4]) return (x[0],x[1],datas,meta2) return (x[0],x[1],datas)
467,832
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
467,833
def _perc(self, cr, uid, ids, name, args, context): res = {} for line in self.browse(cr, uid, ids): if line.theoritical_amount <> 0.00: res[line.id] = float(line.practical_amount or 0.0 / line.theoritical_amount) * 100 else: res[line.id] = 0.00 return res
def _perc(self, cr, uid, ids, name, args, context): res = {} for line in self.browse(cr, uid, ids): if line.theoritical_amount <> 0.00: res[line.id] = float((line.practical_amount or 0.0) / line.theoritical_amount) * 100 else: res[line.id] = 0.00 return res
467,834
def create_invoices(self, cr, uid, ids, context={}): """ To create invoices.
def create_invoices(self, cr, uid, ids, context={}): """ To create invoices.
467,835
def check_group(node): if node.get('groups'): groups = node.get('groups').split(',') access_pool = self.pool.get('ir.model.access') can_see = any(access_pool.check_groups(cr, user, group) for group in groups) if not can_see: node.set('invisible', '1') if 'attrs' in node.attrib: del(node.attrib['attrs']) #avoid making field visible later del(node.attrib['groups']) return can_see else: return True
def check_group(node): if node.get('groups'): groups = node.get('groups').split(',') access_pool = self.pool.get('ir.model.access') can_see = any(access_pool.check_groups(cr, user, group) for group in groups) if not can_see: node.set('invisible', '1') if 'attrs' in node.attrib: del(node.attrib['attrs']) #avoid making field visible later del(node.attrib['groups']) return can_see else: return True
467,836
def _apply_ir_rules(self, cr, uid, query, mode='read', context=None): """Add what's missing in ``query`` to implement all appropriate ir.rules (using the ``model_name``'s rules or the current model's rules if ``model_name`` is None)
def _apply_ir_rules(self, cr, uid, query, mode='read', context=None): """Add what's missing in ``query`` to implement all appropriate ir.rules (using the ``model_name``'s rules or the current model's rules if ``model_name`` is None)
467,837
def _generate_m2o_order_by(self, order_field, query): """ Add possibly missing JOIN to ``query`` and generate the ORDER BY clause for m2o fields, either native m2o fields or function/related fields that are stored, including intermediate JOINs for inheritance if required.
def _generate_m2o_order_by(self, order_field, query): """ Add possibly missing JOIN to ``query`` and generate the ORDER BY clause for m2o fields, either native m2o fields or function/related fields that are stored, including intermediate JOINs for inheritance if required.
467,838
def holidays_validate(self, cr, uid, ids, *args): data_holiday = self.browse(cr, uid, ids) self.check_holidays(cr, uid, ids) if data_holiday[0].holiday_status_id.double_validation: vals = {'state':'validate1'} else: vals = {'state':'validate'} ids2 = self.pool.get('hr.employee').search(cr, uid, [('user_id','=', uid)]) if ids2: vals['manager_id'] = ids2[0] else: raise osv.except_osv(_('Warning !'),_('No user related to the selected employee.')) self.write(cr, uid, ids, vals) if data_holiday[0].holiday_status_id.double_validation: for record in data_holiday: if record.holiday_type=='employee' and record.type=='remove': vals= { 'name':record.name, 'date_from':record.date_from, 'date_to':record.date_to, 'calendar_id':record.employee_id.calendar_id.id, 'company_id':record.employee_id.company_id.id, 'resource_id':record.employee_id.resource_id.id } self.pool.get('resource.calendar.leaves').create(cr, uid, vals) return True
def holidays_validate(self, cr, uid, ids, *args): data_holiday = self.browse(cr, uid, ids) self.check_holidays(cr, uid, ids) if not data_holiday[0].holiday_status_id.double_validation: vals = {'state':'validate1'} else: vals = {'state':'validate'} ids2 = self.pool.get('hr.employee').search(cr, uid, [('user_id','=', uid)]) if ids2: vals['manager_id'] = ids2[0] else: raise osv.except_osv(_('Warning !'),_('No user related to the selected employee.')) self.write(cr, uid, ids, vals) if not data_holiday[0].holiday_status_id.double_validation: for record in data_holiday: if record.holiday_type=='employee' and record.type=='remove': vals= { 'name':record.name, 'date_from':record.date_from, 'date_to':record.date_to, 'calendar_id':record.employee_id.calendar_id.id, 'company_id':record.employee_id.company_id.id, 'resource_id':record.employee_id.resource_id.id } self.pool.get('resource.calendar.leaves').create(cr, uid, vals) return True
467,839
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,840
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,841
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,842
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,843
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,844
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,845
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,846
def read(self, cr, user, ids, fields=None, context=None, load='_classic_read'): """ Read records with given ids with the given fields
def read(self, cr, user, ids, fields=None, context=None, load='_classic_read'): """ Read records with given ids with the given fields
467,847
def read(self, cr, user, ids, fields=None, context=None, load='_classic_read'): """ Read records with given ids with the given fields
def read(self, cr, user, ids, fields=None, context=None, load='_classic_read'): """ Read records with given ids with the given fields
467,848
def button_reset_taxes(self, cr, uid, ids, context=None): if context is None: context = {} ctx = context.copy() 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: 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=ctx) return True
def button_reset_taxes(self, cr, uid, ids, context=None): if context is None: context = {} ctx = context.copy() ait_obj = self.pool.get('account.invoice.tax') for id in ids: cr.execute("DELETE FROM account_invoice_tax WHERE invoice_id=%s AND manual is False", (id,)) partner = self.browse(cr, uid, id, context=ctx).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=ctx) return True
467,849
def action_apply(self, cr, uid, ids, context=None): """ This converts Opportunity to Phonecall and opens Phonecall view @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 Opportunity to Phonecall IDs @param context: A standard dictionary for contextual values
def action_apply(self, cr, uid, ids, context=None): """ This converts Opportunity to Phonecall and opens Phonecall view @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 Opportunity to Phonecall IDs @param context: A standard dictionary for contextual values
467,850
def _total_cost(self, cr, uid, ids, field_name, arg, context={}):
def _total_cost(self, cr, uid, ids, field_name, arg, context={}):
467,851
def _total_cost(self, cr, uid, ids, field_name, arg, context={}):
def _total_cost(self, cr, uid, ids, field_name, arg, context={}):
467,852
def _total_cost(self, cr, uid, ids, field_name, arg, context={}):
def _total_cost(self, cr, uid, ids, field_name, arg, context={}):
467,853
def default_get(self, cr, uid, fields, context=None): """ This function gets default values """ res = super(project_task_delegate, self).default_get(cr, uid, fields, context=context) if context is None: context = {} record_id = context and context.get('active_id', False) or False task_pool = self.pool.get('project.task') task = task_pool.browse(cr, uid, record_id, context=context)
def default_get(self, cr, uid, fields, context=None): """ This function gets default values """ res = super(project_task_delegate, self).default_get(cr, uid, fields, context=context) if context is None: context = {} record_id = context and context.get('active_id', False) or False task_pool = self.pool.get('project.task') task = task_pool.browse(cr, uid, record_id, context=context)
467,854
def default_get(self, cr, uid, fields, context=None): """ This function gets default values """ res = super(project_task_delegate, self).default_get(cr, uid, fields, context=context) if context is None: context = {} record_id = context and context.get('active_id', False) or False task_pool = self.pool.get('project.task') task = task_pool.browse(cr, uid, record_id, context=context)
def default_get(self, cr, uid, fields, context=None): """ This function gets default values """ res = super(project_task_delegate, self).default_get(cr, uid, fields, context=context) if context is None: context = {} record_id = context and context.get('active_id', False) or False task_pool = self.pool.get('project.task') task = task_pool.browse(cr, uid, record_id, context=context)
467,855
def default_get(self, cr, uid, fields, context=None): """ This function gets default values """ res = super(project_task_delegate, self).default_get(cr, uid, fields, context=context) if context is None: context = {} record_id = context and context.get('active_id', False) or False task_pool = self.pool.get('project.task') task = task_pool.browse(cr, uid, record_id, context=context)
def default_get(self, cr, uid, fields, context=None): """ This function gets default values """ res = super(project_task_delegate, self).default_get(cr, uid, fields, context=context) if context is None: context = {} record_id = context and context.get('active_id', False) or False task_pool = self.pool.get('project.task') task = task_pool.browse(cr, uid, record_id, context=context)
467,856
def default_get(self, cr, uid, fields, context=None): """ This function gets default values """ res = super(project_task_delegate, self).default_get(cr, uid, fields, context=context) if context is None: context = {} record_id = context and context.get('active_id', False) or False task_pool = self.pool.get('project.task') task = task_pool.browse(cr, uid, record_id, context=context)
def default_get(self, cr, uid, fields, context=None): """ This function gets default values """ res = super(project_task_delegate, self).default_get(cr, uid, fields, context=context) if context is None: context = {} record_id = context and context.get('active_id', False) or False task_pool = self.pool.get('project.task') task = task_pool.browse(cr, uid, record_id, context=context)
467,857
def __repr__(self): return '!workflow {model: %s, action: %s ref: %s}:' % (str(self.model,), str(self.action,), str(self.ref,))
def __repr__(self): return '!workflow {model: %s, action: %s, ref: %s}' % (str(self.model,), str(self.action,), str(self.ref,))
467,858
def onchange_discount(self, cr, uid,ids, discount,price,*a): pos_order = self.pool.get('pos.order.line') res_obj = self.pool.get('res.users') res_company = self.pool.get('res.company') company_disc = pos_order.browse(cr,uid,ids) if discount: if not company_disc: comp=res_obj.browse(cr,uid,uid).company_id.company_discount or 0.0 else: comp= company_disc[0] and company_disc[0].order_id.company_id and company_disc[0].order_id.company_id.company_discount or 0.0
def def _check_qty(self, cr, uid, ids): lines = self.browse(cr, uid, ids) for line in lines: if line.qty <= 0: return False return True _constraints = [ (_check_qty, 'Order quantity cannot be negative or zero !', ['qty']), ] onchange_discount(self, def _check_qty(self, cr, uid, ids): lines = self.browse(cr, uid, ids) for line in lines: if line.qty <= 0: return False return True _constraints = [ (_check_qty, 'Order quantity cannot be negative or zero !', ['qty']), ] cr, def _check_qty(self, cr, uid, ids): lines = self.browse(cr, uid, ids) for line in lines: if line.qty <= 0: return False return True _constraints = [ (_check_qty, 'Order quantity cannot be negative or zero !', ['qty']), ] uid,ids, def _check_qty(self, cr, uid, ids): lines = self.browse(cr, uid, ids) for line in lines: if line.qty <= 0: return False return True _constraints = [ (_check_qty, 'Order quantity cannot be negative or zero !', ['qty']), ] discount,price,*a): def _check_qty(self, cr, uid, ids): lines = self.browse(cr, uid, ids) for line in lines: if line.qty <= 0: return False return True _constraints = [ (_check_qty, 'Order quantity cannot be negative or zero !', ['qty']), ] pos_order def _check_qty(self, cr, uid, ids): lines = self.browse(cr, uid, ids) for line in lines: if line.qty <= 0: return False return True _constraints = [ (_check_qty, 'Order quantity cannot be negative or zero !', ['qty']), ] = def _check_qty(self, cr, uid, ids): lines = self.browse(cr, uid, ids) for line in lines: if line.qty <= 0: return False return True _constraints = [ (_check_qty, 'Order quantity cannot be negative or zero !', ['qty']), ] self.pool.get('pos.order.line') def _check_qty(self, cr, uid, ids): lines = self.browse(cr, uid, ids) for line in lines: if line.qty <= 0: return False return True _constraints = [ (_check_qty, 'Order quantity cannot be negative or zero !', ['qty']), ] res_obj def _check_qty(self, cr, uid, ids): lines = self.browse(cr, uid, ids) for line in lines: if line.qty <= 0: return False return True _constraints = [ (_check_qty, 'Order quantity cannot be negative or zero !', ['qty']), ] = def _check_qty(self, cr, uid, ids): lines = self.browse(cr, uid, ids) for line in lines: if line.qty <= 0: return False return True _constraints = [ (_check_qty, 'Order quantity cannot be negative or zero !', ['qty']), ] self.pool.get('res.users') def _check_qty(self, cr, uid, ids): lines = self.browse(cr, uid, ids) for line in lines: if line.qty <= 0: return False return True _constraints = [ (_check_qty, 'Order quantity cannot be negative or zero !', ['qty']), ] res_company def _check_qty(self, cr, uid, ids): lines = self.browse(cr, uid, ids) for line in lines: if line.qty <= 0: return False return True _constraints = [ (_check_qty, 'Order quantity cannot be negative or zero !', ['qty']), ] = def _check_qty(self, cr, uid, ids): lines = self.browse(cr, uid, ids) for line in lines: if line.qty <= 0: return False return True _constraints = [ (_check_qty, 'Order quantity cannot be negative or zero !', ['qty']), ] self.pool.get('res.company') def _check_qty(self, cr, uid, ids): lines = self.browse(cr, uid, ids) for line in lines: if line.qty <= 0: return False return True _constraints = [ (_check_qty, 'Order quantity cannot be negative or zero !', ['qty']), ] company_disc def _check_qty(self, cr, uid, ids): lines = self.browse(cr, uid, ids) for line in lines: if line.qty <= 0: return False return True _constraints = [ (_check_qty, 'Order quantity cannot be negative or zero !', ['qty']), ] = def _check_qty(self, cr, uid, ids): lines = self.browse(cr, uid, ids) for line in lines: if line.qty <= 0: return False return True _constraints = [ (_check_qty, 'Order quantity cannot be negative or zero !', ['qty']), ] pos_order.browse(cr,uid,ids) def _check_qty(self, cr, uid, ids): lines = self.browse(cr, uid, ids) for line in lines: if line.qty <= 0: return False return True _constraints = [ (_check_qty, 'Order quantity cannot be negative or zero !', ['qty']), ] if def _check_qty(self, cr, uid, ids): lines = self.browse(cr, uid, ids) for line in lines: if line.qty <= 0: return False return True _constraints = [ (_check_qty, 'Order quantity cannot be negative or zero !', ['qty']), ] discount: def _check_qty(self, cr, uid, ids): lines = self.browse(cr, uid, ids) for line in lines: if line.qty <= 0: return False return True _constraints = [ (_check_qty, 'Order quantity cannot be negative or zero !', ['qty']), ] if def _check_qty(self, cr, uid, ids): lines = self.browse(cr, uid, ids) for line in lines: if line.qty <= 0: return False return True _constraints = [ (_check_qty, 'Order quantity cannot be negative or zero !', ['qty']), ] not def _check_qty(self, cr, uid, ids): lines = self.browse(cr, uid, ids) for line in lines: if line.qty <= 0: return False return True _constraints = [ (_check_qty, 'Order quantity cannot be negative or zero !', ['qty']), ] company_disc: def _check_qty(self, cr, uid, ids): lines = self.browse(cr, uid, ids) for line in lines: if line.qty <= 0: return False return True _constraints = [ (_check_qty, 'Order quantity cannot be negative or zero !', ['qty']), ] comp=res_obj.browse(cr,uid,uid).company_id.company_discount def _check_qty(self, cr, uid, ids): lines = self.browse(cr, uid, ids) for line in lines: if line.qty <= 0: return False return True _constraints = [ (_check_qty, 'Order quantity cannot be negative or zero !', ['qty']), ] or def _check_qty(self, cr, uid, ids): lines = self.browse(cr, uid, ids) for line in lines: if line.qty <= 0: return False return True _constraints = [ (_check_qty, 'Order quantity cannot be negative or zero !', ['qty']), ] 0.0 def _check_qty(self, cr, uid, ids): lines = self.browse(cr, uid, ids) for line in lines: if line.qty <= 0: return False return True _constraints = [ (_check_qty, 'Order quantity cannot be negative or zero !', ['qty']), ] else: def _check_qty(self, cr, uid, ids): lines = self.browse(cr, uid, ids) for line in lines: if line.qty <= 0: return False return True _constraints = [ (_check_qty, 'Order quantity cannot be negative or zero !', ['qty']), ] comp= def _check_qty(self, cr, uid, ids): lines = self.browse(cr, uid, ids) for line in lines: if line.qty <= 0: return False return True _constraints = [ (_check_qty, 'Order quantity cannot be negative or zero !', ['qty']), ] company_disc[0] def _check_qty(self, cr, uid, ids): lines = self.browse(cr, uid, ids) for line in lines: if line.qty <= 0: return False return True _constraints = [ (_check_qty, 'Order quantity cannot be negative or zero !', ['qty']), ] and def _check_qty(self, cr, uid, ids): lines = self.browse(cr, uid, ids) for line in lines: if line.qty <= 0: return False return True _constraints = [ (_check_qty, 'Order quantity cannot be negative or zero !', ['qty']), ] company_disc[0].order_id.company_id def _check_qty(self, cr, uid, ids): lines = self.browse(cr, uid, ids) for line in lines: if line.qty <= 0: return False return True _constraints = [ (_check_qty, 'Order quantity cannot be negative or zero !', ['qty']), ] and def _check_qty(self, cr, uid, ids): lines = self.browse(cr, uid, ids) for line in lines: if line.qty <= 0: return False return True _constraints = [ (_check_qty, 'Order quantity cannot be negative or zero !', ['qty']), ] def _check_qty(self, cr, uid, ids): lines = self.browse(cr, uid, ids) for line in lines: if line.qty <= 0: return False return True _constraints = [ (_check_qty, 'Order quantity cannot be negative or zero !', ['qty']), ] company_disc[0].order_id.company_id.company_discount def _check_qty(self, cr, uid, ids): lines = self.browse(cr, uid, ids) for line in lines: if line.qty <= 0: return False return True _constraints = [ (_check_qty, 'Order quantity cannot be negative or zero !', ['qty']), ] def _check_qty(self, cr, uid, ids): lines = self.browse(cr, uid, ids) for line in lines: if line.qty <= 0: return False return True _constraints = [ (_check_qty, 'Order quantity cannot be negative or zero !', ['qty']), ] or def _check_qty(self, cr, uid, ids): lines = self.browse(cr, uid, ids) for line in lines: if line.qty <= 0: return False return True _constraints = [ (_check_qty, 'Order quantity cannot be negative or zero !', ['qty']), ] 0.0
467,859
def _procure_confirm(self, cr, uid, ids=None, use_new_cursor=False, context=None): ''' use_new_cursor: False or the dbname ''' if not context: context = {}
def _procure_confirm(self, cr, uid, ids=None, use_new_cursor=False, context=None): ''' use_new_cursor: False or the dbname ''' if not context: context = {}
467,860
def _procure_confirm(self, cr, uid, ids=None, use_new_cursor=False, context=None): ''' use_new_cursor: False or the dbname ''' if not context: context = {}
def _procure_confirm(self, cr, uid, ids=None, use_new_cursor=False, context=None): ''' use_new_cursor: False or the dbname ''' if not context: context = {}
467,861
def compute_pl(self, model_object_field, sub_model_object_field, null_value, template_language='mako'): """ Returns the expression based on data provided @param model_object_field: First level field @param sub_model_object_field: Second level drilled down field (M2O) @param null_value: What has to be returned if the value is empty @param template_language: The language used for templating @return: computed expression """ #Configure for MAKO copy_val = '' if template_language == 'mako': if model_object_field: copy_val = "${object." + model_object_field if sub_model_object_field: copy_val += "." + sub_model_object_field if null_value: copy_val += " or '''%s'''" % null_value if model_object_field: copy_val += "}" elif template_language == 'django': if model_object_field: copy_val = "{{object." + model_object_field if sub_model_object_field: copy_val += "." + sub_model_object_field if null_value: copy_val = copy_val + "|default:'''%s'''" % null_value copy_val = copy_val + "}}" return copy_val
def compute_pl(self, model_object_field, sub_model_object_field, null_value, template_language='mako'): """ Returns the expression based on data provided @param model_object_field: First level field @param sub_model_object_field: Second level drilled down field (M2O) @param null_value: What has to be returned if the value is empty @param template_language: The language used for templating @return: computed expression """ #Configure for MAKO copy_val = '' if template_language == 'mako': if model_object_field: copy_val = "${object." + model_object_field if sub_model_object_field: copy_val += "." + sub_model_object_field if null_value: copy_val += " or '''%s'''" % null_value copy_val += "}" elif template_language == 'django': if model_object_field: copy_val = "{{object." + model_object_field if sub_model_object_field: copy_val += "." + sub_model_object_field if null_value: copy_val = copy_val + "|default:'''%s'''" % null_value copy_val = copy_val + "}}" return copy_val
467,862
def compute_pl(self, model_object_field, sub_model_object_field, null_value, template_language='mako'): """ Returns the expression based on data provided @param model_object_field: First level field @param sub_model_object_field: Second level drilled down field (M2O) @param null_value: What has to be returned if the value is empty @param template_language: The language used for templating @return: computed expression """ #Configure for MAKO copy_val = '' if template_language == 'mako': if model_object_field: copy_val = "${object." + model_object_field if sub_model_object_field: copy_val += "." + sub_model_object_field if null_value: copy_val += " or '''%s'''" % null_value if model_object_field: copy_val += "}" elif template_language == 'django': if model_object_field: copy_val = "{{object." + model_object_field if sub_model_object_field: copy_val += "." + sub_model_object_field if null_value: copy_val = copy_val + "|default:'''%s'''" % null_value copy_val = copy_val + "}}" return copy_val
def compute_pl(self, model_object_field, sub_model_object_field, null_value, template_language='mako'): """ Returns the expression based on data provided @param model_object_field: First level field @param sub_model_object_field: Second level drilled down field (M2O) @param null_value: What has to be returned if the value is empty @param template_language: The language used for templating @return: computed expression """ #Configure for MAKO copy_val = '' if template_language == 'mako': if model_object_field: copy_val = "${object." + model_object_field if sub_model_object_field: copy_val += "." + sub_model_object_field if null_value: copy_val += " or '''%s'''" % null_value if model_object_field: copy_val += "}" elif template_language == 'django': if model_object_field: copy_val = "{{object." + model_object_field if sub_model_object_field: copy_val += "." + sub_model_object_field if null_value: copy_val = copy_val + "|default:'''%s'''" % null_value copy_val = copy_val + "}}" return copy_val
467,863
def fill_inventory(self, cr, uid, ids, context): """ To Import stock inventory according to products available in the selected locations. @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param ids: the ID or list of IDs if we want more than one @param context: A standard dictionary @return: """ inventory_line_obj = self.pool.get('stock.inventory.line') location_obj = self.pool.get('stock.location') product_obj = self.pool.get('product.product') stock_location_obj = self.pool.get('stock.location') if ids and len(ids): ids = ids[0] else: return {} fill_inventory = self.browse(cr, uid, ids) res = {} res_location = {} if fill_inventory.recursive : location_ids = location_obj.search(cr, uid, [('location_id', 'child_of', fill_inventory.location_id.id)]) for location in location_ids : res = location_obj._product_get(cr, uid, location) res_location[location] = res else: context.update({'compute_child': False}) res = location_obj._product_get(cr, uid, fill_inventory.location_id.id, context=context) res_location[fill_inventory.location_id.id] = res product_ids = [] for location in res_location.keys(): res = res_location[location] for product_id in res.keys(): prod = product_obj.browse(cr, uid, [product_id])[0] uom = prod.uom_id.id context.update(uom=uom, compute_child=False) if fill_inventory.set_stock_zero: amount = 0 else: amount = stock_location_obj._product_get(cr, uid, location, [product_id], context=context)[product_id] if(amount): line_ids=inventory_line_obj.search(cr, uid, [('inventory_id', '=', context['active_ids']), ('location_id', '=', location), ('product_id', '=', product_id), ('product_uom', '=', uom), ('product_qty', '=', amount)]) if not len(line_ids): inventory_line = { 'inventory_id': context['active_ids'][0], 'location_id': location, 'product_id': product_id, 'product_uom': uom, 'product_qty': amount } inventory_line_obj.create(cr, uid, inventory_line) product_ids.append(product_id)
def fill_inventory(self, cr, uid, ids, context): """ To Import stock inventory according to products available in the selected locations. @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param ids: the ID or list of IDs if we want more than one @param context: A standard dictionary @return: """ inventory_line_obj = self.pool.get('stock.inventory.line') location_obj = self.pool.get('stock.location') product_obj = self.pool.get('product.product') stock_location_obj = self.pool.get('stock.location') if ids and len(ids): ids = ids[0] else: return {} fill_inventory = self.browse(cr, uid, ids) res = {} res_location = {} if fill_inventory.recursive : location_ids = location_obj.search(cr, uid, [('location_id', 'child_of', fill_inventory.location_id.id)]) for location in location_ids : res = location_obj._product_get(cr, uid, location) res_location[location] = res else: context.update({'compute_child': False}) res = location_obj._product_get(cr, uid, fill_inventory.location_id.id, context=context) res_location[fill_inventory.location_id.id] = res product_ids = [] for location in res_location.keys(): res = res_location[location] for product_id in res.keys(): prod = product_obj.browse(cr, uid, [product_id])[0] uom = prod.uom_id.id context.update(uom=uom, compute_child=False) amount = stock_location_obj._product_get(cr, uid, location, [product_id], context=context)[product_id] if(amount): line_ids=inventory_line_obj.search(cr, uid, [('inventory_id', '=', context['active_ids']), ('location_id', '=', location), ('product_id', '=', product_id), ('product_uom', '=', uom), ('product_qty', '=', amount)]) if not len(line_ids): inventory_line = { 'inventory_id': context['active_ids'][0], 'location_id': location, 'product_id': product_id, 'product_uom': uom, 'product_qty': amount } inventory_line_obj.create(cr, uid, inventory_line) product_ids.append(product_id)
467,864
def _centralise(self, cr, uid, move, mode, context=None): assert(mode in ('debit', 'credit'), 'Invalid Mode') #to prevent sql injection if context is None: context = {}
def _centralise(self, cr, uid, move, mode, context=None): assert mode in ('debit', 'credit'), 'Invalid Mode' #to prevent sql injection if context is None: context = {}
467,865
def write(self, cr, uid, ids, data, *args, **argv): self.precision_get.clear_cache(cr.dbname) res = super(decimal_precision, self).write(cr, uid, ids, data, *args, **argv) for obj in self.pool.obj_list(): for colname,col in self.pool.get(obj)._columns.items(): if isinstance(col, fields.float): col.digits_change(cr) return res
def write(self, cr, uid, ids, data, *args, **argv): res = super(decimal_precision, self).write(cr, uid, ids, data, *args, **argv) for obj in self.pool.obj_list(): for colname,col in self.pool.get(obj)._columns.items(): if isinstance(col, fields.float): col.digits_change(cr) return res
467,866
def _get_survey(self, cr, uid, context=None): """ Set the value In survey_id field.
def_get_survey(self,cr,uid,context=None):"""SetthevalueInsurvey_idfield.
467,867
def on_change_survey(self, cr, uid, ids, survey_id, context=None): """ on change event of survey_id field, if note is available in selected survey then display this note in note fields.
def on_change_survey(self, cr, uid, ids, survey_id, context=None): """ on change event of survey_id field, if note is available in selected survey then display this note in note fields.
467,868
def _doIt(self, cr, uid, data, context): form = data['form'] pool = pooler.get_pool(cr.dbname) mod_obj = pool.get('ir.model.data') result = mod_obj._get_id(cr, uid, 'hr', 'view_hr_case_phonecalls_filter') res = mod_obj.read(cr, uid, result, ['res_id']) phonecall_case_obj = pool.get('hr.phonecall') job_case_obj = pool.get('hr.applicant') # Select the view
def _doIt(self, cr, uid, data, context): form = data['form'] pool = pooler.get_pool(cr.dbname) mod_obj = pool.get('ir.model.data') result = mod_obj._get_id(cr, uid, 'crm', 'view_crm_case_phonecalls_filter') res = mod_obj.read(cr, uid, result, ['res_id']) phonecall_case_obj = pool.get('hr.phonecall') job_case_obj = pool.get('hr.applicant') # Select the view
467,869
def _doIt(self, cr, uid, data, context): form = data['form'] pool = pooler.get_pool(cr.dbname) mod_obj = pool.get('ir.model.data') result = mod_obj._get_id(cr, uid, 'hr', 'view_hr_case_phonecalls_filter') res = mod_obj.read(cr, uid, result, ['res_id']) phonecall_case_obj = pool.get('hr.phonecall') job_case_obj = pool.get('hr.applicant') # Select the view
def _doIt(self, cr, uid, data, context): form = data['form'] pool = pooler.get_pool(cr.dbname) mod_obj = pool.get('ir.model.data') result = mod_obj._get_id(cr, uid, 'hr', 'view_hr_case_phonecalls_filter') res = mod_obj.read(cr, uid, result, ['res_id']) phonecall_case_obj = pool.get('crm.phonecall') job_case_obj = pool.get('hr.applicant') # Select the view
467,870
def _doIt(self, cr, uid, data, context): form = data['form'] pool = pooler.get_pool(cr.dbname) mod_obj = pool.get('ir.model.data') result = mod_obj._get_id(cr, uid, 'hr', 'view_hr_case_phonecalls_filter') res = mod_obj.read(cr, uid, result, ['res_id']) phonecall_case_obj = pool.get('hr.phonecall') job_case_obj = pool.get('hr.applicant') # Select the view
def _doIt(self, cr, uid, data, context): form = data['form'] pool = pooler.get_pool(cr.dbname) mod_obj = pool.get('ir.model.data') result = mod_obj._get_id(cr, uid, 'hr', 'view_hr_case_phonecalls_filter') res = mod_obj.read(cr, uid, result, ['res_id']) phonecall_case_obj = pool.get('hr.phonecall') job_case_obj = pool.get('hr.applicant') # Select the view
467,871
def _doIt(self, cr, uid, data, context): form = data['form'] pool = pooler.get_pool(cr.dbname) mod_obj = pool.get('ir.model.data') result = mod_obj._get_id(cr, uid, 'hr', 'view_hr_case_phonecalls_filter') res = mod_obj.read(cr, uid, result, ['res_id']) phonecall_case_obj = pool.get('hr.phonecall') job_case_obj = pool.get('hr.applicant') # Select the view
def _doIt(self, cr, uid, data, context): form = data['form'] pool = pooler.get_pool(cr.dbname) mod_obj = pool.get('ir.model.data') result = mod_obj._get_id(cr, uid, 'hr', 'view_hr_case_phonecalls_filter') res = mod_obj.read(cr, uid, result, ['res_id']) phonecall_case_obj = pool.get('hr.phonecall') job_case_obj = pool.get('hr.applicant') # Select the view
467,872
def _doIt(self, cr, uid, data, context): form = data['form'] pool = pooler.get_pool(cr.dbname) mod_obj = pool.get('ir.model.data') result = mod_obj._get_id(cr, uid, 'hr', 'view_hr_case_phonecalls_filter') res = mod_obj.read(cr, uid, result, ['res_id']) phonecall_case_obj = pool.get('hr.phonecall') job_case_obj = pool.get('hr.applicant') # Select the view
def _doIt(self, cr, uid, data, context): form = data['form'] pool = pooler.get_pool(cr.dbname) mod_obj = pool.get('ir.model.data') result = mod_obj._get_id(cr, uid, 'hr', 'view_hr_case_phonecalls_filter') res = mod_obj.read(cr, uid, result, ['res_id']) phonecall_case_obj = pool.get('hr.phonecall') job_case_obj = pool.get('hr.applicant') # Select the view
467,873
def _makeOrder(self, cr, uid, data, context): pool = pooler.get_pool(cr.dbname) mod_obj = pool.get('ir.model.data') result = mod_obj._get_id(cr, uid, 'base', 'view_res_partner_filter') res = mod_obj.read(cr, uid, result, ['res_id']) case_obj = pool.get('hr.applicant') partner_obj = pool.get('res.partner') contact_obj = pool.get('res.partner.address') for case in case_obj.browse(cr, uid, data['ids']): partner_id = partner_obj.search(cr, uid, [('name', '=', case.partner_name or case.name)]) if partner_id: raise wizard.except_wizard(_('Warning !'),_('A partner is already existing with the same name.')) else: partner_id = partner_obj.create(cr, uid, { 'name': case.partner_name or case.name, 'user_id': case.user_id.id, 'comment': case.description, }) contact_id = contact_obj.create(cr, uid, { 'partner_id': partner_id, 'name': case.partner_name2, 'phone': case.partner_phone, 'mobile': case.partner_mobile, 'email': case.email_from })
def _makeOrder(self, cr, uid, data, context): pool = pooler.get_pool(cr.dbname) mod_obj = pool.get('ir.model.data') result = mod_obj._get_id(cr, uid, 'base', 'view_res_partner_filter') res = mod_obj.read(cr, uid, result, ['res_id']) case_obj = pool.get('hr.applicant') partner_obj = pool.get('res.partner') contact_obj = pool.get('res.partner.address') for case in case_obj.browse(cr, uid, data['ids']): partner_id = partner_obj.search(cr, uid, [('name', '=', case.partner_name or case.name)]) if partner_id: raise wizard.except_wizard(_('Warning !'),_('A partner is already existing with the same name.')) else: partner_id = partner_obj.create(cr, uid, { 'name': case.partner_name or case.name, 'user_id': case.user_id.id, 'comment': case.description, }) contact_id = contact_obj.create(cr, uid, { 'partner_id': partner_id, 'name': case.partner_name, 'phone': case.partner_phone, 'mobile': case.partner_mobile, 'email': case.email_from })
467,874
def on_change_unit_amount(self, cr, uid, id, prod_id, unit_amount,company_id, unit=False, journal_id=False, context=None): if context==None: context={} uom_obj = self.pool.get('product.uom') product_obj = self.pool.get('product.product') company_obj=self.pool.get('res.company') analytic_journal_obj=self.pool.get('account.analytic.journal') product_price_type_obj = self.pool.get('product.price.type') if prod_id: result = 0.0 prod = product_obj.browse(cr, uid, prod_id) a = prod.product_tmpl_id.property_account_expense.id if not a: a = prod.categ_id.property_account_expense_categ.id if not a: raise osv.except_osv(_('Error !'), _('There is no expense account defined ' \ 'for this product: "%s" (id:%d)') % \ (prod.name, prod.id,)) if not company_id: company_id=company_obj._company_default_get(cr, uid, 'account.analytic.line', context) flag = False # Compute based on pricetype pricetype=product_price_type_obj.browse(cr, uid, company_obj.browse(cr,uid,company_id).property_valuation_price_type.id) if journal_id: journal = analytic_journal_obj.browse(cr, uid, journal_id) if journal.type == 'sale': product_price_type_ids = product_price_type_obj.search(cr, uid, [('field','=','list_price')], context) if product_price_type_ids: pricetype = product_price_type_obj.browse(cr, uid, product_price_type_ids, context)[0] # Take the company currency as the reference one if pricetype.field == 'list_price': flag = True amount_unit = prod.price_get(pricetype.field, context)[prod.id] amount = amount_unit*unit_amount or 1.0 prec = self.pool.get('decimal.precision').precision_get(cr, uid, 'Account') amount = amount_unit*unit_amount or 1.0 result = round(amount, prec) if not flag: result *= -1 return {'value': { 'amount': result, 'general_account_id': a, }} return {}
def on_change_unit_amount(self, cr, uid, id, prod_id, quantity, company_id, unit=False, journal_id=False, context=None): if context==None: context={} uom_obj = self.pool.get('product.uom') product_obj = self.pool.get('product.product') company_obj=self.pool.get('res.company') analytic_journal_obj=self.pool.get('account.analytic.journal') product_price_type_obj = self.pool.get('product.price.type') if prod_id: result = 0.0 prod = product_obj.browse(cr, uid, prod_id) a = prod.product_tmpl_id.property_account_expense.id if not a: a = prod.categ_id.property_account_expense_categ.id if not a: raise osv.except_osv(_('Error !'), _('There is no expense account defined ' \ 'for this product: "%s" (id:%d)') % \ (prod.name, prod.id,)) if not company_id: company_id=company_obj._company_default_get(cr, uid, 'account.analytic.line', context) flag = False # Compute based on pricetype pricetype=product_price_type_obj.browse(cr, uid, company_obj.browse(cr,uid,company_id).property_valuation_price_type.id) if journal_id: journal = analytic_journal_obj.browse(cr, uid, journal_id) if journal.type == 'sale': product_price_type_ids = product_price_type_obj.search(cr, uid, [('field','=','list_price')], context) if product_price_type_ids: pricetype = product_price_type_obj.browse(cr, uid, product_price_type_ids, context)[0] # Take the company currency as the reference one if pricetype.field == 'list_price': flag = True amount_unit = prod.price_get(pricetype.field, context)[prod.id] amount = amount_unit*unit_amount or 1.0 prec = self.pool.get('decimal.precision').precision_get(cr, uid, 'Account') amount = amount_unit*unit_amount or 1.0 result = round(amount, prec) if not flag: result *= -1 return {'value': { 'amount': result, 'general_account_id': a, }} return {}
467,875
def on_change_unit_amount(self, cr, uid, id, prod_id, unit_amount,company_id, unit=False, journal_id=False, context=None): if context==None: context={} uom_obj = self.pool.get('product.uom') product_obj = self.pool.get('product.product') company_obj=self.pool.get('res.company') analytic_journal_obj=self.pool.get('account.analytic.journal') product_price_type_obj = self.pool.get('product.price.type') if prod_id: result = 0.0 prod = product_obj.browse(cr, uid, prod_id) a = prod.product_tmpl_id.property_account_expense.id if not a: a = prod.categ_id.property_account_expense_categ.id if not a: raise osv.except_osv(_('Error !'), _('There is no expense account defined ' \ 'for this product: "%s" (id:%d)') % \ (prod.name, prod.id,)) if not company_id: company_id=company_obj._company_default_get(cr, uid, 'account.analytic.line', context) flag = False # Compute based on pricetype pricetype=product_price_type_obj.browse(cr, uid, company_obj.browse(cr,uid,company_id).property_valuation_price_type.id) if journal_id: journal = analytic_journal_obj.browse(cr, uid, journal_id) if journal.type == 'sale': product_price_type_ids = product_price_type_obj.search(cr, uid, [('field','=','list_price')], context) if product_price_type_ids: pricetype = product_price_type_obj.browse(cr, uid, product_price_type_ids, context)[0] # Take the company currency as the reference one if pricetype.field == 'list_price': flag = True amount_unit = prod.price_get(pricetype.field, context)[prod.id] amount = amount_unit*unit_amount or 1.0 prec = self.pool.get('decimal.precision').precision_get(cr, uid, 'Account') amount = amount_unit*unit_amount or 1.0 result = round(amount, prec) if not flag: result *= -1 return {'value': { 'amount': result, 'general_account_id': a, }} return {}
def on_change_unit_amount(self, cr, uid, id, prod_id, unit_amount,company_id, unit=False, journal_id=False, context=None): if context==None: context={} if not journal_id or not prod_id: return {} product_obj = self.pool.get('product.product') company_obj=self.pool.get('res.company') analytic_journal_obj=self.pool.get('account.analytic.journal') product_price_type_obj = self.pool.get('product.price.type') if prod_id: result = 0.0 prod = product_obj.browse(cr, uid, prod_id) a = prod.product_tmpl_id.property_account_expense.id if not a: a = prod.categ_id.property_account_expense_categ.id if not a: raise osv.except_osv(_('Error !'), _('There is no expense account defined ' \ 'for this product: "%s" (id:%d)') % \ (prod.name, prod.id,)) if not company_id: company_id=company_obj._company_default_get(cr, uid, 'account.analytic.line', context) flag = False # Compute based on pricetype pricetype=product_price_type_obj.browse(cr, uid, company_obj.browse(cr,uid,company_id).property_valuation_price_type.id) if journal_id: journal = analytic_journal_obj.browse(cr, uid, journal_id) if journal.type == 'sale': product_price_type_ids = product_price_type_obj.search(cr, uid, [('field','=','list_price')], context) if product_price_type_ids: pricetype = product_price_type_obj.browse(cr, uid, product_price_type_ids, context)[0] # Take the company currency as the reference one if pricetype.field == 'list_price': flag = True amount_unit = prod.price_get(pricetype.field, context)[prod.id] amount = amount_unit*unit_amount or 1.0 prec = self.pool.get('decimal.precision').precision_get(cr, uid, 'Account') amount = amount_unit*unit_amount or 1.0 result = round(amount, prec) if not flag: result *= -1 return {'value': { 'amount': result, 'general_account_id': a, }} return {}
467,876
def on_change_unit_amount(self, cr, uid, id, prod_id, unit_amount,company_id, unit=False, journal_id=False, context=None): if context==None: context={} uom_obj = self.pool.get('product.uom') product_obj = self.pool.get('product.product') company_obj=self.pool.get('res.company') analytic_journal_obj=self.pool.get('account.analytic.journal') product_price_type_obj = self.pool.get('product.price.type') if prod_id: result = 0.0 prod = product_obj.browse(cr, uid, prod_id) a = prod.product_tmpl_id.property_account_expense.id if not a: a = prod.categ_id.property_account_expense_categ.id if not a: raise osv.except_osv(_('Error !'), _('There is no expense account defined ' \ 'for this product: "%s" (id:%d)') % \ (prod.name, prod.id,)) if not company_id: company_id=company_obj._company_default_get(cr, uid, 'account.analytic.line', context) flag = False # Compute based on pricetype pricetype=product_price_type_obj.browse(cr, uid, company_obj.browse(cr,uid,company_id).property_valuation_price_type.id) if journal_id: journal = analytic_journal_obj.browse(cr, uid, journal_id) if journal.type == 'sale': product_price_type_ids = product_price_type_obj.search(cr, uid, [('field','=','list_price')], context) if product_price_type_ids: pricetype = product_price_type_obj.browse(cr, uid, product_price_type_ids, context)[0] # Take the company currency as the reference one if pricetype.field == 'list_price': flag = True amount_unit = prod.price_get(pricetype.field, context)[prod.id] amount = amount_unit*unit_amount or 1.0 prec = self.pool.get('decimal.precision').precision_get(cr, uid, 'Account') amount = amount_unit*unit_amount or 1.0 result = round(amount, prec) if not flag: result *= -1 return {'value': { 'amount': result, 'general_account_id': a, }} return {}
def on_change_unit_amount(self, cr, uid, id, prod_id, unit_amount,company_id, unit=False, journal_id=False, context=None): if context==None: context={} uom_obj = self.pool.get('product.uom') product_obj = self.pool.get('product.product') analytic_journal_obj =self.pool.get('account.analytic.journal') j_id = analytic_journal_obj.browse(cr, uid, journal_id, context=context) prod = product_obj.browse(cr, uid, prod_id) if not company_id: company_id = j_id.company_id.id result = 0.0 is_purchase = False if j_id.type == 'purchase': a = prod.product_tmpl_id.property_account_expense.id if not a: a = prod.categ_id.property_account_expense_categ.id if not a: raise osv.except_osv(_('Error !'), _('There is no expense account defined ' \ 'for this product: "%s" (id:%d)') % \ (prod.name, prod.id,)) if not company_id: company_id=company_obj._company_default_get(cr, uid, 'account.analytic.line', context) flag = False # Compute based on pricetype pricetype=product_price_type_obj.browse(cr, uid, company_obj.browse(cr,uid,company_id).property_valuation_price_type.id) if journal_id: journal = analytic_journal_obj.browse(cr, uid, journal_id) if journal.type == 'sale': product_price_type_ids = product_price_type_obj.search(cr, uid, [('field','=','list_price')], context) if product_price_type_ids: pricetype = product_price_type_obj.browse(cr, uid, product_price_type_ids, context)[0] # Take the company currency as the reference one if pricetype.field == 'list_price': flag = True amount_unit = prod.price_get(pricetype.field, context)[prod.id] amount = amount_unit*unit_amount or 1.0 prec = self.pool.get('decimal.precision').precision_get(cr, uid, 'Account') amount = amount_unit*unit_amount or 1.0 result = round(amount, prec) if not flag: result *= -1 return {'value': { 'amount': result, 'general_account_id': a, }} return {}
467,877
def on_change_unit_amount(self, cr, uid, id, prod_id, unit_amount,company_id, unit=False, journal_id=False, context=None): if context==None: context={} uom_obj = self.pool.get('product.uom') product_obj = self.pool.get('product.product') company_obj=self.pool.get('res.company') analytic_journal_obj=self.pool.get('account.analytic.journal') product_price_type_obj = self.pool.get('product.price.type') if prod_id: result = 0.0 prod = product_obj.browse(cr, uid, prod_id) a = prod.product_tmpl_id.property_account_expense.id if not a: a = prod.categ_id.property_account_expense_categ.id if not a: raise osv.except_osv(_('Error !'), _('There is no expense account defined ' \ 'for this product: "%s" (id:%d)') % \ (prod.name, prod.id,)) if not company_id: company_id=company_obj._company_default_get(cr, uid, 'account.analytic.line', context) flag = False # Compute based on pricetype pricetype=product_price_type_obj.browse(cr, uid, company_obj.browse(cr,uid,company_id).property_valuation_price_type.id) if journal_id: journal = analytic_journal_obj.browse(cr, uid, journal_id) if journal.type == 'sale': product_price_type_ids = product_price_type_obj.search(cr, uid, [('field','=','list_price')], context) if product_price_type_ids: pricetype = product_price_type_obj.browse(cr, uid, product_price_type_ids, context)[0] # Take the company currency as the reference one if pricetype.field == 'list_price': flag = True amount_unit = prod.price_get(pricetype.field, context)[prod.id] amount = amount_unit*unit_amount or 1.0 prec = self.pool.get('decimal.precision').precision_get(cr, uid, 'Account') amount = amount_unit*unit_amount or 1.0 result = round(amount, prec) if not flag: result *= -1 return {'value': { 'amount': result, 'general_account_id': a, }} return {}
def on_change_unit_amount(self, cr, uid, id, prod_id, unit_amount,company_id, unit=False, journal_id=False, context=None): if context==None: context={} uom_obj = self.pool.get('product.uom') product_obj = self.pool.get('product.product') company_obj=self.pool.get('res.company') analytic_journal_obj=self.pool.get('account.analytic.journal') product_price_type_obj = self.pool.get('product.price.type') if prod_id: result = 0.0 prod = product_obj.browse(cr, uid, prod_id) a = prod.product_tmpl_id.property_account_expense.id if not a: a = prod.categ_id.property_account_expense_categ.id if not a: raise osv.except_osv(_('Error !'), _('There is no expense account defined ' \ 'for this product: "%s" (id:%d)') % \ (prod.name, prod.id,)) if not company_id: company_id=company_obj._company_default_get(cr, uid, 'account.analytic.line', context) flag = False # Compute based on pricetype pricetype=product_price_type_obj.browse(cr, uid, company_obj.browse(cr,uid,company_id).property_valuation_price_type.id) if journal_id: journal = analytic_journal_obj.browse(cr, uid, journal_id) if journal.type == 'sale': product_price_type_ids = product_price_type_obj.search(cr, uid, [('field','=','list_price')], context) if product_price_type_ids: pricetype = product_price_type_obj.browse(cr, uid, product_price_type_ids, context)[0] # Take the company currency as the reference one if pricetype.field == 'list_price': flag = True amount_unit = prod.price_get(pricetype.field, context)[prod.id] amount = amount_unit*unit_amount or 1.0 prec = self.pool.get('decimal.precision').precision_get(cr, uid, 'Account') amount = amount_unit*unit_amount or 1.0 result = round(amount, prec) if not flag: result *= -1 return {'value': { 'amount': result, 'general_account_id': a, }} return {}
467,878
def on_change_unit_amount(self, cr, uid, id, prod_id, unit_amount,company_id, unit=False, journal_id=False, context=None): if context==None: context={} uom_obj = self.pool.get('product.uom') product_obj = self.pool.get('product.product') company_obj=self.pool.get('res.company') analytic_journal_obj=self.pool.get('account.analytic.journal') product_price_type_obj = self.pool.get('product.price.type') if prod_id: result = 0.0 prod = product_obj.browse(cr, uid, prod_id) a = prod.product_tmpl_id.property_account_expense.id if not a: a = prod.categ_id.property_account_expense_categ.id if not a: raise osv.except_osv(_('Error !'), _('There is no expense account defined ' \ 'for this product: "%s" (id:%d)') % \ (prod.name, prod.id,)) if not company_id: company_id=company_obj._company_default_get(cr, uid, 'account.analytic.line', context) flag = False # Compute based on pricetype pricetype=product_price_type_obj.browse(cr, uid, company_obj.browse(cr,uid,company_id).property_valuation_price_type.id) if journal_id: journal = analytic_journal_obj.browse(cr, uid, journal_id) if journal.type == 'sale': product_price_type_ids = product_price_type_obj.search(cr, uid, [('field','=','list_price')], context) if product_price_type_ids: pricetype = product_price_type_obj.browse(cr, uid, product_price_type_ids, context)[0] # Take the company currency as the reference one if pricetype.field == 'list_price': flag = True amount_unit = prod.price_get(pricetype.field, context)[prod.id] amount = amount_unit*unit_amount or 1.0 prec = self.pool.get('decimal.precision').precision_get(cr, uid, 'Account') amount = amount_unit*unit_amount or 1.0 result = round(amount, prec) if not flag: result *= -1 return {'value': { 'amount': result, 'general_account_id': a, }} return {}
def on_change_unit_amount(self, cr, uid, id, prod_id, unit_amount,company_id, unit=False, journal_id=False, context=None): if context==None: context={} uom_obj = self.pool.get('product.uom') product_obj = self.pool.get('product.product') company_obj=self.pool.get('res.company') analytic_journal_obj=self.pool.get('account.analytic.journal') product_price_type_obj = self.pool.get('product.price.type') if prod_id: result = 0.0 prod = product_obj.browse(cr, uid, prod_id) a = prod.product_tmpl_id.property_account_expense.id if not a: a = prod.categ_id.property_account_expense_categ.id if not a: raise osv.except_osv(_('Error !'), _('There is no expense account defined ' \ 'for this product: "%s" (id:%d)') % \ (prod.name, prod.id,)) if not company_id: company_id=company_obj._company_default_get(cr, uid, 'account.analytic.line', context) flag = False # Compute based on pricetype pricetype=product_price_type_obj.browse(cr, uid, company_obj.browse(cr,uid,company_id).property_valuation_price_type.id) if journal_id: journal = analytic_journal_obj.browse(cr, uid, journal_id) if journal.type == 'sale': product_price_type_ids = product_price_type_obj.search(cr, uid, [('field','=','list_price')], context) if product_price_type_ids: pricetype = product_price_type_obj.browse(cr, uid, product_price_type_ids, context)[0] # Take the company currency as the reference one if pricetype.field == 'list_price': flag = True amount_unit = prod.price_get(pricetype.field, context)[prod.id] amount = amount_unit*unit_amount or 1.0 prec = self.pool.get('decimal.precision').precision_get(cr, uid, 'Account') amount = amount_unit*unit_amount or 1.0 result = round(amount, prec) if not flag: result *= -1 return {'value': { 'amount': result, 'general_account_id': a, }} return {}
467,879
def __create_partial_move_memory(self, move): print "CUUULLL" print move.prodlot_id.id move_memory = { 'product_id' : move.product_id.id, 'quantity' : move.product_qty, 'product_uom' : move.product_uom.id, 'prodlot_id' : move.prodlot_id.id, 'move_id' : move.id, } if move.picking_id.type == 'in': move_memory.update({ 'cost' : move.product_id.standard_price, 'currency' : move.product_id.company_id.currency_id.id, }) return move_memory
def __create_partial_move_memory(self, move): move_memory = { 'product_id' : move.product_id.id, 'quantity' : move.product_qty, 'product_uom' : move.product_uom.id, 'prodlot_id' : move.prodlot_id.id, 'move_id' : move.id, } if move.picking_id.type == 'in': move_memory.update({ 'cost' : move.product_id.standard_price, 'currency' : move.product_id.company_id.currency_id.id, }) return move_memory
467,880
def __get_active_stock_moves(self, cr, uid, context=None): move_obj = self.pool.get('stock.move') if not context: context = {} res = [] for move in move_obj.browse(cr, uid, context.get('active_ids', [])): if move.state in ('done', 'cancel'): continue res.append(self.__create_partial_move_memory(move)) print res return res
def __get_active_stock_moves(self, cr, uid, context=None): move_obj = self.pool.get('stock.move') if not context: context = {} res = [] for move in move_obj.browse(cr, uid, context.get('active_ids', [])): if move.state in ('done', 'cancel'): continue res.append(self.__create_partial_move_memory(move)) return res
467,881
def send_ping(self, cr, uid, ids, cron_mode=True, context={}): """ Send a message to OpenERP's publisher warranty server to check the validity of the contracts, get notifications, etc... @param cron_mode: If true, catch all exceptions (appropriate for usage in a cron). @type cron_mode: boolean """ try: try: result = send_ping(cr, uid) except: _logger.debug("Exception while sending a ping", exc_info=1) raise osv.except_osv(_("Error"), _("Error during communication with the publisher warranty server.")) contracts = result["contracts"] for contract in contracts: c_id = self.search(cr, uid, [("name","=",contract)])[0] date_from = contracts[contract][0] date_to = contracts[contract][1] state = contracts[contract][2] self.write(cr, uid, c_id, { "date_start": date_from, "date_stop": date_to, "state": state, }) if cron_mode and result["interval_type"] and result["interval_number"]: modosv = self.pool.get("ir.model.data") sched_id = modosv.get_object_reference(cr, uid, "base", "ir_cron_ping_scheduler")[1] cronosv = self.pool.get("ir.cron") cronosv.write(cr, uid, sched_id, { "interval_type": result["interval_type"], "interval_number": result["interval_number"], }) self.pool.get('res.log').create(cr, uid, { 'name': repr(result["message"]), 'res_model': "Maintenance Notifications", "read": True, "broadcast": True, }, context=context ) except: _logger.debug("Exception while interpreting the result of a ping", exc_info=1) if cron_mode: return False # same as before else: raise return True
def send_ping(self, cr, uid, ids, cron_mode=True, context={}): """ Send a message to OpenERP's publisher warranty server to check the validity of the contracts, get notifications, etc... @param cron_mode: If true, catch all exceptions (appropriate for usage in a cron). @type cron_mode: boolean """ try: try: result = send_ping(cr, uid) except: _logger.debug("Exception while sending a ping", exc_info=1) raise osv.except_osv(_("Error"), _("Error during communication with the publisher warranty server.")) contracts = result["contracts"] for contract in contracts: c_id = self.search(cr, uid, [("name","=",contract)])[0] date_from = contracts[contract][0] date_to = contracts[contract][1] state = contracts[contract][2] self.write(cr, uid, c_id, { "date_start": date_from, "date_stop": date_to, "state": state, }) if cron_mode and result["interval_type"] and result["interval_number"]: modosv = self.pool.get("ir.model.data") sched_id = modosv.get_object_reference(cr, uid, "base", "ir_cron_ping_scheduler")[1] cronosv = self.pool.get("ir.cron") cronosv.write(cr, uid, sched_id, { "interval_type": result["interval_type"], "interval_number": result["interval_number"], }) self.pool.get('res.log').create(cr, uid, { 'name': result["message"] if isinstance(result["message"], str) or \ isinstance(result["message"], unicode) else repr(result["message"]), 'res_model': "Maintenance Notifications", "read": True, "broadcast": True, }, context=context ) except: _logger.debug("Exception while interpreting the result of a ping", exc_info=1) if cron_mode: return False # same as before else: raise return True
467,882
def create_move_from_st_line(self, cr, uid, st_line_id, company_currency_id, st_line_number, context=None): if context is None: context = {} res_currency_obj = self.pool.get('res.currency') 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') st_line = account_bank_statement_line_obj.browse(cr, uid, st_line_id, context=context) st = st_line.statement_id
def create_move_from_st_line(self, cr, uid, st_line_id, company_currency_id, st_line_number, context=None): if context is None: context = {} res_currency_obj = self.pool.get('res.currency') 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') st_line = account_bank_statement_line_obj.browse(cr, uid, st_line_id, context=context) st = st_line.statement_id
467,883
def create_move_from_st_line(self, cr, uid, st_line_id, company_currency_id, st_line_number, context=None): if context is None: context = {} res_currency_obj = self.pool.get('res.currency') 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') st_line = account_bank_statement_line_obj.browse(cr, uid, st_line_id, context=context) st = st_line.statement_id
def create_move_from_st_line(self, cr, uid, st_line_id, company_currency_id, st_line_number, context=None): if context is None: context = {} res_currency_obj = self.pool.get('res.currency') 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') st_line = account_bank_statement_line_obj.browse(cr, uid, st_line_id, context=context) st = st_line.statement_id
467,884
def create_move_from_st_line(self, cr, uid, st_line_id, company_currency_id, st_line_number, context=None): if context is None: context = {} res_currency_obj = self.pool.get('res.currency') 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') st_line = account_bank_statement_line_obj.browse(cr, uid, st_line_id, context=context) st = st_line.statement_id
def create_move_from_st_line(self, cr, uid, st_line_id, company_currency_id, st_line_number, context=None): if context is None: context = {} res_currency_obj = self.pool.get('res.currency') 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') st_line = account_bank_statement_line_obj.browse(cr, uid, st_line_id, context=context) st = st_line.statement_id
467,885
def create_move_from_st_line(self, cr, uid, st_line_id, company_currency_id, st_line_number, context=None): if context is None: context = {} res_currency_obj = self.pool.get('res.currency') 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') st_line = account_bank_statement_line_obj.browse(cr, uid, st_line_id, context=context) st = st_line.statement_id
def create_move_from_st_line(self, cr, uid, st_line_id, company_currency_id, st_line_number, context=None): if context is None: context = {} res_currency_obj = self.pool.get('res.currency') 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') st_line = account_bank_statement_line_obj.browse(cr, uid, st_line_id, context=context) st = st_line.statement_id
467,886
def on_change_user_id(self, cr, uid, ids,user_id, account_id, unit_amount=0): res = {} if not (user_id): #avoid a useless call to super return res
def on_change_user_id(self, cr, uid, ids,user_id, account_id, unit_amount=0): res = {} if not (user_id): #avoid a useless call to super return res
467,887
def onchange_filter(self, cr, uid, ids, filter='filter_no', fiscalyear_id=False, context=None): res = {} if filter == 'filter_no': res['value'] = {'period_from': False, 'period_to': False, 'date_from': False ,'date_to': False} if filter == 'filter_date': res['value'] = {'period_from': False, 'period_to': False, 'date_from': time.strftime('%Y-01-01'), 'date_to': time.strftime('%Y-%m-%d')} if filter == 'filter_period' and fiscalyear_id: start_period = end_period = False cr.execute('SELECT p.id FROM account_fiscalyear AS f \ LEFT JOIN account_period AS p on p.fiscalyear_id=f.id \ WHERE p.id IN \ (SELECT id FROM account_period \ WHERE p.fiscalyear_id = f.id \ AND p.date_start IN \ (SELECT max(date_start) from account_period WHERE p.fiscalyear_id = f.id)\ OR p.date_stop IN \ (SELECT min(date_stop) from account_period WHERE p.fiscalyear_id = f.id)) \ AND f.id = ' + str(fiscalyear_id) + ' ') periods = [i[0] for i in cr.fetchall()] if periods: start_period = periods[0] end_period = periods[1] res['value'] = {'period_from': start_period, 'period_to': end_period, 'date_from': False, 'date_to': False} return res
def onchange_filter(self, cr, uid, ids, filter='filter_no', fiscalyear_id=False, context=None): res = {} if filter == 'filter_no': res['value'] = {'period_from': False, 'period_to': False, 'date_from': False ,'date_to': False} if filter == 'filter_date': res['value'] = {'period_from': False, 'period_to': False, 'date_from': time.strftime('%Y-01-01'), 'date_to': time.strftime('%Y-%m-%d')} if filter == 'filter_period' and fiscalyear_id: start_period = end_period = False cr.execute('SELECT p.id FROM account_fiscalyear AS f \ LEFT JOIN account_period AS p on p.fiscalyear_id=f.id \ WHERE p.id IN \ (SELECT id FROM account_period \ WHERE p.fiscalyear_id = f.id \ AND p.date_start IN \ (SELECT max(date_start) from account_period WHERE p.fiscalyear_id = f.id)\ OR p.date_stop IN \ (SELECT min(date_stop) from account_period WHERE p.fiscalyear_id = f.id)) \ AND f.id = ' + str(fiscalyear_id) + ' order by p.date_start') periods = [i[0] for i in cr.fetchall()] if periods: start_period = periods[0] end_period = periods[1] res['value'] = {'period_from': start_period, 'period_to': end_period, 'date_from': False, 'date_to': False} return res
467,888
def create_picking(self, cr, uid, ids, context={}): """Create a picking for each order and validate it.""" picking_obj = self.pool.get('stock.picking') pick_name=self.pool.get('ir.sequence').get(cr, uid, 'stock.picking.out') orders = self.browse(cr, uid, ids, context) for order in orders: if not order.picking_id: new = True picking_id = picking_obj.create(cr, uid, { 'name':pick_name, 'origin': order.name, 'type': 'out', 'state': 'draft', 'move_type': 'direct', 'note': 'POS notes ' + (order.note or ""), 'invoice_state': 'none', 'auto_picking': True, 'pos_order': order.id, }) self.write(cr, uid, [order.id], {'picking_id': picking_id}) else: picking_id = order.picking_id.id picking_obj.write(cr, uid, [picking_id], {'auto_picking': True}) picking = picking_obj.browse(cr, uid, [picking_id], context)[0] new = False
def create_picking(self, cr, uid, ids, context={}): """Create a picking for each order and validate it.""" picking_obj = self.pool.get('stock.picking') pick_name=self.pool.get('ir.sequence').get(cr, uid, 'stock.picking.out') orders = self.browse(cr, uid, ids, context) for order in orders: if not order.picking_id: new = True picking_id = picking_obj.create(cr, uid, { 'name':pick_name, 'origin': order.name, 'type': 'out', 'state': 'draft', 'move_type': 'direct', 'note': 'POS notes ' + (order.note or ""), 'invoice_state': 'none', 'auto_picking': True, 'pos_order': order.id, }) self.write(cr, uid, [order.id], {'picking_id': picking_id}) else: picking_id = order.picking_id.id picking_obj.write(cr, uid, [picking_id], {'auto_picking': True}) picking = picking_obj.browse(cr, uid, [picking_id], context)[0] new = False
467,889
def write(self, cr, uid, ids, vals, context=None): result = super(Wiki,self).write(cr, uid, ids, vals, context) history = self.pool.get('wiki.wiki.history') if vals.get('text_area'): for id in ids: res = { 'minor_edit':vals.get('minor_edit', True), 'text_area':vals.get('text_area',''), 'write_uid':uid, 'wiki_id' : id, 'summary':vals.get('summary','') } history.create(cr, uid, res) return result
def write(self, cr, uid, ids, vals, context=None): result = super(Wiki,self).write(cr, uid, ids, vals, context) history = self.pool.get('wiki.wiki.history') if vals.get('text_area'): for id in ids: res = { 'minor_edit':vals.get('minor_edit', True), 'text_area':vals.get('text_area',''), 'write_uid':uid, 'wiki_id' : id, 'summary':vals.get('summary','') } history.create(cr, uid, res) return result
467,890
def fix_xa0(s): if s == '\xa0': return '\xc2\xa0' return s
def fix_xa0(s): if s == '\xa0': return '\xc2\xa0' return s
467,891
def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False): if not context: context = context if not context.get('planning'): return super(project_task,self).search(cr, user, args, offset, limit, order, context) cr.execute(" SELECT t.id, t.name \ from project_task t \ join report_account_analytic_planning_line l on (l.id = t.planning_line_id )\ where l.planning_id=%s",(context.get('planning'),)) ids = map(lambda x: x[0], cr.fetchall()) return ids
def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False): if not context: context = {} if not context.get('planning'): return super(project_task,self).search(cr, user, args, offset, limit, order, context) cr.execute(" SELECT t.id, t.name \ from project_task t \ join report_account_analytic_planning_line l on (l.id = t.planning_line_id )\ where l.planning_id=%s",(context.get('planning'),)) ids = map(lambda x: x[0], cr.fetchall()) return ids
467,892
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)
467,893
def __init__(self, model, action, **kwargs): self.model = model self.action = action super(Workflow, self).__init__(**kwargs)
def __init__(self, model, action, ref=None, **kwargs): self.model = model self.action = action super(Workflow, self).__init__(**kwargs)
467,894
def __init__(self, *args, **kwargs): super(Ref, self).__init__(*args, **kwargs)
def __init__(self, expr="False", *args, **kwargs): self.expr = expr super(Ref, self).__init__(*args, **kwargs)
467,895
def action_open_window(self, cr, uid, ids, context=None): """ This function Open action move line window on given period and Journal/Payment Mode @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: account move journal’s ID or list of IDs @return: dictionary of Open action move line window on given period and Journal/Payment Mode """ period_pool = self.pool.get('account.journal.period') data_pool = self.pool.get('ir.model.data') journal_pool = self.pool.get('account.journal') if context is None: context = {} journal_id = self._get_journal(cr, uid, context) period_id = self._get_period(cr, uid, context) menu = self.pool.get('ir.ui.menu').browse(cr, uid, context.get('active_id')) name = context.get('title', menu.name) result = data_pool._get_id(cr, uid, 'account_voucher', 'view_voucher_filter_new') res_id = data_pool.browse(cr, uid, result, context=context).res_id res = { 'domain':menu.action.domain, 'name': name, 'view_type': 'form', 'view_mode': 'tree,graph,form', 'res_model': 'account.voucher', 'view_id': False, 'context': "{'journal_id': %d, 'search_default_journal_id':%d, 'search_default_period_id':%d, 'partner_id':%s}" % (journal_id, journal_id, period_id, context.get('partner_id',False)), 'type': 'ir.actions.act_window', 'search_view_id': res_id } return res
def action_open_window(self, cr, uid, ids, context=None): """ This function Open action move line window on given period and Journal/Payment Mode @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: account move journal’s ID or list of IDs @return: dictionary of Open action move line window on given period and Journal/Payment Mode """ period_pool = self.pool.get('account.journal.period') data_pool = self.pool.get('ir.model.data') journal_pool = self.pool.get('account.journal') if context is None: context = {} journal_id = self._get_journal(cr, uid, context) period_id = self._get_period(cr, uid, context) menu = self.pool.get('ir.ui.menu').browse(cr, uid, context.get('active_id')) name = context.get('title', menu.name) result = data_pool._get_id(cr, uid, 'account_voucher', 'view_voucher_filter_new') res_id = data_pool.browse(cr, uid, result, context=context).res_id res = { 'domain':menu.action.domain, 'name': name, 'view_type': 'form', 'view_mode': 'tree,graph,form', 'res_model': 'account.voucher', 'view_id': False, 'context': "{'search_default_journal_id':%d, 'search_default_period_id':%d, 'partner_id':%s}" % (journal_id, period_id, context.get('partner_id',False)), 'type': 'ir.actions.act_window', 'search_view_id': res_id } return res
467,896
def _get_photo(self, cr, uid, context=None):
def _get_photo(self, cr, uid, context=None):
467,897
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. """
467,898
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. """
467,899