[MERGE] merge with same branch
bzr revid: qdp-launchpad@tinyerp.com-20100923115214-zusd57juw6giw5v6
This commit is contained in:
@@ -1701,6 +1701,11 @@ class account_tax(osv.osv):
|
||||
ids = self.search(cr, user, args, limit=limit, context=context)
|
||||
return self.name_get(cr, user, ids, context=context)
|
||||
|
||||
def write(self, cr, uid, ids, vals, context=None):
|
||||
if vals.get('type', False) and vals['type'] in ('none', 'code'):
|
||||
vals.update({'amount': 0.0})
|
||||
return super(account_tax, self).write(cr, uid, ids, vals, context=context)
|
||||
|
||||
def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False):
|
||||
journal_pool = self.pool.get('account.journal')
|
||||
|
||||
@@ -1996,26 +2001,28 @@ class account_model(osv.osv):
|
||||
_columns = {
|
||||
'name': fields.char('Model Name', size=64, required=True, help="This is a model for recurring accounting entries"),
|
||||
'journal_id': fields.many2one('account.journal', 'Journal', required=True),
|
||||
'company_id': fields.many2one('res.company', 'Company', required=True),
|
||||
'company_id': fields.related('journal_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True, readonly=True),
|
||||
'lines_id': fields.one2many('account.model.line', 'model_id', 'Model Entries'),
|
||||
'legend' :fields.text('Legend', readonly=True, size=100),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'legend': lambda self, cr, uid, context:_('You can specify year, month and date in the name of the model using the following labels:\n\n%(year)s : To Specify Year \n%(month)s : To Specify Month \n%(date)s : Current Date\n\ne.g. My model on %(date)s'),
|
||||
'company_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id,
|
||||
}
|
||||
def generate(self, cr, uid, ids, datas={}, context={}):
|
||||
def generate(self, cr, uid, ids, datas={}, context=None):
|
||||
move_ids = []
|
||||
entry = {}
|
||||
account_move_obj = self.pool.get('account.move')
|
||||
account_move_line_obj = self.pool.get('account.move.line')
|
||||
pt_obj = self.pool.get('account.payment.term')
|
||||
|
||||
if datas.get('date', False):
|
||||
context.update({'date':datas['date']})
|
||||
period_id = self.pool.get('account.period').find(cr, uid, dt=context.get('date', False))
|
||||
if context is None:
|
||||
context = {}
|
||||
|
||||
if datas.get('date', False):
|
||||
context.update({'date': datas['date']})
|
||||
|
||||
period_id = self.pool.get('account.period').find(cr, uid, dt=context.get('date', False))
|
||||
if not period_id:
|
||||
raise osv.except_osv(_('No period found !'), _('Unable to find a valid period !'))
|
||||
period_id = period_id[0]
|
||||
@@ -2069,7 +2076,9 @@ class account_model(osv.osv):
|
||||
c = context.copy()
|
||||
c.update({'journal_id': model.journal_id.id,'period_id': period_id})
|
||||
account_move_line_obj.create(cr, uid, val, context=c)
|
||||
|
||||
return move_ids
|
||||
|
||||
account_model()
|
||||
|
||||
class account_model_line(osv.osv):
|
||||
|
||||
@@ -176,15 +176,15 @@ class account_bank_statement(osv.osv):
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'name': lambda *a: "/",
|
||||
'date': lambda *a: time.strftime('%Y-%m-%d'),
|
||||
'state': lambda *a: 'draft',
|
||||
'name': "/",
|
||||
'date': time.strftime('%Y-%m-%d'),
|
||||
'state': 'draft',
|
||||
'balance_start': _default_balance_start,
|
||||
'journal_id': _default_journal_id,
|
||||
'period_id': _get_period,
|
||||
}
|
||||
|
||||
def onchange_date(self, cr, user, ids, date, context={}):
|
||||
def onchange_date(self, cr, user, ids, date, context=None):
|
||||
"""
|
||||
Returns a dict that contains new values and context
|
||||
@param cr: A database cursor
|
||||
@@ -196,6 +196,10 @@ class account_bank_statement(osv.osv):
|
||||
"""
|
||||
res = {}
|
||||
period_pool = self.pool.get('account.period')
|
||||
|
||||
if context is None:
|
||||
context = {}
|
||||
|
||||
pids = period_pool.search(cr, user, [('date_start','<=',date), ('date_stop','>=',date)])
|
||||
if pids:
|
||||
res.update({
|
||||
@@ -210,10 +214,8 @@ class account_bank_statement(osv.osv):
|
||||
'context':context,
|
||||
}
|
||||
|
||||
def button_dummy(self, cr, uid, ids, context={}):
|
||||
self.write(cr, uid, ids, {}, context)
|
||||
return True
|
||||
|
||||
def button_dummy(self, cr, uid, ids, context=None):
|
||||
return self.write(cr, uid, ids, {}, context=context)
|
||||
|
||||
def create_move_from_st_line(self, cr, uid, st_line_id, company_currency_id, st_line_number, context=None):
|
||||
res_currency_obj = self.pool.get('res.currency')
|
||||
@@ -348,7 +350,7 @@ class account_bank_statement(osv.osv):
|
||||
company_currency_id = st.journal_id.company_id.currency_id.id
|
||||
if not self.check_status_condition(cr, uid, st.state, journal_type=j_type):
|
||||
continue
|
||||
|
||||
|
||||
self.balance_check(cr, uid, st.id, journal_type=j_type, context=context)
|
||||
if (not st.journal_id.default_credit_account_id) \
|
||||
or (not st.journal_id.default_debit_account_id):
|
||||
@@ -382,7 +384,7 @@ class account_bank_statement(osv.osv):
|
||||
done.append(st.id)
|
||||
return self.write(cr, uid, ids, {'state':'confirm'}, context=context)
|
||||
|
||||
def button_cancel(self, cr, uid, ids, context={}):
|
||||
def button_cancel(self, cr, uid, ids, context=None):
|
||||
done = []
|
||||
for st in self.browse(cr, uid, ids, context):
|
||||
if st.state=='draft':
|
||||
@@ -392,8 +394,7 @@ class account_bank_statement(osv.osv):
|
||||
ids += [x.id for x in line.move_ids]
|
||||
self.pool.get('account.move').unlink(cr, uid, ids, context)
|
||||
done.append(st.id)
|
||||
self.write(cr, uid, done, {'state':'draft'}, context=context)
|
||||
return True
|
||||
return self.write(cr, uid, done, {'state':'draft'}, context=context)
|
||||
|
||||
def onchange_journal_id(self, cursor, user, statement_id, journal_id, context=None):
|
||||
account_journal_obj = self.pool.get('account.journal')
|
||||
@@ -424,7 +425,7 @@ class account_bank_statement(osv.osv):
|
||||
context = {}
|
||||
default = default.copy()
|
||||
default['move_line_ids'] = []
|
||||
return super(account_bank_statement, self).copy(cr, uid, id, default, context)
|
||||
return super(account_bank_statement, self).copy(cr, uid, id, default, context=context)
|
||||
|
||||
account_bank_statement()
|
||||
|
||||
@@ -496,8 +497,8 @@ class account_bank_statement_line(osv.osv):
|
||||
}
|
||||
_defaults = {
|
||||
'name': lambda self,cr,uid,context={}: self.pool.get('ir.sequence').get(cr, uid, 'account.bank.statement.line'),
|
||||
'date': lambda *a: time.strftime('%Y-%m-%d'),
|
||||
'type': lambda *a: 'general',
|
||||
'date': time.strftime('%Y-%m-%d'),
|
||||
'type': 'general',
|
||||
}
|
||||
|
||||
account_bank_statement_line()
|
||||
|
||||
@@ -95,8 +95,8 @@
|
||||
<field name="code"/>
|
||||
<field name="date_start"/>
|
||||
<field name="date_stop"/>
|
||||
<field name="company_id" groups="base.group_multi_company"/>
|
||||
<field name="fiscalyear_id"/>
|
||||
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
|
||||
<field name="fiscalyear_id" widget="selection"/>
|
||||
<field name="special"/>
|
||||
<separator colspan="4" string="States"/>
|
||||
<field name="state"/>
|
||||
@@ -528,7 +528,7 @@
|
||||
<field name="type"/>
|
||||
<field name="partner_id" on_change="onchange_partner_id(partner_id, type, parent.currency, {'amount': amount})"/>
|
||||
<field domain="[('journal_id','=',parent.journal_id)]" name="account_id"/>
|
||||
<field name="analytic_account_id" groups="base.group_extended"/>
|
||||
<field name="analytic_account_id" groups="base.group_extended" domain="[('company_id', '=', parent.company_id), ('type', '<>', 'view')]"/>
|
||||
<field name="amount"/>
|
||||
</tree>
|
||||
<form string="Statement lines">
|
||||
@@ -537,7 +537,7 @@
|
||||
<field name="type"/>
|
||||
<field name="partner_id" on_change="onchange_partner_id(partner_id, type, parent.currency, {'amount': amount})"/>
|
||||
<field domain="[('journal_id', '=', parent.journal_id), ('type', '<>', 'view')]" name="account_id"/>
|
||||
<field name="analytic_account_id" groups="base.group_extended" />
|
||||
<field name="analytic_account_id" groups="base.group_extended" domain="[('company_id', '=', parent.company_id), ('type', '<>', 'view')]"/>
|
||||
<field name="amount"/>
|
||||
<field name="ref"/>
|
||||
<field name="sequence" readonly="0"/>
|
||||
@@ -849,7 +849,7 @@
|
||||
<notebook colspan="4">
|
||||
<page string="Tax Definition">
|
||||
<field name="applicable_type"/>
|
||||
<field name="amount" attrs="{'readonly':[('type','=','none'),('type','=','code')]}"/>
|
||||
<field name="amount" attrs="{'readonly':[('type','in',('none', 'code'))]}"/>
|
||||
<field groups="base.group_extended" name="include_base_amount"/>
|
||||
<field groups="base.group_extended" name="domain"/>
|
||||
<newline/>
|
||||
|
||||
@@ -348,6 +348,7 @@
|
||||
<field name="sequence_id" ref="sequence_sale_journal"/>
|
||||
<field model="account.account" name="default_credit_account_id" ref="a_sale"/>
|
||||
<field model="account.account" name="default_debit_account_id" ref="a_sale"/>
|
||||
<field name="analytic_journal_id" ref="cose_journal_sale"/>
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
</record>
|
||||
<record id="refund_sales_journal" model="account.journal">
|
||||
@@ -359,6 +360,7 @@
|
||||
<field name="sequence_id" ref="sequence_sale_journal"/>
|
||||
<field model="account.account" name="default_credit_account_id" ref="a_sale"/>
|
||||
<field model="account.account" name="default_debit_account_id" ref="a_sale"/>
|
||||
<field name="analytic_journal_id" ref="cose_journal_sale"/>
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
</record>
|
||||
|
||||
@@ -370,6 +372,7 @@
|
||||
<field name="sequence_id" ref="sequence_purchase_journal"/>
|
||||
<field model="account.account" name="default_debit_account_id" ref="a_expense"/>
|
||||
<field model="account.account" name="default_credit_account_id" ref="a_expense"/>
|
||||
<field name="analytic_journal_id" ref="exp"/>
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
</record>
|
||||
<record id="refund_expenses_journal" model="account.journal">
|
||||
@@ -381,6 +384,7 @@
|
||||
<field name="sequence_id" ref="sequence_purchase_journal"/>
|
||||
<field model="account.account" name="default_debit_account_id" ref="a_expense"/>
|
||||
<field model="account.account" name="default_credit_account_id" ref="a_expense"/>
|
||||
<field name="analytic_journal_id" ref="exp"/>
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
</record>
|
||||
|
||||
@@ -392,6 +396,7 @@
|
||||
<field name="sequence_id" ref="sequence_journal"/>
|
||||
<field model="account.account" name="default_debit_account_id" ref="cash"/>
|
||||
<field model="account.account" name="default_credit_account_id" ref="cash"/>
|
||||
<field name="analytic_journal_id" ref="sit"/>
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
</record>
|
||||
<record id="check_journal" model="account.journal">
|
||||
@@ -402,6 +407,7 @@
|
||||
<field name="sequence_id" ref="sequence_journal"/>
|
||||
<field model="account.account" name="default_debit_account_id" ref="cash"/>
|
||||
<field model="account.account" name="default_credit_account_id" ref="cash"/>
|
||||
<field name="analytic_journal_id" ref="sit"/>
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
</record>
|
||||
<record id="cash_journal" model="account.journal">
|
||||
@@ -412,6 +418,7 @@
|
||||
<field name="sequence_id" ref="sequence_journal"/>
|
||||
<field model="account.account" name="default_debit_account_id" ref="cash"/>
|
||||
<field model="account.account" name="default_credit_account_id" ref="cash"/>
|
||||
<field name="analytic_journal_id" ref="sit"/>
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
</record>
|
||||
|
||||
|
||||
+40
-25
@@ -67,13 +67,13 @@ class account_installer(osv.osv_memory):
|
||||
'company_id': fields.many2one('res.company', 'Company'),
|
||||
}
|
||||
|
||||
def _default_company(self, cr, uid, context={}):
|
||||
def _default_company(self, cr, uid, context=None):
|
||||
user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
|
||||
if user.company_id:
|
||||
return user.company_id.id
|
||||
return False
|
||||
|
||||
def _get_default_charts(self, cr, uid, context={}):
|
||||
def _get_default_charts(self, cr, uid, context=None):
|
||||
module_name = False
|
||||
company_id = self._default_company(cr, uid, context=context)
|
||||
company = self.pool.get('res.company').browse(cr, uid, company_id)
|
||||
@@ -91,18 +91,18 @@ class account_installer(osv.osv_memory):
|
||||
_defaults = {
|
||||
'date_start': lambda *a: time.strftime('%Y-01-01'),
|
||||
'date_stop': lambda *a: time.strftime('%Y-12-31'),
|
||||
'period':lambda *a:'month',
|
||||
'sale_tax':lambda *a:0.0,
|
||||
'purchase_tax':lambda *a:0.0,
|
||||
'period': lambda *a:'month',
|
||||
'sale_tax': lambda *a:0.0,
|
||||
'purchase_tax': lambda *a:0.0,
|
||||
'company_id': _default_company,
|
||||
'bank_accounts_id':_get_default_accounts,
|
||||
'bank_accounts_id': _get_default_accounts,
|
||||
'charts': _get_default_charts
|
||||
}
|
||||
|
||||
def on_change_tax(self, cr, uid, id, tax):
|
||||
return {'value':{'purchase_tax':tax}}
|
||||
|
||||
def on_change_start_date(self, cr, uid, id, start_date):
|
||||
def on_change_start_date(self, cr, uid, id, start_date=False):
|
||||
if start_date:
|
||||
start_date = datetime.datetime.strptime(start_date, "%Y-%m-%d")
|
||||
end_date = (start_date + relativedelta(months=12)) - relativedelta(days=1)
|
||||
@@ -117,7 +117,6 @@ class account_installer(osv.osv_memory):
|
||||
obj_acc_template = self.pool.get('account.account.template')
|
||||
obj_fiscal_position_template = self.pool.get('account.fiscal.position.template')
|
||||
obj_fiscal_position = self.pool.get('account.fiscal.position')
|
||||
data_pool = self.pool.get('ir.model.data')
|
||||
mod_obj = self.pool.get('ir.model.data')
|
||||
|
||||
result = mod_obj._get_id(cr, uid, 'account', 'configurable_chart_template')
|
||||
@@ -211,7 +210,7 @@ class account_installer(osv.osv_memory):
|
||||
vals={
|
||||
'name': (obj_acc_root.id == account_template.id) and company_id.name or account_template.name,
|
||||
#'sign': account_template.sign,
|
||||
#'currency_id': account_template.currency_id and account_template.currency_id.id or False,
|
||||
'currency_id': account_template.currency_id and account_template.currency_id.id or False,
|
||||
'code': code_acc,
|
||||
'type': account_template.type,
|
||||
'user_type': account_template.user_type and account_template.user_type.id or False,
|
||||
@@ -237,7 +236,7 @@ class account_installer(osv.osv_memory):
|
||||
'company_id': company_id.id,
|
||||
}
|
||||
bank_account = obj_acc.create(cr, uid, b_vals)
|
||||
|
||||
|
||||
view_id_cash = self.pool.get('account.journal.view').search(cr,uid,[('name','=','Bank/Cash Journal View')])[0] #why fixed name here?
|
||||
view_id_cur = self.pool.get('account.journal.view').search(cr,uid,[('name','=','Bank/Cash Journal (Multi-Currency) View')])[0] #Why Fixed name here?
|
||||
ref_acc_bank = obj_multi.bank_account_view_id
|
||||
@@ -262,11 +261,14 @@ class account_installer(osv.osv_memory):
|
||||
seq_id = obj_sequence.create(cr,uid,vals_seq)
|
||||
|
||||
#create the bank journals
|
||||
sit_res = mod_obj._get_id(cr, uid, 'account', 'sit')
|
||||
sit_id = mod_obj.read(cr, uid, [sit_res], ['res_id'])[0]['res_id']
|
||||
vals_journal = {}
|
||||
vals_journal['name']= _('Bank Journal ')
|
||||
vals_journal['code']= _('BNK')
|
||||
vals_journal['sequence_id'] = seq_id
|
||||
vals_journal['type'] = 'cash'
|
||||
vals_journal['analytic_journal_id'] = sit_id
|
||||
if vals.get('currency_id', False):
|
||||
vals_journal['view_id'] = view_id_cur
|
||||
vals_journal['currency'] = vals.get('currency_id', False)
|
||||
@@ -321,6 +323,7 @@ class account_installer(osv.osv_memory):
|
||||
vals_journal['view_id'] = view_id_cash
|
||||
vals_journal['default_credit_account_id'] = child_bnk_acc
|
||||
vals_journal['default_debit_account_id'] = child_bnk_acc
|
||||
vals_journal['analytic_journal_id'] = sit_id
|
||||
obj_journal.create(cr,uid,vals_journal)
|
||||
code_cnt += 1
|
||||
|
||||
@@ -366,10 +369,15 @@ class account_installer(osv.osv_memory):
|
||||
vals_journal['view_id'] = view_id
|
||||
|
||||
#Sales Journal
|
||||
result = mod_obj._get_id(cr, uid, 'account', 'cose_journal_sale')
|
||||
sale_id = mod_obj.read(cr, uid, [result], ['res_id'])[0]['res_id']
|
||||
|
||||
vals_journal['name'] = _('Sales Journal')
|
||||
vals_journal['type'] = 'sale'
|
||||
vals_journal['code'] = _('SAJ')
|
||||
vals_journal['sequence_id'] = seq_id_sale
|
||||
vals_journal['analytic_journal_id'] = sale_id
|
||||
|
||||
|
||||
if obj_multi.property_account_receivable:
|
||||
vals_journal['default_credit_account_id'] = acc_template_ref[obj_multi.property_account_income_categ.id]
|
||||
@@ -378,10 +386,14 @@ class account_installer(osv.osv_memory):
|
||||
obj_journal.create(cr,uid,vals_journal)
|
||||
|
||||
# Purchase Journal
|
||||
result = mod_obj._get_id(cr, uid, 'account', 'exp')
|
||||
pur_id = mod_obj.read(cr, uid, [result], ['res_id'])[0]['res_id']
|
||||
|
||||
vals_journal['name'] = _('Purchase Journal')
|
||||
vals_journal['type'] = 'purchase'
|
||||
vals_journal['code'] = _('EXJ')
|
||||
vals_journal['sequence_id'] = seq_id_purchase
|
||||
vals_journal['analytic_journal_id'] = pur_id
|
||||
|
||||
if obj_multi.property_account_payable:
|
||||
vals_journal['default_credit_account_id'] = acc_template_ref[obj_multi.property_account_expense_categ.id]
|
||||
@@ -406,6 +418,7 @@ class account_installer(osv.osv_memory):
|
||||
vals_journal['refund_journal'] = True
|
||||
vals_journal['code'] = _('SCNJ')
|
||||
vals_journal['sequence_id'] = seq_id_sale_refund
|
||||
vals_journal['analytic_journal_id'] = sale_id
|
||||
|
||||
if obj_multi.property_account_receivable:
|
||||
vals_journal['default_credit_account_id'] = acc_template_ref[obj_multi.property_account_income_categ.id]
|
||||
@@ -419,6 +432,7 @@ class account_installer(osv.osv_memory):
|
||||
vals_journal['refund_journal'] = True
|
||||
vals_journal['code'] = _('ECNJ')
|
||||
vals_journal['sequence_id'] = seq_id_purchase_refund
|
||||
vals_journal['analytic_journal_id'] = pur_id
|
||||
|
||||
if obj_multi.property_account_payable:
|
||||
vals_journal['default_credit_account_id'] = acc_template_ref[obj_multi.property_account_expense_categ.id]
|
||||
@@ -519,7 +533,7 @@ class account_installer(osv.osv_memory):
|
||||
p_tax = (res.get('purchase_tax',0.0))/100
|
||||
tax_val = {}
|
||||
default_tax = []
|
||||
|
||||
|
||||
pur_temp_tax = mod_obj._get_id(cr, uid, 'account', 'tax_code_base_purchases')
|
||||
pur_temp_tax_id = mod_obj.read(cr, uid, [pur_temp_tax], ['res_id'])[0]['res_id']
|
||||
pur_temp_tax_names = obj_temp_tax_code.read(cr, uid, [pur_temp_tax_id], ['name'])
|
||||
@@ -529,7 +543,7 @@ class account_installer(osv.osv_memory):
|
||||
pur_taxcode_parent_id = pur_taxcode_parent_id[0]
|
||||
else:
|
||||
pur_taxcode_parent_id = False
|
||||
|
||||
|
||||
pur_temp_tax_paid = mod_obj._get_id(cr, uid, 'account', 'tax_code_input')
|
||||
pur_temp_tax_paid_id = mod_obj.read(cr, uid, [pur_temp_tax_paid], ['res_id'])[0]['res_id']
|
||||
pur_temp_tax_paid_names = obj_temp_tax_code.read(cr, uid, [pur_temp_tax_paid_id], ['name'])
|
||||
@@ -539,7 +553,7 @@ class account_installer(osv.osv_memory):
|
||||
pur_taxcode_paid_parent_id = pur_taxcode_paid_parent_id[0]
|
||||
else:
|
||||
pur_taxcode_paid_parent_id = False
|
||||
|
||||
|
||||
sale_temp_tax = mod_obj._get_id(cr, uid, 'account', 'tax_code_base_sales')
|
||||
sale_temp_tax_id = mod_obj.read(cr, uid, [sale_temp_tax], ['res_id'])[0]['res_id']
|
||||
sale_temp_tax_names = obj_temp_tax_code.read(cr, uid, [sale_temp_tax_id], ['name'])
|
||||
@@ -549,7 +563,7 @@ class account_installer(osv.osv_memory):
|
||||
sale_taxcode_parent_id = sale_taxcode_parent_id[0]
|
||||
else:
|
||||
sale_taxcode_parent_id = False
|
||||
|
||||
|
||||
sale_temp_tax_paid = mod_obj._get_id(cr, uid, 'account', 'tax_code_output')
|
||||
sale_temp_tax_paid_id = mod_obj.read(cr, uid, [sale_temp_tax_paid], ['res_id'])[0]['res_id']
|
||||
sale_temp_tax_paid_names = obj_temp_tax_code.read(cr, uid, [sale_temp_tax_paid_id], ['name'])
|
||||
@@ -571,7 +585,7 @@ class account_installer(osv.osv_memory):
|
||||
'parent_id': sale_taxcode_parent_id
|
||||
}
|
||||
new_tax_code = self.pool.get('account.tax.code').create(cr, uid, vals_tax_code)
|
||||
|
||||
|
||||
vals_paid_tax_code = {
|
||||
'name': 'TAX Paid %s%%'%(s_tax*100),
|
||||
'code': 'TAX Paid %s%%'%(s_tax*100),
|
||||
@@ -580,7 +594,7 @@ class account_installer(osv.osv_memory):
|
||||
'parent_id': sale_taxcode_paid_parent_id
|
||||
}
|
||||
new_paid_tax_code = self.pool.get('account.tax.code').create(cr, uid, vals_paid_tax_code)
|
||||
|
||||
|
||||
sales_tax = obj_tax.create(cr, uid,
|
||||
{'name':'TAX%s%%'%(s_tax*100),
|
||||
'description':'TAX%s%%'%(s_tax*100),
|
||||
@@ -601,13 +615,13 @@ class account_installer(osv.osv_memory):
|
||||
purchase_tax_account_id = tax_account_ids and tax_account_ids[0] or False
|
||||
vals_tax_code = {
|
||||
'name': 'TAX%s%%'%(p_tax*100),
|
||||
'code': 'TAX%s%%'%(p_tax*100),
|
||||
'code': 'TAX%s%%'%(p_tax*100),
|
||||
'company_id': company_id.id,
|
||||
'sign': 1,
|
||||
'parent_id': pur_taxcode_parent_id
|
||||
}
|
||||
new_tax_code = self.pool.get('account.tax.code').create(cr, uid, vals_tax_code)
|
||||
|
||||
|
||||
vals_paid_tax_code = {
|
||||
'name': 'TAX Paid %s%%'%(p_tax*100),
|
||||
'code': 'TAX Paid %s%%'%(p_tax*100),
|
||||
@@ -616,7 +630,7 @@ class account_installer(osv.osv_memory):
|
||||
'parent_id': pur_taxcode_paid_parent_id
|
||||
}
|
||||
new_paid_tax_code = self.pool.get('account.tax.code').create(cr, uid, vals_paid_tax_code)
|
||||
|
||||
|
||||
purchase_tax = obj_tax.create(cr, uid,
|
||||
{'name':'TAX%s%%'%(p_tax*100),
|
||||
'description':'TAX%s%%'%(p_tax*100),
|
||||
@@ -680,9 +694,9 @@ class account_bank_accounts_wizard(osv.osv_memory):
|
||||
'currency_id': fields.many2one('res.currency', 'Secondary Currency', help="Forces all moves for this account to have this secondary currency."),
|
||||
'account_type': fields.selection([('cash','Cash'),('check','Check'),('bank','Bank')], 'Account Type', size=32),
|
||||
}
|
||||
_defaults = {
|
||||
'currency_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.currency_id.id,
|
||||
}
|
||||
# _defaults = {
|
||||
# 'currency_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.currency_id.id,
|
||||
# }
|
||||
|
||||
account_bank_accounts_wizard()
|
||||
|
||||
@@ -710,11 +724,12 @@ class account_installer_modules(osv.osv_memory):
|
||||
# 'account_voucher_payment':fields.boolean('Voucher and Reconcile Management',
|
||||
# help="Extension Account Voucher module includes allows to link payment / receipt "
|
||||
# "entries with voucher, also automatically reconcile during the payment and receipt entries."),
|
||||
}
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'account_voucher': True,
|
||||
}
|
||||
}
|
||||
|
||||
account_installer_modules()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -13,7 +13,7 @@
|
||||
</record>
|
||||
<record id="sit" model="account.analytic.journal">
|
||||
<field name="code">START</field>
|
||||
<field name="name">Starting Balance</field>
|
||||
<field name="name">Miscellaneous Operation</field>
|
||||
<field name="type">situation</field>
|
||||
</record>
|
||||
</data>
|
||||
|
||||
@@ -41,14 +41,17 @@
|
||||
I clicked on Change Currency button to change the currency
|
||||
-
|
||||
!python {model: account.change.currency}: |
|
||||
self.view_init(cr, uid, [ref("account_change_currency_0")], {"lang": 'en_US',
|
||||
"active_model": "account.invoice", "tz": False, "record_id": 4, "active_ids":
|
||||
[ref("account_invoice_currency")], "type": "out_invoice", "active_id": ref("account_invoice_currency"),
|
||||
})
|
||||
self.change_currency(cr, uid, [ref("account_change_currency_0")], {"lang": 'en_US',
|
||||
"active_model": "account.invoice", "tz": False, "record_id": 4, "active_ids":
|
||||
[ref("account_invoice_currency")], "type": "out_invoice", "active_id": ref("account_invoice_currency"),
|
||||
})
|
||||
try:
|
||||
self.view_init(cr, uid, [ref("account_change_currency_0")], {"lang": 'en_US',
|
||||
"active_model": "account.invoice", "tz": False, "record_id": 4, "active_ids":
|
||||
[ref("account_invoice_currency")], "type": "out_invoice", "active_id": ref("account_invoice_currency"),
|
||||
})
|
||||
self.change_currency(cr, uid, [ref("account_change_currency_0")], {"lang": 'en_US',
|
||||
"active_model": "account.invoice", "tz": False, "record_id": 4, "active_ids":
|
||||
[ref("account_invoice_currency")], "type": "out_invoice", "active_id": ref("account_invoice_currency"),
|
||||
})
|
||||
except:
|
||||
print "Error: You can change currency only for Draft Invoice !"
|
||||
-
|
||||
I can't change the currency of invoice when it is not in draft state so i change the state to cancel
|
||||
-
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
-
|
||||
In order to test Generate Fiscalyear Opening Entries wizard of OpenERP I first create a fiscalyear "Fiscal Year 2011" to which the entries will move
|
||||
In order to test Generate Fiscalyear Opening Entries wizard of OpenERP I first create a fiscalyear to which the entries will move
|
||||
-
|
||||
!record {model: account.fiscalyear, id: account_fiscalyear_fiscalyear0}:
|
||||
code: FY2011
|
||||
code: !eval "'FY%s'% (datetime.now().year+1)"
|
||||
company_id: base.main_company
|
||||
date_start: '2011-01-01'
|
||||
date_stop: '2011-12-31'
|
||||
name: Fiscal Year 2011
|
||||
date_start: !eval "'%s-01-01' %(datetime.now().year+1)"
|
||||
date_stop: !eval "'%s-12-31' %(datetime.now().year+1)"
|
||||
name: !eval "'Fiscal Year %s' %(datetime.now().year+1)"
|
||||
-
|
||||
I create a period "Jan2011" for the new fiscalyear
|
||||
I create a period for the month of january for the new fiscalyear
|
||||
-
|
||||
!record {model: account.period, id: account_period_jan11}:
|
||||
company_id: base.main_company
|
||||
date_start: '2011-01-01'
|
||||
date_stop: '2011-12-31'
|
||||
date_start: !eval "'%s-01-01'% (datetime.now().year+1)"
|
||||
date_stop: !eval "'%s-12-31'% (datetime.now().year+1)"
|
||||
fiscalyear_id: account_fiscalyear_fiscalyear0
|
||||
name: Jan2011
|
||||
name: !eval "'Jan%s' %(datetime.now().year+1)"
|
||||
special: 1
|
||||
|
||||
-
|
||||
@@ -90,7 +90,4 @@
|
||||
# self.action_open_window(cr, uid, [ref("account_move_journal_2")], {"lang": 'en_US',
|
||||
# "active_model": "ir.ui.menu", "active_ids": [ref("account.menu_action_move_journal_line_form")],
|
||||
# "tz": False, "active_id": ref("account.menu_action_move_journal_line_form"),
|
||||
# })
|
||||
|
||||
|
||||
|
||||
# })
|
||||
@@ -3,11 +3,11 @@
|
||||
In order to check the Close a Fiscal Year wizard in OpenERP I first create a Fiscalyear
|
||||
-
|
||||
!record {model: account.fiscalyear, id: account_fiscalyear_fiscalyear0}:
|
||||
code: FY2011
|
||||
code: !eval "'FY%s'% (datetime.now().year+1)"
|
||||
company_id: base.main_company
|
||||
date_start: '2011-01-01'
|
||||
date_stop: '2011-12-31'
|
||||
name: Fiscal Year 2011
|
||||
date_start: !eval "'%s-01-01' %(datetime.now().year+1)"
|
||||
date_stop: !eval "'%s-12-31' %(datetime.now().year+1)"
|
||||
name: !eval "'Fiscal Year %s' %(datetime.now().year+1)"
|
||||
-
|
||||
I create monthly Periods for this fiscalyear
|
||||
-
|
||||
|
||||
@@ -75,7 +75,7 @@
|
||||
|
||||
<menuitem name="Coda Import Logs" parent="account.menu_finance_bank_and_cash" id="menu_account_coda_statement" action="action_account_coda" groups="base.group_extended" sequence="32"/>
|
||||
|
||||
<menuitem name="Import Coda Statements" action="action_account_coda_import" parent="account.menu_account_coda"
|
||||
<menuitem name="Import Coda Statements" action="action_account_coda_import" parent="account.menu_account_pp_statements"
|
||||
id="menu_account_coda_import" sequence="20"/>
|
||||
|
||||
<act_window name="Coda File"
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
##############################################################################
|
||||
|
||||
import time
|
||||
from lxml import etree
|
||||
|
||||
import netsvc
|
||||
from osv import fields
|
||||
from osv import osv
|
||||
@@ -61,6 +63,8 @@ class account_voucher(osv.osv):
|
||||
return context.get('search_default_journal_id')
|
||||
|
||||
ttype = context.get('type', 'bank')
|
||||
if ttype in ('payment', 'receipt'):
|
||||
ttype = 'bank'
|
||||
res = journal_pool.search(cr, uid, [('type', '=', ttype)], limit=1)
|
||||
return res and res[0] or False
|
||||
|
||||
@@ -92,21 +96,35 @@ class account_voucher(osv.osv):
|
||||
if journal.currency:
|
||||
currency_id = journal.currency.id
|
||||
return False
|
||||
|
||||
|
||||
def _get_partner(self, cr, uid, context={}):
|
||||
return context.get('partner_id', False)
|
||||
|
||||
|
||||
def _get_reference(self, cr, uid, context={}):
|
||||
return context.get('reference', False)
|
||||
|
||||
|
||||
def _get_narration(self, cr, uid, context={}):
|
||||
return context.get('narration', False)
|
||||
|
||||
|
||||
|
||||
def name_get(self, cr, uid, ids, context=None):
|
||||
if not len(ids):
|
||||
return []
|
||||
return [(r['id'], (str(r['amount']) or '')) for r in self.read(cr, uid, ids, ['amount'], context, load='_classic_write')]
|
||||
|
||||
def fields_view_get(self, cr, uid, view_id=None, view_type=False, context=None, toolbar=False, submenu=False):
|
||||
res = super(account_voucher,self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu)
|
||||
doc = etree.XML(res['arch'])
|
||||
nodes = doc.xpath("//field[@name='partner_id']")
|
||||
if context.get('type', 'sale') in ('purchase', 'payment'):
|
||||
for node in nodes:
|
||||
node.set('domain', "[('supplier', '=', True)]")
|
||||
res['arch'] = etree.tostring(doc)
|
||||
return res
|
||||
|
||||
_name = 'account.voucher'
|
||||
_description = 'Accounting Voucher'
|
||||
_order = "date desc, id desc"
|
||||
_rec_name = 'number'
|
||||
# _rec_name = 'number'
|
||||
_columns = {
|
||||
'type':fields.selection([
|
||||
('sale','Sale'),
|
||||
|
||||
@@ -23,13 +23,6 @@
|
||||
<field name="journal_id" widget="selection" context="{'journal_id': self, 'set_visible':False}" domain="[('type','in',('bank','cash'))]"/>
|
||||
<field name="period_id" groups="base.group_extended"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Extended options..." col='8' colspan='4'>
|
||||
<field name="reference"/>
|
||||
<field name="name"/>
|
||||
<field name="narration"/>
|
||||
<field name="amount"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Group By..." colspan="4" col="10">
|
||||
<filter string="Customer" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/>
|
||||
@@ -37,6 +30,13 @@
|
||||
<filter string="Period" icon="terp-go-month" domain="[]" context="{'group_by':'period_id','visible':True}"/>
|
||||
<filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Extended options..." col='8' colspan='4'>
|
||||
<field name="reference"/>
|
||||
<field name="name"/>
|
||||
<field name="narration"/>
|
||||
<field name="amount"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
@@ -63,13 +63,6 @@
|
||||
<field name="journal_id" widget="selection" context="{'journal_id': self, 'set_visible':False}" domain="[('type','in',('bank','cash'))]"/>
|
||||
<field name="period_id" groups="base.group_extended"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Extended options..." col='8' colspan='4'>
|
||||
<field name="reference"/>
|
||||
<field name="name"/>
|
||||
<field name="narration"/>
|
||||
<field name="amount"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Group By..." colspan="4" col="10">
|
||||
<filter string="Supplier" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/>
|
||||
@@ -77,6 +70,13 @@
|
||||
<filter string="Period" icon="terp-go-month" domain="[]" context="{'group_by':'period_id','visible':True}"/>
|
||||
<filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Extended options..." col='8' colspan='4'>
|
||||
<field name="reference"/>
|
||||
<field name="name"/>
|
||||
<field name="narration"/>
|
||||
<field name="amount"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
@@ -151,7 +151,7 @@
|
||||
<field name="arch" type="xml">
|
||||
<form string="Bill Payment">
|
||||
<group col="6" colspan="4">
|
||||
<field name="partner_id" required="1" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type)" context="{'invoice_currency':currency_id}" string="Vendor"/>
|
||||
<field name="partner_id" domain="[('supplier','=',True)]" required="1" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type)" context="{'invoice_currency':currency_id}" string="Vendor"/>
|
||||
<field name="journal_id"
|
||||
domain="[('type','in',['bank', 'cash'])]"
|
||||
widget="selection" select="1"
|
||||
@@ -225,7 +225,7 @@
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="action_vendor_payment" model="ir.actions.act_window">
|
||||
<field name="name">Vendor Payment</field>
|
||||
<field name="res_model">account.voucher</field>
|
||||
@@ -331,7 +331,7 @@
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="action_vendor_receipt" model="ir.actions.act_window">
|
||||
<field name="name">Sales Payment</field>
|
||||
<field name="res_model">account.voucher</field>
|
||||
|
||||
@@ -22,13 +22,6 @@
|
||||
<field name="journal_id" widget="selection" context="{'journal_id': self, 'set_visible':False}" domain="[('type','in',('purchase','purchase_refund'))]"/>
|
||||
<field name="period_id" groups="base.group_extended"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Extended options..." col='8' colspan='4'>
|
||||
<field name="reference"/>
|
||||
<field name="name"/>
|
||||
<field name="narration"/>
|
||||
<field name="amount"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Group By..." colspan="4" col="10">
|
||||
<filter string="Supplier" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/>
|
||||
@@ -36,6 +29,13 @@
|
||||
<filter string="Period" icon="terp-go-month" domain="[]" context="{'group_by':'period_id','visible':True}"/>
|
||||
<filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Extended options..." col='8' colspan='4'>
|
||||
<field name="reference"/>
|
||||
<field name="name"/>
|
||||
<field name="narration"/>
|
||||
<field name="amount"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
@@ -61,13 +61,6 @@
|
||||
<field name="journal_id" widget="selection" context="{'journal_id': self, 'set_visible':False}" domain="[('type','in',('sale','sale_refund'))]"/>
|
||||
<field name="period_id" groups="base.group_extended"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Extended options..." col='8' colspan='4'>
|
||||
<field name="reference"/>
|
||||
<field name="name"/>
|
||||
<field name="narration"/>
|
||||
<field name="amount"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Group By..." colspan="4" col="10">
|
||||
<filter string="Customer" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/>
|
||||
@@ -75,6 +68,13 @@
|
||||
<filter string="Period" icon="terp-go-month" domain="[]" context="{'group_by':'period_id','visible':True}"/>
|
||||
<filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Extended options..." col='8' colspan='4'>
|
||||
<field name="reference"/>
|
||||
<field name="name"/>
|
||||
<field name="narration"/>
|
||||
<field name="amount"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
@@ -122,7 +122,7 @@
|
||||
<group col="2" colspan="1">
|
||||
<separator string="Payment Options" colspan="2"/>
|
||||
<field name="pay_now" on_change="onchange_payment(pay_now, journal_id, partner_id)" required="1"/>
|
||||
<field name="account_id"
|
||||
<field name="account_id"
|
||||
attrs="{'invisible':[('pay_now','!=','pay_now')]}"
|
||||
domain="[('type','=','liquidity')]"/>
|
||||
<!-- should select income accounts only. Or use the journal for this ? -->
|
||||
@@ -159,7 +159,7 @@
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<!-- Sales Voucher -->
|
||||
<record id="action_sale_receipt" model="ir.actions.act_window">
|
||||
<field name="name">Sales Receipt</field>
|
||||
@@ -205,7 +205,7 @@
|
||||
<field name="arch" type="xml">
|
||||
<form string="Vendor Bills">
|
||||
<group col="6" colspan="4">
|
||||
<field name="partner_id" required="1" string="Vendor" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type)"/>
|
||||
<field name="partner_id" domain="[('supplier','=',True)]" required="1" string="Vendor" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type)"/>
|
||||
<field name="journal_id" domain="[('type','in',['purchase','purchase_refund'])]" widget="selection" select="1" on_change="onchange_journal(journal_id, line_dr_ids, tax_id, partner_id)"/>
|
||||
<field name="number"/>
|
||||
<field name="name" colspan="4"/>
|
||||
@@ -284,8 +284,8 @@
|
||||
<field name="act_window_id" ref="action_purchase_receipt"/>
|
||||
</record>
|
||||
|
||||
<menuitem id="menu_action_purchase_receipt" icon="STOCK_JUSTIFY_FILL"
|
||||
action="action_purchase_receipt" parent="account.menu_finance_payables" sequence="10"/>
|
||||
|
||||
<menuitem id="menu_action_purchase_receipt" icon="STOCK_JUSTIFY_FILL"
|
||||
action="action_purchase_receipt" parent="account.menu_finance_payables" sequence="10"/>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -107,13 +107,6 @@
|
||||
<field name="journal_id" widget="selection" context="{'journal_id': self, 'set_visible':False}" />
|
||||
<field name="period_id" groups="base.group_extended"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Extended options..." col='8' colspan='4'>
|
||||
<field name="reference"/>
|
||||
<field name="name"/>
|
||||
<field name="narration"/>
|
||||
<field name="amount"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Group By..." colspan="4" col="10">
|
||||
<filter string="Partner" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/>
|
||||
@@ -121,6 +114,13 @@
|
||||
<filter string="Period" icon="terp-go-month" domain="[]" context="{'group_by':'period_id','visible':True}"/>
|
||||
<filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Extended options..." col='8' colspan='4'>
|
||||
<field name="reference"/>
|
||||
<field name="name"/>
|
||||
<field name="narration"/>
|
||||
<field name="amount"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
+14
-14
@@ -35,16 +35,16 @@ class account_analytic_account(osv.osv):
|
||||
cr.execute("SELECT a.id, r.currency_id FROM account_analytic_account a INNER JOIN res_company r ON (a.company_id = r.id) where a.id IN %s" , (tuple(ids2),))
|
||||
currency = dict(cr.fetchall())
|
||||
res_currency= self.pool.get('res.currency')
|
||||
for id in ids:
|
||||
if id not in ids2:
|
||||
for account in self.browse(cr, uid, ids, context=context):
|
||||
if account.id not in ids2:
|
||||
continue
|
||||
for child in self.search(cr, uid, [('parent_id', 'child_of', [id])]):
|
||||
if child != id:
|
||||
res.setdefault(id, 0.0)
|
||||
if currency[child]!=currency[id]:
|
||||
res[id] += res_currency.compute(cr, uid, currency[child], currency[id], res.get(child, 0.0), context=context)
|
||||
for child in account.child_ids:
|
||||
if child.id != account.id:
|
||||
res.setdefault(account.id, 0.0)
|
||||
if currency[child.id] != currency[account.id]:
|
||||
res[account.id] += res_currency.compute(cr, uid, currency[child.id], currency[account.id], res.get(child.id, 0.0), context=context)
|
||||
else:
|
||||
res[id] += res.get(child, 0.0)
|
||||
res[account.id] += res.get(child.id, 0.0)
|
||||
|
||||
cur_obj = res_currency.browse(cr, uid, currency.values(), context=context)
|
||||
cur_obj = dict([(o.id, o) for o in cur_obj])
|
||||
@@ -145,13 +145,13 @@ class account_analytic_account(osv.osv):
|
||||
for account_id, sum in cr.fetchall():
|
||||
res[account_id] = sum
|
||||
|
||||
for id in ids:
|
||||
if id not in parent_ids:
|
||||
for account in self.browse(cr, uid, ids, context=context):
|
||||
if account.id not in parent_ids:
|
||||
continue
|
||||
for child in self.search(cr, uid, [('parent_id', 'child_of', [id])]):
|
||||
if child != id:
|
||||
res.setdefault(id, 0.0)
|
||||
res[id] += res.get(child, 0.0)
|
||||
for child in account.child_ids:
|
||||
if child.id != account.id:
|
||||
res.setdefault(account.id, 0.0)
|
||||
res[account.id] += res.get(child.id, 0.0)
|
||||
return dict([(i, res[i]) for i in ids])
|
||||
|
||||
def name_get(self, cr, uid, ids, context=None):
|
||||
|
||||
@@ -220,7 +220,6 @@
|
||||
<field name="date_action"/>
|
||||
<field name="title_action" />
|
||||
<field name="stage_id"/>
|
||||
<field name="partner_assigned_id" invisible="1"/>
|
||||
<field name="channel_id" invisible="1"/>
|
||||
<field name="type_id" invisible="1"/>
|
||||
<button name="stage_previous" string="Previous Stage"
|
||||
@@ -328,8 +327,6 @@
|
||||
<filter string="Salesman" icon="terp-personal"
|
||||
domain="[]" context="{'group_by':'user_id'}" />
|
||||
<filter string="Team" help="Sales Team" icon="terp-personal+" domain="[]" context="{'group_by':'section_id'}"/>
|
||||
<filter string="Assigned Partner" icon="terp-personal"
|
||||
domain="[]" context="{'group_by':'partner_assigned_id'}" />
|
||||
<separator orientation="vertical" />
|
||||
<filter string="Creation" icon="terp-go-month"
|
||||
domain="[]" context="{'group_by':'create_date'}" />
|
||||
|
||||
@@ -113,87 +113,10 @@ class res_users(osv.osv):
|
||||
_inherit = 'res.users'
|
||||
_description = 'User'
|
||||
|
||||
def _parent_compute(self, cr, uid, ids, name, args, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
result = {}
|
||||
obj_dept = self.pool.get('hr.department')
|
||||
for user_id in ids:
|
||||
emp_ids = self.pool.get('hr.employee').search(cr, uid, [('user_id', '=', user_id)], context=context)
|
||||
cr.execute('SELECT emp.department_id FROM hr_employee AS emp \
|
||||
JOIN resource_resource AS res ON res.id = emp.resource_id \
|
||||
JOIN hr_department as dept ON dept.id = emp.department_id \
|
||||
WHERE res.user_id = %s AND emp.department_id IS NOT NULL AND dept.manager_id IS NOT NULL', (user_id,))
|
||||
ids_dept = [x[0] for x in cr.fetchall()]
|
||||
parent_ids = []
|
||||
if ids_dept:
|
||||
data_dept = obj_dept.read(cr, uid, ids_dept, ['manager_id'], context=context)
|
||||
parent_ids = map(lambda x: x['manager_id'][0], data_dept)
|
||||
cr.execute('SELECT res.user_id FROM hr_employee AS emp JOIN resource_resource AS res ON res.id=emp.resource_id \
|
||||
WHERE emp.id IN %s AND res.user_id IS NOT NULL', (tuple(parent_ids),))
|
||||
parent_ids = [x[0] for x in cr.fetchall()]
|
||||
result[user_id] = parent_ids
|
||||
return result
|
||||
|
||||
def _parent_search(self, cr, uid, obj, name, args, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
parent = []
|
||||
for arg in args:
|
||||
if arg[0] == 'parent_id':
|
||||
parent = arg[2]
|
||||
child_ids = self._child_compute(cr, uid, parent, name, args, context=context)
|
||||
if not child_ids:
|
||||
return [('id', 'in', [0])]
|
||||
return [('id', 'in', child_ids.get(uid, []))]
|
||||
|
||||
def _child_compute(self, cr, uid, ids, name, args, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
obj_dept = self.pool.get('hr.department')
|
||||
obj_user = self.pool.get('res.users')
|
||||
result = {}
|
||||
for user_id in ids:
|
||||
child_ids = []
|
||||
cr.execute('SELECT dept.id FROM hr_department AS dept \
|
||||
LEFT JOIN hr_employee AS emp ON dept.manager_id = emp.id \
|
||||
WHERE emp.id IN \
|
||||
(SELECT emp.id FROM hr_employee \
|
||||
JOIN resource_resource r ON r.id = emp.resource_id WHERE r.user_id=' + str(user_id) + ') ')
|
||||
mgnt_dept_ids = [x[0] for x in cr.fetchall()]
|
||||
ids_dept = obj_dept.search(cr, uid, [('id', 'child_of', mgnt_dept_ids)], context=context)
|
||||
if ids_dept:
|
||||
data_dept = obj_dept.read(cr, uid, ids_dept, ['member_ids'], context=context)
|
||||
childs = map(lambda x: x['member_ids'], data_dept)
|
||||
childs = tools.flatten(childs)
|
||||
childs = obj_user.search(cr, uid, [('id', 'in', childs),('active', '=', True)], context=context)
|
||||
if user_id in childs:
|
||||
childs.remove(user_id)
|
||||
child_ids.extend(tools.flatten(childs))
|
||||
set = {}
|
||||
map(set.__setitem__, child_ids, [])
|
||||
child_ids = set.keys()
|
||||
result[user_id] = child_ids
|
||||
return result
|
||||
|
||||
def _child_search(self, cr, uid, obj, name, args, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
parent = []
|
||||
for arg in args:
|
||||
if arg[0] == 'child_ids':
|
||||
parent = arg[2]
|
||||
child_ids = self._child_compute(cr, uid, parent, name, args, context=context)
|
||||
if not child_ids:
|
||||
return [('id', 'in', [0])]
|
||||
return [('id', 'in', child_ids.get(uid, []))]
|
||||
|
||||
_columns = {
|
||||
'parent_id': fields.function(_parent_compute, relation='res.users', fnct_search=_parent_search, method=True, string="Managers", type='many2many'),
|
||||
'child_ids': fields.function(_child_compute, relation='res.users', fnct_search=_child_search, method=True, string="Subordinates", type='many2many'),
|
||||
'context_department_id': fields.many2one('hr.department', 'Departments'),
|
||||
}
|
||||
|
||||
res_users()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -87,10 +87,6 @@
|
||||
<notebook position="inside">
|
||||
<page string="Departments" groups="base.group_extended">
|
||||
<field name="context_department_id" completion="1" widget="selection" string="Department"/>
|
||||
<separator string="Managers" colspan="4"/>
|
||||
<field name="parent_id" nolabel="1" colspan="4"/>
|
||||
<separator string="Subordinates" colspan="4"/>
|
||||
<field name="child_ids" nolabel="1" colspan="4"/>
|
||||
</page>
|
||||
</notebook>
|
||||
</field>
|
||||
|
||||
@@ -259,7 +259,7 @@
|
||||
<para style="terp_default_9">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="terp_default_9">[[ o.note or '' ]] [[ setTag('para','xpre') ]]</para>
|
||||
<para style="terp_default_9">[[ setTag('para','xpre') ]] [[ o.note or '' ]] </para>
|
||||
<para style="terp_default_9">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
|
||||
@@ -784,6 +784,7 @@ class hr_payslip(osv.osv):
|
||||
'contract_id':fields.many2one('hr.contract', 'Contract', required=False),
|
||||
'igross': fields.float('Calculaton Field', readonly=True, digits=(16, 2), help="Calculation field used for internal calculation, do not place this on form"),
|
||||
'inet': fields.float('Calculaton Field', readonly=True, digits=(16, 2), help="Calculation field used for internal calculation, do not place this on form"),
|
||||
'period_id': fields.many2one('account.period', 'Force Period', domain=[('state','<>','done')], help="Keep empty to use the period of the validation(Payslip) date."),
|
||||
}
|
||||
_defaults = {
|
||||
'date': lambda *a: time.strftime('%Y-%m-%d'),
|
||||
|
||||
@@ -500,12 +500,12 @@
|
||||
</notebook>
|
||||
<group col="10" colspan="4">
|
||||
<field name="state"/>
|
||||
<button string="Cancel" icon="terp-dialog-close" name="cancel_sheet" states="draft,hr_check,confirm"/>
|
||||
<button string="Compute Sheet" icon="terp-stock_format-scientific" name="compute_sheet" states="new"/>
|
||||
<button string="Recompute Sheet" icon="terp-stock_format-scientific" name="compute_sheet" type="object" states="draft"/>
|
||||
<button string="Verify Sheet" icon="terp-camera_test" name="verify_sheet" states="draft"/>
|
||||
<button string="Approve Sheet" icon="terp-camera_test" name="final_verify_sheet" states="hr_check"/>
|
||||
<button string="Pay Salary" icon="terp-dolar_ok!" name="process_sheet" states="confirm"/>
|
||||
<button string="Cancel" icon="terp-dialog-close" name="cancel_sheet" states="draft,hr_check,confirm"/>
|
||||
<button string="Set to Draft" icon="terp-stock_effects-object-colorize" name="set_to_draft" states="cancel"/>
|
||||
</group>
|
||||
</form>
|
||||
|
||||
@@ -45,6 +45,7 @@ class mrp_repair(osv.osv):
|
||||
"""
|
||||
res = {}
|
||||
cur_obj = self.pool.get('res.currency')
|
||||
|
||||
for repair in self.browse(cr, uid, ids):
|
||||
res[repair.id] = 0.0
|
||||
for line in repair.operations:
|
||||
@@ -62,6 +63,7 @@ class mrp_repair(osv.osv):
|
||||
@return: Dictionary of values.
|
||||
"""
|
||||
res = {}
|
||||
#return {}.fromkeys(ids, 0)
|
||||
cur_obj = self.pool.get('res.currency')
|
||||
tax_obj = self.pool.get('account.tax')
|
||||
for repair in self.browse(cr, uid, ids):
|
||||
@@ -94,6 +96,14 @@ class mrp_repair(osv.osv):
|
||||
res[id] = cur_obj.round(cr, uid, cur, untax.get(id, 0.0) + tax.get(id, 0.0))
|
||||
return res
|
||||
|
||||
def _get_lines(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
result = {}
|
||||
for line in self.pool.get('mrp.repair.line').browse(cr, uid, ids, context=context):
|
||||
result[line.repair_id.id] = True
|
||||
return result.keys()
|
||||
|
||||
_columns = {
|
||||
'name': fields.char('Repair Reference',size=24, required=True),
|
||||
'product_id': fields.many2one('product.product', string='Product to Repair', required=True, readonly=True, states={'draft':[('readonly',False)]}),
|
||||
@@ -137,9 +147,21 @@ class mrp_repair(osv.osv):
|
||||
'deliver_bool': fields.boolean('Deliver', help="Check this box if you want to manage the delivery once the product is repaired. If cheked, it will create a picking with selected product. Note that you can select the locations in the Info tab, if you have the extended view."),
|
||||
'invoiced': fields.boolean('Invoiced', readonly=True),
|
||||
'repaired': fields.boolean('Repaired', readonly=True),
|
||||
'amount_untaxed': fields.function(_amount_untaxed, method=True, string='Untaxed Amount'),
|
||||
'amount_tax': fields.function(_amount_tax, method=True, string='Taxes'),
|
||||
'amount_total': fields.function(_amount_total, method=True, string='Total'),
|
||||
'amount_untaxed': fields.function(_amount_untaxed, method=True, string='Untaxed Amount',
|
||||
store={
|
||||
'mrp.repair': (lambda self, cr, uid, ids, c={}: ids, ['operations'], 10),
|
||||
'mrp.repair.line': (_get_lines, ['price_unit', 'price_subtotal', 'product_id', 'tax_id', 'product_uom_qty', 'product_uom'], 10),
|
||||
}),
|
||||
'amount_tax': fields.function(_amount_tax, method=True, string='Taxes',
|
||||
store={
|
||||
'mrp.repair': (lambda self, cr, uid, ids, c={}: ids, ['operations'], 10),
|
||||
'mrp.repair.line': (_get_lines, ['price_unit', 'price_subtotal', 'product_id', 'tax_id', 'product_uom_qty', 'product_uom'], 10),
|
||||
}),
|
||||
'amount_total': fields.function(_amount_total, method=True, string='Total',
|
||||
store={
|
||||
'mrp.repair': (lambda self, cr, uid, ids, c={}: ids, ['operations'], 10),
|
||||
'mrp.repair.line': (_get_lines, ['price_unit', 'price_subtotal', 'product_id', 'tax_id', 'product_uom_qty', 'product_uom'], 10),
|
||||
}),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
@@ -163,7 +185,6 @@ class mrp_repair(osv.osv):
|
||||
})
|
||||
return super(mrp_repair, self).copy(cr, uid, id, default, context)
|
||||
|
||||
|
||||
def onchange_product_id(self, cr, uid, ids, product_id=None):
|
||||
""" On change of product sets some values.
|
||||
@param product_id: Changed product
|
||||
|
||||
@@ -377,23 +377,23 @@ class product_product(osv.osv):
|
||||
res[product.id] = (res[product.id] or 0.0) * (product.price_margin or 1.0) + product.price_extra
|
||||
return res
|
||||
|
||||
def _get_partner_code_name(self, cr, uid, ids, product_id, partner_id, context={}):
|
||||
product = self.browse(cr, uid, [product_id], context)[0]
|
||||
def _get_partner_code_name(self, cr, uid, ids, product, partner_id, context={}):
|
||||
for supinfo in product.seller_ids:
|
||||
if supinfo.name.id == partner_id:
|
||||
return {'code': supinfo.product_code, 'name': supinfo.product_name, 'variants': ''}
|
||||
return {'code' : product.default_code, 'name' : product.name, 'variants': product.variants}
|
||||
res = {'code': product.default_code, 'name': product.name, 'variants': product.variants}
|
||||
return res
|
||||
|
||||
def _product_code(self, cr, uid, ids, name, arg, context={}):
|
||||
res = {}
|
||||
for p in self.browse(cr, uid, ids, context):
|
||||
res[p.id] = self._get_partner_code_name(cr, uid, [], p.id, context.get('partner_id', None), context)['code']
|
||||
res[p.id] = self._get_partner_code_name(cr, uid, [], p, context.get('partner_id', None), context)['code']
|
||||
return res
|
||||
|
||||
def _product_partner_ref(self, cr, uid, ids, name, arg, context={}):
|
||||
res = {}
|
||||
for p in self.browse(cr, uid, ids, context):
|
||||
data = self._get_partner_code_name(cr, uid, [], p.id, context.get('partner_id', None), context)
|
||||
data = self._get_partner_code_name(cr, uid, [], p, context.get('partner_id', None), context)
|
||||
if not data['variants']:
|
||||
data['variants'] = p.variants
|
||||
if not data['code']:
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
<field name="object_id" search="[('model','=','project.issue')]" model="ir.model"/>
|
||||
</record>
|
||||
|
||||
<record model="crm.case.resource.type" id="type2">
|
||||
<record model="crm.case.resource.type" id="type3">
|
||||
<field name="name">Version 6.0</field>
|
||||
<field name="section_id" ref="crm.section_sales_department"/>
|
||||
<field name="object_id" search="[('model','=','project.issue')]" model="ir.model"/>
|
||||
|
||||
+1
-1
@@ -164,7 +164,7 @@ class wiki_wiki2(osv.osv):
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param id: Give wiki page's ID """
|
||||
|
||||
return super(Wiki, self).copy_data(cr, uid, id, {'wiki_id': False}, context)
|
||||
return super(wiki_wiki2, self).copy_data(cr, uid, id, {'wiki_id': False}, context)
|
||||
|
||||
def create_history(self, cr, uid, ids, vals, context=None):
|
||||
history_id = False
|
||||
|
||||
Reference in New Issue
Block a user