bzr revid: fp@tinyerp.com-20080917153410-0g4w5vjjcyxkllh7
This commit is contained in:
Fabien Pinckaers
2008-09-17 17:34:10 +02:00
5 changed files with 54 additions and 63 deletions
+13 -12
View File
@@ -1762,6 +1762,11 @@ class wizard_multi_charts_accounts(osv.osv_memory):
'code_digits':fields.integer('# of Digits',required=True,help="No. of Digits to use for account code"),
}
_defaults = {
'company_id': lambda self, cr, uid, c: self.pool.get('res.users').browse(cr,uid,[uid],c)[0].company_id.id,
'code_digits': lambda *a:6,
}
def action_create(self, cr, uid, ids, context=None):
obj_multi = self.browse(cr,uid,ids[0])
obj_acc = self.pool.get('account.account')
@@ -1887,9 +1892,9 @@ class wizard_multi_charts_accounts(osv.osv_memory):
vals_journal['sequence_id']=seq_id
#Sales Journal
vals_journal['name'] = 'Sales Journal '+ str(seq_code)
vals_journal['name'] = _('Sales Journal')
vals_journal['type'] = 'sale'
vals_journal['code'] = 'SAJ' + str(seq_code)
vals_journal['code'] = _('SAJ')
if obj_multi.chart_template_id.property_account_receivable:
vals_journal['default_credit_account_id'] = acc_template_ref[obj_multi.chart_template_id.property_account_receivable.id]
@@ -1898,9 +1903,9 @@ class wizard_multi_charts_accounts(osv.osv_memory):
obj_journal.create(cr,uid,vals_journal)
# Purchase Journal
vals_journal['name']='Purchase Journal '+ str(seq_code)
vals_journal['name']=_('Purchase Journal')
vals_journal['type']='purchase'
vals_journal['code']='EXJ' + str(seq_code)
vals_journal['code']=_('EXJ')
if obj_multi.chart_template_id.property_account_payable:
vals_journal['default_credit_account_id'] = acc_template_ref[obj_multi.chart_template_id.property_account_payable.id]
@@ -1913,19 +1918,15 @@ class wizard_multi_charts_accounts(osv.osv_memory):
view_id_cur = self.pool.get('account.journal.view').search(cr,uid,[('name','=','Multi-Currency Cash Journal View')])[0]
ref_acc_bank = obj_multi.chart_template_id.bank_account_view_id
current_num = 0
current_num = 1
for line in obj_multi.bank_accounts_id:
#create the account_account for this bank journal
tmp = self.pool.get('res.partner.bank').name_get(cr, uid, [line.acc_no.id])[0][1]
dig = obj_multi.code_digits
code_main = len(ref_acc_bank.code+str(current_num))
code_acc = ref_acc_bank.code+str(current_num)
if code_main<=dig:
code_acc=str(code_acc) + (str('0'*(dig-code_main)))
vals={
'name': line.acc_no.bank and line.acc_no.bank.name+' '+tmp or tmp,
'currency_id': line.currency_id and line.currency_id.id or False,
'code': ref_acc_bank.code+str(current_num),
'code': str(int(ref_acc_bank.code.ljust(dig,'0')) + current_num),
'type': 'other',
'user_type': account_template.user_type and account_template.user_type.id or False,
'reconcile': True,
@@ -1935,8 +1936,8 @@ class wizard_multi_charts_accounts(osv.osv_memory):
acc_cash_id = obj_acc.create(cr,uid,vals)
#create the bank journal
vals_journal['name']='Bank Journal '+ str(current_num)
vals_journal['code']='BNK' + str(current_num)
vals_journal['name']= vals['name']
vals_journal['code']= _('BNK') + str(current_num)
vals_journal['sequence_id'] = seq_id
vals_journal['type'] = 'cash'
if line.currency_id:
+13 -7
View File
@@ -391,8 +391,8 @@ class payment_line(osv.osv):
# help='Amount to pay in the partner currency'),
# 'currency': fields.function(_currency, string='Currency',
# method=True, type='many2one', obj='res.currency'),
'currency': fields.many2one('res.currency','Currency',required=True),
'company_currency': fields.many2one('res.currency','Currency',readonly=True),
'currency': fields.many2one('res.currency','Partner Currency',required=True),
'company_currency': fields.many2one('res.currency','Company Currency',readonly=True),
'bank_id': fields.many2one('res.partner.bank', 'Destination Bank account'),
'order_id': fields.many2one('payment.order', 'Order', required=True,
ondelete='cascade', select=True),
@@ -432,17 +432,23 @@ class payment_line(osv.osv):
def onchange_move_line(self,cr,uid,ids,move_line_id,payment_type,date_prefered,date_planned,currency=False,company_currency=False,context=None):
data={}
data['amount_currency']=data['currency']=data['communication']=data['partner_id']=data['reference']=data['date_created']=data['bank_id']=data['amount']=False
data['amount_currency']=data['communication']=data['partner_id']=data['reference']=data['date_created']=data['bank_id']=data['amount']=False
if move_line_id:
line = self.pool.get('account.move.line').browse(cr,uid,move_line_id)
data['amount_currency']=line.amount_to_pay
res = self.onchange_amount(cr, uid, ids, data['amount_currency'], currency, company_currency, context)
res = self.onchange_amount(cr, uid, ids, data['amount_currency'], currency, company_currency,
if res:
data['amount'] = res['value']['amount']
data['partner_id']=line.partner_id.id
data['currency']=line.currency_id and line.currency_id.id or False
if not data['currency']:
data['currency']=line.invoice and line.invoice.currency_id.id or False
temp = line.currency_id and line.currency_id.id or False
if not temp:
if line.invoice:
data['currency'] = line.invoice.currency_id.id
else:
data['currency'] = temp
# calling onchange of partner and updating data dictionary
temp_dict=self.onchange_partner(cr,uid,ids,line.partner_id.id,payment_type)
data.update(temp_dict['value'])
+22 -42
View File
@@ -3,6 +3,18 @@
<data>
<!-- View used in the wizard -->
<record id="view_move_line_form" model="ir.ui.view">
<field name="name">account.move.line.form.inherit</field>
<field name="model">account.move.line</field>
<field name="type">form</field>
<field name="inherit_id" ref="account.view_move_line_form"/>
<field name="arch" type="xml">
<field name="reconcile_partial_id" position="after">
<field name="amount_to_pay" select="2"/>
</field>
</field>
</record>
<record model="ir.ui.view" id="view_move_line_tree_wiz">
<field name="name">account.move.line.tree</field>
<field name="model">account.move.line</field>
@@ -17,6 +29,7 @@
<field name="date"/>
<field name="debit" sum="Total debit"/>
<field name="credit" sum="Total credit"/>
<field name="amount_to_pay"/>
<field name="amount_currency"/>
<field name="currency_id"/>
</tree>
@@ -88,8 +101,7 @@
<form string="Payment Line">
<notebook>
<page string="Payment">
<field name="move_line_id" on_change="onchange_move_line(move_line_id,parent.mode,parent.date_prefered,parent.date_planned,currency,company_currency)" select="1"/>
<!--domain="[('reconcile_id','=', False), ('credit', '>',0),('amount_to_pay','>',0)] "/>-->
<field name="move_line_id" on_change="onchange_move_line(move_line_id,parent.mode,parent.date_prefered,parent.date_planned,currency,company_currency)" select="1" domain="[('reconcile_id','=', False), ('credit', '>',0),('amount_to_pay','>',0)] "/>
<separator colspan="4" string="Transaction Information"/>
<field name="date"/>
<group colspan="2">
@@ -102,7 +114,6 @@
<separator colspan="2" string="Desitination Account"/>
<field colspan="2" name="info_owner" nolabel="1"/>
<field colspan="2" name="info_partner" nolabel="1"/>
<field colspan="4" name="communication"/>
<field colspan="4" name="communication2"/>
<field name="name"/>
@@ -115,34 +126,23 @@
<field name="amount"/>
<field name="company_currency" nolabel="1"/>
</group>
<!--<field name="partner_payable"/>-->
<separator colspan="4" string="Entry Information"/>
<field name="create_date" readonly="1"/>
<field name="ml_maturity_date"/>
<field name="ml_inv_ref"/>
<!--<field name="to_pay_currency"/>
<field name="to_pay"/>-->
</page>
</notebook>
</form>
<tree string="Payment Line"> <!-- editable="bottom" colors="red:to_pay_currency&lt;amount_currency" -->
<tree string="Payment Line">
<field name="ml_inv_ref" />
<field name="partner_id" select="1"/>
<field name="bank_id" domain="[('partner_id', '=', partner_id)]" required="1"/>
<field name="bank_id" domain="[('partner_id', '=', partner_id)]"/>
<field name="ml_maturity_date"/>
<field name="date"/>
<!--<field name="value_date"/>-->
<!--<field name="amount" sum="Amount Total"/>-->
<field name="amount_currency" sum="Currency Amount Total" select="2" string="Amount"/>
<field name="amount_currency" select="2" string="Amount"/>
<field name="currency"/>
<!--<field name="to_pay_currency"/>
<field name="to_pay"/>-->
<!--domain="[('partner_id','=',partner_id),('reconcile_id', '=', False), ('credit', '>', 0),('amount_to_pay','>',0)]"/>-->
<field name="name"/>
<!--<field name="communication"/>
<field name="state"/>
<field name="date"/>-->
<!-- <field invisible="1" name="to_pay_currency"/>-->
<field name="amount" sum="Total in Company Currency" invisible="1"/>
</tree>
</field>
<field name="date_created" select="2"/>
@@ -167,7 +167,6 @@
<tree string="Payment order">
<field name="reference"/>
<field name="mode"/>
<!--<field name="line_ids"/>-->
<field name="date_planned"/>
<field name="date_created" select="2"/>
<field name="date_done" select="2"/>
@@ -212,9 +211,7 @@
<notebook>
<page string="Payment">
<field name="order_id" select="1"/>
<!--<field name="reference" />-->
<field name="move_line_id" on_change="onchange_move_line(move_line_id,parent.mode,currency,company_currency)" select="1"/>
<!--domain="[('reconcile_id','=', False), ('credit', '>',0),('amount_to_pay','>',0)] "/>-->
<field name="move_line_id" on_change="onchange_move_line(move_line_id,parent.mode, currency, company_currency)" select="1" domain="[('reconcile_id','=', False), ('credit', '>',0),('amount_to_pay','>',0)] "/>
<separator colspan="4" string="Transaction Information"/>
<field name="date"/>
<group colspan="2">
@@ -222,7 +219,7 @@
<field name="currency" nolabel="1"/>
</group>
<field name="partner_id" on_change="onchange_partner(partner_id)" select="1"/>
<field domain="[('partner_id','=',partner_id)]" name="bank_id" required="1"/>
<field domain="[('partner_id','=',partner_id)]" name="bank_id"/>
<separator colspan="2" string="Owner Account"/>
<separator colspan="2" string="Desitination Account"/>
<field colspan="2" name="info_owner" nolabel="1"/>
@@ -238,18 +235,12 @@
<separator colspan="4" string="General Information"/>
<group colspan="2">
<field name="amount" select="1"/>
<!--<field name="currency"/>-->
<field name="company_currency" nolabel="1"/>
</group>
<!--<field name="partner_payable"/>-->
<separator colspan="4" string="Entry Information"/>
<field name="create_date"/>
<field name="ml_maturity_date"/>
<field name="ml_inv_ref"/>
<!--<field name="due_date"/>-->
<!--<field name="to_pay_currency"/>
<field name="to_pay"/>-->
</page>
</notebook>
</form>
@@ -261,30 +252,19 @@
<field name="type">tree</field>
<field eval="4" name="priority"/>
<field name="arch" type="xml">
<tree string="Payment Line"> <!-- editable="bottom" colors="red:to_pay_currency&lt;amount_currency" -->
<tree string="Payment Line">
<field name="order_id"/>
<field name="ml_inv_ref" />
<field name="ml_maturity_date"/>
<!--<field name="value_date"/>-->
<field name="partner_id" select="1"/>
<field name="amount" sum="Amount Total"/>
<field name="amount_currency" sum="Currency Amount Total" select="2" />
<field name="currency"/>
<field name="bank_id" domain="[('partner_id', '=', partner_id)]" required="1"/>
<!--<field name="to_pay_currency"/>
<field name="to_pay"/>-->
<field name="bank_id" domain="[('partner_id', '=', partner_id)]"/>
<field name="move_line_id" on_change="onchange_move_line(move_line_id,parent.mode)"/>
<!--domain="[('partner_id','=',partner_id),('reconcile_id', '=', False), ('credit', '>', 0),('amount_to_pay','>',0)]"/>-->
<field domain="[('partner_id', '=', partner_id)]" name="bank_id"/>
<!--<field name="partner_payable"/>-->
<field name="create_date"/>
<field name="name"/>
<!--<field name="communication"/>
<field name="state"/>
<field name="date"/>-->
<!-- <field invisible="1" name="to_pay_currency"/>-->
</tree>
</field>
</record>
+1 -1
View File
@@ -6615,7 +6615,7 @@
<!-- Chart template -->
<record id="l10nbe_chart_template" model="account.chart.template">
<field name="name">Template of the belgian Chart of Accounts</field>
<field name="name">Belgian PCMN</field>
<field name="account_root_id" ref="a_root"/>
<field name="tax_code_root_id" ref="vat_code_chart_root"/>
<field name="bank_account_view_id" ref="a550"/>
+5 -1
View File
@@ -59,12 +59,13 @@ class process_process(osv.osv):
data['menu'] = (node.menu_id or None) and node.menu_id.name
data['model'] = (node.model_id or None) and node.model_id.model
data['kind'] = node.kind
data['notes'] = node.note
data['active'] = 0
if node.kind == "state" and node.model_id and node.model_id.model == res_model:
states = node.model_states
states = (states or []) and states.split(',')
data['active'] = (states and current_object.state in states) or not states
data['active'] = not states or current_object.state in states
elif node.kind == "router":
#TODO:
@@ -83,10 +84,13 @@ class process_process(osv.osv):
data['name'] = tr.name
data['source'] = tr.source_node_id.id
data['target'] = tr.target_node_id.id
data['notes'] = tr.note
data['buttons'] = buttons = []
for b in tr.action_ids:
button = {}
button['name'] = b.name
button['state'] = b.state
button['action'] = b.action
buttons.append(button)
data['roles'] = roles = []
for r in tr.transition_ids: