diff --git a/addons/account/wizard/account_invoice_state.py b/addons/account/wizard/account_invoice_state.py
index 6b1a41f49af..c3934e38db0 100644
--- a/addons/account/wizard/account_invoice_state.py
+++ b/addons/account/wizard/account_invoice_state.py
@@ -21,6 +21,7 @@
from osv import fields, osv
from tools.translate import _
import netsvc
+import pooler
class account_invoice_confirm(osv.osv_memory):
"""
@@ -34,7 +35,12 @@ class account_invoice_confirm(osv.osv_memory):
wf_service = netsvc.LocalService('workflow')
if context is None:
context = {}
- for id in context['active_ids']:
+ pool_obj = pooler.get_pool(cr.dbname)
+ data_inv = pool_obj.get('account.invoice').read(cr, uid, context['active_ids'], ['state'], context=context)
+
+ for record in data_inv:
+ if record['state'] not in ('draft','proforma','proforma2'):
+ raise osv.except_osv(_('Warning'), _("Selected Invoice(s) cannot be confirmed as they are not in 'Draft' or 'Pro-Forma' state!"))
wf_service.trg_validate(uid, 'account.invoice', id, 'invoice_open', cr)
return {}
@@ -47,14 +53,19 @@ class account_invoice_cancel(osv.osv_memory):
"""
_name = "account.invoice.cancel"
- _description = "Cancel the selected invoices"
+ _description = "Cancel the Selected Invoices"
def invoice_cancel(self, cr, uid, ids, context=None):
- wf_service = netsvc.LocalService('workflow')
if context is None:
context = {}
- for id in context['active_ids']:
- wf_service.trg_validate(uid, 'account.invoice', id, 'invoice_cancel', cr)
+ wf_service = netsvc.LocalService('workflow')
+ pool_obj = pooler.get_pool(cr.dbname)
+ data_inv = pool_obj.get('account.invoice').read(cr, uid, context['active_ids'], ['state'], context=context)
+
+ for record in data_inv:
+ if record['state'] in ('cancel','paid'):
+ raise osv.except_osv(_('Warning'), _("Selected Invoice(s) cannot be cancelled as they are already in 'Cancelled' or 'Done' state!"))
+ wf_service.trg_validate(uid, 'account.invoice', record['id'], 'invoice_cancel', cr)
return {}
account_invoice_cancel()
diff --git a/addons/account/wizard/account_invoice_state_view.xml b/addons/account/wizard/account_invoice_state_view.xml
index 8748edbb688..d83c0c6f2dc 100644
--- a/addons/account/wizard/account_invoice_state_view.xml
+++ b/addons/account/wizard/account_invoice_state_view.xml
@@ -6,10 +6,10 @@
account.invoice.confirm
form
-
@@ -17,7 +17,7 @@
- Confirm draft invoices
+ Confirm Draft Invoices
account.invoice.confirm
form
form
@@ -28,7 +28,7 @@
- Confirm draft invoices
+ Confirm Draft Invoices
client_action_multi
action
@@ -40,18 +40,18 @@
account.invoice.cancel
form
-
- Cancel selected invoices
+ Cancel Selected Invoices
account.invoice.cancel
form
form
@@ -62,7 +62,7 @@
- Cancel selected invoices
+ Cancel Selected Invoices
client_action_multi
action
diff --git a/addons/point_of_sale/__init__.py b/addons/point_of_sale/__init__.py
index 8b041be5801..31c55fc965f 100644
--- a/addons/point_of_sale/__init__.py
+++ b/addons/point_of_sale/__init__.py
@@ -26,7 +26,5 @@ import stock
import wizard
import report
-
-
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/point_of_sale/pos.py b/addons/point_of_sale/pos.py
index a59ae6e9d5b..8b31c3348d3 100644
--- a/addons/point_of_sale/pos.py
+++ b/addons/point_of_sale/pos.py
@@ -287,7 +287,7 @@ class pos_order(osv.osv):
'date_payment': fields.function(_get_date_payment2, method=True, string='Payment Date', type='date', store=True),
'date_validity': fields.date('Validity Date', required=True),
'user_id': fields.many2one('res.users', 'Connected Salesman', readonly=True),
- 'user_saleman': fields.many2one('res.users', 'Salesman', required=True),
+ 'user_salesman_id': fields.many2one('res.users', 'Salesman', required=True),
'sale_manager': fields.many2one('res.users', 'Salesman Manager'),
'amount_tax': fields.function(_amount_all, method=True, string='Taxes',digits_compute=dp.get_precision('Point Of Sale'), multi='all'),
'amount_total': fields.function(_amount_total, method=True, string='Total'),
@@ -702,7 +702,7 @@ class pos_order(osv.osv):
inv_ids = []
for order in self.browse(cr, uid, ids, context):
- curr_c = order.user_saleman.company_id
+ curr_c = order.user_salesman_id.company_id
if order.invoice_id:
inv_ids.append(order.invoice_id.id)
continue
@@ -979,8 +979,8 @@ class pos_order(osv.osv):
create_contract_nb = True
break
if create_contract_nb:
- seq = sequence_obj.get(cr, uid, 'pos.user_%s' % pos.user_saleman.login)
- vals['contract_number'] ='%s-%s' % (pos.user_saleman.login, seq)
+ seq = sequence_obj.get(cr, uid, 'pos.user_%s' % pos.user_salesman_id.login)
+ vals['contract_number'] ='%s-%s' % (pos.user_salesman_id.login, seq)
self.write(cr, uid, ids, vals)
def action_paid(self, cr, uid, ids, context=None):
@@ -1322,4 +1322,4 @@ class product_product(osv.osv):
'disc_controle': lambda *a: True,
}
product_product()
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/point_of_sale/pos_demo.xml b/addons/point_of_sale/pos_demo.xml
index f3573abc791..b75f4362578 100644
--- a/addons/point_of_sale/pos_demo.xml
+++ b/addons/point_of_sale/pos_demo.xml
@@ -57,7 +57,7 @@
-
+
@@ -93,7 +93,7 @@
-
+
@@ -135,7 +135,7 @@
-
+
diff --git a/addons/point_of_sale/pos_view.xml b/addons/point_of_sale/pos_view.xml
index f32c23b92ff..4958afc82fd 100644
--- a/addons/point_of_sale/pos_view.xml
+++ b/addons/point_of_sale/pos_view.xml
@@ -11,7 +11,7 @@
-
+
diff --git a/addons/point_of_sale/report/pos_receipt.rml b/addons/point_of_sale/report/pos_receipt.rml
index 807d9e497d6..d615fc74534 100644
--- a/addons/point_of_sale/report/pos_receipt.rml
+++ b/addons/point_of_sale/report/pos_receipt.rml
@@ -103,7 +103,7 @@
Tel : [[ address and address.phone ]]
E-mail : [[ address and address.email ]]
Shop : [[ o.shop_id.name ]]
- Vendeur : [[ o.user_saleman.name ]]
+ Vendeur : [[ o.user_salesman_id.name ]]
Date : [[ formatLang(o.date_order,date = True) ]]