commit
41e62b1f57
|
@ -212,10 +212,10 @@ class account_invoice(osv.osv):
|
|||
('cancel','Cancelled')
|
||||
],'State', select=True, readonly=True),
|
||||
|
||||
'date_invoice': fields.date('Date Invoiced', states={'open':[('readonly',True)],'close':[('readonly',True)]}),
|
||||
'date_invoice': fields.date('Date Invoiced', states={'open':[('readonly',True)],'close':[('readonly',True)]}, help="Keep empty to use the current date"),
|
||||
'date_due': fields.date('Due Date', states={'open':[('readonly',True)],'close':[('readonly',True)]},
|
||||
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."),
|
||||
"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."),
|
||||
'partner_id': fields.many2one('res.partner', 'Partner', change_default=True, readonly=True, required=True, states={'draft':[('readonly',False)]}),
|
||||
'address_contact_id': fields.many2one('res.partner.address', 'Contact Address', readonly=True, states={'draft':[('readonly',False)]}),
|
||||
'address_invoice_id': fields.many2one('res.partner.address', 'Invoice Address', readonly=True, required=True, states={'draft':[('readonly',False)]}),
|
||||
|
@ -223,7 +223,7 @@ class account_invoice(osv.osv):
|
|||
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."),
|
||||
'period_id': fields.many2one('account.period', 'Force Period', domain=[('state','<>','done')], help="Keep empty to use the period of the validation date."),
|
||||
'period_id': fields.many2one('account.period', 'Force Period', domain=[('state','<>','done')], help="Keep empty to use the period of the validation(invoice) date."),
|
||||
|
||||
'account_id': fields.many2one('account.account', 'Account', required=True, readonly=True, states={'draft':[('readonly',False)]}, help="The partner account used for this invoice."),
|
||||
'invoice_line': fields.one2many('account.invoice.line', 'invoice_id', 'Invoice Lines', readonly=True, states={'draft':[('readonly',False)]}),
|
||||
|
|
|
@ -150,7 +150,7 @@ class account_balance(report_sxw.rml_parse):
|
|||
if res['credit'] > 0 or res['debit'] > 0 or res['balance'] > 0 :
|
||||
result_acc.append(res)
|
||||
elif form['display_account'] == 'bal_solde':
|
||||
if res['balance'] > 0:
|
||||
if res['balance'] != 0:
|
||||
result_acc.append(res)
|
||||
else:
|
||||
result_acc.append(res)
|
||||
|
|
|
@ -151,10 +151,13 @@ class base_module_record(osv.osv):
|
|||
else:
|
||||
fname = self.pool.get(model)._inherit_fields[key][2]._fields_id
|
||||
valitem[2][fname] = record_id
|
||||
if valitem[0]==0:
|
||||
newid,update = self._get_id(cr, uid, fields[key]['relation'], valitem[1])
|
||||
if not newid:
|
||||
newid = self._create_id(cr, uid, fields[key]['relation'], valitem[2])
|
||||
else:
|
||||
newid,update = self._get_id(cr, uid, fields[key]['relation'], valitem[1])
|
||||
# if valitem[0]==0:
|
||||
# newid = self._create_id(cr, uid, fields[key]['relation'], valitem[2])
|
||||
# else:
|
||||
# newid,update = self._get_id(cr, uid, fields[key]['relation'], valitem[1])
|
||||
childrecord, update = self._create_record(cr, uid, doc, fields[key]['relation'],valitem[2], newid)
|
||||
noupdate = noupdate or update
|
||||
record_list += childrecord
|
||||
|
@ -186,7 +189,7 @@ class base_module_record(osv.osv):
|
|||
record.appendChild(field)
|
||||
return record_list, noupdate
|
||||
|
||||
def get_copy_data(self, cr, uid,model,id,result):
|
||||
def get_copy_data(self, cr, uid, model, id, result):
|
||||
res = []
|
||||
obj=self.pool.get(model)
|
||||
data=obj.read(cr, uid,[id])
|
||||
|
@ -279,10 +282,7 @@ class base_module_record(osv.osv):
|
|||
rec=copy_rec
|
||||
rec_data=[(self.recording_data[0][0],rec,self.recording_data[0][2],self.recording_data[0][3])]
|
||||
self.recording_data=rec_data
|
||||
|
||||
id,update = self._get_id(cr, uid, rec[3], rec[5])
|
||||
if not id:
|
||||
id = self._create_id(cr, uid, rec[3],rec[6])
|
||||
id = self._create_id(cr, uid, rec[3],rec[6])
|
||||
record,noupdate = self._create_record(cr, uid, doc, rec[3], rec[6], id)
|
||||
self.ids[(rec[3],result)] = id
|
||||
record_list += record
|
||||
|
@ -324,7 +324,6 @@ class base_module_record(osv.osv):
|
|||
data.appendChild(res)
|
||||
elif rec[0]=='assert':
|
||||
pass
|
||||
|
||||
return doc.toprettyxml(indent="\t").encode('utf-8')
|
||||
base_module_record()
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -180,10 +180,11 @@ class report_creator(osv.osv):
|
|||
# where_list.append(filter_id.expression)
|
||||
# if where_list:
|
||||
# ret_str+="\nwhere\n\t"+" and\n\t".join(where_list)
|
||||
self.model_set_id=False
|
||||
self.model_set_id = False
|
||||
model_dict = {}
|
||||
from_list = []
|
||||
where_list = []
|
||||
filter_list = []
|
||||
for model in models:
|
||||
model_dict[model.model] = self.pool.get(model.model)._table
|
||||
|
||||
|
@ -218,21 +219,27 @@ class report_creator(osv.osv):
|
|||
self.model_set_id = model_dict.get(reference_model_dict.keys()[reference_model_dict.values().index(min(reference_model_dict.values()))])
|
||||
if model_list and not len(model_dict.keys()) == 1:
|
||||
raise osv.except_osv(_('No Related Models!!'),_('These is/are model(s) (%s) in selection which is/are not related to any other model') % ','.join(model_list))
|
||||
|
||||
if filter_ids and where_list<>[]:
|
||||
where_list.append('and')
|
||||
where_list.append(' ')
|
||||
filter_list.append(' and ')
|
||||
filter_list.append(' ')
|
||||
|
||||
for filter_id in filter_ids:
|
||||
where_list.append(filter_id.expression)
|
||||
where_list.append(' ')
|
||||
where_list.append(filter_id.condition)
|
||||
filter_list.append(filter_id.expression)
|
||||
filter_list.append(' ')
|
||||
filter_list.append(filter_id.condition)
|
||||
|
||||
ret_str = ",\n".join(from_list)
|
||||
if where_list:
|
||||
ret_str+="\n where \n"+"\n".join(where_list)
|
||||
ret_str+="\n where \n"+" and\n".join(where_list)
|
||||
ret_str = ret_str.strip()
|
||||
if filter_list:
|
||||
ret_str +="\n".join(filter_list)
|
||||
if ret_str.endswith('and'):
|
||||
ret_str = ret_str[0:len(ret_str)-3]
|
||||
if ret_str.endswith('or'):
|
||||
ret_str = ret_str[0:len(ret_str)-2]
|
||||
ret_str = ret_str.strip()
|
||||
return ret_str
|
||||
|
||||
def _id_get(self, cr, uid, id, context):
|
||||
|
@ -365,7 +372,7 @@ class report_creator_filter(osv.osv):
|
|||
_description = "Report Filters"
|
||||
_columns = {
|
||||
'name': fields.char('Filter Name',size=64, required=True),
|
||||
'expression': fields.text('Value', required=True),
|
||||
'expression': fields.text('Value', required=True,help='Provide an expression for the field based on which you want to filter the records.\n e.g. res_partner.id=3'),
|
||||
'report_id': fields.many2one('base_report_creator.report','Report', on_delete='cascade'),
|
||||
'condition' : fields.selection([('and','AND'),('or','OR')], 'Condition')
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ import pooler
|
|||
import netsvc
|
||||
import os
|
||||
from service import security
|
||||
from osv import osv
|
||||
|
||||
def log(message):
|
||||
logger = netsvc.Logger()
|
||||
|
@ -188,7 +189,7 @@ class abstracted_fs:
|
|||
# Ok
|
||||
def ftp2fs(self, path_orig, data):
|
||||
path = self.ftpnorm(path_orig)
|
||||
if path and path=='/':
|
||||
if not data or (path and path=='/'):
|
||||
return None
|
||||
path2 = filter(None,path.split('/'))[1:]
|
||||
(cr, uid, pool) = data
|
||||
|
@ -400,6 +401,8 @@ class abstracted_fs:
|
|||
if path=='/':
|
||||
return None
|
||||
dbname = path.split('/')[1]
|
||||
if dbname not in self.db_list():
|
||||
return None
|
||||
try:
|
||||
db,pool = pooler.get_db_and_pool(dbname)
|
||||
except:
|
||||
|
@ -422,7 +425,12 @@ class abstracted_fs:
|
|||
if path is None:
|
||||
result = []
|
||||
for db in self.db_list():
|
||||
result.append(false_node(db))
|
||||
try:
|
||||
uid = security.login(db, self.username, self.password)
|
||||
if uid:
|
||||
result.append(false_node(db))
|
||||
except osv.except_osv:
|
||||
pass
|
||||
return result
|
||||
return path.children()
|
||||
|
||||
|
|
|
@ -283,49 +283,6 @@ class hr_holidays(osv.osv):
|
|||
return True
|
||||
hr_holidays()
|
||||
|
||||
|
||||
class hr_holidays_per_user(osv.osv):
|
||||
_name = "hr.holidays.per.user"
|
||||
_description = "Holidays Per User"
|
||||
_rec_name = 'user_id'
|
||||
|
||||
def _get_remaining_leaves(self, cr, uid, ids, field_name, arg=None, context={}):
|
||||
obj_holiday = self.pool.get('hr.holidays')
|
||||
result = {}
|
||||
for holiday_user in self.browse(cr, uid, ids):
|
||||
days = 0.0
|
||||
ids_request = obj_holiday.search(cr, uid, [('employee_id', '=', holiday_user.employee_id.id),('state', '=', 'validate'),('holiday_status', '=', holiday_user.holiday_status.id)])
|
||||
if ids_request:
|
||||
holidays = obj_holiday.browse(cr, uid, ids_request)
|
||||
for holiday in holidays:
|
||||
days += holiday.number_of_days
|
||||
days = holiday_user.max_leaves - days
|
||||
result[holiday_user.id] = days
|
||||
return result
|
||||
|
||||
_columns = {
|
||||
'employee_id' : fields.many2one('hr.employee', 'Employee',required=True),
|
||||
'user_id' : fields.many2one('res.users','User'),
|
||||
'holiday_status' : fields.many2one("hr.holidays.status", "Holiday's Status", required=True),
|
||||
'max_leaves' : fields.float('Maximum Leaves Allowed',required=True),
|
||||
'leaves_taken' : fields.float('Leaves Already Taken',readonly=True),
|
||||
'active' : fields.boolean('Active'),
|
||||
'notes' : fields.text('Notes'),
|
||||
'remaining_leaves': fields.function(_get_remaining_leaves, method=True, string='Remaining Leaves', type='float'),
|
||||
'history' : fields.one2many('hr.holidays.log', 'holiday_user_id', 'History')
|
||||
}
|
||||
_defaults = {
|
||||
'active' : lambda *a: True,
|
||||
}
|
||||
|
||||
def create(self, cr, uid, vals, *args, **kwargs):
|
||||
if vals['employee_id']:
|
||||
obj_emp=self.pool.get('hr.employee').browse(cr,uid,vals['employee_id'])
|
||||
vals.update({'user_id': obj_emp.user_id.id})
|
||||
return super(osv.osv,self).create(cr, uid, vals, *args, **kwargs)
|
||||
|
||||
hr_holidays_per_user()
|
||||
|
||||
class holiday_user_log(osv.osv):
|
||||
_name = 'hr.holidays.log'
|
||||
_description = 'hr.holidays.log'
|
||||
|
|
|
@ -88,6 +88,10 @@ class make_sale(wizard.interface):
|
|||
fpos = fpos_data and fpos_data.id or False
|
||||
partner_addr = default_partner_addr
|
||||
pricelist = default_pricelist
|
||||
|
||||
if False in partner_addr.values():
|
||||
raise wizard.except_wizard(_('Data Insufficient!'),_('Customer has no addresses defined!'))
|
||||
|
||||
vals = {
|
||||
'origin': 'CRM:%s' % str(case.id),
|
||||
'picking_policy': data['form']['picking_policy'],
|
||||
|
@ -109,6 +113,7 @@ class make_sale(wizard.interface):
|
|||
product_id, qty=1, partner_id=partner_id, fiscal_position=fpos)['value']
|
||||
value['product_id'] = product_id
|
||||
value['order_id'] = new_id
|
||||
value['tax_id'] = [(6,0,value['tax_id'])]
|
||||
sale_line_obj.create(cr, uid, value)
|
||||
|
||||
case_obj.write(cr, uid, case.id, {'ref': 'sale.order,%s' % new_id})
|
||||
|
|
Loading…
Reference in New Issue