commit
801cc36052
|
@ -52,17 +52,17 @@ class account_payment_term(osv.osv):
|
|||
amount = value
|
||||
result = []
|
||||
for line in pt.line_ids:
|
||||
if line.value=='fixed':
|
||||
if line.value == 'fixed':
|
||||
amt = round(line.value_amount, 2)
|
||||
elif line.value=='procent':
|
||||
elif line.value == 'procent':
|
||||
amt = round(value * line.value_amount, 2)
|
||||
elif line.value=='balance':
|
||||
elif line.value == 'balance':
|
||||
amt = round(amount, 2)
|
||||
if amt:
|
||||
next_date = mx.DateTime.strptime(date_ref, '%Y-%m-%d') + RelativeDateTime(days=line.days)
|
||||
if line.days2<0:
|
||||
if line.days2 < 0:
|
||||
next_date += RelativeDateTime(day=line.days2)
|
||||
if line.days2>0:
|
||||
if line.days2 > 0:
|
||||
next_date += RelativeDateTime(day=line.days2, months=1)
|
||||
result.append( (next_date.strftime('%Y-%m-%d'), amt) )
|
||||
amount -= amt
|
||||
|
@ -74,14 +74,14 @@ class account_payment_term_line(osv.osv):
|
|||
_name = "account.payment.term.line"
|
||||
_description = "Payment Term Line"
|
||||
_columns = {
|
||||
'name': fields.char('Line Name', size=32,required=True),
|
||||
'name': fields.char('Line Name', size=32, required=True),
|
||||
'sequence': fields.integer('Sequence', required=True, help="The sequence field is used to order the payment term lines from the lowest sequences to the higher ones"),
|
||||
'value': fields.selection([('procent','Percent'),('balance','Balance'),('fixed','Fixed Amount')], 'Value',required=True),
|
||||
'value': fields.selection([('procent', 'Percent'), ('balance', 'Balance'), ('fixed', 'Fixed Amount')], 'Value',required=True),
|
||||
'value_amount': fields.float('Value Amount'),
|
||||
'days': fields.integer('Number of Days',required=True, help="Number of days to add before computation of the day of month." \
|
||||
'days': fields.integer('Number of Days', required=True, help="Number of days to add before computation of the day of month." \
|
||||
"If Date=15/01, Number of Days=22, Day of Month=-1, then the due date is 28/02."),
|
||||
'days2': fields.integer('Day of the Month',required=True, help="Day of the month, set -1 for the last day of the current month. If it's positive, it gives the day of the next month. Set 0 for net days (otherwise it's based on the beginning of the month)."),
|
||||
'payment_id': fields.many2one('account.payment.term','Payment Term', required=True, select=True),
|
||||
'days2': fields.integer('Day of the Month', required=True, help="Day of the month, set -1 for the last day of the current month. If it's positive, it gives the day of the next month. Set 0 for net days (otherwise it's based on the beginning of the month)."),
|
||||
'payment_id': fields.many2one('account.payment.term', 'Payment Term', required=True, select=True),
|
||||
}
|
||||
_defaults = {
|
||||
'value': lambda *a: 'balance',
|
||||
|
@ -100,7 +100,7 @@ class account_account_type(osv.osv):
|
|||
'code': fields.char('Code', size=32, required=True),
|
||||
'sequence': fields.integer('Sequence', help="Gives the sequence order when displaying a list of account types."),
|
||||
'partner_account': fields.boolean('Partner account'),
|
||||
'close_method': fields.selection([('none','None'), ('balance','Balance'), ('detail','Detail'),('unreconciled','Unreconciled')], 'Deferral Method', required=True),
|
||||
'close_method': fields.selection([('none', 'None'), ('balance', 'Balance'), ('detail', 'Detail'), ('unreconciled', 'Unreconciled')], 'Deferral Method', required=True),
|
||||
'sign': fields.selection([(-1, 'Negative'), (1, 'Positive')], 'Sign on Reports', required=True, help='Allows you to change the sign of the balance amount displayed in the reports, so that you can see positive figures instead of negative ones in expenses accounts.'),
|
||||
}
|
||||
_defaults = {
|
||||
|
@ -138,11 +138,11 @@ class account_account(osv.osv):
|
|||
context = {}
|
||||
pos = 0
|
||||
|
||||
while pos<len(args):
|
||||
while pos < len(args):
|
||||
|
||||
if args[pos][0]=='code' and args[pos][1] in ('like','ilike') and args[pos][2]:
|
||||
args[pos] = ('code', '=like', str(args[pos][2].replace('%',''))+'%')
|
||||
if args[pos][0]=='journal_id':
|
||||
if args[pos][0] == 'code' and args[pos][1] in ('like', 'ilike') and args[pos][2]:
|
||||
args[pos] = ('code', '=like', str(args[pos][2].replace('%', ''))+'%')
|
||||
if args[pos][0] == 'journal_id':
|
||||
if not args[pos][2]:
|
||||
del args[pos]
|
||||
continue
|
||||
|
@ -151,19 +151,19 @@ class account_account(osv.osv):
|
|||
del args[pos]
|
||||
continue
|
||||
ids3 = map(lambda x: x.code, jour.type_control_ids)
|
||||
ids1 = super(account_account,self).search(cr, uid, [('type','in',ids3)])
|
||||
ids1 = super(account_account, self).search(cr, uid, [('type', 'in', ids3)])
|
||||
ids1 += map(lambda x: x.id, jour.account_control_ids)
|
||||
args[pos] = ('id','in',ids1)
|
||||
pos+=1
|
||||
args[pos] = ('id', 'in', ids1)
|
||||
pos += 1
|
||||
|
||||
if context and context.has_key('consolidate_childs'): #add consolidated childs of accounts
|
||||
ids = super(account_account,self).search(cr, uid, args, offset, limit,
|
||||
ids = super(account_account, self).search(cr, uid, args, offset, limit,
|
||||
order, context=context, count=count)
|
||||
for consolidate_child in self.browse(cr, uid, context['account_id']).child_consol_ids:
|
||||
ids.append(consolidate_child.id)
|
||||
return ids
|
||||
|
||||
return super(account_account,self).search(cr, uid, args, offset, limit,
|
||||
return super(account_account, self).search(cr, uid, args, offset, limit,
|
||||
order, context=context, count=count)
|
||||
|
||||
def _get_children_and_consol(self, cr, uid, ids, context={}):
|
||||
|
@ -175,7 +175,7 @@ class account_account(osv.osv):
|
|||
ids3.append(child.id)
|
||||
if ids3:
|
||||
ids3 = self._get_children_and_consol(cr, uid, ids3, context)
|
||||
return ids2+ids3
|
||||
return ids2 + ids3
|
||||
|
||||
def __compute(self, cr, uid, ids, field_names, arg, context={}, query=''):
|
||||
#compute the balance/debit/credit accordingly to the value of field_name for the given account ids
|
||||
|
@ -236,12 +236,12 @@ class account_account(osv.osv):
|
|||
return result
|
||||
|
||||
def _get_child_ids(self, cr, uid, ids, field_name, arg, context={}):
|
||||
result={}
|
||||
result = {}
|
||||
for record in self.browse(cr, uid, ids, context):
|
||||
if record.child_parent_ids:
|
||||
result[record.id]=[x.id for x in record.child_parent_ids]
|
||||
result[record.id] = [x.id for x in record.child_parent_ids]
|
||||
else:
|
||||
result[record.id]=[]
|
||||
result[record.id] = []
|
||||
|
||||
if record.child_consol_ids:
|
||||
for acc in record.child_consol_ids:
|
||||
|
@ -254,26 +254,26 @@ class account_account(osv.osv):
|
|||
'currency_id': fields.many2one('res.currency', 'Secondary Currency', help="Force all moves for this account to have this secondary currency."),
|
||||
'code': fields.char('Code', size=64, required=True),
|
||||
'type': fields.selection([
|
||||
('receivable','Receivable'),
|
||||
('payable','Payable'),
|
||||
('view','View'),
|
||||
('consolidation','Consolidation'),
|
||||
('other','Others'),
|
||||
('closed','Closed'),
|
||||
('receivable', 'Receivable'),
|
||||
('payable', 'Payable'),
|
||||
('view', 'View'),
|
||||
('consolidation', 'Consolidation'),
|
||||
('other', 'Others'),
|
||||
('closed', 'Closed'),
|
||||
], 'Internal Type', required=True,),
|
||||
|
||||
'user_type': fields.many2one('account.account.type', 'Account Type', required=True),
|
||||
'parent_id': fields.many2one('account.account','Parent', ondelete='cascade'),
|
||||
'child_parent_ids':fields.one2many('account.account','parent_id','Children'),
|
||||
'child_consol_ids':fields.many2many('account.account', 'account_account_consol_rel', 'child_id', 'parent_id', 'Consolidated Children'),
|
||||
'child_id': fields.function(_get_child_ids, method=True, type='many2many',relation="account.account",string="Child Accounts"),
|
||||
'balance': fields.function(__compute, digits=(16,2), method=True, string='Balance', multi='balance'),
|
||||
'credit': fields.function(__compute, digits=(16,2), method=True, string='Credit', multi='balance'),
|
||||
'debit': fields.function(__compute, digits=(16,2), method=True, string='Debit', multi='balance'),
|
||||
'parent_id': fields.many2one('account.account', 'Parent', ondelete='cascade'),
|
||||
'child_parent_ids': fields.one2many('account.account','parent_id','Children'),
|
||||
'child_consol_ids': fields.many2many('account.account', 'account_account_consol_rel', 'child_id', 'parent_id', 'Consolidated Children'),
|
||||
'child_id': fields.function(_get_child_ids, method=True, type='many2many', relation="account.account", string="Child Accounts"),
|
||||
'balance': fields.function(__compute, digits=(16, 2), method=True, string='Balance', multi='balance'),
|
||||
'credit': fields.function(__compute, digits=(16, 2), method=True, string='Credit', multi='balance'),
|
||||
'debit': fields.function(__compute, digits=(16, 2), method=True, string='Debit', multi='balance'),
|
||||
'reconcile': fields.boolean('Reconcile', help="Check this if the user is allowed to reconcile entries in this account."),
|
||||
'shortcut': fields.char('Shortcut', size=12),
|
||||
'tax_ids': fields.many2many('account.tax', 'account_account_tax_default_rel',
|
||||
'account_id','tax_id', 'Default Taxes'),
|
||||
'account_id', 'tax_id', 'Default Taxes'),
|
||||
'note': fields.text('Note'),
|
||||
'company_currency_id': fields.function(_get_company_currency, method=True, type='many2one', relation='res.currency', string='Company Currency'),
|
||||
'company_id': fields.many2one('res.company', 'Company', required=True),
|
||||
|
@ -281,7 +281,7 @@ class account_account(osv.osv):
|
|||
|
||||
'parent_left': fields.integer('Parent Left', select=1),
|
||||
'parent_right': fields.integer('Parent Right', select=1),
|
||||
'currency_mode': fields.selection([('current','At Date'),('average','Average Rate')], 'Outgoing Currencies Rate',
|
||||
'currency_mode': fields.selection([('current', 'At Date'), ('average', 'Average Rate')], 'Outgoing Currencies Rate',
|
||||
help=
|
||||
'This will select how the current currency rate for outgoing transactions is computed. '\
|
||||
'In most countries the legal method is "average" but only a few software systems are able to '\
|
||||
|
@ -300,7 +300,7 @@ class account_account(osv.osv):
|
|||
return self.pool.get('res.company').search(cr, uid, [('parent_id', '=', False)])[0]
|
||||
|
||||
_defaults = {
|
||||
'type' : lambda *a :'view',
|
||||
'type': lambda *a : 'view',
|
||||
'reconcile': lambda *a: False,
|
||||
'company_id': _default_company,
|
||||
'active': lambda *a: True,
|
||||
|
@ -309,22 +309,22 @@ class account_account(osv.osv):
|
|||
}
|
||||
|
||||
def _check_recursion(self, cr, uid, ids):
|
||||
obj_self=self.browse(cr,uid,ids[0])
|
||||
p_id=obj_self.parent_id and obj_self.parent_id.id
|
||||
obj_self = self.browse(cr, uid, ids[0])
|
||||
p_id = obj_self.parent_id and obj_self.parent_id.id
|
||||
if (obj_self in obj_self.child_consol_ids) or (p_id and (p_id is obj_self.id)):
|
||||
return False
|
||||
while(ids):
|
||||
cr.execute('select distinct child_id from account_account_consol_rel where parent_id in ('+','.join(map(str,ids))+')')
|
||||
child_ids = filter(None, map(lambda x:x[0], cr.fetchall()))
|
||||
c_ids=child_ids
|
||||
cr.execute('select distinct child_id from account_account_consol_rel where parent_id in ('+','.join(map(str, ids))+')')
|
||||
child_ids = filter(None, map(lambda x: x[0], cr.fetchall()))
|
||||
c_ids = child_ids
|
||||
if (p_id and (p_id in c_ids)) or (obj_self.id in c_ids):
|
||||
return False
|
||||
while len(c_ids):
|
||||
s_ids=self.search(cr,uid,[('parent_id','in',c_ids)])
|
||||
s_ids = self.search(cr, uid, [('parent_id', 'in', c_ids)])
|
||||
if p_id and (p_id in s_ids):
|
||||
return False
|
||||
c_ids=s_ids
|
||||
ids=child_ids
|
||||
c_ids = s_ids
|
||||
ids = child_ids
|
||||
return True
|
||||
|
||||
_constraints = [
|
||||
|
@ -332,7 +332,7 @@ class account_account(osv.osv):
|
|||
]
|
||||
def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=80):
|
||||
if not args:
|
||||
args=[]
|
||||
args = []
|
||||
if not context:
|
||||
context = {}
|
||||
args = args[:]
|
||||
|
@ -341,20 +341,20 @@ class account_account(osv.osv):
|
|||
if name and str(name).startswith('partner:'):
|
||||
part_id = int(name.split(':')[1])
|
||||
part = self.pool.get('res.partner').browse(cr, user, part_id, context)
|
||||
args += [('id','in', (part.property_account_payable.id, part.property_account_receivable.id))]
|
||||
args += [('id', 'in', (part.property_account_payable.id, part.property_account_receivable.id))]
|
||||
name = False
|
||||
if name and str(name).startswith('type:'):
|
||||
type = name.split(':')[1]
|
||||
args += [('type','=', type)]
|
||||
args += [('type', '=', type)]
|
||||
name = False
|
||||
except:
|
||||
pass
|
||||
if name:
|
||||
ids = self.search(cr, user, [('code','=like',name+"%")]+ args, limit=limit)
|
||||
ids = self.search(cr, user, [('code', '=like', name+"%")]+args, limit=limit)
|
||||
if not ids:
|
||||
ids = self.search(cr, user, [('shortcut','=',name)]+ args, limit=limit)
|
||||
ids = self.search(cr, user, [('shortcut', '=', name)]+ args, limit=limit)
|
||||
if not ids:
|
||||
ids = self.search(cr, user, [('name',operator,name)]+ args, limit=limit)
|
||||
ids = self.search(cr, user, [('name', operator, name)]+ args, limit=limit)
|
||||
else:
|
||||
ids = self.search(cr, user, args, context=context, limit=limit)
|
||||
return self.name_get(cr, user, ids, context=context)
|
||||
|
@ -362,28 +362,28 @@ class account_account(osv.osv):
|
|||
def name_get(self, cr, uid, ids, context={}):
|
||||
if not len(ids):
|
||||
return []
|
||||
reads = self.read(cr, uid, ids, ['name','code'], context)
|
||||
reads = self.read(cr, uid, ids, ['name', 'code'], context)
|
||||
res = []
|
||||
for record in reads:
|
||||
name = record['name']
|
||||
if record['code']:
|
||||
name = record['code']+' '+name
|
||||
res.append((record['id'],name ))
|
||||
name = record['code'] + ' '+name
|
||||
res.append((record['id'], name))
|
||||
return res
|
||||
|
||||
def copy(self, cr, uid, id, default={}, context={},done_list=[]):
|
||||
def copy(self, cr, uid, id, default={}, context={}, done_list=[]):
|
||||
account = self.browse(cr, uid, id, context=context)
|
||||
new_child_ids = []
|
||||
if not default:
|
||||
default={}
|
||||
default=default.copy()
|
||||
default = {}
|
||||
default = default.copy()
|
||||
default['parent_id'] = False
|
||||
if account.id in done_list:
|
||||
return False
|
||||
done_list.append(account.id)
|
||||
if account:
|
||||
for child in account.child_id:
|
||||
child_ids=self.copy(cr, uid, child.id, default, context=context,done_list=done_list)
|
||||
child_ids = self.copy(cr, uid, child.id, default, context=context, done_list=done_list)
|
||||
if child_ids:
|
||||
new_child_ids.append(child_ids)
|
||||
default['child_parent_ids'] = [(6, 0, new_child_ids)]
|
||||
|
@ -393,7 +393,7 @@ class account_account(osv.osv):
|
|||
|
||||
def write(self, cr, uid, ids, vals, context=None):
|
||||
if not context:
|
||||
context={}
|
||||
context = {}
|
||||
if 'active' in vals and not vals['active']:
|
||||
line_obj = self.pool.get('account.move.line')
|
||||
account_ids = self.search(cr, uid, [('id', 'child_of', ids)])
|
||||
|
@ -440,7 +440,7 @@ class account_journal(osv.osv):
|
|||
_columns = {
|
||||
'name': fields.char('Journal Name', size=64, required=True, translate=True),
|
||||
'code': fields.char('Code', size=16),
|
||||
'type': fields.selection([('sale','Sale'), ('purchase','Purchase'), ('cash','Cash'), ('general','General'), ('situation','Situation')], 'Type', size=32, required=True),
|
||||
'type': fields.selection([('sale', 'Sale'), ('purchase', 'Purchase'), ('cash', 'Cash'), ('general', 'General'), ('situation', 'Situation')], 'Type', size=32, required=True),
|
||||
'refund_journal': fields.boolean('Refund Journal'),
|
||||
|
||||
'type_control_ids': fields.many2many('account.account.type', 'account_journal_type_rel', 'journal_id','type_id', 'Type Controls', domain=[('code','<>','view'), ('code', '<>', 'closed')]),
|
||||
|
@ -526,7 +526,6 @@ class account_fiscalyear(osv.osv):
|
|||
|
||||
def create_period(self,cr, uid, ids, context={}, interval=1):
|
||||
for fy in self.browse(cr, uid, ids, context):
|
||||
dt = fy.date_start
|
||||
ds = mx.DateTime.strptime(fy.date_start, '%Y-%m-%d')
|
||||
while ds.strftime('%Y-%m-%d')<fy.date_stop:
|
||||
de = ds + RelativeDateTime(months=interval, days=-1)
|
||||
|
@ -584,7 +583,11 @@ class account_period(osv.osv):
|
|||
for obj_period in self.browse(cr,uid,ids):
|
||||
if obj_period.special:
|
||||
continue
|
||||
if obj_period.fiscalyear_id.date_stop < obj_period.date_stop or obj_period.fiscalyear_id.date_stop < obj_period.date_start or obj_period.fiscalyear_id.date_start > obj_period.date_start or obj_period.fiscalyear_id.date_start > obj_period.date_stop:
|
||||
|
||||
if obj_period.fiscalyear_id.date_stop < obj_period.date_stop or \
|
||||
obj_period.fiscalyear_id.date_stop < obj_period.date_start or \
|
||||
obj_period.fiscalyear_id.date_start > obj_period.date_start or \
|
||||
obj_period.fiscalyear_id.date_start > obj_period.date_stop:
|
||||
return False
|
||||
|
||||
pids = self.search(cr, uid, [('date_stop','>=',obj_period.date_start),('date_start','<=',obj_period.date_stop),('special','=',False),('id','<>',obj_period.id)])
|
||||
|
@ -861,7 +864,7 @@ class account_move(osv.osv):
|
|||
def unlink(self, cr, uid, ids, context={}, check=True):
|
||||
toremove = []
|
||||
for move in self.browse(cr, uid, ids, context):
|
||||
if move['state'] <> 'draft':
|
||||
if move['state'] != 'draft':
|
||||
raise osv.except_osv(_('UserError'),
|
||||
_('You can not delete posted movement: "%s"!') % \
|
||||
move['name'])
|
||||
|
@ -961,7 +964,7 @@ class account_move(osv.osv):
|
|||
|
||||
if line.account_id.currency_id:
|
||||
if line.account_id.currency_id.id != line.currency_id.id and (line.account_id.currency_id.id != line.account_id.company_id.currency_id.id or line.currency_id):
|
||||
raise osv.except_osv(_('Error'), _("""Couldn't create move with currency different from the secondary currency of the account "%s - %s". Clear the secondary currency field of the account definition if you want to accept all currencies.""" % (line.account_id.code, line.account_id.name)))
|
||||
raise osv.except_osv(_('Error'), _("""Couldn't create move with currency different from the secondary currency of the account "%s - %s". Clear the secondary currency field of the account definition if you want to accept all currencies.""" % (line.account_id.code, line.account_id.name)))
|
||||
|
||||
if abs(amount) < 0.0001:
|
||||
if not len(line_draft_ids):
|
||||
|
@ -1109,9 +1112,9 @@ class account_tax_code(osv.osv):
|
|||
fiscalyear_id = self.pool.get('account.fiscalyear').find(cr, uid, exception=False)
|
||||
where = ''
|
||||
if fiscalyear_id:
|
||||
pids = map(lambda x: str(x.id), self.pool.get('account.fiscalyear').browse(cr, uid, fiscalyear_id).period_ids)
|
||||
if pids:
|
||||
where = ' and period_id in (' + (','.join(pids))+')'
|
||||
pids = map(lambda x: str(x.id), self.pool.get('account.fiscalyear').browse(cr, uid, fiscalyear_id).period_ids)
|
||||
if pids:
|
||||
where = ' and period_id in (' + (','.join(pids))+')'
|
||||
return self._sum(cr, uid, ids, name, args, context,
|
||||
where=where)
|
||||
|
||||
|
|
|
@ -632,7 +632,7 @@ class account_invoice(osv.osv):
|
|||
journal = self.pool.get('account.journal').browse(cr, uid, journal_id)
|
||||
if journal.centralisation:
|
||||
raise osv.except_osv(_('UserError'),
|
||||
_('Can not create invoice move on centralised journal'))
|
||||
_('Cannot create invoice move on centralised journal'))
|
||||
move = {'ref': inv.number, 'line_id': line, 'journal_id': journal_id, 'date': date}
|
||||
period_id=inv.period_id and inv.period_id.id or False
|
||||
if not period_id:
|
||||
|
|
|
@ -27,7 +27,7 @@ class wizard_account_chart(wizard.interface):
|
|||
_account_chart_arch = '''<?xml version="1.0"?>
|
||||
<form string="Account charts">
|
||||
<field name="fiscalyear"/>
|
||||
<label align="0.7" colspan="6" string="(If you do not select Fiscal year it will take all open fiscal year)"/>
|
||||
<label align="0.7" colspan="6" string="(If you do not select Fiscal year it will take all open fiscal years)"/>
|
||||
<field name="target_move"/>
|
||||
</form>'''
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ dates_form = '''<?xml version="1.0"?>
|
|||
<notebook tabpos="up">
|
||||
<page string="Report Options">
|
||||
<separator string="Select Fiscal Year(s)(Maximum Three Years)" colspan="4"/>
|
||||
<label align="0.7" colspan="6" string="(If you do not select Fiscal year it will take all open fiscal year)"/>
|
||||
<label align="0.7" colspan="6" string="(If you do not select Fiscal year it will take all open fiscal years)"/>
|
||||
<field name="fiscalyear" colspan="5" nolabel="1"/>
|
||||
<field name="landscape" colspan="4"/>
|
||||
<field name="show_columns" colspan="4"/>
|
||||
|
|
|
@ -510,24 +510,27 @@ class document_file(osv.osv):
|
|||
if not value:
|
||||
return True
|
||||
#if (not context) or context.get('store_method','fs')=='fs':
|
||||
path = self._get_filestore(cr)
|
||||
if not os.path.isdir(path):
|
||||
os.makedirs(path)
|
||||
flag = None
|
||||
# This can be improved
|
||||
for dirs in os.listdir(path):
|
||||
if os.path.isdir(os.path.join(path,dirs)) and len(os.listdir(os.path.join(path,dirs)))<4000:
|
||||
flag = dirs
|
||||
break
|
||||
flag = flag or create_directory(path)
|
||||
filename = random_name()
|
||||
fname = os.path.join(path, flag, filename)
|
||||
fp = file(fname,'wb')
|
||||
v = base64.decodestring(value)
|
||||
fp.write(v)
|
||||
filesize = os.stat(fname).st_size
|
||||
cr.execute('update ir_attachment set store_fname=%s,store_method=%s,file_size=%s where id=%s', (os.path.join(flag,filename),'fs',len(v),id))
|
||||
return True
|
||||
try:
|
||||
path = self._get_filestore(cr)
|
||||
if not os.path.isdir(path):
|
||||
os.makedirs(path)
|
||||
flag = None
|
||||
# This can be improved
|
||||
for dirs in os.listdir(path):
|
||||
if os.path.isdir(os.path.join(path,dirs)) and len(os.listdir(os.path.join(path,dirs)))<4000:
|
||||
flag = dirs
|
||||
break
|
||||
flag = flag or create_directory(path)
|
||||
filename = random_name()
|
||||
fname = os.path.join(path, flag, filename)
|
||||
fp = file(fname,'wb')
|
||||
v = base64.decodestring(value)
|
||||
fp.write(v)
|
||||
filesize = os.stat(fname).st_size
|
||||
cr.execute('update ir_attachment set store_fname=%s,store_method=%s,file_size=%s where id=%s', (os.path.join(flag,filename),'fs',len(v),id))
|
||||
return True
|
||||
except Exception,e :
|
||||
raise except_orm('Error!', str(e))
|
||||
|
||||
_columns = {
|
||||
'user_id': fields.many2one('res.users', 'Owner', select=1),
|
||||
|
@ -609,7 +612,7 @@ class document_file(osv.osv):
|
|||
|
||||
def create(self, cr, uid, vals, context={}):
|
||||
vals['title']=vals['name']
|
||||
vals['parent_id'] = context.get('parent_id',False)
|
||||
vals['parent_id'] = context.get('parent_id',False) or vals.get('parent_id',False)
|
||||
if not vals.get('res_id', False) and context.get('default_res_id',False):
|
||||
vals['res_id']=context.get('default_res_id',False)
|
||||
if not vals.get('res_model', False) and context.get('default_res_model',False):
|
||||
|
|
|
@ -31,10 +31,10 @@ class res_company(osv.osv):
|
|||
city = post_code = address = ""
|
||||
for ads in addresses:
|
||||
if ads.type == 'default':
|
||||
city = ads.city
|
||||
post_code = ads.zip
|
||||
city = ads.city or ""
|
||||
post_code = ads.zip or ""
|
||||
if ads.street:
|
||||
address = ads.street
|
||||
address = ads.street or ""
|
||||
if ads.street2:
|
||||
address += " " + ads.street2
|
||||
return city, post_code, address
|
||||
|
|
|
@ -1,27 +1,35 @@
|
|||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<menuitem
|
||||
id="menu_finance_belgian_statement"
|
||||
name="Belgium Statements"
|
||||
parent="account.menu_finance_legal_statement"/>
|
||||
|
||||
<wizard
|
||||
string="Enlist Vat Details"
|
||||
string="Annual Listing of VAT-Subjected Customers"
|
||||
model="res.partner"
|
||||
name="list.vat.detail"
|
||||
menu="False"
|
||||
id="partner_wizard_vat"/>
|
||||
|
||||
<menuitem
|
||||
name="Listing of VAT Customers"
|
||||
parent="account.menu_finance_legal_statement"
|
||||
name="Annual Listing of VAT-Subjected Customers"
|
||||
parent="menu_finance_belgian_statement"
|
||||
action="partner_wizard_vat"
|
||||
type="wizard"
|
||||
id="partner_wizard_vat_menu"/>
|
||||
|
||||
<wizard
|
||||
string="Taxes Statement"
|
||||
string="Periodical VAT Declaration"
|
||||
name="wizard.account.xml.vat.declaration"
|
||||
menu="False"
|
||||
id="wizard_xml_vat_declaration"/>
|
||||
|
||||
<menuitem
|
||||
name="Taxes Statement"
|
||||
parent="account.menu_finance_legal_statement"
|
||||
name="Periodical VAT Declaration"
|
||||
parent="menu_finance_belgian_statement"
|
||||
action="wizard_xml_vat_declaration"
|
||||
type="wizard"
|
||||
id="account_wizard_vat_declaration"/>
|
||||
|
|
|
@ -76,9 +76,10 @@ class wizard_vat_declaration(wizard.interface):
|
|||
|
||||
obj_fyear = pool_obj.get('account.fiscalyear')
|
||||
year_id = obj_fyear.find(cr, uid)
|
||||
current_year = obj_fyear.browse(cr,uid,year_id).name
|
||||
|
||||
period_code = pool_obj.get('account.period').browse(cr, uid, data['form']['period']).code
|
||||
|
||||
account_period=pool_obj.get('account.period').browse(cr, uid, data['form']['period'])
|
||||
current_year = account_period.fiscalyear_id.name
|
||||
period_code = account_period.code
|
||||
|
||||
send_ref = user_cmpny
|
||||
if period_code:
|
||||
|
@ -89,8 +90,8 @@ class wizard_vat_declaration(wizard.interface):
|
|||
data_of_file +='\n\t\t<POSTCODE>'+post_code+'</POSTCODE>\n\t\t<CITY>'+city+'</CITY>\n\t\t<SENDINGREFERENCE>'+send_ref+'</SENDINGREFERENCE>\n\t</DECLARER>'
|
||||
data_of_file +='\n\t<VATRECORD>\n\t\t<RECNUM>1</RECNUM>\n\t\t<VATNUMBER>'+str(vat_no)+'</VATNUMBER>\n\t\t<DPERIODE>\n\t\t\t'
|
||||
|
||||
starting_month = pool_obj.get('account.period').browse(cr, uid, data['form']['period']).date_start[5:7]
|
||||
ending_month = pool_obj.get('account.period').browse(cr, uid, data['form']['period']).date_stop[5:7]
|
||||
starting_month = account_period.date_start[5:7]
|
||||
ending_month = account_period.date_stop[5:7]
|
||||
if starting_month != ending_month:
|
||||
#starting month and ending month of selected period are not the same
|
||||
#it means that the accounting isn't based on periods of 1 month but on quarters
|
||||
|
@ -98,7 +99,7 @@ class wizard_vat_declaration(wizard.interface):
|
|||
data_of_file += '<QUARTER>'+quarter+'</QUARTER>\n\t\t\t'
|
||||
else:
|
||||
data_of_file += '<MONTH>'+starting_month+'</MONTH>\n\t\t\t'
|
||||
data_of_file += '<YEAR>'+str(current_year[-4:])+'</YEAR>\n\t\t</DPERIODE>\n\t\t<ASK RESTITUTION="NO" PAYMENT="NO"/>'
|
||||
data_of_file += '<YEAR>' + str(account_period.date_stop[:4]) + '</YEAR>\n\t\t</DPERIODE>\n\t\t<ASK RESTITUTION="NO" PAYMENT="NO"/>'
|
||||
data_of_file +='\n\t\t<DATA>\n\t\t\t<DATA_ELEM>'
|
||||
|
||||
for item in tax_info:
|
||||
|
|
|
@ -62,26 +62,23 @@ class wizard_vat(wizard.interface):
|
|||
|
||||
def _create_xml(self, cr, uid, data, context):
|
||||
datas=[]
|
||||
# now wizard will use user->company instead of directly company from res.company
|
||||
|
||||
seq_controlref = pooler.get_pool(cr.dbname).get('ir.sequence').get(cr, uid,'controlref')
|
||||
seq_declarantnum = pooler.get_pool(cr.dbname).get('ir.sequence').get(cr, uid,'declarantnum')
|
||||
obj_cmpny = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, uid).company_id
|
||||
company_vat = obj_cmpny.partner_id.vat
|
||||
if not company_vat: #if not vat_company:
|
||||
if not company_vat:
|
||||
raise wizard.except_wizard('Data Insufficient','No VAT Number Associated with Main Company!')
|
||||
|
||||
cref = company_vat + seq_controlref
|
||||
dnum = cref + seq_declarantnum
|
||||
# obj_company=pooler.get_pool(cr.dbname).get('res.company').browse(cr,uid,1)
|
||||
# vat_company=obj_company.partner_id.vat
|
||||
|
||||
p_id_list=pooler.get_pool(cr.dbname).get('res.partner').search(cr,uid,[('vat_subjected','!=',False)])
|
||||
|
||||
if not p_id_list:
|
||||
raise wizard.except_wizard('Data Insufficient!','No partner has a VAT Number asociated with him.')
|
||||
obj_year=pooler.get_pool(cr.dbname).get('account.fiscalyear').browse(cr,uid,data['form']['fyear'])
|
||||
period="to_date('" + str(obj_year.date_start) + "','yyyy-mm-dd') and to_date('" + str(obj_year.date_stop) +"','yyyy-mm-dd')"
|
||||
period_ids = pooler.get_pool(cr.dbname).get('account.period').search(cr, uid, [('fiscalyear_id', '=', data['form']['fyear'])])
|
||||
period = "("+','.join(map(lambda x: str(x), period_ids)) +")"
|
||||
|
||||
street=zip_city=country=''
|
||||
addr = pooler.get_pool(cr.dbname).get('res.partner').address_get(cr, uid, [obj_cmpny.partner_id.id], ['invoice'])
|
||||
|
@ -108,39 +105,57 @@ class wizard_vat(wizard.interface):
|
|||
data_file +='\n<AgentRepr DecNumber="1">\n\t<CompanyInfo>\n\t\t<VATNum>'+str(company_vat)+'</VATNum>\n\t\t<Name>'+str(obj_cmpny.name)+'</Name>\n\t\t<Street>'+ str(street) +'</Street>\n\t\t<CityAndZipCode>'+ str(zip_city) +'</CityAndZipCode>'
|
||||
data_file +='\n\t\t<Country>'+ str(country) +'</Country>\n\t</CompanyInfo>\n</AgentRepr>'
|
||||
data_comp ='\n<CompanyInfo>\n\t<VATNum>'+str(company_vat)+'</VATNum>\n\t<Name>'+str(obj_cmpny.name)+'</Name>\n\t<Street>'+ str(street) +'</Street>\n\t<CityAndZipCode>'+ str(zip_city) +'</CityAndZipCode>\n\t<Country>'+ str(country) +'</Country>\n</CompanyInfo>'
|
||||
data_period ='\n<Period>'+ str(obj_year.name[-4:]) +'</Period>'
|
||||
data_period ='\n<Period>'+ str(obj_year.date_stop[:4]) +'</Period>'
|
||||
error_message=[]
|
||||
|
||||
for p_id in p_id_list:
|
||||
record=[] # this holds record per partner
|
||||
obj_partner=pooler.get_pool(cr.dbname).get('res.partner').browse(cr,uid,p_id)
|
||||
cr.execute('select b.code,sum(credit)-sum(debit) from account_move_line l left join account_account a on (l.account_id=a.id) left join account_account_type b on (a.user_type=b.id) where b.code in ('"'produit'"','"'tax'"') and l.partner_id=%%s and l.date between %s group by b.code' % (period,), (p_id,))
|
||||
record = {} # this holds record per partner
|
||||
obj_partner = pooler.get_pool(cr.dbname).get('res.partner').browse(cr,uid,p_id)
|
||||
|
||||
#This listing is only for customers located in belgium, that's the
|
||||
#reason why we skip all the partners that haven't their
|
||||
#(or one of their) default address(es) located in Belgium.
|
||||
go_ahead = False
|
||||
for ads in obj_partner.address:
|
||||
if ads.type == 'default' and (ads.country_id and ads.country_id.code == 'BE'):
|
||||
go_ahead = True
|
||||
break
|
||||
if not go_ahead:
|
||||
continue
|
||||
query = 'select b.code,sum(credit)-sum(debit) from account_move_line l left join account_account a on (l.account_id=a.id) left join account_account_type b on (a.user_type=b.id) where b.code in ('"'produit'"','"'tax'"') and l.partner_id='+str(p_id)+' and l.period_id in '+period+' group by b.code'
|
||||
cr.execute(query)
|
||||
line_info=cr.fetchall()
|
||||
if not line_info:
|
||||
continue
|
||||
|
||||
record.append(obj_partner.vat)
|
||||
addr = pooler.get_pool(cr.dbname).get('res.partner').address_get(cr, uid, [obj_partner.id], ['invoice'])
|
||||
if addr.get('invoice',False):
|
||||
ads=pooler.get_pool(cr.dbname).get('res.partner.address').browse(cr,uid,[addr['invoice']])[0]
|
||||
record['vat'] = obj_partner.vat
|
||||
|
||||
#it seems that this listing is only for belgian customers
|
||||
record['country'] = 'BE'
|
||||
|
||||
#...deprecated...
|
||||
#~addr = pooler.get_pool(cr.dbname).get('res.partner').address_get(cr, uid, [obj_partner.id], ['invoice'])
|
||||
|
||||
if ads.country_id:
|
||||
record.append(ads.country_id.code)
|
||||
else:
|
||||
error_message.append('Data Insufficient! : '+ 'The Partner "'+obj_partner.name + '"'' has no country associated with its Invoice address!')
|
||||
#~ if addr.get('invoice',False):
|
||||
#~ads=pooler.get_pool(cr.dbname).get('res.partner.address').browse(cr,uid,[addr['invoice']])[0]
|
||||
|
||||
#~ if ads.country_id:
|
||||
#~ record.append(ads.country_id.code)
|
||||
#~ else:
|
||||
#~ error_message.append('Data Insufficient! : '+ 'The Partner "'+obj_partner.name + '"'' has no country associated with its Invoice address!')
|
||||
|
||||
if len(record)<2:
|
||||
record.append('')
|
||||
error_message.append('Data Insufficient! : '+ 'The Partner "'+obj_partner.name + '"'' has no Invoice address!')
|
||||
if len(line_info)==1:
|
||||
if line_info[0][0]=='produit':
|
||||
record.append(0.00)
|
||||
record.append(line_info[0][1])
|
||||
#~ if len(record)<2:
|
||||
#~ record.append('')
|
||||
#~ error_message.append('Data Insufficient! : '+ 'The Partner "'+obj_partner.name + '"'' has no Invoice address!')
|
||||
|
||||
record['amount'] = 0
|
||||
record['turnover'] = 0
|
||||
|
||||
for item in line_info:
|
||||
if item[0]=='produit':
|
||||
record['turnover'] += item[1]
|
||||
else:
|
||||
record.append(line_info[0][1])
|
||||
record.append(0.00)
|
||||
else:
|
||||
for item in line_info:
|
||||
record.append(item[1])
|
||||
record['amount'] += item[1]
|
||||
datas.append(record)
|
||||
|
||||
seq=0
|
||||
|
@ -151,12 +166,12 @@ class wizard_vat(wizard.interface):
|
|||
data['form']['msg']='Exception : \n' +'-'*50+'\n'+ '\n'.join(error_message)
|
||||
return data['form']
|
||||
for line in datas:
|
||||
if line[3]< data['form']['limit_amount']:
|
||||
if line['turnover'] < data['form']['limit_amount']:
|
||||
continue
|
||||
seq +=1
|
||||
sum_tax +=line[2]
|
||||
sum_turnover +=line[3]
|
||||
data_clientinfo +='\n<ClientList SequenceNum="'+str(seq)+'">\n\t<CompanyInfo>\n\t\t<VATNum>'+line[0] +'</VATNum>\n\t\t<Country>'+line[1] +'</Country>\n\t</CompanyInfo>\n\t<Amount>'+str(int(line[2] * 100)) +'</Amount>\n\t<TurnOver>'+str(int(line[3] * 100)) +'</TurnOver>\n</ClientList>'
|
||||
sum_tax +=line['amount']
|
||||
sum_turnover +=line['turnover']
|
||||
data_clientinfo +='\n<ClientList SequenceNum="'+str(seq)+'">\n\t<CompanyInfo>\n\t\t<VATNum>'+line['vat'] +'</VATNum>\n\t\t<Country>'+line['country'] +'</Country>\n\t</CompanyInfo>\n\t<Amount>'+str(int(line['amount'] * 100)) +'</Amount>\n\t<TurnOver>'+str(int(line['turnover'] * 100)) +'</TurnOver>\n</ClientList>'
|
||||
|
||||
data_decl ='\n<DeclarantList SequenceNum="1" DeclarantNum="'+ dnum + '" ClientNbr="'+ str(seq) +'" TurnOverSum="'+ str(int(sum_turnover * 100)) +'" TaxSum="'+ str(int(sum_tax * 100)) +'" />'
|
||||
data_file += str(data_decl) + str(data_comp) + str(data_period) + str(data_clientinfo) + '\n</VatList>'
|
||||
|
|
|
@ -1,35 +1,36 @@
|
|||
"ref_base_code_id:id","ref_base_sign","name","ref_tax_code_id:id","account_collected_id:id","amount","chart_template_id:id","tax_code_id:id","child_depend","include_base_amount","parent_id:id","tax_sign","account_paid_id:id","base_code_id:id","id","ref_tax_sign"
|
||||
"account_tax_code_template_9",-1,"Intra Travail à façon 0%",,,"0.0000","l10nlu_chart_template",,0,0,,1,,"account_tax_code_template_9","account_tax_template_1",1
|
||||
"account_tax_code_template_9",-1,"Intra Livraison avec installation 0%",,,"0.0000","l10nlu_chart_template",,0,0,,1,,"account_tax_code_template_9","account_tax_template_2",1
|
||||
"account_tax_code_template_9",-1,"Intra transfert de biens 0%",,,"0.0000","l10nlu_chart_template",,0,0,,1,,"account_tax_code_template_9","account_tax_template_3",1
|
||||
"account_tax_code_template_13",-1,"Vente de tabacs 0%",,,"0.0000","l10nlu_chart_template",,0,0,,1,,"account_tax_code_template_13","account_tax_template_9",1
|
||||
"account_tax_code_template_10",-1,"Exportations 0%",,,"0.0000","l10nlu_chart_template",,0,0,,1,,"account_tax_code_template_10","account_tax_template_10",1
|
||||
,1,"Achats frais généraux 0%",,,"0.0000","l10nlu_chart_template",,0,0,,1,,,"account_tax_template_11",1
|
||||
"account_tax_code_template_29",-1,"Ventes 3%","account_tax_code_template_34","account_451000","0.0300","l10nlu_chart_template","account_tax_code_template_34",0,0,,1,"account_451000","account_tax_code_template_29","account_tax_template_5",-1
|
||||
"account_tax_code_template_28",-1,"Ventes 6%","account_tax_code_template_33","account_451000","0.0600","l10nlu_chart_template","account_tax_code_template_33",0,0,,1,"account_451000","account_tax_code_template_28","account_tax_template_6",-1
|
||||
"account_tax_code_template_30",-1,"Ventes 12%","account_tax_code_template_35","account_451000","0.1200","l10nlu_chart_template","account_tax_code_template_35",0,0,,1,"account_451000","account_tax_code_template_30","account_tax_template_7",-1
|
||||
"account_tax_code_template_27",-1,"Ventes 15%","account_tax_code_template_32","account_451000","0.1500","l10nlu_chart_template","account_tax_code_template_32",0,0,,1,"account_451000","account_tax_code_template_27","account_tax_template_8",-1
|
||||
,1,"Achats frais généraux 15%","account_tax_code_template_18","account_411000","0.1500","l10nlu_chart_template","account_tax_code_template_18",0,0,,1,"account_411000",,"account_tax_template_12",-1
|
||||
,1,"Achats Intra-Co",,,1,"l10nlu_chart_template",,1,0,,1,,"account_tax_code_template_38","account_tax_template_13",1
|
||||
,1,"Achats de Services Art.26",,,1,"l10nlu_chart_template",,1,0,,1,,"account_tax_code_template_38","account_tax_template_18",1
|
||||
,1,"Ventes de Services Art.26",,,1,"l10nlu_chart_template",,1,0,,1,,"account_tax_code_template_38","account_tax_template_21",1
|
||||
,1,"Livraison de Biens Triangulaire 1",,"account_411500","0.1500","l10nlu_chart_template","account_tax_code_template_45",0,0,,1,"account_411000","account_tax_code_template_38","account_tax_template_26",1
|
||||
,1,"Livraisons de biens triangulaire 2",,"account_411000","-0.1500","l10nlu_chart_template","account_tax_code_template_22",0,0,,-1,"account_451000",,"account_tax_template_25",1
|
||||
,1,"Importations a des fins de l'entreprise",,,1,"l10nlu_chart_template",,1,0,,1,,"account_tax_code_template_38","account_tax_template_30",1
|
||||
,1,"Importations a des fins privées",,,1,"l10nlu_chart_template",,1,0,,1,,"account_tax_code_template_38","account_tax_template_33",1
|
||||
,1,"Livraisons de Biens Art.26",,,1,"l10nlu_chart_template",,1,0,,1,,"account_tax_code_template_38","account_tax_template_36",1
|
||||
,1,"Livraison de Biens triangulaire",,,1,"l10nlu_chart_template",,1,0,,1,,"account_tax_code_template_38","account_tax_template_24",1
|
||||
,1,"Livraisons de biens triangulaire 2",,"account_411000","-0.1500","l10nlu_chart_template","account_tax_code_template_22",0,0,"account_tax_template_24",-1,"account_451000",,"account_tax_template_22",1
|
||||
,1,"Livraison de Biens Triangulaire 1",,"account_411500","0.1500","l10nlu_chart_template","account_tax_code_template_45",0,0,"account_tax_template_24",1,"account_411000","account_tax_code_template_38","account_tax_template_23",1
|
||||
,1,"Importations Intra-Co2",,"account_451000","-0.1500","l10nlu_chart_template","account_tax_code_template_56",0,0,"account_tax_template_30",-1,"account_411000","account_tax_code_template_51","account_tax_template_28",1
|
||||
,1,"Importations Intra-Co 1",,"account_411500","0.1500","l10nlu_chart_template","account_tax_code_template_20",0,0,"account_tax_template_30",1,"account_411000",,"account_tax_template_29",1
|
||||
,1,"Importations Fins Privées",,"account_451000","-0.1500","l10nlu_chart_template","account_tax_code_template_64",0,0,"account_tax_template_33",-1,"account_411000","account_tax_code_template_60","account_tax_template_31",1
|
||||
,1,"Importations Fins Privées",,"account_411500","0.1500","l10nlu_chart_template","account_tax_code_template_20",0,0,"account_tax_template_33",1,"account_411000",,"account_tax_template_32",1
|
||||
,1,"Livraison de Biens Art26",,"account_411000","-0.1500","l10nlu_chart_template","account_tax_code_template_22",0,0,"account_tax_template_36",-1,"account_451000",,"account_tax_template_34",1
|
||||
,1,"Livraisons de Biens Art26",,"account_411500","0.1500","l10nlu_chart_template","account_tax_code_template_82",0,0,"account_tax_template_36",1,"account_411000","account_tax_code_template_78","account_tax_template_35",1
|
||||
,1,"Achats Intra-Co 1",,"account_411500","0.1500","l10nlu_chart_template","account_tax_code_template_19",0,0,"account_tax_template_13",1,"account_411000","account_tax_code_template_38","account_tax_template_14",1
|
||||
,1,"Achats Intra-CO2",,"account_451000","-0.1500","l10nlu_chart_template","account_tax_code_template_45",0,0,"account_tax_template_13",-1,"account_411000",,"account_tax_template_15",1
|
||||
,1,"Services Intra-Co2",,"account_451000","-0.1500","l10nlu_chart_template","account_tax_code_template_45",0,0,"account_tax_template_18",-1,"account_411000",,"account_tax_template_17",1
|
||||
,1,"Services Intra-Co 1",,"account_411500","0.1500","l10nlu_chart_template","account_tax_code_template_22",0,0,"account_tax_template_18",1,"account_411000","account_tax_code_template_38","account_tax_template_16",1
|
||||
,1,"Services Intra-Co2",,"account_411000","-0.1500","l10nlu_chart_template","account_tax_code_template_22",0,0,"account_tax_template_21",-1,"account_451000",,"account_tax_template_19",1
|
||||
,1,"Services Intra-Co 1",,"account_411500","0.1500","l10nlu_chart_template","account_tax_code_template_86",0,0,"account_tax_template_21",1,"account_411000","account_tax_code_template_74","account_tax_template_20",1
|
||||
"ref_base_code_id:id","ref_base_sign","name","description","type_tax_use","ref_tax_code_id:id","account_collected_id:id","amount","chart_template_id:id","tax_code_id:id","child_depend","include_base_amount","parent_id:id","tax_sign","account_paid_id:id","base_code_id:id","id","ref_tax_sign"
|
||||
"account_tax_code_template_9",-1,"Intra Travail à façon 0%","ESWRK0","sale",,,"0.0000","l10nlu_chart_template",,0,0,,1,,"account_tax_code_template_9","account_tax_template_1",1
|
||||
"account_tax_code_template_9",-1,"Intra Livraison avec installation 0%","ESDLI0","sale",,,"0.0000","l10nlu_chart_template",,0,0,,1,,"account_tax_code_template_9","account_tax_template_2",1
|
||||
"account_tax_code_template_9",-1,"Intra transfert de biens 0%","ESTRF0","sale",,,"0.0000","l10nlu_chart_template",,0,0,,1,,"account_tax_code_template_9","account_tax_template_3",1
|
||||
"account_tax_code_template_13",-1,"Vente de tabacs 0%","NSNST0","sale",,,"0.0000","l10nlu_chart_template",,0,0,,1,,"account_tax_code_template_13","account_tax_template_9",1
|
||||
"account_tax_code_template_10",-1,"Exportations 0%","ISEXP0","sale",,,"0.0000","l10nlu_chart_template",,0,0,,1,,"account_tax_code_template_10","account_tax_template_10",1
|
||||
,1,"Achats frais généraux 0%","ESSDD0","purchase",,,"0.0000","l10nlu_chart_template",,0,0,,1,,,"account_tax_template_11",1
|
||||
"account_tax_code_template_29",-1,"Ventes 3%","NSS 3","sale","account_tax_code_template_34","account_451000","0.0300","l10nlu_chart_template","account_tax_code_template_34",0,0,,1,"account_451000","account_tax_code_template_29","account_tax_template_5",-1
|
||||
"account_tax_code_template_28",-1,"Ventes 6%","NSS 6","sale","account_tax_code_template_33","account_451000","0.0600","l10nlu_chart_template","account_tax_code_template_33",0,0,,1,"account_451000","account_tax_code_template_28","account_tax_template_6",-1
|
||||
"account_tax_code_template_30",-1,"Ventes 12%","NSS 12","sale","account_tax_code_template_35","account_451000","0.1200","l10nlu_chart_template","account_tax_code_template_35",0,0,,1,"account_451000","account_tax_code_template_30","account_tax_template_7",-1
|
||||
"account_tax_code_template_27",-1,"Ventes 15%","NSS 15","sale","account_tax_code_template_32","account_451000","0.1500","l10nlu_chart_template","account_tax_code_template_32",0,0,,1,"account_451000","account_tax_code_template_27","account_tax_template_8",-1
|
||||
,1,"Achats frais généraux 15%","NSGSD15","purchase","account_tax_code_template_18","account_411000","0.1500","l10nlu_chart_template","account_tax_code_template_18",0,0,,1,"account_411000",,"account_tax_template_12",-1
|
||||
,1,"Achats Intra-Co",,"purchase",,,1,"l10nlu_chart_template",,1,0,,1,,"account_tax_code_template_38","account_tax_template_13",1
|
||||
,1,"Achats de Services Art.26",,"purchase",,,1,"l10nlu_chart_template",,1,0,,1,,"account_tax_code_template_38","account_tax_template_18",1
|
||||
,1,"Ventes de Services Art.26",,"sale",,,1,"l10nlu_chart_template",,1,0,,1,,"account_tax_code_template_38","account_tax_template_21",1
|
||||
,1,"Livraison de Biens Triangulaire 1",,"sale",,"account_411500","0.1500","l10nlu_chart_template","account_tax_code_template_45",0,0,,1,"account_411000","account_tax_code_template_38","account_tax_template_26",1
|
||||
,1,"Livraisons de biens triangulaire 2",,"sale",,"account_411000","-0.1500","l10nlu_chart_template","account_tax_code_template_22",0,0,,-1,"account_451000",,"account_tax_template_25",1
|
||||
,1,"Importations a des fins de l'entreprise",,"purchase",,,1,"l10nlu_chart_template",,1,0,,1,,"account_tax_code_template_38","account_tax_template_30",1
|
||||
,1,"Importations a des fins privées",,"purchase",,,1,"l10nlu_chart_template",,1,0,,1,,"account_tax_code_template_38","account_tax_template_33",1
|
||||
,1,"Livraisons de Biens Art.26",,"sale",,,1,"l10nlu_chart_template",,1,0,,1,,"account_tax_code_template_38","account_tax_template_36",1
|
||||
,1,"Livraison de Biens triangulaire",,"sale",,,1,"l10nlu_chart_template",,1,0,,1,,"account_tax_code_template_38","account_tax_template_24",1
|
||||
,1,"Livraisons de biens triangulaire 2",,"sale",,"account_411000","-0.1500","l10nlu_chart_template","account_tax_code_template_22",0,0,"account_tax_template_24",-1,"account_451000",,"account_tax_template_22",1
|
||||
,1,"Livraison de Biens Triangulaire 1",,"sale",,"account_411500","0.1500","l10nlu_chart_template","account_tax_code_template_45",0,0,"account_tax_template_24",1,"account_411000","account_tax_code_template_38","account_tax_template_23",1
|
||||
,1,"Importations Intra-Co2",,"purchase",,"account_451000","-0.1500","l10nlu_chart_template","account_tax_code_template_56",0,0,"account_tax_template_30",-1,"account_411000","account_tax_code_template_51","account_tax_template_28",1
|
||||
,1,"Importations Intra-Co 1",,"purchase",,"account_411500","0.1500","l10nlu_chart_template","account_tax_code_template_20",0,0,"account_tax_template_30",1,"account_411000",,"account_tax_template_29",1
|
||||
,1,"Importations Fins Privées",,"purchase",,"account_451000","-0.1500","l10nlu_chart_template","account_tax_code_template_64",0,0,"account_tax_template_33",-1,"account_411000","account_tax_code_template_60","account_tax_template_31",1
|
||||
,1,"Importations Fins Privées",,"purchase",,"account_411500","0.1500","l10nlu_chart_template","account_tax_code_template_20",0,0,"account_tax_template_33",1,"account_411000",,"account_tax_template_32",1
|
||||
,1,"Livraison de Biens Art26",,"sale",,"account_411000","-0.1500","l10nlu_chart_template","account_tax_code_template_22",0,0,"account_tax_template_36",-1,"account_451000",,"account_tax_template_34",1
|
||||
,1,"Livraisons de Biens Art26",,"sale",,"account_411500","0.1500","l10nlu_chart_template","account_tax_code_template_82",0,0,"account_tax_template_36",1,"account_411000","account_tax_code_template_78","account_tax_template_35",1
|
||||
,1,"Achats Intra-Co 1",,"purchase",,"account_411500","0.1500","l10nlu_chart_template","account_tax_code_template_19",0,0,"account_tax_template_13",1,"account_411000","account_tax_code_template_38","account_tax_template_14",1
|
||||
,1,"Achats Intra-CO2",,"purchase",,"account_451000","-0.1500","l10nlu_chart_template","account_tax_code_template_45",0,0,"account_tax_template_13",-1,"account_411000",,"account_tax_template_15",1
|
||||
,1,"Services Intra-Co2",,"purchase",,"account_451000","-0.1500","l10nlu_chart_template","account_tax_code_template_45",0,0,"account_tax_template_18",-1,"account_411000",,"account_tax_template_17",1
|
||||
,1,"Services Intra-Co 1",,"purchase",,"account_411500","0.1500","l10nlu_chart_template","account_tax_code_template_22",0,0,"account_tax_template_18",1,"account_411000","account_tax_code_template_38","account_tax_template_16",1
|
||||
,1,"Services Intra-Co2",,"sale",,"account_411000","-0.1500","l10nlu_chart_template","account_tax_code_template_22",0,0,"account_tax_template_21",-1,"account_451000",,"account_tax_template_19",1
|
||||
,1,"Services Intra-Co 1",,"sale",,"account_411500","0.1500","l10nlu_chart_template","account_tax_code_template_86",0,0,"account_tax_template_21",1,"account_411000","account_tax_code_template_74","account_tax_template_20",1
|
||||
|
||||
|
|
|
|
@ -219,7 +219,7 @@
|
|||
|
||||
|
||||
<record id="product_normal_action_tree" model="ir.actions.act_window">
|
||||
<field name="name">Products"</field>
|
||||
<field name="name">Products</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">product.product</field>
|
||||
<field name="view_type">form</field>
|
||||
|
|
|
@ -803,7 +803,7 @@ class sale_order_line(osv.osv):
|
|||
def button_cancel(self, cr, uid, ids, context={}):
|
||||
for line in self.browse(cr, uid, ids, context=context):
|
||||
if line.invoiced:
|
||||
raise osv.except_osv(_('Invalid action !'), _('You can not cancel a sale order line that has already been invoiced !'))
|
||||
raise osv.except_osv(_('Invalid action !'), _('You cannot cancel a sale order line that has already been invoiced !'))
|
||||
return self.write(cr, uid, ids, {'state':'cancel'})
|
||||
|
||||
def button_confirm(self, cr, uid, ids, context={}):
|
||||
|
@ -847,7 +847,7 @@ class sale_order_line(osv.osv):
|
|||
uom=False, qty_uos=0, uos=False, name='', partner_id=False,
|
||||
lang=False, update_tax=True, date_order=False, packaging=False, fiscal_position=False):
|
||||
if not partner_id:
|
||||
raise osv.except_osv(_('No Partner !'), _('You have to select a partner in the sale form !\nPlease set one partner before choosing a product.'))
|
||||
raise osv.except_osv(_('No Customer Defined !'), _('You have to select a customer in the sale form !\nPlease set one customer before choosing a product.'))
|
||||
warning={}
|
||||
product_uom_obj = self.pool.get('product.uom')
|
||||
partner_obj = self.pool.get('res.partner')
|
||||
|
|
|
@ -397,7 +397,7 @@ class stock_picking(osv.osv):
|
|||
|
||||
|
||||
_columns = {
|
||||
'name': fields.char('Reference', size=64, required=True, select=True),
|
||||
'name': fields.char('Reference', size=64, select=True),
|
||||
'origin': fields.char('Origin Reference', size=64),
|
||||
'backorder_id': fields.many2one('stock.picking', 'Back Order'),
|
||||
'type': fields.selection([('out','Sending Goods'),('in','Getting Goods'),('internal','Internal'),('delivery','Delivery')], 'Shipping Type', required=True, select=True),
|
||||
|
@ -432,7 +432,7 @@ class stock_picking(osv.osv):
|
|||
select=True, required=True, readonly=True, states={'draft':[('readonly',False)]}),
|
||||
}
|
||||
_defaults = {
|
||||
'name': lambda self,cr,uid,context: self.pool.get('ir.sequence').get(cr, uid, 'stock.picking'),
|
||||
#'name': lambda self,cr,uid,context: self.pool.get('ir.sequence').get(cr, uid, 'stock.picking'),
|
||||
'active': lambda *a: 1,
|
||||
'state': lambda *a: 'draft',
|
||||
'move_type': lambda *a: 'direct',
|
||||
|
@ -440,19 +440,22 @@ class stock_picking(osv.osv):
|
|||
'invoice_state': lambda *a: 'none',
|
||||
'date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
}
|
||||
#def copy(self, cr, uid, id, data=None, context={}):
|
||||
# data = data or {}
|
||||
# return super(stock_picking, self).copy(cr, uid, id, data, context)
|
||||
def copy(self, cr, uid, id, default=None, context={}):
|
||||
if default is None:
|
||||
default = {}
|
||||
default = default.copy()
|
||||
default['name'] = False
|
||||
return super(stock_picking, self).copy(cr, uid, id, default, context)
|
||||
|
||||
def onchange_partner_in(self, cr, uid, context, partner_id=None):
|
||||
sid = self.pool.get('res.partner.address').browse(cr, uid, partner_id, context).partner_id.property_stock_supplier.id
|
||||
return { }
|
||||
|
||||
def action_explode(self, cr, uid, moves, context={}):
|
||||
return moves
|
||||
|
||||
def action_confirm(self, cr, uid, ids, context={}):
|
||||
self.write(cr, uid, ids, {'state': 'confirmed'})
|
||||
val = self.pool.get('ir.sequence').get(cr, uid, 'stock.picking')
|
||||
self.write(cr, uid, ids, {'name': val, 'state': 'confirmed'})
|
||||
todo = []
|
||||
for picking in self.browse(cr, uid, ids):
|
||||
for r in picking.move_lines:
|
||||
|
@ -1178,6 +1181,9 @@ class stock_move(osv.osv):
|
|||
amount = move.product_qty * move.product_id.standard_price
|
||||
|
||||
date = time.strftime('%Y-%m-%d')
|
||||
partner_id = False
|
||||
if move.picking_id:
|
||||
partner_id = move.picking_id.address_id and (move.picking_id.address_id.partner_id and move.picking_id.address_id.partner_id.id or False) or False
|
||||
lines = [
|
||||
(0, 0, {
|
||||
'name': move.name,
|
||||
|
@ -1185,14 +1191,16 @@ class stock_move(osv.osv):
|
|||
'credit': amount,
|
||||
'account_id': acc_src,
|
||||
'ref': ref,
|
||||
'date': date}),
|
||||
'date': date,
|
||||
'partner_id': partner_id}),
|
||||
(0, 0, {
|
||||
'name': move.name,
|
||||
'quantity': move.product_qty,
|
||||
'debit': amount,
|
||||
'account_id': acc_dest,
|
||||
'ref': ref,
|
||||
'date': date})
|
||||
'date': date,
|
||||
'partner_id': partner_id})
|
||||
]
|
||||
self.pool.get('account.move').create(cr, uid, {
|
||||
'name': move.name,
|
||||
|
|
|
@ -740,7 +740,7 @@
|
|||
<menuitem action="action_picking_tree2_delivery" id="menu_picking_waiting_delivery" parent="menu_action_picking_tree_delivery"/>
|
||||
|
||||
<record id="action_picking_tree3_delivery" model="ir.actions.act_window">
|
||||
<field name="name">Futur Delivery Orders</field>
|
||||
<field name="name">Future Delivery Orders</field>
|
||||
<field name="res_model">stock.picking</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="view_type">form</field>
|
||||
|
@ -1205,6 +1205,7 @@
|
|||
<field eval="6" name="priority"/>
|
||||
<field name="arch" type="xml">
|
||||
<tree color="grey:state=='cancel'" string="Moves">
|
||||
<field name="name"/>
|
||||
<field name="product_id"/>
|
||||
<field name="product_qty"/>
|
||||
<field name="product_uom" string="UOM"/>
|
||||
|
|
Loading…
Reference in New Issue