[MERGE] Merge with lp:~openerp-dev/openobject-addons/trunk-dev-addons1
bzr revid: sbh@tinyerp.com-20100505104757-a2seu27d7313d192
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
<field name="model">account.invoice.confirm</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Confirm draft invoices">
|
||||
<separator string="Confirm draft invoices" colspan="4"/>
|
||||
<form string="Confirm Draft Invoices">
|
||||
<separator string="Confirm Draft Invoices" colspan="4"/>
|
||||
<group colspan="4" col="6">
|
||||
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
|
||||
<button icon="gtk-cancel" special="cancel" string="Close"/>
|
||||
<button icon="gtk-execute" string="Confirm Invoices" name="invoice_confirm" type="object" default_focus="1"/>
|
||||
</group>
|
||||
</form>
|
||||
@@ -17,7 +17,7 @@
|
||||
</record>
|
||||
|
||||
<record id="action_account_invoice_confirm" model="ir.actions.act_window">
|
||||
<field name="name">Confirm draft invoices</field>
|
||||
<field name="name">Confirm Draft Invoices</field>
|
||||
<field name="res_model">account.invoice.confirm</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
@@ -28,7 +28,7 @@
|
||||
<record model="ir.values" id="action_account_invoice_confirm_values">
|
||||
<field name="model_id" ref="account.model_account_invoice" />
|
||||
<field name="object" eval="1" />
|
||||
<field name="name">Confirm draft invoices</field>
|
||||
<field name="name">Confirm Draft Invoices</field>
|
||||
<field name="key2">client_action_multi</field>
|
||||
<field name="value" eval="'ir.actions.act_window,' +str(ref('action_account_invoice_confirm'))" />
|
||||
<field name="key">action</field>
|
||||
@@ -40,18 +40,18 @@
|
||||
<field name="model">account.invoice.cancel</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Cancel selected invoices">
|
||||
<separator string="Cancel selected invoices" colspan="4"/>
|
||||
<form string="Cancel Selected Invoices">
|
||||
<separator string="Cancel Selected Invoices" colspan="4"/>
|
||||
<group colspan="4" col="6">
|
||||
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
|
||||
<button icon="gtk-execute" string="Cancel selected invoices" name="invoice_cancel" type="object" default_focus="1"/>
|
||||
<button icon="gtk-cancel" special="cancel" string="Close"/>
|
||||
<button icon="gtk-execute" string="Cancel Invoices" name="invoice_cancel" type="object" default_focus="1"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_account_invoice_cancel" model="ir.actions.act_window">
|
||||
<field name="name">Cancel selected invoices</field>
|
||||
<field name="name">Cancel Selected Invoices</field>
|
||||
<field name="res_model">account.invoice.cancel</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
@@ -62,7 +62,7 @@
|
||||
<record model="ir.values" id="action_account_invoice_cancel_values">
|
||||
<field name="model_id" ref="account.model_account_invoice" />
|
||||
<field name="object" eval="1" />
|
||||
<field name="name">Cancel selected invoices</field>
|
||||
<field name="name">Cancel Selected Invoices</field>
|
||||
<field name="key2">client_action_multi</field>
|
||||
<field name="value" eval="'ir.actions.act_window,' +str(ref('action_account_invoice_cancel'))" />
|
||||
<field name="key">action</field>
|
||||
|
||||
@@ -26,7 +26,5 @@ import stock
|
||||
import wizard
|
||||
import report
|
||||
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
||||
@@ -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:
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
<field name="shop_id" ref="sale.shop"/>
|
||||
<field eval=""""2009-05-29"""" name="date_order"/>
|
||||
<field name="partner_id" ref="base.res_partner_5"/>
|
||||
<field name="user_saleman" ref="base.user_root"/>
|
||||
<field name="user_salesman_id" ref="base.user_root"/>
|
||||
<field name="sale_manager" ref="base.user_root"/>
|
||||
<field eval=""""POS/001"""" name="name"/>
|
||||
<field name="company_id" ref="res_company_tinyshop0"/>
|
||||
@@ -93,7 +93,7 @@
|
||||
<field name="shop_id" ref="sale.shop"/>
|
||||
<field eval=""""2009-05-29"""" name="date_order"/>
|
||||
<field name="partner_id" ref="base.res_partner_3"/>
|
||||
<field name="user_saleman" ref="res_users_sofia0"/>
|
||||
<field name="user_salesman_id" ref="res_users_sofia0"/>
|
||||
<field name="sale_manager" ref="base.user_root"/>
|
||||
<field eval=""""POS/002"""" name="name"/>
|
||||
<field name="company_id" ref="res_company_shop0"/>
|
||||
@@ -135,7 +135,7 @@
|
||||
<field eval=""""2009-11-29"""" name="date_validity"/>
|
||||
<field eval=""""2009-05-29"""" name="date_order"/>
|
||||
<field name="partner_id" ref="base.res_partner_3"/>
|
||||
<field name="user_saleman" ref="res_users_sofia0"/>
|
||||
<field name="user_salesman_id" ref="res_users_sofia0"/>
|
||||
<field name="sale_manager" ref="base.user_root"/>
|
||||
<field eval=""""POS/0012"""" name="name"/>
|
||||
<field name="company_id" ref="res_company_shop0"/>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<notebook >
|
||||
<page string="Order lines">
|
||||
<group colspan="4" col="6">
|
||||
<field name="user_saleman" />
|
||||
<field name="user_salesman_id" />
|
||||
<field name="partner_id" on_change="onchange_partner_pricelist(partner_id)"/>
|
||||
<field name="contract_number" select="1" groups="base.group_extended"/>
|
||||
</group>
|
||||
|
||||
@@ -103,7 +103,7 @@
|
||||
<para style="terp_default_Centre_9">Tel : [[ address and address.phone ]]</para>
|
||||
<para style="terp_default_Centre_9">E-mail : [[ address and address.email ]]</para>
|
||||
<para style="terp_default_Centre_9">Shop : [[ o.shop_id.name ]]</para>
|
||||
<para style="terp_default_Centre_9">Vendeur : [[ o.user_saleman.name ]]</para>
|
||||
<para style="terp_default_Centre_9">Vendeur : [[ o.user_salesman_id.name ]]</para>
|
||||
<para style="terp_default_Centre_9">Date : [[ formatLang(o.date_order,date = True) ]]</para>
|
||||
<para style="P4">
|
||||
<font color="white"> </font>
|
||||
|
||||
Reference in New Issue
Block a user