diff --git a/addons/account/invoice.py b/addons/account/invoice.py index edb44b623e8..bb2dca8b3b3 100644 --- a/addons/account/invoice.py +++ b/addons/account/invoice.py @@ -178,6 +178,7 @@ class account_invoice(osv.osv): move[line.move_id.id] = True for line in r.line_id: move[line.move_id.id] = True + invoice_ids = [] if move: invoice_ids = self.pool.get('account.invoice').search(cr, uid, [('move_id','in',move.keys())], context=context) @@ -1127,14 +1128,14 @@ class account_invoice_tax(osv.osv): if inv.type in ('out_invoice','in_invoice'): val['base_code_id'] = tax['base_code_id'] val['tax_code_id'] = tax['tax_code_id'] - val['base_amount'] = cur_obj.compute(cr, uid, inv.currency_id.id, company_currency, val['base'] * tax['base_sign'], context={'date': inv.date_invoice or time.strftime('%Y-%m-%d')}) - val['tax_amount'] = cur_obj.compute(cr, uid, inv.currency_id.id, company_currency, val['amount'] * tax['tax_sign'], context={'date': inv.date_invoice or time.strftime('%Y-%m-%d')}) + val['base_amount'] = cur_obj.compute(cr, uid, inv.currency_id.id, company_currency, val['base'] * tax['base_sign'], context={'date': inv.date_invoice or time.strftime('%Y-%m-%d')}, round=False) + val['tax_amount'] = cur_obj.compute(cr, uid, inv.currency_id.id, company_currency, val['amount'] * tax['tax_sign'], context={'date': inv.date_invoice or time.strftime('%Y-%m-%d')}, round=False) val['account_id'] = tax['account_collected_id'] or line.account_id.id else: val['base_code_id'] = tax['ref_base_code_id'] val['tax_code_id'] = tax['ref_tax_code_id'] - val['base_amount'] = cur_obj.compute(cr, uid, inv.currency_id.id, company_currency, val['base'] * tax['ref_base_sign'], context={'date': inv.date_invoice or time.strftime('%Y-%m-%d')}) - val['tax_amount'] = cur_obj.compute(cr, uid, inv.currency_id.id, company_currency, val['amount'] * tax['ref_tax_sign'], context={'date': inv.date_invoice or time.strftime('%Y-%m-%d')}) + val['base_amount'] = cur_obj.compute(cr, uid, inv.currency_id.id, company_currency, val['base'] * tax['ref_base_sign'], context={'date': inv.date_invoice or time.strftime('%Y-%m-%d')}, round=False) + val['tax_amount'] = cur_obj.compute(cr, uid, inv.currency_id.id, company_currency, val['amount'] * tax['ref_tax_sign'], context={'date': inv.date_invoice or time.strftime('%Y-%m-%d')}, round=False) val['account_id'] = tax['account_paid_id'] or line.account_id.id key = (val['tax_code_id'], val['base_code_id'], val['account_id']) @@ -1148,6 +1149,8 @@ class account_invoice_tax(osv.osv): for t in tax_grouped.values(): t['amount'] = cur_obj.round(cr, uid, cur, t['amount']) + t['base_amount'] = cur_obj.round(cr, uid, cur, t['base_amount']) + t['tax_amount'] = cur_obj.round(cr, uid, cur, t['tax_amount']) return tax_grouped def move_line_get(self, cr, uid, invoice_id): diff --git a/addons/account/product_view.xml b/addons/account/product_view.xml index cadf5d9c476..1000cef2156 100644 --- a/addons/account/product_view.xml +++ b/addons/account/product_view.xml @@ -11,8 +11,8 @@ - - + + @@ -33,8 +33,8 @@ - - + + @@ -53,8 +53,8 @@
- - + +
diff --git a/addons/document/document.py b/addons/document/document.py index 36d71c27a82..e86d90e4643 100644 --- a/addons/document/document.py +++ b/addons/document/document.py @@ -41,7 +41,7 @@ import tools def random_name(): random.seed() - d = [random.choice(string.letters) for x in xrange(10) ] + d = [random.choice(string.ascii_letters) for x in xrange(10) ] name = "".join(d) return name diff --git a/addons/hr_timesheet/hr_timesheet_report.xml b/addons/hr_timesheet/hr_timesheet_report.xml index eae167002a4..06dcd5d6d55 100644 --- a/addons/hr_timesheet/hr_timesheet_report.xml +++ b/addons/hr_timesheet/hr_timesheet_report.xml @@ -4,15 +4,15 @@ - + - + - + - + diff --git a/addons/hr_timesheet_invoice/hr_timesheet_invoice_report.xml b/addons/hr_timesheet_invoice/hr_timesheet_invoice_report.xml index 794c38abc06..5063362bb1b 100644 --- a/addons/hr_timesheet_invoice/hr_timesheet_invoice_report.xml +++ b/addons/hr_timesheet_invoice/hr_timesheet_invoice_report.xml @@ -20,7 +20,7 @@ menu="False" model="account.analytic.line" name="account.analytic.profit" - string="Timesheet profit" + string="Timesheet Profit" groups="account.group_account_manager"/> diff --git a/addons/hr_timesheet_invoice/wizard/account_analytic_profit.py b/addons/hr_timesheet_invoice/wizard/account_analytic_profit.py index ecf318d234f..9d1ac817baf 100644 --- a/addons/hr_timesheet_invoice/wizard/account_analytic_profit.py +++ b/addons/hr_timesheet_invoice/wizard/account_analytic_profit.py @@ -22,6 +22,7 @@ import wizard import datetime +import pooler form='''
@@ -34,8 +35,26 @@ form=''' class wizard_report(wizard.interface): def _date_from(*a): return datetime.datetime.today().strftime('%Y-%m-1') + def _date_to(*a): return datetime.datetime.today().strftime('%Y-%m-%d') + + def _check(self, cr, uid, data, context): + pool = pooler.get_pool(cr.dbname) + line_obj = pool.get('account.analytic.line') + product_obj = pool.get('product.product') + price_obj = pool.get('product.pricelist') + ids = line_obj.search(cr, uid, [ + ('date', '>=', data['form']['date_from']), + ('date', '<=', data['form']['date_to']), + ('journal_id', 'in', data['form']['journal_ids'][0][2]), + ('user_id', 'in', data['form']['employee_ids'][0][2]), + ]) + if not ids: + raise wizard.except_wizard(_('Data Insufficient!'), _('No Records Found for Report!')) + + return data['form'] + fields={ 'date_from':{ @@ -70,7 +89,7 @@ class wizard_report(wizard.interface): 'result':{'type':'form', 'arch':form, 'fields':fields, 'state':[('end', 'Cancel'), ('report', 'Print')]} }, 'report':{ - 'actions':[], + 'actions':[_check], 'result':{'type':'print', 'report':'account.analytic.profit', 'state':'end'} } } diff --git a/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py b/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py index a568f711874..5b19583070c 100644 --- a/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py +++ b/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py @@ -135,7 +135,7 @@ class invoice_create(wizard.interface): " AND id IN (%s)" " AND product_id=%%s" " AND to_invoice=%%s" % ','.join(['%s']*len(data['ids'])), - (account.id, data['ids'], product_id, factor_id)) + tuple([account.id]+ data['ids']+[ product_id, factor_id])) line_ids = cr.dictfetchall() note = [] for line in line_ids: diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py index 828998c4142..dea7ba4ee90 100644 --- a/addons/mrp/mrp.py +++ b/addons/mrp/mrp.py @@ -399,8 +399,8 @@ class mrp_production(osv.osv): 'product_id': fields.many2one('product.product', 'Product', required=True, domain=[('type','<>','service')]), 'product_qty': fields.float('Product Qty', required=True), 'product_uom': fields.many2one('product.uom', 'Product UOM', required=True), - 'product_uos_qty': fields.float('Product Qty'), - 'product_uos': fields.many2one('product.uom', 'Product UOM'), + 'product_uos_qty': fields.float('Product UoS Qty'), + 'product_uos': fields.many2one('product.uom', 'Product UoS'), 'location_src_id': fields.many2one('stock.location', 'Raw Materials Location', required=True, help="Location where the system will look for products used in raw materials."), diff --git a/addons/stock/product_view.xml b/addons/stock/product_view.xml index 3b49f0749f7..86711ba4029 100644 --- a/addons/stock/product_view.xml +++ b/addons/stock/product_view.xml @@ -11,8 +11,8 @@ - - + +
@@ -34,8 +34,8 @@ - - + +
@@ -50,8 +50,8 @@ 26 - - + + diff --git a/addons/stock/stock.py b/addons/stock/stock.py index acb6c3b5fe7..9285143c69e 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -395,6 +395,10 @@ class stock_picking(osv.osv): res[pick]['max_date'] = dt2 return res + def create(self, cr, user, vals, context=None): + if 'name' not in vals: + vals['name'] = self.pool.get('ir.sequence').get(cr, user, 'stock.picking') + return super(stock_picking, self).create(cr, user, vals, context) _columns = { 'name': fields.char('Reference', size=64, select=True), @@ -432,7 +436,7 @@ class stock_picking(osv.osv): select=True, required=True, readonly=True, states={'draft':[('readonly',False)]}), } _defaults = { - 'name': lambda self,cr,uid,context: self.pool.get('ir.sequence').get(cr, uid, 'stock.picking'), + 'name': lambda self,cr,uid,context: '/', 'active': lambda *a: 1, 'state': lambda *a: 'draft', 'move_type': lambda *a: 'direct', @@ -673,7 +677,7 @@ class stock_picking(osv.osv): else: invoice_vals = { 'name': picking.name, - 'origin': str(picking.name or '') + (picking.origin and (':' + picking.origin) or ''), + 'origin': (picking.name or '') + (picking.origin and (':' + picking.origin) or ''), 'type': type, 'account_id': account_id, 'partner_id': partner.id,