[FIX] partially reverted commit 5220 which was wrongly reverting few enhancements

bzr revid: qdp-launchpad@openerp.com-20111019081403-4zeh9qlw6p8d2va0
This commit is contained in:
Quentin (OpenERP) 2011-10-19 10:14:03 +02:00
parent e3ffcd94d6
commit 4463d93eea
3 changed files with 11 additions and 2 deletions

View File

@ -966,10 +966,17 @@ class account_period(osv.osv):
return False return False
def find(self, cr, uid, dt=None, context=None): def find(self, cr, uid, dt=None, context=None):
if context is None: context = {}
if not dt: if not dt:
dt = time.strftime('%Y-%m-%d') dt = time.strftime('%Y-%m-%d')
#CHECKME: shouldn't we check the state of the period? #CHECKME: shouldn't we check the state of the period?
ids = self.search(cr, uid, [('date_start','<=',dt),('date_stop','>=',dt)]) args = [('date_start', '<=' ,dt), ('date_stop', '>=', dt)]
if context.get('company_id', False):
args.append(('company_id', '=', context['company_id']))
else:
company_id = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.id
args.append(('company_id', '=', company_id))
ids = self.search(cr, uid, args, context=context)
if not ids: if not ids:
raise osv.except_osv(_('Error !'), _('No period defined for this date: %s !\nPlease create one.')%dt) raise osv.except_osv(_('Error !'), _('No period defined for this date: %s !\nPlease create one.')%dt)
return ids return ids

View File

@ -209,7 +209,7 @@ class account_invoice(osv.osv):
\n* The \'Open\' state is used when user create invoice,a invoice number is generated.Its in open state till user does not pay invoice. \ \n* The \'Open\' state is used when user create invoice,a invoice number is generated.Its in open state till user does not pay invoice. \
\n* The \'Paid\' state is set automatically when invoice is paid.\ \n* The \'Paid\' state is set automatically when invoice is paid.\
\n* The \'Cancelled\' state is used when user cancel invoice.'), \n* The \'Cancelled\' state is used when user cancel invoice.'),
'date_invoice': fields.date('Invoice Date', states={'paid':[('readonly',True)], 'open':[('readonly',True)], 'close':[('readonly',True)]}, select=True, help="Keep empty to use the current date"), 'date_invoice': fields.date('Invoice Date', readonly=True, states={'draft':[('readonly',False)]}, select=True, help="Keep empty to use the current date"),
'date_due': fields.date('Due Date', states={'paid':[('readonly',True)], 'open':[('readonly',True)], 'close':[('readonly',True)]}, select=True, 'date_due': fields.date('Due Date', states={'paid':[('readonly',True)], 'open':[('readonly',True)], 'close':[('readonly',True)]}, select=True,
help="If you use payment terms, the due date will be computed automatically at the generation "\ help="If you use payment terms, the due date will be computed automatically at the generation "\
"of accounting entries. If you keep the payment term and the due date empty, it means direct payment. The payment term may compute several due dates, for example 50% now, 50% in one month."), "of accounting entries. If you keep the payment term and the due date empty, it means direct payment. The payment term may compute several due dates, for example 50% now, 50% in one month."),

View File

@ -234,6 +234,7 @@
<field name="payment_ids" colspan="4" nolabel="1" > <field name="payment_ids" colspan="4" nolabel="1" >
<tree string="Payments"> <tree string="Payments">
<field name="date" string="Payment Date"/> <field name="date" string="Payment Date"/>
<field name="move_id"/>
<field name="ref"/> <field name="ref"/>
<field name="name" groups="base.group_extended"/> <field name="name" groups="base.group_extended"/>
<field name="journal_id"/> <field name="journal_id"/>
@ -332,6 +333,7 @@
<field name="payment_ids" colspan="4" nolabel="1"> <field name="payment_ids" colspan="4" nolabel="1">
<tree string="Payments"> <tree string="Payments">
<field name="date"/> <field name="date"/>
<field name="move_id"/>
<field name="ref"/> <field name="ref"/>
<field name="name"/> <field name="name"/>
<field name="journal_id" groups="base.group_user"/> <field name="journal_id" groups="base.group_user"/>