bugged
stringlengths
4
228k
fixed
stringlengths
0
96.3M
__index_level_0__
int64
0
481k
def para_style_get(self, node): style = False if node.get('style'): if node.get('style') in self.styles: styles = reportlab.lib.styles.getSampleStyleSheet() sname = node.get('style') style = reportlab.lib.styles.ParagraphStyle(sname, styles["Normal"], **self.styles[sname]) else: sys.stderr.write('Warning: style not found, %s - setting default!\n' % (node.get('style'),) ) if not style: styles = reportlab.lib.styles.getSampleStyleSheet() style = styles['Normal'] style.__dict__.update(self._para_style_update(node)) return style
def para_style_get(self, node): style = False if node.get('style'): if node.get('style') in self.styles: styles = reportlab.lib.styles.getSampleStyleSheet() sname = node.get('style') style = reportlab.lib.styles.ParagraphStyle(sname, styles["Normal"], **self.styles[sname]) else: sys.stderr.write('Warning: style not found, %s - setting default!\n' % (node.get('style'),) ) if not style: style = self.default_style['Normal'] para_update = self._para_style_update(node) if para_update: style = copy.deepcopy(style) style.__dict__.update(para_update) return style
468,600
def fields_view_get(self, cr, uid, view_id=None, view_type=False, context=None, toolbar=False, submenu=False): if not view_id and context.get('invoice_type', False): mod_obj = self.pool.get('ir.model.data') if context.get('invoice_type') in ('out_invoice', 'out_refund'): result = mod_obj.get_object_reference(cr, uid, 'account_voucher', 'view_vendor_receipt_form') else: result = mod_obj.get_object_reference(cr, uid, 'account_voucher', 'view_vendor_payment_form') result = result and result[1] or False view_id = result res = super(account_voucher, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu) doc = etree.XML(res['arch']) nodes = doc.xpath("//field[@name='partner_id']") if context.get('type', 'sale') in ('purchase', 'payment'): for node in nodes: node.set('domain', "[('supplier', '=', True)]") res['arch'] = etree.tostring(doc) return res
def fields_view_get(self, cr, uid, view_id=None, view_type=False, context=None, toolbar=False, submenu=False): if not view_id: mod_obj = self.pool.get('ir.model.data') if context.get('invoice_type') in ('out_invoice', 'out_refund'): result = mod_obj.get_object_reference(cr, uid, 'account_voucher', 'view_vendor_receipt_form') else: result = mod_obj.get_object_reference(cr, uid, 'account_voucher', 'view_vendor_payment_form') result = result and result[1] or False view_id = result res = super(account_voucher, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu) doc = etree.XML(res['arch']) nodes = doc.xpath("//field[@name='partner_id']") if context.get('type', 'sale') in ('purchase', 'payment'): for node in nodes: node.set('domain', "[('supplier', '=', True)]") res['arch'] = etree.tostring(doc) return res
468,601
def fields_view_get(self, cr, uid, view_id=None, view_type=False, context=None, toolbar=False, submenu=False): if not view_id and context.get('invoice_type', False): mod_obj = self.pool.get('ir.model.data') if context.get('invoice_type') in ('out_invoice', 'out_refund'): result = mod_obj.get_object_reference(cr, uid, 'account_voucher', 'view_vendor_receipt_form') else: result = mod_obj.get_object_reference(cr, uid, 'account_voucher', 'view_vendor_payment_form') result = result and result[1] or False view_id = result res = super(account_voucher, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu) doc = etree.XML(res['arch']) nodes = doc.xpath("//field[@name='partner_id']") if context.get('type', 'sale') in ('purchase', 'payment'): for node in nodes: node.set('domain', "[('supplier', '=', True)]") res['arch'] = etree.tostring(doc) return res
def fields_view_get(self, cr, uid, view_id=None, view_type=False, context=None, toolbar=False, submenu=False): if not view_id and context.get('invoice_type', False): mod_obj = self.pool.get('ir.model.data') if context.get('invoice_type', False) in ('out_invoice', 'out_refund') or context.get('line_type', False) == 'customer': result = mod_obj.get_object_reference(cr, uid, 'account_voucher', 'view_vendor_receipt_form') else: result = mod_obj.get_object_reference(cr, uid, 'account_voucher', 'view_vendor_payment_form') result = result and result[1] or False view_id = result res = super(account_voucher, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu) doc = etree.XML(res['arch']) nodes = doc.xpath("//field[@name='partner_id']") if context.get('type', 'sale') in ('purchase', 'payment'): for node in nodes: node.set('domain', "[('supplier', '=', True)]") res['arch'] = etree.tostring(doc) return res
468,602
def _create_invoice(obj, cr, uid, data, context): if data['form'].get('new_picking', False): data['id'] = data['form']['new_picking'] data['ids'] = [data['form']['new_picking']] pool = pooler.get_pool(cr.dbname) picking_obj = pooler.get_pool(cr.dbname).get('stock.picking') mod_obj = pool.get('ir.model.data') act_obj = pool.get('ir.actions.act_window') type = data['form']['type'] context['date_inv'] = data['form']['invoice_date'] res = picking_obj.action_invoice_create(cr, uid, data['ids'], journal_id = data['form']['journal_id'], group=data['form']['group'], type=type, context= context) invoice_ids = res.values() if not invoice_ids: raise wizard.except_wizard(_('Error'), _('Invoice is not created')) if type == 'out_invoice': xml_id = 'action_invoice_tree5' elif type == 'in_invoice': xml_id = 'action_invoice_tree8' elif type == 'out_refund': xml_id = 'action_invoice_tree10' else: xml_id = 'action_invoice_tree12' result = mod_obj._get_id(cr, uid, 'account', xml_id) id = mod_obj.read(cr, uid, result, ['res_id']) result = act_obj.read(cr, uid, id['res_id']) result['res_id'] = invoice_ids return result
def _create_invoice(obj, cr, uid, data, context): if data['form'].get('new_picking', False): data['id'] = data['form']['new_picking'] data['ids'] = [data['form']['new_picking']] pool = pooler.get_pool(cr.dbname) picking_obj = pooler.get_pool(cr.dbname).get('stock.picking') mod_obj = pool.get('ir.model.data') act_obj = pool.get('ir.actions.act_window') type = data['form']['type'] context['date_inv'] = data['form']['invoice_date'] res = picking_obj.action_invoice_create(cr, uid, data['ids'], journal_id = data['form']['journal_id'], group=data['form']['group'], type=type, context= context) invoice_ids = res.values() if not invoice_ids: raise wizard.except_wizard(_('Error'), _('Invoice is not created')) if type == 'out_invoice': xml_id = 'action_invoice_tree1' elif type == 'in_invoice': xml_id = 'action_invoice_tree8' elif type == 'out_refund': xml_id = 'action_invoice_tree10' else: xml_id = 'action_invoice_tree12' result = mod_obj._get_id(cr, uid, 'account', xml_id) id = mod_obj.read(cr, uid, result, ['res_id']) result = act_obj.read(cr, uid, id['res_id']) result['res_id'] = invoice_ids return result
468,603
def _create_invoice(obj, cr, uid, data, context): if data['form'].get('new_picking', False): data['id'] = data['form']['new_picking'] data['ids'] = [data['form']['new_picking']] pool = pooler.get_pool(cr.dbname) picking_obj = pooler.get_pool(cr.dbname).get('stock.picking') mod_obj = pool.get('ir.model.data') act_obj = pool.get('ir.actions.act_window') type = data['form']['type'] context['date_inv'] = data['form']['invoice_date'] res = picking_obj.action_invoice_create(cr, uid, data['ids'], journal_id = data['form']['journal_id'], group=data['form']['group'], type=type, context= context) invoice_ids = res.values() if not invoice_ids: raise wizard.except_wizard(_('Error'), _('Invoice is not created')) if type == 'out_invoice': xml_id = 'action_invoice_tree5' elif type == 'in_invoice': xml_id = 'action_invoice_tree8' elif type == 'out_refund': xml_id = 'action_invoice_tree10' else: xml_id = 'action_invoice_tree12' result = mod_obj._get_id(cr, uid, 'account', xml_id) id = mod_obj.read(cr, uid, result, ['res_id']) result = act_obj.read(cr, uid, id['res_id']) result['res_id'] = invoice_ids return result
def _create_invoice(obj, cr, uid, data, context): if data['form'].get('new_picking', False): data['id'] = data['form']['new_picking'] data['ids'] = [data['form']['new_picking']] pool = pooler.get_pool(cr.dbname) picking_obj = pooler.get_pool(cr.dbname).get('stock.picking') mod_obj = pool.get('ir.model.data') act_obj = pool.get('ir.actions.act_window') type = data['form']['type'] context['date_inv'] = data['form']['invoice_date'] res = picking_obj.action_invoice_create(cr, uid, data['ids'], journal_id = data['form']['journal_id'], group=data['form']['group'], type=type, context= context) invoice_ids = res.values() if not invoice_ids: raise wizard.except_wizard(_('Error'), _('Invoice is not created')) if type == 'out_invoice': xml_id = 'action_invoice_tree5' elif type == 'in_invoice': xml_id = 'action_invoice_tree2' elif type == 'out_refund': xml_id = 'action_invoice_tree10' else: xml_id = 'action_invoice_tree12' result = mod_obj._get_id(cr, uid, 'account', xml_id) id = mod_obj.read(cr, uid, result, ['res_id']) result = act_obj.read(cr, uid, id['res_id']) result['res_id'] = invoice_ids return result
468,604
def _create_invoice(obj, cr, uid, data, context): if data['form'].get('new_picking', False): data['id'] = data['form']['new_picking'] data['ids'] = [data['form']['new_picking']] pool = pooler.get_pool(cr.dbname) picking_obj = pooler.get_pool(cr.dbname).get('stock.picking') mod_obj = pool.get('ir.model.data') act_obj = pool.get('ir.actions.act_window') type = data['form']['type'] context['date_inv'] = data['form']['invoice_date'] res = picking_obj.action_invoice_create(cr, uid, data['ids'], journal_id = data['form']['journal_id'], group=data['form']['group'], type=type, context= context) invoice_ids = res.values() if not invoice_ids: raise wizard.except_wizard(_('Error'), _('Invoice is not created')) if type == 'out_invoice': xml_id = 'action_invoice_tree5' elif type == 'in_invoice': xml_id = 'action_invoice_tree8' elif type == 'out_refund': xml_id = 'action_invoice_tree10' else: xml_id = 'action_invoice_tree12' result = mod_obj._get_id(cr, uid, 'account', xml_id) id = mod_obj.read(cr, uid, result, ['res_id']) result = act_obj.read(cr, uid, id['res_id']) result['res_id'] = invoice_ids return result
def _create_invoice(obj, cr, uid, data, context): if data['form'].get('new_picking', False): data['id'] = data['form']['new_picking'] data['ids'] = [data['form']['new_picking']] pool = pooler.get_pool(cr.dbname) picking_obj = pooler.get_pool(cr.dbname).get('stock.picking') mod_obj = pool.get('ir.model.data') act_obj = pool.get('ir.actions.act_window') type = data['form']['type'] context['date_inv'] = data['form']['invoice_date'] res = picking_obj.action_invoice_create(cr, uid, data['ids'], journal_id = data['form']['journal_id'], group=data['form']['group'], type=type, context= context) invoice_ids = res.values() if not invoice_ids: raise wizard.except_wizard(_('Error'), _('Invoice is not created')) if type == 'out_invoice': xml_id = 'action_invoice_tree5' elif type == 'in_invoice': xml_id = 'action_invoice_tree8' elif type == 'out_refund': xml_id = 'action_invoice_tree3' else: xml_id = 'action_invoice_tree12' result = mod_obj._get_id(cr, uid, 'account', xml_id) id = mod_obj.read(cr, uid, result, ['res_id']) result = act_obj.read(cr, uid, id['res_id']) result['res_id'] = invoice_ids return result
468,605
def _create_invoice(obj, cr, uid, data, context): if data['form'].get('new_picking', False): data['id'] = data['form']['new_picking'] data['ids'] = [data['form']['new_picking']] pool = pooler.get_pool(cr.dbname) picking_obj = pooler.get_pool(cr.dbname).get('stock.picking') mod_obj = pool.get('ir.model.data') act_obj = pool.get('ir.actions.act_window') type = data['form']['type'] context['date_inv'] = data['form']['invoice_date'] res = picking_obj.action_invoice_create(cr, uid, data['ids'], journal_id = data['form']['journal_id'], group=data['form']['group'], type=type, context= context) invoice_ids = res.values() if not invoice_ids: raise wizard.except_wizard(_('Error'), _('Invoice is not created')) if type == 'out_invoice': xml_id = 'action_invoice_tree5' elif type == 'in_invoice': xml_id = 'action_invoice_tree8' elif type == 'out_refund': xml_id = 'action_invoice_tree10' else: xml_id = 'action_invoice_tree12' result = mod_obj._get_id(cr, uid, 'account', xml_id) id = mod_obj.read(cr, uid, result, ['res_id']) result = act_obj.read(cr, uid, id['res_id']) result['res_id'] = invoice_ids return result
def _create_invoice(obj, cr, uid, data, context): if data['form'].get('new_picking', False): data['id'] = data['form']['new_picking'] data['ids'] = [data['form']['new_picking']] pool = pooler.get_pool(cr.dbname) picking_obj = pooler.get_pool(cr.dbname).get('stock.picking') mod_obj = pool.get('ir.model.data') act_obj = pool.get('ir.actions.act_window') type = data['form']['type'] context['date_inv'] = data['form']['invoice_date'] res = picking_obj.action_invoice_create(cr, uid, data['ids'], journal_id = data['form']['journal_id'], group=data['form']['group'], type=type, context= context) invoice_ids = res.values() if not invoice_ids: raise wizard.except_wizard(_('Error'), _('Invoice is not created')) if type == 'out_invoice': xml_id = 'action_invoice_tree5' elif type == 'in_invoice': xml_id = 'action_invoice_tree8' elif type == 'out_refund': xml_id = 'action_invoice_tree10' else: xml_id = 'action_invoice_tree4' result = mod_obj._get_id(cr, uid, 'account', xml_id) id = mod_obj.read(cr, uid, result, ['res_id']) result = act_obj.read(cr, uid, id['res_id']) result['res_id'] = invoice_ids return result
468,606
def make_po(self, cr, uid, ids, context={}): """ Make purchase order from procurement @return: New created Purchase Orders procurement wise """ res = {} company = self.pool.get('res.users').browse(cr, uid, uid, context).company_id partner_obj = self.pool.get('res.partner') uom_obj = self.pool.get('product.uom') pricelist_obj = self.pool.get('product.pricelist') prod_obj = self.pool.get('product.product') acc_pos_obj = self.pool.get('account.fiscal.position') po_obj = self.pool.get('purchase.order') for procurement in self.browse(cr, uid, ids): res_id = procurement.move_id.id partner_list = sorted([(partner_id.sequence, partner_id) for partner_id in procurement.product_id.seller_ids if partner_id]) partner_rec = partner_list and partner_list[0] and partner_list[0][1] or False partner = partner_rec.name or False partner_id = partner_rec.id or False address_id = partner_obj.address_get(cr, uid, [partner_id], ['delivery'])['delivery'] pricelist_id = partner.property_product_pricelist_purchase.id
def make_po(self, cr, uid, ids, context={}): """ Make purchase order from procurement @return: New created Purchase Orders procurement wise """ res = {} company = self.pool.get('res.users').browse(cr, uid, uid, context).company_id partner_obj = self.pool.get('res.partner') uom_obj = self.pool.get('product.uom') pricelist_obj = self.pool.get('product.pricelist') prod_obj = self.pool.get('product.product') acc_pos_obj = self.pool.get('account.fiscal.position') po_obj = self.pool.get('purchase.order') for procurement in self.browse(cr, uid, ids): res_id = procurement.move_id.id partner_list = sorted([(partner_id.sequence, partner_id) for partner_id in procurement.product_id.seller_ids if partner_id]) partner_rec = partner_list and partner_list[0] and partner_list[0][1] or False partner = partner_rec.name or False partner_id = partner.id or False address_id = partner_obj.address_get(cr, uid, [partner_id], ['delivery'])['delivery'] pricelist_id = partner.property_product_pricelist_purchase.id
468,607
def action_apply(self, cr, uid, ids, context=None): """ This converts lead to opportunity and opens Opportunity view @param ids: ids of the leads to convert to opportunities
def action_apply(self, cr, uid, ids, context=None): """ This converts lead to opportunity and opens Opportunity view @param ids: ids of the leads to convert to opportunities
468,608
def init(self, cr): """ Display Est.Revenue , Average Probability ,Est.Revenue Probability @param cr: the current row, from the database cursor """
def init(self, cr): """ Display Est.Revenue , Average Probability ,Est.Revenue Probability @param cr: the current row, from the database cursor """
468,609
def do_open(self, cr, uid, ids, *args): tasks= self.browse(cr,uid,ids) for t in tasks: self.write(cr, uid, [t.id], {'state': 'open', 'date_start': time.strftime('%Y-%m-%d %H:%M:%S'),}) message = _('Task ') + " '" + t.name + "' "+ _("is Open.") self.log(cr, uid, t.id, message) return True
def do_open(self, cr, uid, ids, *args): tasks= self.browse(cr,uid,ids) for t in tasks: data = {'state': 'open'} if not t.date_start: data['date_start'] = time.strftime('%Y-%m-%d %H:%M:%S') self.write(cr, uid, [t.id], data) message = _('Task ') + " '" + t.name + "' "+ _("is Open.") self.log(cr, uid, t.id, message) return True
468,610
def set_context(self, objects, data, ids, report_type=None): self.borne_date = self.get_min_date(data['form']) new_ids = [] if (data['model'] == 'account.account'): new_ids = 'active_ids' in data['form']['context'] and data['form']['context']['active_ids'] or [] else: new_ids.append(data['form']['chart_account_id']) objects = self.pool.get('account.account').browse(self.cr, self.uid, new_ids) super(general_ledger, self).set_context(objects, data, new_ids, report_type)
def set_context(self, objects, data, ids, report_type=None): self.borne_date = self.get_min_date(data['form']) new_ids = ids if (data['model'] == 'ir.ui.menu'): new_ids = [data['form']['chart_account_id']] objects = self.pool.get('account.account').browse(self.cr, self.uid, new_ids) super(general_ledger, self).set_context(objects, data, new_ids, report_type)
468,611
def consume_moves(self, cr, uid, ids, quantity, location_id=False, location_dest_id=False, consume=True, context=None): if not context: context = {} if quantity <= 0: raise osv.except_osv(_('Warning!'), _('Please provide Proper Quantity !'))
def consume_moves(self, cr, uid, ids, quantity, location_id=False, location_dest_id=False, consume=True, context=None): if not context: context = {} if quantity <= 0: raise osv.except_osv(_('Warning!'), _('Please provide Proper Quantity !'))
468,612
def consume_moves(self, cr, uid, ids, quantity, location_id=False, location_dest_id=False, consume=True, context=None): if not context: context = {} if quantity <= 0: raise osv.except_osv(_('Warning!'), _('Please provide Proper Quantity !'))
def consume_moves(self, cr, uid, ids, quantity, location_id=False, location_dest_id=False, consume=True, context=None): if not context: context = {} if quantity <= 0: raise osv.except_osv(_('Warning!'), _('Please provide Proper Quantity !'))
468,613
def consume_moves(self, cr, uid, ids, quantity, location_id=False, location_dest_id=False, consume=True, context=None): if not context: context = {} if quantity <= 0: raise osv.except_osv(_('Warning!'), _('Please provide Proper Quantity !'))
def consume_moves(self, cr, uid, ids, quantity, location_id=False, location_dest_id=False, consume=True, context=None): if not context: context = {} if quantity <= 0: raise osv.except_osv(_('Warning!'), _('Please provide Proper Quantity !'))
468,614
def consume_moves(self, cr, uid, ids, quantity, location_id=False, location_dest_id=False, consume=True, context=None): if not context: context = {} if quantity <= 0: raise osv.except_osv(_('Warning!'), _('Please provide Proper Quantity !'))
def consume_moves(self, cr, uid, ids, quantity, location_id=False, location_dest_id=False, consume=True, context=None): if not context: context = {} if quantity <= 0: raise osv.except_osv(_('Warning!'), _('Please provide Proper Quantity !'))
468,615
def action_move(self, cr, uid, ids, context=None): move_obj = self.pool.get('stock.move') picking_obj = self.pool.get('stock.picking') account_move_obj = self.pool.get('account.move') for act in self.read(cr, uid, ids): move_lines = move_obj.browse(cr, uid, act['move_ids']) for line in move_lines: if line.picking_id: picking_obj.write(cr, uid, [line.picking_id.id], {'move_lines': [(1, line.id, {'picking_id': act['picking_id']})]}) picking_obj.write(cr, uid, [act['picking_id']], {'move_lines': [(1, line.id, {'picking_id': act['picking_id']})]}) old_picking = picking_obj.read(cr, uid, [line.picking_id.id])[0] if not len(old_picking['move_lines']): picking_obj.write(cr, uid, [old_picking['id']], {'state': 'done'}) else: raise osv.except_osv(_('UserError'), _('You can not create new moves.')) return {'type': 'ir.actions.act_window_close'}
def action_move(self, cr, uid, ids, context=None): move_obj = self.pool.get('stock.move') picking_obj = self.pool.get('stock.picking') account_move_obj = self.pool.get('account.move') for act in self.read(cr, uid, ids): move_lines = move_obj.browse(cr, uid, act['move_ids']) for line in move_lines: if line.picking_id: picking_obj.write(cr, uid, [line.picking_id.id], {'move_lines': [(1, line.id, {'picking_id': act['picking_id']})]}) picking_obj.write(cr, uid, [act['picking_id']], {'move_lines': [(1, line.id, {'picking_id': act['picking_id']})]}) old_picking = picking_obj.read(cr, uid, [line.picking_id.id])[0] if not len(old_picking['move_lines']): picking_obj.write(cr, uid, [old_picking['id']], {'state': 'done'}) else: raise osv.except_osv(_('UserError'), _('You can not create new moves.')) return {'type': 'ir.actions.act_window_close'}
468,616
def fields_get(self, cr, uid, fields=None, context=None): res = super(payment_line, self).fields_get(cr, uid, fields, context) if 'communication2' in res: res['communication2'].setdefault('states', {}) res['communication2']['states']['structured'] = [('readonly', True)] res['communication2']['states']['normal'] = [('readonly', False)] return res
def fields_get(self, cr, uid, fields=None, context=None): res = super(payment_line, self).fields_get(cr, uid, fields, context) if 'communication2' in res: res['communication2'].setdefault('states', {}) res['communication2']['states']['structured'] = [('readonly', True)] res['communication2']['states']['normal'] = [('readonly', False)] return res
468,617
def _get_lines(self, form): res = [] self.cr.execute('SELECT DISTINCT res_partner.id AS id,\ res_partner.name AS name \ FROM res_partner,account_move_line AS l, account_account\ WHERE (l.account_id=account_account.id) \ AND ((reconcile_id IS NULL)\ OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\ AND (l.partner_id=res_partner.id)\ AND ' + self.query + ' \ ORDER BY res_partner.name', (self.date_from,)) partners = self.cr.dictfetchall() ## mise a 0 du total for i in range(7): self.total_account.append(0) # # Build a string like (1,2,3) for easy use in SQL query partner_ids = [x['id'] for x in partners] if not partner_ids: return [] # This dictionary will store the debit-credit for all partners, using partner_id as key. move_state = ['draft','posted'] if self.target_move == 'posted': move_state = ['posted']
def _get_lines(self, form): res = [] self.cr.execute('SELECT DISTINCT res_partner.id AS id,\ res_partner.name AS name \ FROM res_partner,account_move_line AS l, account_account, account_move am\ WHERE (l.account_id=account_account.id) \ AND ((reconcile_id IS NULL)\ OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\ AND (l.partner_id=res_partner.id)\ AND ' + self.query + ' \ ORDER BY res_partner.name', (self.date_from,)) partners = self.cr.dictfetchall() ## mise a 0 du total for i in range(7): self.total_account.append(0) # # Build a string like (1,2,3) for easy use in SQL query partner_ids = [x['id'] for x in partners] if not partner_ids: return [] # This dictionary will store the debit-credit for all partners, using partner_id as key. move_state = ['draft','posted'] if self.target_move == 'posted': move_state = ['posted']
468,618
def _get_lines(self, form): res = [] self.cr.execute('SELECT DISTINCT res_partner.id AS id,\ res_partner.name AS name \ FROM res_partner,account_move_line AS l, account_account\ WHERE (l.account_id=account_account.id) \ AND ((reconcile_id IS NULL)\ OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\ AND (l.partner_id=res_partner.id)\ AND ' + self.query + ' \ ORDER BY res_partner.name', (self.date_from,)) partners = self.cr.dictfetchall() ## mise a 0 du total for i in range(7): self.total_account.append(0) # # Build a string like (1,2,3) for easy use in SQL query partner_ids = [x['id'] for x in partners] if not partner_ids: return [] # This dictionary will store the debit-credit for all partners, using partner_id as key. move_state = ['draft','posted'] if self.target_move == 'posted': move_state = ['posted']
def _get_lines(self, form): res = [] self.cr.execute('SELECT DISTINCT res_partner.id AS id,\ res_partner.name AS name \ FROM res_partner,account_move_line AS l, account_account\ WHERE (l.account_id=account_account.id) \ AND ((reconcile_id IS NULL)\ OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\ AND (l.partner_id=res_partner.id)\ AND ' + self.query + ' \ ORDER BY res_partner.name', (self.date_from,)) partners = self.cr.dictfetchall() ## mise a 0 du total for i in range(7): self.total_account.append(0) # # Build a string like (1,2,3) for easy use in SQL query partner_ids = [x['id'] for x in partners] if not partner_ids: return [] # This dictionary will store the debit-credit for all partners, using partner_id as key. move_state = ['draft','posted'] if self.target_move == 'posted': move_state = ['posted']
468,619
def _get_lines(self, form): res = [] self.cr.execute('SELECT DISTINCT res_partner.id AS id,\ res_partner.name AS name \ FROM res_partner,account_move_line AS l, account_account\ WHERE (l.account_id=account_account.id) \ AND ((reconcile_id IS NULL)\ OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\ AND (l.partner_id=res_partner.id)\ AND ' + self.query + ' \ ORDER BY res_partner.name', (self.date_from,)) partners = self.cr.dictfetchall() ## mise a 0 du total for i in range(7): self.total_account.append(0) # # Build a string like (1,2,3) for easy use in SQL query partner_ids = [x['id'] for x in partners] if not partner_ids: return [] # This dictionary will store the debit-credit for all partners, using partner_id as key. move_state = ['draft','posted'] if self.target_move == 'posted': move_state = ['posted']
def _get_lines(self, form): res = [] self.cr.execute('SELECT DISTINCT res_partner.id AS id,\ res_partner.name AS name \ FROM res_partner,account_move_line AS l, account_account\ WHERE (l.account_id=account_account.id) \ AND ((reconcile_id IS NULL)\ OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\ AND (l.partner_id=res_partner.id)\ AND ' + self.query + ' \ ORDER BY res_partner.name', (tuple(move_state), tuple(self.ACCOUNT_TYPE), self.date_from, self.date_from,)) partners = self.cr.dictfetchall() ## mise a 0 du total for i in range(7): self.total_account.append(0) # # Build a string like (1,2,3) for easy use in SQL query partner_ids = [x['id'] for x in partners] if not partner_ids: return [] # This dictionary will store the debit-credit for all partners, using partner_id as key. move_state = ['draft','posted'] if self.target_move == 'posted': move_state = ['posted']
468,620
def _get_lines(self, form): res = [] self.cr.execute('SELECT DISTINCT res_partner.id AS id,\ res_partner.name AS name \ FROM res_partner,account_move_line AS l, account_account\ WHERE (l.account_id=account_account.id) \ AND ((reconcile_id IS NULL)\ OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\ AND (l.partner_id=res_partner.id)\ AND ' + self.query + ' \ ORDER BY res_partner.name', (self.date_from,)) partners = self.cr.dictfetchall() ## mise a 0 du total for i in range(7): self.total_account.append(0) # # Build a string like (1,2,3) for easy use in SQL query partner_ids = [x['id'] for x in partners] if not partner_ids: return [] # This dictionary will store the debit-credit for all partners, using partner_id as key. move_state = ['draft','posted'] if self.target_move == 'posted': move_state = ['posted']
def _get_lines(self, form): res = [] self.cr.execute('SELECT DISTINCT res_partner.id AS id,\ res_partner.name AS name \ FROM res_partner,account_move_line AS l, account_account\ WHERE (l.account_id=account_account.id) \ AND ((reconcile_id IS NULL)\ OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\ AND (l.partner_id=res_partner.id)\ AND ' + self.query + ' \ ORDER BY res_partner.name', (self.date_from,)) partners = self.cr.dictfetchall() ## mise a 0 du total for i in range(7): self.total_account.append(0) # # Build a string like (1,2,3) for easy use in SQL query partner_ids = [x['id'] for x in partners] if not partner_ids: return [] # This dictionary will store the debit-credit for all partners, using partner_id as key. move_state = ['draft','posted'] if self.target_move == 'posted': move_state = ['posted']
468,621
def _get_lines(self, form): res = [] self.cr.execute('SELECT DISTINCT res_partner.id AS id,\ res_partner.name AS name \ FROM res_partner,account_move_line AS l, account_account\ WHERE (l.account_id=account_account.id) \ AND ((reconcile_id IS NULL)\ OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\ AND (l.partner_id=res_partner.id)\ AND ' + self.query + ' \ ORDER BY res_partner.name', (self.date_from,)) partners = self.cr.dictfetchall() ## mise a 0 du total for i in range(7): self.total_account.append(0) # # Build a string like (1,2,3) for easy use in SQL query partner_ids = [x['id'] for x in partners] if not partner_ids: return [] # This dictionary will store the debit-credit for all partners, using partner_id as key. move_state = ['draft','posted'] if self.target_move == 'posted': move_state = ['posted']
def _get_lines(self, form): res = [] self.cr.execute('SELECT DISTINCT res_partner.id AS id,\ res_partner.name AS name \ FROM res_partner,account_move_line AS l, account_account\ WHERE (l.account_id=account_account.id) \ AND ((reconcile_id IS NULL)\ OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\ AND (l.partner_id=res_partner.id)\ AND ' + self.query + ' \ ORDER BY res_partner.name', (self.date_from,)) partners = self.cr.dictfetchall() ## mise a 0 du total for i in range(7): self.total_account.append(0) # # Build a string like (1,2,3) for easy use in SQL query partner_ids = [x['id'] for x in partners] if not partner_ids: return [] # This dictionary will store the debit-credit for all partners, using partner_id as key. move_state = ['draft','posted'] if self.target_move == 'posted': move_state = ['posted']
468,622
def _get_lines(self, form): res = [] self.cr.execute('SELECT DISTINCT res_partner.id AS id,\ res_partner.name AS name \ FROM res_partner,account_move_line AS l, account_account\ WHERE (l.account_id=account_account.id) \ AND ((reconcile_id IS NULL)\ OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\ AND (l.partner_id=res_partner.id)\ AND ' + self.query + ' \ ORDER BY res_partner.name', (self.date_from,)) partners = self.cr.dictfetchall() ## mise a 0 du total for i in range(7): self.total_account.append(0) # # Build a string like (1,2,3) for easy use in SQL query partner_ids = [x['id'] for x in partners] if not partner_ids: return [] # This dictionary will store the debit-credit for all partners, using partner_id as key. move_state = ['draft','posted'] if self.target_move == 'posted': move_state = ['posted']
def _get_lines(self, form): res = [] self.cr.execute('SELECT DISTINCT res_partner.id AS id,\ res_partner.name AS name \ FROM res_partner,account_move_line AS l, account_account\ WHERE (l.account_id=account_account.id) \ AND ((reconcile_id IS NULL)\ OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\ AND (l.partner_id=res_partner.id)\ AND ' + self.query + ' \ ORDER BY res_partner.name', (self.date_from,)) partners = self.cr.dictfetchall() ## mise a 0 du total for i in range(7): self.total_account.append(0) # # Build a string like (1,2,3) for easy use in SQL query partner_ids = [x['id'] for x in partners] if not partner_ids: return [] # This dictionary will store the debit-credit for all partners, using partner_id as key. move_state = ['draft','posted'] if self.target_move == 'posted': move_state = ['posted']
468,623
def _get_lines(self, form): res = [] self.cr.execute('SELECT DISTINCT res_partner.id AS id,\ res_partner.name AS name \ FROM res_partner,account_move_line AS l, account_account\ WHERE (l.account_id=account_account.id) \ AND ((reconcile_id IS NULL)\ OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\ AND (l.partner_id=res_partner.id)\ AND ' + self.query + ' \ ORDER BY res_partner.name', (self.date_from,)) partners = self.cr.dictfetchall() ## mise a 0 du total for i in range(7): self.total_account.append(0) # # Build a string like (1,2,3) for easy use in SQL query partner_ids = [x['id'] for x in partners] if not partner_ids: return [] # This dictionary will store the debit-credit for all partners, using partner_id as key. move_state = ['draft','posted'] if self.target_move == 'posted': move_state = ['posted']
def _get_lines(self, form): res = [] self.cr.execute('SELECT DISTINCT res_partner.id AS id,\ res_partner.name AS name \ FROM res_partner,account_move_line AS l, account_account\ WHERE (l.account_id=account_account.id) \ AND ((reconcile_id IS NULL)\ OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\ AND (l.partner_id=res_partner.id)\ AND ' + self.query + ' \ ORDER BY res_partner.name', (self.date_from,)) partners = self.cr.dictfetchall() ## mise a 0 du total for i in range(7): self.total_account.append(0) # # Build a string like (1,2,3) for easy use in SQL query partner_ids = [x['id'] for x in partners] if not partner_ids: return [] # This dictionary will store the debit-credit for all partners, using partner_id as key. move_state = ['draft','posted'] if self.target_move == 'posted': move_state = ['posted']
468,624
def _get_lines(self, form): res = [] self.cr.execute('SELECT DISTINCT res_partner.id AS id,\ res_partner.name AS name \ FROM res_partner,account_move_line AS l, account_account\ WHERE (l.account_id=account_account.id) \ AND ((reconcile_id IS NULL)\ OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\ AND (l.partner_id=res_partner.id)\ AND ' + self.query + ' \ ORDER BY res_partner.name', (self.date_from,)) partners = self.cr.dictfetchall() ## mise a 0 du total for i in range(7): self.total_account.append(0) # # Build a string like (1,2,3) for easy use in SQL query partner_ids = [x['id'] for x in partners] if not partner_ids: return [] # This dictionary will store the debit-credit for all partners, using partner_id as key. move_state = ['draft','posted'] if self.target_move == 'posted': move_state = ['posted']
def _get_lines(self, form): res = [] self.cr.execute('SELECT DISTINCT res_partner.id AS id,\ res_partner.name AS name \ FROM res_partner,account_move_line AS l, account_account\ WHERE (l.account_id=account_account.id) \ AND ((reconcile_id IS NULL)\ OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\ AND (l.partner_id=res_partner.id)\ AND ' + self.query + ' \ ORDER BY res_partner.name', (self.date_from,)) partners = self.cr.dictfetchall() ## mise a 0 du total for i in range(7): self.total_account.append(0) # # Build a string like (1,2,3) for easy use in SQL query partner_ids = [x['id'] for x in partners] if not partner_ids: return [] # This dictionary will store the debit-credit for all partners, using partner_id as key. move_state = ['draft','posted'] if self.target_move == 'posted': move_state = ['posted']
468,625
def _get_lines(self, form): res = [] self.cr.execute('SELECT DISTINCT res_partner.id AS id,\ res_partner.name AS name \ FROM res_partner,account_move_line AS l, account_account\ WHERE (l.account_id=account_account.id) \ AND ((reconcile_id IS NULL)\ OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\ AND (l.partner_id=res_partner.id)\ AND ' + self.query + ' \ ORDER BY res_partner.name', (self.date_from,)) partners = self.cr.dictfetchall() ## mise a 0 du total for i in range(7): self.total_account.append(0) # # Build a string like (1,2,3) for easy use in SQL query partner_ids = [x['id'] for x in partners] if not partner_ids: return [] # This dictionary will store the debit-credit for all partners, using partner_id as key. move_state = ['draft','posted'] if self.target_move == 'posted': move_state = ['posted']
def _get_lines(self, form): res = [] self.cr.execute('SELECT DISTINCT res_partner.id AS id,\ res_partner.name AS name \ FROM res_partner,account_move_line AS l, account_account\ WHERE (l.account_id=account_account.id) \ AND ((reconcile_id IS NULL)\ OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\ AND (l.partner_id=res_partner.id)\ AND ' + self.query + ' \ ORDER BY res_partner.name', (self.date_from,)) partners = self.cr.dictfetchall() ## mise a 0 du total for i in range(7): self.total_account.append(0) # # Build a string like (1,2,3) for easy use in SQL query partner_ids = [x['id'] for x in partners] if not partner_ids: return [] # This dictionary will store the debit-credit for all partners, using partner_id as key. move_state = ['draft','posted'] if self.target_move == 'posted': move_state = ['posted']
468,626
def _get_lines_with_out_partner(self, form): res = [] move_state = ['draft','posted'] if self.target_move == 'posted': move_state = ['posted']
def _get_lines_with_out_partner(self, form): res = [] move_state = ['draft','posted'] if self.target_move == 'posted': move_state = ['posted']
468,627
def _get_lines_with_out_partner(self, form): res = [] move_state = ['draft','posted'] if self.target_move == 'posted': move_state = ['posted']
defargs_list += (self.date_from,) _get_lines_with_out_partner(self,args_list += (self.date_from,) form):args_list += (self.date_from,) resargs_list += (self.date_from,) =args_list += (self.date_from,) []args_list += (self.date_from,) move_stateargs_list += (self.date_from,) =args_list += (self.date_from,) ['draft','posted']args_list += (self.date_from,) ifargs_list += (self.date_from,) self.target_moveargs_list += (self.date_from,) ==args_list += (self.date_from,) 'posted':args_list += (self.date_from,) move_stateargs_list += (self.date_from,) =args_list += (self.date_from,) ['posted']
468,628
def _sheet_search(self, cursor, user, obj, name, args): if not len(args): return [] sheet_obj = self.pool.get('hr_timesheet_sheet.sheet')
def _sheet_search(self, cursor, user, obj, name, args, context={}): if not len(args): return [] sheet_obj = self.pool.get('hr_timesheet_sheet.sheet')
468,629
def _sheet_search(self, cursor, user, obj, name, args): if not len(args): return [] sheet_obj = self.pool.get('hr_timesheet_sheet.sheet')
def _sheet_search(self, cursor, user, obj, name, args): if not len(args): return [] sheet_obj = self.pool.get('hr_timesheet_sheet.sheet')
468,630
def start_server(root_path, port, netport, addons_path): os.system('python2.5 %sopenerp-server.py --pidfile=openerp.pid --port=%s --net_port=%s --addons-path=%s' %(root_path, str(port),str(netport),addons_path))
def start_server(root_path, port, netport, addons_path): os.system('python2.5 %sopenerp-server.py --pidfile=openerp.pid --port=%s --net_port=%s --addons-path=%s' %(root_path, str(port),str(netport),addons_path))
468,631
def process_wi_email(self, cr, uid, activity, workitem, context=None): print 'Sending Email Init', activity.name return self.pool.get('email.template').generate_mail(cr, uid, activity.email_template_id.id, [workitem.res_id], context=context)
def process_wi_email(self, cr, uid, activity, workitem, context=None): print 'Sending Email Init', activity.name return self.pool.get('email.template').generate_mail(cr, uid, activity.email_template_id.id, [workitem.res_id], context=context)
468,632
def _fnct_read(self, obj, cr, uid, ids, prop_name, obj_dest, context=None): properties = obj.pool.get('ir.property') domain = [('fields_id.model', '=', obj._name), ('fields_id.name','in',prop_name)] domain += [('res_id','in', [obj._name + ',' + str(oid) for oid in ids])] nids = properties.search(cr, uid, domain, context=context) default_val,replaces = self._get_defaults(obj, cr, uid, prop_name, context)
def _fnct_read(self, obj, cr, uid, ids, prop_name, obj_dest, context=None): properties = obj.pool.get('ir.property') domain = [('fields_id.model', '=', obj._name), ('fields_id.name','in',prop_name)] domain += [('res_id','in', [obj._name + ',' + str(oid) for oid in ids])] nids = properties.search(cr, uid, domain, context=context) default_val,replaces = self._get_defaults(obj, cr, uid, prop_name, context)
468,633
def change_digit(cr): return pooler.get_pool(cr.dbname).get('decimal.precision').precision_get(cr, 1, application)
def change_digit(cr): return pooler.get_pool(cr.dbname).get('decimal.precision').precision_get(cr, 1, application)
468,634
def reconcile(self, cr, uid, ids, context=None): move_line_obj = self.pool.get('account.move.line') obj_model = self.pool.get('ir.model.data') if context is None: context = {} form = self.read(cr, uid, ids, [])[0] max_amount = form.get('max_amount', False) and form.get('max_amount') or 0.0 power = form['power'] allow_write_off = form['allow_write_off'] reconciled = unreconciled = 0 if not form['account_ids']: raise osv.except_osv(_('UserError'), _('You must select accounts to reconcile')) for account_id in form['account_ids']: params = (account_id,) if not allow_write_off: query = """SELECT partner_id FROM account_move_line WHERE account_id=%s AND reconcile_id IS NULL AND state <> 'draft' GROUP BY partner_id HAVING ABS(SUM(debit-credit)) = 0.0 AND count(*)>0""" else: query = """SELECT partner_id FROM account_move_line WHERE account_id=%s AND reconcile_id IS NULL AND state <> 'draft' GROUP BY partner_id HAVING ABS(SUM(debit-credit)) < %s AND count(*)>0""" params += (max_amount,) # reconcile automatically all transactions from partners whose balance is 0 cr.execute(query, params) partner_ids = [id for (id,) in cr.fetchall()] for partner_id in partner_ids: cr.execute( "SELECT id " \ "FROM account_move_line " \ "WHERE account_id=%s " \ "AND partner_id=%s " \ "AND state <> 'draft' " \ "AND reconcile_id IS NULL", (account_id, partner_id)) line_ids = [id for (id,) in cr.fetchall()] if len(line_ids): reconciled += len(line_ids) if allow_write_off: move_line_obj.reconcile(cr, uid, line_ids, 'auto', form['writeoff_acc_id'], form['period_id'], form['journal_id'], context) else: move_line_obj.reconcile_partial(cr, uid, line_ids, 'manual', context={})
def reconcile(self, cr, uid, ids, context=None): move_line_obj = self.pool.get('account.move.line') obj_model = self.pool.get('ir.model.data') if context is None: context = {} form = self.read(cr, uid, ids, [])[0] max_amount = form.get('max_amount', False) and form.get('max_amount') or 0.0 power = form['power'] allow_write_off = form['allow_write_off'] reconciled = unreconciled = 0 if not form['account_ids']: raise osv.except_osv(_('UserError'), _('You must select accounts to reconcile')) for account_id in form['account_ids']: params = (account_id,) if not allow_write_off: query = """SELECT partner_id FROM account_move_line WHERE account_id=%s AND reconcile_id IS NULL AND state <> 'draft' GROUP BY partner_id HAVING ABS(SUM(debit-credit)) = 0.0 AND count(*)>0""" else: query = """SELECT partner_id FROM account_move_line WHERE account_id=%s AND reconcile_id IS NULL AND state <> 'draft' GROUP BY partner_id HAVING ABS(SUM(debit-credit)) < %s AND count(*)>0""" params += (max_amount,) # reconcile automatically all transactions from partners whose balance is 0 cr.execute(query, params) partner_ids = [id for (id,) in cr.fetchall()] for partner_id in partner_ids: cr.execute( "SELECT id " \ "FROM account_move_line " \ "WHERE account_id=%s " \ "AND partner_id=%s " \ "AND state <> 'draft' " \ "AND reconcile_id IS NULL", (account_id, partner_id)) line_ids = [id for (id,) in cr.fetchall()] if len(line_ids): reconciled += len(line_ids) if allow_write_off: move_line_obj.reconcile(cr, uid, line_ids, 'auto', form['writeoff_acc_id'], form['period_id'], form['journal_id'], context) else: move_line_obj.reconcile_partial(cr, uid, line_ids, 'manual', context={})
468,635
def reconcile(self, cr, uid, ids, context=None): move_line_obj = self.pool.get('account.move.line') obj_model = self.pool.get('ir.model.data') if context is None: context = {} form = self.read(cr, uid, ids, [])[0] max_amount = form.get('max_amount', False) and form.get('max_amount') or 0.0 power = form['power'] allow_write_off = form['allow_write_off'] reconciled = unreconciled = 0 if not form['account_ids']: raise osv.except_osv(_('UserError'), _('You must select accounts to reconcile')) for account_id in form['account_ids']: params = (account_id,) if not allow_write_off: query = """SELECT partner_id FROM account_move_line WHERE account_id=%s AND reconcile_id IS NULL AND state <> 'draft' GROUP BY partner_id HAVING ABS(SUM(debit-credit)) = 0.0 AND count(*)>0""" else: query = """SELECT partner_id FROM account_move_line WHERE account_id=%s AND reconcile_id IS NULL AND state <> 'draft' GROUP BY partner_id HAVING ABS(SUM(debit-credit)) < %s AND count(*)>0""" params += (max_amount,) # reconcile automatically all transactions from partners whose balance is 0 cr.execute(query, params) partner_ids = [id for (id,) in cr.fetchall()] for partner_id in partner_ids: cr.execute( "SELECT id " \ "FROM account_move_line " \ "WHERE account_id=%s " \ "AND partner_id=%s " \ "AND state <> 'draft' " \ "AND reconcile_id IS NULL", (account_id, partner_id)) line_ids = [id for (id,) in cr.fetchall()] if len(line_ids): reconciled += len(line_ids) if allow_write_off: move_line_obj.reconcile(cr, uid, line_ids, 'auto', form['writeoff_acc_id'], form['period_id'], form['journal_id'], context) else: move_line_obj.reconcile_partial(cr, uid, line_ids, 'manual', context={})
def reconcile(self, cr, uid, ids, context=None): move_line_obj = self.pool.get('account.move.line') obj_model = self.pool.get('ir.model.data') if context is None: context = {} form = self.read(cr, uid, ids, [])[0] max_amount = form.get('max_amount', False) and form.get('max_amount') or 0.0 power = form['power'] allow_write_off = form['allow_write_off'] reconciled = unreconciled = 0 if not form['account_ids']: raise osv.except_osv(_('UserError'), _('You must select accounts to reconcile')) for account_id in form['account_ids']: params = (account_id,) if not allow_write_off: query = """SELECT partner_id FROM account_move_line WHERE account_id=%s AND reconcile_id IS NULL AND state <> 'draft' GROUP BY partner_id HAVING ABS(SUM(debit-credit)) = 0.0 AND count(*)>0""" else: query = """SELECT partner_id FROM account_move_line WHERE account_id=%s AND reconcile_id IS NULL AND state <> 'draft' GROUP BY partner_id HAVING ABS(SUM(debit-credit)) < %s AND count(*)>0""" params += (max_amount,) # reconcile automatically all transactions from partners whose balance is 0 cr.execute(query, params) partner_ids = [id for (id,) in cr.fetchall()] for partner_id in partner_ids: cr.execute( "SELECT id " \ "FROM account_move_line " \ "WHERE account_id=%s " \ "AND partner_id=%s " \ "AND state <> 'draft' " \ "AND reconcile_id IS NULL", (account_id, partner_id)) line_ids = [id for (id,) in cr.fetchall()] if len(line_ids): reconciled += len(line_ids) if allow_write_off: move_line_obj.reconcile(cr, uid, line_ids, 'auto', form['writeoff_acc_id'], form['period_id'], form['journal_id'], context) else: move_line_obj.reconcile_partial(cr, uid, line_ids, 'manual', context={})
468,636
def sign_in(self, cr, uid, data, context=None): if context is None: context = {} emp_id = data['emp_id'] if 'last_time' in data: if data['last_time'] > time.strftime('%Y-%m-%d %H:%M:%S'): raise osv.except_osv(_('UserError'), _('The sign-out date must be in the past')) self.pool.get('hr.attendance').create(cr, uid, {'name': data['last_time'], 'action': 'sign_out', 'employee_id': emp_id}, context=context) try: success = self.pool.get('hr.employee').attendance_action_change(cr, uid, [emp_id], 'sign_in') except: raise osv.except_osv(_('UserError'), _('A sign-in must be right after a sign-out !')) return {} # To do: Return Success message
def sign_in(self, cr, uid, data, context=None): if context is None: context = {} emp_id = data['emp_id'] if 'last_time' in data: if data['last_time'] > time.strftime('%Y-%m-%d %H:%M:%S'): raise osv.except_osv(_('UserError'), _('The sign-out date must be in the past')) self.pool.get('hr.attendance').create(cr, uid, {'name': data['last_time'], 'action': 'sign_out', 'employee_id': emp_id}, context=context) try: self.pool.get('hr.employee').attendance_action_change(cr, uid, [emp_id], 'sign_in') except: raise osv.except_osv(_('UserError'), _('A sign-in must be right after a sign-out !')) return {} # To do: Return Success message
468,637
def sign_out(self, cr, uid, data, context=None): emp_id = data['emp_id'] if 'last_time' in data: if data['last_time'] > time.strftime('%Y-%m-%d %H:%M:%S'): raise osv.except_osv(_('UserError'), _('The Sign-in date must be in the past')) self.pool.get('hr.attendance').create(cr, uid, {'name':data['last_time'], 'action':'sign_in', 'employee_id':emp_id}, context=context) try: success = self.pool.get('hr.employee').attendance_action_change(cr, uid, [emp_id], 'sign_out') except: raise osv.except_osv(_('UserError'), _('A sign-out must be right after a sign-in !')) return {} # To do: Return Success message
def sign_out(self, cr, uid, data, context=None): emp_id = data['emp_id'] if 'last_time' in data: if data['last_time'] > time.strftime('%Y-%m-%d %H:%M:%S'): raise osv.except_osv(_('UserError'), _('The Sign-in date must be in the past')) self.pool.get('hr.attendance').create(cr, uid, {'name':data['last_time'], 'action':'sign_in', 'employee_id':emp_id}, context=context) try: self.pool.get('hr.employee').attendance_action_change(cr, uid, [emp_id], 'sign_out') except: raise osv.except_osv(_('UserError'), _('A sign-out must be right after a sign-in !')) return {} # To do: Return Success message
468,638
def _flowable(self, node, extra_style=None): if node.tag=='para': style = self.styles.para_style_get(node) if extra_style: style.__dict__.update(extra_style) result = [] for i in self._textual(node).split('\n'): result.append(platypus.Paragraph(i, style, **(utils.attr_get(node, [], {'bulletText':'str'})))) return result elif node.tag=='barCode': try: from reportlab.graphics.barcode import code128 from reportlab.graphics.barcode import code39 from reportlab.graphics.barcode import code93 from reportlab.graphics.barcode import common from reportlab.graphics.barcode import fourstate from reportlab.graphics.barcode import usps except Exception, e: return None args = utils.attr_get(node, [], {'ratio':'float','xdim':'unit','height':'unit','checksum':'int','quiet':'int','width':'unit','stop':'bool','bearers':'int','barWidth':'float','barHeight':'float'}) codes = { 'codabar': lambda x: common.Codabar(x, **args), 'code11': lambda x: common.Code11(x, **args), 'code128': lambda x: code128.Code128(x, **args), 'standard39': lambda x: code39.Standard39(x, **args), 'standard93': lambda x: code93.Standard93(x, **args), 'i2of5': lambda x: common.I2of5(x, **args), 'extended39': lambda x: code39.Extended39(x, **args), 'extended93': lambda x: code93.Extended93(x, **args), 'msi': lambda x: common.MSI(x, **args), 'fim': lambda x: usps.FIM(x, **args), 'postnet': lambda x: usps.POSTNET(x, **args), } code = 'code128' if node.get('code'): code = node.get('code').lower() return codes[code](self._textual(node)) elif node.tag=='name': self.styles.names[ node.get('id')] = node.get('value') return None elif node.tag=='xpre': style = self.styles.para_style_get(node) return platypus.XPreformatted(self._textual(node), style, **(utils.attr_get(node, [], {'bulletText':'str','dedent':'int','frags':'int'}))) elif node.tag=='pre': style = self.styles.para_style_get(node) return platypus.Preformatted(self._textual(node), style, **(utils.attr_get(node, [], {'bulletText':'str','dedent':'int'}))) elif node.tag=='illustration': return self._illustration(node) elif node.tag=='blockTable': return self._table(node) elif node.tag=='title': styles = reportlab.lib.styles.getSampleStyleSheet() style = styles['Title'] return platypus.Paragraph(self._textual(node), style, **(utils.attr_get(node, [], {'bulletText':'str'}))) elif re.match('^h([1-9]+[0-9]*)$', (node.text or '')): styles = reportlab.lib.styles.getSampleStyleSheet() style = styles['Heading'+str(node.get[1:])] return platypus.Paragraph(self._textual(node), style, **(utils.attr_get(node, [], {'bulletText':'str'}))) elif node.tag=='image': if not node.get('file'): if node.get('name'): image_data = self.doc.images[node.get('name')].read() else: import base64 if self.localcontext: newtext = utils._process_text(self, node.text or '') node.text = newtext image_data = base64.decodestring(node.text) if not image_data: return False image = cStringIO.StringIO(image_data) return platypus.Image(image, mask=(250,255,250,255,250,255), **(utils.attr_get(node, ['width','height']))) else: return platypus.Image(node.get('file'), mask=(250,255,250,255,250,255), **(utils.attr_get(node, ['width','height']))) from reportlab.lib.utils import ImageReader name = str(node.get('file')) img = ImageReader(name) (sx,sy) = img.getSize() args = {} for tag in ('width','height'): if node.get(tag): args[tag] = utils.unit_get(node.get(tag)) if ('width' in args) and (not 'height' in args): args['height'] = sy * args['width'] / sx elif ('height' in args) and (not 'width' in args): args['width'] = sx * args['height'] / sy elif ('width' in args) and ('height' in args): if (float(args['width'])/args['height'])>(float(sx)>sy): args['width'] = sx * args['height'] / sy else: args['height'] = sy * args['width'] / sx return platypus.Image(name, mask=(250,255,250,255,250,255), **args) elif node.tag=='spacer': if node.get('width'): width = utils.unit_get(node.get('width')) else: width = utils.unit_get('1cm') length = utils.unit_get(node.get('length')) return platypus.Spacer(width=width, height=length) elif node.tag=='section': return self.render(node) elif node.tag == 'pageNumberReset': return PageReset() elif node.tag in ('pageBreak', 'nextPage'): return platypus.PageBreak() elif node.tag=='condPageBreak': return platypus.CondPageBreak(**(utils.attr_get(node, ['height']))) elif node.tag=='setNextTemplate': return platypus.NextPageTemplate(str(node.get('name'))) elif node.tag=='nextFrame': return platypus.CondPageBreak(1000) # TODO: change the 1000 ! elif node.tag == 'setNextFrame': from reportlab.platypus.doctemplate import NextFrameFlowable return NextFrameFlowable(str(node.get('name'))) elif node.tag == 'currentFrame': from reportlab.platypus.doctemplate import CurrentFrameFlowable return CurrentFrameFlowable(str(node.get('name'))) elif node.tag == 'frameEnd': return EndFrameFlowable() elif node.tag == 'hr': width_hr=node.get('width') or '100%' color_hr=node.get('color') or 'black' thickness_hr=node.get('thickness') or 1 lineCap_hr=node.get('lineCap') or 'round' return platypus.flowables.HRFlowable(width=width_hr,color=color.get(color_hr),thickness=float(thickness_hr),lineCap=str(lineCap_hr)) else: sys.stderr.write('Warning: flowable not yet implemented: %s !\n' % (node.tag,)) return None
def _flowable(self, node, extra_style=None): if node.tag=='para': style = self.styles.para_style_get(node) if extra_style: style.__dict__.update(extra_style) result = [] for i in self._textual(node).split('\n'): result.append(platypus.Paragraph(i, style, **(utils.attr_get(node, [], {'bulletText':'str'})))) return result elif node.tag=='barCode': try: from reportlab.graphics.barcode import code128 from reportlab.graphics.barcode import code39 from reportlab.graphics.barcode import code93 from reportlab.graphics.barcode import common from reportlab.graphics.barcode import fourstate from reportlab.graphics.barcode import usps except Exception, e: return None args = utils.attr_get(node, [], {'ratio':'float','xdim':'unit','height':'unit','checksum':'int','quiet':'int','width':'unit','stop':'bool','bearers':'int','barWidth':'float','barHeight':'float'}) codes = { 'codabar': lambda x: common.Codabar(x, **args), 'code11': lambda x: common.Code11(x, **args), 'code128': lambda x: code128.Code128(x, **args), 'standard39': lambda x: code39.Standard39(x, **args), 'standard93': lambda x: code93.Standard93(x, **args), 'i2of5': lambda x: common.I2of5(x, **args), 'extended39': lambda x: code39.Extended39(x, **args), 'extended93': lambda x: code93.Extended93(x, **args), 'msi': lambda x: common.MSI(x, **args), 'fim': lambda x: usps.FIM(x, **args), 'postnet': lambda x: usps.POSTNET(x, **args), } code = 'code128' if node.get('code'): code = node.get('code').lower() return codes[code](self._textual(node)) elif node.tag=='name': self.styles.names[ node.get('id')] = node.get('value') return None elif node.tag=='xpre': style = self.styles.para_style_get(node) return platypus.XPreformatted(self._textual(node), style, **(utils.attr_get(node, [], {'bulletText':'str','dedent':'int','frags':'int'}))) elif node.tag=='pre': style = self.styles.para_style_get(node) return platypus.Preformatted(self._textual(node), style, **(utils.attr_get(node, [], {'bulletText':'str','dedent':'int'}))) elif node.tag=='illustration': return self._illustration(node) elif node.tag=='blockTable': return self._table(node) elif node.tag=='title': styles = reportlab.lib.styles.getSampleStyleSheet() style = styles['Title'] return platypus.Paragraph(self._textual(node), style, **(utils.attr_get(node, [], {'bulletText':'str'}))) elif re.match('^h([1-9]+[0-9]*)$', (node.tag or '')): styles = reportlab.lib.styles.getSampleStyleSheet() style = styles['Heading'+str(node.get[1:])] return platypus.Paragraph(self._textual(node), style, **(utils.attr_get(node, [], {'bulletText':'str'}))) elif node.tag=='image': if not node.get('file'): if node.get('name'): image_data = self.doc.images[node.get('name')].read() else: import base64 if self.localcontext: newtext = utils._process_text(self, node.text or '') node.text = newtext image_data = base64.decodestring(node.text) if not image_data: return False image = cStringIO.StringIO(image_data) return platypus.Image(image, mask=(250,255,250,255,250,255), **(utils.attr_get(node, ['width','height']))) else: return platypus.Image(node.get('file'), mask=(250,255,250,255,250,255), **(utils.attr_get(node, ['width','height']))) from reportlab.lib.utils import ImageReader name = str(node.get('file')) img = ImageReader(name) (sx,sy) = img.getSize() args = {} for tag in ('width','height'): if node.get(tag): args[tag] = utils.unit_get(node.get(tag)) if ('width' in args) and (not 'height' in args): args['height'] = sy * args['width'] / sx elif ('height' in args) and (not 'width' in args): args['width'] = sx * args['height'] / sy elif ('width' in args) and ('height' in args): if (float(args['width'])/args['height'])>(float(sx)>sy): args['width'] = sx * args['height'] / sy else: args['height'] = sy * args['width'] / sx return platypus.Image(name, mask=(250,255,250,255,250,255), **args) elif node.tag=='spacer': if node.get('width'): width = utils.unit_get(node.get('width')) else: width = utils.unit_get('1cm') length = utils.unit_get(node.get('length')) return platypus.Spacer(width=width, height=length) elif node.tag=='section': return self.render(node) elif node.tag == 'pageNumberReset': return PageReset() elif node.tag in ('pageBreak', 'nextPage'): return platypus.PageBreak() elif node.tag=='condPageBreak': return platypus.CondPageBreak(**(utils.attr_get(node, ['height']))) elif node.tag=='setNextTemplate': return platypus.NextPageTemplate(str(node.get('name'))) elif node.tag=='nextFrame': return platypus.CondPageBreak(1000) # TODO: change the 1000 ! elif node.tag == 'setNextFrame': from reportlab.platypus.doctemplate import NextFrameFlowable return NextFrameFlowable(str(node.get('name'))) elif node.tag == 'currentFrame': from reportlab.platypus.doctemplate import CurrentFrameFlowable return CurrentFrameFlowable(str(node.get('name'))) elif node.tag == 'frameEnd': return EndFrameFlowable() elif node.tag == 'hr': width_hr=node.get('width') or '100%' color_hr=node.get('color') or 'black' thickness_hr=node.get('thickness') or 1 lineCap_hr=node.get('lineCap') or 'round' return platypus.flowables.HRFlowable(width=width_hr,color=color.get(color_hr),thickness=float(thickness_hr),lineCap=str(lineCap_hr)) else: sys.stderr.write('Warning: flowable not yet implemented: %s !\n' % (node.tag,)) return None
468,639
def _flowable(self, node, extra_style=None): if node.tag=='para': style = self.styles.para_style_get(node) if extra_style: style.__dict__.update(extra_style) result = [] for i in self._textual(node).split('\n'): result.append(platypus.Paragraph(i, style, **(utils.attr_get(node, [], {'bulletText':'str'})))) return result elif node.tag=='barCode': try: from reportlab.graphics.barcode import code128 from reportlab.graphics.barcode import code39 from reportlab.graphics.barcode import code93 from reportlab.graphics.barcode import common from reportlab.graphics.barcode import fourstate from reportlab.graphics.barcode import usps except Exception, e: return None args = utils.attr_get(node, [], {'ratio':'float','xdim':'unit','height':'unit','checksum':'int','quiet':'int','width':'unit','stop':'bool','bearers':'int','barWidth':'float','barHeight':'float'}) codes = { 'codabar': lambda x: common.Codabar(x, **args), 'code11': lambda x: common.Code11(x, **args), 'code128': lambda x: code128.Code128(x, **args), 'standard39': lambda x: code39.Standard39(x, **args), 'standard93': lambda x: code93.Standard93(x, **args), 'i2of5': lambda x: common.I2of5(x, **args), 'extended39': lambda x: code39.Extended39(x, **args), 'extended93': lambda x: code93.Extended93(x, **args), 'msi': lambda x: common.MSI(x, **args), 'fim': lambda x: usps.FIM(x, **args), 'postnet': lambda x: usps.POSTNET(x, **args), } code = 'code128' if node.get('code'): code = node.get('code').lower() return codes[code](self._textual(node)) elif node.tag=='name': self.styles.names[ node.get('id')] = node.get('value') return None elif node.tag=='xpre': style = self.styles.para_style_get(node) return platypus.XPreformatted(self._textual(node), style, **(utils.attr_get(node, [], {'bulletText':'str','dedent':'int','frags':'int'}))) elif node.tag=='pre': style = self.styles.para_style_get(node) return platypus.Preformatted(self._textual(node), style, **(utils.attr_get(node, [], {'bulletText':'str','dedent':'int'}))) elif node.tag=='illustration': return self._illustration(node) elif node.tag=='blockTable': return self._table(node) elif node.tag=='title': styles = reportlab.lib.styles.getSampleStyleSheet() style = styles['Title'] return platypus.Paragraph(self._textual(node), style, **(utils.attr_get(node, [], {'bulletText':'str'}))) elif re.match('^h([1-9]+[0-9]*)$', (node.text or '')): styles = reportlab.lib.styles.getSampleStyleSheet() style = styles['Heading'+str(node.get[1:])] return platypus.Paragraph(self._textual(node), style, **(utils.attr_get(node, [], {'bulletText':'str'}))) elif node.tag=='image': if not node.get('file'): if node.get('name'): image_data = self.doc.images[node.get('name')].read() else: import base64 if self.localcontext: newtext = utils._process_text(self, node.text or '') node.text = newtext image_data = base64.decodestring(node.text) if not image_data: return False image = cStringIO.StringIO(image_data) return platypus.Image(image, mask=(250,255,250,255,250,255), **(utils.attr_get(node, ['width','height']))) else: return platypus.Image(node.get('file'), mask=(250,255,250,255,250,255), **(utils.attr_get(node, ['width','height']))) from reportlab.lib.utils import ImageReader name = str(node.get('file')) img = ImageReader(name) (sx,sy) = img.getSize() args = {} for tag in ('width','height'): if node.get(tag): args[tag] = utils.unit_get(node.get(tag)) if ('width' in args) and (not 'height' in args): args['height'] = sy * args['width'] / sx elif ('height' in args) and (not 'width' in args): args['width'] = sx * args['height'] / sy elif ('width' in args) and ('height' in args): if (float(args['width'])/args['height'])>(float(sx)>sy): args['width'] = sx * args['height'] / sy else: args['height'] = sy * args['width'] / sx return platypus.Image(name, mask=(250,255,250,255,250,255), **args) elif node.tag=='spacer': if node.get('width'): width = utils.unit_get(node.get('width')) else: width = utils.unit_get('1cm') length = utils.unit_get(node.get('length')) return platypus.Spacer(width=width, height=length) elif node.tag=='section': return self.render(node) elif node.tag == 'pageNumberReset': return PageReset() elif node.tag in ('pageBreak', 'nextPage'): return platypus.PageBreak() elif node.tag=='condPageBreak': return platypus.CondPageBreak(**(utils.attr_get(node, ['height']))) elif node.tag=='setNextTemplate': return platypus.NextPageTemplate(str(node.get('name'))) elif node.tag=='nextFrame': return platypus.CondPageBreak(1000) # TODO: change the 1000 ! elif node.tag == 'setNextFrame': from reportlab.platypus.doctemplate import NextFrameFlowable return NextFrameFlowable(str(node.get('name'))) elif node.tag == 'currentFrame': from reportlab.platypus.doctemplate import CurrentFrameFlowable return CurrentFrameFlowable(str(node.get('name'))) elif node.tag == 'frameEnd': return EndFrameFlowable() elif node.tag == 'hr': width_hr=node.get('width') or '100%' color_hr=node.get('color') or 'black' thickness_hr=node.get('thickness') or 1 lineCap_hr=node.get('lineCap') or 'round' return platypus.flowables.HRFlowable(width=width_hr,color=color.get(color_hr),thickness=float(thickness_hr),lineCap=str(lineCap_hr)) else: sys.stderr.write('Warning: flowable not yet implemented: %s !\n' % (node.tag,)) return None
def _flowable(self, node, extra_style=None): if node.tag=='para': style = self.styles.para_style_get(node) if extra_style: style.__dict__.update(extra_style) result = [] for i in self._textual(node).split('\n'): result.append(platypus.Paragraph(i, style, **(utils.attr_get(node, [], {'bulletText':'str'})))) return result elif node.tag=='barCode': try: from reportlab.graphics.barcode import code128 from reportlab.graphics.barcode import code39 from reportlab.graphics.barcode import code93 from reportlab.graphics.barcode import common from reportlab.graphics.barcode import fourstate from reportlab.graphics.barcode import usps except Exception, e: return None args = utils.attr_get(node, [], {'ratio':'float','xdim':'unit','height':'unit','checksum':'int','quiet':'int','width':'unit','stop':'bool','bearers':'int','barWidth':'float','barHeight':'float'}) codes = { 'codabar': lambda x: common.Codabar(x, **args), 'code11': lambda x: common.Code11(x, **args), 'code128': lambda x: code128.Code128(x, **args), 'standard39': lambda x: code39.Standard39(x, **args), 'standard93': lambda x: code93.Standard93(x, **args), 'i2of5': lambda x: common.I2of5(x, **args), 'extended39': lambda x: code39.Extended39(x, **args), 'extended93': lambda x: code93.Extended93(x, **args), 'msi': lambda x: common.MSI(x, **args), 'fim': lambda x: usps.FIM(x, **args), 'postnet': lambda x: usps.POSTNET(x, **args), } code = 'code128' if node.get('code'): code = node.get('code').lower() return codes[code](self._textual(node)) elif node.tag=='name': self.styles.names[ node.get('id')] = node.get('value') return None elif node.tag=='xpre': style = self.styles.para_style_get(node) return platypus.XPreformatted(self._textual(node), style, **(utils.attr_get(node, [], {'bulletText':'str','dedent':'int','frags':'int'}))) elif node.tag=='pre': style = self.styles.para_style_get(node) return platypus.Preformatted(self._textual(node), style, **(utils.attr_get(node, [], {'bulletText':'str','dedent':'int'}))) elif node.tag=='illustration': return self._illustration(node) elif node.tag=='blockTable': return self._table(node) elif node.tag=='title': styles = reportlab.lib.styles.getSampleStyleSheet() style = styles['Title'] return platypus.Paragraph(self._textual(node), style, **(utils.attr_get(node, [], {'bulletText':'str'}))) elif re.match('^h([1-9]+[0-9]*)$', (node.text or '')): styles = reportlab.lib.styles.getSampleStyleSheet() style = styles['Heading'+str(node.tag[1:])] return platypus.Paragraph(self._textual(node), style, **(utils.attr_get(node, [], {'bulletText':'str'}))) elif node.tag=='image': if not node.get('file'): if node.get('name'): image_data = self.doc.images[node.get('name')].read() else: import base64 if self.localcontext: newtext = utils._process_text(self, node.text or '') node.text = newtext image_data = base64.decodestring(node.text) if not image_data: return False image = cStringIO.StringIO(image_data) return platypus.Image(image, mask=(250,255,250,255,250,255), **(utils.attr_get(node, ['width','height']))) else: return platypus.Image(node.get('file'), mask=(250,255,250,255,250,255), **(utils.attr_get(node, ['width','height']))) from reportlab.lib.utils import ImageReader name = str(node.get('file')) img = ImageReader(name) (sx,sy) = img.getSize() args = {} for tag in ('width','height'): if node.get(tag): args[tag] = utils.unit_get(node.get(tag)) if ('width' in args) and (not 'height' in args): args['height'] = sy * args['width'] / sx elif ('height' in args) and (not 'width' in args): args['width'] = sx * args['height'] / sy elif ('width' in args) and ('height' in args): if (float(args['width'])/args['height'])>(float(sx)>sy): args['width'] = sx * args['height'] / sy else: args['height'] = sy * args['width'] / sx return platypus.Image(name, mask=(250,255,250,255,250,255), **args) elif node.tag=='spacer': if node.get('width'): width = utils.unit_get(node.get('width')) else: width = utils.unit_get('1cm') length = utils.unit_get(node.get('length')) return platypus.Spacer(width=width, height=length) elif node.tag=='section': return self.render(node) elif node.tag == 'pageNumberReset': return PageReset() elif node.tag in ('pageBreak', 'nextPage'): return platypus.PageBreak() elif node.tag=='condPageBreak': return platypus.CondPageBreak(**(utils.attr_get(node, ['height']))) elif node.tag=='setNextTemplate': return platypus.NextPageTemplate(str(node.get('name'))) elif node.tag=='nextFrame': return platypus.CondPageBreak(1000) # TODO: change the 1000 ! elif node.tag == 'setNextFrame': from reportlab.platypus.doctemplate import NextFrameFlowable return NextFrameFlowable(str(node.get('name'))) elif node.tag == 'currentFrame': from reportlab.platypus.doctemplate import CurrentFrameFlowable return CurrentFrameFlowable(str(node.get('name'))) elif node.tag == 'frameEnd': return EndFrameFlowable() elif node.tag == 'hr': width_hr=node.get('width') or '100%' color_hr=node.get('color') or 'black' thickness_hr=node.get('thickness') or 1 lineCap_hr=node.get('lineCap') or 'round' return platypus.flowables.HRFlowable(width=width_hr,color=color.get(color_hr),thickness=float(thickness_hr),lineCap=str(lineCap_hr)) else: sys.stderr.write('Warning: flowable not yet implemented: %s !\n' % (node.tag,)) return None
468,640
def _get_partners(self, cr, uid, ids, context={}): ids2 = ids while ids2: ids2 = self.search(cr, uid, [('associate_member','in',ids2)], context=context) ids+=ids2 return ids
def _get_partners(self, cr, uid, ids, context={}): ids2 = ids while ids2: ids2 = self.search(cr, uid, [('associate_member','in',ids2)], context=context) ids+=ids2 return ids
468,641
def _tag_assert(self, cr, rec, data_node=None): if self.isnoupdate(data_node) and self.mode != 'init': return
def _tag_assert(self, cr, rec, data_node=None): if self.isnoupdate(data_node) and self.mode != 'init': return
468,642
def __getitem__(self2, key): if key in brrec: return brrec[key] return dict.__getitem__(self2, key)
def __getitem__(self2, key): if key in brrec: return brrec[key] return dict.__getitem__(self2, key)
468,643
def stage_change(self, cr, uid, ids, context=None, order='sequence'): if not context: context = {} stage_pool = self.pool.get('crm.case.stage') stage_type = context and context.get('stage_type','') current_seq = False next_stage_id = False for case in self.browse(cr, uid, ids, context): next_stage = False data = {}
def stage_change(self, cr, uid, ids, context=None, order='sequence'): if not context: context = {} stage_pool = self.pool.get('crm.case.stage') stage_type = context and context.get('stage_type','') current_seq = False next_stage_id = False for case in self.browse(cr, uid, ids, context): next_stage = False data = {}
468,644
def stage_change(self, cr, uid, ids, context=None, order='sequence'): if not context: context = {} stage_pool = self.pool.get('crm.case.stage') stage_type = context and context.get('stage_type','') current_seq = False next_stage_id = False for case in self.browse(cr, uid, ids, context): next_stage = False data = {}
def stage_change(self, cr, uid, ids, context=None, order='sequence'): if not context: context = {} stage_pool = self.pool.get('crm.case.stage') stage_type = context and context.get('stage_type','') current_seq = False next_stage_id = False for case in self.browse(cr, uid, ids, context): next_stage = False data = {}
468,645
def stage_change(self, cr, uid, ids, context=None, order='sequence'): if not context: context = {} stage_pool = self.pool.get('crm.case.stage') stage_type = context and context.get('stage_type','') current_seq = False next_stage_id = False for case in self.browse(cr, uid, ids, context): next_stage = False data = {}
def stage_change(self, cr, uid, ids, context=None, order='sequence'): if not context: context = {} stage_pool = self.pool.get('crm.case.stage') stage_type = context and context.get('stage_type','') current_seq = False next_stage_id = False for case in self.browse(cr, uid, ids, context): next_stage = False data = {}
468,646
def stage_change(self, cr, uid, ids, context=None, order='sequence'): if not context: context = {} stage_pool = self.pool.get('crm.case.stage') stage_type = context and context.get('stage_type','') current_seq = False next_stage_id = False for case in self.browse(cr, uid, ids, context): next_stage = False data = {}
def stage_change(self, cr, uid, ids, context=None, order='sequence'): if not context: context = {} stage_pool = self.pool.get('crm.case.stage') stage_type = context and context.get('stage_type','') current_seq = False next_stage_id = False for case in self.browse(cr, uid, ids, context): next_stage = False data = {}
468,647
def _get_payment_term_lines(term_id, amount): term_pool = self.pool.get('account.payment.term') if term_id and amount: terms = term_pool.compute(cr, uid, term_id, amount) return terms return False
def _get_payment_term_lines(term_id, amount): term_pool = self.pool.get('account.payment.term') if term_id and amount: terms = term_pool.compute(cr, uid, term_id, amount) return terms return False
468,648
def _get_payment_term_lines(term_id, amount): term_pool = self.pool.get('account.payment.term') if term_id and amount: terms = term_pool.compute(cr, uid, term_id, amount) return terms return False
defif debit < 0: credit = -debit debit = 0.0 if credit < 0: debit = -credit credit = 0.0 _get_payment_term_lines(term_id,if debit < 0: credit = -debit debit = 0.0 if credit < 0: debit = -credit credit = 0.0 amount):if debit < 0: credit = -debit debit = 0.0 if credit < 0: debit = -credit credit = 0.0 term_poolif debit < 0: credit = -debit debit = 0.0 if credit < 0: debit = -credit credit = 0.0 =if debit < 0: credit = -debit debit = 0.0 if credit < 0: debit = -credit credit = 0.0 self.pool.get('account.payment.term')if debit < 0: credit = -debit debit = 0.0 if credit < 0: debit = -credit credit = 0.0 ifif debit < 0: credit = -debit debit = 0.0 if credit < 0: debit = -credit credit = 0.0 term_idif debit < 0: credit = -debit debit = 0.0 if credit < 0: debit = -credit credit = 0.0 andif debit < 0: credit = -debit debit = 0.0 if credit < 0: debit = -credit credit = 0.0 amount:if debit < 0: credit = -debit debit = 0.0 if credit < 0: debit = -credit credit = 0.0 termsif debit < 0: credit = -debit debit = 0.0 if credit < 0: debit = -credit credit = 0.0 =if debit < 0: credit = -debit debit = 0.0 if credit < 0: debit = -credit credit = 0.0 term_pool.compute(cr,if debit < 0: credit = -debit debit = 0.0 if credit < 0: debit = -credit credit = 0.0 uid,if debit < 0: credit = -debit debit = 0.0 if credit < 0: debit = -credit credit = 0.0 term_id,if debit < 0: credit = -debit debit = 0.0 if credit < 0: debit = -credit credit = 0.0 amount)if debit < 0: credit = -debit debit = 0.0 if credit < 0: debit = -credit credit = 0.0 returnif debit < 0: credit = -debit debit = 0.0 if credit < 0: debit = -credit credit = 0.0 termsif debit < 0: credit = -debit debit = 0.0 if credit < 0: debit = -credit credit = 0.0 returnif debit < 0: credit = -debit debit = 0.0 if credit < 0: debit = -credit credit = 0.0 False
468,649
def _get_payment_term_lines(term_id, amount): term_pool = self.pool.get('account.payment.term') if term_id and amount: terms = term_pool.compute(cr, uid, term_id, amount) return terms return False
def _get_payment_term_lines(term_id, amount): term_pool = self.pool.get('account.payment.term') if term_id and amount: terms = term_pool.compute(cr, uid, term_id, amount) return terms return False
468,650
def _get_payment_term_lines(term_id, amount): term_pool = self.pool.get('account.payment.term') if term_id and amount: terms = term_pool.compute(cr, uid, term_id, amount) return terms return False
def _get_payment_term_lines(term_id, amount): term_pool = self.pool.get('account.payment.term') if term_id and amount: terms = term_pool.compute(cr, uid, term_id, amount) return terms return False
468,651
def copy_data(self, cr, uid, id, default=None, context=None):
def copy_data(self, cr, uid, id, default=None, context=None):
468,652
def __getattr__(self, attr): if not attr.startswith('check_vat_'): super(res_partner, self).__getattr__(attr) def default_vat_check(self, cn, vn): # by default, a VAT number is valid if: # it starts with 2 letters # has more than 3 characters return len(vn) > 0 and len(cn) == 2 and cn[0] in string.ascii_lowercase and cn[1] in string.ascii_lowercase
def __getattr__(self, attr): if not attr.startswith('check_vat_'): super(res_partner, self).__getattr__(attr) def default_vat_check(self, cn, vn): # by default, a VAT number is valid if: # it starts with 2 letters # has more than 3 characters return len(vn) > 0 and len(cn) == 2 and cn[0] in string.ascii_lowercase and cn[1] in string.ascii_lowercase
468,653
def vat_change(self, cr, uid, ids, value, context={}): return {'value': {'vat_subjected': bool(value)}}
def vat_change(self, cr, uid, ids, value, context={}): return {'value': {'vat_subjected': bool(value)}}
468,654
def check_vat_se(self, vat): ''' Check Sweden VAT number. ''' if len(vat) != 12: return False try: int(vat) except: return False
def check_vat_se(self, vat): ''' Check Sweden VAT number. ''' if len(vat) != 12: return False try: int(vat) except: return False
468,655
def check_vat_se(self, vat): ''' Check Sweden VAT number. ''' if len(vat) != 12: return False try: int(vat) except: return False
def check_vat_se(self, vat): ''' Check Sweden VAT number. ''' if len(vat) != 12: return False try: int(vat) except: return False
468,656
def onchange_employee_id(self, cr, uid, ids, employee_id, context=None): if context is None: context = {} evaluation_plan_id=False if employee_id: employee_obj=self.pool.get('hr.employee') for employee in employee_obj.browse(cr, uid, [employee_id], context=context): if employee and employee.evaluation_plan_id and employee.evaluation_plan_id.id: evaluation_plan_id=employee.evaluation_plan_id.id employee_ids=employee_obj.search(cr, uid, [('parent_id','=',employee.id)], context=context) return {'value': {'plan_id':evaluation_plan_id}}
def onchange_employee_id(self, cr, uid, ids, employee_id, context=None): if context is None: context = {} evaluation_plan_id=False if employee_id: employee_obj=self.pool.get('hr.employee') for employee in employee_obj.browse(cr, uid, [employee_id], context=context): if employee and employee.evaluation_plan_id and employee.evaluation_plan_id.id: evaluation_plan_id=employee.evaluation_plan_id.id return {'value': {'plan_id':evaluation_plan_id}}
468,657
def button_plan_in_progress(self, cr, uid, ids, context=None): hr_eval_inter_obj = self.pool.get('hr.evaluation.interview') if context is None: context = {} apprai_id = [] for evaluation in self.browse(cr, uid, ids, context=context): wait = False for phase in evaluation.plan_id.phase_ids: childs = [] if phase.action == "bottom-up": childs = evaluation.employee_id.child_ids elif phase.action in ("top-down", "final"): if evaluation.employee_id.parent_id: childs = [evaluation.employee_id.parent_id] elif phase.action == "self": childs = [evaluation.employee_id] for child in childs:
def button_plan_in_progress(self, cr, uid, ids, context=None): hr_eval_inter_obj = self.pool.get('hr.evaluation.interview') if context is None: context = {} for evaluation in self.browse(cr, uid, ids, context=context): wait = False for phase in evaluation.plan_id.phase_ids: childs = [] if phase.action == "bottom-up": childs = evaluation.employee_id.child_ids elif phase.action in ("top-down", "final"): if evaluation.employee_id.parent_id: childs = [evaluation.employee_id.parent_id] elif phase.action == "self": childs = [evaluation.employee_id] for child in childs:
468,658
def _fnct_read(self, obj, cr, uid, ids, field_name, args, context=None): self._field_get2(cr, uid, obj, context) if not ids: return {} relation = obj._name if self._type in ('one2many', 'many2many'): res = {}.fromkeys(ids, []) else: res = {}.fromkeys(ids, False)
def _fnct_read(self, obj, cr, uid, ids, field_name, args, context=None): self._field_get2(cr, uid, obj, context) if not ids: return {} relation = obj._name if self._type in ('one2many', 'many2many'): res = dict([(i, []) for i in ids]) else: res = {}.fromkeys(ids, False)
468,659
def msg_new(self, cr, uid, msg, model): print ' MSG NEW' , model message = self.msg_body_get(msg) res_model = self.pool.get(model) res_id = res_model.msg_new(cr, uid, msg) if res_id: attachments = message['attachment']
def msg_new(self, cr, uid, msg, model): message = self.msg_body_get(msg) res_model = self.pool.get(model) res_id = res_model.msg_new(cr, uid, msg) if res_id: attachments = message['attachment']
468,660
def process_liness(self, datas, prefix, current_module, model_name, fields_def, position=0): line = datas[position] row = {} translate = {} todo = [] warning = [] data_id = False data_res_id = False is_xml_id = False is_db_id = False ir_model_data_obj = self.pool.get('ir.model.data') # # Import normal fields # for i in range(len(fields)): if i >= len(line): raise Exception(_('Please check that all your lines have %d columns.') % (len(fields),)) if not line[i]: continue
def process_liness(self, datas, prefix, current_module, model_name, fields_def, position=0): line = datas[position] row = {} translate = {} todo = [] warning = [] data_id = False data_res_id = False is_xml_id = False is_db_id = False ir_model_data_obj = self.pool.get('ir.model.data') # # Import normal fields # for i in range(len(fields)): if i >= len(line): raise Exception(_('Please check that all your lines have %d columns.') % (len(fields),)) if not line[i]: continue
468,661
def process_liness(self, datas, prefix, current_module, model_name, fields_def, position=0): line = datas[position] row = {} translate = {} todo = [] warning = [] data_id = False data_res_id = False is_xml_id = False is_db_id = False ir_model_data_obj = self.pool.get('ir.model.data') # # Import normal fields # for i in range(len(fields)): if i >= len(line): raise Exception(_('Please check that all your lines have %d columns.') % (len(fields),)) if not line[i]: continue
def process_liness(self, datas, prefix, current_module, model_name, fields_def, position=0): line = datas[position] row = {} translate = {} todo = [] warning = [] data_id = False data_res_id = False is_xml_id = False is_db_id = False ir_model_data_obj = self.pool.get('ir.model.data') # # Import normal fields # for i in range(len(fields)): if i >= len(line): raise Exception(_('Please check that all your lines have %d columns.') % (len(fields),)) if not line[i]: continue
468,662
def onchange_lot_id(self, cr, uid, ids, prodlot_id=False, product_qty=False, loc_id=False, product_id=False, context=None): """ On change of production lot gives a warning message. @param prodlot_id: Changed production lot id @param product_qty: Quantity of product @param loc_id: Location id @param product_id: Product id @return: Warning message """ if not prodlot_id or not loc_id: return {} ctx = context and context.copy() or {} ctx['location_id'] = loc_id prodlot = self.pool.get('stock.production.lot').browse(cr, uid, prodlot_id, ctx) location = self.pool.get('stock.location').browse(cr, uid, loc_id) warning = {} if (location.usage == 'internal') and (product_qty > (prodlot.stock_available or 0.0)): warning = { 'title': 'Bad Lot Assignation !', 'message': 'You are moving %.2f products but only %.2f available in this lot.' % (product_qty, prodlot.stock_available or 0.0) } return {'warning': warning}
def onchange_lot_id(self, cr, uid, ids, prodlot_id=False, product_qty=False, loc_id=False, product_id=False, context=None): """ On change of production lot gives a warning message. @param prodlot_id: Changed production lot id @param product_qty: Quantity of product @param loc_id: Location id @param product_id: Product id @return: Warning message """ if not prodlot_id or not loc_id: return {} ctx = context and context.copy() or {} ctx['location_id'] = loc_id prodlot = self.pool.get('stock.production.lot').browse(cr, uid, prodlot_id, ctx) location = self.pool.get('stock.location').browse(cr, uid, loc_id) warning = {} if (location.usage == 'internal') and (product_qty > (prodlot.stock_available or 0.0)): warning = { 'title': _('Bad Lot Assignation !'), 'message': _('You are moving %.2f products but only %.2f available in this lot.') % (product_qty, prodlot.stock_available or 0.0) } return {'warning': warning}
468,663
def _check_xml(self, cr, uid, ids, context=None): logger = logging.getLogger('init') for view in self.browse(cr, uid, ids, context): eview = etree.fromstring(view.arch.encode('utf8')) frng = tools.file_open(os.path.join('base','rng','view.rng')) relaxng_doc = etree.parse(frng) relaxng = etree.RelaxNG(relaxng_doc) if not relaxng.validate(eview): for error in relaxng.error_log: logger.error(tools.ustr(error)) return False return True
def _check_xml(self, cr, uid, ids, context=None): logger = logging.getLogger('init') for view in self.browse(cr, uid, ids, context): eview = etree.fromstring(view.arch.encode('utf8')) frng = tools.file_open(os.path.join('base','rng','view.rng')) relaxng_doc = etree.parse(frng) relaxng = etree.RelaxNG(relaxng_doc) if not relaxng.validate(eview): for error in relaxng.error_log: logger.error(tools.ustr(error)) return False return True
468,664
def _check_xml(self, cr, uid, ids, context=None): logger = logging.getLogger('init') for view in self.browse(cr, uid, ids, context): eview = etree.fromstring(view.arch.encode('utf8')) frng = tools.file_open(os.path.join('base','rng','view.rng')) relaxng_doc = etree.parse(frng) relaxng = etree.RelaxNG(relaxng_doc) if not relaxng.validate(eview): for error in relaxng.error_log: logger.error(tools.ustr(error)) return False return True
def _check_xml(self, cr, uid, ids, context=None): logger = logging.getLogger('init') for view in self.browse(cr, uid, ids, context): eview = etree.fromstring(view.arch.encode('utf8')) frng = tools.file_open(os.path.join('base','rng','view.rng')) relaxng_doc = etree.parse(frng) relaxng = etree.RelaxNG(relaxng_doc) if not relaxng.validate(eview): for error in relaxng.error_log: logger.error(tools.ustr(error)) return False return True
468,665
def _check_xml(self, cr, uid, ids, context=None): logger = logging.getLogger('init') for view in self.browse(cr, uid, ids, context): eview = etree.fromstring(view.arch.encode('utf8')) frng = tools.file_open(os.path.join('base','rng','view.rng')) relaxng_doc = etree.parse(frng) relaxng = etree.RelaxNG(relaxng_doc) if not relaxng.validate(eview): for error in relaxng.error_log: logger.error(tools.ustr(error)) return False return True
def _check_xml(self, cr, uid, ids, context=None): logger = logging.getLogger('init') for view in self.browse(cr, uid, ids, context): eview = etree.fromstring(view.arch.encode('utf8')) frng = tools.file_open(os.path.join('base','rng','view.rng')) relaxng_doc = etree.parse(frng) relaxng = etree.RelaxNG(relaxng_doc) if not relaxng.validate(eview): for error in relaxng.error_log: logger.error(tools.ustr(error)) return False return True
468,666
def _check_xml(self, cr, uid, ids, context=None): logger = logging.getLogger('init') for view in self.browse(cr, uid, ids, context): eview = etree.fromstring(view.arch.encode('utf8')) frng = tools.file_open(os.path.join('base','rng','view.rng')) relaxng_doc = etree.parse(frng) relaxng = etree.RelaxNG(relaxng_doc) if not relaxng.validate(eview): for error in relaxng.error_log: logger.error(tools.ustr(error)) return False return True
def _check_xml(self, cr, uid, ids, context=None): logger = logging.getLogger('init') for view in self.browse(cr, uid, ids, context): eview = etree.fromstring(view.arch.encode('utf8')) frng = tools.file_open(os.path.join('base','rng','view.rng')) relaxng_doc = etree.parse(frng) relaxng = etree.RelaxNG(relaxng_doc) if not relaxng.validate(eview): for error in relaxng.error_log: logger.error(tools.ustr(error)) return False return True
468,667
def graph_get(self, cr, uid, id, model, node_obj, conn_obj, src_node, des_node,label,scale,context={}): if not label: label = [] nodes=[] nodes_name=[] transitions=[] start=[] tres={} labels={} no_ancester=[] blank_nodes = []
def graph_get(self, cr, uid, id, model, node_obj, conn_obj, src_node, des_node,label,scale,context={}): if not label: label = [] nodes=[] nodes_name=[] transitions=[] start=[] tres={} labels={} no_ancester=[] blank_nodes = []
468,668
def process_liness(self, datas, prefix, current_module, model_name, fields_def, position=0): line = datas[position] row = {} translate = {} todo = [] warning = [] data_id = False data_res_id = False is_xml_id = False is_db_id = False ir_model_data_obj = self.pool.get('ir.model.data') # # Import normal fields # for i in range(len(fields)): if i >= len(line): raise Exception(_('Please check that all your lines have %d columns.') % (len(fields),)) if not line[i]: continue
def process_liness(self, datas, prefix, current_module, model_name, fields_def, position=0): line = datas[position] row = {} translate = {} todo = [] warning = [] data_id = False data_res_id = False is_xml_id = False is_db_id = False ir_model_data_obj = self.pool.get('ir.model.data') # # Import normal fields # for i in range(len(fields)): if i >= len(line): raise Exception(_('Please check that all your lines have %d columns.') % (len(fields),)) if not line[i]: continue
468,669
def process_liness(self, datas, prefix, current_module, model_name, fields_def, position=0): line = datas[position] row = {} translate = {} todo = [] warning = [] data_id = False data_res_id = False is_xml_id = False is_db_id = False ir_model_data_obj = self.pool.get('ir.model.data') # # Import normal fields # for i in range(len(fields)): if i >= len(line): raise Exception(_('Please check that all your lines have %d columns.') % (len(fields),)) if not line[i]: continue
def process_liness(self, datas, prefix, current_module, model_name, fields_def, position=0): line = datas[position] row = {} translate = {} todo = [] warning = [] data_id = False data_res_id = False is_xml_id = False is_db_id = False ir_model_data_obj = self.pool.get('ir.model.data') # # Import normal fields # for i in range(len(fields)): if i >= len(line): raise Exception(_('Please check that all your lines have %d columns.') % (len(fields),)) if not line[i]: continue
468,670
def _get_charts(self, cr, uid, context=None): modules = self.pool.get('ir.module.module') ids = modules.search(cr, uid, [('category_id','=','Account Charts')]) charts = list( sorted(((m.name, m.shortdesc) for m in modules.browse(cr, uid, ids)), key=itemgetter(1))) charts.insert(0,('configurable','Generic Chart Of Account')) return charts
def _get_charts(self, cr, uid, context=None): modules = self.pool.get('ir.module.module') ids = modules.search(cr, uid, [('category_id','=','Account Charts')]) charts = list( sorted(((m.name, m.shortdesc) for m in modules.browse(cr, uid, ids)), key=itemgetter(1))) charts.insert(0,('configurable','Generic Chart Of Account')) return charts
468,671
def execute(self, cr, uid, ids, context=None): if context is None: context = {} data_pool = self.pool.get('ir.model.data') obj_acc = self.pool.get('account.account') super(account_installer, self).execute(cr, uid, ids, context=context) record = self.browse(cr, uid, ids, context=context)[0] company_id = self.pool.get('res.users').browse(cr, uid, [uid], context)[0].company_id for res in self.read(cr, uid, ids): if record.charts == 'configurable': mod_obj = self.pool.get('ir.model.data') fp = tools.file_open(opj('account','configurable_account_chart.xml')) tools.convert_xml_import(cr, 'account', fp, {}, 'init',True, None) fp.close() self.generate_configurable_chart(cr, uid, ids, context=context) obj_tax = self.pool.get('account.tax') obj_product = self.pool.get('product.product') ir_values = self.pool.get('ir.values') s_tax = (res.get('sale_tax',0.0))/100 p_tax = (res.get('purchase_tax',0.0))/100 tax_val = {} default_tax = []
def execute(self, cr, uid, ids, context=None): if context is None: context = {} data_pool = self.pool.get('ir.model.data') obj_acc = self.pool.get('account.account') super(account_installer, self).execute(cr, uid, ids, context=context) record = self.browse(cr, uid, ids, context=context)[0] company_id = self.pool.get('res.users').browse(cr, uid, [uid], context)[0].company_id for res in self.read(cr, uid, ids): if record.charts == 'configurable': mod_obj = self.pool.get('ir.model.data') fp = tools.file_open(opj('account','configurable_account_chart.xml')) tools.convert_xml_import(cr, 'account', fp, {}, 'init',True, None) fp.close() self.generate_configurable_chart(cr, uid, ids, context=context) obj_tax = self.pool.get('account.tax') obj_product = self.pool.get('product.product') ir_values = self.pool.get('ir.values') s_tax = (res.get('sale_tax',0.0))/100 p_tax = (res.get('purchase_tax',0.0))/100 tax_val = {} default_tax = []
468,672
def msg_new(self, msg): message = self.msg_body_get(msg) msg_subject = self._decode_header(msg['Subject']) msg_from = self._decode_header(msg['From']) msg_cc = self._decode_header(msg['Cc'] or '') data = { 'name': msg_subject, 'email_from': msg_from, 'email_cc': msg_cc, 'user_id': False, 'description': message['body'], 'state' : 'draft', } data.update(self.partner_get(msg_from))
def msg_new(self, msg): message = self.msg_body_get(msg) msg_subject = self._decode_header(msg['Subject']) msg_from = self._decode_header(msg['From']) msg_cc = self._decode_header(msg['Cc'] or '') data = { 'name': msg_subject, 'email_from': msg_from, 'email_cc': msg_cc, 'user_id': False, 'description': message['body'], 'state' : 'draft', } data.update(self.partner_get(msg_from))
468,673
def msg_user(self, msg, id): body = self.msg_body_get(msg)
def msg_user(self, msg, id): body = self.msg_body_get(msg)
468,674
def msg_partner(self, msg, id): message = self.msg_body_get(msg) body = message['body'] act = 'case_open' self.rpc(self.model, act, [id]) #body2 = '\n'.join(map(lambda l: '> '+l, (body or '').split('\n'))) #data = { # 'description':body, #} #self.rpc(self.model, 'write', [id], data) attachments = message['attachment'] for attach in attachments or []: data_attach = { 'name': str(attach), 'datas': binascii.b2a_base64(str(attachments[attach])), 'datas_fname': str(attach), 'description': 'Mail attachment', 'res_model': self.model, 'res_id': id } self.rpc('ir.attachment', 'create', data_attach) self.rpc(self.model, 'history', [id], 'Send', True, msg['From'], message['body']) return id
def msg_partner(self, msg, id): message = self.msg_body_get(msg) body = message['body'] act = 'case_open' self.rpc(self.model, act, [id]) #body2 = '\n'.join(map(lambda l: '> '+l, (body or '').split('\n'))) #data = { # 'description':body, #} #self.rpc(self.model, 'write', [id], data) attachments = message['attachment'] for attach in attachments or []: data_attach = { 'name': str(attach), 'datas': binascii.b2a_base64(str(attachments[attach])), 'datas_fname': str(attach), 'description': 'Mail attachment', 'res_model': self.model, 'res_id': id } self.rpc('ir.attachment', 'create', data_attach) self.rpc(self.model, 'history', [id], 'Send', True, self._decode_header(msg['From']), message['body']) return id
468,675
def reconcile(self, cr, uid, ids, context=None): move_line_obj = self.pool.get('account.move.line') obj_model = self.pool.get('ir.model.data') if context is None: context = {} form = self.read(cr, uid, ids, [])[0] max_amount = form.get('max_amount', 0.0) power = form['power'] reconciled = unreconciled = 0 if not form['account_ids']: raise osv.except_osv(_('UserError'), _('You must select accounts to reconcile')) for account_id in form['account_ids']: if not context.get('allow_write_off', False): query = "SELECT partner_id FROM account_move_line WHERE account_id=%s AND reconcile_id IS NULL \ AND state <> 'draft' GROUP BY partner_id \ HAVING ABS(SUM(debit-credit)) <> %s AND count(*)>0"%(account_id, 0.0) else: query = "SELECT partner_id FROM account_move_line WHERE account_id=%s AND reconcile_id IS NULL \ AND state <> 'draft' GROUP BY partner_id \ HAVING ABS(SUM(debit-credit)) <= %s AND count(*)>0"%(account_id, max_amount or 0.0) # reconcile automatically all transactions from partners whose balance is 0 cr.execute(query) partner_ids = [id for (id,) in cr.fetchall()] for partner_id in partner_ids: cr.execute( "SELECT id " \ "FROM account_move_line " \ "WHERE account_id=%s " \ "AND partner_id=%s " \ "AND state <> 'draft' " \ "AND reconcile_id IS NULL", (account_id, partner_id)) line_ids = [id for (id,) in cr.fetchall()] if len(line_ids): reconciled += len(line_ids) if not context.get('allow_write_off', False): move_line_obj.reconcile_partial(cr, uid, line_ids, 'manual', context={}) else: move_line_obj.reconcile(cr, uid, line_ids, 'auto', form['writeoff_acc_id'], form['period_id'], form['journal_id'], context)
def reconcile(self, cr, uid, ids, context=None): move_line_obj = self.pool.get('account.move.line') obj_model = self.pool.get('ir.model.data') if context is None: context = {} form = self.read(cr, uid, ids, [])[0] max_amount = form.get('max_amount', 0.0) power = form['power'] reconciled = unreconciled = 0 if not form['account_ids']: raise osv.except_osv(_('UserError'), _('You must select accounts to reconcile')) for account_id in form['account_ids']: if not allow_write_off: query = "SELECT partner_id FROM account_move_line WHERE account_id=%s AND reconcile_id IS NULL \ AND state <> 'draft' GROUP BY partner_id \ HAVING ABS(SUM(debit-credit)) <> %s AND count(*)>0"%(account_id, 0.0) else: query = "SELECT partner_id FROM account_move_line WHERE account_id=%s AND reconcile_id IS NULL \ AND state <> 'draft' GROUP BY partner_id \ HAVING ABS(SUM(debit-credit)) <= %s AND count(*)>0"%(account_id, max_amount or 0.0) # reconcile automatically all transactions from partners whose balance is 0 cr.execute(query) partner_ids = [id for (id,) in cr.fetchall()] for partner_id in partner_ids: cr.execute( "SELECT id " \ "FROM account_move_line " \ "WHERE account_id=%s " \ "AND partner_id=%s " \ "AND state <> 'draft' " \ "AND reconcile_id IS NULL", (account_id, partner_id)) line_ids = [id for (id,) in cr.fetchall()] if len(line_ids): reconciled += len(line_ids) if not allow_write_off: move_line_obj.reconcile_partial(cr, uid, line_ids, 'manual', context={}) else: move_line_obj.reconcile(cr, uid, line_ids, 'auto', form['writeoff_acc_id'], form['period_id'], form['journal_id'], context)
468,676
def reconcile(self, cr, uid, ids, context=None): move_line_obj = self.pool.get('account.move.line') obj_model = self.pool.get('ir.model.data') if context is None: context = {} form = self.read(cr, uid, ids, [])[0] max_amount = form.get('max_amount', 0.0) power = form['power'] reconciled = unreconciled = 0 if not form['account_ids']: raise osv.except_osv(_('UserError'), _('You must select accounts to reconcile')) for account_id in form['account_ids']: if not context.get('allow_write_off', False): query = "SELECT partner_id FROM account_move_line WHERE account_id=%s AND reconcile_id IS NULL \ AND state <> 'draft' GROUP BY partner_id \ HAVING ABS(SUM(debit-credit)) <> %s AND count(*)>0"%(account_id, 0.0) else: query = "SELECT partner_id FROM account_move_line WHERE account_id=%s AND reconcile_id IS NULL \ AND state <> 'draft' GROUP BY partner_id \ HAVING ABS(SUM(debit-credit)) <= %s AND count(*)>0"%(account_id, max_amount or 0.0) # reconcile automatically all transactions from partners whose balance is 0 cr.execute(query) partner_ids = [id for (id,) in cr.fetchall()] for partner_id in partner_ids: cr.execute( "SELECT id " \ "FROM account_move_line " \ "WHERE account_id=%s " \ "AND partner_id=%s " \ "AND state <> 'draft' " \ "AND reconcile_id IS NULL", (account_id, partner_id)) line_ids = [id for (id,) in cr.fetchall()] if len(line_ids): reconciled += len(line_ids) if not context.get('allow_write_off', False): move_line_obj.reconcile_partial(cr, uid, line_ids, 'manual', context={}) else: move_line_obj.reconcile(cr, uid, line_ids, 'auto', form['writeoff_acc_id'], form['period_id'], form['journal_id'], context)
def reconcile(self, cr, uid, ids, context=None): move_line_obj = self.pool.get('account.move.line') obj_model = self.pool.get('ir.model.data') if context is None: context = {} form = self.read(cr, uid, ids, [])[0] max_amount = form.get('max_amount', 0.0) power = form['power'] reconciled = unreconciled = 0 if not form['account_ids']: raise osv.except_osv(_('UserError'), _('You must select accounts to reconcile')) for account_id in form['account_ids']: if not context.get('allow_write_off', False): query = "SELECT partner_id FROM account_move_line WHERE account_id=%s AND reconcile_id IS NULL \ AND state <> 'draft' GROUP BY partner_id \ HAVING ABS(SUM(debit-credit)) = %s AND count(*)>0"%(account_id, 0.0) else: query = "SELECT partner_id FROM account_move_line WHERE account_id=%s AND reconcile_id IS NULL \ AND state <> 'draft' GROUP BY partner_id \ HAVING ABS(SUM(debit-credit)) <= %s AND count(*)>0"%(account_id, max_amount or 0.0) # reconcile automatically all transactions from partners whose balance is 0 cr.execute(query) partner_ids = [id for (id,) in cr.fetchall()] for partner_id in partner_ids: cr.execute( "SELECT id " \ "FROM account_move_line " \ "WHERE account_id=%s " \ "AND partner_id=%s " \ "AND state <> 'draft' " \ "AND reconcile_id IS NULL", (account_id, partner_id)) line_ids = [id for (id,) in cr.fetchall()] if len(line_ids): reconciled += len(line_ids) if not context.get('allow_write_off', False): move_line_obj.reconcile_partial(cr, uid, line_ids, 'manual', context={}) else: move_line_obj.reconcile(cr, uid, line_ids, 'auto', form['writeoff_acc_id'], form['period_id'], form['journal_id'], context)
468,677
def reconcile(self, cr, uid, ids, context=None): move_line_obj = self.pool.get('account.move.line') obj_model = self.pool.get('ir.model.data') if context is None: context = {} form = self.read(cr, uid, ids, [])[0] max_amount = form.get('max_amount', 0.0) power = form['power'] reconciled = unreconciled = 0 if not form['account_ids']: raise osv.except_osv(_('UserError'), _('You must select accounts to reconcile')) for account_id in form['account_ids']: if not context.get('allow_write_off', False): query = "SELECT partner_id FROM account_move_line WHERE account_id=%s AND reconcile_id IS NULL \ AND state <> 'draft' GROUP BY partner_id \ HAVING ABS(SUM(debit-credit)) <> %s AND count(*)>0"%(account_id, 0.0) else: query = "SELECT partner_id FROM account_move_line WHERE account_id=%s AND reconcile_id IS NULL \ AND state <> 'draft' GROUP BY partner_id \ HAVING ABS(SUM(debit-credit)) <= %s AND count(*)>0"%(account_id, max_amount or 0.0) # reconcile automatically all transactions from partners whose balance is 0 cr.execute(query) partner_ids = [id for (id,) in cr.fetchall()] for partner_id in partner_ids: cr.execute( "SELECT id " \ "FROM account_move_line " \ "WHERE account_id=%s " \ "AND partner_id=%s " \ "AND state <> 'draft' " \ "AND reconcile_id IS NULL", (account_id, partner_id)) line_ids = [id for (id,) in cr.fetchall()] if len(line_ids): reconciled += len(line_ids) if not context.get('allow_write_off', False): move_line_obj.reconcile_partial(cr, uid, line_ids, 'manual', context={}) else: move_line_obj.reconcile(cr, uid, line_ids, 'auto', form['writeoff_acc_id'], form['period_id'], form['journal_id'], context)
def reconcile(self, cr, uid, ids, context=None): move_line_obj = self.pool.get('account.move.line') obj_model = self.pool.get('ir.model.data') if context is None: context = {} form = self.read(cr, uid, ids, [])[0] max_amount = form.get('max_amount', 0.0) power = form['power'] reconciled = unreconciled = 0 if not form['account_ids']: raise osv.except_osv(_('UserError'), _('You must select accounts to reconcile')) for account_id in form['account_ids']: if not context.get('allow_write_off', False): query = "SELECT partner_id FROM account_move_line WHERE account_id=%s AND reconcile_id IS NULL \ AND state <> 'draft' GROUP BY partner_id \ HAVING ABS(SUM(debit-credit)) <> %s AND count(*)>0"%(account_id, 0.0) else: query = "SELECT partner_id FROM account_move_line WHERE account_id=%s AND reconcile_id IS NULL \ AND state <> 'draft' GROUP BY partner_id \ HAVING ABS(SUM(debit-credit)) < %s AND count(*)>0"%(account_id, max_amount or 0.0) # reconcile automatically all transactions from partners whose balance is 0 cr.execute(query) partner_ids = [id for (id,) in cr.fetchall()] for partner_id in partner_ids: cr.execute( "SELECT id " \ "FROM account_move_line " \ "WHERE account_id=%s " \ "AND partner_id=%s " \ "AND state <> 'draft' " \ "AND reconcile_id IS NULL", (account_id, partner_id)) line_ids = [id for (id,) in cr.fetchall()] if len(line_ids): reconciled += len(line_ids) if not context.get('allow_write_off', False): move_line_obj.reconcile_partial(cr, uid, line_ids, 'manual', context={}) else: move_line_obj.reconcile(cr, uid, line_ids, 'auto', form['writeoff_acc_id'], form['period_id'], form['journal_id'], context)
468,678
def reconcile(self, cr, uid, ids, context=None): move_line_obj = self.pool.get('account.move.line') obj_model = self.pool.get('ir.model.data') if context is None: context = {} form = self.read(cr, uid, ids, [])[0] max_amount = form.get('max_amount', 0.0) power = form['power'] reconciled = unreconciled = 0 if not form['account_ids']: raise osv.except_osv(_('UserError'), _('You must select accounts to reconcile')) for account_id in form['account_ids']: if not context.get('allow_write_off', False): query = "SELECT partner_id FROM account_move_line WHERE account_id=%s AND reconcile_id IS NULL \ AND state <> 'draft' GROUP BY partner_id \ HAVING ABS(SUM(debit-credit)) <> %s AND count(*)>0"%(account_id, 0.0) else: query = "SELECT partner_id FROM account_move_line WHERE account_id=%s AND reconcile_id IS NULL \ AND state <> 'draft' GROUP BY partner_id \ HAVING ABS(SUM(debit-credit)) <= %s AND count(*)>0"%(account_id, max_amount or 0.0) # reconcile automatically all transactions from partners whose balance is 0 cr.execute(query) partner_ids = [id for (id,) in cr.fetchall()] for partner_id in partner_ids: cr.execute( "SELECT id " \ "FROM account_move_line " \ "WHERE account_id=%s " \ "AND partner_id=%s " \ "AND state <> 'draft' " \ "AND reconcile_id IS NULL", (account_id, partner_id)) line_ids = [id for (id,) in cr.fetchall()] if len(line_ids): reconciled += len(line_ids) if not context.get('allow_write_off', False): move_line_obj.reconcile_partial(cr, uid, line_ids, 'manual', context={}) else: move_line_obj.reconcile(cr, uid, line_ids, 'auto', form['writeoff_acc_id'], form['period_id'], form['journal_id'], context)
def reconcile(self, cr, uid, ids, context=None): move_line_obj = self.pool.get('account.move.line') obj_model = self.pool.get('ir.model.data') if context is None: context = {} form = self.read(cr, uid, ids, [])[0] max_amount = form.get('max_amount', 0.0) power = form['power'] reconciled = unreconciled = 0 if not form['account_ids']: raise osv.except_osv(_('UserError'), _('You must select accounts to reconcile')) for account_id in form['account_ids']: if allow_write_off: move_line_obj.reconcile(cr, uid, line_ids, 'auto', form['writeoff_acc_id'], form['period_id'], form['journal_id'], context) else: query = "SELECT partner_id FROM account_move_line WHERE account_id=%s AND reconcile_id IS NULL \ AND state <> 'draft' GROUP BY partner_id \ HAVING ABS(SUM(debit-credit)) <> %s AND count(*)>0"%(account_id, 0.0) else: query = "SELECT partner_id FROM account_move_line WHERE account_id=%s AND reconcile_id IS NULL \ AND state <> 'draft' GROUP BY partner_id \ HAVING ABS(SUM(debit-credit)) <= %s AND count(*)>0"%(account_id, max_amount or 0.0) # reconcile automatically all transactions from partners whose balance is 0 cr.execute(query) partner_ids = [id for (id,) in cr.fetchall()] for partner_id in partner_ids: cr.execute( "SELECT id " \ "FROM account_move_line " \ "WHERE account_id=%s " \ "AND partner_id=%s " \ "AND state <> 'draft' " \ "AND reconcile_id IS NULL", (account_id, partner_id)) line_ids = [id for (id,) in cr.fetchall()] if len(line_ids): reconciled += len(line_ids) if allow_write_off: move_line_obj.reconcile(cr, uid, line_ids, 'auto', form['writeoff_acc_id'], form['period_id'], form['journal_id'], context) else: move_line_obj.reconcile_partial(cr, uid, line_ids, 'manual', context={}) else: move_line_obj.reconcile(cr, uid, line_ids, 'auto', form['writeoff_acc_id'], form['period_id'], form['journal_id'], context)
468,679
def reconcile(self, cr, uid, ids, context=None): move_line_obj = self.pool.get('account.move.line') obj_model = self.pool.get('ir.model.data') if context is None: context = {} form = self.read(cr, uid, ids, [])[0] max_amount = form.get('max_amount', 0.0) power = form['power'] reconciled = unreconciled = 0 if not form['account_ids']: raise osv.except_osv(_('UserError'), _('You must select accounts to reconcile')) for account_id in form['account_ids']: if not context.get('allow_write_off', False): query = "SELECT partner_id FROM account_move_line WHERE account_id=%s AND reconcile_id IS NULL \ AND state <> 'draft' GROUP BY partner_id \ HAVING ABS(SUM(debit-credit)) <> %s AND count(*)>0"%(account_id, 0.0) else: query = "SELECT partner_id FROM account_move_line WHERE account_id=%s AND reconcile_id IS NULL \ AND state <> 'draft' GROUP BY partner_id \ HAVING ABS(SUM(debit-credit)) <= %s AND count(*)>0"%(account_id, max_amount or 0.0) # reconcile automatically all transactions from partners whose balance is 0 cr.execute(query) partner_ids = [id for (id,) in cr.fetchall()] for partner_id in partner_ids: cr.execute( "SELECT id " \ "FROM account_move_line " \ "WHERE account_id=%s " \ "AND partner_id=%s " \ "AND state <> 'draft' " \ "AND reconcile_id IS NULL", (account_id, partner_id)) line_ids = [id for (id,) in cr.fetchall()] if len(line_ids): reconciled += len(line_ids) if not context.get('allow_write_off', False): move_line_obj.reconcile_partial(cr, uid, line_ids, 'manual', context={}) else: move_line_obj.reconcile(cr, uid, line_ids, 'auto', form['writeoff_acc_id'], form['period_id'], form['journal_id'], context)
def reconcile(self, cr, uid, ids, context=None): move_line_obj = self.pool.get('account.move.line') obj_model = self.pool.get('ir.model.data') if context is None: context = {} form = self.read(cr, uid, ids, [])[0] max_amount = form.get('max_amount', 0.0) power = form['power'] reconciled = unreconciled = 0 if not form['account_ids']: raise osv.except_osv(_('UserError'), _('You must select accounts to reconcile')) for account_id in form['account_ids']: if not context.get('allow_write_off', False): query = "SELECT partner_id FROM account_move_line WHERE account_id=%s AND reconcile_id IS NULL \ AND state <> 'draft' GROUP BY partner_id \ HAVING ABS(SUM(debit-credit)) <> %s AND count(*)>0"%(account_id, 0.0) else: query = "SELECT partner_id FROM account_move_line WHERE account_id=%s AND reconcile_id IS NULL \ AND state <> 'draft' GROUP BY partner_id \ HAVING ABS(SUM(debit-credit)) <= %s AND count(*)>0"%(account_id, max_amount or 0.0) # reconcile automatically all transactions from partners whose balance is 0 cr.execute(query) partner_ids = [id for (id,) in cr.fetchall()] for partner_id in partner_ids: cr.execute( "SELECT id " \ "FROM account_move_line " \ "WHERE account_id=%s " \ "AND partner_id=%s " \ "AND state <> 'draft' " \ "AND reconcile_id IS NULL", (account_id, partner_id)) line_ids = [id for (id,) in cr.fetchall()] if len(line_ids): reconciled += len(line_ids) if not context.get('allow_write_off', False): move_line_obj.reconcile_partial(cr, uid, line_ids, 'manual', context={}) else: move_line_obj.reconcile(cr, uid, line_ids, 'auto', form['writeoff_acc_id'], form['period_id'], form['journal_id'], context)
468,680
def reconcile(self, cr, uid, ids, context=None): move_line_obj = self.pool.get('account.move.line') obj_model = self.pool.get('ir.model.data') if context is None: context = {} form = self.read(cr, uid, ids, [])[0] max_amount = form.get('max_amount', 0.0) power = form['power'] reconciled = unreconciled = 0 if not form['account_ids']: raise osv.except_osv(_('UserError'), _('You must select accounts to reconcile')) for account_id in form['account_ids']: if not context.get('allow_write_off', False): query = "SELECT partner_id FROM account_move_line WHERE account_id=%s AND reconcile_id IS NULL \ AND state <> 'draft' GROUP BY partner_id \ HAVING ABS(SUM(debit-credit)) <> %s AND count(*)>0"%(account_id, 0.0) else: query = "SELECT partner_id FROM account_move_line WHERE account_id=%s AND reconcile_id IS NULL \ AND state <> 'draft' GROUP BY partner_id \ HAVING ABS(SUM(debit-credit)) <= %s AND count(*)>0"%(account_id, max_amount or 0.0) # reconcile automatically all transactions from partners whose balance is 0 cr.execute(query) partner_ids = [id for (id,) in cr.fetchall()] for partner_id in partner_ids: cr.execute( "SELECT id " \ "FROM account_move_line " \ "WHERE account_id=%s " \ "AND partner_id=%s " \ "AND state <> 'draft' " \ "AND reconcile_id IS NULL", (account_id, partner_id)) line_ids = [id for (id,) in cr.fetchall()] if len(line_ids): reconciled += len(line_ids) if not context.get('allow_write_off', False): move_line_obj.reconcile_partial(cr, uid, line_ids, 'manual', context={}) else: move_line_obj.reconcile(cr, uid, line_ids, 'auto', form['writeoff_acc_id'], form['period_id'], form['journal_id'], context)
def reconcile(self, cr, uid, ids, context=None): move_line_obj = self.pool.get('account.move.line') obj_model = self.pool.get('ir.model.data') if context is None: context = {} form = self.read(cr, uid, ids, [])[0] max_amount = form.get('max_amount', 0.0) power = form['power'] reconciled = unreconciled = 0 if not form['account_ids']: raise osv.except_osv(_('UserError'), _('You must select accounts to reconcile')) for account_id in form['account_ids']: if not context.get('allow_write_off', False): query = "SELECT partner_id FROM account_move_line WHERE account_id=%s AND reconcile_id IS NULL \ AND state <> 'draft' GROUP BY partner_id \ HAVING ABS(SUM(debit-credit)) <> %s AND count(*)>0"%(account_id, 0.0) else: query = "SELECT partner_id FROM account_move_line WHERE account_id=%s AND reconcile_id IS NULL \ AND state <> 'draft' GROUP BY partner_id \ HAVING ABS(SUM(debit-credit)) <= %s AND count(*)>0"%(account_id, max_amount or 0.0) # reconcile automatically all transactions from partners whose balance is 0 cr.execute(query) partner_ids = [id for (id,) in cr.fetchall()] for partner_id in partner_ids: cr.execute( "SELECT id " \ "FROM account_move_line " \ "WHERE account_id=%s " \ "AND partner_id=%s " \ "AND state <> 'draft' " \ "AND reconcile_id IS NULL", (account_id, partner_id)) line_ids = [id for (id,) in cr.fetchall()] if len(line_ids): reconciled += len(line_ids) if not context.get('allow_write_off', False): move_line_obj.reconcile_partial(cr, uid, line_ids, 'manual', context={}) else: move_line_obj.reconcile(cr, uid, line_ids, 'auto', form['writeoff_acc_id'], form['period_id'], form['journal_id'], context)
468,681
def calc_date(self, cr, uid, context=None): """Compute the limit date for a given date""" if context is None: context = {} if not context.get('product_id', False): date = False else: product = pooler.get_pool(cr.dbname).get('product.product').browse( cr, uid, context['product_id']) duration = getattr(product, dtype) # set date to False when no expiry time specified on the product date = duration and (datetime.datetime.today() + datetime.timedelta(days=duration)) return date and date.strftime('%Y-%m-%d %H:%M:%S')
def calc_date(self, cr, uid, context=None): """Compute the limit date for a given date""" if context is None: context = {} if not context.get('product_id', False): date = False else: product = pooler.get_pool(cr.dbname).get('product.product').browse( cr, uid, context['product_id']) duration = getattr(product, dtype) # set date to False when no expiry time specified on the product date = duration and (datetime.datetime.today() + datetime.timedelta(days=duration)) return date and date.strftime('%Y-%m-%d %H:%M:%S')
468,682
def create(self, cr, uid, vals, context=None): newid = super(stock_production_lot, self).create(cr, uid, vals, context=context) obj = self.browse(cr, uid, newid, context=context) towrite = [] for f in ('life_date','use_date','removal_date','alert_date'): if not getattr(obj, f): towrite.append(f) context = context or {} context['product_id'] = obj.product_id.id self.write(cr, uid, [obj.id], self.default_get(cr, uid, towrite, context=context)) return newid
def create(self, cr, uid, vals, context=None): newid = super(stock_production_lot, self).create(cr, uid, vals, context=context) obj = self.browse(cr, uid, newid, context=context) towrite = [] for f in ('life_date', 'use_date', 'removal_date', 'alert_date'): if not getattr(obj, f): towrite.append(f) context = context or {} context['product_id'] = obj.product_id.id self.write(cr, uid, [obj.id], self.default_get(cr, uid, towrite, context=context)) return newid
468,683
def create(self, cr, uid, vals, context=None): newid = super(stock_production_lot, self).create(cr, uid, vals, context=context) obj = self.browse(cr, uid, newid, context=context) towrite = [] for f in ('life_date','use_date','removal_date','alert_date'): if not getattr(obj, f): towrite.append(f) context = context or {} context['product_id'] = obj.product_id.id self.write(cr, uid, [obj.id], self.default_get(cr, uid, towrite, context=context)) return newid
def create(self, cr, uid, vals, context=None): newid = super(stock_production_lot, self).create(cr, uid, vals, context=context) obj = self.browse(cr, uid, newid, context=context) towrite = [] for f in ('life_date','use_date','removal_date','alert_date'): if not getattr(obj, f): towrite.append(f) context = context or {} context['product_id'] = obj.product_id.id self.write(cr, uid, [obj.id], self.default_get(cr, uid, towrite, context=context)) return newid
468,684
def create(self, cr, uid, vals, context=None): newid = super(stock_production_lot, self).create(cr, uid, vals, context=context) obj = self.browse(cr, uid, newid, context=context) towrite = [] for f in ('life_date','use_date','removal_date','alert_date'): if not getattr(obj, f): towrite.append(f) context = context or {} context['product_id'] = obj.product_id.id self.write(cr, uid, [obj.id], self.default_get(cr, uid, towrite, context=context)) return newid
defcreate(self,cr,uid,vals,context=None):newid=super(stock_production_lot,self).create(cr,uid,vals,context=context)obj=self.browse(cr,uid,newid,context=context)towrite=[]forfin('life_date','use_date','removal_date','alert_date'):ifnotgetattr(obj,f):towrite.append(f)context=contextor{}context['product_id']=obj.product_id.idself.write(cr,uid,[obj.id],self.default_get(cr,uid,towrite,context=context))returnnewid
468,685
def convert_field(f): f_qual = "%s.%s" % (self._table, f) # need fully-qualified references in case len(tables) > 1 if f in ('create_date', 'write_date'): return "date_trunc('second', %s) as %s" % (f_qual, f) if f == self.CONCURRENCY_CHECK_FIELD: if self._log_access: return "COALESCE(%s.write_date, %s.create_date, now())::timestamp AS %s" % (self._table, self._table, f,) return "now()::timestamp AS %s" % (f,) if isinstance(self._columns[f], fields.binary) and context.get('bin_size', False): return 'length(%s) as "%s"' % (f_qual, f) return f_qual
def convert_field(f): f_qual = "%s.%s" % (self._table, f) # need fully-qualified references in case len(tables) > 1 if f in ('create_date', 'write_date'): return "date_trunc('second', %s) as %s" % (f_qual, f) if f == self.CONCURRENCY_CHECK_FIELD: if self._log_access: return "COALESCE(%s.write_date, %s.create_date, now())::timestamp AS %s" % (self._table, self._table, f,) return "now()::timestamp AS %s" % (f,) if isinstance(self._columns[f], fields.binary) and context.get('bin_size', False): return 'length(%s) as "%s"' % (f_qual, f) return f_qual
468,686
def check_group(node): if node.get('groups'): groups = node.get('groups').split(',') readonly = False access_pool = self.pool.get('ir.model.access') for group in groups: readonly = readonly or access_pool.check_groups(cr, user, group) if not readonly: node.set('invisible', '1') del(node.attrib['groups'])
def check_group(node): if node.get('groups'): groups = node.get('groups').split(',') can_see = False access_pool = self.pool.get('ir.model.access') for group in groups: readonly = readonly or access_pool.check_groups(cr, user, group) if not readonly: node.set('invisible', '1') del(node.attrib['groups'])
468,687
def check_group(node): if node.get('groups'): groups = node.get('groups').split(',') readonly = False access_pool = self.pool.get('ir.model.access') for group in groups: readonly = readonly or access_pool.check_groups(cr, user, group) if not readonly: node.set('invisible', '1') del(node.attrib['groups'])
def check_group(node): if node.get('groups'): groups = node.get('groups').split(',') readonly = False access_pool = self.pool.get('ir.model.access') for group in groups: can_see = can_see or access_pool.check_groups(cr, user, group) if can_see: break if not can_see: node.set('invisible', '1') del(node.attrib['groups'])
468,688
def check_group(node): if node.get('groups'): groups = node.get('groups').split(',') readonly = False access_pool = self.pool.get('ir.model.access') for group in groups: readonly = readonly or access_pool.check_groups(cr, user, group) if not readonly: node.set('invisible', '1') del(node.attrib['groups'])
defreturn can_see check_group(node):return can_see ifreturn can_see node.get('groups'):return can_see groupsreturn can_see =return can_see node.get('groups').split(',')return can_see readonlyreturn can_see =return can_see Falsereturn can_see access_poolreturn can_see =return can_see self.pool.get('ir.model.access')return can_see forreturn can_see groupreturn can_see inreturn can_see groups:return can_see readonlyreturn can_see =return can_see readonlyreturn can_see orreturn can_see access_pool.check_groups(cr,return can_see user,return can_see group)return can_see ifreturn can_see notreturn can_see readonly:return can_see node.set('invisible',return can_see '1')return can_see del(node.attrib['groups'])
468,689
def check_group(node): if node.get('groups'): groups = node.get('groups').split(',') readonly = False access_pool = self.pool.get('ir.model.access') for group in groups: readonly = readonly or access_pool.check_groups(cr, user, group) if not readonly: node.set('invisible', '1') del(node.attrib['groups'])
def check_group(node): if node.get('groups'): groups = node.get('groups').split(',') readonly = False access_pool = self.pool.get('ir.model.access') for group in groups: readonly = readonly or access_pool.check_groups(cr, user, group) if not readonly: node.set('invisible', '1') del(node.attrib['groups'])
468,690
def check_group(node): if node.get('groups'): groups = node.get('groups').split(',') readonly = False access_pool = self.pool.get('ir.model.access') for group in groups: readonly = readonly or access_pool.check_groups(cr, user, group) if not readonly: node.set('invisible', '1') del(node.attrib['groups'])
def check_group(node): if node.get('groups'): groups = node.get('groups').split(',') readonly = False access_pool = self.pool.get('ir.model.access') for group in groups: readonly = readonly or access_pool.check_groups(cr, user, group) if not readonly: node.set('invisible', '1') del(node.attrib['groups'])
468,691
def _name_search(self, cr, user, name='', args=None, operator='ilike', context=None, limit=100, name_get_uid=None): if not args: args = [] if not context: context = {} args = args[:] if name: args += [(self._rec_name, operator, name)] ids = self.search(cr, user, args, limit=limit, context=context) res = self.name_get(cr, name_get_uid, ids, context) return res
def _name_search(self, cr, user, name='', args=None, operator='ilike', context=None, limit=100, name_get_uid=None): if not args: args = [] if not context: context = {} args = args[:] if name: args += [(self._rec_name, operator, name)] ids = self.search(cr, user, args, limit=limit, context=context) res = self.name_get(cr, name_get_uid or user, ids, context) return res
468,692
def name_search(self, cr, user, name='', args=None, operator='ilike', context=None, limit=100): """
def name_search(self, cr, user, name='', args=None, operator='ilike', context=None, limit=100): """
468,693
def convert_field(f): if f in ('create_date', 'write_date'): return "date_trunc('second', %s) as %s" % (f, f) if f == self.CONCURRENCY_CHECK_FIELD: if self._log_access: return "COALESCE(%s.write_date, %s.create_date, now())::timestamp AS %s" % (self._table, self._table, f,) return "now()::timestamp AS %s" % (f,) if isinstance(self._columns[f], fields.binary) and context.get('bin_size', False): return 'length("%s") as "%s"' % (f, f) return '"%s"' % (f,)
def convert_field(f): if f in ('create_date', 'write_date'): return "date_trunc('second', %s) as %s" % (f, f) if f == self.CONCURRENCY_CHECK_FIELD: if self._log_access: return "COALESCE(%s.write_date, %s.create_date, now())::timestamp AS %s" % (self._table, self._table, f,) return "now()::timestamp AS %s" % (f,) if isinstance(self._columns[f], fields.binary) and context.get('bin_size', False): return 'length("%s") as "%s"' % (f, f) return '"%s"' % (f,)
468,694
def init(self, cr): tools.drop_view_if_exists(cr, 'project_issue_report') cr.execute(""" create or replace view project_issue_report as ( select min(c.id) as id, to_char(c.create_date, 'YYYY') as name, to_char(c.create_date, 'MM') as month, c.state, c.user_id, c.section_id, c.categ_id, c.stage_id, count(*) as nbr, sum(planned_revenue) as amount_revenue, sum(planned_cost) as amount_costs, sum(planned_revenue*probability/100)::decimal(16,2) as amount_revenue_prob, avg(probability)::decimal(16,2) as probability, to_char(avg(date_closed-c.create_date), 'DD"d" HH24:MI:SS') as delay_close from project_issue c group by to_char(c.create_date, 'YYYY'), to_char(c.create_date, 'MM'), c.state, c.user_id,c.section_id,c.categ_id,c.stage_id )""")
def init(self, cr): tools.drop_view_if_exists(cr, 'project_issue_report') cr.execute(""" create or replace view project_issue_report as ( select min(c.id) as id, to_char(c.create_date, 'YYYY') as name, to_char(c.create_date, 'MM') as month, c.state, c.user_id, c.section_id, c.categ_id, c.stage_id, count(*) as nbr, to_char(avg(date_closed-c.create_date), 'DD"d" HH24:MI:SS') as delay_close from project_issue c group by to_char(c.create_date, 'YYYY'), to_char(c.create_date, 'MM'), c.state, c.user_id,c.section_id,c.categ_id,c.stage_id )""")
468,695
def action_done(self, cr, uid, ids, context=None): move_obj = self.pool.get('stock.move') for inv in self.browse(cr,uid,ids): move_obj.action_done(cr, uid, [x.id for x in inv.move_ids], context) self.write(cr, uid, [inv.id], {'state':'done'}, context=context) return True
def action_done(self, cr, uid, ids, context=None): move_obj = self.pool.get('stock.move') for inv in self.browse(cr, uid, ids, context=context): move_obj.action_done(cr, uid, [x.id for x in inv.move_ids], context=context) self.write(cr, uid, [inv.id], {'state':'done'}, context=context) return True
468,696
def process_liness(self, datas, prefix, current_module, model_name, fields_def, position=0): line = datas[position] row = {} translate = {} todo = [] warning = [] data_id = False data_res_id = False is_xml_id = False is_db_id = False ir_model_data_obj = self.pool.get('ir.model.data') # # Import normal fields # for i in range(len(fields)): if i >= len(line): raise Exception(_('Please check that all your lines have %d columns.') % (len(fields),)) if not line[i]: continue
def process_liness(self, datas, prefix, current_module, model_name, fields_def, position=0): line = datas[position] row = {} translate = {} todo = [] warning = [] data_id = False data_res_id = False is_xml_id = False is_db_id = False ir_model_data_obj = self.pool.get('ir.model.data') # # Import normal fields # for i in range(len(fields)): if i >= len(line): raise Exception(_('Please check that all your lines have %d columns.') % (len(fields),)) if not line[i]: continue
468,697
def process_liness(self, datas, prefix, current_module, model_name, fields_def, position=0): line = datas[position] row = {} translate = {} todo = [] warning = [] data_id = False data_res_id = False is_xml_id = False is_db_id = False ir_model_data_obj = self.pool.get('ir.model.data') # # Import normal fields # for i in range(len(fields)): if i >= len(line): raise Exception(_('Please check that all your lines have %d columns.') % (len(fields),)) if not line[i]: continue
def process_liness(self, datas, prefix, current_module, model_name, fields_def, position=0): line = datas[position] row = {} translate = {} todo = [] warning = [] data_id = False data_res_id = False is_xml_id = False is_db_id = False ir_model_data_obj = self.pool.get('ir.model.data') # # Import normal fields # for i in range(len(fields)): if i >= len(line): raise Exception(_('Please check that all your lines have %d columns.') % (len(fields),)) if not line[i]: continue
468,698
fields_def = self.__view_look_dom(cr, user, node, view_id, context=context)
fields_def = self.__view_look_dom(cr, user, node, view_id, context=context)
468,699