diff --git a/addons/account/account.py b/addons/account/account.py
index 5fd45977905..004b6610cf2 100644
--- a/addons/account/account.py
+++ b/addons/account/account.py
@@ -78,7 +78,7 @@ class account_payment_term_line(osv.osv):
'value': fields.selection([('procent','Percent'),('balance','Balance'),('fixed','Fixed Amount')], 'Value',required=True),
'value_amount': fields.float('Value Amount'),
'days': fields.integer('Number of Days',required=True, help="Number of days to add before computation of the day of month."),
- 'days2': fields.integer('Day of the Month',required=True, help="Day of the month, set -1 for the last day of the current month. If it's positive, it gives the day of the next month. Set 0 for net days (otherwise it's based on the end of the month)."),
+ 'days2': fields.integer('Day of the Month',required=True, help="Day of the month, set -1 for the last day of the current month. If it's positive, it gives the day of the next month. Set 0 for net days (otherwise it's based on the beginning of the month)."),
'payment_id': fields.many2one('account.payment.term','Payment Term', required=True, select=True),
}
_defaults = {
@@ -681,6 +681,7 @@ account_fiscalyear()
class account_move(osv.osv):
_name = "account.move"
_description = "Account Entry"
+ _order = 'id desc'
def name_get(self, cursor, user, ids, context=None):
if not len(ids):
@@ -712,15 +713,15 @@ class account_move(osv.osv):
return result
_columns = {
- 'name': fields.char('Entry Number', size=64, required=True),
+ 'name': fields.char('Number', size=64, required=True),
'ref': fields.char('Ref', size=64),
'period_id': fields.many2one('account.period', 'Period', required=True, states={'posted':[('readonly',True)]}),
'journal_id': fields.many2one('account.journal', 'Journal', required=True, states={'posted':[('readonly',True)]}),
'state': fields.selection([('draft','Draft'), ('posted','Posted')], 'Status', required=True, readonly=True),
'line_id': fields.one2many('account.move.line', 'move_id', 'Entries', states={'posted':[('readonly',True)]}),
'to_check': fields.boolean('To Be Verified'),
- 'partner_id': fields.related('line_id', 'partner_id', type="many2one", relation="res.partner", string="Partner", store=True),
- 'amount': fields.function(_amount_compute, method=True, string='Amount', digits=(16,2), store=True),
+ 'partner_id': fields.related('line_id', 'partner_id', type="many2one", relation="res.partner", string="Partner"),
+ 'amount': fields.function(_amount_compute, method=True, string='Amount', digits=(16,2)),
'type': fields.selection([
('pay_voucher','Cash Payment'),
('bank_pay_voucher','Bank Payment'),
diff --git a/addons/account/account_invoice_view.xml b/addons/account/account_invoice_view.xml
index e2b06ce9b78..75dc00a0eeb 100644
--- a/addons/account/account_invoice_view.xml
+++ b/addons/account/account_invoice_view.xml
@@ -137,24 +137,26 @@
2
@@ -800,13 +799,14 @@
tree
-
-
+
+
-
+
+
@@ -824,8 +824,10 @@
-
+
+
+
@@ -1330,7 +1334,6 @@
-
diff --git a/addons/account/invoice.py b/addons/account/invoice.py
index 96da3233651..7f8f1bbb1d0 100644
--- a/addons/account/invoice.py
+++ b/addons/account/invoice.py
@@ -187,23 +187,23 @@ class account_invoice(osv.osv):
'move_id': fields.many2one('account.move', 'Invoice Movement', readonly=True, help="Link to the automatically generated account moves."),
'amount_untaxed': fields.function(_amount_all, method=True, digits=(16,2),string='Untaxed',
store={
- 'account.invoice': (lambda self, cr, uid, ids, c={}: ids, None, 10),
- 'account.invoice.tax': (_get_invoice_tax, None, 10),
- 'account.invoice.line': (_get_invoice_line, None, 10),
+ 'account.invoice': (lambda self, cr, uid, ids, c={}: ids, None, 20),
+ 'account.invoice.tax': (_get_invoice_tax, None, 20),
+ 'account.invoice.line': (_get_invoice_line, None, 20),
},
multi='all'),
'amount_tax': fields.function(_amount_all, method=True, digits=(16,2), string='Tax',
store={
- 'account.invoice': (lambda self, cr, uid, ids, c={}: ids, None, 10),
- 'account.invoice.tax': (_get_invoice_tax, None, 10),
- 'account.invoice.line': (_get_invoice_line, None, 10),
+ 'account.invoice': (lambda self, cr, uid, ids, c={}: ids, None, 20),
+ 'account.invoice.tax': (_get_invoice_tax, None, 20),
+ 'account.invoice.line': (_get_invoice_line, None, 20),
},
multi='all'),
'amount_total': fields.function(_amount_all, method=True, digits=(16,2), string='Total',
store={
- 'account.invoice': (lambda self, cr, uid, ids, c={}: ids, None, 10),
- 'account.invoice.tax': (_get_invoice_tax, None, 10),
- 'account.invoice.line': (_get_invoice_line, None, 10),
+ 'account.invoice': (lambda self, cr, uid, ids, c={}: ids, None, 20),
+ 'account.invoice.tax': (_get_invoice_tax, None, 20),
+ 'account.invoice.line': (_get_invoice_line, None, 20),
},
multi='all'),
'currency_id': fields.many2one('res.currency', 'Currency', required=True, readonly=True, states={'draft':[('readonly',False)]}),
@@ -217,8 +217,9 @@ class account_invoice(osv.osv):
'move_lines':fields.function(_get_lines , method=True,type='many2many' , relation='account.move.line',string='Move Lines'),
'residual': fields.function(_amount_residual, method=True, digits=(16,2),string='Residual',
store={
- 'account.invoice': (lambda self, cr, uid, ids, c={}: ids, None, 12),
- 'account.invoice.tax': (_get_invoice_tax, None, 12),
+ 'account.invoice': (lambda self, cr, uid, ids, c={}: ids, None, 50),
+ 'account.invoice.tax': (_get_invoice_tax, None, 50),
+ 'account.invoice.line': (_get_invoice_line, None, 50),
},
help="Remaining amount due."),
'payment_ids': fields.function(_compute_lines, method=True, relation='account.move.line', type="many2many", string='Payments'),
diff --git a/addons/account_tax_include/invoice_tax_incl.py b/addons/account_tax_include/invoice_tax_incl.py
index 68b4a944966..36abef3fe5e 100644
--- a/addons/account_tax_include/invoice_tax_incl.py
+++ b/addons/account_tax_include/invoice_tax_incl.py
@@ -107,9 +107,9 @@ class account_invoice_line(osv.osv):
return result.keys()
_columns = {
'price_subtotal': fields.function(_amount_line2, method=True, string='Subtotal w/o tax', multi='amount',
- store={'account.invoice':(_get_invoice,['price_type']), 'account.invoice.line': (lambda self,cr,uid,ids,c={}: ids, None)}),
+ store={'account.invoice':(_get_invoice,['price_type'],10), 'account.invoice.line': (lambda self,cr,uid,ids,c={}: ids, None,10)}),
'price_subtotal_incl': fields.function(_amount_line2, method=True, string='Subtotal', multi='amount',
- store={'account.invoice':(_get_invoice,['price_type']), 'account.invoice.line': (lambda self,cr,uid,ids,c={}: ids, None)}),
+ store={'account.invoice':(_get_invoice,['price_type'],10), 'account.invoice.line': (lambda self,cr,uid,ids,c={}: ids, None,10)}),
}
_defaults = {
diff --git a/addons/delivery/delivery.py b/addons/delivery/delivery.py
index 2ff5c122472..db555876467 100644
--- a/addons/delivery/delivery.py
+++ b/addons/delivery/delivery.py
@@ -38,7 +38,10 @@ class delivery_carrier(osv.osv):
if order_id:
order = sale_obj.browse(cr, uid, [order_id])[0]
carrier_grid=self.grid_get(cr,uid,[carrier.id],order.partner_shipping_id.id,context)
- price=grid_obj.get_price(cr, uid, carrier_grid, order, time.strftime('%Y-%m-%d'), context)
+ if carrier_grid:
+ price=grid_obj.get_price(cr, uid, carrier_grid, order, time.strftime('%Y-%m-%d'), context)
+ else:
+ price = 0.0
res[carrier.id]=price
return res
_columns = {
diff --git a/addons/document/ftpserver/abstracted_fs.py b/addons/document/ftpserver/abstracted_fs.py
index 9cc0f2d5868..c0f0bdf3407 100644
--- a/addons/document/ftpserver/abstracted_fs.py
+++ b/addons/document/ftpserver/abstracted_fs.py
@@ -70,6 +70,7 @@ class abstracted_fs:
# Ok
def db_list(self):
+ return pooler.pool_dic.keys()
s = netsvc.LocalService('db')
result = s.list()
self.db_name_list = []
@@ -89,8 +90,9 @@ class abstracted_fs:
finally:
if cr is not None:
cr.close()
- if db is not None:
- pooler.close_db(db_name)
+ #if db is not None:
+ # pooler.close_db(db_name)
+ print 'Return', self.db_name_list
return self.db_name_list
# Ok
diff --git a/addons/hr_attendance/__terp__.py b/addons/hr_attendance/__terp__.py
index 10abc85aa66..3ffc44ac9a7 100644
--- a/addons/hr_attendance/__terp__.py
+++ b/addons/hr_attendance/__terp__.py
@@ -21,7 +21,7 @@
##############################################################################
{
"name" : "Attendances Of Employees",
- "version" : "1.0",
+ "version" : "1.1",
"author" : "Tiny",
"category" : "Generic Modules/Human Resources",
"description": "This module aims to manage employee's attendances.",
diff --git a/addons/hr_attendance/hr_attendance_demo.xml b/addons/hr_attendance/hr_attendance_demo.xml
index 640d6b5257a..93908662470 100644
--- a/addons/hr_attendance/hr_attendance_demo.xml
+++ b/addons/hr_attendance/hr_attendance_demo.xml
@@ -1,10 +1,8 @@
-
-
-
+
-
+
sign_in
diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py
index 5935bc4aca1..331af2aeb99 100644
--- a/addons/mrp/mrp.py
+++ b/addons/mrp/mrp.py
@@ -776,7 +776,15 @@ class mrp_procurement(osv.osv):
'property_ids': fields.many2many('mrp.property', 'mrp_procurement_property_rel', 'procurement_id','property_id', 'Properties'),
'message': fields.char('Latest error', size=64),
- 'state': fields.selection([('draft','Draft'),('confirmed','Confirmed'),('exception','Exception'),('running','Running'),('cancel','Cancel'),('done','Done'),('waiting','Waiting')], 'Status')
+ 'state': fields.selection([
+ ('draft','Draft'),
+ ('confirmed','Confirmed'),
+ ('exception','Exception'),
+ ('running','Running'),
+ ('cancel','Cancel'),
+ ('ready','Ready'),
+ ('done','Done'),
+ ('waiting','Waiting')], 'Status')
}
_defaults = {
'state': lambda *a: 'draft',
@@ -1072,7 +1080,7 @@ class mrp_procurement(osv.osv):
return True
def action_check_finnished(self, cr, uid, ids):
- return True
+ return self.check_move_done(cr, uid, ids)
def action_check(self, cr, uid, ids):
ok = False
@@ -1082,17 +1090,21 @@ class mrp_procurement(osv.osv):
ok = True
return ok
+ def action_ready(self, cr, uid, ids):
+ res = self.write(cr, uid, ids, {'state':'ready'})
+ return res
+
def action_done(self, cr, uid, ids):
for procurement in self.browse(cr, uid, ids):
if procurement.move_id:
if procurement.close_move and (procurement.move_id.state <> 'done'):
self.pool.get('stock.move').action_done(cr, uid, [procurement.move_id.id])
res = self.write(cr, uid, ids, {'state':'done', 'date_close':time.strftime('%Y-%m-%d')})
-
wf_service = netsvc.LocalService("workflow")
for id in ids:
wf_service.trg_trigger(uid, 'mrp.procurement', id, cr)
return res
+
def run_scheduler(self, cr, uid, automatic=False, use_new_cursor=False, context=None):
'''
use_new_cursor: False or the dbname
diff --git a/addons/mrp/mrp_order_point.xml b/addons/mrp/mrp_order_point.xml
index aa6909e2601..ba2e56e8515 100644
--- a/addons/mrp/mrp_order_point.xml
+++ b/addons/mrp/mrp_order_point.xml
@@ -10,7 +10,7 @@
-
+
50.0
@@ -18,7 +18,7 @@
-
+
20.0
@@ -26,7 +26,7 @@
-
+
50.0
@@ -34,7 +34,7 @@
-
+
5.0
@@ -42,7 +42,7 @@
-
+
50.0
@@ -50,7 +50,7 @@
-
+
diff --git a/addons/mrp/mrp_workflow.xml b/addons/mrp/mrp_workflow.xml
index 74fe78b64c0..69c7840ceaf 100644
--- a/addons/mrp/mrp_workflow.xml
+++ b/addons/mrp/mrp_workflow.xml
@@ -185,7 +185,9 @@
- done
+ ready
+ function
+ action_ready()
@@ -301,14 +303,9 @@
- check_move_done()
- stock.move
- [move_id.id]
-
-
-
-
- check_move_cancel()
+ True
+
+
@@ -348,8 +345,8 @@
-
- not action_check_finnished()
+
+ check_move_cancel()
diff --git a/addons/product/product.py b/addons/product/product.py
index 56a96a4258d..74d9549a78c 100644
--- a/addons/product/product.py
+++ b/addons/product/product.py
@@ -337,7 +337,10 @@ class product_product(osv.osv):
pricelist = context.get('pricelist', False)
if pricelist:
for id in ids:
- price = self.pool.get('product.pricelist').price_get(cr,uid,[pricelist], id, quantity, context=context)[pricelist]
+ try:
+ price = self.pool.get('product.pricelist').price_get(cr,uid,[pricelist], id, quantity, context=context)[pricelist]
+ except:
+ price = 0.0
res[id] = price
for id in ids:
res.setdefault(id, 0.0)
diff --git a/addons/project/project_view.xml b/addons/project/project_view.xml
index 0159e019572..17813b80bdf 100644
--- a/addons/project/project_view.xml
+++ b/addons/project/project_view.xml
@@ -249,8 +249,8 @@
on_change="onchange_planned(planned_hours,effective_hours)"/>
-
-
+
+
diff --git a/addons/project_mrp/__terp__.py b/addons/project_mrp/__terp__.py
index e7e9a547a53..14ce68d725e 100644
--- a/addons/project_mrp/__terp__.py
+++ b/addons/project_mrp/__terp__.py
@@ -20,18 +20,18 @@
#
##############################################################################
{
- "name" : "Project Management - MRP Link",
+ "name" : "Project Management - MRP and Sale Integration",
"version": "1.0",
"author" : "Tiny",
"website" : "http://www.openerp.com",
"category" : "Generic Modules/Projects & Services",
"depends" : ["project", 'mrp', "sale", "mrp_jit"],
"description": """
-This module is used to automatically create tasks base on different
+This module is used to automatically create tasks based on different
procurements: sales order, manufacturing order, ...
-It is mainly used to invoices services based on tasks by doing sales
-order on services products.
+It is mainly used to invoices services based on tasks automatically
+created by sales orders.
""",
"init_xml" : [],
"demo_xml" : [],
diff --git a/addons/sale/product.py b/addons/sale/product.py
index 6b556e892d1..661dee6fa85 100644
--- a/addons/sale/product.py
+++ b/addons/sale/product.py
@@ -31,7 +31,6 @@ class product_product(osv.osv):
def _pricelist_calculate(self, cr, uid, ids, name, arg, context=None):
result = {}
- format=""
pricelist_obj=self.pool.get('product.pricelist')
if name=='pricelist_purchase':
pricelist_ids=pricelist_obj.search(cr,uid,[('type','=','purchase')])
@@ -39,17 +38,18 @@ class product_product(osv.osv):
pricelist_ids=pricelist_obj.search(cr,uid,[('type','=','sale')])
pricelist_browse=pricelist_obj.browse(cr,uid,pricelist_ids)
for product in self.browse(cr, uid, ids, context):
+ result[product.id] = ""
for pricelist in pricelist_browse:
for version in pricelist.version_id:
for items in version.items_id:
qty=items.min_quantity
- price=pricelist_obj.price_get(cr, uid,[pricelist.id],product.id,qty,partner=None, context=None)
- if name=='pricelist_purchase':
- format+=pricelist.name + "\t" +str(qty) +" \t\t" + str(price[pricelist.id]) + "\n"
- else:
- format+=pricelist.name + "\t\t\t" +str(qty) +" \t\t\t" + str(price[pricelist.id]) + "\n"
- result[product.id]=format
- format=""
+ try:
+ price=pricelist_obj.price_get(cr, uid,[pricelist.id],product.id,qty,partner=None, context=None)
+ except:
+ price = 0.0
+ result[product.id]+= ("%s (%.2f) : %.2f" % (pricelist.name,qty or 0.0,price[pricelist.id] or 0.0)) + "\n"
+ break
+ break
return result
_columns = {
diff --git a/addons/sale/product_view.xml b/addons/sale/product_view.xml
index a32b7a536f7..f61788dee04 100644
--- a/addons/sale/product_view.xml
+++ b/addons/sale/product_view.xml
@@ -10,8 +10,8 @@
-
-
+
+
diff --git a/addons/sale/sale.py b/addons/sale/sale.py
index 1889def63f1..40574cca830 100644
--- a/addons/sale/sale.py
+++ b/addons/sale/sale.py
@@ -382,7 +382,7 @@ class sale_order(osv.osv):
return inv_id
- def action_invoice_create(self, cr, uid, ids, grouped=False, states=['confirmed','done']):
+ def action_invoice_create(self, cr, uid, ids, grouped=False, states=['confirmed','done','exception']):
res = False
invoices = {}
invoice_ids = []
@@ -401,7 +401,7 @@ class sale_order(osv.osv):
for i in o.invoice_ids:
if i.state == 'draft':
return i.id
- picking_obj=self.pool.get('stock.picking')
+ picking_obj=self.pool.get('stock.picking')
for val in invoices.values():
if grouped:
res = self._make_invoice(cr, uid, val[0][0], reduce(lambda x,y: x + y, [l for o,l in val], []))
@@ -409,7 +409,7 @@ class sale_order(osv.osv):
self.write(cr, uid, [o.id], {'state' : 'progress'})
if o.order_policy=='picking':
picking_obj.write(cr,uid,map(lambda x:x.id,o.picking_ids),{'invoice_state':'invoiced'})
- cr.execute('insert into sale_order_invoice_rel (order_id,invoice_id) values (%d,%d)', (o.id, res))
+ cr.execute('insert into sale_order_invoice_rel (order_id,invoice_id) values (%s,%s)', (o.id, res))
else:
for order, il in val:
res = self._make_invoice(cr, uid, order, il)
@@ -417,7 +417,7 @@ class sale_order(osv.osv):
self.write(cr, uid, [order.id], {'state' : 'progress'})
if order.order_policy=='picking':
picking_obj.write(cr,uid,map(lambda x:x.id,order.picking_ids),{'invoice_state':'invoiced'})
- cr.execute('insert into sale_order_invoice_rel (order_id,invoice_id) values (%d,%d)', (order.id, res))
+ cr.execute('insert into sale_order_invoice_rel (order_id,invoice_id) values (%s,%s)', (order.id, res))
return res
def action_invoice_cancel(self, cr, uid, ids, context={}):
@@ -499,26 +499,24 @@ class sale_order(osv.osv):
write_cancel_ids = []
for order in self.browse(cr, uid, ids, context={}):
for line in order.order_line:
- if (not line.procurement_id) or (line.procurement_id.state=='done') or (line.procurement_id.move_id and line.procurement_id.move_id.state=='done'):
+ if (not line.procurement_id) or (line.procurement_id.state=='done'):
finished = True
+ if line.state != 'done':
+ write_done_ids.append(line.id)
else:
finished = False
if line.procurement_id:
- if (line.procurement_id.state == 'cancel') or (line.procurement_id.move_id and line.procurement_id.move_id.state=='cancel'):
+ if (line.procurement_id.state == 'cancel'):
canceled = True
- if line.state != 'cancel':
+ if line.state != 'exception':
write_cancel_ids.append(line.id)
else:
notcanceled = True
- # if a line is finished (ie its procuremnt is done or it has not procuremernt and it
- # is not already marked as done, mark it as being so...
- if ((not line.procurement_id) or line.procurement_id.state == 'done') and line.state != 'done':
- write_done_ids.append(line.id)
if write_done_ids:
self.pool.get('sale.order.line').write(cr, uid, write_done_ids, {'state': 'done'})
if write_cancel_ids:
- self.pool.get('sale.order.line').write(cr, uid, write_cancel_ids, {'state': 'cancel'})
+ self.pool.get('sale.order.line').write(cr, uid, write_cancel_ids, {'state': 'exception'})
if mode=='finished':
return finished
@@ -622,8 +620,12 @@ class sale_order(osv.osv):
if order.state=='shipping_except':
val['state'] = 'progress'
- if (order.order_policy == 'manual') and order.invoice_ids:
- val['state'] = 'manual'
+
+ if (order.order_policy == 'manual'):
+ for line in order.order_line:
+ if (not line.invoiced) and (line.state not in ('cancel','draft')):
+ val['state'] = 'manual'
+ break
self.write(cr, uid, [order.id], val)
return True
@@ -632,10 +634,18 @@ class sale_order(osv.osv):
for order in self.browse(cr, uid, ids):
val = {'shipped':True}
if order.state=='shipping_except':
- if (order.order_policy=='manual') and not order.invoice_ids:
- val['state'] = 'manual'
- else:
- val['state'] = 'progress'
+ val['state'] = 'progress'
+ if (order.order_policy == 'manual'):
+ for line in order.order_line:
+ if (not line.invoiced) and (line.state not in ('cancel','draft')):
+ val['state'] = 'manual'
+ break
+ for line in order.order_line:
+ towrite = []
+ if line.state=='exception':
+ towrite.append(line.id)
+ if towrite:
+ self.pool.get('sale.order.line').write(cr, uid, towrite, {'state':'done'},context=context)
self.write(cr, uid, [order.id], val)
return True
@@ -717,7 +727,7 @@ class sale_order_line(osv.osv):
'number_packages': fields.function(_number_packages, method=True, type='integer', string='Number packages'),
'notes': fields.text('Notes'),
'th_weight' : fields.float('Weight'),
- 'state': fields.selection([('draft','Draft'),('confirmed','Confirmed'),('done','Done'),('cancel','Canceled')], 'Status', required=True, readonly=True),
+ 'state': fields.selection([('draft','Draft'),('confirmed','Confirmed'),('done','Done'),('cancel','Canceled'),('exception','Exception')], 'Status', required=True, readonly=True),
'order_partner_id': fields.related('order_id', 'partner_id', type='many2one', relation='res.partner', string='Customer')
}
_order = 'sequence, id'
@@ -787,11 +797,17 @@ class sale_order_line(osv.osv):
'note': line.notes,
'account_analytic_id': line.order_id.project_id.id,
})
- cr.execute('insert into sale_order_line_invoice_rel (order_line_id,invoice_id) values (%d,%d)', (line.id, inv_id))
+ cr.execute('insert into sale_order_line_invoice_rel (order_line_id,invoice_id) values (%s,%s)', (line.id, inv_id))
self.write(cr, uid, [line.id], {'invoiced':True})
create_ids.append(inv_id)
return create_ids
+ def button_cancel(self, cr, uid, ids, context={}):
+ for line in self.browse(cr, uid, ids, context=context):
+ if line.invoiced:
+ raise osv.except_osv(_('Invalid action !'), _('You can not cancel a sale order line that has already been invoiced !'))
+ return self.write(cr, uid, ids, {'state':'cancel'})
+
def button_confirm(self, cr, uid, ids, context={}):
return self.write(cr, uid, ids, {'state':'confirmed'})
diff --git a/addons/sale/sale_view.xml b/addons/sale/sale_view.xml
index 41b6d336b4d..03f03ae99cf 100644
--- a/addons/sale/sale_view.xml
+++ b/addons/sale/sale_view.xml
@@ -384,11 +384,11 @@
-
+
-
+
@@ -401,7 +401,8 @@
-
+
+
diff --git a/addons/sale/wizard/wizard_sale_line_invoice.py b/addons/sale/wizard/wizard_sale_line_invoice.py
index f6dd1413c7b..15124b1113c 100644
--- a/addons/sale/wizard/wizard_sale_line_invoice.py
+++ b/addons/sale/wizard/wizard_sale_line_invoice.py
@@ -66,7 +66,7 @@ def _makeInvoices(self, cr, uid, data, context):
return inv_id
for line in pool.get('sale.order.line').browse(cr,uid,data['ids']):
- if not line.invoiced:
+ if (not line.invoiced) and (line.state not in ('draft','cancel')):
if not line.order_id.id in invoices:
invoices[line.order_id.id] = []
line_id = pool.get('sale.order.line').invoice_line_create(cr, uid,
@@ -91,7 +91,7 @@ def _makeInvoices(self, cr, uid, data, context):
il = map(lambda x: x[1], result)
res = make_invoice(order, il)
cr.execute('INSERT INTO sale_order_invoice_rel \
- (order_id,invoice_id) values (%d,%d)', (order.id, res))
+ (order_id,invoice_id) values (%s,%s)', (order.id, res))
return {}
diff --git a/addons/stock/stock.py b/addons/stock/stock.py
index 4e5463b5245..b024ee31d27 100644
--- a/addons/stock/stock.py
+++ b/addons/stock/stock.py
@@ -234,9 +234,9 @@ class stock_location(osv.osv):
result = []
amount = 0.0
for id in self.search(cr, uid, [('location_id', 'child_of', ids)]):
- cr.execute("select product_uom,sum(product_qty) as product_qty from stock_move where location_dest_id=%s and product_id=%s and state='done' group by product_uom", (id,product_id))
+ cr.execute("select product_uom,sum(product_qty) as product_qty from stock_move where location_dest_id=%s and location_id<>%s and product_id=%s and state='done' group by product_uom", (id,id,product_id))
results = cr.dictfetchall()
- cr.execute("select product_uom,-sum(product_qty) as product_qty from stock_move where location_id=%s and product_id=%s and state in ('done', 'assigned') group by product_uom", (id,product_id))
+ cr.execute("select product_uom,-sum(product_qty) as product_qty from stock_move where location_id=%s and location_dest_id<>%s and product_id=%s and state in ('done', 'assigned') group by product_uom", (id,id,product_id))
results += cr.dictfetchall()
total = 0.0
diff --git a/addons/stock/stock_view.xml b/addons/stock/stock_view.xml
index fca543de59a..e45732b4ae3 100644
--- a/addons/stock/stock_view.xml
+++ b/addons/stock/stock_view.xml
@@ -540,7 +540,10 @@
-
+
@@ -633,7 +636,10 @@
-
+
@@ -821,7 +827,10 @@
-
+
@@ -1005,7 +1014,10 @@
-
+
@@ -1220,7 +1232,10 @@
-
+