diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py
index fd10dff1c95..272933018ad 100644
--- a/addons/account/account_move_line.py
+++ b/addons/account/account_move_line.py
@@ -790,7 +790,7 @@ class account_move_line(osv.osv):
result = super(osv.osv, self).fields_view_get(cr, uid, view_id,view_type,context,toolbar=toolbar, submenu=submenu)
if view_type != 'tree':
return result
-
+
fld = []
fields = {}
flds = []
@@ -800,12 +800,12 @@ class account_move_line(osv.osv):
ids = journal_pool.search(cr, uid, [])
journals = journal_pool.browse(cr, uid, ids)
- all_journal = []
+ all_journal = [None]
for journal in journals:
all_journal.append(journal.id)
for field in journal.view_id.columns_id:
if not field.field in fields:
- fields[field.field] = [journal.id]
+ fields[field.field] = [None, journal.id]
fld.append((field.field, field.sequence))
flds.append(field.field)
else:
diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml
index fb449ba722f..809927dbabf 100644
--- a/addons/account/account_view.xml
+++ b/addons/account/account_view.xml
@@ -952,7 +952,7 @@
-
+
diff --git a/addons/account_voucher_payment/__init__.py b/addons/account_voucher_payment/__init__.py
index 75d9f73de64..ad7558e11ee 100755
--- a/addons/account_voucher_payment/__init__.py
+++ b/addons/account_voucher_payment/__init__.py
@@ -19,6 +19,6 @@
#
##############################################################################
import account_voucher_payment
-import account_voucher_unreconcile
+import wizard
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/account_voucher_payment/__openerp__.py b/addons/account_voucher_payment/__openerp__.py
index bb1dfcc0d15..6d5e4d85f57 100755
--- a/addons/account_voucher_payment/__openerp__.py
+++ b/addons/account_voucher_payment/__openerp__.py
@@ -38,8 +38,9 @@
"demo_xml" : [],
"update_xml" : [
- "account_voucher_payment_wizard.xml",
- "account_voucher_payment_view.xml"
+ "wizard/account_voucher_unreconcile_view.xml",
+ "account_voucher_payment_view.xml",
+
],
"test" : [
# "test/account_voucher.yml",
diff --git a/addons/account_voucher_payment/account_voucher_payment_view.xml b/addons/account_voucher_payment/account_voucher_payment_view.xml
index 7969e9dbfca..5d611131527 100755
--- a/addons/account_voucher_payment/account_voucher_payment_view.xml
+++ b/addons/account_voucher_payment/account_voucher_payment_view.xml
@@ -70,7 +70,7 @@
diff --git a/addons/account_voucher_payment/account_voucher_payment_wizard.xml b/addons/account_voucher_payment/account_voucher_payment_wizard.xml
deleted file mode 100644
index 2f961994fbd..00000000000
--- a/addons/account_voucher_payment/account_voucher_payment_wizard.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
diff --git a/addons/account_voucher_payment/account_voucher_unreconcile.py b/addons/account_voucher_payment/account_voucher_unreconcile.py
deleted file mode 100644
index f36af98dc1c..00000000000
--- a/addons/account_voucher_payment/account_voucher_unreconcile.py
+++ /dev/null
@@ -1,56 +0,0 @@
-# -*- encoding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2009 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 pooler
-
-_info_form = '''
-'''
-
-def _trans_unrec(self, cr, uid, data, context):
- pool = pooler.get_pool(cr.dbname)
- voucher = pool.get('account.voucher').browse(cr, uid, data.get('id'))
- recs = []
- for line in voucher.move_ids:
- if line.reconcile_id:
- recs = [line.reconcile_id.id]
-
- for rec in recs:
- pool.get('account.move.reconcile').unlink(cr, uid, rec)
- return {}
-
-class wiz_unreconcile(wizard.interface):
- states = {
- 'init': {
- 'actions': [],
- 'result': {'type': 'form', 'arch': _info_form, 'fields': {}, 'state':[('end', 'Cancel'), ('unrec', 'Unreconcile')]}
- },
- 'unrec': {
- 'actions': [_trans_unrec],
- 'result': {'type': 'state', 'state':'end'}
- }
- }
-wiz_unreconcile('account.voucher.unreconcile')
-
diff --git a/addons/account_voucher_payment/wizard/__init__.py b/addons/account_voucher_payment/wizard/__init__.py
new file mode 100644
index 00000000000..32ab938c5a6
--- /dev/null
+++ b/addons/account_voucher_payment/wizard/__init__.py
@@ -0,0 +1,24 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2009 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 account_voucher_unreconcile
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/account_voucher_payment/wizard/account_voucher_unreconcile.py b/addons/account_voucher_payment/wizard/account_voucher_unreconcile.py
new file mode 100644
index 00000000000..d6f468a1ab2
--- /dev/null
+++ b/addons/account_voucher_payment/wizard/account_voucher_unreconcile.py
@@ -0,0 +1,46 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2009 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 fields, osv
+
+class account_voucher_unreconcile(osv.osv_memory):
+ _name = "account.voucher.unreconcile"
+ _description = "Account voucher unreconcile"
+
+ def trans_unrec(self, cr, uid, ids, context=None):
+ if context is None:
+ context = {}
+ obj_voucher = self.pool.get('account.voucher')
+ obj_reconcile = self.pool.get('account.move.reconcile')
+ if context.get('active_id'):
+ voucher = obj_voucher.browse(cr, uid, context.get('active_id'), context=context)
+ recs = []
+ for line in voucher.move_ids:
+ if line.reconcile_id:
+ recs = [line.reconcile_id.id]
+
+ for rec in recs:
+ obj_reconcile.unlink(cr, uid, rec)
+
+ return {}
+
+account_voucher_unreconcile()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/account_voucher_payment/wizard/account_voucher_unreconcile_view.xml b/addons/account_voucher_payment/wizard/account_voucher_unreconcile_view.xml
new file mode 100644
index 00000000000..70c54e61b70
--- /dev/null
+++ b/addons/account_voucher_payment/wizard/account_voucher_unreconcile_view.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+ Account voucher unreconcile
+ account.voucher.unreconcile
+ form
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/addons/purchase_requisition/purchase_requisition.py b/addons/purchase_requisition/purchase_requisition.py
index 7ea7e4d6a56..64ca0b312be 100644
--- a/addons/purchase_requisition/purchase_requisition.py
+++ b/addons/purchase_requisition/purchase_requisition.py
@@ -20,10 +20,11 @@
#
##############################################################################
+import time
+
from osv import fields,osv
from osv import orm
import netsvc
-import time
from tools.translate import _
class purchase_requisition(osv.osv):
@@ -43,16 +44,16 @@ class purchase_requisition(osv.osv):
'state': fields.selection([('draft','Draft'),('in_progress','In Progress'),('cancel','Cancelled'),('done','Done')], 'State', required=True)
}
_defaults = {
- 'date_start': lambda *args: time.strftime('%Y-%m-%d %H:%M:%S'),
- 'state': lambda *args: 'draft',
- 'exclusive': lambda *args: 'multiple',
+ 'date_start': time.strftime('%Y-%m-%d %H:%M:%S'),
+ 'state': 'draft',
+ 'exclusive': 'multiple',
'company_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id,
'user_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).id ,
'name': lambda obj, cr, uid, context: obj.pool.get('ir.sequence').get(cr, uid, 'purchase.order.requisition'),
}
- def tender_cancel(self, cr, uid, ids, context={}):
+ def tender_cancel(self, cr, uid, ids, context=None):
purchase_order_obj = self.pool.get('purchase.order')
for purchase in self.browse(cr, uid, ids):
for purchase_id in purchase.purchase_ids:
@@ -61,32 +62,30 @@ class purchase_requisition(osv.osv):
self.write(cr, uid, ids, {'state': 'cancel'})
for (id,name) in self.name_get(cr, uid, ids):
message = _('Tender') + " '" + name + "' "+ _("is cancelled")
- self.log(cr, uid, id, message)
+ self.log(cr, uid, id, message)
return True
- def tender_in_progress(self, cr, uid, ids, context={}):
+ def tender_in_progress(self, cr, uid, ids, context=None):
for quotations in self.browse(cr, uid, ids):
if not quotations.purchase_ids:
raise osv.except_osv(_('Purchase order required'),('You should have atleast one purchase order line defined for this tender'))
self.write(cr, uid, ids, {'state':'in_progress'} ,context=context)
for (id,name) in self.name_get(cr, uid, ids):
message = _('Tender') + " '" + name + "' "+ _(" is In Progress")
- self.log(cr, uid, id, message)
+ self.log(cr, uid, id, message)
return True
- def tender_reset(self, cr, uid, ids, context={}):
+ def tender_reset(self, cr, uid, ids, context=None):
self.write(cr, uid, ids, {'state': 'draft'})
for (id,name) in self.name_get(cr, uid, ids):
message = _('Tender') + " '" + name + "' "+ _("is in draft state")
- self.log(cr, uid, id, message)
+ self.log(cr, uid, id, message)
return True
- def tender_done(self, cr, uid, ids, context={}):
+ def tender_done(self, cr, uid, ids, context=None):
self.write(cr, uid, ids, {'state':'done', 'date_end':time.strftime('%Y-%m-%d %H:%M:%S')}, context=context)
for (id,name) in self.name_get(cr, uid, ids):
message = _('Tender') + " '" + name + "' "+ _("is done")
- self.log(cr, uid, id, message)
+ self.log(cr, uid, id, message)
return True
-
-
purchase_requisition()
class purchase_requisition_line(osv.osv):
@@ -102,7 +101,7 @@ class purchase_requisition_line(osv.osv):
'requisition_id' : fields.many2one('purchase.requisition','Purchase Requisition', ondelete='cascade')
}
- def onchange_product_id(self, cr, uid, ids, product_id,product_uom_id, context={}):
+ def onchange_product_id(self, cr, uid, ids, product_id,product_uom_id, context=None):
""" Changes UoM and name if product_id changes.
@param name: Name of the field
@@ -147,7 +146,7 @@ class product_product(osv.osv):
'purchase_requisition': fields.boolean('Purchase Requisition', help="Check this box so that requisitions generates purchase requisitions instead of directly requests for quotations.")
}
_defaults = {
- 'purchase_requisition': lambda *args: False
+ 'purchase_requisition': False
}
product_product()
@@ -174,3 +173,5 @@ class procurement_order(osv.osv):
})
return res
procurement_order()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/purchase_requisition/wizard/purchase_requisition_partner.py b/addons/purchase_requisition/wizard/purchase_requisition_partner.py
index 3f74e857035..9473fe11889 100644
--- a/addons/purchase_requisition/wizard/purchase_requisition_partner.py
+++ b/addons/purchase_requisition/wizard/purchase_requisition_partner.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
-#
+#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL ().
#
@@ -15,16 +15,17 @@
# 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 .
+# along with this program. If not, see .
#
##############################################################################
+import time
+from mx import DateTime
+
from osv import fields, osv
from service import web_services
import netsvc
import pooler
-import time
-from mx import DateTime
from osv.orm import browse_record, browse_null
class purchase_requisition_partner(osv.osv_memory):
@@ -33,38 +34,37 @@ class purchase_requisition_partner(osv.osv_memory):
_columns = {
'partner_id': fields.many2one('res.partner', 'Partner', required=True,domain=[('supplier', '=', True)]),
'partner_address_id':fields.many2one('res.partner.address', 'Address', required=True),
- }
+ }
-
def view_init(self, cr, uid, fields_list, context=None):
res = super(purchase_requisition_partner, self).view_init(cr, uid, fields_list, context=context)
- record_id = context and context.get('active_id', False) or False
+ record_id = context and context.get('active_id', False) or False
tender = self.pool.get('purchase.requisition').browse(cr, uid, record_id)
if not tender.line_ids:
- raise osv.except_osv('Error!','No Product in Tender')
+ raise osv.except_osv('Error!','No Product in Tender')
True
def onchange_partner_id(self, cr, uid, ids, partner_id):
addr = self.pool.get('res.partner').address_get(cr, uid, [partner_id], ['default'])
part = self.pool.get('res.partner').browse(cr, uid, partner_id)
return {'value':{'partner_address_id': addr['default']}}
-
+
def create_order(self, cr, uid, ids, context):
- """
+ """
To Create a purchase orders .
-
+
@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
- @param context: A standard dictionary
+ @param ids: the ID or list of IDs
+ @param context: A standard dictionary
@return: {}
-
- """
+
+ """
record_ids = context and context.get('active_ids', False)
if record_ids:
data = self.read(cr, uid, ids)
- company = self.pool.get('res.users').browse(cr, uid, uid, context).company_id
+ company = self.pool.get('res.users').browse(cr, uid, uid, context).company_id
order_obj = self.pool.get('purchase.order')
order_line_obj = self.pool.get('purchase.order.line')
partner_obj = self.pool.get('res.partner')
@@ -72,29 +72,29 @@ class purchase_requisition_partner(osv.osv_memory):
pricelist_obj = self.pool.get('product.pricelist')
prod_obj = self.pool.get('product.product')
tender_obj = self.pool.get('purchase.requisition')
- acc_pos_obj = self.pool.get('account.fiscal.position')
+ acc_pos_obj = self.pool.get('account.fiscal.position')
partner_id = data[0]['partner_id']
-
+
supplier_data = partner_obj.browse(cr, uid,[ partner_id])[0]
address_id = partner_obj.address_get(cr, uid, [partner_id], ['delivery'])['delivery']
list_line=[]
purchase_order_line={}
for tender in tender_obj.browse(cr, uid, record_ids):
- for line in tender.line_ids:
+ for line in tender.line_ids:
partner_list = sorted([(partner.sequence, partner) for partner in line.product_id.seller_ids if partner])
partner_rec = partner_list and partner_list[0] and partner_list[0][1] or False
- uom_id = line.product_id.uom_po_id and line.product_id.uom_po_id.id or False
+ uom_id = line.product_id.uom_po_id and line.product_id.uom_po_id.id or False
newdate = DateTime.strptime(tender.date_start, '%Y-%m-%d %H:%M:%S')
newdate = newdate - DateTime.RelativeDateTime(days=company.po_lead)
delay = partner_rec and partner_rec.delay or False
newdate = newdate -(delay or DateTime.strptime(tender.date_start, '%Y-%m-%d %H:%M:%S') )
partner = partner_rec and partner_rec.name or supplier_data
- pricelist_id = partner.property_product_pricelist_purchase and partner.property_product_pricelist_purchase.id or False
+ pricelist_id = partner.property_product_pricelist_purchase and partner.property_product_pricelist_purchase.id or False
price = pricelist_obj.price_get(cr, uid, [pricelist_id], line.product_id.id, line.product_qty, False, {'uom': uom_id})[pricelist_id]
product = prod_obj.browse(cr, uid, line.product_id.id, context=context)
-
-
+
+
purchase_order_line= {
'name': product.partner_ref,
'product_qty': line.product_qty,
@@ -108,14 +108,14 @@ class purchase_requisition_partner(osv.osv_memory):
taxes = acc_pos_obj.map_tax(cr, uid, partner.property_account_position, taxes_ids)
purchase_order_line.update({
'taxes_id': [(6,0,taxes)]
- })
+ })
list_line.append(purchase_order_line)
purchase_id = order_obj.create(cr, uid, {
'origin': tender.purchase_ids and tender.purchase_ids[0].origin or tender.name,
'partner_id': partner_id,
'partner_address_id': address_id,
'pricelist_id': pricelist_id,
- 'location_id': tender.purchase_ids and tender.purchase_ids[0].location_id.id or line.product_id.product_tmpl_id.property_stock_production.id,
+ 'location_id': tender.purchase_ids and tender.purchase_ids[0].location_id.id or line.product_id.product_tmpl_id.property_stock_production.id,
'company_id': tender.company_id.id,
'fiscal_position': partner.property_account_position and partner.property_account_position.id or False,
'requisition_id':tender.id,
@@ -124,9 +124,11 @@ class purchase_requisition_partner(osv.osv_memory):
for order_line in list_line:
order_line.update({
'order_id': purchase_id
- })
+ })
order_line_obj.create(cr,uid,order_line)
- return {}
+ return {}
purchase_requisition_partner()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: