[RIP] purchase: funeral of dead code
bzr revid: rco@openerp.com-20111220150930-a47t7pjccy0v80sy
This commit is contained in:
parent
5c92c476d3
commit
faf2dfd908
|
@ -35,14 +35,6 @@ from osv.orm import browse_record, browse_null
|
|||
#
|
||||
class purchase_order(osv.osv):
|
||||
|
||||
def _calc_amount(self, cr, uid, ids, prop, unknow_none, unknow_dict):
|
||||
res = {}
|
||||
for order in self.browse(cr, uid, ids):
|
||||
res[order.id] = 0
|
||||
for oline in order.order_line:
|
||||
res[order.id] += oline.price_unit * oline.product_qty
|
||||
return res
|
||||
|
||||
def _amount_all(self, cr, uid, ids, field_name, arg, context=None):
|
||||
res = {}
|
||||
cur_obj=self.pool.get('res.currency')
|
||||
|
@ -300,25 +292,6 @@ class purchase_order(osv.osv):
|
|||
for id in ids:
|
||||
self.write(cr, uid, [id], {'state' : 'confirmed', 'validator' : uid})
|
||||
return True
|
||||
# Dead code:
|
||||
def wkf_warn_buyer(self, cr, uid, ids):
|
||||
self.write(cr, uid, ids, {'state' : 'wait', 'validator' : uid})
|
||||
request = pooler.get_pool(cr.dbname).get('res.request')
|
||||
for po in self.browse(cr, uid, ids):
|
||||
managers = []
|
||||
for oline in po.order_line:
|
||||
manager = oline.product_id.product_manager
|
||||
if manager and not (manager.id in managers):
|
||||
managers.append(manager.id)
|
||||
for manager_id in managers:
|
||||
request.create(cr, uid,{
|
||||
'name' : _("Purchase amount over the limit"),
|
||||
'act_from' : uid,
|
||||
'act_to' : manager_id,
|
||||
'body': _('Somebody has just confirmed a purchase with an amount over the defined limit'),
|
||||
'ref_partner_id': po.partner_id.id,
|
||||
'ref_doc1': 'purchase.order,%d' % (po.id,),
|
||||
})
|
||||
|
||||
def _prepare_inv_line(self, cr, uid, account_id, order_line, context=None):
|
||||
"""Collects require data from purchase order line that is used to create invoice line
|
||||
|
|
|
@ -27,60 +27,7 @@ import pooler
|
|||
class order(report_sxw.rml_parse):
|
||||
def __init__(self, cr, uid, name, context):
|
||||
super(order, self).__init__(cr, uid, name, context=context)
|
||||
self.localcontext.update({
|
||||
'time': time,
|
||||
'get_line_tax': self._get_line_tax,
|
||||
'get_tax': self._get_tax,
|
||||
'get_product_code': self._get_product_code,
|
||||
})
|
||||
|
||||
#dead code
|
||||
def _get_line_tax(self, line_obj):
|
||||
self.cr.execute("SELECT tax_id FROM purchase_order_taxe WHERE order_line_id=%s", (line_obj.id))
|
||||
res = self.cr.fetchall() or None
|
||||
if not res:
|
||||
return ""
|
||||
if isinstance(res, list):
|
||||
tax_ids = [t[0] for t in res]
|
||||
else:
|
||||
tax_ids = res[0]
|
||||
res = [tax.name for tax in pooler.get_pool(self.cr.dbname).get('account.tax').browse(self.cr, self.uid, tax_ids)]
|
||||
return ",\n ".join(res)
|
||||
|
||||
#dead code
|
||||
def _get_tax(self, order_obj):
|
||||
self.cr.execute("SELECT DISTINCT tax_id FROM purchase_order_taxe, purchase_order_line, purchase_order \
|
||||
WHERE (purchase_order_line.order_id=purchase_order.id) AND (purchase_order.id=%s)", (order_obj.id))
|
||||
res = self.cr.fetchall() or None
|
||||
if not res:
|
||||
return []
|
||||
if isinstance(res, list):
|
||||
tax_ids = [t[0] for t in res]
|
||||
else:
|
||||
tax_ids = res[0]
|
||||
tax_obj = pooler.get_pool(self.cr.dbname).get('account.tax')
|
||||
res = []
|
||||
for tax in tax_obj.browse(self.cr, self.uid, tax_ids):
|
||||
self.cr.execute("SELECT DISTINCT order_line_id FROM purchase_order_line, purchase_order_taxe \
|
||||
WHERE (purchase_order_taxe.tax_id=%s) AND (purchase_order_line.order_id=%s)", (tax.id, order_obj.id))
|
||||
lines = self.cr.fetchall() or None
|
||||
if lines:
|
||||
if isinstance(lines, list):
|
||||
line_ids = [l[0] for l in lines]
|
||||
else:
|
||||
line_ids = lines[0]
|
||||
base = 0
|
||||
for line in pooler.get_pool(self.cr.dbname).get('purchase.order.line').browse(self.cr, self.uid, line_ids):
|
||||
base += line.price_subtotal
|
||||
res.append({'code':tax.name,
|
||||
'base':base,
|
||||
'amount':base*tax.amount})
|
||||
return res
|
||||
|
||||
#dead code
|
||||
def _get_product_code(self, product_id, partner_id):
|
||||
product_obj=pooler.get_pool(self.cr.dbname).get('product.product')
|
||||
return product_obj._product_code(self.cr, self.uid, [product_id], name=None, arg=None, context={'partner_id': partner_id})[product_id]
|
||||
self.localcontext.update({'time': time})
|
||||
|
||||
report_sxw.report_sxw('report.purchase.order','purchase.order','addons/purchase/report/order.rml',parser=order)
|
||||
|
||||
|
|
Loading…
Reference in New Issue