[MERGE] merge from dev3
bzr revid: ara@tinyerp.com-20101210103256-4u1udk12w22m9ysm bzr revid: ara@tinyerp.com-20101213045827-zzh26wg4swgdbx2d
This commit is contained in:
@@ -1170,7 +1170,7 @@
|
||||
<filter icon="terp-document-new" string="Unbalanced" domain="[('state','=','draft')]" help="Unbalanced Journal Items"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter icon="terp-document-new" string="Unposted" domain="[('move_id.state','=','draft')]" help="Unposted Journal Items"/>
|
||||
<filter icon="terp-camera_test" string="Posted" domain="[('move_id.state','=','posted')]" help="Posted Journal Items"/>
|
||||
<filter name="posted" icon="terp-camera_test" string="Posted" domain="[('move_id.state','=','posted')]" help="Posted Journal Items"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter
|
||||
icon="terp-dolar_ok!"
|
||||
@@ -1216,6 +1216,7 @@
|
||||
<field name="res_model">account.move.line</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="context">{'search_default_posted': 1}</field>
|
||||
<field name="search_view_id" ref="view_account_move_line_filter"/>
|
||||
<field name="help">This view is used by accountants in order to record entries massively in OpenERP. If you want to record a supplier invoice, start by recording the line of the expense account, OpenERP will propose to you automatically the Tax related to this account and the counter-part "Account Payable".</field>
|
||||
</record>
|
||||
|
||||
@@ -95,6 +95,25 @@ class account_installer(osv.osv_memory):
|
||||
'bank_accounts_id': _get_default_accounts,
|
||||
'charts': _get_default_charts
|
||||
}
|
||||
|
||||
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
|
||||
res = super(account_installer, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar,submenu=False)
|
||||
configured_cmp = []
|
||||
unconfigured_cmp = []
|
||||
cmp_select = []
|
||||
company_ids = self.pool.get('res.company').search(cr, uid, [], context=context)
|
||||
cr.execute("SELECT company_id FROM account_account WHERE account_account.parent_id IS NULL")
|
||||
for r in cr.fetchall():
|
||||
configured_cmp.append(r[0])
|
||||
unconfigured_cmp = list(set(company_ids)-set(configured_cmp))
|
||||
if unconfigured_cmp:
|
||||
for line in self.pool.get('res.company').browse(cr, uid, unconfigured_cmp):
|
||||
cmp_select.append((line.id,line.name))
|
||||
for field in res['fields']:
|
||||
if field == 'company_id':
|
||||
res['fields'][field]['domain'] = unconfigured_cmp
|
||||
res['fields'][field]['selection'] = cmp_select
|
||||
return res
|
||||
|
||||
def on_change_tax(self, cr, uid, id, tax):
|
||||
return {'value': {'purchase_tax': tax}}
|
||||
|
||||
@@ -1312,6 +1312,7 @@ class account_invoice_line(osv.osv):
|
||||
if context is None:
|
||||
context = {}
|
||||
company_id = context.get('company_id',False)
|
||||
tax_obj = self.pool.get('account.tax')
|
||||
if not partner_id:
|
||||
raise osv.except_osv(_('No Partner Defined !'),_("You must first select a partner !") )
|
||||
if not product:
|
||||
@@ -1400,17 +1401,24 @@ class account_invoice_line(osv.osv):
|
||||
if a:
|
||||
result['account_id'] = a
|
||||
|
||||
tax_ids = tax_obj.search(cr, uid, [('company_id', '=', company_id)])
|
||||
if type in ('out_invoice', 'out_refund'):
|
||||
taxes = res.taxes_id and res.taxes_id or (a and self.pool.get('account.account').browse(cr, uid, a).tax_ids or False)
|
||||
tax_id = fpos_obj.map_tax(cr, uid, fpos, taxes)
|
||||
sale_taxes_def = map(lambda x: x.id, res.taxes_id)
|
||||
sale_tax_ids = [tax for tax in tax_ids if tax in sale_taxes_def]
|
||||
sale_taxes = tax_obj.browse(cr, uid, sale_tax_ids)
|
||||
sale_taxes_all = sale_taxes and sale_taxes or (a and self.pool.get('account.account').browse(cr, uid, a).tax_ids or False)
|
||||
tax_id = fpos_obj.map_tax(cr, uid, fpos, sale_taxes_all)
|
||||
else:
|
||||
taxes = res.supplier_taxes_id and res.supplier_taxes_id or (a and self.pool.get('account.account').browse(cr, uid, a).tax_ids or False)
|
||||
tax_id = fpos_obj.map_tax(cr, uid, fpos, taxes)
|
||||
pur_taxes_def = map(lambda x: x.id, res.supplier_taxes_id)
|
||||
pur_tax_ids = [tax for tax in tax_ids if tax in pur_taxes_def]
|
||||
pur_taxes = tax_obj.browse(cr, uid, pur_tax_ids)
|
||||
pur_taxes_all = pur_taxes and pur_taxes or (a and self.pool.get('account.account').browse(cr, uid, a).tax_ids or False)
|
||||
tax_id = fpos_obj.map_tax(cr, uid, fpos, pur_taxes_all)
|
||||
|
||||
if type in ('in_invoice', 'in_refund'):
|
||||
result.update( {'price_unit': price_unit or res.standard_price,'invoice_line_tax_id': tax_id} )
|
||||
else:
|
||||
result.update({'price_unit': res.list_price, 'invoice_line_tax_id': tax_id})
|
||||
|
||||
# if not name:
|
||||
result['name'] = res.partner_ref
|
||||
|
||||
|
||||
@@ -60,6 +60,13 @@ class report_balancesheet_horizontal(report_sxw.rml_parse, common_report_header)
|
||||
})
|
||||
self.context = context
|
||||
|
||||
def set_context(self, objects, data, ids, report_type=None):
|
||||
new_ids = ids
|
||||
if (data['model'] == 'ir.ui.menu'):
|
||||
new_ids = 'chart_account_id' in data['form'] and [data['form']['chart_account_id']] or []
|
||||
objects = self.pool.get('account.account').browse(self.cr, self.uid, new_ids)
|
||||
return super(report_balancesheet_horizontal, self).set_context(objects, data, new_ids, report_type=report_type)
|
||||
|
||||
def sum_dr(self):
|
||||
if self.res_bl['type'] == _('Net Profit'):
|
||||
self.result_sum_dr += self.res_bl['balance']*-1
|
||||
|
||||
@@ -94,7 +94,7 @@ class account_entries_report(osv.osv):
|
||||
return super(account_entries_report, self).search(cr, uid, args=args, offset=offset, limit=limit, order=order,
|
||||
context=context, count=count)
|
||||
|
||||
def read_group(self, cr, uid, domain, fields, groupby, offset=0, limit=None, context=None):
|
||||
def read_group(self, cr, uid, domain, fields, groupby, offset=0, limit=None, context=None, orderby=False):
|
||||
todel=[]
|
||||
fiscalyear_obj = self.pool.get('account.fiscalyear')
|
||||
period_obj = self.pool.get('account.period')
|
||||
@@ -112,7 +112,7 @@ class account_entries_report(osv.osv):
|
||||
for a in [['period_id','in','current_year'], ['period_id','in','current_period']]:
|
||||
if a in domain:
|
||||
domain.remove(a)
|
||||
return super(account_entries_report, self).read_group(cr, uid, domain, fields, groupby, offset, limit, context)
|
||||
return super(account_entries_report, self).read_group(cr, uid, domain, fields, groupby, offset, limit, context, orderby)
|
||||
|
||||
def init(self, cr):
|
||||
tools.drop_view_if_exists(cr, 'account_entries_report')
|
||||
|
||||
@@ -56,6 +56,13 @@ class report_pl_account_horizontal(report_sxw.rml_parse, common_report_header):
|
||||
})
|
||||
self.context = context
|
||||
|
||||
def set_context(self, objects, data, ids, report_type=None):
|
||||
new_ids = ids
|
||||
if (data['model'] == 'ir.ui.menu'):
|
||||
new_ids = 'chart_account_id' in data['form'] and [data['form']['chart_account_id']] or []
|
||||
objects = self.pool.get('account.account').browse(self.cr, self.uid, new_ids)
|
||||
return super(report_pl_account_horizontal, self).set_context(objects, data, new_ids, report_type=report_type)
|
||||
|
||||
|
||||
def final_result(self):
|
||||
return self.res_pl
|
||||
|
||||
@@ -33,8 +33,9 @@ class account_chart(osv.osv_memory):
|
||||
help = 'Keep empty for all open fiscal years'),
|
||||
'period_from': fields.many2one('account.period', 'Start period'),
|
||||
'period_to': fields.many2one('account.period', 'End period'),
|
||||
'target_move': fields.selection([('all', 'All Entries'),
|
||||
('posted', 'All Posted Entries')], 'Target Moves', required = True),
|
||||
'target_move': fields.selection([('posted', 'All Posted Entries'),
|
||||
('all', 'All Entries'),
|
||||
], 'Target Moves', required = True),
|
||||
}
|
||||
|
||||
def onchange_fiscalyear(self, cr, uid, ids, fiscalyear_id=False, context=None):
|
||||
@@ -92,7 +93,7 @@ class account_chart(osv.osv_memory):
|
||||
return result
|
||||
|
||||
_defaults = {
|
||||
'target_move': 'all'
|
||||
'target_move': 'posted'
|
||||
}
|
||||
|
||||
account_chart()
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
from lxml import etree
|
||||
|
||||
from osv import osv
|
||||
from osv import osv, fields
|
||||
from tools.translate import _
|
||||
import tools
|
||||
|
||||
@@ -29,6 +29,15 @@ class account_move_journal(osv.osv_memory):
|
||||
_name = "account.move.journal"
|
||||
_description = "Move journal"
|
||||
|
||||
_columns = {
|
||||
'target_move': fields.selection([('posted', 'All Posted Entries'),
|
||||
('all', 'All Entries'),
|
||||
], 'Target Moves', required=True),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'target_move': 'posted'
|
||||
}
|
||||
def _get_period(self, cr, uid, context={}):
|
||||
"""
|
||||
Return default account period value
|
||||
@@ -93,6 +102,8 @@ class account_move_journal(osv.osv_memory):
|
||||
view = """<?xml version="1.0" encoding="utf-8"?>
|
||||
<form string="Standard entries">
|
||||
<separator string="Open Journal Items !" colspan="4"/>
|
||||
<field name="target_move" />
|
||||
<newline/>
|
||||
<group colspan="4" >
|
||||
<label width="300" string="Journal: %s"/>
|
||||
<newline/>
|
||||
@@ -132,6 +143,7 @@ class account_move_journal(osv.osv_memory):
|
||||
|
||||
journal_id = self._get_journal(cr, uid, context)
|
||||
period_id = self._get_period(cr, uid, context)
|
||||
target_move = self.read(cr, uid, ids, [])[0]['target_move']
|
||||
|
||||
name = _("Journal Items")
|
||||
if journal_id:
|
||||
@@ -156,23 +168,26 @@ class account_move_journal(osv.osv_memory):
|
||||
}
|
||||
period_pool.create(cr, uid, res,context=context)
|
||||
|
||||
ids = period_pool.search(cr, uid, [('journal_id', '=', journal_id), ('period_id', '=', period_id)],context=context)
|
||||
ids = period_pool.search(cr, uid, [('journal_id', '=', journal_id), ('period_id', '=', period_id)], context=context)
|
||||
period = period_pool.browse(cr, uid, ids[0], context=context)
|
||||
name = (period.journal_id.code or '') + ':' + (period.period_id.code or '')
|
||||
|
||||
result = data_pool.get_object_reference(cr, uid, 'account', 'view_account_move_line_filter')
|
||||
res_id = result and result[1] or False
|
||||
move = 0
|
||||
if target_move == 'posted':
|
||||
move = 1
|
||||
return {
|
||||
'name': name,
|
||||
'view_type': 'form',
|
||||
'view_mode': 'tree,graph,form',
|
||||
'res_model': 'account.move.line',
|
||||
'view_id': False,
|
||||
'context': "{'visible_id':%s, 'search_default_journal_id':%d, 'search_default_period_id':%d}" % (journal_id, journal_id, period_id),
|
||||
'context': "{'search_default_posted': %d, 'visible_id':%s, 'search_default_journal_id':%d, 'search_default_period_id':%d}" % (move, journal_id, journal_id, period_id),
|
||||
'type': 'ir.actions.act_window',
|
||||
'search_view_id': res_id
|
||||
}
|
||||
|
||||
account_move_journal()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -38,8 +38,9 @@ class account_common_report(osv.osv_memory):
|
||||
'journal_ids': fields.many2many('account.journal', 'account_common_journal_rel', 'account_id', 'journal_id', 'Journals', required=True),
|
||||
'date_from': fields.date("Start Date"),
|
||||
'date_to': fields.date("End Date"),
|
||||
'target_move': fields.selection([('all', 'All Entries'),
|
||||
('posted', 'All Posted Entries')], 'Target Moves', required=True),
|
||||
'target_move': fields.selection([('posted', 'All Posted Entries'),
|
||||
('all', 'All Entries'),
|
||||
], 'Target Moves', required=True),
|
||||
|
||||
}
|
||||
|
||||
@@ -101,7 +102,7 @@ class account_common_report(osv.osv_memory):
|
||||
'journal_ids': _get_all_journal,
|
||||
'filter': 'filter_no',
|
||||
'chart_account_id': _get_account,
|
||||
'target_move': 'all',
|
||||
'target_move': 'posted',
|
||||
}
|
||||
|
||||
def _build_contexts(self, cr, uid, ids, data, context=None):
|
||||
|
||||
@@ -31,8 +31,9 @@ class account_tax_chart(osv.osv_memory):
|
||||
'period_id': fields.many2one('account.period', \
|
||||
'Period', \
|
||||
),
|
||||
'target_move': fields.selection([('all', 'All Entries'),
|
||||
('posted', 'All Posted Entries')], 'Target Moves', required=True),
|
||||
'target_move': fields.selection([('posted', 'All Posted Entries'),
|
||||
('all', 'All Entries'),
|
||||
], 'Target Moves', required=True),
|
||||
}
|
||||
|
||||
def _get_period(self, cr, uid, context=None):
|
||||
@@ -72,7 +73,7 @@ class account_tax_chart(osv.osv_memory):
|
||||
|
||||
_defaults = {
|
||||
'period_id': _get_period,
|
||||
'target_move': 'all'
|
||||
'target_move': 'posted'
|
||||
}
|
||||
|
||||
account_tax_chart()
|
||||
|
||||
@@ -240,7 +240,7 @@ class account_analytic_plan_instance_line(osv.osv):
|
||||
_description = "Analytic Instance Line"
|
||||
_columns = {
|
||||
'plan_id': fields.many2one('account.analytic.plan.instance', 'Plan Id'),
|
||||
'analytic_account_id': fields.many2one('account.analytic.account', 'Analytic Account', required=True),
|
||||
'analytic_account_id': fields.many2one('account.analytic.account', 'Analytic Account', required=True, domain=[('type','<>','view')]),
|
||||
'rate': fields.float('Rate (%)', required=True),
|
||||
}
|
||||
_defaults = {
|
||||
|
||||
@@ -97,19 +97,21 @@ class crossovered_analytic(report_sxw.rml_parse):
|
||||
|
||||
self.final_list = children_list
|
||||
selected_ids = line_pool.search(self.cr, self.uid, [('account_id', 'in' ,self.final_list)])
|
||||
|
||||
res['ref_qty'] = 0.0
|
||||
res['ref_amt'] = 0.0
|
||||
self.base_amount = 0.0
|
||||
|
||||
if selected_ids:
|
||||
query = "SELECT SUM(aal.amount) AS amt, SUM(aal.unit_amount) AS qty FROM account_analytic_line AS aal, account_analytic_account AS aaa \
|
||||
WHERE aal.account_id = aaa.id AND aal.id IN ("+','.join(map(str,selected_ids))+") AND (aal.journal_id " + journal +") AND aal.date>='"+ str(form['date1']) +"'"" AND aal.date<='" + str(form['date2']) + "'"
|
||||
|
||||
self.cr.execute(query)
|
||||
info=self.cr.dictfetchall()
|
||||
|
||||
res['ref_qty'] = info[0]['qty']
|
||||
res['ref_amt'] = info[0]['amt']
|
||||
self.base_amount = info[0]['amt']
|
||||
res['ref_qty'] = 0.0
|
||||
res['ref_amt'] = 0.0
|
||||
self.base_amount = 0.0
|
||||
|
||||
result.append(res)
|
||||
return result
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ class account_crossovered_analytic(osv.osv_memory):
|
||||
'date1': fields.date('Start Date', required=True),
|
||||
'date2': fields.date('End Date', required=True),
|
||||
'journal_ids': fields.many2many('account.analytic.journal', 'crossovered_journal_rel', 'crossover_id', 'journal_id', 'Analytic Journal'),
|
||||
'ref': fields.many2one('account.analytic.account', 'Analytic Account Reference', required=False),
|
||||
'ref': fields.many2one('account.analytic.account', 'Analytic Account Reference', required=True),
|
||||
'empty_line': fields.boolean('Dont show empty lines'),
|
||||
}
|
||||
_defaults = {
|
||||
|
||||
@@ -206,7 +206,7 @@ class account_analytic_line(osv.osv):
|
||||
'date': fields.date('Date', required=True, select=1),
|
||||
'amount': fields.float('Amount', required=True, help='Calculated by multiplying the quantity and the price given in the Product\'s cost price. Always expressed in the company main currency.', digits_compute=dp.get_precision('Account')),
|
||||
'unit_amount': fields.float('Quantity', help='Specifies the amount of quantity to count.'),
|
||||
'account_id': fields.many2one('account.analytic.account', 'Analytic Account', required=True, ondelete='cascade', select=True),
|
||||
'account_id': fields.many2one('account.analytic.account', 'Analytic Account', required=True, ondelete='cascade', select=True, domain=[('type','<>','view')]),
|
||||
'user_id': fields.many2one('res.users', 'User'),
|
||||
'company_id': fields.related('account_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True, readonly=True),
|
||||
|
||||
|
||||
@@ -340,7 +340,7 @@
|
||||
<field name="requirements" colspan="4" nolabel="1"/>
|
||||
</page>
|
||||
<page string="Employee">
|
||||
<field name="employee_ids" colspan='4' nolabel="1" mode="tree,form"/>
|
||||
<field name="employee_ids" colspan='4' nolabel="1" widget="many2many" mode="tree,form"/>
|
||||
</page>
|
||||
</notebook>
|
||||
<group col="6" colspan="4">
|
||||
|
||||
@@ -289,7 +289,7 @@ class hr_timesheet_sheet(osv.osv):
|
||||
'draft': [('readonly', False)],
|
||||
'new': [('readonly', False)]}
|
||||
),
|
||||
'attendances_ids' : one2many_mod2('hr.attendance', 'sheet_id', 'Attendances', readonly=True, states={'draft':[('readonly',False)],'new':[('readonly',False)]}),
|
||||
'attendances_ids' : one2many_mod2('hr.attendance', 'sheet_id', 'Attendances', readonly=True,),
|
||||
'state' : fields.selection([
|
||||
('new', 'New'),
|
||||
('draft','Draft'),
|
||||
|
||||
@@ -75,6 +75,6 @@
|
||||
'demo_xml': [],
|
||||
'installable': True,
|
||||
'active': False,
|
||||
'certificate': '18956603329629',
|
||||
'certificate': '008956603329629',
|
||||
}
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -15,14 +15,7 @@
|
||||
res_model="project.project" view_mode="tree,form"
|
||||
view_type="form"/>
|
||||
|
||||
<act_window
|
||||
id="act_my_account"
|
||||
name="My accounts to invoice"
|
||||
res_model="account.analytic.account"
|
||||
domain="[('user_id','=',uid),('state','<>','close')]"
|
||||
view_id="account.view_account_analytic_account_tree"
|
||||
view_mode="tree,form"
|
||||
view_type="form"/>
|
||||
<act_window domain="[('user_id','=',uid),('state','<>','close')]" id="act_my_account" name="My accounts to invoice" res_model="account.analytic.account" view_mode="tree,form" view_type="form"/>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
Reference in New Issue
Block a user