summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoratp (Open ERP) <atp@tinyerp.co.in>2010-07-30 20:55:56 +0530
committeratp (Open ERP) <atp@tinyerp.co.in>2010-07-30 20:55:56 +0530
commitf33ea507e4a98cfbd616c31476da47368b46beac (patch)
tree92b48f58280a37d47a9936a31893aa2ffb738e39
parent3b56d0d65b6048ebb07a1de681c0a0593d5f6ec4 (diff)
[IMP]: auction: ADD auction data file.
[IMP]: Improve report and add search view. [IMP]: remove unnecessary report. bzr revid: atp@tinyerp.co.in-20100730152556-t65ue8aouwilw9ki
-rw-r--r--addons/auction/__openerp__.py4
-rw-r--r--addons/auction/auction.py758
-rw-r--r--addons/auction/auction_data.xml310
-rw-r--r--addons/auction/auction_demo.xml12
-rw-r--r--addons/auction/auction_report.xml12
-rw-r--r--addons/auction/auction_view.xml872
-rw-r--r--addons/auction/board_auction_view.xml9
-rw-r--r--addons/auction/report/__init__.py3
-rw-r--r--addons/auction/report/report_attendance.py315
-rw-r--r--addons/auction/report/report_attendance_view.xml414
-rw-r--r--addons/auction/report/report_auction.py107
-rw-r--r--addons/auction/report/report_auction_view.xml119
-rw-r--r--addons/auction/security/ir.model.access.csv14
13 files changed, 1443 insertions, 1506 deletions
diff --git a/addons/auction/__openerp__.py b/addons/auction/__openerp__.py
index 29541b8b3fb..750df8ce302 100644
--- a/addons/auction/__openerp__.py
+++ b/addons/auction/__openerp__.py
@@ -40,7 +40,7 @@
""",
'author': 'OpenERP SA',
'depends': ['base', 'account', 'hr_attendance'],
- 'init_xml': ['auction_sequence.xml'],
+ 'init_xml': ['auction_sequence.xml', 'auction_data.xml'],
'update_xml': [
'security/ir.model.access.csv',
# 'wizard/auction_lots_able_view.xml',
@@ -56,6 +56,8 @@
'wizard/auction_lots_buyer_map_view.xml',
'auction_view.xml',
'auction_report.xml',
+ 'report/report_auction_view.xml',
+ 'report/report_attendance_view.xml',
'auction_wizard.xml',
'board_auction_view.xml',
'board_auction_manager_view.xml',
diff --git a/addons/auction/auction.py b/addons/auction/auction.py
index c5572da6284..57e2e11e783 100644
--- a/addons/auction/auction.py
+++ b/addons/auction/auction.py
@@ -18,15 +18,15 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
-import os
-import time
-import netsvc
-from osv import fields, osv, orm
-import ir
from mx import DateTime
+from osv import fields, osv, orm
+from tools import config
from tools.translate import _
+import ir
+import netsvc
+import os
+import time
import tools
-from tools import config
#----------------------------------------------------------
# Auction Artists
@@ -60,8 +60,10 @@ class auction_dates(osv.osv):
res[auction.id]=total
return res
- def name_get(self, cr, uid, ids, context={}):
- if not len(ids):
+ def name_get(self, cr, uid, ids, context=None):
+ if not context:
+ context={}
+ if not ids:
return []
reads = self.read(cr, uid, ids, ['name', 'auction1'], context)
name = [(r['id'], '['+r['auction1']+'] '+ r['name']) for r in reads]
@@ -86,11 +88,11 @@ class auction_dates(osv.osv):
}
_defaults = {
- 'state': lambda *a: 'draft',
+ 'state': lambda *a: 'draft',
}
_order = "auction1 desc"
- def close(self, cr, uid, ids, *args):
+ def close(self, cr, uid, ids, context=None):
"""
Close an auction date.
@@ -101,6 +103,8 @@ class auction_dates(osv.osv):
"""
# objects vendus mais non factures
#TODO: convert this query to tiny API
+ if not context:
+ context={}
lots_obj = self.pool.get('auction.lots')
lots_ids = lots_obj.search(cr, uid, [('auction_id', 'in', ids), ('state', '=', 'draft'), ('obj_price', '>', 0)])
new_buyer_invoice = lots_obj.lots_invoice(cr, uid, lots_ids, {}, None)
@@ -125,8 +129,10 @@ def _inv_uniq(cr, ids):
return True
class auction_deposit(osv.osv):
+ """Auction Deposit Border"""
+
_name = "auction.deposit"
- _description="Deposit Border"
+ _description=__doc__
_order = "id desc"
_columns = {
'transfer' : fields.boolean('Transfer'),
@@ -147,8 +153,6 @@ class auction_deposit(osv.osv):
'total_neg': lambda *a: False,
'name': lambda obj, cr, uid, context: obj.pool.get('ir.sequence').get(cr, uid, 'auction.deposit'),
}
- _constraints = [
- ]
def partner_id_change(self, cr, uid, ids, part):
return {}
@@ -159,7 +163,11 @@ auction_deposit()
# (Specific) Deposit Costs
#----------------------------------------------------------
class auction_deposit_cost(osv.osv):
+
+ """Auction Deposit Cost"""
+
_name = 'auction.deposit.cost'
+ _description=__doc__
_columns = {
'name': fields.char('Cost Name', required=True, size=64),
'amount': fields.float('Amount'),
@@ -171,59 +179,48 @@ auction_deposit_cost()
#----------------------------------------------------------
# Lots Categories
#----------------------------------------------------------
+
+class aie_category(osv.osv):
+
+ _name="aie.category"
+ _order = "name"
+ _columns={
+ 'name': fields.char('Name', size=64, required=True),
+ 'code':fields.char('Code', size=64),
+ 'parent_id': fields.many2one('aie.category','Parent aie Category'),
+ 'child_ids': fields.one2many('aie.category', 'parent_id', help="Childs aie category")
+ }
+
+ def name_get(self, cr, uid, ids, context=None):
+ if not context:
+ context = {}
+
+ res = []
+ if not ids:
+ return res
+ reads = self.read(cr, uid, ids, ['name', 'parent_id'], context)
+ for record in reads:
+ name = record['name']
+ if record['parent_id']:
+ name = record['parent_id'][1] + ' / ' + name
+ res.append((record['id'], name))
+ return res
+
+aie_category()
+
class auction_lot_category(osv.osv):
+ """Auction Lots Category"""
+
_name = 'auction.lot.category'
+ _description=__doc__
_columns = {
'name': fields.char('Category Name', required=True, size=64),
'priority': fields.float('Priority'),
'active' : fields.boolean('Active', help="If the active field is set to true, it will allow you to hide the auction lot category without removing it."),
- 'aie_categ' : fields.selection([('41', "Unclassifieds"),
- ('2', "Antiques"),
- ('42', "Antique/African Arts"),
- ('59', "Antique/Argenterie"),
- ('45', "Antique/Art from the Ivory Coast"),
- ('46', "Antique/Art from the Ivory Coast/African Arts"),
- ('12', "Antique/Books, manuscripts, eso."),
- ('11', "Antique/Carpet and textilles"),
- ('14', "Antique/Cartoons"),
- ('26', "Antique/Clocks and watches"),
- ('31', "Antique/Collectible & art objects"),
- ('33', "Antique/Engravings"),
- ('10', "Antique/Furnitures"),
- ('50', "Antique/Graphic Arts"),
- ('37', "Antique/Jewelry"),
- ('9', "Antique/Lightings"),
- ('52', "Antique/Metal Ware"),
- ('51', "Antique/Miniatures / Collections"),
- ('53', "Antique/Musical Instruments"),
- ('19', "Antique/Old weapons and militaria"),
- ('43', "Antique/Oriental Arts"),
- ('47', "Antique/Oriental Arts/Chineese furnitures"),
- ('24', "Antique/Others"),
- ('8', "Antique/Painting"),
- ('25', "Antique/Porcelain, Ceramics, Glassmaking, ..."),
- ('13', "Antique/Posters"),
- ('56', "Antique/Religiosa"),
- ('54', "Antique/Scientific Instruments"),
- ('18', "Antique/Sculpture, bronze, eso."),
- ('55', "Antique/Tin / Copper wares"),
- ('16', "Antique/Toys"),
- ('57', "Antique/Verreries"),
- ('17', "Antique/Wine"),
- ('1', "Contemporary Art"),
- ('58', "Cont. Art/Arts"),
- ('27', "Cont. Art/Curiosa"),
- ('15', "Cont. Art/Jewelry"),
- ('30', "Cont. Art/Other Media"),
- ('3', "Cont. Art/Photo"),
- ('4', "Cont. Art/Painting"),
- ('5', "Cont. Art/Sculpture"),
- ('48', "Cont. Art/Shows")],
- 'Aie Category'),
+ 'aie_categ': fields.many2one('aie.category', 'Category'),
}
_defaults = {
'active' : lambda *a: 1,
- 'aie_categ' : lambda *a:1,
}
auction_lot_category()
@@ -247,27 +244,44 @@ def _inv_constraint(cr, ids):
return True
class auction_lots(osv.osv):
+
+ """Auction Object"""
_name = "auction.lots"
_order = "obj_num,lot_num,id"
- _description="Object"
+ _description=__doc__
- def button_not_bought(self, cr, uid, ids, *a):
+ def button_not_bought(self, cr, uid, ids, context=None):
+ if not context:
+ context={}
return self.write(cr, uid, ids, {'state':'unsold'})
- def button_taken_away(self, cr, uid, ids, *a):
+
+ def button_taken_away(self, cr, uid, ids, context=None):
+ if not context:
+ context={}
return self.write(cr, uid, ids, {'state':'taken_away'})
- def button_unpaid(self, cr, uid, ids, *a):
+ def button_unpaid(self, cr, uid, ids, context=None):
+ if not context:
+ context={}
return self.write(cr, uid, ids, {'state':'draft'})
- def button_draft(self, cr, uid, ids, *a):
+ def button_draft(self, cr, uid, ids, context=None):
+ if not context:
+ context={}
return self.write(cr, uid, ids, {'state':'draft'})
- def button_bought(self, cr, uid, ids, *a):
+ def button_bought(self, cr, uid, ids, context=None):
+ if not context:
+ context={}
return self.write(cr, uid, ids, {'state':'sold'})
- def _buyerprice(self, cr, uid, ids, name, args, context):
+ def _buyerprice(self, cr, uid, ids, name, args, context=None):
+ if not context:
+ context={}
+
res={}
- lots=self.pool.get('auction.lots').browse(cr, uid, ids)
+ lots_obj = self.pool.get('auction.lots')
+ lots = lots_obj.browse(cr, uid, ids, context={})
pt_tax=self.pool.get('account.tax')
for lot in lots:
amount_total=0.0
@@ -287,10 +301,10 @@ class auction_lots(osv.osv):
res[lot.id] = amount_total
return res
-
def _sellerprice(self, cr, uid, ids, *a):
res={}
- lots=self.pool.get('auction.lots').browse(cr, uid, ids)
+ lots_obj = self.pool.get('auction.lots')
+ lots=lots_obj.browse(cr, uid, ids)
pt_tax=self.pool.get('account.tax')
for lot in lots:
amount_total=0.0
@@ -309,25 +323,29 @@ class auction_lots(osv.osv):
res[lot.id] = montant+amount_total
return res
- def _grossprice(self, cr, uid, ids, name, args, context):
+ def _grossprice(self, cr, uid, ids, name, args, context=None):
"""gross revenue"""
res={}
- auction_lots_obj = self.read(cr, uid, ids, ['seller_price', 'buyer_price', 'auction_id'])
- for auction_data in auction_lots_obj:
+ if not context:
+ context={}
+ lots = self.browse(cr, uid, ids, context={})
+ for lot in lots:
total_tax = 0.0
- if auction_data['auction_id']:
- total_tax += auction_data['buyer_price']-auction_data['seller_price']
- res[auction_data['id']] = total_tax
+ if lot.auction_id:
+ total_tax += lot.buyer_price - lot.seller_price
+ res[lot.id] = total_tax
return res
- def _grossmargin(self, cr, uid, ids, name, args, context):
+ def _grossmargin(self, cr, uid, ids, name, args, context=None):
"""
gross Margin : Gross revenue * 100 / Adjudication
(state==unsold or obj_ret_price>0): adj_price = 0 (=> gross margin = 0, net margin is negative)
"""
res={}
- for lot in self.browse(cr, uid, ids, context):
+ if not context:
+ context={}
+ for lot in self.browse(cr, uid, ids, context={}):
if ((lot.obj_price==0) and (lot.state=='draft')):
montant=lot.lot_est1
else:
@@ -339,7 +357,9 @@ class auction_lots(osv.osv):
res[lot.id]=round(total, 2)
return res
- def onchange_obj_ret(self, cr, uid, ids, obj_ret, *args):
+ def onchange_obj_ret(self, cr, uid, ids, obj_ret, context=None):
+ if not context:
+ context={}
if obj_ret:
return {'value': {'obj_price': 0}}
return {}
@@ -351,7 +371,7 @@ class auction_lots(osv.osv):
(excluding analytic lines that are in the analytic journal of the auction date).
"""
res={}
- for lot in self.browse(cr, uid, ids):
+ for lot in self.browse(cr, uid, ids, context={}):
som=0.0
if not lot.auction_id:
res[lot.id] = 0.0
@@ -371,9 +391,11 @@ class auction_lots(osv.osv):
res[lot.id]=som/nb
return res
- def _netprice(self, cr, uid, ids, name, args, context):
+ def _netprice(self, cr, uid, ids, name, args, context=None):
"""This is the net revenue"""
res={}
+ if not context:
+ context={}
auction_lots_obj = self.read(cr, uid, ids, ['seller_price', 'buyer_price', 'auction_id', 'costs'])
for auction_data in auction_lots_obj:
total_tax = 0.0
@@ -382,26 +404,31 @@ class auction_lots(osv.osv):
res[auction_data['id']] = total_tax
return res
- def _netmargin(self, cr, uid, ids, name, args, context):
+ def _netmargin(self, cr, uid, ids, name, args, context=None):
res={}
+ if not context:
+ context={}
total_tax = 0.0
total=0.0
montant=0.0
- auction_lots_obj = self.read(cr, uid, ids, ['net_revenue', 'auction_id', 'lot_est1', 'obj_price', 'state'])
- for auction_data in auction_lots_obj:
- if ((auction_data ['obj_price']==0) and (auction_data['state']=='draft')):
- montant=auction_data['lot_est1']
- else: montant=auction_data ['obj_price']
+ auction_lots = self.read(cr, uid, ids, ['net_revenue', 'auction_id', 'lot_est1', 'obj_price', 'state'])
+ for lot in auction_lots:
+ if ((lot['obj_price']==0) and (lot['state']=='draft')):
+ montant=lot['lot_est1']
+ else: montant=lot['obj_price']
if montant>0:
- total_tax += (auction_data['net_revenue']*100)/montant
+ total_tax += (lot['net_revenue']*100)/montant
else:
total_tax=0
- res[auction_data['id']] = total_tax
+ res[lot['id']] = total_tax
return res
- def _is_paid_vnd(self, cr, uid, ids, *a):
+ def _is_paid_vnd(self, cr, uid, ids, context=None):
res = {}
- lots=self.browse(cr, uid, ids)
+
+ if not context:
+ context={}
+ lots=self.browse(cr, uid, ids, context)
for lot in lots:
res[lot.id] = False
if lot.sel_inv_id:
@@ -477,7 +504,7 @@ class auction_lots(osv.osv):
_defaults = {
'state':lambda *a: 'draft',
'lot_num':lambda *a:1,
- 'is_ok': lambda *a: False,
+ 'is_ok': lambda *a: False,
}
_constraints = [
# (_inv_constraint, 'Twice the same inventory number !', ['lot_num','bord_vnd_id'])
@@ -486,21 +513,25 @@ class auction_lots(osv.osv):
def auction_lots_enable(self, cr, uid, ids, context=None):
if not context:
context={}
- return self.write(cr, uid, ids, {'ach_emp': False})
+ return self.write(cr, uid, ids, {'ach_emp': False}, context)
def auction_lots_able(self, cr, uid, ids, context=None):
if not context:
context={}
- return self.write(cr, uid, ids, {'ach_emp': True})
+ return self.write(cr, uid, ids, {'ach_emp': True}, context)
- def name_get(self, cr, user, ids, context={}):
- if not len(ids):
+ def name_get(self, cr, user, ids, context=None):
+ if not context:
+ context={}
+ if not ids:
return []
result = [ (r['id'], str(r['obj_num'])+' - '+r['name']) for r in self.read(cr, user, ids, ['name', 'obj_num'])]
return result
- def name_search(self, cr, user, name, args=None, operator='ilike', context={}):
- if not len(args):
+ def name_search(self, cr, user, name, args=None, operator='ilike', context=None):
+ if not context:
+ context={}
+ if not args:
args = []
ids = []
if name:
@@ -652,10 +683,13 @@ class auction_lots(osv.osv):
taxes_summed[key] = tax
return taxes_summed.values()
- def buyer_proforma(self, cr, uid, ids, context):
+ def buyer_proforma(self, cr, uid, ids, context=None):
+
+ if not context:
+ context={}
invoices = {}
inv_ref = self.pool.get('account.invoice')
- partner_r = self.pool.get('res.partner')
+ res_obj = self.pool.get('res.partner')
inv_line_obj = self.pool.get('account.invoice.line')
wf_service = netsvc.LocalService('workflow')
# acc_receiv=self.pool.get('account.account').search([cr,uid,[('code','=','4010')]])
@@ -667,7 +701,7 @@ class auction_lots(osv.osv):
else:
partner_ref =lot.ach_uid.id
lot_name = lot.obj_num
- res = partner_r.address_get(cr, uid, [partner_ref], ['contact', 'invoice'])
+ res = res_obj.address_get(cr, uid, [partner_ref], ['contact', 'invoice'])
contact_addr_id = res['contact']
invoice_addr_id = res['invoice']
if not invoice_addr_id:
@@ -712,12 +746,14 @@ class auction_lots(osv.osv):
# creates the transactions between the auction company and the seller
# this is done by creating a new in_invoice for each
- def seller_trans_create(self, cr, uid, ids, context):
+ def seller_trans_create(self, cr, uid, ids, context=None):
"""
Create a seller invoice for each bord_vnd_id, for selected ids.
"""
# use each list of object in turn
invoices = {}
+ if not context:
+ context={}
inv_ref=self.pool.get('account.invoice')
partner_obj = self.pool.get('res.partner')
inv_line_obj = self.pool.get('account.invoice.line')
@@ -784,7 +820,7 @@ class auction_lots(osv.osv):
"""
dt = time.strftime('%Y-%m-%d')
inv_ref = self.pool.get('account.invoice')
- partner_r = self.pool.get('res.partner')
+ res_obj = self.pool.get('res.partner')
inv_line_obj = self.pool.get('account.invoice.line')
wf_service = netsvc.LocalService('workflow')
invoices={}
@@ -797,7 +833,7 @@ class auction_lots(osv.osv):
if (lot.auction_id.id, lot.ach_uid.id) in invoices:
inv_id = invoices[(lot.auction_id.id, lot.ach_uid.id)]
else:
- add = partner_r.read(cr, uid, [lot.ach_uid.id], ['address'])[0]['address']
+ add = res_obj.read(cr, uid, [lot.ach_uid.id], ['address'])[0]['address']
if not len(add):
raise orm.except_orm(_('Missed Address !'), _('The Buyer has no Invoice Address.'))
price = lot.obj_price or 0.0
@@ -861,8 +897,10 @@ auction_lots()
# Auction Bids
#----------------------------------------------------------
class auction_bid(osv.osv):
+ """Bid Auctions"""
+
_name = "auction.bid"
- _description="Bid auctions"
+ _description=__doc__
_order = 'id desc'
_columns = {
'partner_id': fields.many2one('res.partner', 'Buyer Name', required=True),
@@ -874,6 +912,7 @@ class auction_bid(osv.osv):
_defaults = {
'name': lambda obj, cr, uid, context: obj.pool.get('ir.sequence').get(cr, uid, 'auction.bid'),
}
+
def onchange_contact(self, cr, uid, ids, partner_id):
if not partner_id:
return {'value': {'contact_tel':False}}
@@ -887,8 +926,10 @@ class auction_bid(osv.osv):
auction_bid()
class auction_lot_history(osv.osv):
+ """Lot History"""
+
_name = "auction.lot.history"
- _description="Lot history"
+ _description=__doc__
_columns = {
'name': fields.date('Date', size=64),
'lot_id': fields.many2one('auction.lots', 'Object', required=True, ondelete='cascade'),
@@ -932,516 +973,5 @@ class auction_bid_lines(osv.osv):
auction_bid_lines()
-class report_buyer_auction(osv.osv):
- _name = "report.buyer.auction"
- _description = "Auction Reporting on buyer view"
- _auto = False
- _columns = {
- 'buyer_login': fields.char('Buyer Login', size=64, readonly=True, select=1),
- 'buyer':fields.many2one('res.partner', 'Buyer', readonly=True, select=2),
- 'object':fields.integer('No of objects', readonly=True, select=1),
- 'total_price':fields.float('Total Adj.', digits=(16, 2), readonly=True, select=2),
- 'avg_price':fields.float('Avg Adj.', digits=(16, 2), readonly=True, select=2),
- 'date': fields.date('Create Date', select=1),
- 'auction': fields.many2one('auction.dates', 'Auction date', readonly=True, select=1),
-
- }
-
- def init(self, cr):
- cr.execute('''
- create or replace view report_buyer_auction as (
- select
- min(al.id) as id,
- al.ach_login as "buyer_login",
- to_char(al.create_date, 'YYYY-MM-01') as date,
- al.ach_uid as "buyer",
- ad.id as auction,
- count(al.id) as "object",
- sum(al.obj_price) as "total_price",
- (sum(al.obj_price)/count(al.id)) as "avg_price"
- from
- auction_lots al,
- auction_dates ad
- where
- ad.id=al.auction_id
- group by
- to_char(al.create_date, 'YYYY-MM-01'),
- al.ach_uid,
- ad.id,
- al.ach_login
- )''')
-report_buyer_auction()
-
-class report_buyer_auction2(osv.osv):
- _name = "report.buyer.auction2"
- _description = "Auction Reporting on buyer view"
- _auto = False
- _columns = {
- 'auction': fields.many2one('auction.dates', 'Auction date', readonly=True, select=1),
- 'buyer_login': fields.char('Buyer Login', size=64, readonly=True, select=True),
- 'buyer':fields.many2one('res.partner', 'Buyer', readonly=True, select=2),
- 'sumadj':fields.float('Sum of adjustication', readonly=True),
- 'gross_revenue':fields.float('Gross Revenue', readonly=True),
- 'net_revenue':fields.float('Net Revenue', readonly=True),
- 'net_margin':fields.float('Net Margin', readonly=True),
- 'date': fields.date('Create Date', required=True)
- }
- def init(self, cr):
- cr.execute('''
- create or replace view report_buyer_auction2 as (
- select
- min(al.id) as id,
- to_char(al.create_date, 'YYYY-MM-01') as date,
- al.ach_login as "buyer_login",
- al.ach_uid as "buyer",
- sum(al.obj_price) as sumadj,
- ad.id as auction,
- sum(al.gross_revenue) as gross_revenue,
- sum(al.net_revenue) as net_revenue,
- avg(al.net_margin) as net_margin
- from
- auction_lots al,
- auction_dates ad
- where
- al.auction_id=ad.id
- group by
- al.ach_uid,
- al.ach_login,
- ad.id,
- to_char(al.create_date, 'YYYY-MM-01')
- )''')
-report_buyer_auction2()
-
-
-class report_seller_auction(osv.osv):
- _name = "report.seller.auction"
- _description = "Auction Reporting on seller view"
- _auto = False
- _rec_name = 'date'
- _columns = {
- 'auction': fields.many2one('auction.dates', 'Auction date', readonly=True, select=1),
- 'seller': fields.many2one('res.partner', 'Seller', readonly=True, select=1),
- 'object_number':fields.integer('No of Objects', readonly=True),
- 'total_price':fields.float('Total adjudication', readonly=True),
- 'avg_price':fields.float('Avg adjudication', readonly=True),
- 'avg_estimation':fields.float('Avg estimation', readonly=True),
- 'date': fields.date('Create Date', required=True, select=1),
- 'state': fields.selection((('draft', 'Draft'), ('unsold', 'Unsold'), ('sold', 'Sold')), 'State', readonly=True, select=1)
- }
-
- def init(self, cr):
- cr.execute('''
- create or replace view report_seller_auction as (
- select
- adl.id as auction,
- min(al.id) as id,
- to_char(adl.auction1, 'YYYY-MM-DD') as date,
- ad.partner_id as seller,
- count(al.id) as "object_number",
- SUM(al.obj_price) as "total_price",
- (SUM(al.obj_price)/count(al.id)) as avg_price,
- sum(al.lot_est1+al.lot_est2)/2 as avg_estimation,
- al.state
- from
- auction_dates adl,
- auction_lots al,
- auction_deposit ad
- where
- al.auction_id=adl.id and ad.id=al.bord_vnd_id
- group by
- ad.partner_id,
- al.state,adl.auction1,adl.id
- )''')
-report_seller_auction()
-
-class report_seller_auction2(osv.osv):
- _name = "report.seller.auction2"
- _description = "Auction Reporting on seller view2"
- _auto = False
- _rec_name = 'date'
- _columns = {
- 'seller': fields.many2one('res.partner', 'Seller', readonly=True, select=1),
- 'auction': fields.many2one('auction.dates', 'Auction date', readonly=True, select=1),
- 'sum_adj':fields.float('Sum Adjustication', readonly=True, select=2),
- 'gross_revenue':fields.float('Gross revenue', readonly=True, select=2),
- 'net_revenue':fields.float('Net revenue', readonly=True, select=2),
- 'net_margin':fields.float('Net margin', readonly=True, select=2),
- 'date': fields.date('Auction date', required=1),
- }
-
- def init(self, cr):
- cr.execute('''create or replace view report_seller_auction2 as
- (select
- min(al.id) as id,
- to_char(adl.auction1, 'YYYY-MM-DD') as date,
- adl.id as auction,
- ad.partner_id as seller,
- sum(al.obj_price) as "sum_adj",
- sum(al.gross_revenue) as "gross_revenue",
- sum(al.net_revenue) as "net_revenue",
- avg(al.net_margin) as "net_margin"
- from
- auction_lots al,auction_dates adl,auction_deposit ad
- where
- adl.id=al.auction_id and ad.id=al.bord_vnd_id
- group by
- al.ach_uid,adl.auction1,adl.id,ad.partner_id)
- ''')
-
-report_seller_auction2()
-
-class report_auction_view2(osv.osv):
- _name = "report.auction.view2"
- _description = "Auction Reporting on view2"
- _auto = False
- _rec_name = 'date'
- _columns = {
- 'auction': fields.many2one('auction.dates', 'Auction date', readonly=True, select=1),
- 'sum_adj':fields.float('Sum of adjudication', readonly=True),
- 'obj_number':fields.integer('# of Objects', readonly=True),
- 'gross_revenue':fields.float('Gross revenue', readonly=True),
- 'net_revenue':fields.float('Net revenue', readonly=True),
- 'obj_margin':fields.float('Avg margin', readonly=True),
- 'obj_margin_procent':fields.float('Net margin (%)', readonly=True),
- 'date': fields.date('Auction date', required=True, select=1)
- }
- def init(self, cr):
- cr.execute('''create or replace view report_auction_view2 as (
- select
- ad.id as id,
- to_char(ad.auction1, 'YYYY-MM-DD') as date,
- ad.id as "auction",
- count(al.id) as "obj_number",
- SUM(al.obj_price) as "sum_adj",
- SUM(al.gross_revenue) as "gross_revenue",
- SUM(al.net_revenue) as "net_revenue",
- avg(al.net_revenue) as "obj_margin",
- SUM(al.net_revenue)*100/sum(al.obj_price) as "obj_margin_procent"
- from
- auction_dates ad
- left join
- auction_lots al on (al.auction_id = ad.id)
- group by
- ad.id, ad.auction1
- having
- sum(al.obj_price) <> 0
- )''')
-report_auction_view2()
-
-class report_auction_view(osv.osv):
- _name = "report.auction.view"
- _description = "Auction Reporting on view1"
- _auto = False
- _rec_name = 'auction_id'
- _columns = {
- 'auction_id': fields.many2one('auction.dates', 'Auction date', readonly=True, select=1),
- 'nobjects':fields.float('No of objects', readonly=True),
- 'nbuyer':fields.float('No of buyers', readonly=True),
- 'nseller':fields.float('No of sellers', readonly=True),
- 'min_est':fields.float('Minimum Estimation', readonly=True, select=2),
- 'max_est':fields.float('Maximum Estimation', readonly=True, select=2),
- 'adj_price':fields.float('Adjudication price', readonly=True, select=2),
- 'obj_ret':fields.integer('# obj ret', readonly=True, select=2)
- }
-
- def init(self, cr):
- cr.execute('''create or replace view report_auction_view as
- (select
- min(al.id) as id,
- al.auction_id as "auction_id",
- count(al.id) as "nobjects",
- count(al.ach_login) as "nbuyer",
- count(al.bord_vnd_id) as "nseller",
- sum(al.lot_est1) as "min_est",
- sum(al.lot_est2) as "max_est",
- (SELECT count(1) FROM auction_lots WHERE obj_ret>0) as obj_ret,
- sum(al.obj_price) as "adj_price"
- from
- auction_lots al
- group by
- al.auction_id
- )''')
-
-report_auction_view()
-
-class report_auction_object_date(osv.osv):
- _name = "report.auction.object.date"
- _description = "Objects per day"
- _auto = False
- _columns = {
- 'obj_num': fields.integer('# of Objects'),
- 'name': fields.date('Created date', select=2),
- 'month': fields.date('Month', select=1),
- 'user_id':fields.many2one('res.users', 'User', select=1),
- }
- #l.create_uid as user,
-
- def init(self, cr):
- cr.execute("""create or replace view report_auction_object_date as
- (select
- min(l.id) as id,
- to_char(l.create_date, 'YYYY-MM-DD') as name,
- to_char(l.create_date, 'YYYY-MM-01') as month,
- count(l.obj_num) as obj_num,
- l.create_uid as user_id
- from
- auction_lots l
- group by
- to_char(l.create_date, 'YYYY-MM-DD'),
- to_char(l.create_date, 'YYYY-MM-01'),
- l.create_uid
- )
- """)
-report_auction_object_date()
-
-class report_auction_estimation_adj_category(osv.osv):
- _name = "report.auction.estimation.adj.category"
- _description = "comparaison estimate/adjudication "
- _auto = False
- _rec_name='date'
- _columns = {
- 'lot_est1': fields.float('Minimum Estimation', select=2),
- 'lot_est2': fields.float('Maximum Estimation', select=2),
-# 'obj_price': fields.float('Adjudication price'),
- 'date': fields.date('Date', readonly=True, select=1),
- 'lot_type': fields.selection(_type_get, 'Object Type', size=64),
- 'adj_total': fields.float('Total Adjudication', select=2),
- 'user_id':fields.many2one('res.users', 'User', select=1)
- }
-
- def init(self, cr):
- cr.execute("""
- create or replace view report_auction_estimation_adj_category as (
- select
- min(l.id) as id,
- to_char(l.create_date, 'YYYY-MM-01') as date,
- l.lot_type as lot_type,
- sum(l.lot_est1) as lot_est1,
- sum(l.lot_est2) as lot_est2,
- sum(l.obj_price) as adj_total,
- l.create_uid as user_id
- from
- auction_lots l,auction_dates m
- where
- l.auction_id=m.id and l.obj_price >0
- group by
- to_char(l.create_date, 'YYYY-MM-01'),lot_type,l.create_uid
- )
- """)
-report_auction_estimation_adj_category()
-
-class report_auction_adjudication(osv.osv):
- _name = "report.auction.adjudication"
- _description = "report_auction_adjudication"
- _auto = False
- _columns = {
- 'name': fields.many2one('auction.dates', 'Auction date', readonly=True, select=1),
- 'state': fields.selection((('draft', 'Draft'), ('close', 'Closed')), 'State', select=1),
- 'adj_total': fields.float('Total Adjudication'),
- 'date': fields.date('Date', readonly=True, select=1),
- 'user_id':fields.many2one('res.users', 'User', select=1)
-
- }
-
-
- def init(self, cr):
- cr.execute("""
- create or replace view report_auction_adjudication as (
- select
- l.id as id,
- l.id as name,
- sum(m.obj_price) as adj_total,
- to_char(l.create_date, 'YYYY-MM-01') as date,
- l.create_uid as user_id,
- l.state
- from
- auction_dates l ,auction_lots m
- where
- m.auction_id=l.id
- group by
- l.id,l.state,l.name,l.create_uid,to_char(l.create_date, 'YYYY-MM-01')
-
- )
- """)
-report_auction_adjudication()
-
-class report_attendance(osv.osv):
- _name="report.attendance"
- _description = "Report Sign In/Out"
- _auto = False
- #_rec_name='date'
- _columns = {
- 'name': fields.date('Date', readonly=True, select=1),
- 'employee_id' : fields.many2one('hr.employee', "Employee's Name", select=1, readonly=True),
- 'total_attendance': fields.float('Total', readonly=True),
-}
- def init(self, cr):
- cr.execute("""CREATE OR REPLACE VIEW report_attendance AS
- SELECT
- id,
- name,
- employee_id,
- CASE WHEN SUM(total_attendance) < 0
- THEN (SUM(total_attendance) +
- CASE WHEN current_date <> name
- THEN 1440
- ELSE (EXTRACT(hour FROM current_time) * 60) + EXTRACT(minute FROM current_time)
- END
- )
- ELSE SUM(total_attendance)
- END /60 as total_attendance
- FROM (
- SELECT
- max(a.id) as id,
- a.name::date as name,
- a.employee_id,
- SUM(((EXTRACT(hour FROM a.name) * 60) + EXTRACT(minute FROM a.name)) * (CASE WHEN a.action = 'sign_in' THEN -1 ELSE 1 END)) as total_attendance
- FROM hr_attendance a
- where name > current_date + interval '-1 day'
- GROUP BY a.name::date, a.employee_id
- ) AS fs
- GROUP BY name,fs.id,employee_id
- """)
-
-report_attendance()
-
-
-class report_deposit_border(osv.osv):
- _name="report.deposit.border"
- _description = "Report deposit border"
- _auto = False
- _rec_name='bord'
- _columns = {
- 'bord': fields.char('Depositer Inventory', size=64, required=True),
- 'seller': fields.many2one('res.partner', 'Seller', select=1),
- 'moy_est' : fields.float('Avg. Est', select=1, readonly=True),
- 'total_marge': fields.float('Total margin', readonly=True),
- 'nb_obj':fields.float('# of objects', readonly=True),
-}
- def init(self, cr):
- cr.execute("""CREATE OR REPLACE VIEW report_deposit_border AS
- SELECT
- min(al.id) as id,
- ab.partner_id as seller,
- ab.name as bord,
- COUNT(al.id) as nb_obj,
- SUM((al.lot_est1 + al.lot_est2)/2) as moy_est,
- SUM(al.net_revenue)/(count(ad.id)) as total_marge
-
- FROM
- auction_lots al,auction_deposit ab,auction_dates ad
- WHERE
- ad.id=al.auction_id
- and al.bord_vnd_id=ab.id
- GROUP BY
- ab.name,ab.partner_id""")
-report_deposit_border()
-
-class report_object_encoded(osv.osv):
- _name = "report.object.encoded"
- _description = "Object encoded"
- _auto = False
- _columns = {
- 'state': fields.selection((('draft', 'Draft'), ('unsold', 'Unsold'), ('paid', 'Paid'), ('invoiced', 'Invoiced')), 'State', required=True, select=1),
- 'user_id':fields.many2one('res.users', 'User', select=1),
- 'estimation': fields.float('Estimation', select=2),
- 'date': fields.date('Create Date', required=True),
-# 'gross_revenue':fields.float('Gross revenue',readonly=True, select=2),
-# 'net_revenue':fields.float('Net revenue',readonly=True, select=2),
-# 'obj_margin':fields.float('Net margin', readonly=True, select=2),
- 'obj_ret':fields.integer('# obj ret', readonly=True, select=2),
-# 'adj':fields.integer('Adj.', readonly=True, select=2),
- 'obj_num':fields.integer('# of Encoded obj.', readonly=True, select=2),
- }
- def init(self, cr):
- cr.execute('''create or replace view report_object_encoded as
- (select min(al.id) as id,
- to_char(al.create_date, 'YYYY-MM-DD') as date,
- al.state as state,
- al.create_uid as user_id,
- (SELECT count(1) FROM auction_lots WHERE obj_ret>0) as obj_ret,
- sum((100* al.lot_est1)/al.obj_price) as estimation,
- COUNT(al.product_id) as obj_num
- from auction_lots al
- where al.obj_price>0 and state='draft'
- group by to_char(al.create_date, 'YYYY-MM-DD'), al.state, al.create_uid)
- ''')
-report_object_encoded()
-
-
-class report_object_encoded_manager(osv.osv):
- _name = "report.object.encoded.manager"
- _description = "Object encoded"
- _auto = False
- _columns = {
- 'user_id':fields.many2one('res.users', 'User', select=True),
- 'estimation': fields.float('Estimation', select=True),
- 'date': fields.date('Create Date', required=True),
- 'gross_revenue':fields.float('Gross revenue', readonly=True, select=True),
- 'net_revenue':fields.float('Net revenue', readonly=True, select=True),
- 'obj_margin':fields.float('Net margin', readonly=True, select=True),
- 'obj_ret':fields.integer('# obj ret', readonly=True, select=True),
- 'adj':fields.integer('Adj.', readonly=True, select=True),
- 'obj_num':fields.integer('# of Encoded obj.', readonly=True, select=True),
- }
- def init(self, cr):
- cr.execute('''create or replace view report_object_encoded_manager as
- (select
- min(al.id) as id,
- to_char(al.create_date, 'YYYY-MM-DD') as date,
- al.create_uid as user_id,
- sum((100*lot_est1)/obj_price) as estimation,
- (SELECT count(1) FROM auction_lots WHERE obj_ret>0) as obj_ret,
- SUM(al.gross_revenue) as "gross_revenue",
- SUM(al.net_revenue) as "net_revenue",
- SUM(al.net_revenue)/count(al.id) as "obj_margin",
- COUNT(al.product_id) as obj_num,
- SUM(al.obj_price) as "adj"
- from auction_lots al
- where al.obj_price>0
- group by to_char(al.create_date, 'YYYY-MM-DD'), al.create_uid)
- ''')
-report_object_encoded_manager()
-
-class report_unclassified_objects(osv.osv):
- _name = "report.unclassified.objects"
- _description = "Unclassified objects "
- _auto = False
- _columns = {
- 'name': fields.char('Short Description', size=64, required=True),
- 'obj_num': fields.integer('Catalog Number'),
- 'obj_price': fields.float('Adjudication price'),
- 'lot_num': fields.integer('List Number', required=True, select=1),
- 'state': fields.selection((('draft', 'Draft'), ('unsold', 'Unsold'), ('paid', 'Paid'), ('sold', 'Sold')), 'State', required=True, readonly=True),
- 'obj_comm': fields.boolean('Commission'),
- 'bord_vnd_id': fields.many2one('auction.deposit', 'Depositer Inventory', required=True),
- 'ach_login': fields.char('Buyer Username', size=64),
- 'lot_est1': fields.float('Minimum Estimation'),
- 'lot_est2': fields.float('Maximum Estimation'),
- 'lot_type': fields.selection(_type_get, 'Object category', size=64),
- 'auction': fields.many2one('auction.dates', 'Auction date', readonly=True, select=1),
- }
- def init(self, cr):
- cr.execute("""create or replace view report_unclassified_objects as
- (select
- min(al.id) as id,
- al.name as name,
- al.obj_price as obj_price,
- al.obj_num as obj_num,
- al.lot_num as lot_num,
- al.state as state,
- al.obj_comm as obj_comm,
- al.bord_vnd_id as bord_vnd_id,
- al.ach_login as ach_login,
- al.lot_est1 as lot_est1,
- al.lot_est2 as lot_est2,
- al.lot_type as lot_type,
- al.auction_id as auction
- from auction_lots al,auction_lot_category ac
- where (al.lot_type=ac.name) AND (ac.aie_categ='41') AND (al.auction_id is null)
-group by al.obj_price,al.obj_num, al.lot_num, al.state, al.obj_comm,al.bord_vnd_id,al.ach_login,al.lot_est1,al.lot_est2,al.lot_type,al.auction_id,al.name)
- """)
-report_unclassified_objects()
-
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/auction/auction_data.xml b/addons/auction/auction_data.xml
index 7d742803722..32cc0bc5726 100644
--- a/addons/auction/auction_data.xml
+++ b/addons/auction/auction_data.xml
@@ -6,49 +6,320 @@
<field name="code">0</field>
<field name="type">view</field>
<field name="currency_id" search="[('name','=','EUR')]"/>
- <field name="parent_id" type="list">
+ <field name="parent_id" eval="0">
<value search="[('type','=','view')]" model="account.account"/>
</field>
+ <field name="user_type" ref="account.account_type_root"/>
</record>
+
+ <!-- Auction lots category data -->
+
+ <record model="aie.category" id="aie_category_anti_view">
+ <field name="name">Antiques</field>
+ <field name="code">ANTI</field>
+ </record>
+
+ <record model="aie.category" id="aie_category_paint_view">
+ <field name="name">Painting</field>
+ <field name="code">PAINT</field>
+ <field name="parent_id" ref="aie_category_anti_view"/>
+ </record>
+
+ <record model="aie.category" id="aie_category_furn_view">
+ <field name="name">Furnitures</field>
+ <field name="code">FURN</field>
+ <field name="parent_id" ref="aie_category_anti_view"/>
+ </record>
+
+ <record model="aie.category" id="aie_category_pcg_view">
+ <field name="name">Porcelain, Ceramics, Glassmaking, ...</field>
+ <field name="code">PCG</field>
+ <field name="parent_id" ref="aie_category_anti_view"/>
+ </record>
+
+ <record model="aie.category" id="aie_category_sbe_view">
+ <field name="name">Sculpture, bronze, eso</field>
+ <field name="code">SBE</field>
+ <field name="parent_id" ref="aie_category_anti_view"/>
+ </record>
+
+ <record model="aie.category" id="aie_category_clock_view">
+ <field name="name">Clocks and watches</field>
+ <field name="code">CLW</field>
+ <field name="parent_id" ref="aie_category_anti_view"/>
+ </record>
+
+ <record model="aie.category" id="aie_category_caob_view">
+ <field name="name">Collectible and art objects</field>
+ <field name="code">COAO</field>
+ <field name="parent_id" ref="aie_category_anti_view"/>
+ </record>
+
+ <record model="aie.category" id="aie_category_engr_view">
+ <field name="name">Engravings</field>
+ <field name="code">ENGR</field>
+ <field name="parent_id" ref="aie_category_anti_view"/>
+ </record>
+
+ <record model="aie.category" id="aie_category_gart_view">
+ <field name="name">Graphic Arts</field>
+ <field name="code">GART</field>
+ <field name="parent_id" ref="aie_category_anti_view"/>
+ </record>
+
+ <record model="aie.category" id="aie_category_light_view">
+ <field name="name">Lightings</field>
+ <field name="code">LGT</field>
+ <field name="parent_id" ref="aie_category_anti_view"/>
+ </record>
+
+ <record model="aie.category" id="aie_category_metal_view">
+ <field name="name">Metal Ware</field>
+ <field name="code">MW</field>
+ <field name="parent_id" ref="aie_category_anti_view"/>
+ </record>
+
+ <record model="aie.category" id="aie_category_mini_view">
+ <field name="name">Miniatures</field>
+ <field name="code">MAT</field>
+ <field name="parent_id" ref="aie_category_anti_view"/>
+ </record>
+
+ <record model="aie.category" id="aie_category_collect_view">
+ <field name="name">Collections</field>
+ <field name="code">CLT</field>
+ <field name="parent_id" ref="aie_category_mini_view"/>
+ </record>
+
+ <record model="aie.category" id="aie_category_mi_view">
+ <field name="name">Musical Instruments</field>
+ <field name="code">MI</field>
+ <field name="parent_id" ref="aie_category_anti_view"/>
+ </record>
+
+ <record model="aie.category" id="aie_category_owm_view">
+ <field name="name">Old weapons and militaria</field>
+ <field name="code">OWM</field>
+ <field name="parent_id" ref="aie_category_anti_view"/>
+ </record>
+
+ <record model="aie.category" id="aie_category_oart_view">
+ <field name="name">Oriental Arts</field>
+ <field name="code">OART</field>
+ <field name="parent_id" ref="aie_category_anti_view"/>
+ </record>
+
+ <record model="aie.category" id="aie_category_chf_view">
+ <field name="name">Chineese furnitures</field>
+ <field name="code">CHF</field>
+ <field name="parent_id" ref="aie_category_oart_view"/>
+ </record>
+
+ <record model="aie.category" id="aie_category_othr_view">
+ <field name="name">Others</field>
+ <field name="code">OTR</field>
+ <field name="parent_id" ref="aie_category_anti_view"/>
+ </record>
+
+ <record model="aie.category" id="aie_category_pst_view">
+ <field name="name">Posters</field>
+ <field name="code">PST</field>
+ <field name="parent_id" ref="aie_category_anti_view"/>
+ </record>
+
+ <record model="aie.category" id="aie_category_rel_view">
+ <field name="name">Religiosa</field>
+ <field name="code">REL</field>
+ <field name="parent_id" ref="aie_category_anti_view"/>
+ </record>
+
+ <record model="aie.category" id="aie_category_sin_view">
+ <field name="name">Scientific Instruments</field>
+ <field name="code">SIN</field>
+ <field name="parent_id" ref="aie_category_anti_view"/>
+ </record>
+
+ <record model="aie.category" id="aie_category_tin_view">
+ <field name="name">Tin</field>
+ <field name="code">TIN</field>
+ <field name="parent_id" ref="aie_category_anti_view"/>
+ </record>
+
+ <record model="aie.category" id="aie_category_cwa_view">
+ <field name="name">Copper wares</field>
+ <field name="code">CWA</field>
+ <field name="parent_id" ref="aie_category_tin_view"/>
+ </record>
+
+ <record model="aie.category" id="aie_category_ty_view">
+ <field name="name">Toys</field>
+ <field name="code">TY</field>
+ <field name="parent_id" ref="aie_category_anti_view"/>
+ </record>
+
+ <record model="aie.category" id="aie_category_vrs_view">
+ <field name="name">Verreries</field>
+ <field name="code">VRS</field>
+ <field name="parent_id" ref="aie_category_anti_view"/>
+ </record>
+
+ <record model="aie.category" id="aie_category_wne_view">
+ <field name="name">Wine</field>
+ <field name="code">WNE</field>
+ <field name="parent_id" ref="aie_category_anti_view"/>
+ </record>
+
+ <!-- -->
+
+ <record model="aie.category" id="aie_category_con_view">
+ <field name="name">Contemporary Art</field>
+ <field name="code">CONTEM</field>
+ </record>
+
+ <record model="aie.category" id="aie_category_con_art_view">
+ <field name="name">Arts</field>
+ <field name="code">ARTS</field>
+ <field name="parent_id" ref="aie_category_con_view"/>
+ </record>
+
+ <record model="aie.category" id="aie_category_con_curi_view">
+ <field name="name">Curiosa</field>
+ <field name="code">CRS</field>
+ <field name="parent_id" ref="aie_category_con_view"/>
+ </record>
+
+ <record model="aie.category" id="aie_category_con_ome_view">
+ <field name="name">Other Media</field>
+ <field name="code">OME</field>
+ <field name="parent_id" ref="aie_category_con_view"/>
+ </record>
+
+ <record model="aie.category" id="aie_category_con_pht_view">
+ <field name="name">Photo</field>
+ <field name="code">PHT</field>
+ <field name="parent_id" ref="aie_category_con_view"/>
+ </record>
+
+ <record model="aie.category" id="aie_category_con_paint_view">
+ <field name="name">Painting</field>
+ <field name="code">CPAINT</field>
+ <field name="parent_id" ref="aie_category_con_view"/>
+ </record>
+
+ <record model="aie.category" id="aie_category_con_scul_view">
+ <field name="name">Sculpture</field>
+ <field name="code">SCUL</field>
+ <field name="parent_id" ref="aie_category_con_view"/>
+ </record>
+
+ <record model="aie.category" id="aie_category_con_cshe_view">
+ <field name="name">Shows</field>
+ <field name="code">CSHW</field>
+ <field name="parent_id" ref="aie_category_con_view"/>
+ </record>
+
+
+ <record model="aie.category" id="aie_category_jew_view">
+ <field name="name">Jewelry</field>
+ <field name="code">JWL</field>
+ <field name="parent_id" ref="aie_category_con_view"/>
+ </record>
+
+ <!-- -->
+
+ <record model="aie.category" id="aie_category_uncla_view">
+ <field name="name">Unclassifieds</field>
+ <field name="code">UNCLASS</field>
+ </record>
+
+ <record model="aie.category" id="aie_category_afrart_view">
+ <field name="name">African Arts</field>
+ <field name="code">AFART</field>
+ <field name="parent_id" ref="aie_category_anti_view"/>
+ </record>
+
+ <record model="aie.category" id="aie_category_argen_view">
+ <field name="name">Argenterie</field>
+ <field name="code">ARGENT</field>
+ <field name="parent_id" ref="aie_category_anti_view"/>
+ </record>
+
+ <record model="aie.category" id="aie_category_artfrom_view">
+ <field name="name">Art from the Ivory Coast</field>
+ <field name="code">ARTFORM</field>
+ <field name="parent_id" ref="aie_category_anti_view"/>
+ </record>
+
+ <record model="aie.category" id="aie_category_afrec_view">
+ <field name="name">African Arts</field>
+ <field name="code">AFRART</field>
+ <field name="parent_id" ref="aie_category_artfrom_view"/>
+ </record>
+
+ <record model="aie.category" id="aie_category_book_view">
+ <field name="name">Books, manuscripts, eso.</field>
+ <field name="code">BME</field>
+ <field name="parent_id" ref="aie_category_anti_view"/>
+ </record>
+
+ <record model="aie.category" id="aie_category_carpet_view">
+ <field name="name">Carpet and textilles</field>
+ <field name="code">CARPTEX</field>
+ <field name="parent_id" ref="aie_category_anti_view"/>
+ </record>
+
+ <record model="aie.category" id="aie_category_cartoon_view">
+ <field name="name">Cartoons</field>
+ <field name="code">CATOON</field>
+ <field name="parent_id" ref="aie_category_anti_view"/>
+ </record>
+
+ <!-- End Of Auction Lots Category -->
<record model="account.account" id="auction_expense_view">
<field name="name">Auction Adjudication Expenses</field>
- <field name="code">0</field>
+ <field name="code">1</field>
<field name="type">view</field>
<field name="currency_id" search="[('name','=','EUR')]"/>
- <field name="parent_id" type="list">
+ <field name="parent_id" eval="0">
<value search="[('type','=','view')]" model="account.account"/>
</field>
+ <field name="user_type" ref="account.account_type_asset"/>
</record>
<record model="account.account" id="auction_income">
<field name="name">Auction Adjudications</field>
<field name="code">7x*</field>
- <field name="type">income</field>
+ <!-- <field name="type">income</field> -->
+ <field name="type">other</field>
<field name="currency_id" search="[('name','=','EUR')]"/>
- <field name="parent_id" eval="[auction_income_view]"/>
+ <field name="parent_id" eval="auction_income_view"/>
+ <field name="user_type" ref="account.account_type_root"/>
</record>
<record model="account.account" id="auction_expense">
<field name="name">Auction Adjudication Expenses</field>
<field name="code">6x*</field>
- <field name="type">expense</field>
+ <field name="type">other</field>
<field name="currency_id" search="[('name','=','EUR')]"/>
- <field name="parent_id" eval="[auction_expense_view]"/>
+ <field name="parent_id" eval="auction_expense_view"/>
+ <field name="user_type" ref="account.account_type_root"/>
</record>
<record model="account.account" id="auction_income_costs">
<field name="name">Auction Buyer Costs</field>
- <field name="code">7x*</field>
- <field name="type">tax</field>
+ <field name="code">8x*</field>
+ <field name="type">payable</field>
<field name="currency_id" search="[('name','=','EUR')]"/>
- <field name="parent_id" eval="[auction_income_view]"/>
+ <field name="parent_id" eval="auction_income_view"/>
+ <field name="user_type" ref="account.account_type_root"/>
</record>
<record model="account.account" id="auction_expense_costs">
<field name="name">Auction Seller Costs</field>
- <field name="code">6x*</field>
- <field name="type">tax</field>
+ <field name="code">9x*</field>
+ <field name="type">receivable</field>
<field name="currency_id" search="[('name','=','EUR')]"/>
- <field name="parent_id" eval="[auction_expense_view]"/>
+ <field name="parent_id" eval="auction_expense_view"/>
+ <field name="user_type" ref="account.account_type_root"/>
</record>
<record model="account.tax" id="tax_buyer_author">
@@ -77,21 +348,10 @@
<field name="account_collected_id" ref="auction_expense_costs"/>
<field name="account_paid_id" ref="auction_expense_costs"/>
</record>
-
- <ir_set>
- <field name="keys" eval="[('meta','res.partner'),('name','auction.seller.costs')]"/>
- <field name="args" eval="[]"/>
- <field name="name">account.seller.costs</field>
- <field name="value" eval="tax_seller"/>
- <field name="meta" eval="{'type':'many2one', 'string':'Seller Costs', 'relation':'account.tax'}"/>
- </ir_set>
-
-
-
+
<record id="product.product_product_pc2" model="product.product">
<field name="list_price">770.0</field>
<field name="standard_price">700.0</field>
-
</record>
</data>
diff --git a/addons/auction/auction_demo.xml b/addons/auction/auction_demo.xml
index fe48ae3df74..4a794db88c3 100644
--- a/addons/auction/auction_demo.xml
+++ b/addons/auction/auction_demo.xml
@@ -166,30 +166,30 @@
<record model="auction.lot.category" id="auction_cat_1">
<field name="name">painting</field>
<field name="priority">1</field>
- <field name="aie_categ">8</field>
+ <field name="aie_categ" ref="aie_category_paint_view"/>
</record>
+
<record model="auction.lot.category" id="auction_cat_2">
<field name="name">Furniture</field>
<field name="priority">2</field>
- <field name="aie_categ">10</field>
-
+ <field name="aie_categ" ref="aie_category_furn_view"/>
</record>
<record model="auction.lot.category" id="auction_cat_3">
<field name="name">glass</field>
<field name="priority">2</field>
- <field name="aie_categ">25</field>
+ <field name="aie_categ" ref="aie_category_pcg_view"/>
</record>
<record model="auction.lot.category" id="auction_cat_4">
<field name="name">sculpture</field>
<field name="priority">10</field>
- <field name="aie_categ">18</field>
+ <field name="aie_categ" ref="aie_category_sbe_view"/>
</record>
<record model="auction.lot.category" id="auction_cat_5">
<field name="name">Jawellery</field>
<field name="priority">6</field>
- <field name="aie_categ">15</field>
+ <field name="aie_categ" ref="aie_category_jew_view"/>
</record>
<!-- end == demo data for the auction_lot_Category-->
diff --git a/addons/auction/auction_report.xml b/addons/auction/auction_report.xml
index eec4cf966cd..cd924e4dff8 100644
--- a/addons/auction/auction_report.xml
+++ b/addons/auction/auction_report.xml
@@ -207,11 +207,13 @@
xsl="auction/report/lots_bids_phone.xsl"
multi="1"/>-->
- <report string="Auction's results"
- model="auction.lots"
- name="auction.result"
- rml="auction/report/auction_result.rml"
- multi="1"/>
+<!-- temp -->
+
+<!-- <report string="Auction's results"-->
+<!-- model="auction.lots"-->
+<!-- name="auction.result"-->
+<!-- rml="auction/report/auction_result.rml"-->
+<!-- multi="1"/>-->
<report string="Results with buyer"
model="auction.lots"
diff --git a/addons/auction/auction_view.xml b/addons/auction/auction_view.xml
index 9d4559f24ef..d5ac1c17904 100644
--- a/addons/auction/auction_view.xml
+++ b/addons/auction/auction_view.xml
@@ -404,6 +404,7 @@
<field name="vnd_lim_net"/>
<field name="sel_inv_id"/>
<field name="paid_vnd"/>
+ <button name="mark_paid" string="Mark" type="object" icon="gtk-execute" attrs="{'invisible':[('paid_vnd','=', False)]}"/>
<field name="history_ids" colspan="4" readonly="1" nolabel="1">
<tree string="History">
<field name="name"/>
@@ -588,18 +589,6 @@
</field>
</record>
-
- =======================================================
- Auction Management/seller
- =======================================================
- <record model="ir.actions.act_window" id="action_unclassified_objects">
- <field name="name">Unclassified objects</field>
- <field name="res_model">report.unclassified.objects</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree,form</field>
- <field name="filter" eval="True"/>
- </record>
-
<record model="ir.ui.view" id="v12">
<field name="name">Auction.deposit.tree</field>
<field name="model">auction.deposit</field>
@@ -790,7 +779,7 @@
</field>
</record>
-
+ <menuitem name="Reporting" id="auction_report_menu" parent="auction_menu_root" sequence="6"/>
<record model="ir.ui.view" id="view_auction_bid_tree">
<field name="name">auction.bid.tree</field>
@@ -823,437 +812,34 @@
<menuitem name="Bids line" parent="menu_action_bid_open" action="action_bids_form" id="menu_action_bids_form"/>
-
-<!--start : creating auction Reporting menu for the auction by pmo-->
-
-<record model="ir.ui.view" id="view_auction_reports_tree">
- <field name="name">auction.reports.tree</field>
- <field name="model">report.auction.view</field>
- <field name="type">tree</field>
- <field name="arch" type="xml">
- <tree string="Auction results">
- <field name="auction_id" />
- <field name="nobjects" />
- <field name="nbuyer" />
- <field name="obj_ret" />
- <field name="nseller" />
- <field name="min_est" />
- <field name="max_est" />
- <field name="adj_price" />
- </tree>
- </field>
- </record>
- <record model="ir.ui.view" id="view_auction_reports_form">
- <field name="name">auction.reports.form</field>
- <field name="model">report.auction.view</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Auctions results">
- <field name="auction_id" />
- <field name="nobjects" />
- <field name="nbuyer" />
- <field name="nseller" />
- <field name="min_est" />
- <field name="max_est" />
- <field name="adj_price" />
- </form>
- </field>
- </record>
-
- <menuitem name="Reporting" id="auction_report_menu" parent="auction_menu_root" sequence="6"/>
-
-
-<record model="ir.actions.act_window" id="action_auction_report_allmonth_view1">
- <field name="name">Auction report</field>
- <field name="res_model">report.auction.view</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree</field>
- <!--field name="domain">[('auction_id','=', active_id)]</field-->
- </record>
- <menuitem name="Auction" id="auction_report_auction_menu" parent="auction_report_menu"/>
- <menuitem name="Auction's Summary" parent="auction_report_auction_menu" action="action_auction_report_allmonth_view1" id="menu_auction_allmonth_view1"/>
-
-
-
- <!--start : auction reporting view 2-->
-
-<record model="ir.ui.view" id="view_auction_reports_tree2">
- <field name="name">auction.reports.tree2</field>
- <field name="model">report.auction.view2</field>
- <field name="type">tree</field>
- <field name="arch" type="xml">
- <tree string="Auction Reporting tree view2">
- <field name="date" />
- <field name="auction" />
- <field name="sum_adj" />
- <field name="obj_number" />
- <field name="gross_revenue" />
- <field name="net_revenue" />
- <field name="obj_margin" />
- <field name="obj_margin_procent" />
- </tree>
- </field>
- </record>
- <record model="ir.ui.view" id="view_auction_reports_form2">
- <field name="name">Auction report</field>
- <field name="model">report.auction.view2</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Auctions">
- <field name="auction" />
- <field name="sum_adj" />
- <field name="gross_revenue" />
- <field name="net_revenue" />
- <field name="obj_margin" />
- <field name="obj_margin_procent" />
- </form>
- </field>
- </record>
-
- <record model="ir.actions.act_window" id="action_auction_report_thismonth_view2">
- <field name="name">Auction report</field>
- <field name="res_model">report.auction.view2</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree</field>
- <field name="domain">[('date','ilike',time.strftime('%Y-%m'))]</field>
- </record>
-
-<!-- <menuitem name="This Month" id="auction_report_thismonth_menu" parent="auction_report_menu"/> -->
-<!-- <menuitem name="Result of Auction" action="action_auction_report_thismonth_view2" id="menu_auction_thismonth_view2" parent="auction_report_thismonth_menu"/> -->
-
-
-<record model="ir.actions.act_window" id="action_auction_report_allmonth_view2">
- <field name="name">Auction report</field>
- <field name="res_model">report.auction.view2</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree</field>
- </record>
- <menuitem name="Auction's Revenues" parent="auction_report_auction_menu" action="action_auction_report_allmonth_view2" id="menu_auction_allmonth_view2"/>
-
-<!--start : creating seller Reporting menu for the selller by pmo-->
-
-<record model="ir.ui.view" id="view_auction_form">
- <field name="name">Seller's auction</field>
- <field name="model">report.seller.auction</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Auction reporting form view">
- <field name="seller" select="1"/>
- <field name="total_price"/>
- <field name="avg_price"/>
- <field name="state" select="1"/>
- </form>
- </field>
- </record>
-
-
- <record model="ir.ui.view" id="view_auction_tree">
- <field name="name">Seller's auction</field>
- <field name="model">report.seller.auction</field>
- <field name="type">tree</field>
- <field name="arch" type="xml">
- <tree string="Auction reporting tree view">
- <field name="auction" />
- <!--field name="date" /-->
- <field name="seller" select="1"/>
- <field name="object_number"/>
- <field name="total_price"/>
- <field name="avg_price" />
- <field name="avg_estimation" />
- </tree>
- </field>
- </record>
- <record model="ir.ui.view" id="view_auction_graph">
- <field name="name">Seller's auction</field>
- <field name="model">report.seller.auction</field>
- <field name="type">graph</field>
- <field name="arch" type="xml">
- <graph string="Auction reporting graph view" orientation="vertical" type="bar">
- <field name="seller" />
- <!-- <field name="object_sold"/> -->
- <field name="total_price" operator="+"/>
- <field name="avg_price" operator="+" />
- <field name="avg_estimation" operator="+" />
-
- </graph>
- </field>
- </record>
- <record model="ir.actions.act_window" id="action_auction_reporting1">
- <field name="name">Seller's auction</field>
- <field name="res_model">report.seller.auction</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree,graph</field>
- <field name="domain">[('date','ilike',time.strftime('%Y-%m'))]</field>
- </record>
- <record model="ir.actions.act_window" id="action_auction_reporting_all1">
- <field name="name">Seller's auction</field>
- <field name="res_model">report.seller.auction</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree,graph</field>
- </record>
- <menuitem name="Sellers" id="auction_report_seller_menu" parent="auction_report_menu"/>
- <menuitem name="Seller's Summary" action="action_auction_reporting_all1" id="menu_seller_allmonth_view1" parent="auction_report_seller_menu"/>
-
-<record model="ir.ui.view" id="view_auction_form2">
- <field name="name">Seller's auction</field>
- <field name="model">report.seller.auction2</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Auction reporting2 form view">
- <field name="auction" select="1"/>
- <field name="seller" select="1"/>
- <field name="sum_adj" select="1"/>
- <field name="gross_revenue" select="1"/>
- <field name="net_revenue" select="1"/>
- <field name="net_margin" select="1" />
- <field name="date" select="1"/>
-
- </form>
- </field>
- </record>
- <record model="ir.ui.view" id="view_auction_tree2">
- <field name="name">Seller's auction</field>
- <field name="model">report.seller.auction2</field>
- <field name="type">tree</field>
- <field name="arch" type="xml">
- <tree string="Auction reporting2 tree view">
- <field name="auction" select="1"/>
- <field name="seller" select="1"/>
- <field name="sum_adj" select="1" sum="Sum adj"/>
- <field name="gross_revenue" select="1"/>
- <field name="net_revenue" select="1"/>
- <field name="net_margin" select="1" sum="Sum net margin"/>
- <field name="date" select="1"/>
- </tree>
- </field>
- </record>
- <record model="ir.ui.view" id="view_auction_graph2">
- <field name="name">Seller's auction</field>
- <field name="model">report.seller.auction2</field>
- <field name="type">graph</field>
- <field name="arch" type="xml">
- <graph string="Auction seller reporting2 graph view" orientation="vertical" type="bar">
- <field name="seller" />
- <field name="net_revenue" operator="+"/>
- <field name="gross_revenue" operator="+" />
- <field name="net_margin" operator="+" />
- </graph>
- </field>
- </record>
- <record model="ir.actions.act_window" id="action_auction_reporting_all2">
- <field name="name">Seller's auction</field>
- <field name="res_model">report.seller.auction2</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree,graph</field>
- <field name="domain">[('date','ilike',time.strftime('%Y-%m'))]</field>
- </record>
- <menuitem name="Seller's Revenues" action="action_auction_reporting_all2" id="menu_seller_allmonth_view2" parent="auction_report_seller_menu"/>
-
-<record model="ir.ui.view" id="view_auction_buyer_form">
- <field name="name">Buyer's auction</field>
- <field name="model">report.buyer.auction</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Auction buyer reporting form view">
- <field name="buyer_login" select="1"/>
- <field name="buyer" select="1"/>
- <field name="object"/>
- <field name="total_price"/>
- <field name="avg_price"/>
- </form>
- </field>
- </record>
- <record model="ir.ui.view" id="view_auction_buyer_tree">
- <field name="name">Buyer's auction</field>
- <field name="model">report.buyer.auction</field>
- <field name="type">tree</field>
- <field name="arch" type="xml">
- <tree string="Auction buyer reporting tree view">
- <field name="auction" select="1"/>
- <field name="buyer_login" select="1"/>
- <field name="buyer" select="1"/>
- <field name="object" select="1"/>
- <field name="total_price" select="1"/>
- <field name="avg_price" select="1"/>
- </tree>
- </field>
- </record>
- <record model="ir.actions.act_window" id="action_auction_buyer_reporting">
- <field name="name">Buyer's auction</field>
- <field name="res_model">report.buyer.auction</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree</field>
- <field name="domain">[('date','ilike',time.strftime('%Y-%m'))]</field>
- </record>
-
-<record model="ir.ui.view" id="view_auction_buyer_form2">
- <field name="name">Buyer's auction</field>
- <field name="model">report.buyer.auction2</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Auction buyer reporting form view2">
- <field name="buyer_login" select="1"/>
- <field name="buyer" select="1"/>
- <field name="sumadj" />
- <field name="gross_revenue" />
- <field name="net_revenue" />
- <field name="net_margin" />
- </form>
- </field>
- </record>
- <record model="ir.ui.view" id="view_auction_buyer_tree2">
- <field name="name">Buyer's auction</field>
- <field name="model">report.buyer.auction2</field>
- <field name="type">tree</field>
- <field name="arch" type="xml">
- <tree string="Auction buyer reporting tree view2">
- <field name="auction" select="1"/>
- <field name="buyer_login" select="1"/>
- <field name="buyer" select="1"/>
- <field name="sumadj" select="1" sum="Sum adj"/>
- <field name="gross_revenue" select="1"/>
- <field name="net_revenue" select="1"/>
- <field name="net_margin" select="1" sum="Sum net margin"/>
- </tree>
- </field>
- </record>
- <record model="ir.actions.act_window" id="action_auction_buyer_reporting2">
- <field name="name">Buyer's auction</field>
- <field name="res_model">report.buyer.auction2</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree</field>
- <field name="domain">[('date','ilike',time.strftime('%Y-%m'))]</field>
- </record>
-
- <record model="ir.actions.act_window" id="action_auction_buyer_reporting_all1">
- <field name="name">Buyer's auction</field>
- <field name="res_model">report.buyer.auction</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree</field>
- </record>
- <menuitem name="Buyer" id="auction_report_buyer_menu" parent="auction_report_menu"/>
- <menuitem name="Buyer's Summary" action="action_auction_buyer_reporting_all1" id="menu_buyer_allmonth_view1" parent="auction_report_buyer_menu"/>
-
- <record model="ir.actions.act_window" id="action_auction_buyer_reporting_all2">
- <field name="name">Buyer's auction for all months</field>
- <field name="res_model">report.buyer.auction2</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree</field>
- </record>
-
-
-
-<menuitem name="Buyer's Revenues" action="action_auction_buyer_reporting_all2" id="menu_buyer_allmonth_view2" parent="auction_report_buyer_menu"/>
-
-<!--end : creating buyer Reporting menu for the buyer by pmo-->
-
- <record model="ir.ui.view" id="view_report_unplanned_object_tree">
- <field name="name">Unplanned objects</field>
- <field name="model">report.unplanned.object</field>
- <field name="type">tree</field>
- <field name="arch" type="xml">
- <tree string="Unplanned Objects">
- <field name="depos" select="1"/>
- <field name="lot" select="1"/>
- <field name="product_l" select="1"/>
- <field name="lot_est1_l"/>
- <field name="lot_est2_l" select="1"/>
- <field name="artist_id_l" select="1"/>
- <field name="name_l" select="1"/>
- <field name="obj_desc_l"/>
- </tree>
- </field>
- </record>
- <record model="ir.ui.view" id="view_report_unplanned_object_form">
- <field name="name">Unplanned objects</field>
- <field name="model">report.unplanned.object</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Unplanned Objects">
- <field name="depos" select="1"/>
- <field name="lot" select="1"/>
- <field name="product_l" select="1"/>
- <field name="lot_est1_l" select="1"/>
- <field name="lot_est2_l" select="1"/>
- <field name="artist_id_l" select="1"/>
- <field name="obj_desc_l" select="1"/>
- <field name="name_l" select="1"/>
- </form>
- </field>
- </record>
-
-=============================
-estimation.adj.category
-==============================
- <record model="ir.ui.view" id="view_report_auction_estimation_adj_category_form">
- <field name="name">report.auction.estimation.adj.category.form</field>
- <field name="model">report.auction.estimation.adj.category</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Min est/Adj/Max est">
- <!--field name="date" select="1"/-->
- <field name="lot_type" select="1"/>
- <field name="user_id" select="1"/>
- <field name="lot_est1"/>
- <field name="lot_est2"/>
- <field name="adj_total"/>
- <field name="date" select="1"/>
- </form>
- </field>
- </record>
- <record model="ir.ui.view" id="view_report_auction_estimation_adj_category_tree">
- <field name="name">report.auction.estimation.adj.category.tree</field>
- <field name="model">report.auction.estimation.adj.category</field>
- <field name="type">tree</field>
- <field name="arch" type="xml">
- <tree string="Min est/Adj/Max est">
- <!--field name="date" select="1"/-->
- <field name="user_id" select="1"/>
- <field name="lot_type" select="1"/>
- <field name="lot_est1" select="1"/>
- <field name="lot_est2" select="1"/>
- <field name="adj_total" select="1"/>
- <field name="date" select="1"/>
- </tree>
- </field>
- </record>
-
- <record model="ir.ui.view" id="view_report_auction_estimation_adj_category_graph">
- <field name="name">report.auction.estimation.adj.category.graph</field>
- <field name="model">report.auction.estimation.adj.category</field>
- <field name="type">graph</field>
- <field name="arch" type="xml">
- <graph string="Min est/Adj/Max est" orientation="vertical" type="bar">
- <!--field name="date" operator="+"/-->
- <field name="lot_type" select="1"/>
- <field name="lot_est1" operator="+"/>
- <field name="adj_total" operator="+"/>
- <field name="lot_est2" operator="+"/>
- <field name="user_id" group="True"/>
- </graph>
- </field>
- </record>
- <record model="ir.actions.act_window" id="action_report_auction_estimation_adj_category_manager_tree">
- <field name="name">Min est/Adj/Max est</field>
- <field name="res_model">report.auction.estimation.adj.category</field>
- <field name="view_type">form</field>
- <field name="view_mode">graph,tree</field>
- <field name="domain">[('date','like',time.strftime('%Y-%m'))]</field>
- </record>
-
- <record model="ir.actions.act_window" id="action_report_auction_estimation_adj_category_member_tree">
- <field name="name">Min est/Adj/Max est</field>
- <field name="res_model">report.auction.estimation.adj.category</field>
- <field name="view_type">form</field>
- <field name="view_mode">graph,tree</field>
- <field name="domain">[('date','like',time.strftime('%Y-%m')),('user_id','=',uid)]</field>
- </record>
-
-<menuitem name="Employees" id="auction_report_employees_menu" parent="auction_report_menu"/>
-<menuitem name="Comparison of estimations" action="action_report_auction_estimation_adj_category_member_tree" id="menu_report_auction_estimation_adj_category_member" parent="auction_report_employees_menu"/>
-<menuitem name="Manager" id="auction_report_manager_menu" parent="auction_report_menu"/>
-<menuitem name="Comparison of estimations" action="action_report_auction_estimation_adj_category_manager_tree" id="menu_report_auction_estimation_adj_category_manager" parent="auction_report_manager_menu"/>
-
+<!--==============================-->
+<!--My Latest Objects-->
+<!--==============================-->
+<!-- <record model="ir.actions.act_window" id="action_report_latest_objects_tree">-->
+<!-- <field name="res_model">auction.lots</field>-->
+<!-- <field name="view_type">form</field>-->
+<!-- <field name="view_mode">tree,form</field>-->
+<!-- <field name="domain">[('create_uid','=',uid)]</field>-->
+<!-- </record>-->
+<!---->
+<!-- <record model="ir.actions.act_window" id="action_report_latest_objects_manager_tree">-->
+<!-- <field name="res_model">auction.lots</field>-->
+<!-- <field name="view_type">form</field>-->
+<!-- <field name="view_mode">tree,form</field>-->
+<!-- <field name="limit" eval="80"/>-->
+<!-- </record>-->
+<!---->
+<!--=============================-->
+<!--My Latest Deposit-->
+<!--==============================-->
+<!---->
+<!-- <record model="ir.actions.act_window" id="action_report_latest_doposit_manager_tree">-->
+<!-- <field name="res_model">auction.deposit</field>-->
+<!-- <field name="view_type">form</field>-->
+<!-- <field name="view_mode">tree,form</field>-->
+<!-- </record>-->
+<!---->
+<!-- <menuitem name="Latest Deposits" action="action_report_latest_doposit_manager_tree" id="menu_report_latest_doposit_tree_manager" parent="auction_report_manager_menu"/>-->
<!--=============================
sign in sign out report by user
@@ -1299,400 +885,6 @@ sign in sign out report by user
<menuitem name="Summury of Sign_in Sign_out" action="action_report_auction_sign_in_out_manager_tree" id="menu_report_auction_sign_in_out_manager_tree" parent="auction_report_manager_menu"/>
-->
- <record model="ir.ui.view" id="view_report_auction_sign_in_out_tree1">
- <field name="name">report attendance</field>
- <field name="model">report.attendance</field>
- <field name="type">tree</field>
- <field name="arch" type="xml">
- <tree string="User's pointing">
- <field name="employee_id" select="1"/>
- <field name="name" select="1"/>
- <field name="total_attendance" select="1"/>
- </tree>
- </field>
- </record>
-
- <record model="ir.ui.view" id="view_report_auction_sign_in_out_graph1">
- <field name="name">Graph attendance</field>
- <field name="model">report.attendance</field>
- <field name="type">graph</field>
- <field name="arch" type="xml">
- <graph string="User's pointing" orientation="vertical" type="bar">
- <field name="employee_id" select="1"/>
- <field name="total_attendance" operator="+"/>
- <field name="name" select="1"/>
- </graph>
-
- </field>
- </record>
-
- <record model="ir.actions.act_window" id="action_report_auction_sign_in_out_member_tree1">
- <field name="res_model">report.attendance</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree,graph</field>
- <field name="domain"> [('name','=',time.strftime('%Y-%m-%d')),('employee_id','=',uid)]</field>
- <!--<field name="domain"> [('name','ilike',time.strftime('%Y-%m'))]</field>-->
- </record>
- <menuitem name="Attendance" action="action_report_auction_sign_in_out_member_tree1" id="menu_report_auction_sign_in_out_member_tree1" parent="auction_report_employees_menu"/>
-
-
- <record model="ir.actions.act_window" id="action_report_auction_sign_in_out_manager_tree1">
- <field name="res_model">report.attendance</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree,graph</field>
- <field name="domain"> [('name','=',time.strftime('%Y-%m-%d'))]</field>
- </record>
-
- <menuitem name="Attendance" action="action_report_auction_sign_in_out_manager_tree1" id="menu_report_auction_sign_in_out_manager_tree1" parent="auction_report_manager_menu"/>
-
-==============================
-My Latest Objects
-==============================
- <record model="ir.actions.act_window" id="action_report_latest_objects_tree">
- <field name="res_model">auction.lots</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree,form</field>
- <field name="domain">[('create_uid','=',uid)]</field>
- </record>
-
- <record model="ir.actions.act_window" id="action_report_latest_objects_manager_tree">
- <field name="res_model">auction.lots</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree,form</field>
- <field name="limit" eval="80"/>
- </record>
-
-=============================
-My Latest Deposit
-==============================
-
- <record model="ir.actions.act_window" id="action_report_latest_doposit_manager_tree">
- <field name="res_model">auction.deposit</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree,form</field>
- </record>
-
- <menuitem name="Latest Deposits" action="action_report_latest_doposit_manager_tree" id="menu_report_latest_doposit_tree_manager" parent="auction_report_manager_menu"/>
-=============================
-Objects per Day
-==============================
- <record model="ir.ui.view" id="view_report_auction_object_date_tree">
- <field name="name">Objects by date</field>
- <field name="model">report.auction.object.date</field>
- <field name="type">tree</field>
- <field name="arch" type="xml">
- <tree string="Objects per Day">
- <field name="month" select="1" />
- <field name="user_id" select="1"/>
- <field name="obj_num"/>
- <field name="name" />
- </tree>
- </field>
- </record>
-
- <record model="ir.ui.view" id="view_report_auction_object_date_form">
- <field name="name">Object date</field>
- <field name="model">report.auction.object.date</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Objects per Day">
- <field name="user_id" />
- <field name="name" select="1"/>
- <field name="obj_num" />
- <field name="month" select="1"/>
- </form>
- </field>
- </record>
-
- <record model="ir.ui.view" id="view_report_auction_object_date_graph">
- <field name="name">report.auction.object.date.graph</field>
- <field name="model">report.auction.object.date</field>
- <field name="type">graph</field>
- <field name="arch" type="xml">
- <graph string="Objects per day" type="bar">
- <field name="name" select="1"/>
- <field name="obj_num" operator="+"/>
- <field name="user_id" group="True"/>
- </graph>
- </field>
- </record>
-
- <record model="ir.actions.act_window" id="action_report_auction_object_date_tree">
- <field name="res_model">report.auction.object.date</field>
- <field name="view_type">form</field>
- <field name="view_mode">graph,tree</field>
- <field name="domain">[('month','=',time.strftime('%Y-%m-01'))]</field>
- </record>
- <menuitem
- name="Encoded Objects Per Day"
- action="action_report_auction_object_date_tree"
- id="menu_report_auction_object_date_tree"
- parent="auction_report_manager_menu"/>
-
- <record model="ir.actions.act_window" id="view_report_object_by_auction">
- <field name="name">Detailed lots</field>
- <field name="res_model">auction.lots</field>
- <field name="view_type">form</field>
- <field name="domain">[('auction_id','=', active_id)]</field>
- <field name="limit" eval="2000"/>
- </record>
- <record model="ir.values" id="ir_open_auction_lots">
- <field name="key2">tree_but_open</field>
- <field name="model">auction.dates</field>
- <field name="name">Open auction</field>
- <field name="value" eval="'ir.actions.act_window,%d'%view_report_object_by_auction"/>
- <field name="object" eval="True"/>
- </record>
-
- <record model="ir.actions.act_window" id="auction_lots_open">
- <field name="name">Simplified lots for adjudication</field>
- <field name="res_model">auction.lots</field>
- <field name="view_type">form</field>
- <field name="domain">[('auction_id','=',active_id)]</field>
- <field name="limit" eval="2000"/>
- </record>
- <record model="ir.actions.act_window.view" id="action_auction_lots_open_view1">
- <field name="sequence" eval="1"/>
- <field name="view_mode">tree</field>
- <field name="act_window_id" ref="auction_lots_open"/>
- </record>
- <record model="ir.actions.act_window.view" id="action_auction_lots_open_view2">
- <field name="sequence" eval="2"/>
- <field name="view_mode">form</field>
- <field name="act_window_id" ref="auction_lots_open"/>
- <field name="view_id" ref="auction_lots_sell_form"/>
- </record>
-
- <record model="ir.values" id="ir_open_auction_lots_adj">
- <field name="key2">tree_but_action</field>
- <field name="model">auction.dates</field>
- <field name="name">Open lots for adjudication</field>
- <field name="value" eval="'ir.actions.act_window,%d'%auction_lots_open"/>
- <field name="object" eval="True"/>
- </record>
-
- <record model="ir.actions.act_window" id="action_report_object_by_auction">
- <field name="name">Auction dates</field>
- <field name="res_model">auction.dates</field>
- <field name="view_type">tree</field>
- <field name="domain">[('state','=', 'draft')]</field>
- </record>
- <menuitem name="Objects by Auction"
- parent="auction_objects_menu"
- id="menu_auction_dates_next_by_auction"
- action="action_report_object_by_auction" sequence="11"/>
-
- <act_window name="Open lots"
- domain="[('auction_id', '=', active_id)]"
- res_model="auction.lots"
- src_model="auction.dates"
- id="act_auction_lot_line_open"/>
-
-=============================
-Auction adjudication
-==============================
-
- <record model="ir.ui.view" id="view_report_auction_adjudication_tree">
- <field name="name">report.auction.adjudication.tree</field>
- <field name="model">report.auction.adjudication</field>
- <field name="type">tree</field>
- <field name="arch" type="xml">
- <tree colors="blue:state in ('draft');black:state in ('close')" string="Total adjudication">
- <field name="name" select="1"/>
- <field name="adj_total" select="1"/>
- <field name="state" select="1"/>
- </tree>
- </field>
- </record>
-
- <record model="ir.ui.view" id="view_report_auction_adjudication_graph">
- <field name="name">report.auction.adjudication.graph</field>
- <field name="model">report.auction.adjudication</field>
- <field name="type">graph</field>
- <field name="arch" type="xml">
- <graph string="Total adjudication" type="bar">
- <field name="name" select="1"/>
- <field name="adj_total" select="1" />
- <field name="user_id" group="True"/>
-
- </graph>
- </field>
-
- </record>
-
- <record model="ir.actions.act_window" id="action_report_auction_adjudication_tree">
- <field name="res_model">report.auction.adjudication</field>
- <field name="view_type">form</field>
- <field name="view_mode">graph,tree</field>
- </record>
- <menuitem name="Adjudication by Auction" action="action_report_auction_adjudication_tree" id="menu_report_auction_adjudication_tree" parent="auction_report_manager_menu"/>
-
-
- <record model="ir.ui.view" id="view_auction_deposit_tree">
- <field name="name">Depositer's statistics</field>
- <field name="model">report.deposit.border</field>
- <field name="type">tree</field>
- <field name="arch" type="xml">
- <tree string="Depositer's statistics">
- <field name="bord" select="1"/>
- <field name="seller" select="1"/>
- <field name="moy_est" select="1"/>
- <field name="total_marge" select="1"/>
- <field name="nb_obj" select="1"/>
- </tree>
- </field>
- </record>
- <record model="ir.actions.act_window" id="menu_view_auction_deposit_tree">
- <field name="res_model">report.deposit.border</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree</field>
- </record>
- <menuitem name="Depositer's Statistics" action="menu_view_auction_deposit_tree" id="menu_report_deposit_tree_m" parent="auction_report_manager_menu"/>
- <menuitem name="Depositer's Statistics" action="menu_view_auction_deposit_tree" id="menu_report_deposit_tree_member" parent="auction_report_employees_menu"/>
-=============================
-Object encoded
-==============================
- <record model="ir.ui.view" id="view_report_object_encoded_form">
- <field name="name">report.object.encoded.form</field>
- <field name="model">report.object.encoded</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Objects statistics">
- <field name="date" select="1"/>
- <field name="state" select="1"/>
- <field name="user_id" select="1"/>
- <field name="estimation"/>
- <field name="obj_ret"/>
- <field name="obj_num" sum="# objects"/>
- </form>
- </field>
- </record>
-
-<record model="ir.ui.view" id="view_report_object_encoded_tree">
-<field name="name">report.object.encoded.tree</field>
-<field name="model">report.object.encoded</field>
-<field name="type">tree</field>
-
- <field name="arch" type="xml">
-
- <tree string="Objects statistics">
-<field name="date" select="1"/>
-<field name="state" select="1"/>
-<field name="user_id" select="1"/>
-<field name="estimation"/>
-<field name="obj_ret"/>
-<field name="obj_num"/>
-</tree>
-</field>
-</record>
-<!-- <record model="ir.ui.view" id="view_report_object_encoded_tree">
- <field name="name">report.object.encoded.tree</field>
- <field name="model">report.object.encoded</field>
- <field name="type">tree</field>
- <field name="arch" type="xml">
- <tree string="Objects statistics" >
- <field name="date" select="1"/>
- <field name="state" select="1"/>
- <field name="user_id" select="1"/>
- <field name="estimation" />
- <field name="obj_ret" />
- <field name="obj_num" />
- </tree>
- </field>
- </record>
--->
- <record model="ir.ui.view" id="view_report_object_encoded_graph">
- <field name="name">report.object.encoded.graph</field>
- <field name="model">report.object.encoded</field>
- <field name="type">graph</field>
- <field name="arch" type="xml">
- <graph string="Objects statistics" type="bar">
- <field name="user_id" select="1"/>
- <field name="estimation" operator="+" />
- <field name="obj_ret" operator="+" />
- <field name="obj_num" operator="+" />
- </graph>
- </field>
- </record>
-
- <record model="ir.actions.act_window" id="action_report_object_encoded_member_tree">
- <field name="res_model">report.object.encoded</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree</field>
- <field name="domain"> [('user_id','=',uid),('date','ilike',time.strftime('%Y-%m'))]</field>
- </record>
-
-
- <record model="ir.ui.view" id="view_report_object_encoded_manager_tree">
- <field name="name">report.object.encoded.tree</field>
- <field name="model">report.object.encoded.manager</field>
- <field name="type">tree</field>
- <field name="arch" type="xml">
- <tree string="Objects statistics">
- <field name="user_id" select="1"/>
- <field name="estimation" />
- <field name="obj_ret" />
- <field name="obj_num" sum="# objects" select="1"/>
- <field name="adj" sum="Total adj."/>
- <field name="obj_margin" />
- <field name="net_revenue" sum="Total net rev."/>
- <field name="gross_revenue" sum="Total gross rev."/>
- <field name="date" select="1"/>
-
- </tree>
- </field>
- </record>
-
- <record model="ir.ui.view" id="view_report_object_encoded_manager_graph">
- <field name="name">report.object.encoded.graph</field>
- <field name="model">report.object.encoded.manager</field>
- <field name="type">graph</field>
- <field name="arch" type="xml">
- <graph string="Object statistic" type="bar">
- <field name="user_id" select="1"/>
- <field name="obj_ret" operator="+" />
- <field name="obj_num" operator="+" />
- <field name="obj_margin" operator="+" />
- <field name="net_revenue" operator="+" />
- <field name="gross_revenue" operator="+" />
- </graph>
- </field>
- </record>
-
- <record model="ir.actions.act_window" id="action_report_object_encoded_manager_tree">
- <field name="res_model">report.object.encoded.manager</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree</field>
- <field name="domain">[('date','ilike',time.strftime('%Y-%m'))]</field>
- </record>
-
- <record model="ir.ui.view" id="view_report_unclassified_objects">
- <field name="name">report.unclassified.objects</field>
- <field name="model">report.unclassified.objects</field>
- <field name="type">tree</field>
- <field name="arch" type="xml">
- <tree colors="blue:state in ('draft','unsold');black:state in ('sold');gray:state in ('paid')" string="Unclassified objects">
- <field name="obj_num" string="Ref" select="1"/>
- <field name="name" select="1"/>
- <field name="ach_login"/>
- <field name="obj_price"/>
- <field name="state" select="1"/>
- <field name="obj_comm"/>
- <field name="bord_vnd_id"/>
- <field name="lot_num"/>
- <field name="lot_est1"/>
- <field name="lot_est2"/>
- <field name="lot_type" select="1"/>
- <field name="auction"/>
- </tree>
- </field>
- </record>
-
- <act_window name="Bordereau de dépôt"
- domain="[('partner_id', '=', active_id)]"
- res_model="auction.deposit"
- src_model="res.partner"
- id="act_auction_lot_open_deposit"/>
-
</data>
-</openerp>
+</openerp>
+ \ No newline at end of file
diff --git a/addons/auction/board_auction_view.xml b/addons/auction/board_auction_view.xml
index 6693622d55c..6d491fa663b 100644
--- a/addons/auction/board_auction_view.xml
+++ b/addons/auction/board_auction_view.xml
@@ -5,6 +5,13 @@
<field name="name">Auction</field>
</record>
+ <record model="ir.actions.act_window" id="action_report_latest_objects_tree">
+ <field name="res_model">auction.lots</field>
+ <field name="view_type">form</field>
+ <field name="view_mode">tree,form</field>
+ <field name="domain">[('create_uid','=',uid)]</field>
+ </record>
+
<record model="ir.ui.view" id="board_auction_manager_form">
<field name="name">board.auction.manager.form</field>
<field name="model">board.board</field>
@@ -58,7 +65,7 @@
<field name="usage">menu</field>
<field name="view_id" ref="board_auction_manager_form"/>
</record>
- <menuitem name="Dashboard" id="menu_board_auction" parent="auction_report_menu" sequence="0"/>
+ <menuitem name="Dashboard" id="menu_board_auction" parent="auction.auction_report_menu" sequence="0"/>
<menuitem
name="Auction Member"
action="open_board_auction"
diff --git a/addons/auction/report/__init__.py b/addons/auction/report/__init__.py
index 2b7907ee6a2..38617f0a84f 100644
--- a/addons/auction/report/__init__.py
+++ b/addons/auction/report/__init__.py
@@ -32,7 +32,8 @@ import auction_objects
import buyer_form_report
import seller_form_report
-
+import report_auction
+import report_attendance
import buyer_list
diff --git a/addons/auction/report/report_attendance.py b/addons/auction/report/report_attendance.py
new file mode 100644
index 00000000000..22da81785d5
--- /dev/null
+++ b/addons/auction/report/report_attendance.py
@@ -0,0 +1,315 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+from mx import DateTime
+from osv import fields, osv, orm
+from tools import config
+from tools.translate import _
+import ir
+import netsvc
+import os
+import time
+import tools
+
+
+def _type_get(self, cr, uid, context=None):
+ if not context:
+ context = {}
+ cr.execute('select name, name from auction_lot_category order by name')
+ return cr.fetchall()
+
+class report_attendance(osv.osv):
+ _name="report.attendance"
+ _description = "Report Sign In/Out"
+ _auto = False
+ #_rec_name='date'
+ _columns = {
+ 'name': fields.date('Date', readonly=True, select=1),
+ 'employee_id' : fields.many2one('hr.employee', "Employee's Name", select=1, readonly=True),
+ 'total_attendance': fields.float('Total', readonly=True),
+}
+ def init(self, cr):
+ cr.execute("""CREATE OR REPLACE VIEW report_attendance AS
+ SELECT
+ id,
+ name,
+ employee_id,
+ CASE WHEN SUM(total_attendance) < 0
+ THEN (SUM(total_attendance) +
+ CASE WHEN current_date <> name
+ THEN 1440
+ ELSE (EXTRACT(hour FROM current_time) * 60) + EXTRACT(minute FROM current_time)
+ END
+ )
+ ELSE SUM(total_attendance)
+ END /60 as total_attendance
+ FROM (
+ SELECT
+ max(a.id) as id,
+ a.name::date as name,
+ a.employee_id,
+ SUM(((EXTRACT(hour FROM a.name) * 60) + EXTRACT(minute FROM a.name)) * (CASE WHEN a.action = 'sign_in' THEN -1 ELSE 1 END)) as total_attendance
+ FROM hr_attendance a
+ where name > current_date + interval '-1 day'
+ GROUP BY a.name::date, a.employee_id
+ ) AS fs
+ GROUP BY name,fs.id,employee_id
+ """)
+
+report_attendance()
+
+class report_auction_object_date(osv.osv):
+ _name = "report.auction.object.date"
+ _description = "Objects per day"
+ _auto = False
+ _columns = {
+ 'obj_num': fields.integer('# of Objects'),
+ 'name': fields.date('Created date', select=2),
+ 'month': fields.date('Month', select=1),
+ 'user_id':fields.many2one('res.users', 'User', select=1),
+ }
+ #l.create_uid as user,
+
+ def init(self, cr):
+ cr.execute("""create or replace view report_auction_object_date as
+ (select
+ min(l.id) as id,
+ to_char(l.create_date, 'YYYY-MM-DD') as name,
+ to_char(l.create_date, 'YYYY-MM-01') as month,
+ count(l.obj_num) as obj_num,
+ l.create_uid as user_id
+ from
+ auction_lots l
+ group by
+ to_char(l.create_date, 'YYYY-MM-DD'),
+ to_char(l.create_date, 'YYYY-MM-01'),
+ l.create_uid
+ )
+ """)
+report_auction_object_date()
+
+class report_auction_estimation_adj_category(osv.osv):
+ _name = "report.auction.estimation.adj.category"
+ _description = "comparaison estimate/adjudication "
+ _auto = False
+ _rec_name='date'
+ _columns = {
+ 'lot_est1': fields.float('Minimum Estimation', select=2),
+ 'lot_est2': fields.float('Maximum Estimation', select=2),
+# 'obj_price': fields.float('Adjudication price'),
+ 'date': fields.date('Date', readonly=True, select=1),
+ 'lot_type': fields.selection(_type_get, 'Object Type', size=64),
+ 'adj_total': fields.float('Total Adjudication', select=2),
+ 'user_id':fields.many2one('res.users', 'User', select=1)
+ }
+
+ def init(self, cr):
+ cr.execute("""
+ create or replace view report_auction_estimation_adj_category as (
+ select
+ min(l.id) as id,
+ to_char(l.create_date, 'YYYY-MM-01') as date,
+ l.lot_type as lot_type,
+ sum(l.lot_est1) as lot_est1,
+ sum(l.lot_est2) as lot_est2,
+ sum(l.obj_price) as adj_total,
+ l.create_uid as user_id
+ from
+ auction_lots l,auction_dates m
+ where
+ l.auction_id=m.id and l.obj_price >0
+ group by
+ to_char(l.create_date, 'YYYY-MM-01'),lot_type,l.create_uid
+ )
+ """)
+report_auction_estimation_adj_category()
+
+class report_auction_adjudication(osv.osv):
+ _name = "report.auction.adjudication"
+ _description = "report_auction_adjudication"
+ _auto = False
+ _columns = {
+ 'name': fields.many2one('auction.dates', 'Auction date', readonly=True, select=1),
+ 'state': fields.selection((('draft', 'Draft'), ('close', 'Closed')), 'State', select=1),
+ 'adj_total': fields.float('Total Adjudication'),
+ 'date': fields.date('Date', readonly=True, select=1),
+ 'user_id':fields.many2one('res.users', 'User', select=1)
+
+ }
+
+
+ def init(self, cr):
+ cr.execute("""
+ create or replace view report_auction_adjudication as (
+ select
+ l.id as id,
+ l.id as name,
+ sum(m.obj_price) as adj_total,
+ to_char(l.create_date, 'YYYY-MM-01') as date,
+ l.create_uid as user_id,
+ l.state
+ from
+ auction_dates l ,auction_lots m
+ where
+ m.auction_id=l.id
+ group by
+ l.id,l.state,l.name,l.create_uid,to_char(l.create_date, 'YYYY-MM-01')
+
+ )
+ """)
+report_auction_adjudication()
+
+class report_deposit_border(osv.osv):
+ _name="report.deposit.border"
+ _description = "Report deposit border"
+ _auto = False
+ _rec_name='bord'
+ _columns = {
+ 'bord': fields.char('Depositer Inventory', size=64, required=True),
+ 'seller': fields.many2one('res.partner', 'Seller', select=1),
+ 'moy_est' : fields.float('Avg. Est', select=1, readonly=True),
+ 'total_marge': fields.float('Total margin', readonly=True),
+ 'nb_obj':fields.float('# of objects', readonly=True),
+}
+ def init(self, cr):
+ cr.execute("""CREATE OR REPLACE VIEW report_deposit_border AS
+ SELECT
+ min(al.id) as id,
+ ab.partner_id as seller,
+ ab.name as bord,
+ COUNT(al.id) as nb_obj,
+ SUM((al.lot_est1 + al.lot_est2)/2) as moy_est,
+ SUM(al.net_revenue)/(count(ad.id)) as total_marge
+
+ FROM
+ auction_lots al,auction_deposit ab,auction_dates ad
+ WHERE
+ ad.id=al.auction_id
+ and al.bord_vnd_id=ab.id
+ GROUP BY
+ ab.name,ab.partner_id""")
+report_deposit_border()
+
+class report_object_encoded(osv.osv):
+ _name = "report.object.encoded"
+ _description = "Object encoded"
+ _auto = False
+ _columns = {
+ 'state': fields.selection((('draft', 'Draft'), ('unsold', 'Unsold'), ('paid', 'Paid'), ('invoiced', 'Invoiced')), 'State', required=True, select=1),
+ 'user_id':fields.many2one('res.users', 'User', select=1),
+ 'estimation': fields.float('Estimation', select=2),
+ 'date': fields.date('Create Date', required=True),
+# 'gross_revenue':fields.float('Gross revenue',readonly=True, select=2),
+# 'net_revenue':fields.float('Net revenue',readonly=True, select=2),
+# 'obj_margin':fields.float('Net margin', readonly=True, select=2),
+ 'obj_ret':fields.integer('# obj ret', readonly=True, select=2),
+# 'adj':fields.integer('Adj.', readonly=True, select=2),
+ 'obj_num':fields.integer('# of Encoded obj.', readonly=True, select=2),
+ }
+ def init(self, cr):
+ cr.execute('''create or replace view report_object_encoded as
+ (select min(al.id) as id,
+ to_char(al.create_date, 'YYYY-MM-DD') as date,
+ al.state as state,
+ al.create_uid as user_id,
+ (SELECT count(1) FROM auction_lots WHERE obj_ret>0) as obj_ret,
+ sum((100* al.lot_est1)/al.obj_price) as estimation,
+ COUNT(al.product_id) as obj_num
+ from auction_lots al
+ where al.obj_price>0 and state='draft'
+ group by to_char(al.create_date, 'YYYY-MM-DD'), al.state, al.create_uid)
+ ''')
+report_object_encoded()
+
+
+class report_object_encoded_manager(osv.osv):
+ _name = "report.object.encoded.manager"
+ _description = "Object encoded"
+ _auto = False
+ _columns = {
+ 'user_id':fields.many2one('res.users', 'User', select=True),
+ 'estimation': fields.float('Estimation', select=True),
+ 'date': fields.date('Create Date', required=True),
+ 'gross_revenue':fields.float('Gross revenue', readonly=True, select=True),
+ 'net_revenue':fields.float('Net revenue', readonly=True, select=True),
+ 'obj_margin':fields.float('Net margin', readonly=True, select=True),
+ 'obj_ret':fields.integer('# obj ret', readonly=True, select=True),
+ 'adj':fields.integer('Adj.', readonly=True, select=True),
+ 'obj_num':fields.integer('# of Encoded obj.', readonly=True, select=True),
+ }
+ def init(self, cr):
+ cr.execute('''create or replace view report_object_encoded_manager as
+ (select
+ min(al.id) as id,
+ to_char(al.create_date, 'YYYY-MM-DD') as date,
+ al.create_uid as user_id,
+ sum((100*lot_est1)/obj_price) as estimation,
+ (SELECT count(1) FROM auction_lots WHERE obj_ret>0) as obj_ret,
+ SUM(al.gross_revenue) as "gross_revenue",
+ SUM(al.net_revenue) as "net_revenue",
+ SUM(al.net_revenue)/count(al.id) as "obj_margin",
+ COUNT(al.product_id) as obj_num,
+ SUM(al.obj_price) as "adj"
+ from auction_lots al
+ where al.obj_price>0
+ group by to_char(al.create_date, 'YYYY-MM-DD'), al.create_uid)
+ ''')
+report_object_encoded_manager()
+
+class report_unclassified_objects(osv.osv):
+ _name = "report.unclassified.objects"
+ _description = "Unclassified objects "
+ _auto = False
+ _columns = {
+ 'name': fields.char('Short Description', size=64, required=True),
+ 'obj_num': fields.integer('Catalog Number'),
+ 'obj_price': fields.float('Adjudication price'),
+ 'lot_num': fields.integer('List Number', required=True, select=1),
+ 'state': fields.selection((('draft', 'Draft'), ('unsold', 'Unsold'), ('paid', 'Paid'), ('sold', 'Sold')), 'State', required=True, readonly=True),
+ 'obj_comm': fields.boolean('Commission'),
+ 'bord_vnd_id': fields.many2one('auction.deposit', 'Depositer Inventory', required=True),
+ 'ach_login': fields.char('Buyer Username', size=64),
+ 'lot_est1': fields.float('Minimum Estimation'),
+ 'lot_est2': fields.float('Maximum Estimation'),
+ 'lot_type': fields.selection(_type_get, 'Object category', size=64),
+ 'auction': fields.many2one('auction.dates', 'Auction date', readonly=True, select=1),
+ }
+ def init(self, cr):
+ cr.execute("""create or replace view report_unclassified_objects as
+ (select
+ min(al.id) as id,
+ al.name as name,
+ al.obj_price as obj_price,
+ al.obj_num as obj_num,
+ al.lot_num as lot_num,
+ al.state as state,
+ al.obj_comm as obj_comm,
+ al.bord_vnd_id as bord_vnd_id,
+ al.ach_login as ach_login,
+ al.lot_est1 as lot_est1,
+ al.lot_est2 as lot_est2,
+ al.lot_type as lot_type,
+ al.auction_id as auction
+ from auction_lots al,auction_lot_category ac
+ where (al.lot_type=ac.name) AND (ac.aie_categ='41') AND (al.auction_id is null)
+group by al.obj_price,al.obj_num, al.lot_num, al.state, al.obj_comm,al.bord_vnd_id,al.ach_login,al.lot_est1,al.lot_est2,al.lot_type,al.auction_id,al.name)
+ """)
+report_unclassified_objects()
+
diff --git a/addons/auction/report/report_attendance_view.xml b/addons/auction/report/report_attendance_view.xml
new file mode 100644
index 00000000000..ec22643820a
--- /dev/null
+++ b/addons/auction/report/report_attendance_view.xml
@@ -0,0 +1,414 @@
+<?xml version="1.0"?>
+<openerp>
+<data>
+
+ <record model="ir.ui.view" id="view_report_auction_sign_in_out_tree1">
+ <field name="name">report attendance</field>
+ <field name="model">report.attendance</field>
+ <field name="type">tree</field>
+ <field name="arch" type="xml">
+ <tree string="User's pointing">
+ <field name="employee_id" select="1"/>
+ <field name="name" select="1"/>
+ <field name="total_attendance" select="1"/>
+ </tree>
+ </field>
+ </record>
+
+ <record model="ir.ui.view" id="view_report_auction_sign_in_out_graph1">
+ <field name="name">Graph attendance</field>
+ <field name="model">report.attendance</field>
+ <field name="type">graph</field>
+ <field name="arch" type="xml">
+ <graph string="User's pointing" orientation="vertical" type="bar">
+ <field name="employee_id" select="1"/>
+ <field name="total_attendance" operator="+"/>
+ <field name="name" select="1"/>
+ </graph>
+
+ </field>
+ </record>
+
+ <record model="ir.actions.act_window" id="action_report_auction_sign_in_out_member_tree1">
+ <field name="res_model">report.attendance</field>
+ <field name="view_type">form</field>
+ <field name="view_mode">tree,graph</field>
+ <field name="domain"> [('name','=',time.strftime('%Y-%m-%d')),('employee_id','=',uid)]</field>
+ <!--<field name="domain"> [('name','ilike',time.strftime('%Y-%m'))]</field>-->
+ </record>
+ <menuitem name="Employees" id="auction_report_employees_menu" parent="auction_report_menu"/>
+ <menuitem name="Manager" id="auction_report_manager_menu" parent="auction_report_menu"/>
+ <menuitem name="Attendance" action="action_report_auction_sign_in_out_member_tree1" id="menu_report_auction_sign_in_out_member_tree1" parent="auction_report_employees_menu"/>
+
+ <record model="ir.actions.act_window" id="action_report_auction_sign_in_out_manager_tree1">
+ <field name="res_model">report.attendance</field>
+ <field name="view_type">form</field>
+ <field name="view_mode">tree,graph</field>
+ <field name="domain"> [('name','=',time.strftime('%Y-%m-%d'))]</field>
+ </record>
+
+==============================
+My Latest Objects
+==============================
+ <record model="ir.actions.act_window" id="action_report_latest_objects_tree">
+ <field name="res_model">auction.lots</field>
+ <field name="view_type">form</field>
+ <field name="view_mode">tree,form</field>
+ <field name="domain">[('create_uid','=',uid)]</field>
+ </record>
+
+ <record model="ir.actions.act_window" id="action_report_latest_objects_manager_tree">
+ <field name="res_model">auction.lots</field>
+ <field name="view_type">form</field>
+ <field name="view_mode">tree,form</field>
+ <field name="limit" eval="80"/>
+ </record>
+
+=============================
+My Latest Deposit
+==============================
+
+ <record model="ir.actions.act_window" id="action_report_latest_doposit_manager_tree">
+ <field name="res_model">auction.deposit</field>
+ <field name="view_type">form</field>
+ <field name="view_mode">tree,form</field>
+ </record>
+
+ <menuitem name="Latest Deposits" action="action_report_latest_doposit_manager_tree" id="menu_report_latest_doposit_tree_manager" parent="auction_report_manager_menu"/>
+
+ <menuitem name="Attendance" action="action_report_auction_sign_in_out_manager_tree1" id="menu_report_auction_sign_in_out_manager_tree1" parent="auction_report_manager_menu"/>
+
+ <record model="ir.ui.view" id="view_report_object_encoded_graph">
+ <field name="name">report.object.encoded.graph</field>
+ <field name="model">report.object.encoded</field>
+ <field name="type">graph</field>
+ <field name="arch" type="xml">
+ <graph string="Objects statistics" type="bar">
+ <field name="user_id" select="1"/>
+ <field name="estimation" operator="+" />
+ <field name="obj_ret" operator="+" />
+ <field name="obj_num" operator="+" />
+ </graph>
+ </field>
+ </record>
+
+ <record model="ir.actions.act_window" id="action_report_object_encoded_member_tree">
+ <field name="res_model">report.object.encoded</field>
+ <field name="view_type">form</field>
+ <field name="view_mode">tree</field>
+ <field name="domain"> [('user_id','=',uid),('date','ilike',time.strftime('%Y-%m'))]</field>
+ </record>
+=============================
+Objects per Day
+==============================
+ <record model="ir.ui.view" id="view_report_auction_object_date_tree">
+ <field name="name">Objects by date</field>
+ <field name="model">report.auction.object.date</field>
+ <field name="type">tree</field>
+ <field name="arch" type="xml">
+ <tree string="Objects per Day">
+ <field name="month" select="1" />
+ <field name="user_id" select="1"/>
+ <field name="obj_num"/>
+ <field name="name" />
+ </tree>
+ </field>
+ </record>
+
+ <record model="ir.ui.view" id="view_report_auction_object_date_form">
+ <field name="name">Object date</field>
+ <field name="model">report.auction.object.date</field>
+ <field name="type">form</field>
+ <field name="arch" type="xml">
+ <form string="Objects per Day">
+ <field name="user_id" />
+ <field name="name" select="1"/>
+ <field name="obj_num" />
+ <field name="month" select="1"/>
+ </form>
+ </field>
+ </record>
+
+ <record model="ir.ui.view" id="view_report_auction_object_date_graph">
+ <field name="name">report.auction.object.date.graph</field>
+ <field name="model">report.auction.object.date</field>
+ <field name="type">graph</field>
+ <field name="arch" type="xml">
+ <graph string="Objects per day" type="bar">
+ <field name="name" select="1"/>
+ <field name="obj_num" operator="+"/>
+ <field name="user_id" group="True"/>
+ </graph>
+ </field>
+ </record>
+
+ <record model="ir.actions.act_window" id="action_report_auction_object_date_tree">
+ <field name="res_model">report.auction.object.date</field>
+ <field name="view_type">form</field>
+ <field name="view_mode">graph,tree</field>
+ <field name="domain">[('month','=',time.strftime('%Y-%m-01'))]</field>
+ </record>
+ <menuitem
+ name="Encoded Objects Per Day"
+ action="action_report_auction_object_date_tree"
+ id="menu_report_auction_object_date_tree"
+ parent="auction_report_manager_menu"/>
+
+=============================
+estimation.adj.category
+==============================
+ <record model="ir.ui.view" id="view_report_auction_estimation_adj_category_form">
+ <field name="name">report.auction.estimation.adj.category.form</field>
+ <field name="model">report.auction.estimation.adj.category</field>
+ <field name="type">form</field>
+ <field name="arch" type="xml">
+ <form string="Min est/Adj/Max est">
+ <!--field name="date" select="1"/-->
+ <field name="lot_type" select="1"/>
+ <field name="user_id" select="1"/>
+ <field name="lot_est1"/>
+ <field name="lot_est2"/>
+ <field name="adj_total"/>
+ <field name="date" select="1"/>
+ </form>
+ </field>
+ </record>
+ <record model="ir.ui.view" id="view_report_auction_estimation_adj_category_tree">
+ <field name="name">report.auction.estimation.adj.category.tree</field>
+ <field name="model">report.auction.estimation.adj.category</field>
+ <field name="type">tree</field>
+ <field name="arch" type="xml">
+ <tree string="Min est/Adj/Max est">
+ <!--field name="date" select="1"/-->
+ <field name="user_id" select="1"/>
+ <field name="lot_type" select="1"/>
+ <field name="lot_est1" select="1"/>
+ <field name="lot_est2" select="1"/>
+ <field name="adj_total" select="1"/>
+ <field name="date" select="1"/>
+ </tree>
+ </field>
+ </record>
+
+ <record model="ir.ui.view" id="view_report_auction_estimation_adj_category_graph">
+ <field name="name">report.auction.estimation.adj.category.graph</field>
+ <field name="model">report.auction.estimation.adj.category</field>
+ <field name="type">graph</field>
+ <field name="arch" type="xml">
+ <graph string="Min est/Adj/Max est" orientation="vertical" type="bar">
+ <!--field name="date" operator="+"/-->
+ <field name="lot_type" select="1"/>
+ <field name="lot_est1" operator="+"/>
+ <field name="adj_total" operator="+"/>
+ <field name="lot_est2" operator="+"/>
+ <field name="user_id" group="True"/>
+ </graph>
+ </field>
+ </record>
+ <record model="ir.actions.act_window" id="action_report_auction_estimation_adj_category_manager_tree">
+ <field name="name">Min est/Adj/Max est</field>
+ <field name="res_model">report.auction.estimation.adj.category</field>
+ <field name="view_type">form</field>
+ <field name="view_mode">graph,tree</field>
+ <field name="domain">[('date','like',time.strftime('%Y-%m'))]</field>
+ </record>
+
+ <record model="ir.actions.act_window" id="action_report_auction_estimation_adj_category_member_tree">
+ <field name="name">Min est/Adj/Max est</field>
+ <field name="res_model">report.auction.estimation.adj.category</field>
+ <field name="view_type">form</field>
+ <field name="view_mode">graph,tree</field>
+ <field name="domain">[('date','like',time.strftime('%Y-%m')),('user_id','=',uid)]</field>
+ </record>
+
+<menuitem name="Employees" id="auction_report_employees_menu" parent="auction_report_menu"/>
+<menuitem name="Comparison of estimations" action="action_report_auction_estimation_adj_category_member_tree" id="menu_report_auction_estimation_adj_category_member" parent="auction_report_employees_menu"/>
+<menuitem name="Manager" id="auction_report_manager_menu" parent="auction_report_menu"/>
+<menuitem name="Comparison of estimations" action="action_report_auction_estimation_adj_category_manager_tree" id="menu_report_auction_estimation_adj_category_manager" parent="auction_report_manager_menu"/>
+
+=============================
+Object encoded
+==============================
+ <record model="ir.ui.view" id="view_report_object_encoded_form">
+ <field name="name">report.object.encoded.form</field>
+ <field name="model">report.object.encoded</field>
+ <field name="type">form</field>
+ <field name="arch" type="xml">
+ <form string="Objects statistics">
+ <field name="date" select="1"/>
+ <field name="state" select="1"/>
+ <field name="user_id" select="1"/>
+ <field name="estimation"/>
+ <field name="obj_ret"/>
+ <field name="obj_num" sum="# objects"/>
+ </form>
+ </field>
+ </record>
+
+<record model="ir.ui.view" id="view_report_object_encoded_tree">
+<field name="name">report.object.encoded.tree</field>
+<field name="model">report.object.encoded</field>
+<field name="type">tree</field>
+
+ <field name="arch" type="xml">
+
+ <tree string="Objects statistics">
+<field name="date" select="1"/>
+<field name="state" select="1"/>
+<field name="user_id" select="1"/>
+<field name="estimation"/>
+<field name="obj_ret"/>
+<field name="obj_num"/>
+</tree>
+</field>
+</record>
+<!-- <record model="ir.ui.view" id="view_report_object_encoded_tree">
+ <field name="name">report.object.encoded.tree</field>
+ <field name="model">report.object.encoded</field>
+ <field name="type">tree</field>
+ <field name="arch" type="xml">
+ <tree string="Objects statistics" >
+ <field name="date" select="1"/>
+ <field name="state" select="1"/>
+ <field name="user_id" select="1"/>
+ <field name="estimation" />
+ <field name="obj_ret" />
+ <field name="obj_num" />
+ </tree>
+ </field>
+ </record>
+-->
+ <record model="ir.ui.view" id="view_report_object_encoded_graph">
+ <field name="name">report.object.encoded.graph</field>
+ <field name="model">report.object.encoded</field>
+ <field name="type">graph</field>
+ <field name="arch" type="xml">
+ <graph string="Objects statistics" type="bar">
+ <field name="user_id" select="1"/>
+ <field name="estimation" operator="+" />
+ <field name="obj_ret" operator="+" />
+ <field name="obj_num" operator="+" />
+ </graph>
+ </field>
+ </record>
+
+ <record model="ir.actions.act_window" id="action_report_object_encoded_member_tree">
+ <field name="res_model">report.object.encoded</field>
+ <field name="view_type">form</field>
+ <field name="view_mode">tree</field>
+ <field name="domain"> [('user_id','=',uid),('date','ilike',time.strftime('%Y-%m'))]</field>
+ </record>
+
+
+ <record model="ir.ui.view" id="view_report_object_encoded_manager_tree">
+ <field name="name">report.object.encoded.tree</field>
+ <field name="model">report.object.encoded.manager</field>
+ <field name="type">tree</field>
+ <field name="arch" type="xml">
+ <tree string="Objects statistics">
+ <field name="user_id" select="1"/>
+ <field name="estimation" />
+ <field name="obj_ret" />
+ <field name="obj_num" sum="# objects" select="1"/>
+ <field name="adj" sum="Total adj."/>
+ <field name="obj_margin" />
+ <field name="net_revenue" sum="Total net rev."/>
+ <field name="gross_revenue" sum="Total gross rev."/>
+ <field name="date" select="1"/>
+
+ </tree>
+ </field>
+ </record>
+
+ <record model="ir.ui.view" id="view_report_object_encoded_manager_graph">
+ <field name="name">report.object.encoded.graph</field>
+ <field name="model">report.object.encoded.manager</field>
+ <field name="type">graph</field>
+ <field name="arch" type="xml">
+ <graph string="Object statistic" type="bar">
+ <field name="user_id" select="1"/>
+ <field name="obj_ret" operator="+" />
+ <field name="obj_num" operator="+" />
+ <field name="obj_margin" operator="+" />
+ <field name="net_revenue" operator="+" />
+ <field name="gross_revenue" operator="+" />
+ </graph>
+ </field>
+ </record>
+
+ <record model="ir.actions.act_window" id="action_report_object_encoded_manager_tree">
+ <field name="res_model">report.object.encoded.manager</field>
+ <field name="view_type">form</field>
+ <field name="view_mode">tree</field>
+ <field name="domain">[('date','ilike',time.strftime('%Y-%m'))]</field>
+ </record>
+
+ <record model="ir.ui.view" id="view_report_unclassified_objects">
+ <field name="name">report.unclassified.objects</field>
+ <field name="model">report.unclassified.objects</field>
+ <field name="type">tree</field>
+ <field name="arch" type="xml">
+ <tree colors="blue:state in ('draft','unsold');black:state in ('sold');gray:state in ('paid')" string="Unclassified objects">
+ <field name="obj_num" string="Ref" select="1"/>
+ <field name="name" select="1"/>
+ <field name="ach_login"/>
+ <field name="obj_price"/>
+ <field name="state" select="1"/>
+ <field name="obj_comm"/>
+ <field name="bord_vnd_id"/>
+ <field name="lot_num"/>
+ <field name="lot_est1"/>
+ <field name="lot_est2"/>
+ <field name="lot_type" select="1"/>
+ <field name="auction"/>
+ </tree>
+ </field>
+ </record>
+
+ <act_window name="Bordereau de dépôt"
+ domain="[('partner_id', '=', active_id)]"
+ res_model="auction.deposit"
+ src_model="res.partner"
+ id="act_auction_lot_open_deposit"/>
+=============================
+Auction adjudication
+==============================
+
+ <record model="ir.ui.view" id="view_report_auction_adjudication_tree">
+ <field name="name">report.auction.adjudication.tree</field>
+ <field name="model">report.auction.adjudication</field>
+ <field name="type">tree</field>
+ <field name="arch" type="xml">
+ <tree colors="blue:state in ('draft');black:state in ('close')" string="Total adjudication">
+ <field name="name" select="1"/>
+ <field name="adj_total" select="1"/>
+ <field name="state" select="1"/>
+ </tree>
+ </field>
+ </record>
+
+ <record model="ir.ui.view" id="view_report_auction_adjudication_graph">
+ <field name="name">report.auction.adjudication.graph</field>
+ <field name="model">report.auction.adjudication</field>
+ <field name="type">graph</field>
+ <field name="arch" type="xml">
+ <graph string="Total adjudication" type="bar">
+ <field name="name" select="1"/>
+ <field name="adj_total" select="1" />
+ <field name="user_id" group="True"/>
+
+ </graph>
+ </field>
+
+ </record>
+
+ <record model="ir.actions.act_window" id="action_report_auction_adjudication_tree">
+ <field name="res_model">report.auction.adjudication</field>
+ <field name="view_type">form</field>
+ <field name="view_mode">graph,tree</field>
+ </record>
+ <menuitem name="Adjudication by Auction" action="action_report_auction_adjudication_tree" id="menu_report_auction_adjudication_tree" parent="auction_report_manager_menu"/>
+
+
+</data>
+</openerp>
diff --git a/addons/auction/report/report_auction.py b/addons/auction/report/report_auction.py
new file mode 100644
index 00000000000..05c123c98ed
--- /dev/null
+++ b/addons/auction/report/report_auction.py
@@ -0,0 +1,107 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+from mx import DateTime
+from osv import fields, osv, orm
+from tools import config
+from tools.translate import _
+import ir
+import netsvc
+import os
+import time
+import tools
+
+class report_auction(osv.osv):
+
+ """Auction Report"""
+ _name = "report.auction"
+ _description = "Auction's Summary"
+ _auto = False
+ _columns = {
+ 'year': fields.char('Year', size=4, readonly=True),
+ 'month':fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'),
+ ('05','May'), ('06','June'), ('07','July'), ('08','August'), ('09','September'),
+ ('10','October'), ('11','November'), ('12','December')], 'Month',readonly=True),
+ 'day': fields.char('Day', size=128, readonly=True),
+ 'buyer_login': fields.char('Buyer Login', size=64, readonly=True, select=1),
+ 'buyer':fields.many2one('res.partner', 'Buyer', readonly=True, select=2),
+ 'seller': fields.many2one('res.partner', 'Seller', readonly=True, select=1),
+ 'object':fields.integer('No of objects', readonly=True, select=1),
+ 'total_price':fields.float('Total Adj.', digits=(16, 2), readonly=True, select=2),
+ 'avg_price':fields.float('Avg Adj.', digits=(16, 2), readonly=True, select=2),
+ 'date': fields.date('Create Date', select=1),
+ 'auction': fields.many2one('auction.dates', 'Auction date', readonly=True, select=1),
+ 'gross_revenue':fields.float('Gross Revenue', readonly=True),
+ 'net_revenue':fields.float('Net Revenue', readonly=True),
+ 'net_margin':fields.float('Net Margin', readonly=True),
+ 'avg_estimation':fields.float('Avg estimation', readonly=True),
+ 'user_id':fields.many2one('res.users', 'User', select=1),
+ 'nbuyer':fields.float('No of buyers', readonly=True),
+ 'nseller':fields.float('No of sellers', readonly=True),
+ 'min_est':fields.float('Minimum Estimation', readonly=True, select=2),
+ 'max_est':fields.float('Maximum Estimation', readonly=True, select=2),
+ 'state': fields.selection((('draft', 'Draft'), ('unsold', 'Unsold'), ('sold', 'Sold')), 'State', readonly=True, select=1),
+
+ }
+
+ def init(self, cr):
+ tools.drop_view_if_exists(cr, 'report_auction')
+ cr.execute('''
+ create or replace view report_auction as (
+ select
+ min(al.id) as id,
+ al.ach_login as "buyer_login",
+ ad.auction1 as date,
+ al.state,
+ al.create_uid as user_id,
+ to_char(ad.auction1, 'YYYY') as year,
+ to_char(ad.auction1, 'MM') as month,
+ to_char(ad.auction1, 'YYYY-MM-DD') as day,
+ al.ach_uid as "buyer",
+ ade.partner_id as seller,
+ count(al.ach_login) as "nbuyer",
+ count(al.bord_vnd_id) as "nseller",
+ sum(al.lot_est1) as "min_est",
+ sum(al.lot_est2) as "max_est",
+ ad.id as auction,
+ count(al.id) as "object",
+ sum(al.obj_price) as "total_price",
+ (sum(al.obj_price)/count(al.id)) as "avg_price",
+ sum(al.gross_revenue) as gross_revenue,
+ sum(al.net_revenue) as net_revenue,
+ avg(al.net_margin) as net_margin,
+ sum(al.lot_est1+al.lot_est2)/2 as avg_estimation
+ from
+ auction_lots al,
+ auction_dates ad,
+ auction_deposit ade
+ where
+ ad.id=al.auction_id and ade.id=al.bord_vnd_id
+ group by
+ ad.auction1,
+ al.ach_uid,
+ ad.id,
+ al.ach_login,
+ ade.partner_id,
+ al.state,
+ al.create_uid
+ )
+ ''')
+report_auction()
diff --git a/addons/auction/report/report_auction_view.xml b/addons/auction/report/report_auction_view.xml
new file mode 100644
index 00000000000..81d794f5513
--- /dev/null
+++ b/addons/auction/report/report_auction_view.xml
@@ -0,0 +1,119 @@
+<?xml version="1.0"?>
+<openerp>
+ <data>
+
+ <record model="ir.ui.view" id="view_report_auction_tree">
+ <field name="name">Auction's Summary</field>
+ <field name="model">report.auction</field>
+ <field name="type">tree</field>
+ <field name="arch" type="xml">
+ <tree string="Auction Summary tree view">
+ <field name="date" invisible="1"/>
+ <field name="user_id" invisible="1"/>
+ <field name="year" invisible="1"/>
+ <field name="day" invisible="1"/>
+ <field name="month" invisible="1"/>
+ <field name="auction" select="1" invisible="1"/>
+ <field name="buyer_login" select="1" invisible="1"/>
+ <field name="buyer" select="1" invisible="1"/>
+ <field name="seller" invisible="1"/>
+ <field name="object" select="1" invisible="1"/>
+ <field name="nbuyer" />
+ <field name="nseller" />
+ <field name="min_est" />
+ <field name="max_est" />
+ <field name="avg_price" select="1"/>
+ <field name="gross_revenue" />
+ <field name="net_revenue" />
+ <field name="net_margin" />
+ <field name="total_price" select="1"/>
+ </tree>
+ </field>
+ </record>
+
+ <record id="view_report_auction_search" model="ir.ui.view">
+ <field name="name">report.auction.search</field>
+ <field name="model">report.auction</field>
+ <field name="type">search</field>
+ <field name="arch" type="xml">
+ <search string="Auction Summary">
+ <group>
+ <filter icon="terp-go-year" string=" 365 Days "
+ domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')),('date','&gt;',(datetime.date.today()-datetime.timedelta(days=365)).strftime('%%Y-%%m-%%d'))]"
+ help="Auction in last 365 days"/>
+ <filter icon="terp-go-month" string=" 30 Days "
+ name="month"
+ domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')), ('date','&gt;',(datetime.date.today()-datetime.timedelta(days=30)).strftime('%%Y-%%m-%%d'))]"
+ help="Auction in last 30 days"/>
+ <filter icon="terp-go-week"
+ string=" 7 Days "
+ separator="1"
+ domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')), ('date','&gt;',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]"
+ help="Auction during last 7 days"/>
+ <separator orientation="vertical"/>
+ <filter icon="terp-document-new"
+ string="Draft"
+ domain="[('state','=','draft')]"/>
+ <filter icon="terp-dolar"
+ string="Sold"
+ domain="[('state','=', 'sold')]"/>
+ <separator orientation="vertical"/>
+ <field name="auction"/>
+ <field name="user_id" widget="selection">
+ <filter icon="terp-personal"
+ string="My Auction"
+ help="My Auction"
+ domain="[('user_id','=',uid)]"/>
+ </field>
+ <field name="object"/>
+ </group>
+ <newline/>
+ <group expand="1" string="Group By..." colspan="10" col="12">
+ <filter string="User" icon="terp-personal" name="User" context="{'group_by':'user_id'}"/>
+ <filter string="Buyer" icon="terp-personal" name="buyer" context="{'group_by':'buyer'}"/>
+ <filter string="Seller" icon="terp-personal" name="seller" context="{'group_by':'seller'}"/>
+ <separator orientation="vertical"/>
+ <filter string="Auction" icon="terp-product" name="auction" context="{'group_by':'auction'}"/>
+ <separator orientation="vertical"/>
+ <filter string="Day" icon="terp-go-today" context="{'group_by':'day'}"/>
+ <filter string="Month" icon="terp-go-month" context="{'group_by':'month'}"/>
+ <filter string="Year" icon="terp-go-year" context="{'group_by':'year'}"/>
+ </group>
+ </search>
+ </field>
+ </record>
+
+ <record id="view_report_auction_graph" model="ir.ui.view">
+ <field name="name">report.auction.graph</field>
+ <field name="model">report.auction</field>
+ <field name="type">graph</field>
+ <field name="arch" type="xml">
+ <graph string="Auction's Summary" type="bar">
+ <field name="auction"/>
+ <field name="total_price" operator="+"/>
+ <field name="avg_estimation" operator="+"/>
+ <field name="avg_price" operator="+"/>
+ <field name="gross_revenue" operator="+"/>
+ <field name="net_revenue" operator="+"/>
+ <field name="net_margin" operator="+"/>
+ </graph>
+ </field>
+ </record>
+
+ <record model="ir.actions.act_window" id="action_report_auction">
+ <field name="name">Auction Summary</field>
+ <field name="res_model">report.auction</field>
+ <field name="view_type">form</field>
+ <field name="view_mode">tree,graph</field>
+<!-- <field name="domain">[('date','ilike',time.strftime('%Y-%m'))]</field>-->
+ <field name="search_view_id" ref="view_report_auction_search"/>
+ <field name="context">{'search_default_month':1}</field>
+ </record>
+
+ <menuitem name="Auction" id="auction_report_auction_menu" parent="auction.auction_report_menu"/>
+ <menuitem name="Auction's Summary" action="action_report_auction" id="menu_report_auction" parent="auction_report_auction_menu"/>
+
+<!--end : creating buyer Reporting menu for the buyer by pmo-->
+
+ </data>
+</openerp> \ No newline at end of file
diff --git a/addons/auction/security/ir.model.access.csv b/addons/auction/security/ir.model.access.csv
index 642209edd05..f0e394700a1 100644
--- a/addons/auction/security/ir.model.access.csv
+++ b/addons/auction/security/ir.model.access.csv
@@ -8,17 +8,5 @@
"access_auction_bid","auction.bid","model_auction_bid","base.group_user",1,1,1,1
"access_auction_bid_line","auction.bid.line","model_auction_bid_line","base.group_user",1,1,1,1
"access_auction_lot_history","auction.lot.history","model_auction_lot_history","base.group_user",1,1,1,1
-"access_report_buyer_auction","report.buyer.auction","model_report_buyer_auction","base.group_user",1,0,0,0
-"access_report_buyer_auction2","report.buyer.auction2","model_report_buyer_auction2","base.group_user",1,0,0,0
-"access_report_seller_auction","report.seller.auction","model_report_seller_auction","base.group_user",1,0,0,0
-"access_report_seller_auction2","report.seller.auction2","model_report_seller_auction2","base.group_user",1,0,0,0
-"access_report_auction_view","report.auction.view","model_report_auction_view","base.group_user",1,0,0,0
-"access_report_auction_view2","report.auction.view2","model_report_auction_view2","base.group_user",1,0,0,0
-"access_report_auction_object_date","report.auction.object.date","model_report_auction_object_date","base.group_user",1,0,0,0
-"access_report_auction_estimation_adj_category","report.auction.estimation.adj.category","model_report_auction_estimation_adj_category","base.group_user",1,0,0,0
-"access_report_auction_adjudication","report.auction.adjudication","model_report_auction_adjudication","base.group_user",1,0,0,0
+"access_report_auction","report.auction","model_report_auction","base.group_user",1,0,0,0
"access_report_attendance","report.attendance","model_report_attendance","base.group_user",1,0,0,0
-"access_report_deposit_border","report.deposit.border","model_report_deposit_border","base.group_user",1,0,0,0
-"access_report_object_encoded","report.object.encoded","model_report_object_encoded","base.group_user",1,0,0,0
-"access_report_object_encoded_manager","report.object.encoded.manager","model_report_object_encoded_manager","base.group_user",1,0,0,0
-"access_report_unclassified_objects","report.unclassified.objects","model_report_unclassified_objects","base.group_user",1,0,0,0