diff --git a/addons/account/account_invoice.py b/addons/account/account_invoice.py index 7bc9ceaaf61..78ef090ebbe 100644 --- a/addons/account/account_invoice.py +++ b/addons/account/account_invoice.py @@ -1361,10 +1361,16 @@ class account_invoice_line(osv.osv): 'company_id': fields.related('invoice_id','company_id',type='many2one',relation='res.company',string='Company', store=True, readonly=True), 'partner_id': fields.related('invoice_id','partner_id',type='many2one',relation='res.partner',string='Partner',store=True) } + + def _default_account_id(self, cr, uid, ids, context=None): + prop = self.pool.get('ir.property').get(cr, uid, 'property_account_income_categ', 'product.category', context=context) + return prop and prop.id or False + _defaults = { 'quantity': 1, 'discount': 0.0, 'price_unit': _price_unit_default, + 'account_id': _default_account_id, } def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): @@ -1473,10 +1479,11 @@ class account_invoice_line(osv.osv): prod = self.pool.get('product.product').browse(cr, uid, product, context=context) prod_uom = self.pool.get('product.uom').browse(cr, uid, uom, context=context) if prod.uom_id.category_id.id != prod_uom.category_id.id: - warning = { + warning = { 'title': _('Warning!'), 'message': _('The selected unit of measure is not compatible with the unit of measure of the product.') - } + } + res['value'].update({'uos_id': prod.uom_id.id}) return {'value': res['value'], 'warning': warning} return res diff --git a/addons/account/account_invoice_view.xml b/addons/account/account_invoice_view.xml index 143c5514141..610485ec3a0 100644 --- a/addons/account/account_invoice_view.xml +++ b/addons/account/account_invoice_view.xml @@ -191,17 +191,23 @@ - - - - + + + + + + + + - - - - @@ -342,17 +348,22 @@ - - + + + + diff --git a/addons/account/demo/account_minimal.xml b/addons/account/demo/account_minimal.xml index b7bc34a3e35..94b3d2d4085 100644 --- a/addons/account/demo/account_minimal.xml +++ b/addons/account/demo/account_minimal.xml @@ -383,7 +383,7 @@ cash - + diff --git a/addons/account/wizard/pos_box.py b/addons/account/wizard/pos_box.py index b4254b5ba84..b5d1cc37776 100644 --- a/addons/account/wizard/pos_box.py +++ b/addons/account/wizard/pos_box.py @@ -40,6 +40,10 @@ class CashBox(osv.osv_memory): return {} + def _create_bank_statement_line(self, cr, uid, box, record, context=None): + values = self._compute_values_for_statement_line(cr, uid, box, record, context=context) + return self.pool.get('account.bank.statement.line').create(cr, uid, values, context=context) + class CashBoxIn(CashBox): _name = 'cash.box.in' @@ -49,30 +53,24 @@ class CashBoxIn(CashBox): 'ref' : fields.char('Reference', size=32), }) - def _create_bank_statement_line(self, cr, uid, box, record, context=None): - absl_proxy = self.pool.get('account.bank.statement.line') - - values = { + def _compute_values_for_statement_line(self, cr, uid, box, record, context=None): + return { 'statement_id' : record.id, 'journal_id' : record.journal_id.id, 'account_id' : record.journal_id.internal_account_id.id, 'amount' : box.amount or 0.0, - 'ref' : "%s" % (box.ref or ''), + 'ref' : '%s' % (box.ref or ''), 'name' : box.name, } - return absl_proxy.create(cr, uid, values, context=context) - CashBoxIn() class CashBoxOut(CashBox): _name = 'cash.box.out' - def _create_bank_statement_line(self, cr, uid, box, record, context=None): - absl_proxy = self.pool.get('account.bank.statement.line') - + def _compute_values_for_statement_line(self, cr, uid, box, record, context=None): amount = box.amount or 0.0 - values = { + return { 'statement_id' : record.id, 'journal_id' : record.journal_id.id, 'account_id' : record.journal_id.internal_account_id.id, @@ -80,6 +78,4 @@ class CashBoxOut(CashBox): 'name' : box.name, } - return absl_proxy.create(cr, uid, values, context=context) - CashBoxOut() diff --git a/addons/auth_openid/static/src/xml/auth_openid.xml b/addons/auth_openid/static/src/xml/auth_openid.xml index aa61d161657..6a40439a012 100644 --- a/addons/auth_openid/static/src/xml/auth_openid.xml +++ b/addons/auth_openid/static/src/xml/auth_openid.xml @@ -4,7 +4,7 @@ -