diff --git a/addons/auction/__terp__.py b/addons/auction/__terp__.py
index 61e91802f44..8918a6394aa 100644
--- a/addons/auction/__terp__.py
+++ b/addons/auction/__terp__.py
@@ -38,6 +38,8 @@
'init_xml': ['auction_sequence.xml'],
'update_xml': [
'security/ir.model.access.csv',
+# 'wizard/auction_lots_cancel_view.xml',
+# 'wizard/auction_transfer_unsold_object_view.xml',
'wizard/auction_lots_able_view.xml',
'wizard/auction_lots_enable_view.xml',
'wizard/auction_lots_make_invoice_buyer_view.xml',
diff --git a/addons/auction/auction.py b/addons/auction/auction.py
index 1687980c029..cf5f27775df 100644
--- a/addons/auction/auction.py
+++ b/addons/auction/auction.py
@@ -95,15 +95,17 @@ class auction_dates(osv.osv):
RETURN: True
"""
# objects vendus mais non factures
+ #TODO: convert this query to tiny API
+ lots_obj = self.pool.get('auction.lots')
cr.execute('select count(*) as c from auction_lots where auction_id =ANY(%s) and state=%s and obj_price>0', (ids,'draft',))
nbr = cr.fetchone()[0]
ach_uids = {}
cr.execute('select id from auction_lots where auction_id =ANY(%s) and state=%s and obj_price>0', (ids,'draft',))
- r=self.pool.get('auction.lots').lots_invoice(cr, uid, [x[0] for x in cr.fetchall()],{},None)
+ r = lots_obj.lots_invoice(cr, uid, [x[0] for x in cr.fetchall()],{},None)
cr.execute('select id from auction_lots where auction_id =ANY(%s) and obj_price>0',(ids,))
ids2 = [x[0] for x in cr.fetchall()]
# for auction in auction_ids:
- c=self.pool.get('auction.lots').seller_trans_create(cr, uid, ids2,{})
+ c = lots_obj.seller_trans_create(cr, uid, ids2,{})
self.write(cr, uid, ids, {'state':'closed'}) #close the auction
return True
auction_dates()
@@ -508,14 +510,14 @@ class auction_lots(osv.osv):
##CHECKME: est-ce que ca vaudrait la peine de faire des groupes de lots qui ont les memes couts pour passer des listes de lots a compute?
taxes = []
amount=0.0
- # pt_tax=pool.get('account.tax')
+ pt_tax = self.pool.get('account.tax')
for lot in lots:
taxes = lot.product_id.taxes_id
if lot.author_right:
taxes.append(lot.author_right)
elif lot.auction_id:
taxes += lot.auction_id.buyer_costs
- tax=self.pool.get('account.tax').compute(cr,uid,taxes,lot.obj_price,1)
+ tax=pt_tax.compute(cr,uid,taxes,lot.obj_price,1)
for t in tax:
amount+=t['amount']
#amount+=lot.obj_price*0.2
@@ -630,18 +632,20 @@ class auction_lots(osv.osv):
def buyer_proforma(self,cr,uid,ids,context):
invoices = {}
- inv_ref=self.pool.get('account.invoice')
+ inv_ref = self.pool.get('account.invoice')
+ partner_r = 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')]])
for lot in self.browse(cr,uid,ids,context):
if not lot.obj_price>0:
continue
- partner_r=self.pool.get('res.partner')
if not lot.ach_uid.id:
raise orm.except_orm(_('Missed buyer !'), _('The object "%s" has no buyer assigned.') % (lot.name,))
else:
partner_ref =lot.ach_uid.id
lot_name = lot.obj_num
- res = self.pool.get('res.partner').address_get(cr, uid, [partner_ref], ['contact', 'invoice'])
+ res = partner_r.address_get(cr, uid, [partner_ref], ['contact', 'invoice'])
contact_addr_id = res['contact']
invoice_addr_id = res['invoice']
if not invoice_addr_id:
@@ -675,12 +679,11 @@ class auction_lots(osv.osv):
'account_id': lot.auction_id.acc_income.id,
'price_unit': lot.obj_price,
}
- self.pool.get('account.invoice.line').create(cr, uid, inv_line,context)
+ inv_line_obj.create(cr, uid, inv_line,context)
# inv_ref.button_compute(cr, uid, [inv_id])
# wf_service = netsvc.LocalService('workflow')
# wf_service.trg_validate(uid, 'account.invoice', inv_id, 'invoice_open', cr)
inv_ref.button_compute(cr, uid, invoice.values())
- wf_service = netsvc.LocalService('workflow')
wf_service.trg_validate(uid, 'account.invoice', inv_id, 'invoice_proforma', cr)
return invoices.values()
@@ -694,6 +697,9 @@ class auction_lots(osv.osv):
# use each list of object in turn
invoices = {}
inv_ref=self.pool.get('account.invoice')
+ partner_obj = self.pool.get('res.partner')
+ inv_line_obj = self.pool.get('account.invoice.line')
+ wf_service = netsvc.LocalService('workflow')
for lot in self.browse(cr,uid,ids,context):
partner_id = lot.bord_vnd_id.partner_id.id
if not lot.auction_id.id:
@@ -702,7 +708,7 @@ class auction_lots(osv.osv):
if lot.bord_vnd_id.id in invoices:
inv_id = invoices[lot.bord_vnd_id.id]
else:
- res = self.pool.get('res.partner').address_get(cr, uid, [lot.bord_vnd_id.partner_id.id], ['contact', 'invoice'])
+ res = partner_obj.address_get(cr, uid, [lot.bord_vnd_id.partner_id.id], ['contact', 'invoice'])
contact_addr_id = res['contact']
invoice_addr_id = res['invoice']
inv = {
@@ -734,13 +740,12 @@ class auction_lots(osv.osv):
'account_id': lot.auction_id.acc_expense.id,
'price_unit': lot.obj_price,
}
- self.pool.get('account.invoice.line').create(cr, uid, inv_line,context)
+ inv_line_obj.create(cr, uid, inv_line,context)
inv_ref.button_compute(cr, uid, invoices.values())
for inv in inv_ref.browse(cr, uid, invoices.values(), context):
inv_ref.write(cr, uid, [inv.id], {
'check_total': inv.amount_total
})
- wf_service = netsvc.LocalService('workflow')
wf_service.trg_validate(uid, 'account.invoice', inv.id, 'invoice_open', cr)
return invoices.values()
@@ -756,13 +761,15 @@ class auction_lots(osv.osv):
RETURN: id of generated invoice
"""
dt = time.strftime('%Y-%m-%d')
- inv_ref=self.pool.get('account.invoice')
+ inv_ref = self.pool.get('account.invoice')
+ partner_r = self.pool.get('res.partner')
+ inv_line_obj = self.pool.get('account.invoice.line')
+ wf_service = netsvc.LocalService('workflow')
invoices={}
for lot in self.browse(cr, uid, ids,context):
# partner_ref = lot.ach_uid.id
if not lot.auction_id.id:
continue
- partner_r=self.pool.get('res.partner')
if not lot.ach_uid.id:
raise orm.except_orm(_('Missed buyer !'), _('The object "%s" has no buyer assigned.') % (lot.name,))
if (lot.auction_id.id,lot.ach_uid.id) in invoices:
@@ -773,13 +780,12 @@ class auction_lots(osv.osv):
raise orm.except_orm(_('Missed Address !'), _('The Buyer has no Invoice Address.'))
price = lot.obj_price or 0.0
lot_name =lot.obj_num
- inv={
+ inv = {
'name':lot.auction_id.name or '',
'reference': lot.ach_login,
'journal_id': lot.auction_id.journal_id.id,
'partner_id': lot.ach_uid.id,
'type': 'out_invoice',
-
}
if invoice_number:
inv['number'] = invoice_number
@@ -804,12 +810,11 @@ class auction_lots(osv.osv):
'account_id': lot.auction_id.acc_income.id,
'price_unit': lot.obj_price,
}
- self.pool.get('account.invoice.line').create(cr, uid, inv_line,context)
+ inv_line_obj.create(cr, uid, inv_line,context)
# inv_ref.button_compute(cr, uid, [inpq tu dis cav_id])
# inv_ref.button_compute(cr, uid, [inv_id])
inv_ref.button_compute(cr, uid, [inv_id])
for l in inv_ref.browse(cr, uid, invoices.values(), context):
- wf_service = netsvc.LocalService('workflow')
# wf_service.trg_validate(uid, 'account.invoice',l.id, 'invoice_proforma', cr)
wf_service.trg_validate(uid, 'account.invoice',l.id, 'invoice_open', cr)
return invoices.values()
diff --git a/addons/auction/wizard/__init__.py b/addons/auction/wizard/__init__.py
index bcd2de8b301..957ab02b053 100644
--- a/addons/auction/wizard/__init__.py
+++ b/addons/auction/wizard/__init__.py
@@ -29,7 +29,8 @@ import auction_pay_buy
import auction_payer_sel
import auction_lots_sms_send
import auction_catalog_flagey_report
-
+#import auction_lots_cancel
+#import auction_transfer_unsold_object
#import auction_aie_send_result
import auction_lots_buyer_map
diff --git a/addons/auction/wizard/auction_catalog_flagey_report.py b/addons/auction/wizard/auction_catalog_flagey_report.py
index 119c3273ee0..d8fec4b6d95 100644
--- a/addons/auction/wizard/auction_catalog_flagey_report.py
+++ b/addons/auction/wizard/auction_catalog_flagey_report.py
@@ -40,9 +40,21 @@ class auction_catalog_flagey(osv.osv_memory):
return res
def view_init(self, cr, uid, fields, context):
- current_auction = self.pool.get('auction.dates').browse(cr,uid,context.get('active_ids', []))
- v_lots = self.pool.get('auction.lots').search(cr,uid,[('auction_id','=',current_auction.id)])
- v_ids = self.pool.get('auction.lots').browse(cr,uid,v_lots)
+ """
+ Creates view dynamically, adding fields at runtime, raises exception
+ at the time of initialization of view.
+ @param self: The object pointer.
+ @param cr: A database cursor
+ @param uid: ID of the user currently logged in
+ @param fields: List of fields for which we want default values
+ @param context: A standard dictionary
+ @return: New arch of view with new columns.
+ """
+ lots_obj = self.pool.get('auction.lots')
+ auc_dates_obj = self.pool.get('auction.dates')
+ current_auction = auc_dates_obj.browse(cr,uid,context.get('active_ids', []))
+ v_lots = lots_obj.search(cr,uid,[('auction_id','=',current_auction.id)])
+ v_ids = lots_obj.browse(cr,uid,v_lots)
for ab in v_ids:
if not ab.auction_id :
raise osv.except_osv('Error!','No Lots belong to this Auction Date')
diff --git a/addons/auction/wizard/auction_lots_auction_move.py b/addons/auction/wizard/auction_lots_auction_move.py
index 24b2604d1d7..d1303be0887 100644
--- a/addons/auction/wizard/auction_lots_auction_move.py
+++ b/addons/auction/wizard/auction_lots_auction_move.py
@@ -32,16 +32,16 @@ class auction_lots_auction_move(osv.osv_memory):
_name = "auction.lots.auction.move"
_description = "Auction move "
_columns= {
- 'auction_id':fields.many2one('auction.dates', 'Auction Date', required=True),
- }
+ 'auction_id':fields.many2one('auction.dates', 'Auction Date', required=True),
+ }
- def _top(self, cr, uid, ids, context={}):
- refs = self.pool.get('auction.lots')
- rec_ids = refs.browse(cr, uid, context['active_ids'])
- for rec in rec_ids:
- if not rec.auction_id:
- raise osv.except_osv('Error !', 'You can not move a lot that has no auction date')
- return {}
+# def _top(self, cr, uid, ids, context={}):
+# refs = self.pool.get('auction.lots')
+# rec_ids = refs.browse(cr, uid, context['active_ids'])
+# for rec in rec_ids:
+# if not rec.auction_id:
+# raise osv.except_osv('Error !', 'You can not move a lot that has no auction date')
+# return {}
def auction_move_set(self, cr, uid, ids, context={}):
"""
@@ -56,13 +56,13 @@ class auction_lots_auction_move(osv.osv_memory):
auction_bid_line_obj = self.pool.get('auction.bid_line')
auction_lot_history_obj = self.pool.get('auction.lot.history')
auction_lots_obj = self.pool.get('auction.lots')
+ rec_ids = refs.browse(cr, uid, context['active_ids'])
for datas in self.read(cr, uid, ids):
if not (datas['auction_id'] and len(context['active_ids'])) :
return {}
- rec_ids = refs.browse(cr, uid, context['active_ids'])
- line_ids = auction_bid_line_obj.search(cr, uid, [('lot_id', 'in', context['active_ids'])])
- # pooler.get_pool(cr.dbname).get('auction.bid_line').unlink(cr, uid, line_ids)
+# line_ids = auction_bid_line_obj.search(cr, uid, [('lot_id', 'in', context['active_ids'])])
+# pooler.get_pool(cr.dbname).get('auction.bid_line').unlink(cr, uid, line_ids)
for rec in rec_ids:
new_id = auction_lot_history_obj.create(cr, uid, {
'auction_id': rec.auction_id.id,
diff --git a/addons/auction/wizard/auction_lots_buyer_map.py b/addons/auction/wizard/auction_lots_buyer_map.py
index db80a2ab3f3..b20250edc38 100644
--- a/addons/auction/wizard/auction_lots_buyer_map.py
+++ b/addons/auction/wizard/auction_lots_buyer_map.py
@@ -107,18 +107,21 @@ class wiz_auc_lots_buyer_map(osv.osv_memory):
res = super(wiz_auc_lots_buyer_map, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar,submenu=False)
lots_obj = self.pool.get('auction.lots')
if record_ids:
- for lots in lots_obj.browse(cr, uid, record_ids):
- if lots.ach_uid:
- res['arch'] = """
-
- """
+ try:
+ for lots in lots_obj.browse(cr, uid, record_ids):
+ if lots.ach_uid:
+ res['arch'] = """
+
+ """
+ except:
+ return res
return res
wiz_auc_lots_buyer_map()
diff --git a/addons/auction/wizard/auction_lots_cancel.py b/addons/auction/wizard/auction_lots_cancel.py
new file mode 100644
index 00000000000..edf530ac8aa
--- /dev/null
+++ b/addons/auction/wizard/auction_lots_cancel.py
@@ -0,0 +1,55 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# 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 .
+#
+##############################################################################
+
+from osv import osv
+from osv import fields
+
+class auction_lots_cancel(osv.osv):
+ '''
+ Open ERP Model
+ '''
+ _name = 'auction.lots.cancel'
+ _description = 'To cancel auction lots.'
+
+ def cancel(self, cr, uid, ids, context):
+ """
+ To cancel the auction lot
+
+ @param self: The object pointer.
+ @param cr: A database cursor
+ @param uid: ID of the user currently logged in
+ @param ids: List of IDs selected
+ @param context: A standard dictionary
+ @return:
+ """
+
+ lots_obj = self.pool.get('auction.lots')
+ invoice_obj = self.pool.get('account.invoice')
+ lot = lots_obj.browse(cr,uid,context['active_id'],context)
+ if lot.ach_inv_id:
+ supplier_refund_inv_id = invoice_obj.refund(cr, uid,[lot.ach_inv_id.id])
+ if lot.sel_inv_id:
+ customer_refund_inv_id = invoice_obj.refund(cr, uid,[lot.sel_inv_id.id])
+ return {}
+
+ _columns = {
+ }
+auction_lots_cancel()
\ No newline at end of file
diff --git a/addons/auction/wizard/auction_lots_cancel_view.xml b/addons/auction/wizard/auction_lots_cancel_view.xml
new file mode 100644
index 00000000000..77ff6a373b7
--- /dev/null
+++ b/addons/auction/wizard/auction_lots_cancel_view.xml
@@ -0,0 +1,27 @@
+
+
+
+
+ auction.lots.cancel.form
+ auction.lots.cancel
+ form
+
+
+
+
+
+
+
+
diff --git a/addons/auction/wizard/auction_lots_enable.py b/addons/auction/wizard/auction_lots_enable.py
index e8aa5edadf5..65cb0c4d49e 100644
--- a/addons/auction/wizard/auction_lots_enable.py
+++ b/addons/auction/wizard/auction_lots_enable.py
@@ -19,20 +19,14 @@
#
##############################################################################
from osv import fields, osv
-from tools.translate import _
-import netsvc
-import pooler
-import time
-import tools
-import wizard
class auction_lots_enable(osv.osv_memory):
-
_name = "auction.lots.enable"
_description = "Lots Enable"
+
_columns= {
- 'confirm_en':fields.integer('Catalog Number')
- }
+ 'confirm_en':fields.integer('Catalog Number')
+ }
def confirm_enable(self, cr, uid, ids, context={}):
"""
diff --git a/addons/auction/wizard/auction_lots_make_invoice.py b/addons/auction/wizard/auction_lots_make_invoice.py
index 6be49f7336a..8cda461e186 100644
--- a/addons/auction/wizard/auction_lots_make_invoice.py
+++ b/addons/auction/wizard/auction_lots_make_invoice.py
@@ -27,20 +27,29 @@ import tools
import wizard
class auction_lots_make_invoice(osv.osv_memory):
+ _name = "auction.lots.make.invoice"
+ _description = "Make invoice"
+ _columns = {
+ 'amount': fields.float('Invoiced Amount', required =True, readonly=True),
+ 'objects':fields.integer('# of objects', required =True, readonly=True),
+ 'number':fields.char('Invoice Number', size=64),
+
+ }
+
+ _defaults = {
+ 'number': lambda *a: False,
+ }
def default_get(self, cr, uid, fields, context):
"""
- To get default values for the object.
-
- @param self: The object pointer.
- @param cr: A database cursor
- @param uid: ID of the user currently logged in
- @param fields: List of fields for which we want default values
- @param context: A standard dictionary
-
- @return: A dictionary which of fields with values.
-
+ To get default values for the object.
+ @param self: The object pointer.
+ @param cr: A database cursor
+ @param uid: ID of the user currently logged in
+ @param fields: List of fields for which we want default values
+ @param context: A standard dictionary
+ @return: A dictionary which of fields with values.
"""
res = super(auction_lots_make_invoice, self).default_get(cr, uid, fields, context=context)
for lot in self.pool.get('auction.lots').browse(cr, uid, context.get('active_ids', [])):
@@ -53,7 +62,7 @@ class auction_lots_make_invoice(osv.osv_memory):
def makeInvoices(self, cr, uid, ids, context):
"""
- seller invoice :Create an invoice.
+ Seller invoice :Create an invoice.
@param cr: the current row, from the database cursor.
@param uid: the current user’s ID for security checks.
@param ids: List of Auction lots make invoice’s IDs
@@ -61,36 +70,20 @@ class auction_lots_make_invoice(osv.osv_memory):
"""
order_obj = self.pool.get('auction.lots')
mod_obj = self.pool.get('ir.model.data')
-
- for data in self.read(cr, uid, ids):
- result = mod_obj._get_id(cr, uid, 'account', 'view_account_invoice_filter')
- id = mod_obj.read(cr, uid, result, ['res_id'])
- newinv = []
- ids = order_obj.seller_trans_create(cr, uid, context['active_ids'], context)
- cr.commit()
- return {
- 'domain': "[('id','in', ["+','.join(map(str, ids))+"])]",
- 'name': 'Seller invoices',
- 'view_type': 'form',
- 'view_mode': 'tree,form',
- 'res_model': 'account.invoice',
- 'view_id': False,
- 'context': "{'type':'out_refund'}",
- 'type': 'ir.actions.act_window',
- 'search_view_id': id['res_id']
- }
+ result = mod_obj._get_id(cr, uid, 'account', 'view_account_invoice_filter')
+ id = mod_obj.read(cr, uid, result, ['res_id'])
+ lots_ids = order_obj.seller_trans_create(cr, uid, context['active_ids'], context)
+ cr.commit()
+ return {
+ 'domain': "[('id','in', ["+','.join(map(str, lots_ids))+"])]",
+ 'name': 'Seller invoices',
+ 'view_type': 'form',
+ 'view_mode': 'tree,form',
+ 'res_model': 'account.invoice',
+ 'view_id': False,
+ 'context': "{'type':'out_refund'}",
+ 'type': 'ir.actions.act_window',
+ 'search_view_id': id['res_id']
+ }
- _name = "auction.lots.make.invoice"
- _description = "Make invoice"
- _columns= {
- 'amount': fields.float('Invoiced Amount', required =True, readonly=True),
- 'objects':fields.integer('# of objects', required =True, readonly=True),
- 'number':fields.char('Invoice Number', size=64),
-
- }
- _defaults={
- 'number':lambda *a: False,
-
- }
-
auction_lots_make_invoice()
diff --git a/addons/auction/wizard/auction_lots_make_invoice_buyer.py b/addons/auction/wizard/auction_lots_make_invoice_buyer.py
index 53c3519d225..5d2e370a81e 100644
--- a/addons/auction/wizard/auction_lots_make_invoice_buyer.py
+++ b/addons/auction/wizard/auction_lots_make_invoice_buyer.py
@@ -19,27 +19,31 @@
#
##############################################################################
from osv import fields, osv
-from tools.translate import _
-import netsvc
-import pooler
-import time
-import tools
-import wizard
class auction_lots_make_invoice_buyer(osv.osv_memory):
+ _name = "auction.lots.make.invoice.buyer"
+ _description = "Make invoice buyer "
+
+ _columns= {
+ 'amount': fields.float('Invoiced Amount', required =True, readonly=True),
+ 'objects':fields.integer('# of objects', required =True, readonly=True),
+ 'number':fields.char('Invoice Number', size=64),
+ 'buyer_id':fields.many2one('res.partner', 'Buyer', required=True),
+ }
+
+ _defaults={
+ 'number': lambda *a: False,
+ }
def default_get(self, cr, uid, fields, context):
"""
- To get default values for the object.
-
- @param self: The object pointer.
- @param cr: A database cursor
- @param uid: ID of the user currently logged in
- @param fields: List of fields for which we want default values
- @param context: A standard dictionary
-
- @return: A dictionary which of fields with values.
-
+ To get default values for the object.
+ @param self: The object pointer.
+ @param cr: A database cursor
+ @param uid: ID of the user currently logged in
+ @param fields: List of fields for which we want default values
+ @param context: A standard dictionary
+ @return: A dictionary which of fields with values.
"""
res = super(auction_lots_make_invoice_buyer, self).default_get(cr, uid, fields, context=context)
for lot in self.pool.get('auction.lots').browse(cr, uid, context.get('active_ids', [])):
@@ -59,22 +63,19 @@ class auction_lots_make_invoice_buyer(osv.osv_memory):
@param ids: List of Auction lots make invoice buyer’s IDs
@return: dictionary of account invoice form.
"""
- newinv = []
-
order_obj = self.pool.get('auction.lots')
mod_obj = self.pool.get('ir.model.data')
-
+ result = mod_obj._get_id(cr, uid, 'account', 'view_account_invoice_filter')
+ id = mod_obj.read(cr, uid, result, ['res_id'])
+ lots = order_obj.browse(cr, uid, context['active_ids'])
for data in self.read(cr, uid, ids):
- result = mod_obj._get_id(cr, uid, 'account', 'view_account_invoice_filter')
- id = mod_obj.read(cr, uid, result, ['res_id'])
- lots = order_obj.browse(cr, uid, context['active_ids'])
invoice_number = data['number']
for lot in lots:
- up_auction = order_obj.write(cr, uid, [lot.id], {'ach_uid':data['buyer_id']})
- ids = order_obj.lots_invoice(cr, uid, context['active_ids'], context, data['number'])
+ up_auction = order_obj.write(cr, uid, [lot.id], {'ach_uid': data['buyer_id']})
+ lots_ids = order_obj.lots_invoice(cr, uid, context['active_ids'], context, data['number'])
cr.commit()
return {
- 'domain': "[('id','in', ["+','.join(map(str, ids))+"])]",
+ 'domain': "[('id','in', ["+','.join(map(str, lots_ids))+"])]",
'name': 'Buyer invoices',
'view_type': 'form',
'view_mode': 'tree,form',
@@ -84,17 +85,5 @@ class auction_lots_make_invoice_buyer(osv.osv_memory):
'type': 'ir.actions.act_window',
'search_view_id': id['res_id']
}
-
- _name = "auction.lots.make.invoice.buyer"
- _description = "Make invoice buyer "
- _columns= {
- 'amount': fields.float('Invoiced Amount', required =True, readonly=True),
- 'objects':fields.integer('# of objects', required =True, readonly=True),
- 'number':fields.char('Invoice Number', size=64),
- 'buyer_id':fields.many2one('res.partner', 'Buyer', required=True),
- }
- _defaults={
- 'number':lambda *a: False,
- }
auction_lots_make_invoice_buyer()
diff --git a/addons/auction/wizard/auction_pay_buy.py b/addons/auction/wizard/auction_pay_buy.py
index 8f16ea9e7de..28028f45538 100644
--- a/addons/auction/wizard/auction_pay_buy.py
+++ b/addons/auction/wizard/auction_pay_buy.py
@@ -21,26 +21,33 @@
from osv import fields, osv
from tools.translate import _
-import netsvc
-import pooler
import time
import tools
-import wizard
class auction_pay_buy(osv.osv_memory):
+ _name = "auction.pay.buy"
+ _description = "Pay buy"
+
+ _columns= {
+ 'amount': fields.float('Amount paid', digits= (16, int(tools.config['price_accuracy']))),
+ 'buyer_id':fields.many2one('res.partner', 'Buyer'),
+ 'statement_id1':fields.many2one('account.bank.statement', 'Statement', required=True),
+ 'amount2': fields.float('Amount paid', digits= (16, int(tools.config['price_accuracy']))),
+ 'statement_id2':fields.many2one('account.bank.statement', 'Statement'),
+ 'amount3': fields.float('Amount paid', digits = (16, int(tools.config['price_accuracy']))),
+ 'statement_id3':fields.many2one('account.bank.statement', 'Statement'),
+ 'total': fields.float('Amount paid', digits = (16, int(tools.config['price_accuracy'])), readonly =True),
+ }
def default_get(self, cr, uid, fields, context):
"""
- To get default values for the object.
-
- @param self: The object pointer.
- @param cr: A database cursor
- @param uid: ID of the user currently logged in
- @param fields: List of fields for which we want default values
- @param context: A standard dictionary
-
- @return: A dictionary which of fields with values.
-
+ To get default values for the object.
+ @param self: The object pointer.
+ @param cr: A database cursor
+ @param uid: ID of the user currently logged in
+ @param fields: List of fields for which we want default values
+ @param context: A standard dictionary
+ @return: A dictionary which of fields with values.
"""
res = super(auction_pay_buy, self).default_get(cr, uid, fields, context=context)
for lot in self.pool.get('auction.lots').browse(cr, uid, context.get('active_ids', [])):
@@ -54,13 +61,12 @@ class auction_pay_buy(osv.osv_memory):
def pay_and_reconcile(self, cr, uid, ids, context):
"""
- Pay and Reconcile
-
- @param cr: the current row, from the database cursor.
- @param uid: the current user’s ID for security checks.
- @param ids: the ID or list of IDs
- @param context: A standard dictionary
- @return:
+ Pay and Reconcile
+ @param cr: the current row, from the database cursor.
+ @param uid: the current user’s ID for security checks.
+ @param ids: the ID or list of IDs
+ @param context: A standard dictionary
+ @return:
"""
lot_obj = self.pool.get('auction.lots')
bank_statement_line_obj = self.pool.get('account.bank.statement.line')
@@ -94,22 +100,8 @@ class auction_pay_buy(osv.osv_memory):
for lot in lots:
lot_obj.write(cr, uid, [lot.id], {'statement_id':[(4, new_id)]})
return {}
-
- _name = "auction.pay.buy"
- _description = "Pay buy"
- _columns= {
- 'amount': fields.float('Amount paid', digits= (16, int(tools.config['price_accuracy']))),
- 'buyer_id':fields.many2one('res.partner', 'Buyer'),
- 'statement_id1':fields.many2one('account.bank.statement', 'Statement', required=True),
- 'amount2': fields.float('Amount paid', digits= (16, int(tools.config['price_accuracy']))),
- 'statement_id2':fields.many2one('account.bank.statement', 'Statement'),
- 'amount3': fields.float('Amount paid', digits = (16, int(tools.config['price_accuracy']))),
- 'statement_id3':fields.many2one('account.bank.statement', 'Statement'),
- 'total': fields.float('Amount paid', digits = (16, int(tools.config['price_accuracy'])), readonly =True),
- }
+
auction_pay_buy()
-
-
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/auction/wizard/auction_pay_sel.py b/addons/auction/wizard/auction_pay_sel.py
index df7b4a794f3..6873092c7e9 100644
--- a/addons/auction/wizard/auction_pay_sel.py
+++ b/addons/auction/wizard/auction_pay_sel.py
@@ -20,33 +20,27 @@
##############################################################################
from osv import fields, osv
from tools.translate import _
-import netsvc
-import pooler
-import time
import tools
-import wizard
class auction_pay_sel(osv.osv_memory):
-
_name = "auction.pay.sel"
_description = "Pay Invoice"
+
_columns= {
- 'amount': fields.float('Amount paid', digits= (16, int(tools.config['price_accuracy'])), required=True),
- 'dest_account_id':fields.many2one('account.account', 'Payment to Account', required=True, domain= [('type', '=', 'cash')]),
- 'journal_id':fields.many2one('account.journal', 'Journal', required=True),
- 'period_id':fields.many2one('account.period', 'Period', required=True),
- }
+ 'amount': fields.float('Amount paid', digits= (16, int(tools.config['price_accuracy'])), required=True),
+ 'dest_account_id':fields.many2one('account.account', 'Payment to Account', required=True, domain= [('type', '=', 'cash')]),
+ 'journal_id':fields.many2one('account.journal', 'Journal', required=True),
+ 'period_id':fields.many2one('account.period', 'Period', required=True),
+ }
def pay_and_reconcile(self, cr, uid, ids, context):
-
"""
- Pay and Reconcile
-
- @param cr: the current row, from the database cursor.
- @param uid: the current user’s ID for security checks.
- @param ids: the ID or list of IDs
- @param context: A standard dictionary
- @return:
+ Pay and Reconcile
+ @param cr: the current row, from the database cursor.
+ @param uid: the current user’s ID for security checks.
+ @param ids: the ID or list of IDs
+ @param context: A standard dictionary
+ @return:
"""
lot = self.pool.get('auction.lots').browse(cr, uid, context['active_id'], context)
invoice_obj = self.pool.get('account.invoice')
diff --git a/addons/auction/wizard/auction_payer_sel.py b/addons/auction/wizard/auction_payer_sel.py
index 349f10d4dec..c422ee91857 100644
--- a/addons/auction/wizard/auction_payer_sel.py
+++ b/addons/auction/wizard/auction_payer_sel.py
@@ -20,15 +20,8 @@
##############################################################################
from osv import fields, osv
-from tools.translate import _
-import netsvc
-import pooler
-import time
-import tools
-import wizard
class auction_payer(osv.osv_memory):
-
_name = "auction.payer"
_description = "Auction payer"
diff --git a/addons/auction/wizard/auction_taken.py b/addons/auction/wizard/auction_taken.py
index 63c3db7583c..005fd042646 100644
--- a/addons/auction/wizard/auction_taken.py
+++ b/addons/auction/wizard/auction_taken.py
@@ -32,10 +32,10 @@ class auction_taken(osv.osv_memory):
"""
_name = "auction.taken"
_description = "Auction taken"
+
_columns = {
- 'lot_ids':fields.many2many('auction.lots', 'auction_taken_rel', 'taken_id', 'lot_id', 'Lots Emportes'),
-
- }
+ 'lot_ids':fields.many2many('auction.lots', 'auction_taken_rel', 'taken_id', 'lot_id', 'Lots Emportes'),
+ }
def _to_xml(s):
return s.replace('&','&').replace('<','<').replace('>','>')
diff --git a/addons/auction/wizard/auction_transfer_unsold_object.py b/addons/auction/wizard/auction_transfer_unsold_object.py
new file mode 100644
index 00000000000..47aadc25d59
--- /dev/null
+++ b/addons/auction/wizard/auction_transfer_unsold_object.py
@@ -0,0 +1,86 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# 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 .
+#
+##############################################################################
+
+from osv import osv
+from osv import fields
+
+class auction_transfer_unsold_object(osv.osv):
+ '''
+ Open ERP Model
+ '''
+ _name = 'auction.transfer.unsold.object'
+ _description = 'To transfer unsold objects'
+
+ _columns = {
+ 'auction_id_from':fields.many2one('auction.dates', 'From Auction Date', required=True),
+ 'auction_id_to':fields.many2one('auction.dates', 'To Auction Date', required=True),
+ }
+
+ _defaults = {
+ 'auction_id_from': _start,
+ }
+
+ def _start(self, cr, uid, context):
+ """
+ To initialize auction_id_from
+ @param self: The object pointer.
+ @param cr: A database cursor
+ @param uid: ID of the user currently logged in
+ @param ids: List of IDs selected
+ @param context: A standard dictionary
+ @return: auction_id_from
+ """
+ lots_obj = self.pool.get('auction.lots')
+ rec = lots_obj.browse(cr, uid, context['active_id'], context)
+ auction_from = rec and rec.auction_id.id or False
+ return auction_from
+
+ def transfer_unsold_object(self, cr, uid, ids, context):
+ """
+ To Transfer the unsold object
+ @param self: The object pointer.
+ @param cr: A database cursor
+ @param uid: ID of the user currently logged in
+ @param ids: List of IDs selected
+ @param context: A standard dictionary
+ @return:
+ """
+ bid_line_obj = self.pool.get('auction.bid_line')
+ lots_obj = self.pool.get('auction.lots')
+ lot_history_obj = self.pool.get('auction.lot.history')
+ line_ids= bid_line_obj.search(cr,uid,[('lot_id','in',context['active_ids'])])
+ bid_line_obj.unlink(cr, uid, line_ids)
+
+ res = self.browse(cr, uid, ids)
+ unsold_ids = lots_obj.search(cr,uid,[('auction_id','=',res[0].auction_id_from.id),('state','=','unsold')])
+ for rec in lots_obj.browse(cr, uid, unsold_ids, context):
+ new_id = lot_history_obj.create(cr,uid,{'auction_id':rec.auction_id.id,'lot_id':rec.id,'price': rec.obj_ret, 'name': rec.auction_id.auction1})
+ up_auction = lots_obj.write(cr,uid,[rec.id],{'auction_id': res[0].auction_id_to.id,
+ 'obj_ret':None,
+ 'obj_price':None,
+ 'ach_login':None,
+ 'ach_uid':None,
+ 'ach_inv_id':None,
+ 'sel_inv_id':None,
+ 'state':'draft'})
+ return {}
+
+auction_transfer_unsold_object()
\ No newline at end of file
diff --git a/addons/auction/wizard/auction_transfer_unsold_object_view.xml b/addons/auction/wizard/auction_transfer_unsold_object_view.xml
new file mode 100644
index 00000000000..768043b3bed
--- /dev/null
+++ b/addons/auction/wizard/auction_transfer_unsold_object_view.xml
@@ -0,0 +1,26 @@
+
+
+
+
+ auction.transfer.unsold.object.form
+ auction.transfer.unsold.object
+ form
+
+
+
+
+
+
+
diff --git a/addons/auction/wizard/wizard_lots_cancel.py b/addons/auction/wizard/wizard_lots_cancel.py
deleted file mode 100644
index 1d7f93b14d3..00000000000
--- a/addons/auction/wizard/wizard_lots_cancel.py
+++ /dev/null
@@ -1,91 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# 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 .
-#
-##############################################################################
-
-import wizard
-import netsvc
-import pooler
-
-paid_form = '''
-'''
-fields_ask = {
-}
-#
-#def _get_value(self,cr,uid, datas,context={}):
-## service = netsvc.LocalService("object_proxy")
-# lots=pool.get('auction.lots').browse(cr,uid,data['id'],context)
-#
-#
-## lots = service.execute(cr.dbname,uid, 'auction.lots', 'read', datas['ids'])
-#
-# ids = []
-# pay_ids = {}
-# price = 0.0
-# price_paid = 0.0
-# uid = False
-#
-##TODO: refuse if several payments?
-# for lot in lots:
-# price += lot['obj_price']
-#
-# # add all the buyer costs
-# costs = service.execute(cr.dbname,uid, 'auction.lots', 'compute_buyer_costs', [lot['id']])
-# for cost in costs:
-# price += cost['amount']
-#
-##TODO: pr bien faire, faudrait leur poser la question: continue anyway?
-# if len(ids)).
-#
-# 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 .
-#
-##############################################################################
-
-import time
-import wizard
-import netsvc
-import pooler
-from osv.orm import browse_record
-import sql_db
-
-transfer_unsold_object_form = """
-
-"""
-
-transfer_unsold_object_fields = {
- 'auction_id_from': {'string':'From Auction Date', 'type':'many2one', 'required':True, 'relation':'auction.dates'},
- 'auction_id_to': {'string':'To Auction Date', 'type':'many2one', 'required':True, 'relation':'auction.dates'},
-}
-
-def _start(self,cr,uid,data,context):
- pool = pooler.get_pool(cr.dbname)
- rec=pool.get('auction.lots').browse(cr,uid,data['id'],context)
- auction_from= rec and rec.auction_id.id or False
- return {'auction_id_from':auction_from}
-
-def _transfer_unsold_object(self, cr, uid, data, context):
- #if not (data['form']['auction_id_to']) :
- # return {}
-#Historique de l objet + changement de l auction date + supp des bid line
- line_ids= pooler.get_pool(cr.dbname).get('auction.bid_line').search(cr,uid,[('lot_id','in',data['ids'])])
- pooler.get_pool(cr.dbname).get('auction.bid_line').unlink(cr, uid, line_ids)
-
- obj_pool = pooler.get_pool(cr.dbname).get('auction.lots')
- ids= obj_pool.search(cr,uid,[('auction_id','=',data['form']['auction_id_from']),('state','=','unsold')])
- for rec in obj_pool.browse(cr, uid, ids, context):
- new_id=pooler.get_pool(cr.dbname).get('auction.lot.history').create(cr,uid,{'auction_id':rec.auction_id.id,'lot_id':rec.id,'price': rec.obj_ret, 'name': 'reasons'+rec.auction_id.auction1})
- up_auction=pooler.get_pool(cr.dbname).get('auction.lots').write(cr,uid,[rec.id],{'auction_id':data['form']['auction_id_to'],
- 'obj_ret':None,
- 'obj_price':None,
- 'ach_login':None,
- 'ach_uid':None,
- 'ach_inv_id':None,
- 'sel_inv_id':None,
- 'state':'draft'})
-
- # new_id = self.pool.get('auction.lot.history').copy(cr, uid, m.id, {'price': recs.obj_ret, 'name': 'reasons'+recs.auction_id.name})
- # new_id=pooler.get_pool(cr.dbname).get('auction.lot.history').create(cr,uid,{'auction_id':rec.auction_id,'lot_id':rec.name,'price': rec.obj_ret, 'name': 'reasons'+rec.auction_id.auction1})
- return {}
-
-class transfer_object(wizard.interface):
- states = {
- 'init' : {
- 'actions' : [_start],
- 'result' : {'type' : 'form',
- 'arch' : transfer_unsold_object_form,
- 'fields' :transfer_unsold_object_fields,
- 'state' : [('transfer', 'Transfer'),('end', 'Cancel') ]}
- },
- 'transfer' : {
- 'actions' : [_transfer_unsold_object],
- 'result' : {'type' : 'state','state' : 'end'}
- },
- }
-transfer_object('auction.lots.transfer.unsold.object')
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/mrp/__terp__.py b/addons/mrp/__terp__.py
index acf25b160e0..a69e8ce4025 100644
--- a/addons/mrp/__terp__.py
+++ b/addons/mrp/__terp__.py
@@ -62,10 +62,12 @@
'mrp_data.xml',
'wizard/mrp_product_produce_view.xml',
'wizard/make_procurement_view.xml',
+ 'wizard/mrp_procurement_view.xml',
'wizard/change_production_qty_view.xml',
'wizard/orderpoint_procurement_view.xml',
'wizard/mrp_price_view.xml',
'wizard/mrp_workcenter_load_view.xml',
+# 'wizard/mrp_track_prod_view.xml',
'mrp_view.xml',
'wizard/schedulers_all_view.xml',
'mrp_wizard.xml',
diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py
index fe7d45cdb6c..9ca9fee3e91 100644
--- a/addons/mrp/mrp.py
+++ b/addons/mrp/mrp.py
@@ -65,6 +65,9 @@ mrp_workcenter()
class mrp_property_group(osv.osv):
+ """
+ Group of mrp properties.
+ """
_name = 'mrp.property.group'
_description = 'Property Group'
_columns = {
@@ -74,6 +77,9 @@ class mrp_property_group(osv.osv):
mrp_property_group()
class mrp_property(osv.osv):
+ """
+ Properties of mrp.
+ """
_name = 'mrp.property'
_description = 'Property'
_columns = {
@@ -88,6 +94,9 @@ class mrp_property(osv.osv):
mrp_property()
class mrp_routing(osv.osv):
+ """
+ For specifying the routings of workcenters.
+ """
_name = 'mrp.routing'
_description = 'Routing'
_columns = {
@@ -110,6 +119,9 @@ class mrp_routing(osv.osv):
mrp_routing()
class mrp_routing_workcenter(osv.osv):
+ """
+ Defines working cycles and hours of a workcenter using routings.
+ """
_name = 'mrp.routing.workcenter'
_description = 'Routing workcenter usage'
_columns = {
@@ -131,19 +143,22 @@ class mrp_routing_workcenter(osv.osv):
mrp_routing_workcenter()
class mrp_bom(osv.osv):
+ """
+ Defines bills of material for a product.
+ """
_name = 'mrp.bom'
_description = 'Bills of Material'
+
def _child_compute(self, cr, uid, ids, name, arg, context={}):
- """
- @param self: The object pointer.
- @param cr: A database cursor
- @param uid: ID of the user currently logged in
- @param ids: the ID of mrp.production object
- @param name:
- @param arg:
-
- @return: True
-
+ """ Gets child bom.
+ @param self: The object pointer
+ @param cr: The current row, from the database cursor,
+ @param uid: The current user ID for security checks
+ @param ids: List of selected IDs
+ @param name: Name of the field
+ @param arg: User defined argument
+ @param context: A standard dictionary for contextual values
+ @return: Dictionary of values
"""
result = {}
for bom in self.browse(cr, uid, ids, context=context):
@@ -156,8 +171,15 @@ class mrp_bom(osv.osv):
if sids:
bom2 = self.pool.get('mrp.bom').browse(cr, uid, sids[0], context=context)
result[bom.id] += map(lambda x: x.id, bom2.bom_lines)
+
return result
+
def _compute_type(self, cr, uid, ids, field_name, arg, context):
+ """ Sets particular method for the selected bom type.
+ @param field_name: Name of the field
+ @param arg: User defined argument
+ @return: Dictionary of values
+ """
res = dict(map(lambda x: (x,''), ids))
for line in self.browse(cr, uid, ids):
if line.type=='phantom' and not line.bom_id:
@@ -171,6 +193,7 @@ class mrp_bom(osv.osv):
else:
res[line.id] = 'order'
return res
+
_columns = {
'name': fields.char('Name', size=64, required=True),
'code': fields.char('Code', size=16),
@@ -233,6 +256,11 @@ class mrp_bom(osv.osv):
def onchange_product_id(self, cr, uid, ids, product_id, name, context={}):
+ """ Changes UoM and name if product_id changes.
+ @param name: Name of the field
+ @param product_id: Changed product_id
+ @return: Dictionary of changed values
+ """
if product_id:
prod=self.pool.get('product.product').browse(cr,uid,[product_id])[0]
v = {'product_uom':prod.uom_id.id}
@@ -242,6 +270,12 @@ class mrp_bom(osv.osv):
return {}
def _bom_find(self, cr, uid, product_id, product_uom, properties=[]):
+ """ Finds BoM for particular product and product uom.
+ @param product_id: Selected product.
+ @param product_uom: Unit of measure of a product.
+ @param properties: List of related properties.
+ @return: False or BoM id.
+ """
bom_result = False
# Why searching on BoM without parent ?
cr.execute('select id from mrp_bom where product_id=%s and bom_id is null order by sequence', (product_id,))
@@ -259,6 +293,15 @@ class mrp_bom(osv.osv):
return result
def _bom_explode(self, cr, uid, bom, factor, properties, addthis=False, level=0):
+ """ Finds Products and Workcenters for related BoM for manufacturing order.
+ @param bom: BoM of particular product.
+ @param factor: Factor of product UoM.
+ @param properties: A dictionary for contextual values.
+ @param addthis: If BoM found then True else False.
+ @param level: Depth level to find BoM lines starts from 10.
+ @return: result: List of dictionaries containing product details.
+ result2: List of dictionaries containing workcenter details.
+ """
factor = factor / (bom.product_efficiency or 1.0)
factor = rounding(factor, bom.product_rounding)
if factor).
+#
+# 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 .
+#
+##############################################################################
+
+import threading
+from osv import osv, fields
+
+class procurement_compute(osv.osv_memory):
+ _name = 'mrp.procurement.compute'
+ _description = 'Compute Procurement'
+
+ def _procure_calculation_procure(self, cr, uid, ids, context):
+ try:
+ proc_obj = self.pool.get('mrp.procurement')
+ proc_obj._procure_confirm(cr, uid, use_new_cursor=cr.dbname, context=context)
+ finally:
+ cr.close()
+ return {}
+
+ def procure_calculation(self, cr, uid, ids, context):
+ """
+ @param self: The object pointer.
+ @param cr: A database cursor
+ @param uid: ID of the user currently logged in
+ @param ids: List of IDs selected
+ @param context: A standard dictionary
+ """
+ threaded_calculation = threading.Thread(target=self._procure_calculation_procure, args=(cr, uid, ids, context))
+ threaded_calculation.start()
+ return {}
+
+procurement_compute()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
diff --git a/addons/mrp/wizard/mrp_procurement_view.xml b/addons/mrp/wizard/mrp_procurement_view.xml
new file mode 100644
index 00000000000..6d78f89793d
--- /dev/null
+++ b/addons/mrp/wizard/mrp_procurement_view.xml
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+ Compute Procurements
+ mrp.procurement.compute
+ form
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/addons/mrp/wizard/mrp_product_produce.py b/addons/mrp/wizard/mrp_product_produce.py
index 7c77dfdee94..b64567a407a 100644
--- a/addons/mrp/wizard/mrp_product_produce.py
+++ b/addons/mrp/wizard/mrp_product_produce.py
@@ -34,15 +34,12 @@ class mrp_product_produce(osv.osv_memory):
}
def _get_product_qty(self, cr, uid, context):
- """
- To obtain product quantity
-
- @param self: The object pointer.
- @param cr: A database cursor
- @param uid: ID of the user currently logged in
- @param context: A standard dictionary
- @return: quantity
-
+ """ To obtain product quantity
+ @param self: The object pointer.
+ @param cr: A database cursor
+ @param uid: ID of the user currently logged in
+ @param context: A standard dictionary
+ @return: Quantity
"""
prod = self.pool.get('mrp.production').browse(cr, uid,
context['active_id'], context=context)
@@ -57,16 +54,13 @@ class mrp_product_produce(osv.osv_memory):
}
def do_produce(self, cr, uid, ids, context={}):
- """
- To check the product type
-
- @param self: The object pointer.
- @param cr: A database cursor
- @param uid: ID of the user currently logged in
- @param ids: the ID or list of IDs if we want more than one
- @param context: A standard dictionary
- @return:
-
+ """ To check the product type
+ @param self: The object pointer.
+ @param cr: A database cursor
+ @param uid: ID of the user currently logged in
+ @param ids: the ID or list of IDs if we want more than one
+ @param context: A standard dictionary
+ @return:
"""
prod_obj = self.pool.get('mrp.production')
move_ids = context['active_ids']
diff --git a/addons/mrp/wizard/mrp_track_prod.py b/addons/mrp/wizard/mrp_track_prod.py
new file mode 100644
index 00000000000..11e1ec32ec6
--- /dev/null
+++ b/addons/mrp/wizard/mrp_track_prod.py
@@ -0,0 +1,123 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# 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 .
+#
+##############################################################################
+
+from osv import osv, fields
+
+class mrp_track_move(osv.osv_memory):
+ _name = 'mrp.production.track'
+ _description = 'Production Track'
+
+ def view_init(self, cr, uid, fields_list, context=None):
+ """ Creates view dynamically and adding fields at runtime.
+ @param self: The object pointer.
+ @param cr: A database cursor
+ @param uid: ID of the user currently logged in
+ @param context: A standard dictionary
+ @return: New arch of view with new columns.
+ """
+ res = super(mrp_track_move, self).view_init(cr, uid, fields_list, context=context)
+ record_id = context and context.get('active_id', False) or False
+ if record_id:
+ prod_obj = self.pool.get('mrp.production')
+ try:
+ prod = prod_obj.browse(cr, uid, record_id)
+ for m in [line for line in prod.move_created_ids]:
+ if 'track%s'%(m.id) not in self._columns:
+ self._columns['track%s'%(m.id)] = fields.boolean(string=m.product_id.name)
+ except:
+ return res
+ return res
+
+ def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
+ """ Changes the view dynamically
+ @param self: The object pointer.
+ @param cr: A database cursor
+ @param uid: ID of the user currently logged in
+ @param context: A standard dictionary
+ @return: New arch of view.
+ """
+ res = super(mrp_track_move, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar,submenu=False)
+ record_id = context and context.get('active_id', False) or False
+ if record_id:
+ prod_obj = self.pool.get('mrp.production')
+ prod = prod_obj.browse(cr, uid, record_id)
+ try:
+ if prod.state != 'done':
+ res['arch'] = '''
+ '''
+ else:
+ arch_lst = ['')
+ res['arch'] = '\n'.join(arch_lst)
+ except Exception,e:
+ return res
+ return res
+
+ def track_lines(self, cr, uid, ids, context):
+ """ Tracks Finished products and splits products to finish lines.
+ @param self: The object pointer.
+ @param cr: A database cursor
+ @param uid: ID of the user currently logged in
+ @param ids: List of IDs selected
+ @param context: A standard dictionary
+ @return:
+ """
+ record_id = context and context.get('active_id', False) or False
+ assert record_id, 'Active ID not found'
+ data = self.read(cr, uid, ids[0])
+ prod_obj = self.pool.get('mrp.production')
+ prod = prod_obj.browse(cr, uid, record_id)
+ if not prod.move_created_ids and prod.state != 'done':
+ return {}
+ prodlot_obj = self.pool.get('stock.production.lot')
+ move_obj = self.pool.get('stock.move')
+ move_ids = [m.id for m in [line for line in prod.move_created_ids]]
+ for idx, move in enumerate(move_obj.browse(cr, uid, move_ids)):
+ if data['track%s' %move.id]:
+ for idx in range(int(move.product_qty)):
+ update_val = {'product_qty': 1}
+ if idx:
+ current_move = move_obj.copy(cr, uid, move.id, {'state': move.state, 'production_id': move.production_id.id})
+ else:
+ current_move = move.id
+ new_prodlot = prodlot_obj.create(cr, uid, {'name': 'PRODUCTION:%d:LOT:%d' % (record_id, idx+1), 'product_id': move.product_id.id})
+ update_val['prodlot_id'] = new_prodlot
+ move_obj.write(cr, uid, [current_move], update_val)
+ return {}
+
+mrp_track_move()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
diff --git a/addons/mrp/wizard/mrp_track_prod_view.xml b/addons/mrp/wizard/mrp_track_prod_view.xml
new file mode 100644
index 00000000000..fe2e54026a2
--- /dev/null
+++ b/addons/mrp/wizard/mrp_track_prod_view.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/addons/mrp/wizard/mrp_workcenter_load.py b/addons/mrp/wizard/mrp_workcenter_load.py
index 1b5478dcbeb..db08b170ee1 100644
--- a/addons/mrp/wizard/mrp_workcenter_load.py
+++ b/addons/mrp/wizard/mrp_workcenter_load.py
@@ -31,15 +31,12 @@ class mrp_workcenter_load(osv.osv_memory):
}
def print_report(self, cr, uid, ids, context=None):
- """
- To print the report of Work Center Load
-
- @param self: The object pointer.
- @param cr: A database cursor
- @param uid: ID of the user currently logged in
- @param context: A standard dictionary
-
- @return : Report
+ """ To print the report of Work Center Load
+ @param self: The object pointer.
+ @param cr: A database cursor
+ @param uid: ID of the user currently logged in
+ @param context: A standard dictionary
+ @return : Report
"""
datas = {'ids' : context.get('active_ids',[])}
res = self.read(cr, uid, ids, ['time_unit','measure_unit'])
diff --git a/addons/mrp/wizard/orderpoint_procurement.py b/addons/mrp/wizard/orderpoint_procurement.py
index 731c3fca440..56302660939 100644
--- a/addons/mrp/wizard/orderpoint_procurement.py
+++ b/addons/mrp/wizard/orderpoint_procurement.py
@@ -41,11 +41,11 @@ class procurement_compute(osv.osv_memory):
def _procure_calculation_orderpoint(self, cr, uid, ids, context):
"""
- @param self: The object pointer.
- @param cr: A database cursor
- @param uid: ID of the user currently logged in
- @param ids: List of IDs selected
- @param context: A standard dictionary
+ @param self: The object pointer.
+ @param cr: A database cursor
+ @param uid: ID of the user currently logged in
+ @param ids: List of IDs selected
+ @param context: A standard dictionary
"""
proc_obj = self.pool.get('mrp.procurement')
for proc in self.browse(cr, uid, ids):
@@ -55,12 +55,11 @@ class procurement_compute(osv.osv_memory):
def procure_calculation(self, cr, uid, ids, context):
"""
- @param self: The object pointer.
- @param cr: A database cursor
- @param uid: ID of the user currently logged in
- @param ids: List of IDs selected
- @param context: A standard dictionary
-
+ @param self: The object pointer.
+ @param cr: A database cursor
+ @param uid: ID of the user currently logged in
+ @param ids: List of IDs selected
+ @param context: A standard dictionary
"""
threaded_calculation = threading.Thread(target=self._procure_calculation_orderpoint, args=(cr, uid, ids, context))
threaded_calculation.start()
diff --git a/addons/mrp/wizard/schedulers_all.py b/addons/mrp/wizard/schedulers_all.py
index 62497564905..ad67b1330d0 100644
--- a/addons/mrp/wizard/schedulers_all.py
+++ b/addons/mrp/wizard/schedulers_all.py
@@ -37,11 +37,11 @@ class procurement_compute(osv.osv_memory):
def _procure_calculation_all(self, cr, uid, ids, context):
"""
- @param self: The object pointer.
- @param cr: A database cursor
- @param uid: ID of the user currently logged in
- @param ids: List of IDs selected
- @param context: A standard dictionary
+ @param self: The object pointer.
+ @param cr: A database cursor
+ @param uid: ID of the user currently logged in
+ @param ids: List of IDs selected
+ @param context: A standard dictionary
"""
proc_obj = self.pool.get('mrp.procurement')
for proc in self.browse(cr, uid, ids):
@@ -51,11 +51,11 @@ class procurement_compute(osv.osv_memory):
def procure_calculation(self, cr, uid, ids, context):
"""
- @param self: The object pointer.
- @param cr: A database cursor
- @param uid: ID of the user currently logged in
- @param ids: List of IDs selected
- @param context: A standard dictionary
+ @param self: The object pointer.
+ @param cr: A database cursor
+ @param uid: ID of the user currently logged in
+ @param ids: List of IDs selected
+ @param context: A standard dictionary
"""
threaded_calculation = threading.Thread(target=self._procure_calculation_all, args=(cr, uid, ids, context))
threaded_calculation.start()
diff --git a/addons/mrp/wizard/wizard_procurement.py b/addons/mrp/wizard/wizard_procurement.py
deleted file mode 100644
index af43437cc52..00000000000
--- a/addons/mrp/wizard/wizard_procurement.py
+++ /dev/null
@@ -1,64 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# 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 .
-#
-##############################################################################
-
-import wizard
-import threading
-import pooler
-
-parameter_form = '''
-'''
-
-parameter_fields = {
-}
-
-def _procure_calculation_procure(self, db_name, uid, data, context):
- db, pool = pooler.get_db_and_pool(db_name)
- cr = db.cursor()
- try:
- proc_obj = pool.get('mrp.procurement')
- proc_obj._procure_confirm(cr, uid, use_new_cursor=cr.dbname, context=context)
- finally:
- cr.close()
- return {}
-
-def _procure_calculation(self, cr, uid, data, context):
- threaded_calculation = threading.Thread(target=_procure_calculation_procure, args=(self, cr.dbname, uid, data, context))
- threaded_calculation.start()
- return {}
-
-class procurement_compute(wizard.interface):
- states = {
- 'init': {
- 'actions': [],
- 'result': {'type': 'form', 'arch':parameter_form, 'fields': parameter_fields, 'state':[('end','Cancel'),('compute','Compute Requisitions') ]}
- },
- 'compute': {
- 'actions': [_procure_calculation],
- 'result': {'type': 'state', 'state':'end'}
- },
- }
-procurement_compute('mrp.procurement.compute')
-
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/mrp/wizard/wizard_track_prod.py b/addons/mrp/wizard/wizard_track_prod.py
deleted file mode 100644
index c94ce47b8d8..00000000000
--- a/addons/mrp/wizard/wizard_track_prod.py
+++ /dev/null
@@ -1,104 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# 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 .
-#
-##############################################################################
-
-import wizard
-import netsvc
-import pooler
-
-import time
-from osv import osv
-from tools.misc import UpdateableStr
-
-arch = UpdateableStr()
-fields = {}
-
-def _get_moves(self, cr, uid, data, context):
- prod_obj = pooler.get_pool(cr.dbname).get('mrp.production')
- prod = prod_obj.browse(cr, uid, [data['id']])[0]
- res = {}
- fields.clear()
- if prod.state != 'done':
- arch.string = ''''''
- res['moves'] = []
- else:
- arch_lst = ['', '')
- arch.string = '\n'.join(arch_lst)
- return res
-
-def _track_lines(self, cr, uid, data, context):
- if not data['form']['moves']:
- return {}
- prodlot_obj = pooler.get_pool(cr.dbname).get('stock.production.lot')
- lot_obj = pooler.get_pool(cr.dbname).get('stock.lot')
- move_obj = pooler.get_pool(cr.dbname).get('stock.move')
-
- new_lot = lot_obj.create(cr, uid, {'name': 'PRODUCTION:%d' % data['id']})
- for idx, move in enumerate(move_obj.browse(cr, uid, data['form']['moves'])):
- if data['form']['track%s' % move.id]:
- for idx in range(move.product_qty):
- update_val = {'product_qty': 1, 'lot_id': new_lot}
- if idx:
- current_move = move_obj.copy(cr, uid, move.id, {'state': move.state, 'production_id': move.production_id.id})
- else:
- current_move = move.id
- new_prodlot = prodlot_obj.create(cr, uid, {'name': 'PRODUCTION:%d:LOT:%d' % (data['id'], idx+1)})
- update_val['prodlot_id'] = new_prodlot
- move_obj.write(cr, uid, [current_move], update_val)
- return {}
-
-class wizard_track_move(wizard.interface):
- def _next(self, cr, uid, data, context):
- prod_obj = pooler.get_pool(cr.dbname).get('mrp.production')
- prod = prod_obj.browse(cr, uid, [data['id']])[0]
- if prod.state != 'done':
- return 'notrack'
- else:
- return 'track'
- states = {
- 'init': {
- 'actions': [],
- 'result': {'type':'choice', 'next_state': _next}
- },
- 'notrack':{
- 'actions':[_get_moves],
- 'result':{'type':'form', 'arch':arch, 'fields':fields, 'state':[('end', 'Cancel')]}
- },
- 'track':{
- 'actions':[_get_moves],
- 'result': {'type':'form', 'arch':arch, 'fields':fields, 'state':[('end','Cancel'),('split','Track')]}
- },
- 'split': {
- 'actions': [_track_lines],
- 'result': {'type':'state', 'state':'end'}
- }
- }
-
-wizard_track_move('mrp.production.track')
-
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/mrp_repair/wizard/cancel_repair.py b/addons/mrp_repair/wizard/cancel_repair.py
index 91df6fb01ef..7977a8b2195 100644
--- a/addons/mrp_repair/wizard/cancel_repair.py
+++ b/addons/mrp_repair/wizard/cancel_repair.py
@@ -68,17 +68,20 @@ class repair_cancel(osv.osv_memory):
record_id = context and context.get('active_id', False) or False
res = super(repair_cancel, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar,submenu=False)
if record_id:
- repair_order = self.pool.get('mrp.repair').browse(cr, uid, record_id)
- if not repair_order.invoiced:
- res['arch'] = """
- """
+ try:
+ repair_order = self.pool.get('mrp.repair').browse(cr, uid, record_id)
+ if not repair_order.invoiced:
+ res['arch'] = """
+ """
+ except:
+ return res
return res
repair_cancel()
diff --git a/addons/point_of_sale/__terp__.py b/addons/point_of_sale/__terp__.py
index f1d847cf76d..95228bb044c 100644
--- a/addons/point_of_sale/__terp__.py
+++ b/addons/point_of_sale/__terp__.py
@@ -41,7 +41,7 @@ Main features :
'init_xml': [],
'update_xml': [
- 'security/point_of_sale_security.xml',
+ 'security/point_of_sale_security.xml',
'security/ir.model.access.csv',
'wizard/pos_details.xml',
'wizard/pos_add_product.xml',
@@ -73,7 +73,7 @@ Main features :
'statement_view.xml',
'statement_report.xml',
'statement_data.xml',
- 'statement_wizard.xml',
+ 'statement_wizard.xml',
],
'demo_xml': ['pos_demo.xml','singer_statement_demo.xml','multi_company_stock_data.xml'],
'installable': True,
diff --git a/addons/point_of_sale/pos_wizard.xml b/addons/point_of_sale/pos_wizard.xml
index 2e09b5cc9df..50e3630c4d7 100644
--- a/addons/point_of_sale/pos_wizard.xml
+++ b/addons/point_of_sale/pos_wizard.xml
@@ -10,7 +10,6 @@
-
@@ -63,12 +62,12 @@
string="Close Statements"/>-->
-
+ string="All Cashboxes Of the day"/>
diff --git a/addons/point_of_sale/report/all_closed_cashbox_of_the_day.py b/addons/point_of_sale/report/all_closed_cashbox_of_the_day.py
index f3c21da2dcb..2490d5719cd 100644
--- a/addons/point_of_sale/report/all_closed_cashbox_of_the_day.py
+++ b/addons/point_of_sale/report/all_closed_cashbox_of_the_day.py
@@ -138,6 +138,4 @@ class all_closed_cashbox_of_the_day(report_sxw.rml_parse):
res = self.cr.dictfetchall()
return res[0]['net_total'] or 0.0
-
report_sxw.report_sxw('report.all.closed.cashbox.of.the.day', 'account.bank.statement', 'addons/point_of_sale/report/all_closed_cashbox_of_the_day.rml', parser=all_closed_cashbox_of_the_day)
-
diff --git a/addons/point_of_sale/report/pos_receipt.rml b/addons/point_of_sale/report/pos_receipt.rml
index 1d5e70241c7..1d2e6edc9d0 100644
--- a/addons/point_of_sale/report/pos_receipt.rml
+++ b/addons/point_of_sale/report/pos_receipt.rml
@@ -104,9 +104,7 @@
E-mail : [[ address and address.email ]]Shop : [[ o.shop_id.name ]]Vendeur : [[ o.user_id1.name ]]
-
Date : [[ formatLang(o.date_order,date = True) ]]
-
diff --git a/addons/point_of_sale/security/ir.model.access.csv b/addons/point_of_sale/security/ir.model.access.csv
index a36d631968a..0cfc0fae9b7 100644
--- a/addons/point_of_sale/security/ir.model.access.csv
+++ b/addons/point_of_sale/security/ir.model.access.csv
@@ -28,7 +28,6 @@
"acess_pos_box_entries ","pos.box.entries ","model_pos_box_entries","point_of_sale.group_pos_user",1,0,0,0
"access_pos_box_out","pos.box.out","model_pos_box_out","point_of_sale.group_pos_user",1,0,0,0
"access_pos_details ","pos.details ","model_pos_details","point_of_sale.group_pos_user",1,0,0,0
-"access_pos_details ","pos.details ","model_pos_details","point_of_sale.group_pos_user",1,0,0,0
"access_pos_sale_user","pos.sale.user","model_pos_sale_user","point_of_sale.group_pos_user",1,0,0,0
"access_pos_sale_user","pos.sales.user.today","model_pos_sales_user_today","point_of_sale.group_pos_user",1,0,0,0
"access_pos_sales_user_today_current_user","pos.sales.user.today.current_user","model_pos_sales_user_today_current_user","point_of_sale.group_pos_user",1,0,0,0
diff --git a/addons/point_of_sale/statement_report.xml b/addons/point_of_sale/statement_report.xml
index 719729a5d45..73b2c914dd3 100644
--- a/addons/point_of_sale/statement_report.xml
+++ b/addons/point_of_sale/statement_report.xml
@@ -22,6 +22,18 @@
rml="point_of_sale/report/account_statement.rml"
/>
+
+
+
-
+ parent="menu_statement_tree_all"/>