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..854c917ee68 100644
--- a/addons/auction/auction.py
+++ b/addons/auction/auction.py
@@ -95,6 +95,7 @@ class auction_dates(osv.osv):
RETURN: True
"""
# objects vendus mais non factures
+ #TODO: convert this query to tiny API
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 = {}
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_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_transfer_unsold_object.py b/addons/auction/wizard/auction_transfer_unsold_object.py
new file mode 100644
index 00000000000..9beb4893560
--- /dev/null
+++ b/addons/auction/wizard/auction_transfer_unsold_object.py
@@ -0,0 +1,88 @@
+# -*- 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'
+
+ 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 {}
+
+ _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,
+ }
+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..a238658302c 100644
--- a/addons/mrp/mrp.py
+++ b/addons/mrp/mrp.py
@@ -139,8 +139,8 @@ class mrp_bom(osv.osv):
@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:
+ @param name: name of the field
+ @param arg: user defined argument
@return: True
@@ -156,6 +156,7 @@ 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):
res = dict(map(lambda x: (x,''), ids))
diff --git a/addons/mrp/product.py b/addons/mrp/product.py
index 375bd0c9f46..b4cc4214d33 100644
--- a/addons/mrp/product.py
+++ b/addons/mrp/product.py
@@ -32,35 +32,42 @@ class product_product(osv.osv):
bom_obj = self.pool.get('mrp.bom')
product_uom_obj = self.pool.get('product.uom')
- def _compute_price(bom):
+ def _compute_price(bom):
+ print bom.product_id
price = 0
- if bom.bom_lines:
- for sbom in bom.bom_lines:
- price += _compute_price(sbom) * sbom.product_qty
- else:
+# if bom.bom_lines:
+# for sbom in bom.bom_lines:
+# print "--->>>" , sbom.name
+# price += _compute_price(sbom) * sbom.product_qty
+# else:
+ parent_bom = bom_obj.search(cr, uid, [('bom_id', '=', False)])
+ print "========", bom.product_id.name
+ for p in parent_bom:
+ test_obj = bom_obj.browse(cr, uid, p)
+ print test_obj
+ print "XXXXXXXXXXXXX", p, test_obj.child_ids
- no_child_bom = bom_obj.search(cr, uid, [('product_id', '=', bom.product_id.id), ('bom_id', '=', False)])
- if no_child_bom and bom.id not in no_child_bom:
- other_bom = bom_obj.browse(cr, uid, no_child_bom)[0]
- if not other_bom.product_id.calculate_price:
- price += _compute_price(other_bom) * other_bom.product_qty
- else:
- price += other_bom.product_id.standard_price
- else:
- price += bom.product_id.standard_price
-
- if bom.routing_id:
- for wline in bom.routing_id.workcenter_lines:
- wc = wline.workcenter_id
- cycle = wline.cycle_nbr
- hour = (wc.time_start + wc.time_stop + cycle * wc.time_cycle) * (wc.time_efficiency or 1.0)
- price += wc.costs_cycle * cycle + wc.costs_hour * hour
- price = product_uom_obj._compute_price(cr, uid, bom.product_uom.id, price, bom.product_id.uom_id.id)
- if bom.bom_lines:
- self.write(cr, uid, [bom.product_id.id], {'standard_price' : price/bom.product_qty})
- if bom.product_uom.id != bom.product_id.uom_id.id:
- price = product_uom_obj._compute_price(cr, uid, bom.product_uom.id, price, bom.product_id.uom_id.id)
- return price
+# if no_child_bom and bom.id not in no_child_bom:
+# other_bom = bom_obj.browse(cr, uid, no_child_bom)[0]
+# if not other_bom.product_id.calculate_price:
+# price += _compute_price(other_bom) * other_bom.product_qty
+# else:
+# price += other_bom.product_id.standard_price
+# else:
+# price += bom.product_id.standard_price
+#
+# if bom.routing_id:
+# for wline in bom.routing_id.workcenter_lines:
+# wc = wline.workcenter_id
+# cycle = wline.cycle_nbr
+# hour = (wc.time_start + wc.time_stop + cycle * wc.time_cycle) * (wc.time_efficiency or 1.0)
+# price += wc.costs_cycle * cycle + wc.costs_hour * hour
+# price = product_uom_obj._compute_price(cr, uid, bom.product_uom.id, price, bom.product_id.uom_id.id)
+# if bom.bom_lines:
+# self.write(cr, uid, [bom.product_id.id], {'standard_price' : price/bom.product_qty})
+# if bom.product_uom.id != bom.product_id.uom_id.id:
+# price = product_uom_obj._compute_price(cr, uid, bom.product_uom.id, price, bom.product_id.uom_id.id)
+# return price
bom_ids = bom_obj.search(cr, uid, [('product_id', 'in', ids)])
diff --git a/addons/mrp/wizard/__init__.py b/addons/mrp/wizard/__init__.py
index 043cdc94465..045d7f1bd71 100644
--- a/addons/mrp/wizard/__init__.py
+++ b/addons/mrp/wizard/__init__.py
@@ -21,11 +21,11 @@
import mrp_product_produce
import orderpoint_procurement
-import wizard_procurement
+import mrp_procurement
import schedulers_all
import mrp_price
import mrp_workcenter_load
-import wizard_track_prod
+#import mrp_track_prod
import change_production_qty
import make_procurement_product
diff --git a/addons/mrp/wizard/mrp_procurement.py b/addons/mrp/wizard/mrp_procurement.py
new file mode 100644
index 00000000000..1c3f3dd5c8a
--- /dev/null
+++ b/addons/mrp/wizard/mrp_procurement.py
@@ -0,0 +1,52 @@
+# -*- 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 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_track_prod.py b/addons/mrp/wizard/mrp_track_prod.py
new file mode 100644
index 00000000000..52e5508317a
--- /dev/null
+++ b/addons/mrp/wizard/mrp_track_prod.py
@@ -0,0 +1,126 @@
+# -*- 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/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"/>