[MERGE] sync with latest trunk
bzr revid: odo@openerp.com-20110927165219-ux50zxkszwpcfssd
This commit is contained in:
commit
1d3ff0e52f
|
@ -250,6 +250,7 @@ class account_account(osv.osv):
|
|||
#compute for each account the balance/debit/credit from the move lines
|
||||
accounts = {}
|
||||
res = {}
|
||||
null_result = dict((fn, 0.0) for fn in field_names)
|
||||
if children_and_consolidated:
|
||||
aml_query = self.pool.get('account.move.line')._query_get(cr, uid, context=context)
|
||||
|
||||
|
@ -306,12 +307,11 @@ class account_account(osv.osv):
|
|||
sums[current.id][fn] += sums[child.id][fn]
|
||||
else:
|
||||
sums[current.id][fn] += currency_obj.compute(cr, uid, child.company_id.currency_id.id, current.company_id.currency_id.id, sums[child.id][fn], context=context)
|
||||
null_result = dict((fn, 0.0) for fn in field_names)
|
||||
for id in ids:
|
||||
res[id] = sums.get(id, null_result)
|
||||
else:
|
||||
for id in ids:
|
||||
res[id] = 0.0
|
||||
res[id] = null_result
|
||||
return res
|
||||
|
||||
def _get_company_currency(self, cr, uid, ids, field_name, arg, context=None):
|
||||
|
@ -722,8 +722,6 @@ class account_journal(osv.osv):
|
|||
name = rs.name
|
||||
if rs.currency:
|
||||
name = "%s (%s)" % (rs.name, rs.currency.name)
|
||||
else:
|
||||
name = "%s (%s)" % (rs.name, rs.company_id.currency_id.name)
|
||||
res += [(rs.id, name)]
|
||||
return res
|
||||
|
||||
|
@ -932,17 +930,10 @@ class account_period(osv.osv):
|
|||
return False
|
||||
|
||||
def find(self, cr, uid, dt=None, context=None):
|
||||
if context is None: context = {}
|
||||
if not dt:
|
||||
dt = time.strftime('%Y-%m-%d')
|
||||
#CHECKME: shouldn't we check the state of the period?
|
||||
args = [('date_start', '<=' ,dt), ('date_stop', '>=', dt)]
|
||||
if context.get('company_id', False):
|
||||
args.append(('company_id', '=', context['company_id']))
|
||||
else:
|
||||
company_id = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.id
|
||||
args.append(('company_id', '=', company_id))
|
||||
ids = self.search(cr, uid, args, context=context)
|
||||
ids = self.search(cr, uid, [('date_start','<=',dt),('date_stop','>=',dt)])
|
||||
if not ids:
|
||||
raise osv.except_osv(_('Error !'), _('No period defined for this date: %s !\nPlease create one.')%dt)
|
||||
return ids
|
||||
|
|
|
@ -117,6 +117,12 @@ class account_bank_statement(osv.osv):
|
|||
res[statement_id] = (currency_id, currency_names[currency_id])
|
||||
return res
|
||||
|
||||
def _get_statement(self, cr, uid, ids, context=None):
|
||||
result = {}
|
||||
for line in self.pool.get('account.bank.statement.line').browse(cr, uid, ids, context=context):
|
||||
result[line.statement_id.id] = True
|
||||
return result.keys()
|
||||
|
||||
_order = "date desc, id desc"
|
||||
_name = "account.bank.statement"
|
||||
_description = "Bank Statement"
|
||||
|
@ -131,15 +137,19 @@ class account_bank_statement(osv.osv):
|
|||
states={'confirm':[('readonly',True)]}),
|
||||
'balance_end_real': fields.float('Ending Balance', digits_compute=dp.get_precision('Account'),
|
||||
states={'confirm': [('readonly', True)]}),
|
||||
'balance_end': fields.function(_end_balance, store=True, # store=True for account_cash_statement
|
||||
string="Balance", help='Balance as calculated based on Starting Balance and transaction lines'),
|
||||
'balance_end': fields.function(_end_balance,
|
||||
store = {
|
||||
'account.bank.statement': (lambda self, cr, uid, ids, c={}: ids, ['line_ids','move_line_ids'], 10),
|
||||
'account.bank.statement.line': (_get_statement, ['amount'], 10),
|
||||
},
|
||||
string="Computed Balance", help='Balance as calculated based on Starting Balance and transaction lines'),
|
||||
'company_id': fields.related('journal_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True, readonly=True),
|
||||
'line_ids': fields.one2many('account.bank.statement.line',
|
||||
'statement_id', 'Statement lines',
|
||||
states={'confirm':[('readonly', True)]}),
|
||||
'move_line_ids': fields.one2many('account.move.line', 'statement_id',
|
||||
'Entry lines', states={'confirm':[('readonly',True)]}),
|
||||
'state': fields.selection([('draft', 'Draft'),
|
||||
'state': fields.selection([('draft', 'New'),
|
||||
('open','Open'), # used by cash statements
|
||||
('confirm', 'Closed')],
|
||||
'State', required=True, readonly="1",
|
||||
|
@ -306,7 +316,7 @@ class account_bank_statement(osv.osv):
|
|||
return self.write(cr, uid, ids, {'state':'confirm'}, context=context)
|
||||
|
||||
def check_status_condition(self, cr, uid, state, journal_type='bank'):
|
||||
return state=='draft'
|
||||
return state in ('draft','open')
|
||||
|
||||
def button_confirm_bank(self, cr, uid, ids, context=None):
|
||||
obj_seq = self.pool.get('ir.sequence')
|
||||
|
@ -465,7 +475,7 @@ 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'),
|
||||
'date': lambda self,cr,uid,context={}: context.get('date', time.strftime('%Y-%m-%d')),
|
||||
'type': 'general',
|
||||
}
|
||||
|
||||
|
|
|
@ -184,31 +184,33 @@ class account_cash_statement(osv.osv):
|
|||
res['end'] = end_l
|
||||
return res
|
||||
|
||||
def _get_statement(self, cr, uid, ids, context=None):
|
||||
result = {}
|
||||
for line in self.pool.get('account.bank.statement.line').browse(cr, uid, ids, context=context):
|
||||
result[line.statement_id.id] = True
|
||||
return result.keys()
|
||||
|
||||
_columns = {
|
||||
'total_entry_encoding': fields.function(_get_sum_entry_encoding, store=True, string="Cash Transaction", help="Total cash transactions"),
|
||||
'total_entry_encoding': fields.function(_get_sum_entry_encoding, string="Cash Transaction", help="Total cash transactions",
|
||||
store = {
|
||||
'account.bank.statement': (lambda self, cr, uid, ids, c={}: ids, ['line_ids','move_line_ids'], 10),
|
||||
'account.bank.statement.line': (_get_statement, ['amount'], 10),
|
||||
}),
|
||||
'closing_date': fields.datetime("Closed On"),
|
||||
'balance_end_cash': fields.function(_balance_end_cash, store=True, string='Balance', help="Closing balance based on cashBox"),
|
||||
'balance_end_cash': fields.function(_balance_end_cash, store=True, string='Closing Balance', help="Closing balance based on cashBox"),
|
||||
'starting_details_ids': fields.one2many('account.cashbox.line', 'starting_id', string='Opening Cashbox'),
|
||||
'ending_details_ids': fields.one2many('account.cashbox.line', 'ending_id', string='Closing Cashbox'),
|
||||
'user_id': fields.many2one('res.users', 'Responsible', required=False),
|
||||
}
|
||||
_defaults = {
|
||||
'state': 'draft',
|
||||
'date': lambda *a: time.strftime("%Y-%m-%d %H:%M:%S"),
|
||||
'date': lambda self,cr,uid,context={}: context.get('date', time.strftime("%Y-%m-%d %H:%M:%S")),
|
||||
'user_id': lambda self, cr, uid, context=None: uid,
|
||||
'starting_details_ids': _get_cash_open_box_lines,
|
||||
'ending_details_ids': _get_default_cash_close_box_lines
|
||||
}
|
||||
|
||||
def create(self, cr, uid, vals, context=None):
|
||||
sql = [
|
||||
('journal_id', '=', vals.get('journal_id', False)),
|
||||
('state', '=', 'open')
|
||||
]
|
||||
open_jrnl = self.search(cr, uid, sql)
|
||||
if open_jrnl:
|
||||
raise osv.except_osv(_('Error'), _('You can not have two open register for the same journal!'))
|
||||
|
||||
if self.pool.get('account.journal').browse(cr, uid, vals['journal_id'], context=context).type == 'cash':
|
||||
open_close = self._get_cash_open_close_box_lines(cr, uid, context)
|
||||
if vals.get('starting_details_ids', False):
|
||||
|
@ -300,7 +302,6 @@ class account_cash_statement(osv.osv):
|
|||
})
|
||||
|
||||
vals.update({
|
||||
'date': time.strftime("%Y-%m-%d %H:%M:%S"),
|
||||
'state': 'open',
|
||||
})
|
||||
self.write(cr, uid, [statement.id], vals, context=context)
|
||||
|
@ -310,7 +311,7 @@ class account_cash_statement(osv.osv):
|
|||
if journal_type == 'bank':
|
||||
return super(account_cash_statement, self).balance_check(cr, uid, cash_id, journal_type, context)
|
||||
if not self._equal_balance(cr, uid, cash_id, context):
|
||||
raise osv.except_osv(_('Error !'), _('CashBox Balance is not matching with Calculated Balance !'))
|
||||
raise osv.except_osv(_('Error !'), _('The closing balance should be the same than the computed balance !'))
|
||||
return True
|
||||
|
||||
def statement_close(self, cr, uid, ids, journal_type='bank', context=None):
|
||||
|
|
|
@ -85,5 +85,58 @@
|
|||
<field name="type">automatic</field>
|
||||
</record>
|
||||
|
||||
<record id="action_bank_account_configuration_installer" model="ir.actions.act_window">
|
||||
<field name="name">Define your Bank Account</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">res.partner.bank</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
</record>
|
||||
|
||||
<record id="bank_account_configuration_todo" model="ir.actions.todo">
|
||||
<field name="action_id" ref="action_bank_account_configuration_installer" />
|
||||
<field name="category_id" ref="category_accounting_configuration" />
|
||||
</record>
|
||||
|
||||
<record id="action_view_financial_accounts_installer" model="ir.actions.act_window">
|
||||
<field name="name">Review your Financial Accounts</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">account.account</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
|
||||
<record id="view_financial_accounts_todo" model="ir.actions.todo">
|
||||
<field name="action_id" ref="action_view_financial_accounts_installer" />
|
||||
<field name="category_id" ref="category_accounting_configuration" />
|
||||
<field name="groups_id" eval="[(6, 0, [ref('account.group_account_user')])]" />
|
||||
</record>
|
||||
|
||||
<record id="action_review_financial_journals_installer" model="ir.actions.act_window">
|
||||
<field name="name">Review your Financial Journal</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">account.journal</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
|
||||
<record id="review_financial_journals_todo" model="ir.actions.todo">
|
||||
<field name="action_id" ref="action_review_financial_journals_installer" />
|
||||
<field name="category_id" ref="category_accounting_configuration" />
|
||||
<field name="groups_id" eval="[(6, 0, [ref('account.group_account_user')])]" />
|
||||
</record>
|
||||
<record id="action_review_payment_terms_installer" model="ir.actions.act_window">
|
||||
<field name="name">Review your Payment Terms</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">account.payment.term</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
|
||||
<record id="review_payment_terms_todo" model="ir.actions.todo">
|
||||
<field name="action_id" ref="action_review_payment_terms_installer" />
|
||||
<field name="category_id" ref="category_accounting_configuration" />
|
||||
<field name="groups_id" eval="[(6, 0, [ref('account.group_account_user')])]" />
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
|
@ -205,7 +205,7 @@
|
|||
<field name="amount_tax"/>
|
||||
<field name="reconciled"/>
|
||||
<field name="amount_total"/>
|
||||
<field name="state"/>
|
||||
<field name="state" widget="statusbar" statusbar_visible="draft,open,paid" statusbar_colors='{"proforma":"blue","proforma2":"blue"}'/>
|
||||
<field name="residual"/>
|
||||
<group col="6" colspan="4">
|
||||
<button name="invoice_cancel" states="draft,proforma2,sale,open" string="Cancel" icon="gtk-cancel"/>
|
||||
|
@ -234,7 +234,6 @@
|
|||
<field name="payment_ids" colspan="4" nolabel="1" >
|
||||
<tree string="Payments">
|
||||
<field name="date" string="Payment Date"/>
|
||||
<field name="move_id"/>
|
||||
<field name="ref"/>
|
||||
<field name="name" groups="base.group_extended"/>
|
||||
<field name="journal_id"/>
|
||||
|
@ -300,7 +299,7 @@
|
|||
<field name="amount_tax"/>
|
||||
<field name="reconciled"/>
|
||||
<field name="amount_total"/>
|
||||
<field name="state"/>
|
||||
<field name="state" widget="statusbar" statusbar_visible="draft,open,paid" statusbar_colors='{"proforma":"blue","proforma2":"blue"}'/>
|
||||
<field name="residual"/>
|
||||
<group col="8" colspan="4" groups="base.group_user">
|
||||
<button name="invoice_cancel" states="draft,proforma2,sale,open" string="Cancel" icon="gtk-cancel"/>
|
||||
|
@ -333,7 +332,6 @@
|
|||
<field name="payment_ids" colspan="4" nolabel="1">
|
||||
<tree string="Payments">
|
||||
<field name="date"/>
|
||||
<field name="move_id"/>
|
||||
<field name="ref"/>
|
||||
<field name="name"/>
|
||||
<field name="journal_id" groups="base.group_user"/>
|
||||
|
|
|
@ -718,7 +718,7 @@ class account_move_line(osv.osv):
|
|||
)
|
||||
return cr.fetchone()
|
||||
|
||||
def reconcile_partial(self, cr, uid, ids, type='auto', context=None):
|
||||
def reconcile_partial(self, cr, uid, ids, type='auto', context=None, writeoff_acc_id=False, writeoff_period_id=False, writeoff_journal_id=False):
|
||||
move_rec_obj = self.pool.get('account.move.reconcile')
|
||||
merges = []
|
||||
unmerge = []
|
||||
|
@ -747,7 +747,7 @@ class account_move_line(osv.osv):
|
|||
unmerge.append(line.id)
|
||||
total += (line.debit or 0.0) - (line.credit or 0.0)
|
||||
if self.pool.get('res.currency').is_zero(cr, uid, company_currency_id, total):
|
||||
res = self.reconcile(cr, uid, merges+unmerge, context=context)
|
||||
res = self.reconcile(cr, uid, merges+unmerge, context=context, writeoff_acc_id=writeoff_acc_id, writeoff_period_id=writeoff_period_id, writeoff_journal_id=writeoff_journal_id)
|
||||
return res
|
||||
r_id = move_rec_obj.create(cr, uid, {
|
||||
'type': type,
|
||||
|
@ -812,7 +812,7 @@ class account_move_line(osv.osv):
|
|||
if (not currency_obj.is_zero(cr, uid, account.company_id.currency_id, writeoff)) or \
|
||||
(account.currency_id and (not currency_obj.is_zero(cr, uid, account.currency_id, currency))):
|
||||
if not writeoff_acc_id:
|
||||
raise osv.except_osv(_('Warning'), _('You have to provide an account for the write off entry !'))
|
||||
raise osv.except_osv(_('Warning'), _('You have to provide an account for the write off/exchange difference entry !'))
|
||||
if writeoff > 0:
|
||||
debit = writeoff
|
||||
credit = 0.0
|
||||
|
@ -1249,7 +1249,7 @@ class account_move_line(osv.osv):
|
|||
break
|
||||
# Automatically convert in the account's secondary currency if there is one and
|
||||
# the provided values were not already multi-currency
|
||||
if account.currency_id and 'amount_currency' not in vals and account.currency_id.id != account.company_id.currency_id.id:
|
||||
if account.currency_id and not vals.get('ammount_currency') and account.currency_id.id != account.company_id.currency_id.id:
|
||||
vals['currency_id'] = account.currency_id.id
|
||||
ctx = {}
|
||||
if 'date' in vals:
|
||||
|
|
|
@ -564,7 +564,7 @@
|
|||
</group>
|
||||
<notebook colspan="4">
|
||||
<page string="Transaction" name="statement_line_ids">
|
||||
<field colspan="4" name="line_ids" nolabel="1">
|
||||
<field colspan="4" name="line_ids" nolabel="1" context="{'date':date}">
|
||||
<tree editable="bottom" string="Statement lines">
|
||||
<field name="sequence" readonly="1" invisible="1"/>
|
||||
<field name="date" groups="base.group_extended"/>
|
||||
|
@ -596,7 +596,7 @@
|
|||
</page>
|
||||
</notebook>
|
||||
<group col="8" colspan="4">
|
||||
<field name="state"/>
|
||||
<field name="state" widget="statusbar" statusbar_visible="draft,confirm"/>
|
||||
<field name="balance_end"/>
|
||||
<button name="button_cancel" states="confirm" string="Cancel" type="object" icon="gtk-cancel"/>
|
||||
<button name="button_dummy" states="draft" string="Compute" type="object" icon="terp-stock_format-scientific"/>
|
||||
|
@ -2556,7 +2556,7 @@ action = pool.get('res.config').next(cr, uid, [], context)
|
|||
<group col="6" colspan="4">
|
||||
<field name="name" select="1"/>
|
||||
<field name="company_id" select="1" groups="base.group_multi_company"/>
|
||||
<field name="journal_id" on_change="onchange_journal_id(journal_id)" domain="[('type','=','cash')]" select="1" widget="selection"/>
|
||||
<field name="journal_id" on_change="onchange_journal_id(journal_id)" select="1" widget="selection"/>
|
||||
<field name="user_id" select="1" readonly="1"/>
|
||||
<field name="period_id" select="1"/>
|
||||
<field name="currency" invisible="1"/>
|
||||
|
@ -2564,7 +2564,7 @@ action = pool.get('res.config').next(cr, uid, [], context)
|
|||
|
||||
<notebook colspan="4">
|
||||
<page string="Cash Transactions" attrs="{'invisible': [('state','=','draft')]}">
|
||||
<field colspan="4" name="line_ids" nolabel="1">
|
||||
<field colspan="4" name="line_ids" nolabel="1" context="{'date':date}">
|
||||
<tree editable="bottom" string="Statement lines">
|
||||
<field name="sequence" invisible="1"/>
|
||||
<field name="date" groups="base.group_extended"/>
|
||||
|
@ -2638,12 +2638,12 @@ action = pool.get('res.config').next(cr, uid, [], context)
|
|||
</group>
|
||||
<group col="2" colspan="2">
|
||||
<separator string="Closing Balance" colspan="4"/>
|
||||
<field name="balance_end" string="Calculated Balance"/>
|
||||
<field name="balance_end_cash" string="CashBox Balance"/>
|
||||
<field name="balance_end"/>
|
||||
<field name="balance_end_cash"/>
|
||||
</group>
|
||||
</group>
|
||||
<group col="8" colspan="4">
|
||||
<field name="state" colspan="4"/>
|
||||
<field name="state" widget="statusbar" statusbar_visible="draft,confirm" colspan="4"/>
|
||||
<button name="button_cancel" states="confirm,open" string="Cancel" icon="terp-gtk-stop" type="object" groups="base.group_extended"/>
|
||||
<button name="button_confirm_cash" states="open" string="Close CashBox" icon="terp-dialog-close" type="object"/>
|
||||
<button name="button_open" states="draft" string="Open CashBox" icon="gtk-go-forward" type="object"/>
|
||||
|
|
|
@ -186,8 +186,8 @@
|
|||
<field name="code">1104</field>
|
||||
<field name="name">Bank Current Account</field>
|
||||
<field ref="conf_cas" name="parent_id"/>
|
||||
<field name="type">liquidity</field>
|
||||
<field name="user_type" ref="conf_account_type_asset"/>
|
||||
<field name="type">view</field>
|
||||
<field name="user_type" ref="account_type_asset_view1"/>
|
||||
</record>
|
||||
|
||||
<record id="conf_o_income" model="account.account.template">
|
||||
|
@ -446,7 +446,7 @@
|
|||
<field name="property_account_expense_categ" ref="conf_a_expense"/>
|
||||
<field name="property_account_income_categ" ref="conf_a_sale"/>
|
||||
<field name="property_account_income_opening" ref="conf_o_income"/>
|
||||
<field name="property_account_expense_opening" ref="conf_o_expense"/>
|
||||
<field name="property_account_expense_opening" ref="conf_o_expense"/>
|
||||
<field name="property_reserve_and_surplus_account" ref="conf_a_reserve_and_surplus"/>
|
||||
</record>
|
||||
|
||||
|
@ -611,7 +611,7 @@
|
|||
<record id="conf_a_expense" model="account.account.template">
|
||||
<field name="tax_ids" eval="[(6,0,[ref('otaxs')])]"/>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="action_wizard_multi_chart_todo" model="ir.actions.todo">
|
||||
<field name="name">Generate Chart of Accounts from a Chart Template</field>
|
||||
<field name="action_id" ref="account.action_wizard_multi_chart"/>
|
||||
|
|
|
@ -65,21 +65,6 @@ class account_installer(osv.osv_memory):
|
|||
user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
|
||||
return user.company_id and user.company_id.id or False
|
||||
|
||||
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, context=context)
|
||||
address_id = self.pool.get('res.partner').address_get(cr, uid, [company.partner_id.id])
|
||||
if address_id['default']:
|
||||
address = self.pool.get('res.partner.address').browse(cr, uid, address_id['default'], context=context)
|
||||
code = address.country_id.code
|
||||
module_name = (code and 'l10n_' + code.lower()) or False
|
||||
if module_name:
|
||||
module_id = self.pool.get('ir.module.module').search(cr, uid, [('name', '=', module_name)], context=context)
|
||||
if module_id:
|
||||
return module_name
|
||||
return 'configurable'
|
||||
|
||||
_defaults = {
|
||||
'date_start': lambda *a: time.strftime('%Y-01-01'),
|
||||
'date_stop': lambda *a: time.strftime('%Y-12-31'),
|
||||
|
@ -87,7 +72,7 @@ class account_installer(osv.osv_memory):
|
|||
'sale_tax': 0.0,
|
||||
'purchase_tax': 0.0,
|
||||
'company_id': _default_company,
|
||||
'charts': _get_default_charts
|
||||
'charts': 'configurable'
|
||||
}
|
||||
|
||||
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
|
||||
|
|
|
@ -209,7 +209,7 @@ class account_invoice(osv.osv):
|
|||
\n* The \'Open\' state is used when user create invoice,a invoice number is generated.Its in open state till user does not pay invoice. \
|
||||
\n* The \'Paid\' state is set automatically when invoice is paid.\
|
||||
\n* The \'Cancelled\' state is used when user cancel invoice.'),
|
||||
'date_invoice': fields.date('Invoice Date', readonly=True, states={'draft':[('readonly',False)]}, select=True, help="Keep empty to use the current date"),
|
||||
'date_invoice': fields.date('Invoice Date', states={'paid':[('readonly',True)], 'open':[('readonly',True)], 'close':[('readonly',True)]}, select=True, help="Keep empty to use the current date"),
|
||||
'date_due': fields.date('Due Date', states={'paid':[('readonly',True)], 'open':[('readonly',True)], 'close':[('readonly',True)]}, select=True,
|
||||
help="If you use payment terms, the due date will be computed automatically at the generation "\
|
||||
"of accounting entries. If you keep the payment term and the due date empty, it means direct payment. The payment term may compute several due dates, for example 50% now, 50% in one month."),
|
||||
|
|
|
@ -236,12 +236,12 @@
|
|||
</td>
|
||||
</tr>
|
||||
<tr style="Table3">
|
||||
[[ repeatIn(get_lines_another('asset'),'a' ) ]]
|
||||
[[ repeatIn(get_lines_another('asset'),'a' ) ]]
|
||||
[[ setTag('tr','tr',{'style': 'Table'+str(min(3,a['level']))}) ]]
|
||||
<td><para style="terp_level_3_code">[[ (a['type'] =='view' and a['level'] >= 3) and setTag('para','para',{'style': 'terp_level_3_code_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a['level']))+'_code'}) ]]<i>[[ a['code'] ]]</i></para></td>
|
||||
<td><para style="terp_level_3_name">[[ (a['type'] =='view' and a['level'] >= 3) and setTag('para','para',{'style': 'terp_level_'+str(min(3,a['level']))+'_name_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(4,a['level']))+'_name'}) ]][[ a['name'] ]]</para></td>
|
||||
<td>[[ (a['level'] <>2) or removeParentNode('td') ]]<para style="terp_level_3_balance">[[ (a['type'] =='view' and a['level'] >= 3) and setTag('para','para',{'style': 'terp_level_3_balance_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a['level']))+'_balance'}) ]][[ formatLang(a['balance'], currency = company.currency_id) ]]</para></td>
|
||||
<td>[[ a['level'] == 2 or removeParentNode('td') ]]<para style="terp_level_2_balance"><u>[[ formatLang(a['balance'], currency = company.currency_id) ]]</u></para></td>
|
||||
<td>[[ (a['level'] <>2) or removeParentNode('td') ]]<para style="terp_level_3_balance">[[ (a['type'] =='view' and a['level'] >= 3) and setTag('para','para',{'style': 'terp_level_3_balance_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a['level']))+'_balance'}) ]][[ formatLang(a['balance'], currency_obj = company.currency_id) ]]</para></td>
|
||||
<td>[[ a['level'] == 2 or removeParentNode('td') ]]<para style="terp_level_2_balance"><u>[[ formatLang(a['balance'], currency_obj = company.currency_id) ]]</u></para></td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<blockTable colWidths="426.0,113.0" style="Table_Net_Profit_Loss">
|
||||
|
@ -250,7 +250,7 @@
|
|||
<para style="terp_default_Bold_9">Balance:</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Right_9_Bold"><u>[[ formatLang(sum_cr(), currency = company.currency_id) ]]</u></para>
|
||||
<para style="terp_default_Right_9_Bold"><u>[[ formatLang(sum_cr(), currency_obj = company.currency_id) ]]</u></para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
|
@ -278,12 +278,12 @@
|
|||
</td>
|
||||
</tr>
|
||||
<tr style="Table3">
|
||||
[[ repeatIn(get_lines_another('liability'),'a' ) ]]
|
||||
[[ repeatIn(get_lines_another('liability'),'a' ) ]]
|
||||
[[ setTag('tr','tr',{'style': 'Table'+str(min(3,a['level']))}) ]]
|
||||
<td><para style="terp_level_3_code">[[ (a['type'] =='view' and a['level'] >= 3) and setTag('para','para',{'style': 'terp_level_3_code_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a['level']))+'_code'}) ]]<i>[[ a['code'] ]]</i></para></td>
|
||||
<td><para style="terp_level_3_name">[[ (a['type'] =='view' and a['level'] >= 3) and setTag('para','para',{'style': 'terp_level_'+str(min(3,a['level']))+'_name_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(4,a['level']))+'_name'}) ]][[ a['name'] ]]</para></td>
|
||||
<td>[[ (a['level'] <>2) or removeParentNode('td') ]]<para style="terp_level_3_balance">[[ (a['type'] =='view' and a['level'] >= 3) and setTag('para','para',{'style': 'terp_level_3_balance_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a['level']))+'_balance'}) ]][[ formatLang(a['balance'], currency = company.currency_id) ]]</para></td>
|
||||
<td>[[ a['level'] == 2 or removeParentNode('td') ]]<para style="terp_level_2_balance"><u>[[ formatLang(a['balance'], currency = company.currency_id) ]]</u></para></td>
|
||||
<td>[[ (a['level'] <>2) or removeParentNode('td') ]]<para style="terp_level_3_balance">[[ (a['type'] =='view' and a['level'] >= 3) and setTag('para','para',{'style': 'terp_level_3_balance_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a['level']))+'_balance'}) ]][[ formatLang(a['balance'], currency_obj = company.currency_id) ]]</para></td>
|
||||
<td>[[ a['level'] == 2 or removeParentNode('td') ]]<para style="terp_level_2_balance"><u>[[ formatLang(a['balance'], currency_obj = company.currency_id) ]]</u></para></td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<blockTable colWidths="426.0,113.0" style="Table_Net_Profit_Loss">
|
||||
|
@ -292,7 +292,7 @@
|
|||
<para style="terp_default_Bold_9">Balance:</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Right_9_Bold"><u>[[ formatLang(sum_dr(), currency = company.currency_id) ]]</u></para>
|
||||
<para style="terp_default_Right_9_Bold"><u>[[ formatLang(sum_dr(), currency_obj = company.currency_id) ]]</u></para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
|
|
|
@ -235,13 +235,13 @@
|
|||
<para style="terp_default_Bold_9">Balance:</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Right_9_Bold"><u>[[ formatLang(sum_cr(), currency_obj=company.currency_id) ) ]]</u></para>
|
||||
<para style="terp_default_Right_9_Bold"><u>[[ formatLang(sum_cr(), currency_obj=company.currency_id) ]]</u></para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Bold_9">Balance:</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Right_9_Bold"><u>[[ formatLang(sum_dr(), currency_obj=company.currency_id) ) ]]</u></para>
|
||||
<para style="terp_default_Right_9_Bold"><u>[[ formatLang(sum_dr(), currency_obj=company.currency_id) ]]</u></para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
|
|
|
@ -224,11 +224,11 @@
|
|||
</td>
|
||||
</tr>
|
||||
<tr style="Table3">
|
||||
[[ repeatIn(get_lines_another('expense'),'a' ) ]]
|
||||
[[ repeatIn(get_lines_another('expense'),'a' ) ]]
|
||||
[[ setTag('tr','tr',{'style': 'Table'+str(min(3,a.level))}) ]]
|
||||
<td><para style="terp_level_3_code">[[ (a.type =='view' and a.level >= 3) and setTag('para','para',{'style': 'terp_level_3_code_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a.level))+'_code'}) ]]<i>[[ a.code ]]</i></para></td>
|
||||
<td><para style="terp_level_3_name">[[ (a.type =='view' and a.level >= 3) and setTag('para','para',{'style': 'terp_level_'+str(min(3,a.level))+'_name_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(4,a.level))+'_name'}) ]][[ a.name ]]</para></td>
|
||||
<td>[[ (a.level <>2) or removeParentNode('td') ]]<para style="terp_level_3_balance">[[ (a.type =='view' and a.level >= 3) and setTag('para','para',{'style': 'terp_level_3_balance_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a.level))+'_balance'}) ]][[ formatLang(a.balance * a.user_type.sign, currency_obj=company.currency_id.symbol)</para></td>
|
||||
<td>[[ (a.level <>2) or removeParentNode('td') ]]<para style="terp_level_3_balance">[[ (a.type =='view' and a.level >= 3) and setTag('para','para',{'style': 'terp_level_3_balance_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a.level))+'_balance'}) ]][[ formatLang(a.balance * a.user_type.sign, currency_obj=company.currency_id) ]]</para></td>
|
||||
<td>[[ a.level == 2 or removeParentNode('td') ]]<para style="terp_level_2_balance"><u>[[ formatLang(a.balance * a.user_type.sign, currency_obj=company.currency_id) ]]</u></para></td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
|
@ -273,7 +273,7 @@
|
|||
</td>
|
||||
</tr>
|
||||
<tr style="Table3">
|
||||
[[ repeatIn(get_lines_another('income'),'a' ) ]]
|
||||
[[ repeatIn(get_lines_another('income'),'a' ) ]]
|
||||
[[ setTag('tr','tr',{'style': 'Table'+str(min(3,a.level))}) ]]
|
||||
<td><para style="terp_level_3_code">[[ (a.type =='view' and a.level >= 3) and setTag('para','para',{'style': 'terp_level_3_code_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a.level))+'_code'}) ]]<i>[[ a.code ]]</i></para></td>
|
||||
<td><para style="terp_level_3_name">[[ (a.type =='view' and a.level >= 3) and setTag('para','para',{'style': 'terp_level_'+str(min(3,a.level))+'_name_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(4,a.level))+'_name'}) ]][[ a.name ]]</para></td>
|
||||
|
|
|
@ -68,6 +68,7 @@ class account_common_report(osv.osv_memory):
|
|||
FROM account_period p
|
||||
LEFT JOIN account_fiscalyear f ON (p.fiscalyear_id = f.id)
|
||||
WHERE f.id = %s
|
||||
AND p.special = false
|
||||
ORDER BY p.date_start ASC, p.special ASC
|
||||
LIMIT 1) AS period_start
|
||||
UNION
|
||||
|
@ -76,6 +77,7 @@ class account_common_report(osv.osv_memory):
|
|||
LEFT JOIN account_fiscalyear f ON (p.fiscalyear_id = f.id)
|
||||
WHERE f.id = %s
|
||||
AND p.date_start < NOW()
|
||||
AND p.special = false
|
||||
ORDER BY p.date_stop DESC
|
||||
LIMIT 1) AS period_stop''', (fiscalyear_id, fiscalyear_id))
|
||||
periods = [i[0] for i in cr.fetchall()]
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<data>
|
||||
|
||||
<record model="ir.actions.act_window" id="account_analytic_plan_form_action_installer">
|
||||
<field name="name">Account Analytic Plans</field>
|
||||
<field name="name">Define your Analytic Plans</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">account.analytic.plan</field>
|
||||
<field name="view_type">form</field>
|
||||
|
|
|
@ -136,12 +136,11 @@ class account_invoice_line(osv.osv):
|
|||
res += diff_res
|
||||
return res
|
||||
|
||||
def product_id_change(self, cr, uid, ids, product, uom, qty=0, name='', type='out_invoice', partner_id=False, fposition_id=False, price_unit=False, address_invoice_id=False, currency_id=False, context=None):
|
||||
def product_id_change(self, cr, uid, ids, product, uom, qty=0, name='', type='out_invoice', partner_id=False, fposition_id=False, price_unit=False, address_invoice_id=False, currency_id=False, context=None, company_id=None):
|
||||
fiscal_pool = self.pool.get('account.fiscal.position')
|
||||
res = super(account_invoice_line, self).product_id_change(cr, uid, ids, product, uom, qty, name, type, partner_id, fposition_id, price_unit, address_invoice_id, currency_id, context, company_id)
|
||||
if not product:
|
||||
return super(account_invoice_line, self).product_id_change(cr, uid, ids, product, uom, qty, name, type, partner_id, fposition_id, price_unit, address_invoice_id, currency_id, context)
|
||||
else:
|
||||
res = super(account_invoice_line, self).product_id_change(cr, uid, ids, product, uom, qty, name, type, partner_id, fposition_id, price_unit, address_invoice_id, currency_id, context)
|
||||
|
||||
return res
|
||||
if type in ('in_invoice','in_refund'):
|
||||
product_obj = self.pool.get('product.product').browse(cr, uid, product, context=context)
|
||||
if type == 'in_invoice':
|
||||
|
@ -153,8 +152,8 @@ class account_invoice_line(osv.osv):
|
|||
if not oa:
|
||||
oa = product_obj.categ_id.property_stock_account_output_categ and product_obj.categ_id.property_stock_account_output_categ.id
|
||||
if oa:
|
||||
fpos = fposition_id and self.pool.get('account.fiscal.position').browse(cr, uid, fposition_id, context=context) or False
|
||||
a = self.pool.get('account.fiscal.position').map_account(cr, uid, fpos, oa)
|
||||
fpos = fposition_id and fiscal_pool.browse(cr, uid, fposition_id, context=context) or False
|
||||
a = fiscal_pool.map_account(cr, uid, fpos, oa)
|
||||
res['value'].update({'account_id':a})
|
||||
return res
|
||||
|
||||
|
|
|
@ -314,7 +314,7 @@
|
|||
<menuitem parent="menu_finance_config_assets" id="menu_action_account_asset_asset_list_normal" action="action_account_asset_asset_list_normal"/>
|
||||
|
||||
<record model="ir.actions.act_window" id="action_account_asset_asset_form_normal">
|
||||
<field name="name">Asset Categories</field>
|
||||
<field name="name">Review Asset Categories</field>
|
||||
<field name="res_model">account.asset.category</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
|
|
|
@ -8,14 +8,14 @@ msgstr ""
|
|||
"Project-Id-Version: openobject-addons\n"
|
||||
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"POT-Creation-Date: 2009-11-24 12:54+0000\n"
|
||||
"PO-Revision-Date: 2011-09-17 13:42+0000\n"
|
||||
"PO-Revision-Date: 2011-09-26 12:09+0000\n"
|
||||
"Last-Translator: lholivier <olivier.lenoir@free.fr>\n"
|
||||
"Language-Team: French <fr@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2011-09-18 04:58+0000\n"
|
||||
"X-Generator: Launchpad (build 13955)\n"
|
||||
"X-Launchpad-Export-Date: 2011-09-27 04:47+0000\n"
|
||||
"X-Generator: Launchpad (build 14028)\n"
|
||||
|
||||
#. module: account_asset
|
||||
#: model:ir.actions.act_window,name:account_asset.action_account_asset_asset_list_normal
|
||||
|
@ -131,7 +131,7 @@ msgstr "Commentaires"
|
|||
#. module: account_asset
|
||||
#: view:account.asset.asset:0
|
||||
msgid "Change history"
|
||||
msgstr ""
|
||||
msgstr "Historique des modifications"
|
||||
|
||||
#. module: account_asset
|
||||
#: view:account.asset.asset:0
|
||||
|
@ -341,7 +341,7 @@ msgstr ""
|
|||
#: field:account.asset.asset,date:0
|
||||
#: field:account.asset.property.history,date:0
|
||||
msgid "Date"
|
||||
msgstr ""
|
||||
msgstr "Date"
|
||||
|
||||
#. module: account_asset
|
||||
#: field:account.asset.board,value_net:0
|
||||
|
|
|
@ -0,0 +1,441 @@
|
|||
# Danish translation for openobject-addons
|
||||
# Copyright (c) 2011 Rosetta Contributors and Canonical Ltd 2011
|
||||
# This file is distributed under the same license as the openobject-addons package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, 2011.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: openobject-addons\n"
|
||||
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"POT-Creation-Date: 2011-01-11 11:14+0000\n"
|
||||
"PO-Revision-Date: 2011-09-23 06:03+0000\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: Danish <da@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2011-09-24 04:58+0000\n"
|
||||
"X-Generator: Launchpad (build 14012)\n"
|
||||
|
||||
#. module: account_budget
|
||||
#: field:crossovered.budget,creating_user_id:0
|
||||
msgid "Responsible User"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_budget
|
||||
#: selection:crossovered.budget,state:0
|
||||
msgid "Confirmed"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_budget
|
||||
#: model:ir.actions.act_window,name:account_budget.open_budget_post_form
|
||||
#: model:ir.ui.menu,name:account_budget.menu_budget_post_form
|
||||
msgid "Budgetary Positions"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_budget
|
||||
#: code:addons/account_budget/account_budget.py:119
|
||||
#, python-format
|
||||
msgid "The General Budget '%s' has no Accounts!"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_budget
|
||||
#: report:account.budget:0
|
||||
msgid "Printed at:"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_budget
|
||||
#: view:crossovered.budget:0
|
||||
msgid "Confirm"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_budget
|
||||
#: field:crossovered.budget,validating_user_id:0
|
||||
msgid "Validate User"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_budget
|
||||
#: model:ir.actions.act_window,name:account_budget.action_account_budget_crossvered_summary_report
|
||||
msgid "Print Summary"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_budget
|
||||
#: field:crossovered.budget.lines,paid_date:0
|
||||
msgid "Paid Date"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_budget
|
||||
#: field:account.budget.analytic,date_to:0
|
||||
#: field:account.budget.crossvered.report,date_to:0
|
||||
#: field:account.budget.crossvered.summary.report,date_to:0
|
||||
#: field:account.budget.report,date_to:0
|
||||
msgid "End of period"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_budget
|
||||
#: view:crossovered.budget:0
|
||||
#: selection:crossovered.budget,state:0
|
||||
msgid "Draft"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_budget
|
||||
#: report:account.budget:0
|
||||
msgid "at"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_budget
|
||||
#: view:account.budget.report:0
|
||||
#: model:ir.actions.act_window,name:account_budget.action_account_budget_analytic
|
||||
#: model:ir.actions.act_window,name:account_budget.action_account_budget_crossvered_report
|
||||
msgid "Print Budgets"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_budget
|
||||
#: report:account.budget:0
|
||||
msgid "Currency:"
|
||||
msgstr "Valuta:"
|
||||
|
||||
#. module: account_budget
|
||||
#: model:ir.model,name:account_budget.model_account_budget_crossvered_report
|
||||
msgid "Account Budget crossvered report"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_budget
|
||||
#: selection:crossovered.budget,state:0
|
||||
msgid "Validated"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_budget
|
||||
#: field:crossovered.budget.lines,percentage:0
|
||||
msgid "Percentage"
|
||||
msgstr "Procentdel"
|
||||
|
||||
#. module: account_budget
|
||||
#: report:crossovered.budget.report:0
|
||||
msgid "to"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_budget
|
||||
#: field:crossovered.budget,state:0
|
||||
msgid "Status"
|
||||
msgstr "Status"
|
||||
|
||||
#. module: account_budget
|
||||
#: model:ir.actions.act_window,help:account_budget.act_crossovered_budget_view
|
||||
msgid ""
|
||||
"A budget is a forecast of your company's income and expenses expected for a "
|
||||
"period in the future. With a budget, a company is able to carefully look at "
|
||||
"how much money they are taking in during a given period, and figure out the "
|
||||
"best way to divide it among various categories. By keeping track of where "
|
||||
"your money goes, you may be less likely to overspend, and more likely to "
|
||||
"meet your financial goals. Forecast a budget by detailing the expected "
|
||||
"revenue per analytic account and monitor its evolution based on the actuals "
|
||||
"realised during that period."
|
||||
msgstr ""
|
||||
|
||||
#. module: account_budget
|
||||
#: view:account.budget.crossvered.summary.report:0
|
||||
msgid "This wizard is used to print summary of budgets"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_budget
|
||||
#: report:account.budget:0
|
||||
#: report:crossovered.budget.report:0
|
||||
msgid "%"
|
||||
msgstr "%"
|
||||
|
||||
#. module: account_budget
|
||||
#: report:account.budget:0
|
||||
#: report:crossovered.budget.report:0
|
||||
msgid "Description"
|
||||
msgstr "Beskrivelse:"
|
||||
|
||||
#. module: account_budget
|
||||
#: report:crossovered.budget.report:0
|
||||
msgid "Currency"
|
||||
msgstr "Valuta"
|
||||
|
||||
#. module: account_budget
|
||||
#: report:crossovered.budget.report:0
|
||||
msgid "Total :"
|
||||
msgstr "Total:"
|
||||
|
||||
#. module: account_budget
|
||||
#: field:account.budget.post,company_id:0
|
||||
#: field:crossovered.budget,company_id:0
|
||||
#: field:crossovered.budget.lines,company_id:0
|
||||
msgid "Company"
|
||||
msgstr "Virksomhed"
|
||||
|
||||
#. module: account_budget
|
||||
#: view:crossovered.budget:0
|
||||
msgid "To Approve"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_budget
|
||||
#: view:crossovered.budget:0
|
||||
msgid "Reset to Draft"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_budget
|
||||
#: view:account.budget.post:0
|
||||
#: view:crossovered.budget:0
|
||||
#: field:crossovered.budget.lines,planned_amount:0
|
||||
msgid "Planned Amount"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_budget
|
||||
#: report:account.budget:0
|
||||
#: report:crossovered.budget.report:0
|
||||
msgid "Perc(%)"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_budget
|
||||
#: view:crossovered.budget:0
|
||||
#: selection:crossovered.budget,state:0
|
||||
msgid "Done"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_budget
|
||||
#: report:account.budget:0
|
||||
#: report:crossovered.budget.report:0
|
||||
msgid "Practical Amt"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_budget
|
||||
#: view:account.analytic.account:0
|
||||
#: view:account.budget.post:0
|
||||
#: view:crossovered.budget:0
|
||||
#: field:crossovered.budget.lines,practical_amount:0
|
||||
msgid "Practical Amount"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_budget
|
||||
#: field:crossovered.budget,date_to:0
|
||||
#: field:crossovered.budget.lines,date_to:0
|
||||
msgid "End Date"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_budget
|
||||
#: model:ir.model,name:account_budget.model_account_budget_analytic
|
||||
#: model:ir.model,name:account_budget.model_account_budget_report
|
||||
msgid "Account Budget report for analytic account"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_budget
|
||||
#: view:account.analytic.account:0
|
||||
msgid "Theoritical Amount"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_budget
|
||||
#: field:account.budget.post,name:0
|
||||
#: field:crossovered.budget,name:0
|
||||
msgid "Name"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_budget
|
||||
#: model:ir.model,name:account_budget.model_crossovered_budget_lines
|
||||
msgid "Budget Line"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_budget
|
||||
#: view:account.analytic.account:0
|
||||
#: view:account.budget.post:0
|
||||
msgid "Lines"
|
||||
msgstr "Linier"
|
||||
|
||||
#. module: account_budget
|
||||
#: report:account.budget:0
|
||||
#: view:crossovered.budget:0
|
||||
#: field:crossovered.budget.lines,crossovered_budget_id:0
|
||||
#: report:crossovered.budget.report:0
|
||||
#: model:ir.actions.report.xml,name:account_budget.account_budget
|
||||
#: model:ir.model,name:account_budget.model_crossovered_budget
|
||||
msgid "Budget"
|
||||
msgstr "Budget"
|
||||
|
||||
#. module: account_budget
|
||||
#: code:addons/account_budget/account_budget.py:119
|
||||
#, python-format
|
||||
msgid "Error!"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_budget
|
||||
#: field:account.budget.post,code:0
|
||||
#: field:crossovered.budget,code:0
|
||||
msgid "Code"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_budget
|
||||
#: view:account.budget.analytic:0
|
||||
#: view:account.budget.crossvered.report:0
|
||||
msgid "This wizard is used to print budget"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_budget
|
||||
#: model:ir.actions.act_window,name:account_budget.act_crossovered_budget_view
|
||||
#: model:ir.actions.act_window,name:account_budget.action_account_budget_post_tree
|
||||
#: model:ir.actions.act_window,name:account_budget.action_account_budget_report
|
||||
#: model:ir.actions.report.xml,name:account_budget.report_crossovered_budget
|
||||
#: model:ir.ui.menu,name:account_budget.menu_act_crossovered_budget_view
|
||||
#: model:ir.ui.menu,name:account_budget.menu_action_account_budget_post_tree
|
||||
#: model:ir.ui.menu,name:account_budget.next_id_31
|
||||
#: model:ir.ui.menu,name:account_budget.next_id_pos
|
||||
msgid "Budgets"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_budget
|
||||
#: constraint:account.analytic.account:0
|
||||
msgid ""
|
||||
"Error! The currency has to be the same as the currency of the selected "
|
||||
"company"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_budget
|
||||
#: selection:crossovered.budget,state:0
|
||||
msgid "Cancelled"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_budget
|
||||
#: view:crossovered.budget:0
|
||||
msgid "Approve"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_budget
|
||||
#: field:crossovered.budget,date_from:0
|
||||
#: field:crossovered.budget.lines,date_from:0
|
||||
msgid "Start Date"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_budget
|
||||
#: view:account.budget.post:0
|
||||
#: field:crossovered.budget.lines,general_budget_id:0
|
||||
#: model:ir.model,name:account_budget.model_account_budget_post
|
||||
msgid "Budgetary Position"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_budget
|
||||
#: field:account.budget.analytic,date_from:0
|
||||
#: field:account.budget.crossvered.report,date_from:0
|
||||
#: field:account.budget.crossvered.summary.report,date_from:0
|
||||
#: field:account.budget.report,date_from:0
|
||||
msgid "Start of period"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_budget
|
||||
#: model:ir.model,name:account_budget.model_account_budget_crossvered_summary_report
|
||||
msgid "Account Budget crossvered summary report"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_budget
|
||||
#: report:account.budget:0
|
||||
#: report:crossovered.budget.report:0
|
||||
msgid "Theoretical Amt"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_budget
|
||||
#: view:account.budget.analytic:0
|
||||
#: view:account.budget.crossvered.report:0
|
||||
#: view:account.budget.crossvered.summary.report:0
|
||||
#: view:account.budget.report:0
|
||||
msgid "Select Dates Period"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_budget
|
||||
#: view:account.budget.analytic:0
|
||||
#: view:account.budget.crossvered.report:0
|
||||
#: view:account.budget.crossvered.summary.report:0
|
||||
#: view:account.budget.report:0
|
||||
msgid "Print"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_budget
|
||||
#: model:ir.module.module,description:account_budget.module_meta_information
|
||||
msgid ""
|
||||
"This module allows accountants to manage analytic and crossovered budgets.\n"
|
||||
"\n"
|
||||
"Once the Master Budgets and the Budgets are defined (in "
|
||||
"Accounting/Budgets/),\n"
|
||||
"the Project Managers can set the planned amount on each Analytic Account.\n"
|
||||
"\n"
|
||||
"The accountant has the possibility to see the total of amount planned for "
|
||||
"each\n"
|
||||
"Budget and Master Budget in order to ensure the total planned is not\n"
|
||||
"greater/lower than what he planned for this Budget/Master Budget. Each list "
|
||||
"of\n"
|
||||
"record can also be switched to a graphical view of it.\n"
|
||||
"\n"
|
||||
"Three reports are available:\n"
|
||||
" 1. The first is available from a list of Budgets. It gives the "
|
||||
"spreading, for these Budgets, of the Analytic Accounts per Master Budgets.\n"
|
||||
"\n"
|
||||
" 2. The second is a summary of the previous one, it only gives the "
|
||||
"spreading, for the selected Budgets, of the Analytic Accounts.\n"
|
||||
"\n"
|
||||
" 3. The last one is available from the Analytic Chart of Accounts. It "
|
||||
"gives the spreading, for the selected Analytic Accounts, of the Master "
|
||||
"Budgets per Budgets.\n"
|
||||
"\n"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_budget
|
||||
#: field:crossovered.budget.lines,analytic_account_id:0
|
||||
#: model:ir.model,name:account_budget.model_account_analytic_account
|
||||
msgid "Analytic Account"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_budget
|
||||
#: report:account.budget:0
|
||||
msgid "Budget :"
|
||||
msgstr "Budget:"
|
||||
|
||||
#. module: account_budget
|
||||
#: report:account.budget:0
|
||||
#: report:crossovered.budget.report:0
|
||||
msgid "Planned Amt"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_budget
|
||||
#: view:account.budget.post:0
|
||||
#: field:account.budget.post,account_ids:0
|
||||
msgid "Accounts"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_budget
|
||||
#: view:account.analytic.account:0
|
||||
#: field:account.analytic.account,crossovered_budget_line:0
|
||||
#: view:account.budget.post:0
|
||||
#: field:account.budget.post,crossovered_budget_line:0
|
||||
#: view:crossovered.budget:0
|
||||
#: field:crossovered.budget,crossovered_budget_line:0
|
||||
#: view:crossovered.budget.lines:0
|
||||
#: model:ir.actions.act_window,name:account_budget.act_account_analytic_account_cb_lines
|
||||
#: model:ir.actions.act_window,name:account_budget.act_crossovered_budget_lines_view
|
||||
#: model:ir.ui.menu,name:account_budget.menu_act_crossovered_budget_lines_view
|
||||
msgid "Budget Lines"
|
||||
msgstr "Budget linier"
|
||||
|
||||
#. module: account_budget
|
||||
#: view:account.budget.analytic:0
|
||||
#: view:account.budget.crossvered.report:0
|
||||
#: view:account.budget.crossvered.summary.report:0
|
||||
#: view:account.budget.report:0
|
||||
#: view:crossovered.budget:0
|
||||
msgid "Cancel"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_budget
|
||||
#: model:ir.module.module,shortdesc:account_budget.module_meta_information
|
||||
msgid "Budget Management"
|
||||
msgstr "Budget administration"
|
||||
|
||||
#. module: account_budget
|
||||
#: constraint:account.analytic.account:0
|
||||
msgid "Error! You can not create recursive analytic accounts."
|
||||
msgstr ""
|
||||
|
||||
#. module: account_budget
|
||||
#: report:account.budget:0
|
||||
#: report:crossovered.budget.report:0
|
||||
msgid "Analysis from"
|
||||
msgstr ""
|
|
@ -63,7 +63,20 @@ class followup_line(osv.osv):
|
|||
}
|
||||
_defaults = {
|
||||
'start': 'days',
|
||||
|
||||
}
|
||||
def _check_description(self, cr, uid, ids, context=None):
|
||||
for line in self.browse(cr, uid, ids, context=context):
|
||||
if line.description:
|
||||
try:
|
||||
line.description % {'partner_name': '', 'date':'', 'user_signature': '', 'company_name': ''}
|
||||
except:
|
||||
return False
|
||||
return True
|
||||
|
||||
_constraints = [
|
||||
(_check_description, 'Your description is invalid, use the right legend or %% if you want to use the percent character.', ['description']),
|
||||
]
|
||||
|
||||
followup_line()
|
||||
|
||||
|
@ -101,4 +114,4 @@ Thanks,
|
|||
|
||||
res_company()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -164,7 +164,7 @@
|
|||
<!-- Configure Follow-Ups Wizard -->
|
||||
|
||||
<record id="action_view_account_followup_followup_form" model="ir.actions.act_window">
|
||||
<field name="name">Configure Follow-Ups</field>
|
||||
<field name="name">Review Invoicing Follow-Ups</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">account_followup.followup</field>
|
||||
<field name="view_type">form</field>
|
||||
|
|
|
@ -115,13 +115,13 @@ class account_followup_print_all(osv.osv_memory):
|
|||
_name = 'account.followup.print.all'
|
||||
_description = 'Print Followup & Send Mail to Customers'
|
||||
_columns = {
|
||||
'partner_ids': fields.many2many('account_followup.stat.by.partner', 'partner_stat_rel', 'osv_memory_id', 'partner_id',
|
||||
'Partners', required=True),
|
||||
'partner_ids': fields.many2many('account_followup.stat.by.partner', 'partner_stat_rel', 'osv_memory_id', 'partner_id', 'Partners', required=True),
|
||||
'email_conf': fields.boolean('Send email confirmation'),
|
||||
'email_subject': fields.char('Email Subject', size=64),
|
||||
'partner_lang': fields.boolean('Send Email in Partner Language', help='Do not change message text, if you want to send email in partner language, or configure from company'),
|
||||
'email_body': fields.text('Email body'),
|
||||
'summary': fields.text('Summary', required=True, readonly=True)
|
||||
'summary': fields.text('Summary', required=True, readonly=True),
|
||||
'test_print': fields.boolean('Test Print', help='Check if you want to print followups without changing followups level.')
|
||||
}
|
||||
def _get_summary(self, cr, uid, context=None):
|
||||
if context is None:
|
||||
|
@ -317,14 +317,15 @@ class account_followup_print_all(osv.osv_memory):
|
|||
to_update = res
|
||||
data['followup_id'] = 'followup_id' in context and context['followup_id'] or False
|
||||
date = 'date' in context and context['date'] or data['date']
|
||||
for id in to_update.keys():
|
||||
if to_update[id]['partner_id'] in data['partner_ids']:
|
||||
cr.execute(
|
||||
"UPDATE account_move_line "\
|
||||
"SET followup_line_id=%s, followup_date=%s "\
|
||||
"WHERE id=%s",
|
||||
(to_update[id]['level'],
|
||||
date, int(id),))
|
||||
if not data['test_print']:
|
||||
for id in to_update.keys():
|
||||
if to_update[id]['partner_id'] in data['partner_ids']:
|
||||
cr.execute(
|
||||
"UPDATE account_move_line "\
|
||||
"SET followup_line_id=%s, followup_date=%s "\
|
||||
"WHERE id=%s",
|
||||
(to_update[id]['level'],
|
||||
date, int(id),))
|
||||
data.update({'date': context['date']})
|
||||
datas = {
|
||||
'ids': [],
|
||||
|
|
|
@ -86,6 +86,7 @@
|
|||
<page string="Email Settings">
|
||||
<field name="email_conf" colspan="4"/>
|
||||
<field name="partner_lang" colspan="4"/>
|
||||
<field name="test_print" colspan="4"/>
|
||||
<field name="email_subject" colspan="4"/>
|
||||
<separator string="Email body" colspan="4" />
|
||||
<field name="email_body" colspan="4" nolabel="1"/>
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<data>
|
||||
|
||||
<report id="account_invoices_1"
|
||||
string="Invoices with Layout"
|
||||
model="account.invoice"
|
||||
name="account.invoice.layout"
|
||||
rml="account_invoice_layout/report/report_account_invoice_layout.rml"
|
||||
auto="False"/>
|
||||
|
||||
<report id="account_invoices_layout_message"
|
||||
menu="False"
|
||||
string="Invoices with Layout and Message"
|
||||
model="account.invoice"
|
||||
name="notify_account.invoice"
|
||||
rml="account_invoice_layout/report/special_message_invoice.rml"
|
||||
auto="False"/>
|
||||
<report id="account_invoices_1"
|
||||
string="Invoices"
|
||||
model="account.invoice"
|
||||
name="account.invoice.layout"
|
||||
rml="account_invoice_layout/report/report_account_invoice_layout.rml"
|
||||
auto="False"/>
|
||||
|
||||
<report id="account_invoices_layout_message"
|
||||
menu="False"
|
||||
string="Invoices and Message"
|
||||
model="account.invoice"
|
||||
name="notify_account.invoice"
|
||||
rml="account_invoice_layout/report/special_message_invoice.rml"
|
||||
auto="False"/>
|
||||
|
||||
</data>
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
|
@ -182,28 +182,6 @@
|
|||
<images/>
|
||||
</stylesheet>
|
||||
<story>
|
||||
<pto>
|
||||
<pto_header>
|
||||
<blockTable colWidths="283.0,71.0,57.0,57.0,71.0" style="Tableau6">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details">Description / Taxes</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details_Centre">Quantity</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details_Right">Unit Price</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details_Right">Disc. (%)</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details_Right">Price</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
</pto_header>
|
||||
<para style="terp_default_8">[[ repeatIn(objects,'o') ]]</para>
|
||||
<para style="terp_default_8">[[ setLang(o.partner_id.lang) ]]</para>
|
||||
<blockTable colWidths="302.0,237.0" style="Tableau2">
|
||||
|
@ -505,6 +483,5 @@
|
|||
<para style="Standard">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</pto>
|
||||
</story>
|
||||
</document>
|
||||
|
|
|
@ -186,28 +186,6 @@
|
|||
<images/>
|
||||
</stylesheet>
|
||||
<story>
|
||||
<pto>
|
||||
<pto_header>
|
||||
<blockTable colWidths="283.0,71.0,57.0,57.0,71.0" style="Tableau6">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details">Description / Taxes</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details_Centre">Quantity</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details_Right">Unit Price</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details_Right">Disc. (%)</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details_Right">Price</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
</pto_header>
|
||||
<para style="terp_default_8">[[ repeatIn(objects,'o') ]]</para>
|
||||
<para style="terp_default_8">[[ setLang(o.partner_id.lang) ]]</para>
|
||||
<blockTable colWidths="302.0,237.0" style="Tableau2">
|
||||
|
@ -523,6 +501,5 @@
|
|||
<para style="terp_default_9">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</pto>
|
||||
</story>
|
||||
</document>
|
||||
|
|
|
@ -1,22 +1,9 @@
|
|||
-
|
||||
In order to Print the Invoice layout report in Normal Mode, we will create a invoice record
|
||||
-
|
||||
!record {model: account.invoice, id: test_invoice_1}:
|
||||
currency_id: base.EUR
|
||||
company_id: base.main_company
|
||||
address_invoice_id: base.res_partner_address_tang
|
||||
partner_id: base.res_partner_asus
|
||||
state: draft
|
||||
type: out_invoice
|
||||
account_id: account.a_recv
|
||||
name: Test invoice 1
|
||||
address_contact_id: base.res_partner_address_tang
|
||||
-
|
||||
Print the Invoice layout report in Normal Mode
|
||||
-
|
||||
!python {model: account.invoice}: |
|
||||
import netsvc, tools, os
|
||||
(data, format) = netsvc.LocalService('report.account.invoice.layout').create(cr, uid, [ref('test_invoice_1')], {}, {})
|
||||
(data, format) = netsvc.LocalService('report.account.invoice.layout').create(cr, uid, [ref('account.demo_invoice_0')], {}, {})
|
||||
if tools.config['test_report_directory']:
|
||||
file(os.path.join(tools.config['test_report_directory'], 'account_invoice_layout.'+format), 'wb+').write(data)
|
||||
|
||||
|
@ -25,7 +12,7 @@
|
|||
-
|
||||
!python {model: account.invoice}: |
|
||||
ctx={}
|
||||
ctx.update({'model': 'account.invoice','active_ids': [ref('test_invoice_1')]})
|
||||
ctx.update({'model': 'account.invoice','active_ids': [ref('account.demo_invoice_0')]})
|
||||
data_dict = {'message':ref('account_invoice_layout.demo_message1')}
|
||||
from tools import test_reports
|
||||
test_reports.try_report_action(cr, uid, 'action_account_invoice_special_msg',wiz_data=data_dict, context=ctx, our_module='account_invoice_layout')
|
||||
|
|
|
@ -2,43 +2,43 @@
|
|||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="account_invoice_special_msg_view" model="ir.ui.view">
|
||||
<field name="name">Account Invioce Special Message</field>
|
||||
<field name="model">account.invoice.special.msg</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Select Message">
|
||||
<group colspan="4" col="6">
|
||||
<field name="message"/>
|
||||
</group>
|
||||
<separator colspan="4"/>
|
||||
<group colspan="4" col="6">
|
||||
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
|
||||
<button name="check_report" string="Print" type="object" icon="gtk-print"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
<record id="account_invoice_special_msg_view" model="ir.ui.view">
|
||||
<field name="name">Account Invioce Special Message</field>
|
||||
<field name="model">account.invoice.special.msg</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Select Message">
|
||||
<group colspan="4" col="6">
|
||||
<field name="message"/>
|
||||
</group>
|
||||
<separator colspan="4"/>
|
||||
<group colspan="4" col="6">
|
||||
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
|
||||
<button name="check_report" string="Print" type="object" icon="gtk-print"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_account_invoice_special_msg" model="ir.actions.act_window">
|
||||
<field name="name">Invoices with Layout and Message</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">account.invoice.special.msg</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="account_invoice_special_msg_view"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
<record id="action_account_invoice_special_msg" model="ir.actions.act_window">
|
||||
<field name="name">Invoices and Message</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">account.invoice.special.msg</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="account_invoice_special_msg_view"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.values" id="account_invoice_special_msg_values">
|
||||
<field name="model_id" ref="account.model_account_invoice" />
|
||||
<field name="object" eval="1" />
|
||||
<field name="name">Account Invioce Special Message</field>
|
||||
<field name="key2">client_print_multi</field>
|
||||
<field name="value" eval="'ir.actions.act_window,' + str(ref('action_account_invoice_special_msg'))" />
|
||||
<field name="key">action</field>
|
||||
<field name="model">account.invoice</field>
|
||||
</record>
|
||||
<record model="ir.values" id="account_invoice_special_msg_values">
|
||||
<field name="model_id" ref="account.model_account_invoice" />
|
||||
<field name="object" eval="1" />
|
||||
<field name="name">Account Invioce Special Message</field>
|
||||
<field name="key2">client_print_multi</field>
|
||||
<field name="value" eval="'ir.actions.act_window,' + str(ref('action_account_invoice_special_msg'))" />
|
||||
<field name="key">action</field>
|
||||
<field name="model">account.invoice</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
</openerp>
|
||||
|
|
|
@ -70,7 +70,7 @@
|
|||
<field name="inherit_id" ref="account.view_account_move_line_filter"/>
|
||||
<field name="arch" type="xml">
|
||||
<data>
|
||||
<xpath expr="//field[@name='ref']" position="after">
|
||||
<xpath expr="//field[@name='move_id']" position="after">
|
||||
<field name="internal_sequence_number"/>
|
||||
</xpath>
|
||||
</data>
|
||||
|
|
|
@ -20,9 +20,8 @@
|
|||
##############################################################################
|
||||
|
||||
import account_voucher
|
||||
import company
|
||||
import invoice
|
||||
import report
|
||||
import wizard
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -25,22 +25,15 @@
|
|||
"author" : 'OpenERP SA',
|
||||
'complexity': "normal",
|
||||
"description": """
|
||||
Account Voucher module offers an easy way to deal with all the basic requirements of Voucher Entries
|
||||
====================================================================================================
|
||||
Account Voucher module includes all the basic requirements of Voucher Entries for Bank, Cash, Sales, Purchase, Expanse, Contra, etc.
|
||||
====================================================================================================================================
|
||||
|
||||
Its increased usabililty allows you to create easily sales/purchases documents but also to encode payments.
|
||||
Doing so, you'll be able to see all the open transactions for the selected partner and that will help you
|
||||
to reconcile your entry with its invoice.
|
||||
|
||||
Account Voucher module multi-currency support
|
||||
=============================================
|
||||
|
||||
Thanks to the contribution of Camptocamp, the vouchers fully support the multi currency and compute the
|
||||
currency rate difference besides the write off amount. Of course, the accounting entries are also created
|
||||
accordingly.
|
||||
* Voucher Entry
|
||||
* Voucher Receipt
|
||||
* Cheque Register
|
||||
""",
|
||||
"category" : "Finance",
|
||||
"website" : "http://www.openerp.com",
|
||||
"website" : "http://tinyerp.com",
|
||||
"images" : ["images/customer_payment.jpeg","images/journal_voucher.jpeg","images/sales_receipt.jpeg","images/supplier_voucher.jpeg"],
|
||||
"depends" : ["account"],
|
||||
"init_xml" : [],
|
||||
|
@ -55,7 +48,6 @@ accordingly.
|
|||
"wizard/account_voucher_unreconcile_view.xml",
|
||||
"wizard/account_statement_from_invoice_view.xml",
|
||||
"account_voucher_view.xml",
|
||||
"company_view.xml",
|
||||
"voucher_payment_receipt_view.xml",
|
||||
"voucher_sales_purchase_view.xml",
|
||||
"account_voucher_wizard.xml",
|
||||
|
@ -67,12 +59,7 @@ accordingly.
|
|||
"test/account_voucher.yml",
|
||||
"test/sales_receipt.yml",
|
||||
"test/sales_payment.yml",
|
||||
"test/account_voucher_report.yml",
|
||||
"test/case1_usd_usd.yml",
|
||||
"test/case2_usd_eur.yml",
|
||||
"test/case2_suppl_usd_eur.yml",
|
||||
"test/case3_eur_eur.yml",
|
||||
"test/case4_cad_chf.yml",
|
||||
"test/account_voucher_report.yml"
|
||||
],
|
||||
'certificate': '0037580727101',
|
||||
"active": False,
|
||||
|
|
|
@ -29,6 +29,17 @@ from tools.translate import _
|
|||
|
||||
|
||||
class account_voucher(osv.osv):
|
||||
def _check_paid(self, cr, uid, ids, name, args, context=None):
|
||||
res = {}
|
||||
for voucher in self.browse(cr, uid, ids, context=context):
|
||||
ok = True
|
||||
for line in voucher.move_ids:
|
||||
if (line.account_id.type, 'in', ('receivable', 'payable')) and not line.reconcile_id:
|
||||
ok = False
|
||||
res[voucher.id] = ok
|
||||
return res
|
||||
|
||||
|
||||
|
||||
def _get_type(self, cr, uid, context=None):
|
||||
if context is None:
|
||||
|
@ -39,10 +50,7 @@ class account_voucher(osv.osv):
|
|||
if context is None: context = {}
|
||||
if context.get('period_id', False):
|
||||
return context.get('period_id')
|
||||
if context.get('invoice_id', False):
|
||||
company_id = self.pool.get('account.invoice').browse(cr, uid, context['invoice_id'], context=context).company_id.id
|
||||
context.update({'company_id': company_id})
|
||||
periods = self.pool.get('account.period').find(cr, uid, context=context)
|
||||
periods = self.pool.get('account.period').find(cr, uid)
|
||||
return periods and periods[0] or False
|
||||
|
||||
def _get_journal(self, cr, uid, context=None):
|
||||
|
@ -145,102 +153,39 @@ class account_voucher(osv.osv):
|
|||
res['arch'] = etree.tostring(doc)
|
||||
return res
|
||||
|
||||
def _check_paid(self, cr, uid, ids, name, args, context=None):
|
||||
res = {}
|
||||
for voucher in self.browse(cr, uid, ids, context=context):
|
||||
ok = True
|
||||
for line in voucher.move_ids:
|
||||
if (line.account_id.type, 'in', ('receivable', 'payable')) and not line.reconcile_id:
|
||||
ok = False
|
||||
res[voucher.id] = ok
|
||||
return res
|
||||
|
||||
def _compute_writeoff_amount(self, cr, uid, line_dr_ids, line_cr_ids, amount, voucher_date, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
currency_pool = self.pool.get('res.currency')
|
||||
ctx = context.copy()
|
||||
voucher_type = context.get('type', False)
|
||||
counter_for_writeoff = counter_for_currency_diff = real_amount = 0.0
|
||||
ctx.update({'date': voucher_date})
|
||||
def _compute_writeoff_amount(self, cr, uid, line_dr_ids, line_cr_ids, amount):
|
||||
debit = credit = 0.0
|
||||
for l in line_dr_ids:
|
||||
#compute the amount in voucher currency and in company currency if there aren't set yet
|
||||
if not l.get('amount_in_company_currency', False):
|
||||
ctx.update({'date': l['date_original']})
|
||||
amount_in_company_currency = currency_pool.compute(cr, uid, l['currency_id'], l['company_currency_id'], l['amount'], context=ctx)
|
||||
ctx.update({'date': voucher_date})
|
||||
else:
|
||||
amount_in_company_currency = l.get('amount_in_company_currency', 0.0)
|
||||
if not l.get('amount_in_voucher_currency'):
|
||||
amount_in_voucher_currency = currency_pool.compute(cr, uid, l['currency_id'], l['voucher_currency_id'], l['amount'], context=ctx)
|
||||
else:
|
||||
amount_in_voucher_currency = l.get('amount_in_voucher_currency', 0.0)
|
||||
real_amount -= amount_in_company_currency
|
||||
counter_for_writeoff -= l.get('voucher_currency_id') == l.get('currency_id') and l['amount'] or amount_in_voucher_currency
|
||||
counter_for_currency_diff -= currency_pool.compute(cr, uid, l['currency_id'], l['company_currency_id'], l['amount'], context=ctx)
|
||||
debit += l['amount']
|
||||
for l in line_cr_ids:
|
||||
#compute the amount in voucher currency and in company currency if there aren't set yet
|
||||
if not l.get('amount_in_company_currency', False):
|
||||
ctx.update({'date': l['date_original']})
|
||||
amount_in_company_currency = currency_pool.compute(cr, uid, l['currency_id'], l['company_currency_id'], l['amount'], context=ctx)
|
||||
ctx.update({'date': voucher_date})
|
||||
else:
|
||||
amount_in_company_currency = l.get('amount_in_company_currency', 0.0)
|
||||
if not l.get('amount_in_voucher_currency'):
|
||||
amount_in_voucher_currency = currency_pool.compute(cr, uid, l['currency_id'], l['voucher_currency_id'], l['amount'], context=ctx)
|
||||
else:
|
||||
amount_in_voucher_currency = l.get('amount_in_voucher_currency', 0.0)
|
||||
real_amount += amount_in_company_currency
|
||||
counter_for_writeoff += l.get('voucher_currency_id') == l.get('currency_id') and l['amount'] or amount_in_voucher_currency
|
||||
counter_for_currency_diff += currency_pool.compute(cr, uid, l['currency_id'], l['company_currency_id'], l['amount'], context=ctx)
|
||||
sign = voucher_type in ['sale','receipt'] and 1 or -1
|
||||
writeoff_amount = (sign * amount) - counter_for_writeoff
|
||||
currency_rate_difference = real_amount - counter_for_currency_diff
|
||||
return writeoff_amount, currency_rate_difference
|
||||
credit += l['amount']
|
||||
return abs(amount - abs(credit - debit))
|
||||
|
||||
def onchange_line_ids(self, cr, uid, ids, line_dr_ids, line_cr_ids, amount, voucher_date, context=None):
|
||||
def onchange_line_ids(self, cr, uid, ids, line_dr_ids, line_cr_ids, amount, context=None):
|
||||
context = context or {}
|
||||
if not line_dr_ids and not line_cr_ids:
|
||||
return {'value':{}}
|
||||
line_osv = self.pool.get("account.voucher.line")
|
||||
line_dr_ids = resolve_o2m_operations(cr, uid, line_osv, line_dr_ids, ['amount'], context)
|
||||
line_cr_ids = resolve_o2m_operations(cr, uid, line_osv, line_cr_ids, ['amount'], context)
|
||||
writeoff_amount, currency_rate_diff = self._compute_writeoff_amount(cr, uid, line_dr_ids, line_cr_ids, amount, voucher_date, context=context)
|
||||
return {'value': {'writeoff_amount': writeoff_amount, 'currency_rate_difference': currency_rate_diff}}
|
||||
return {'value': {'writeoff_amount': self._compute_writeoff_amount(cr, uid, line_dr_ids, line_cr_ids, amount)}}
|
||||
|
||||
def _get_writeoff_amount(self, cr, uid, ids, name, args, context=None):
|
||||
if not ids: return {}
|
||||
if context is None:
|
||||
context = {}
|
||||
res = {}.fromkeys(ids,{})
|
||||
counter_for_writeoff = counter_for_currency_diff = real_amount = 0.0
|
||||
currency_pool = self.pool.get('res.currency')
|
||||
for voucher in self.browse(cr, uid, ids, context=context):
|
||||
ctx = context.copy()
|
||||
ctx.update({'date': voucher.date})
|
||||
for l in voucher.line_dr_ids:
|
||||
real_amount -= l.amount_in_company_currency
|
||||
counter_for_writeoff -= (l.voucher_currency_id.id == l.currency_id.id) and l.amount or l.amount_in_voucher_currency
|
||||
counter_for_currency_diff -= currency_pool.compute(cr, uid, l.currency_id.id, voucher.company_id.currency_id.id, l.amount, context=ctx)
|
||||
for l in voucher.line_cr_ids:
|
||||
real_amount += l.amount_in_company_currency
|
||||
counter_for_writeoff += (l.voucher_currency_id.id == l.currency_id.id) and l.amount or l.amount_in_voucher_currency
|
||||
counter_for_currency_diff += currency_pool.compute(cr, uid, l.currency_id.id, voucher.company_id.currency_id.id, l.amount, context=ctx)
|
||||
sign = voucher.type in ['sale','receipt'] and 1 or -1
|
||||
writeoff_amount = (sign * voucher.amount) - counter_for_writeoff
|
||||
res[voucher.id]['writeoff_amount'] = writeoff_amount
|
||||
res[voucher.id]['currency_rate_difference'] = real_amount - counter_for_currency_diff
|
||||
return res
|
||||
|
||||
def _currency_id(self, cr, uid, ids, name, args, context=None):
|
||||
res = {}
|
||||
debit = credit = 0.0
|
||||
for voucher in self.browse(cr, uid, ids, context=context):
|
||||
currency = voucher.journal_id.currency and voucher.journal_id.currency.id or voucher.company_id.currency_id.id
|
||||
res[voucher.id] = {'currency_id': currency, 'currency_id2': currency}
|
||||
for l in voucher.line_dr_ids:
|
||||
debit += l.amount
|
||||
for l in voucher.line_cr_ids:
|
||||
credit += l.amount
|
||||
res[voucher.id] = abs(voucher.amount - abs(credit - debit))
|
||||
return res
|
||||
|
||||
_name = 'account.voucher'
|
||||
_description = 'Accounting Voucher'
|
||||
_order = "date desc, id desc"
|
||||
# _rec_name = 'number'
|
||||
_columns = {
|
||||
'type':fields.selection([
|
||||
('sale','Sale'),
|
||||
|
@ -250,7 +195,7 @@ class account_voucher(osv.osv):
|
|||
],'Default Type', readonly=True, states={'draft':[('readonly',False)]}),
|
||||
'name':fields.char('Memo', size=256, readonly=True, states={'draft':[('readonly',False)]}),
|
||||
'date':fields.date('Date', readonly=True, select=True, states={'draft':[('readonly',False)]}, help="Effective date for accounting entries"),
|
||||
'journal_id':fields.many2one('account.journal', 'Journal', required=True, readonly=True, states={'draft':[('readonly',False)]}, change_default=1),
|
||||
'journal_id':fields.many2one('account.journal', 'Journal', required=True, readonly=True, states={'draft':[('readonly',False)]}),
|
||||
'account_id':fields.many2one('account.account', 'Account', required=True, readonly=True, states={'draft':[('readonly',False)]}),
|
||||
'line_ids':fields.one2many('account.voucher.line','voucher_id','Voucher Lines', readonly=True, states={'draft':[('readonly',False)]}),
|
||||
'line_cr_ids':fields.one2many('account.voucher.line','voucher_id','Credits',
|
||||
|
@ -259,11 +204,9 @@ class account_voucher(osv.osv):
|
|||
domain=[('type','=','dr')], context={'default_type':'dr'}, readonly=True, states={'draft':[('readonly',False)]}),
|
||||
'period_id': fields.many2one('account.period', 'Period', required=True, readonly=True, states={'draft':[('readonly',False)]}),
|
||||
'narration':fields.text('Notes', readonly=True, states={'draft':[('readonly',False)]}),
|
||||
'currency_id': fields.function(_currency_id, type='many2one', relation='res.currency', string='Currency', store=True, readonly=True, multi="currency"),
|
||||
#duplicated field for display purposes
|
||||
'currency_id2': fields.function(_currency_id, type='many2one', relation='res.currency', string='Currency', store=True, readonly=True, multi="currency"),
|
||||
'company_id': fields.related('journal_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True, readonly=True),
|
||||
'company_currency': fields.related('company_id','currency_id', type='many2one', relation='res.currency', string='Currency', readonly=True),
|
||||
# 'currency_id':fields.many2one('res.currency', 'Currency', required=True, readonly=True, states={'draft':[('readonly',False)]}),
|
||||
'currency_id': fields.related('journal_id','currency', type='many2one', relation='res.currency', string='Currency', readonly=True),
|
||||
'company_id': fields.many2one('res.company', 'Company', required=True, readonly=True, states={'draft':[('readonly',False)]}),
|
||||
'state':fields.selection(
|
||||
[('draft','Draft'),
|
||||
('proforma','Pro-forma'),
|
||||
|
@ -282,6 +225,7 @@ class account_voucher(osv.osv):
|
|||
'move_ids': fields.related('move_id','line_id', type='one2many', relation='account.move.line', string='Journal Items', readonly=True),
|
||||
'partner_id':fields.many2one('res.partner', 'Partner', change_default=1, readonly=True, states={'draft':[('readonly',False)]}),
|
||||
'audit': fields.related('move_id','to_check', type='boolean', help='Check this box if you are unsure of that journal entry and if you want to note it as \'to be reviewed\' by an accounting expert.', relation='account.move', string='To Review'),
|
||||
'paid': fields.function(_check_paid, string='Paid', type='boolean', help="The Voucher has been totally paid."),
|
||||
'pay_now':fields.selection([
|
||||
('pay_now','Pay Directly'),
|
||||
('pay_later','Pay Later or Group Funds'),
|
||||
|
@ -291,14 +235,13 @@ class account_voucher(osv.osv):
|
|||
'date_due': fields.date('Due Date', readonly=True, select=True, states={'draft':[('readonly',False)]}),
|
||||
'payment_option':fields.selection([
|
||||
('without_writeoff', 'Keep Open'),
|
||||
('with_writeoff', 'Reconcile'),
|
||||
('with_writeoff', 'Reconcile Payment Balance'),
|
||||
], 'Payment Difference', required=True, readonly=True, states={'draft': [('readonly', False)]}),
|
||||
'writeoff_acc_id': fields.many2one('account.account', 'Write-Off account', readonly=True, states={'draft': [('readonly', False)]}),
|
||||
'comment': fields.char('Write-Off Comment', size=64, required=True, readonly=True, states={'draft': [('readonly', False)]}),
|
||||
'exchange_acc_id': fields.many2one('account.account', 'Exchange Diff. Account', readonly=True, states={'draft': [('readonly', False)]}),
|
||||
'writeoff_acc_id': fields.many2one('account.account', 'Counterpart Account', readonly=True, states={'draft': [('readonly', False)]}),
|
||||
'comment': fields.char('Counterpart Comment', size=64, required=True, readonly=True, states={'draft': [('readonly', False)]}),
|
||||
'analytic_id': fields.many2one('account.analytic.account','Write-Off Analytic Account', readonly=True, states={'draft': [('readonly', False)]}),
|
||||
'writeoff_amount': fields.function(_get_writeoff_amount, string='Write-Off Amount', type='float', readonly=True, multi="writeoff"),
|
||||
'currency_rate_difference': fields.function(_get_writeoff_amount, string="Currency Rate Difference", type='float', multi="writeoff"),
|
||||
'paid': fields.function(_check_paid, string='Paid', type='boolean', help="The Voucher has been totally paid."),
|
||||
'writeoff_amount': fields.function(_get_writeoff_amount, string='Reconcile Amount', type='float', readonly=True),
|
||||
}
|
||||
_defaults = {
|
||||
'period_id': _get_period,
|
||||
|
@ -323,7 +266,7 @@ class account_voucher(osv.osv):
|
|||
tax_pool = self.pool.get('account.tax')
|
||||
partner_pool = self.pool.get('res.partner')
|
||||
position_pool = self.pool.get('account.fiscal.position')
|
||||
voucher_voucher_line_obj = self.pool.get('account.voucher.line')
|
||||
voucher_line_pool = self.pool.get('account.voucher.line')
|
||||
voucher_pool = self.pool.get('account.voucher')
|
||||
if context is None: context = {}
|
||||
|
||||
|
@ -332,7 +275,7 @@ class account_voucher(osv.osv):
|
|||
for line in voucher.line_ids:
|
||||
voucher_amount += line.untax_amount or line.amount
|
||||
line.amount = line.untax_amount or line.amount
|
||||
voucher_voucher_line_obj.write(cr, uid, [line.id], {'amount':line.amount, 'untax_amount':line.untax_amount})
|
||||
voucher_line_pool.write(cr, uid, [line.id], {'amount':line.amount, 'untax_amount':line.untax_amount})
|
||||
|
||||
if not voucher.tax_id:
|
||||
self.write(cr, uid, [voucher.id], {'amount':voucher_amount, 'tax_amount':0.0})
|
||||
|
@ -360,7 +303,7 @@ class account_voucher(osv.osv):
|
|||
line_total += tax_line.get('price_unit')
|
||||
total_tax += line_tax
|
||||
untax_amount = line.untax_amount or line.amount
|
||||
voucher_voucher_line_obj.write(cr, uid, [line.id], {'amount':line_total, 'untax_amount':untax_amount})
|
||||
voucher_line_pool.write(cr, uid, [line.id], {'amount':line_total, 'untax_amount':untax_amount})
|
||||
|
||||
self.write(cr, uid, [voucher.id], {'amount':total, 'tax_amount':total_tax})
|
||||
return True
|
||||
|
@ -370,14 +313,14 @@ class account_voucher(osv.osv):
|
|||
tax_pool = self.pool.get('account.tax')
|
||||
partner_pool = self.pool.get('res.partner')
|
||||
position_pool = self.pool.get('account.fiscal.position')
|
||||
voucher_line_obj = self.pool.get('account.voucher.line')
|
||||
line_pool = self.pool.get('account.voucher.line')
|
||||
res = {
|
||||
'tax_amount': False,
|
||||
'amount': False,
|
||||
}
|
||||
voucher_total = 0.0
|
||||
|
||||
line_ids = resolve_o2m_operations(cr, uid, voucher_line_obj, line_ids, ["amount"], context)
|
||||
line_ids = resolve_o2m_operations(cr, uid, line_pool, line_ids, ["amount"], context)
|
||||
|
||||
total = 0.0
|
||||
total_tax = 0.0
|
||||
|
@ -466,8 +409,8 @@ class account_voucher(osv.osv):
|
|||
|
||||
return default
|
||||
|
||||
def onchange_partner_id(self, cr, uid, ids, partner_id, journal_id, price, voucher_currency_id, ttype, date, context=None):
|
||||
"""price
|
||||
def onchange_partner_id(self, cr, uid, ids, partner_id, journal_id, price, currency_id, ttype, date, context=None):
|
||||
"""
|
||||
Returns a dict that contains new values and context
|
||||
|
||||
@param partner_id: latest value from user input for field partner_id
|
||||
|
@ -476,36 +419,43 @@ class account_voucher(osv.osv):
|
|||
|
||||
@return: Returns a dict which contains new values, and context
|
||||
"""
|
||||
if not journal_id:
|
||||
return {}
|
||||
if context is None:
|
||||
context = {}
|
||||
if not journal_id:
|
||||
return {}
|
||||
context_multi_currency = context.copy()
|
||||
if date:
|
||||
context_multi_currency.update({'date': date})
|
||||
|
||||
line_pool = self.pool.get('account.voucher.line')
|
||||
line_ids = ids and line_pool.search(cr, uid, [('voucher_id', '=', ids[0])]) or False
|
||||
if line_ids:
|
||||
line_pool.unlink(cr, uid, line_ids)
|
||||
|
||||
currency_pool = self.pool.get('res.currency')
|
||||
move_line_obj = self.pool.get('account.move.line')
|
||||
move_line_pool = self.pool.get('account.move.line')
|
||||
partner_pool = self.pool.get('res.partner')
|
||||
journal_pool = self.pool.get('account.journal')
|
||||
voucher_line_obj = self.pool.get('account.voucher.line')
|
||||
#get default values
|
||||
vals = self.onchange_journal(cr, uid, ids, journal_id, [], False, partner_id, context=context)
|
||||
vals = vals.get('value',{})
|
||||
voucher_currency_id = vals.get('currency_id', voucher_currency_id)
|
||||
default = {
|
||||
'value':{'line_ids':[], 'line_dr_ids':[], 'line_cr_ids':[], 'pre_line': False, 'currency_id': voucher_currency_id},
|
||||
}
|
||||
|
||||
#drop existing lines
|
||||
line_ids = ids and voucher_line_obj.search(cr, uid, [('voucher_id', 'in', ids)]) or []
|
||||
if line_ids:
|
||||
voucher_line_obj.unlink(cr, uid, line_ids, context=context)
|
||||
vals = self.onchange_journal(cr, uid, ids, journal_id, [], False, partner_id, context)
|
||||
vals = vals.get('value')
|
||||
|
||||
journal = journal_pool.browse(cr, uid, journal_id, context=context)
|
||||
currency_id = vals.get('currency_id', currency_id)
|
||||
default = {
|
||||
'value':{'line_ids':[], 'line_dr_ids':[], 'line_cr_ids':[], 'pre_line': False, 'currency_id':currency_id},
|
||||
}
|
||||
currency_id = currency_id or journal.company_id.currency_id.id
|
||||
|
||||
if not partner_id:
|
||||
return default
|
||||
|
||||
journal = journal_pool.browse(cr, uid, journal_id, context=context)
|
||||
if not partner_id and ids:
|
||||
line_ids = line_pool.search(cr, uid, [('voucher_id', '=', ids[0])])
|
||||
if line_ids:
|
||||
line_pool.unlink(cr, uid, line_ids)
|
||||
return default
|
||||
|
||||
partner = partner_pool.browse(cr, uid, partner_id, context=context)
|
||||
account_id = False
|
||||
if journal.type in ('sale','sale_refund'):
|
||||
|
@ -520,98 +470,78 @@ class account_voucher(osv.osv):
|
|||
if journal.type not in ('cash', 'bank'):
|
||||
return default
|
||||
|
||||
total_credit = 0.0
|
||||
total_debit = 0.0
|
||||
account_type = 'receivable'
|
||||
if ttype == 'payment':
|
||||
account_type = 'payable'
|
||||
total_debit = price or 0.0
|
||||
else:
|
||||
total_credit = price or 0.0
|
||||
account_type = 'receivable'
|
||||
|
||||
if not context.get('move_line_ids', False):
|
||||
ids = move_line_obj.search(cr, uid, [('state','=','valid'), ('account_id.type', '=', account_type), ('reconcile_id', '=', False), ('partner_id', '=', partner_id)], context=context)
|
||||
ids = move_line_pool.search(cr, uid, [('state','=','valid'), ('account_id.type', '=', account_type), ('reconcile_id', '=', False), ('partner_id', '=', partner_id)], context=context)
|
||||
else:
|
||||
ids = context['move_line_ids']
|
||||
|
||||
#computation of the assignation of voucher amount on voucher lines
|
||||
total_credit = account_type == 'receivable' and price or 0.0
|
||||
total_debit = account_type == 'payable' and price or 0.0
|
||||
moves = move_line_obj.browse(cr, uid, ids, context=context)
|
||||
company_currency = journal.company_id.currency_id.id
|
||||
invoice_id = context.get('invoice_id', False)
|
||||
move_line_found = False
|
||||
#order the lines by most old first
|
||||
ids.reverse()
|
||||
moves = move_line_pool.browse(cr, uid, ids, context=context)
|
||||
|
||||
#company_currency = journal.company_id.currency_id.id
|
||||
#if company_currency != currency_id and ttype == 'payment':
|
||||
# total_debit = currency_pool.compute(cr, uid, currency_id, company_currency, total_debit, context=context_multi_currency)
|
||||
#elif company_currency != currency_id and ttype == 'receipt':
|
||||
# total_credit = currency_pool.compute(cr, uid, currency_id, company_currency, total_credit, context=context_multi_currency)
|
||||
|
||||
company_currency = journal.company_id.currency_id.id
|
||||
for line in moves:
|
||||
if line.credit and line.reconcile_partial_id and ttype == 'receipt':
|
||||
continue
|
||||
if line.debit and line.reconcile_partial_id and ttype == 'payment':
|
||||
continue
|
||||
|
||||
if line.currency_id and currency_id==line.currency_id.id:
|
||||
total_credit += line.amount_currency <0 and -line.amount_currency or 0.0
|
||||
total_debit += line.amount_currency >0 and line.amount_currency or 0.0
|
||||
else:
|
||||
total_credit += currency_pool.compute(cr, uid, company_currency, currency_id, line.credit or 0.0)
|
||||
total_debit += currency_pool.compute(cr, uid, company_currency, currency_id, line.debit or 0.0)
|
||||
|
||||
for line in moves:
|
||||
if line.credit and line.reconcile_partial_id and ttype == 'receipt':
|
||||
continue
|
||||
if line.debit and line.reconcile_partial_id and ttype == 'payment':
|
||||
continue
|
||||
if invoice_id:
|
||||
if line.invoice.id == invoice_id:
|
||||
#if the invoice linked to the voucher line is equal to the invoice_id in context
|
||||
#then we assign the amount on that line, whatever the other voucher lines
|
||||
move_line_found = line.id
|
||||
break
|
||||
elif voucher_currency_id == company_currency:
|
||||
#otherwise treatments is the same but with other field names
|
||||
if line.amount_residual == price:
|
||||
#if the amount residual is equal the amount voucher, we assign it to that voucher
|
||||
#line, whatever the other voucher lines
|
||||
move_line_found = line.id
|
||||
break
|
||||
#otherwise we will split the voucher amount on each line (by most old first)
|
||||
total_credit += line.credit or 0.0
|
||||
total_debit += line.debit or 0.0
|
||||
elif voucher_currency_id == line.currency_id.id:
|
||||
if line.amount_residual_currency == price:
|
||||
move_line_found = line.id
|
||||
break
|
||||
total_credit += line.credit and line.amount_currency or 0.0
|
||||
total_debit += line.debit and line.amount_currency or 0.0
|
||||
|
||||
#voucher line creation
|
||||
for line in moves:
|
||||
if line.credit and line.reconcile_partial_id and ttype == 'receipt':
|
||||
continue
|
||||
if line.debit and line.reconcile_partial_id and ttype == 'payment':
|
||||
continue
|
||||
original_amount = line.credit or line.debit or 0.0
|
||||
amount_original, amount_unreconciled = voucher_line_obj._get_amounts(cr, uid, line, context=context)
|
||||
currency_id = line.currency_id and line.currency_id.id or line.company_id.currency_id.id
|
||||
if line.currency_id and currency_id==line.currency_id.id:
|
||||
amount_original = abs(line.amount_currency)
|
||||
amount_unreconciled = abs(line.amount_residual_currency)
|
||||
else:
|
||||
amount_original = currency_pool.compute(cr, uid, company_currency, currency_id, line.credit or line.debit or 0.0)
|
||||
amount_unreconciled = currency_pool.compute(cr, uid, company_currency, currency_id, abs(line.amount_residual))
|
||||
|
||||
#original_amount = line.credit or line.debit or 0.0
|
||||
#amount_unreconciled = currency_pool.compute(cr, uid, line.currency_id and line.currency_id.id or company_currency, currency_id, abs(line.amount_residual_currency), context=context_multi_currency)
|
||||
rs = {
|
||||
'name':line.move_id.name,
|
||||
'type': line.credit and 'dr' or 'cr',
|
||||
'move_line_id':line.id,
|
||||
'account_id':line.account_id.id,
|
||||
'amount_original': amount_original,
|
||||
'amount': (move_line_found == line.id) and min(price, amount_unreconciled) or 0.0,
|
||||
'currency_id': currency_id,
|
||||
'voucher_currency_id': voucher_currency_id,
|
||||
'date_original':line.date,
|
||||
'company_currency_id': line.company_id.currency_id.id,
|
||||
'date_due':line.date_maturity,
|
||||
'amount_unreconciled': amount_unreconciled,
|
||||
|
||||
}
|
||||
#split voucher amount by most old first
|
||||
if not move_line_found:
|
||||
if company_currency == voucher_currency_id:
|
||||
if line.credit:
|
||||
amount = min(amount_unreconciled, abs(total_debit))
|
||||
rs['amount'] = amount
|
||||
total_debit -= amount
|
||||
else:
|
||||
amount = min(amount_unreconciled, abs(total_credit))
|
||||
rs['amount'] = amount
|
||||
total_credit -= amount
|
||||
elif voucher_currency_id == line.currency_id.id:
|
||||
if line.credit:
|
||||
amount = min(amount_unreconciled, abs(total_debit))
|
||||
rs['amount'] = amount
|
||||
total_debit -= amount
|
||||
else:
|
||||
amount = min(amount_unreconciled, abs(total_credit))
|
||||
rs['amount'] = amount
|
||||
total_credit -= amount
|
||||
|
||||
if line.credit:
|
||||
amount = min(amount_unreconciled, total_debit)
|
||||
rs['amount'] = amount
|
||||
total_debit -= amount
|
||||
else:
|
||||
amount = min(amount_unreconciled, total_credit)
|
||||
rs['amount'] = amount
|
||||
total_credit -= amount
|
||||
|
||||
default['value']['line_ids'].append(rs)
|
||||
if rs['type'] == 'cr':
|
||||
|
@ -623,7 +553,7 @@ class account_voucher(osv.osv):
|
|||
default['value']['pre_line'] = 1
|
||||
elif ttype == 'receipt' and len(default['value']['line_dr_ids']) > 0:
|
||||
default['value']['pre_line'] = 1
|
||||
default['value']['writeoff_amount'], default['value']['currency_rate_difference'] = self._compute_writeoff_amount(cr, uid, default['value']['line_dr_ids'], default['value']['line_cr_ids'], price, date, context=context)
|
||||
default['value']['writeoff_amount'] = self._compute_writeoff_amount(cr, uid, default['value']['line_dr_ids'], default['value']['line_cr_ids'], price)
|
||||
return default
|
||||
|
||||
def onchange_date(self, cr, uid, ids, partner_id, journal_id, price, currency_id, ttype, date, context=None):
|
||||
|
@ -633,13 +563,9 @@ class account_voucher(osv.osv):
|
|||
@param context: context arguments, like lang, time zone
|
||||
@return: Returns a dict which contains new values, and context
|
||||
"""
|
||||
if context is None: context = {}
|
||||
period_pool = self.pool.get('account.period')
|
||||
res = self.onchange_partner_id(cr, uid, ids, partner_id, journal_id, price, currency_id, ttype, date, context=context)
|
||||
if context.get('invoice_id', False):
|
||||
company_id = self.pool.get('account.invoice').browse(cr, uid, context['invoice_id'], context=context).company_id.id
|
||||
context.update({'company_id': company_id})
|
||||
pids = period_pool.find(cr, uid, date, context=context)
|
||||
pids = period_pool.search(cr, uid, [('date_start', '<=', date), ('date_stop', '>=', date)])
|
||||
if pids:
|
||||
if not 'value' in res:
|
||||
res['value'] = {}
|
||||
|
@ -647,9 +573,8 @@ class account_voucher(osv.osv):
|
|||
return res
|
||||
|
||||
def onchange_journal(self, cr, uid, ids, journal_id, line_ids, tax_id, partner_id, context=None):
|
||||
if context is None: context = {}
|
||||
if not journal_id:
|
||||
return {}
|
||||
return False
|
||||
journal_pool = self.pool.get('account.journal')
|
||||
journal = journal_pool.browse(cr, uid, journal_id, context=context)
|
||||
account_id = journal.default_credit_account_id or journal.default_debit_account_id
|
||||
|
@ -659,14 +584,10 @@ class account_voucher(osv.osv):
|
|||
|
||||
vals = self.onchange_price(cr, uid, ids, line_ids, tax_id, partner_id, context)
|
||||
vals['value'].update({'tax_id':tax_id})
|
||||
currency_id = journal.company_id.currency_id.id
|
||||
currency_id = False #journal.company_id.currency_id.id
|
||||
if journal.currency:
|
||||
currency_id = journal.currency.id
|
||||
vals['value'].update({'currency_id':currency_id})
|
||||
context.update({'company_id': journal.company_id.id})
|
||||
periods = self.pool.get('account.period').find(cr, uid, context=context)
|
||||
if periods:
|
||||
vals['value'].update({'period_id':periods[0]})
|
||||
return vals
|
||||
|
||||
def proforma_voucher(self, cr, uid, ids, context=None):
|
||||
|
@ -707,9 +628,10 @@ class account_voucher(osv.osv):
|
|||
def unlink(self, cr, uid, ids, context=None):
|
||||
for t in self.read(cr, uid, ids, ['state'], context=context):
|
||||
if t['state'] not in ('draft', 'cancel'):
|
||||
raise osv.except_osv(_('Invalid action !'), _('In order to delete a voucher, you must cancel it!'))
|
||||
raise osv.except_osv(_('Invalid action !'), _('Cannot delete Voucher(s) which are already opened or paid !'))
|
||||
return super(account_voucher, self).unlink(cr, uid, ids, context=context)
|
||||
|
||||
# TODO: may be we can remove this method if not used anyware
|
||||
def onchange_payment(self, cr, uid, ids, pay_now, journal_id, partner_id, ttype='sale'):
|
||||
res = {}
|
||||
if not partner_id:
|
||||
|
@ -730,7 +652,6 @@ class account_voucher(osv.osv):
|
|||
return {'value':res}
|
||||
|
||||
def action_move_line_create(self, cr, uid, ids, context=None):
|
||||
|
||||
def _get_payment_term_lines(term_id, amount):
|
||||
term_pool = self.pool.get('account.payment.term')
|
||||
if term_id and amount:
|
||||
|
@ -740,44 +661,49 @@ class account_voucher(osv.osv):
|
|||
if context is None:
|
||||
context = {}
|
||||
move_pool = self.pool.get('account.move')
|
||||
move_line_obj = self.pool.get('account.move.line')
|
||||
move_line_pool = self.pool.get('account.move.line')
|
||||
currency_pool = self.pool.get('res.currency')
|
||||
tax_obj = self.pool.get('account.tax')
|
||||
seq_obj = self.pool.get('ir.sequence')
|
||||
for voucher in self.browse(cr, uid, ids, context=context):
|
||||
if voucher.move_id:
|
||||
for inv in self.browse(cr, uid, ids, context=context):
|
||||
if inv.move_id:
|
||||
continue
|
||||
context_multi_currency = context.copy()
|
||||
context_multi_currency.update({'date': voucher.date})
|
||||
context_multi_currency.update({'date': inv.date})
|
||||
|
||||
if voucher.number:
|
||||
name = voucher.number
|
||||
if inv.number:
|
||||
name = inv.number
|
||||
elif inv.journal_id.sequence_id:
|
||||
name = seq_obj.get_id(cr, uid, inv.journal_id.sequence_id.id)
|
||||
else:
|
||||
name = seq_obj.get_id(cr, uid, voucher.journal_id.sequence_id.id)
|
||||
if not voucher.reference:
|
||||
raise osv.except_osv(_('Error !'), _('Please define a sequence on the journal !'))
|
||||
if not inv.reference:
|
||||
ref = name.replace('/','')
|
||||
else:
|
||||
ref = voucher.reference
|
||||
ref = inv.reference
|
||||
|
||||
move = {
|
||||
'name': name,
|
||||
'journal_id': voucher.journal_id.id,
|
||||
'narration': voucher.narration,
|
||||
'date': voucher.date,
|
||||
'journal_id': inv.journal_id.id,
|
||||
'narration': inv.narration,
|
||||
'date': inv.date,
|
||||
'ref': ref,
|
||||
'period_id': voucher.period_id and voucher.period_id.id or False
|
||||
'period_id': inv.period_id and inv.period_id.id or False
|
||||
}
|
||||
move_id = move_pool.create(cr, uid, move)
|
||||
|
||||
#create the first line manually
|
||||
company_currency = voucher.journal_id.company_id.currency_id.id
|
||||
voucher_currency = voucher.currency_id.id
|
||||
company_currency = inv.journal_id.company_id.currency_id.id
|
||||
current_currency = inv.currency_id.id or company_currency
|
||||
current_currency_obj = inv.currency_id or inv.journal_id.company_id.currency_id
|
||||
debit = 0.0
|
||||
credit = 0.0
|
||||
if voucher.type in ('purchase', 'payment'):
|
||||
credit = currency_pool.compute(cr, uid, voucher_currency, company_currency, voucher.amount, context=context_multi_currency)
|
||||
elif voucher.type in ('sale', 'receipt'):
|
||||
debit = currency_pool.compute(cr, uid, voucher_currency, company_currency, voucher.amount, context=context_multi_currency)
|
||||
# TODO: is there any other alternative then the voucher type ??
|
||||
# -for sale, purchase we have but for the payment and receipt we do not have as based on the bank/cash journal we can not know its payment or receipt
|
||||
if inv.type in ('purchase', 'payment'):
|
||||
credit = currency_pool.compute(cr, uid, current_currency, company_currency, inv.amount, context=context_multi_currency)
|
||||
elif inv.type in ('sale', 'receipt'):
|
||||
debit = currency_pool.compute(cr, uid, current_currency, company_currency, inv.amount, context=context_multi_currency)
|
||||
if debit < 0:
|
||||
credit = -debit
|
||||
debit = 0.0
|
||||
|
@ -785,71 +711,53 @@ class account_voucher(osv.osv):
|
|||
debit = -credit
|
||||
credit = 0.0
|
||||
sign = debit - credit < 0 and -1 or 1
|
||||
#create the first line of the voucher
|
||||
#create the first line of the voucher, the payment made
|
||||
move_line = {
|
||||
'name': voucher.name or '/',
|
||||
'name': inv.name or '/',
|
||||
'debit': debit,
|
||||
'credit': credit,
|
||||
'account_id': voucher.account_id.id,
|
||||
'account_id': inv.account_id.id,
|
||||
'move_id': move_id,
|
||||
'journal_id': voucher.journal_id.id,
|
||||
'period_id': voucher.period_id.id,
|
||||
'partner_id': voucher.partner_id.id,
|
||||
'currency_id': company_currency <> voucher_currency and voucher_currency or False,
|
||||
'amount_currency': company_currency <> voucher_currency and sign * voucher.amount or 0.0,
|
||||
'date': voucher.date,
|
||||
'date_maturity': voucher.date_due
|
||||
'journal_id': inv.journal_id.id,
|
||||
'period_id': inv.period_id.id,
|
||||
'partner_id': inv.partner_id.id,
|
||||
'currency_id': company_currency <> current_currency and current_currency or False,
|
||||
'amount_currency': company_currency <> current_currency and sign * inv.amount or 0.0,
|
||||
'date': inv.date,
|
||||
'date_maturity': inv.date_due
|
||||
}
|
||||
move_line_obj.create(cr, uid, move_line)
|
||||
|
||||
#create the move line for the currency difference
|
||||
if voucher.currency_rate_difference:
|
||||
if voucher.currency_rate_difference > 0:
|
||||
account_id = voucher.company_id.property_expense_currency_exchange
|
||||
if not account_id:
|
||||
raise osv.except_osv(_('Warning'),_("Unable to create accounting entry for currency rate difference. You have to configure the field 'Expense Currency Rate' on the company! "))
|
||||
else:
|
||||
account_id = voucher.company_id.property_income_currency_exchange
|
||||
if not account_id:
|
||||
raise osv.except_osv(_('Warning'),_("Unable to create accounting entry for currency rate difference. You have to configure the field 'Income Currency Rate' on the company! "))
|
||||
|
||||
currency_diff_line = {
|
||||
'name': _('Currency Difference'),
|
||||
'debit': voucher.currency_rate_difference > 0 and voucher.currency_rate_difference or 0.0,
|
||||
'credit': voucher.currency_rate_difference < 0 and -voucher.currency_rate_difference or 0.0,
|
||||
'account_id': account_id.id,
|
||||
'move_id': move_id,
|
||||
'journal_id': voucher.journal_id.id,
|
||||
'period_id': voucher.period_id.id,
|
||||
'partner_id': voucher.partner_id.id,
|
||||
'date': voucher.date,
|
||||
'date_maturity': voucher.date_due
|
||||
}
|
||||
move_line_obj.create(cr, uid, currency_diff_line, context=context)
|
||||
|
||||
move_line_pool.create(cr, uid, move_line)
|
||||
rec_list_ids = []
|
||||
for line in voucher.line_ids:
|
||||
line_total = debit - credit
|
||||
if inv.type == 'sale':
|
||||
line_total = line_total - currency_pool.compute(cr, uid, current_currency, company_currency, inv.tax_amount, context=context_multi_currency)
|
||||
elif inv.type == 'purchase':
|
||||
line_total = line_total + currency_pool.compute(cr, uid, current_currency, company_currency, inv.tax_amount, context=context_multi_currency)
|
||||
|
||||
for line in inv.line_ids:
|
||||
#create one move line per voucher line where amount is not 0.0
|
||||
if not line.amount:
|
||||
continue
|
||||
#we check if the voucher line is fully paid or not and create a move line to balance the payment and initial invoice if needed
|
||||
if line.amount == line.amount_unreconciled:
|
||||
amount = line.move_line_id.amount_residual #residual amount in company currency
|
||||
amount = currency_pool.compute(cr, uid, current_currency, company_currency, line.untax_amount or line.amount, context=context_multi_currency)
|
||||
amount_residual = line.move_line_id.amount_residual - amount #residual amount in company currency
|
||||
else:
|
||||
amount = line.amount_in_company_currency
|
||||
amount = currency_pool.compute(cr, uid, current_currency, company_currency, line.untax_amount or line.amount, context=context_multi_currency)
|
||||
amount_residual = 0.0
|
||||
move_line = {
|
||||
'journal_id': voucher.journal_id.id,
|
||||
'period_id': voucher.period_id.id,
|
||||
'journal_id': inv.journal_id.id,
|
||||
'period_id': inv.period_id.id,
|
||||
'name': line.name or '/',
|
||||
'account_id': line.account_id.id,
|
||||
'move_id': move_id,
|
||||
'partner_id': voucher.partner_id.id,
|
||||
'currency_id': company_currency <> line.currency_id.id and line.currency_id.id or False,
|
||||
'partner_id': inv.partner_id.id,
|
||||
'currency_id': company_currency <> current_currency and current_currency or False,
|
||||
'analytic_account_id': line.account_analytic_id and line.account_analytic_id.id or False,
|
||||
'quantity': 1,
|
||||
'credit': 0.0,
|
||||
'debit': 0.0,
|
||||
'date': voucher.date
|
||||
'date': inv.date
|
||||
}
|
||||
if amount < 0:
|
||||
amount = -amount
|
||||
|
@ -858,68 +766,97 @@ class account_voucher(osv.osv):
|
|||
else:
|
||||
line.type = 'dr'
|
||||
if (line.type=='dr'):
|
||||
line_total += amount
|
||||
move_line['debit'] = amount
|
||||
else:
|
||||
line_total -= amount
|
||||
move_line['credit'] = amount
|
||||
|
||||
if voucher.tax_id and voucher.type in ('sale', 'purchase'):
|
||||
if inv.tax_id and inv.type in ('sale', 'purchase'):
|
||||
move_line.update({
|
||||
'account_tax_id': voucher.tax_id.id,
|
||||
'account_tax_id': inv.tax_id.id,
|
||||
})
|
||||
if move_line.get('account_tax_id', False):
|
||||
tax_data = tax_obj.browse(cr, uid, [move_line['account_tax_id']], context=context)[0]
|
||||
if not (tax_data.base_code_id and tax_data.tax_code_id):
|
||||
raise osv.except_osv(_('No Account Base Code and Account Tax Code!'),_("You have to configure account base code and account tax code on the '%s' tax!") % (tax_data.name))
|
||||
sign = (move_line['debit'] - move_line['credit']) < 0 and -1 or 1
|
||||
move_line['amount_currency'] = company_currency <> line.currency_id.id and sign * line.amount or 0.0
|
||||
voucher_line = move_line_obj.create(cr, uid, move_line)
|
||||
move_line['amount_currency'] = company_currency <> current_currency and sign * line.amount or 0.0
|
||||
voucher_line = move_line_pool.create(cr, uid, move_line)
|
||||
rec_ids = [voucher_line, line.move_line_id.id]
|
||||
|
||||
# Change difference entry
|
||||
if amount_residual:
|
||||
if not inv.exchange_acc_id.id:
|
||||
raise osv.except_osv(_('Error!'), _('You must provide an account for the exchange difference.'))
|
||||
move_line = {
|
||||
'journal_id': inv.journal_id.id,
|
||||
'period_id': inv.period_id.id,
|
||||
'name': _('change')+': '+(line.name or '/'),
|
||||
'account_id': line.account_id.id,
|
||||
'move_id': move_id,
|
||||
'partner_id': inv.partner_id.id,
|
||||
'currency_id': company_currency <> current_currency and current_currency or False,
|
||||
'amount_currency': 0.0,
|
||||
'quantity': 1,
|
||||
'credit': amount_residual > 0 and amount_residual or 0.0,
|
||||
'debit': amount_residual < 0 and -amount_residual or 0.0,
|
||||
'date': inv.date
|
||||
}
|
||||
new_id = move_line_pool.create(cr, uid, move_line)
|
||||
move_line = {
|
||||
'journal_id': inv.journal_id.id,
|
||||
'period_id': inv.period_id.id,
|
||||
'name': _('change')+': '+(line.name or '/'),
|
||||
'account_id': inv.exchange_acc_id.id,
|
||||
'move_id': move_id,
|
||||
'amount_currency': 0.0,
|
||||
'partner_id': inv.partner_id.id,
|
||||
'currency_id': company_currency <> current_currency and current_currency or False,
|
||||
'quantity': 1,
|
||||
'debit': amount_residual > 0 and amount_residual or 0.0,
|
||||
'credit': amount_residual < 0 and -amount_residual or 0.0,
|
||||
'date': inv.date
|
||||
}
|
||||
move_line_pool.create(cr, uid, move_line)
|
||||
rec_ids.append(new_id)
|
||||
|
||||
if line.move_line_id.id:
|
||||
rec_ids = [voucher_line, line.move_line_id.id]
|
||||
rec_list_ids.append(rec_ids)
|
||||
|
||||
if not currency_pool.is_zero(cr, uid, voucher.currency_id, voucher.writeoff_amount):
|
||||
#create one line for the write off if needed
|
||||
diff = currency_pool.compute(cr, uid, voucher_currency, company_currency, voucher.writeoff_amount, context=context_multi_currency)
|
||||
if not currency_pool.is_zero(cr, uid, current_currency_obj, line_total):
|
||||
diff = line_total
|
||||
account_id = False
|
||||
write_off_name = ''
|
||||
|
||||
if voucher.payment_option == 'with_writeoff':
|
||||
account_id = voucher.writeoff_acc_id.id
|
||||
write_off_name = voucher.comment
|
||||
elif voucher.type in ('sale', 'receipt'):
|
||||
if not voucher.partner_id:
|
||||
account_id = property_obj.search(cr,uid,[('name','=','property_account_receivable'),('res_id','=',False)])
|
||||
else:
|
||||
account_id = voucher.partner_id.property_account_receivable.id
|
||||
if inv.payment_option == 'with_writeoff':
|
||||
account_id = inv.writeoff_acc_id.id
|
||||
write_off_name = inv.comment
|
||||
elif inv.type in ('sale', 'receipt'):
|
||||
account_id = inv.partner_id.property_account_receivable.id
|
||||
else:
|
||||
if not voucher.partner_id:
|
||||
account_id = property_obj.search(cr,uid,[('name','=','property_account_payable'),('res_id','=',False)])
|
||||
else:
|
||||
account_id = voucher.partner_id.property_account_payable.id
|
||||
if not account_id:
|
||||
raise osv.except_osv(_('Error !'), _('No receivable/payable account defined in properties!'))
|
||||
account_id = inv.partner_id.property_account_payable.id
|
||||
move_line = {
|
||||
'name': write_off_name or name,
|
||||
'account_id': account_id,
|
||||
'move_id': move_id,
|
||||
'partner_id': voucher.partner_id.id,
|
||||
'date': voucher.date,
|
||||
'debit': diff < 0 and -diff or 0.0,
|
||||
'partner_id': inv.partner_id.id,
|
||||
'date': inv.date,
|
||||
'credit': diff > 0 and diff or 0.0,
|
||||
'amount_currency': company_currency <> voucher_currency and -voucher.writeoff_amount or 0.0,
|
||||
'currency_id': company_currency <> voucher_currency and voucher_currency or False,
|
||||
'debit': diff < 0 and -diff or 0.0,
|
||||
#'amount_currency': company_currency <> current_currency and currency_pool.compute(cr, uid, company_currency, current_currency, diff * -1, context=context_multi_currency) or 0.0,
|
||||
#'currency_id': company_currency <> current_currency and current_currency or False,
|
||||
}
|
||||
move_line_obj.create(cr, uid, move_line)
|
||||
self.write(cr, uid, [voucher.id], {
|
||||
move_line_pool.create(cr, uid, move_line)
|
||||
self.write(cr, uid, [inv.id], {
|
||||
'move_id': move_id,
|
||||
'state': 'posted',
|
||||
'number': name,
|
||||
})
|
||||
if voucher.journal_id.entry_posted:
|
||||
if inv.journal_id.entry_posted:
|
||||
move_pool.post(cr, uid, [move_id], context={})
|
||||
for rec_ids in rec_list_ids:
|
||||
if len(rec_ids) >= 2:
|
||||
move_line_obj.reconcile_partial(cr, uid, rec_ids)
|
||||
move_line_pool.reconcile_partial(cr, uid, rec_ids, writeoff_acc_id=inv.exchange_acc_id.id, writeoff_period_id=inv.period_id.id, writeoff_journal_id=inv.journal_id.id)
|
||||
return True
|
||||
|
||||
def copy(self, cr, uid, id, default={}, context=None):
|
||||
|
@ -942,86 +879,45 @@ class account_voucher_line(osv.osv):
|
|||
_description = 'Voucher Lines'
|
||||
_order = "move_line_id"
|
||||
|
||||
def _currency_id(self, cr, uid, ids, name, args, context=None):
|
||||
res = {}
|
||||
for line in self.browse(cr, uid, ids, context=context):
|
||||
move_line = line.move_line_id
|
||||
if move_line:
|
||||
res[line.id] = move_line.currency_id and move_line.currency_id.id or move_line.company_id.currency_id.id
|
||||
else:
|
||||
res[line.id] = line.voucher_id.currency_id.id
|
||||
return res
|
||||
|
||||
def _get_amounts(self, cr, uid, line_browse_rec, context=None):
|
||||
if line_browse_rec.currency_id:
|
||||
amount_original = line_browse_rec.amount_currency or 0.0
|
||||
amount_unreconciled = line_browse_rec.amount_residual_currency
|
||||
elif line_browse_rec.credit > 0:
|
||||
amount_original = line_browse_rec.credit or 0.0
|
||||
amount_unreconciled = line_browse_rec.amount_residual
|
||||
else:
|
||||
amount_original = line_browse_rec.debit or 0.0
|
||||
amount_unreconciled = line_browse_rec.amount_residual
|
||||
return amount_original, amount_unreconciled
|
||||
|
||||
# If the payment is in the same currency than the invoice, we keep the same amount
|
||||
# Otherwise, we compute from company currency to payment currency
|
||||
def _compute_balance(self, cr, uid, ids, name, args, context=None):
|
||||
currency_pool = self.pool.get('res.currency')
|
||||
res = {}
|
||||
rs_data = {}
|
||||
for line in self.browse(cr, uid, ids, context=context):
|
||||
amount_original, amount_unreconciled = self._get_amounts(cr, uid, line.move_line_id, context)
|
||||
res[line.id] = {
|
||||
'amount_original': amount_original,
|
||||
'amount_unreconciled': amount_unreconciled,
|
||||
}
|
||||
ctx = context.copy()
|
||||
ctx.update({'date': line.voucher_id.date})
|
||||
res = {}
|
||||
company_currency = line.voucher_id.journal_id.company_id.currency_id.id
|
||||
voucher_currency = line.voucher_id.currency_id and line.voucher_id.currency_id.id or company_currency
|
||||
move_line = line.move_line_id or False
|
||||
|
||||
return res
|
||||
if not move_line:
|
||||
res['amount_original'] = 0.0
|
||||
res['amount_unreconciled'] = 0.0
|
||||
elif move_line.currency_id and voucher_currency==move_line.currency_id.id:
|
||||
res['amount_original'] = currency_pool.compute(cr, uid, move_line.currency_id.id, voucher_currency, abs(move_line.amount_currency), context=ctx)
|
||||
res['amount_unreconciled'] = currency_pool.compute(cr, uid, move_line.currency_id and move_line.currency_id.id or company_currency, voucher_currency, abs(move_line.amount_residual_currency), context=ctx)
|
||||
elif move_line and move_line.credit > 0:
|
||||
res['amount_original'] = currency_pool.compute(cr, uid, company_currency, voucher_currency, move_line.credit, context=ctx)
|
||||
res['amount_unreconciled'] = currency_pool.compute(cr, uid, company_currency, voucher_currency, abs(move_line.amount_residual), context=ctx)
|
||||
else:
|
||||
res['amount_original'] = currency_pool.compute(cr, uid, company_currency, voucher_currency, move_line.debit, context=ctx)
|
||||
res['amount_unreconciled'] = currency_pool.compute(cr, uid, company_currency, voucher_currency, abs(move_line.amount_residual), context=ctx)
|
||||
|
||||
def __company_currency_amount(self, cr, uid, line, amount, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
ctx = context.copy()
|
||||
ctx.update({'date': line.date_original})
|
||||
currency_pool = self.pool.get('res.currency')
|
||||
amount_company_cur = currency_pool.compute(cr, uid, line.currency_id.id, line.company_currency_id.id, amount, context=ctx)
|
||||
ctx.update({'date': line.voucher_id.date})
|
||||
amount_voucher_cur = currency_pool.compute(cr, uid, line.currency_id.id, line.voucher_currency_id.id, amount, context=ctx)
|
||||
return amount_company_cur, amount_voucher_cur
|
||||
|
||||
def onchange_amount(self, cr, uid, ids, amount, context=None):
|
||||
if not amount or not ids:
|
||||
return {'value':{'amount_in_company_currency': 0.0, 'amount_in_voucher_currency': 0.0}}
|
||||
for line in self.browse(cr, uid, ids, context=context):
|
||||
amount_company_cur, amount_voucher_cur = self.__company_currency_amount(cr, uid, line, amount, context=context)
|
||||
return {'value': {'amount_in_company_currency': amount_company_cur, 'amount_in_voucher_currency': amount_voucher_cur}}
|
||||
|
||||
def _get_amount_in_company_currency(self, cr, uid, ids, name, args, context=None):
|
||||
res = {}
|
||||
for line in self.browse(cr, uid, ids, context=context):
|
||||
amount_in_company_currency, amount_in_voucher_currency = self.__company_currency_amount(cr, uid, line, line.amount, context=context)
|
||||
res[line.id] = {
|
||||
'amount_in_company_currency': amount_in_company_currency,
|
||||
'amount_in_voucher_currency': amount_in_voucher_currency,
|
||||
}
|
||||
return res
|
||||
rs_data[line.id] = res
|
||||
return rs_data
|
||||
|
||||
_columns = {
|
||||
'voucher_id':fields.many2one('account.voucher', 'Voucher', required=1, ondelete='cascade'),
|
||||
'move_line_id': fields.many2one('account.move.line', 'Journal Item'),
|
||||
'type':fields.selection([('dr','Debit'),('cr','Credit')], 'Dr/Cr'),
|
||||
'name':fields.char('Description', size=256),
|
||||
'account_id':fields.many2one('account.account','Account', required=True),
|
||||
'account_analytic_id': fields.many2one('account.analytic.account', 'Analytic Account'),
|
||||
'partner_id':fields.related('voucher_id', 'partner_id', type='many2one', relation='res.partner', string='Partner'),
|
||||
'untax_amount':fields.float('Untax Amount'),
|
||||
|
||||
'currency_id': fields.function(_currency_id, string='Currency', type='many2one', relation='res.currency'),
|
||||
'company_currency_id': fields.related('move_line_id','company_id','currency_id', type='many2one', relation='res.currency', string="Company Currency"),
|
||||
'voucher_currency_id': fields.related('voucher_id', 'currency_id', type='many2one', relation='res.currency', string="Voucher Currency"),
|
||||
|
||||
'amount':fields.float('Amount', digits_compute=dp.get_precision('Account')),
|
||||
'amount_in_company_currency': fields.function(_get_amount_in_company_currency, string='Amount in Company Currency', type='float', digits_compute=dp.get_precision('Account'), multi="voucher_line_amount"),
|
||||
'amount_in_voucher_currency': fields.function(_get_amount_in_company_currency, string='Amount in Voucher Currency', type='float', digits_compute=dp.get_precision('Account'), multi="voucher_line_amount"),
|
||||
|
||||
'type':fields.selection([('dr','Debit'),('cr','Credit')], 'Dr/Cr'),
|
||||
'account_analytic_id': fields.many2one('account.analytic.account', 'Analytic Account'),
|
||||
'move_line_id': fields.many2one('account.move.line', 'Journal Item'),
|
||||
'date_original': fields.related('move_line_id','date', type='date', relation='account.move.line', string='Date', readonly=1),
|
||||
'date_due': fields.related('move_line_id','date_maturity', type='date', relation='account.move.line', string='Due Date', readonly=1),
|
||||
'amount_original': fields.function(_compute_balance, multi='dc', type='float', string='Original Amount', store=True),
|
||||
|
@ -1043,9 +939,9 @@ class account_voucher_line(osv.osv):
|
|||
@return: Returns a dict which contains new values, and context
|
||||
"""
|
||||
res = {}
|
||||
move_line_obj = self.pool.get('account.move.line')
|
||||
move_line_pool = self.pool.get('account.move.line')
|
||||
if move_line_id:
|
||||
move_line = move_line_obj.browse(cr, user, move_line_id, context=context)
|
||||
move_line = move_line_pool.browse(cr, user, move_line_id, context=context)
|
||||
if move_line.credit:
|
||||
ttype = 'dr'
|
||||
else:
|
||||
|
@ -1120,7 +1016,7 @@ class account_bank_statement(osv.osv):
|
|||
bank_st_line_obj = self.pool.get('account.bank.statement.line')
|
||||
st_line = bank_st_line_obj.browse(cr, uid, st_line_id, context=context)
|
||||
if st_line.voucher_id:
|
||||
voucher_obj.write(cr, uid, [st_line.voucher_id.id], {'number': next_number, 'date': st_line.date}, context=context)
|
||||
voucher_obj.write(cr, uid, [st_line.voucher_id.id], {'number': next_number}, context=context)
|
||||
if st_line.voucher_id.state == 'cancel':
|
||||
voucher_obj.action_cancel_draft(cr, uid, [st_line.voucher_id.id], context=context)
|
||||
wf_service.trg_validate(uid, 'account.voucher', st_line.voucher_id.id, 'proforma_voucher', cr)
|
||||
|
@ -1130,7 +1026,7 @@ class account_bank_statement(osv.osv):
|
|||
'move_ids': [(4, v.move_id.id, False)]
|
||||
})
|
||||
|
||||
return move_line_obj.write(cr, uid, [x.id for x in v.move_ids], {'statement_id': st_line.statement_id.id, 'date': st_line.date}, update_check=False, context=context)
|
||||
return move_line_obj.write(cr, uid, [x.id for x in v.move_ids], {'statement_id': st_line.statement_id.id}, context=context)
|
||||
return super(account_bank_statement, self).create_move_from_st_line(cr, uid, st_line.id, company_currency_id, next_number, context=context)
|
||||
|
||||
account_bank_statement()
|
||||
|
|
|
@ -1,28 +1,27 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record id="view_invoice_customer" model="ir.ui.view">
|
||||
<field name="name">account.invoice.customer.pay</field>
|
||||
<field name="model">account.invoice</field>
|
||||
<field name="type">form</field>
|
||||
<field name="inherit_id" ref="account.invoice_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<button name="invoice_open" position="after">
|
||||
<button name="invoice_pay_customer" type="object" string="Payment" states="open" icon="gtk-go-forward"/>
|
||||
</button>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_invoice_supplier" model="ir.ui.view">
|
||||
<field name="name">account.invoice.supplier.pay</field>
|
||||
<field name="model">account.invoice</field>
|
||||
<field name="type">form</field>
|
||||
<field name="inherit_id" ref="account.invoice_supplier_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<button name="invoice_open" position="after">
|
||||
<button name="invoice_pay_customer" type="object" string="Pay Invoice" states="open" icon="gtk-go-forward"/>
|
||||
</button>
|
||||
</field>
|
||||
</record>
|
||||
<record id="view_invoice_customer" model="ir.ui.view">
|
||||
<field name="name">account.invoice.customer.pay</field>
|
||||
<field name="model">account.invoice</field>
|
||||
<field name="type">form</field>
|
||||
<field name="inherit_id" ref="account.invoice_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<button name="invoice_open" position="after">
|
||||
<button name="invoice_pay_customer" type="object" string="Payment" states="open" icon="gtk-go-forward"/>
|
||||
</button>
|
||||
</field>
|
||||
</record>
|
||||
<record id="view_invoice_supplier" model="ir.ui.view">
|
||||
<field name="name">account.invoice.supplier.pay</field>
|
||||
<field name="model">account.invoice</field>
|
||||
<field name="type">form</field>
|
||||
<field name="inherit_id" ref="account.invoice_supplier_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<button name="invoice_open" position="after">
|
||||
<button name="invoice_pay_customer" type="object" string="Pay Invoice" states="open" icon="gtk-go-forward"/>
|
||||
</button>
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
<form string="Accounting Voucher">
|
||||
<group col="6" colspan="4">
|
||||
<field name="partner_id" required="1" on_change="onchange_journal_voucher(line_ids, tax_id, amount, partner_id, journal_id, type)"/>
|
||||
<field name="date" on_change="onchange_date(partner_id, journal_id, amount, currency_id, type, date, context)"/>
|
||||
<field name="date" on_change="onchange_date(partner_id, journal_id, amount, currency_id, type, date)"/>
|
||||
<field name="journal_id" widget="selection" select="1" on_change="onchange_journal_voucher(line_ids, tax_id, amount, partner_id, journal_id, type)"/>
|
||||
<field name="type" required="1"/>
|
||||
<field name="name" colspan="2"/>
|
||||
|
@ -102,7 +102,7 @@
|
|||
</page>
|
||||
</notebook>
|
||||
<group col="10" colspan="4">
|
||||
<field name="state"/>
|
||||
<field name="state" widget="statusbar" statusbar_visible="draft,posted" statusbar_colors='{"proforma":"blue"}'/>
|
||||
<button name="cancel_voucher" string="Cancel" states="draft,proforma" icon="gtk-cancel"/>
|
||||
<button name="cancel_voucher" string="Cancel" type="object" states="posted" icon="terp-stock_effects-object-colorize" confirm="Are you sure to unreconcile this record ?"/>
|
||||
<button name="proforma_voucher" string="Post" states="draft" icon="terp-camera_test"/>
|
||||
|
|
|
@ -1,45 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import fields, osv
|
||||
|
||||
class res_company(osv.osv):
|
||||
_inherit = "res.company"
|
||||
_columns = {
|
||||
'property_income_currency_exchange': fields.property(
|
||||
'account.account',
|
||||
type='many2one',
|
||||
relation='account.account',
|
||||
string="Income Currency Rate",
|
||||
view_load=True,
|
||||
domain="[('type', '=', 'other')]",),
|
||||
'property_expense_currency_exchange': fields.property(
|
||||
'account.account',
|
||||
type='many2one',
|
||||
relation='account.account',
|
||||
string="Expense Currency Rate",
|
||||
view_load=True,
|
||||
domain="[('type', '=', 'other')]",),
|
||||
}
|
||||
|
||||
res_company()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -1,18 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record model="ir.ui.view" id="view_company_inherit_currency_xchange_form">
|
||||
<field name="name">res.company.form.inherit</field>
|
||||
<field name="inherit_id" ref="base.view_company_form"/>
|
||||
<field name="model">res.company</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<field name="currency_id" position="after">
|
||||
<field name="property_income_currency_exchange" colspan="2"/>
|
||||
<field name="property_expense_currency_exchange" colspan="2"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
|
@ -45,11 +45,10 @@ class invoice(osv.osv):
|
|||
'close_after_process': True,
|
||||
'invoice_type':inv.type,
|
||||
'invoice_id':inv.id,
|
||||
'default_type': inv.type in ('out_invoice','out_refund') and 'receipt' or 'payment',
|
||||
'type': inv.type in ('out_invoice','out_refund') and 'receipt' or 'payment'
|
||||
'default_type': inv.type in ('out_invoice','out_refund') and 'receipt' or 'payment'
|
||||
}
|
||||
}
|
||||
|
||||
invoice()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -73,7 +73,7 @@ class sale_receipt_report(osv.osv):
|
|||
to_char(av.date, 'MM') as month,
|
||||
to_char(av.date, 'YYYY-MM-DD') as day,
|
||||
av.partner_id as partner_id,
|
||||
av.currency_id as currency_id,
|
||||
aj.currency as currency_id,
|
||||
av.journal_id as journal_id,
|
||||
rp.user_id as user_id,
|
||||
av.company_id as company_id,
|
||||
|
@ -111,7 +111,7 @@ class sale_receipt_report(osv.osv):
|
|||
to_char(av.date, 'MM'),
|
||||
to_char(av.date, 'YYYY-MM-DD'),
|
||||
av.partner_id,
|
||||
av.currency_id,
|
||||
aj.currency,
|
||||
av.journal_id,
|
||||
rp.user_id,
|
||||
av.company_id,
|
||||
|
|
|
@ -1,355 +0,0 @@
|
|||
-
|
||||
In order to check the Account_voucher module with multi-currency in OpenERP,
|
||||
I create 2 Invoices in USD and make 2 Payments in USD based on the currency rating on that particular date
|
||||
-
|
||||
I create currency USD in OpenERP for January of 1.333333 Rate
|
||||
-
|
||||
!python {model: res.currency.rate}: |
|
||||
from datetime import datetime
|
||||
curr_id = self.pool.get('res.currency').search(cr, uid, [('name', '=', 'USD')])
|
||||
date = '%s-01-01' %(datetime.now().year)
|
||||
ids = self.search(cr, uid, [('currency_id','=',curr_id), ('name', '=', date)])
|
||||
self.write(cr, uid, ids, {'rate': 1.333333})
|
||||
-
|
||||
I create currency USD in OpenERP for February of 1.250000 Rate
|
||||
-
|
||||
!record {model: res.currency.rate, id: feb_usd}:
|
||||
currency_id: base.USD
|
||||
name: !eval "'%s-02-01' %(datetime.now().year)"
|
||||
rate: 1.250000
|
||||
|
||||
-
|
||||
I create currency USD in OpenERP for March of 1.111111 Rate
|
||||
-
|
||||
!record {model: res.currency.rate, id: mar_usd}:
|
||||
currency_id: base.USD
|
||||
name: !eval "'%s-03-01' %(datetime.now().year)"
|
||||
rate: 1.111111
|
||||
|
||||
-
|
||||
I create currency USD in OpenERP for April of 1.052632 Rate
|
||||
-
|
||||
!record {model: res.currency.rate, id: apr_usd}:
|
||||
currency_id: base.USD
|
||||
name: !eval "'%s-04-01' %(datetime.now().year)"
|
||||
rate: 1.052632
|
||||
|
||||
-
|
||||
I create a bank journal with USD as currency
|
||||
-
|
||||
!record {model: account.journal, id: bank_journal_USD}:
|
||||
name: Bank Journal(USD)
|
||||
code: BUSD
|
||||
type: bank
|
||||
analytic_journal_id: account.sit
|
||||
sequence_id: account.sequence_bank_journal
|
||||
default_debit_account_id: account.cash
|
||||
default_credit_account_id: account.cash
|
||||
currency: base.USD
|
||||
company_id: base.main_company
|
||||
view_id: account.account_journal_bank_view
|
||||
|
||||
-
|
||||
I set up some accounts for currency rate expense/income in my company
|
||||
-
|
||||
!record {model: res.company, id: base.main_company}:
|
||||
property_expense_currency_exchange: account.o_expense
|
||||
property_income_currency_exchange: account.o_income
|
||||
-
|
||||
I create new partner Mark Strauss.
|
||||
-
|
||||
!record {model: res.partner, id: res_partner_strauss0}:
|
||||
address:
|
||||
- city: paris
|
||||
country_id: base.fr
|
||||
name: Mark Strauss
|
||||
street: 1 rue Rockfeller
|
||||
type: invoice
|
||||
zip: '75016'
|
||||
name: Mr. Mark Strauss
|
||||
-
|
||||
I create the first invoice on 1st January for 200 USD
|
||||
-
|
||||
!record {model: account.invoice, id: account_invoice_jan}:
|
||||
account_id: account.a_recv
|
||||
address_contact_id: base.res_partner_address_3000
|
||||
address_invoice_id: base.res_partner_address_3000
|
||||
company_id: base.main_company
|
||||
currency_id: base.USD
|
||||
date_invoice: !eval "'%s-01-01' %(datetime.now().year)"
|
||||
period_id: account.period_1
|
||||
invoice_line:
|
||||
- account_id: account.a_sale
|
||||
name: '[PC1] Basic PC'
|
||||
price_unit: 200.0
|
||||
quantity: 1.0
|
||||
product_id: product.product_product_pc1
|
||||
uos_id: product.product_uom_unit
|
||||
journal_id: account.sales_journal
|
||||
partner_id: res_partner_strauss0
|
||||
reference_type: none
|
||||
-
|
||||
I Validate invoice by clicking on Validate button
|
||||
-
|
||||
!workflow {model: account.invoice, action: invoice_open, ref: account_invoice_jan}
|
||||
-
|
||||
I check that first invoice move is correct for debtor account (debit - credit == 150.0)
|
||||
-
|
||||
!python {model: account.invoice}: |
|
||||
invoice_id = self.browse(cr, uid, ref("account_invoice_jan"))
|
||||
assert invoice_id.move_id, "Move not created for open invoice"
|
||||
move_line_obj = self.pool.get('account.move.line')
|
||||
move_lines = move_line_obj.search(cr, uid, [('move_id', '=', invoice_id.move_id.id), ('account_id', '=', invoice_id.account_id.id)])
|
||||
move_line = move_line_obj.browse(cr, uid, move_lines[0])
|
||||
assert (move_line.debit - move_line.credit == 150.0), "Invoice move is not correct for debtors account"
|
||||
-
|
||||
I create the second invoice on 1st February for 100 USD
|
||||
-
|
||||
!record {model: account.invoice, id: account_invoice_feb}:
|
||||
account_id: account.a_recv
|
||||
address_contact_id: base.res_partner_address_3000
|
||||
address_invoice_id: base.res_partner_address_3000
|
||||
company_id: base.main_company
|
||||
currency_id: base.USD
|
||||
date_invoice: !eval "'%s-02-01' %(datetime.now().year)"
|
||||
period_id: account.period_2
|
||||
invoice_line:
|
||||
- account_id: account.a_sale
|
||||
name: '[PC1] Basic PC'
|
||||
price_unit: 100.0
|
||||
quantity: 1.0
|
||||
product_id: product.product_product_pc1
|
||||
uos_id: product.product_uom_unit
|
||||
journal_id: account.sales_journal
|
||||
partner_id: res_partner_strauss0
|
||||
reference_type: none
|
||||
-
|
||||
I Validate invoice by clicking on Validate button
|
||||
-
|
||||
!workflow {model: account.invoice, action: invoice_open, ref: account_invoice_feb}
|
||||
-
|
||||
I check that second invoice move is correct for debtor account (debit - credit == 80)
|
||||
-
|
||||
!python {model: account.invoice}: |
|
||||
invoice_id = self.browse(cr, uid, ref("account_invoice_feb"))
|
||||
assert invoice_id.move_id, "Move not created for open invoice"
|
||||
move_line_obj = self.pool.get('account.move.line')
|
||||
move_lines = move_line_obj.search(cr, uid, [('move_id', '=', invoice_id.move_id.id), ('account_id', '=', invoice_id.account_id.id)])
|
||||
move_line = move_line_obj.browse(cr, uid, move_lines[0])
|
||||
assert (move_line.debit - move_line.credit == 80), "Invoice move is not correct for debtors account"
|
||||
|
||||
-
|
||||
I create the first voucher of payment
|
||||
<create with values 240 USD, journal USD, and fill amounts 180 for the invoice of 200$ and 70 for the invoice of 100$>
|
||||
-
|
||||
!python {model: account.voucher}: |
|
||||
import netsvc, time
|
||||
vals = {}
|
||||
res = self.onchange_partner_id(cr, uid, [], ref("res_partner_strauss0"), ref('bank_journal_USD'), 240.00, 2, ttype='receipt', date=False)
|
||||
vals = {
|
||||
'account_id': ref('account.cash'),
|
||||
'amount': 240.00,
|
||||
'company_id': ref('base.main_company'),
|
||||
'currency_id': ref('base.USD'),
|
||||
'journal_id': ref('bank_journal_USD'),
|
||||
'partner_id': ref('res_partner_strauss0'),
|
||||
'period_id': ref('account.period_3'),
|
||||
'type': 'receipt',
|
||||
'date': time.strftime("%Y-03-01"),
|
||||
'payment_option': 'with_writeoff',
|
||||
'writeoff_acc_id': ref('account.a_expense'),
|
||||
'comment': 'Write Off',
|
||||
'name': 'First payment',
|
||||
}
|
||||
if not res['value']['line_cr_ids']:
|
||||
res['value']['line_cr_ids'] = [{'type': 'cr', 'account_id': ref('account.a_recv'),}]
|
||||
for item in res['value']['line_cr_ids']:
|
||||
if item['amount_unreconciled'] == 200.00:
|
||||
item['amount'] = 180.00
|
||||
else:
|
||||
item['amount'] = 70.00
|
||||
vals['line_cr_ids'] = [(0,0,i) for i in res['value']['line_cr_ids']]
|
||||
id = self.create(cr, uid, vals)
|
||||
voucher_id = self.browse(cr, uid, id)
|
||||
assert (voucher_id.state=='draft'), "Voucher is not in draft state"
|
||||
-
|
||||
I check that writeoff amount computed is -10.0
|
||||
-
|
||||
!python {model: account.voucher}: |
|
||||
voucher = self.search(cr, uid, [('name', '=', 'First payment'), ('partner_id', '=', ref('res_partner_strauss0'))])
|
||||
voucher_id = self.browse(cr, uid, voucher[0])
|
||||
assert (voucher_id.writeoff_amount == -10.0), "Writeoff amount is not -10.0"
|
||||
-
|
||||
I check that currency rate difference is -34.0
|
||||
-
|
||||
!python {model: account.voucher}: |
|
||||
voucher = self.search(cr, uid, [('name', '=', 'First payment'), ('partner_id', '=', ref('res_partner_strauss0'))])
|
||||
voucher_id = self.browse(cr, uid, voucher[0])
|
||||
assert (voucher_id.currency_rate_difference == -34.0), "Currency rate difference is not -34.0"
|
||||
-
|
||||
I confirm the voucher
|
||||
-
|
||||
!python {model: account.voucher}: |
|
||||
import netsvc
|
||||
voucher = self.search(cr, uid, [('name', '=', 'First payment'), ('partner_id', '=', ref('res_partner_strauss0'))])
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
wf_service.trg_validate(uid, 'account.voucher', voucher[0], 'proforma_voucher', cr)
|
||||
-
|
||||
I check that the move of my first voucher is valid
|
||||
-
|
||||
!python {model: account.voucher}: |
|
||||
voucher = self.search(cr, uid, [('name', '=', 'First payment'), ('partner_id', '=', ref('res_partner_strauss0'))])
|
||||
voucher_id = self.browse(cr, uid, voucher[0])
|
||||
move_line_obj = self.pool.get('account.move.line')
|
||||
move_lines = move_line_obj.search(cr, uid, [('move_id', '=', voucher_id.move_id.id)])
|
||||
for move_line in move_line_obj.browse(cr, uid, move_lines):
|
||||
assert move_line.state == 'valid', "Voucher move is not valid"
|
||||
-
|
||||
I check that my debtor account is correct
|
||||
-
|
||||
I check that the debtor account has 2 new lines with -180 and -70 as amount_currency columns and that their credit columns are respectively 135 and 56
|
||||
-
|
||||
I check that my currency rate difference is correct. 34 in credit with no amount_currency
|
||||
-
|
||||
I check that my write-off is correct. 9 debit and 10 amount_currency
|
||||
-
|
||||
!python {model: account.voucher}: |
|
||||
voucher = self.search(cr, uid, [('name', '=', 'First payment'), ('partner_id', '=', ref('res_partner_strauss0'))])
|
||||
voucher_id = self.browse(cr, uid, voucher[0])
|
||||
move_line_obj = self.pool.get('account.move.line')
|
||||
move_lines = move_line_obj.search(cr, uid, [('move_id', '=', voucher_id.move_id.id)])
|
||||
for move_line in move_line_obj.browse(cr, uid, move_lines):
|
||||
if move_line.amount_currency == -180.00:
|
||||
assert move_line.credit == 135.00, "Debtor account has wrong entry."
|
||||
elif move_line.amount_currency == -70.00:
|
||||
assert move_line.credit == 56.00, "Debtor account has wrong entry."
|
||||
elif move_line.credit == 34.00:
|
||||
assert move_line.amount_currency == 0.00, "Incorrect currency rate difference."
|
||||
elif move_line.amount_currency == 10.00:
|
||||
assert move_line.debit == 9.00, "Writeoff amount is wrong."
|
||||
-
|
||||
I check the residual amount of Invoice1, should be 20 in amount_currency and 15 in company currency
|
||||
-
|
||||
!python {model: account.invoice}: |
|
||||
invoice_id = self.browse(cr, uid, ref("account_invoice_jan"))
|
||||
move_line_obj = self.pool.get('account.move.line')
|
||||
move_lines = move_line_obj.search(cr, uid, [('move_id', '=', invoice_id.move_id.id), ('invoice', '=', invoice_id.id), ('account_id', '=', invoice_id.account_id.id)])
|
||||
move_line = move_line_obj.browse(cr, uid, move_lines[0])
|
||||
assert (move_line.amount_residual_currency == 20.0 and move_line.amount_residual == 15.0) , "Residual amount is not correct for first Invoice"
|
||||
-
|
||||
I check the residual amuont of Invoice2, should be 30 in residual currency and 24 in amount_residual
|
||||
-
|
||||
!python {model: account.invoice}: |
|
||||
invoice_id = self.browse(cr, uid, ref("account_invoice_feb"))
|
||||
move_line_obj = self.pool.get('account.move.line')
|
||||
move_lines = move_line_obj.search(cr, uid, [('move_id', '=', invoice_id.move_id.id), ('invoice', '=', invoice_id.id), ('account_id', '=', invoice_id.account_id.id)])
|
||||
move_line = move_line_obj.browse(cr, uid, move_lines[0])
|
||||
assert (move_line.amount_residual_currency == 30.0 and move_line.amount_residual == 24.0) , "Residual amount is not correct for first Invoice"
|
||||
-
|
||||
I create the second voucher of payment
|
||||
<create with values 45 USD, journal USD, and fill amounts 20 for the invoice of 200$ and 30 for the invoice of 100$>
|
||||
|
||||
-
|
||||
!python {model: account.voucher}: |
|
||||
import netsvc, time
|
||||
vals = {}
|
||||
res = self.onchange_partner_id(cr, uid, [], ref("res_partner_strauss0"), ref('bank_journal_USD'), 45.00, 2, ttype='receipt', date=False)
|
||||
vals = {
|
||||
'account_id': ref('account.cash'),
|
||||
'amount': 45.00,
|
||||
'company_id': ref('base.main_company'),
|
||||
'currency_id': ref('base.USD'),
|
||||
'journal_id': ref('bank_journal_USD'),
|
||||
'partner_id': ref('res_partner_strauss0'),
|
||||
'period_id': ref('account.period_3'),
|
||||
'type': 'receipt',
|
||||
'date': time.strftime("%Y-04-01"),
|
||||
'payment_option': 'with_writeoff',
|
||||
'writeoff_acc_id': ref('account.a_expense'),
|
||||
'comment': 'Write Off',
|
||||
'name': 'Second payment',
|
||||
}
|
||||
if not res['value']['line_cr_ids']:
|
||||
res['value']['line_cr_ids'] = [{'type': 'cr', 'account_id': ref('account.a_recv'),}]
|
||||
for item in res['value']['line_cr_ids']:
|
||||
if item['amount_unreconciled'] == 20.00:
|
||||
item['amount'] = 20.00
|
||||
else:
|
||||
item['amount'] = 30.00
|
||||
vals['line_cr_ids'] = [(0,0,i) for i in res['value']['line_cr_ids']]
|
||||
id = self.create(cr, uid, vals)
|
||||
voucher_id = self.browse(cr, uid, id)
|
||||
assert (voucher_id.state=='draft'), "Voucher is not in draft state"
|
||||
-
|
||||
I check that writeoff amount computed is -5.0
|
||||
-
|
||||
!python {model: account.voucher}: |
|
||||
voucher = self.search(cr, uid, [('name', '=', 'Second payment'), ('partner_id', '=', ref('res_partner_strauss0'))])
|
||||
voucher_id = self.browse(cr, uid, voucher[0])
|
||||
assert (voucher_id.writeoff_amount == -5.0), "Writeoff amount is not -5.0"
|
||||
-
|
||||
I check that currency rate difference is -8.50
|
||||
-
|
||||
!python {model: account.voucher}: |
|
||||
voucher = self.search(cr, uid, [('name', '=', 'Second payment'), ('partner_id', '=', ref('res_partner_strauss0'))])
|
||||
voucher_id = self.browse(cr, uid, voucher[0])
|
||||
assert (voucher_id.currency_rate_difference == -8.50), "Currency rate difference is not -8.50"
|
||||
-
|
||||
I confirm the voucher
|
||||
-
|
||||
!python {model: account.voucher}: |
|
||||
import netsvc
|
||||
voucher = self.search(cr, uid, [('name', '=', 'Second payment'), ('partner_id', '=', ref('res_partner_strauss0'))])
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
wf_service.trg_validate(uid, 'account.voucher', voucher[0], 'proforma_voucher', cr)
|
||||
-
|
||||
I check that the move of my second voucher is valid
|
||||
-
|
||||
!python {model: account.voucher}: |
|
||||
voucher = self.search(cr, uid, [('name', '=', 'Second payment'), ('partner_id', '=', ref('res_partner_strauss0'))])
|
||||
voucher_id = self.browse(cr, uid, voucher[0])
|
||||
move_line_obj = self.pool.get('account.move.line')
|
||||
move_lines = move_line_obj.search(cr, uid, [('move_id', '=', voucher_id.move_id.id)])
|
||||
for move_line in move_line_obj.browse(cr, uid, move_lines):
|
||||
assert move_line.state == 'valid', "Voucher move is not valid"
|
||||
-
|
||||
I check that my debtor account is correct
|
||||
-
|
||||
I check that the debtor account has 2 new lines with -20 and -30 as amount_currency columns and their credit columns are respectively 15 and 24.
|
||||
-
|
||||
I check that my currency rate difference is correct. 8.5 in credit with no amount_currency
|
||||
-
|
||||
I check that my writeoff is correct. 4.75 debit and 5 amount_currency
|
||||
-
|
||||
!python {model: account.voucher}: |
|
||||
voucher = self.search(cr, uid, [('name', '=', 'Second payment'), ('partner_id', '=', ref('res_partner_strauss0'))])
|
||||
voucher_id = self.browse(cr, uid, voucher[0])
|
||||
move_line_obj = self.pool.get('account.move.line')
|
||||
move_lines = move_line_obj.search(cr, uid, [('move_id', '=', voucher_id.move_id.id)])
|
||||
for move_line in move_line_obj.browse(cr, uid, move_lines):
|
||||
if move_line.amount_currency == -20.00:
|
||||
assert move_line.credit == 15.00, "Debtor account has wrong entry."
|
||||
elif move_line.amount_currency == -30.00:
|
||||
assert move_line.credit == 24.00, "Debtor account has wrong entry."
|
||||
elif move_line.credit == 8.50:
|
||||
assert move_line.amount_currency == 0.00, "Incorrect Currency Difference."
|
||||
elif move_line.amount_currency == 5.00:
|
||||
assert move_line.debit == 4.75, "Writeoff amount is wrong."
|
||||
-
|
||||
I check the residual amount of Invoice1, should be 0 in residual currency and 0 in amount_residual and paid
|
||||
-
|
||||
!python {model: account.invoice}: |
|
||||
invoice_id = self.browse(cr, uid, ref("account_invoice_jan"))
|
||||
move_line_obj = self.pool.get('account.move.line')
|
||||
move_lines = move_line_obj.search(cr, uid, [('move_id', '=', invoice_id.move_id.id), ('invoice', '=', invoice_id.id), ('account_id', '=', invoice_id.account_id.id)])
|
||||
move_line = move_line_obj.browse(cr, uid, move_lines[0])
|
||||
assert (move_line.amount_residual_currency == 0.0 and move_line.amount_residual == 0.0 and invoice_id.state == 'paid') , "Residual amount is not correct for first Invoice"
|
||||
-
|
||||
I check the residual amuont of Invoice2, should be 0 in residual currency and 0 in amount_residual and paid
|
||||
-
|
||||
!python {model: account.invoice}: |
|
||||
invoice_id = self.browse(cr, uid, ref("account_invoice_feb"))
|
||||
move_line_obj = self.pool.get('account.move.line')
|
||||
move_lines = move_line_obj.search(cr, uid, [('move_id', '=', invoice_id.move_id.id), ('invoice', '=', invoice_id.id), ('account_id', '=', invoice_id.account_id.id)])
|
||||
move_line = move_line_obj.browse(cr, uid, move_lines[0])
|
||||
assert (move_line.amount_residual_currency == 0.0 and move_line.amount_residual == 0.0 and invoice_id.state == 'paid') , "Residual amount is not correct for second Invoice"
|
|
@ -1,328 +0,0 @@
|
|||
-
|
||||
In order to check the Account_voucher module with multi-currency in OpenERP,
|
||||
I create 2 Invoices in USD and make 2 Payments one in USD and another in EUR, based on the currency rating on that particular date
|
||||
-
|
||||
I create a bank journal with EUR as currency
|
||||
-
|
||||
!record {model: account.journal, id: bank_journal_EUR}:
|
||||
name: Bank Journal(EUR)
|
||||
code: BEUR
|
||||
type: bank
|
||||
analytic_journal_id: account.sit
|
||||
sequence_id: account.sequence_bank_journal
|
||||
default_debit_account_id: account.cash
|
||||
default_credit_account_id: account.cash
|
||||
currency: base.EUR
|
||||
company_id: base.main_company
|
||||
view_id: account.account_journal_bank_view
|
||||
-
|
||||
I create a bank journal with USD as currency
|
||||
-
|
||||
!record {model: account.journal, id: bank_journal_USD}:
|
||||
name: Bank Journal(USD)
|
||||
code: BUSD
|
||||
type: bank
|
||||
analytic_journal_id: account.sit
|
||||
sequence_id: account.sequence_bank_journal
|
||||
default_debit_account_id: account.cash
|
||||
default_credit_account_id: account.cash
|
||||
currency: base.USD
|
||||
company_id: base.main_company
|
||||
view_id: account.account_journal_bank_view
|
||||
-
|
||||
I create a new partner Robert Clements
|
||||
-
|
||||
!record {model: res.partner, id: res_partner_clements0}:
|
||||
address:
|
||||
- city: marseille
|
||||
country_id: base.fr
|
||||
name: Robert
|
||||
street: 1 rue Rockfeller
|
||||
type: invoice
|
||||
zip: '13016'
|
||||
name: Mr.Robert Clements
|
||||
-
|
||||
I create the first invoice on 1st January for 200 USD
|
||||
-
|
||||
!record {model: account.invoice, id: account_first_invoice_jan_suppl}:
|
||||
account_id: account.a_pay
|
||||
type : in_invoice
|
||||
address_contact_id: base.res_partner_address_3000
|
||||
address_invoice_id: base.res_partner_address_3000
|
||||
company_id: base.main_company
|
||||
currency_id: base.USD
|
||||
date_invoice: !eval "'%s-01-01' %(datetime.now().year)"
|
||||
period_id: account.period_1
|
||||
invoice_line:
|
||||
- account_id: account.a_expense
|
||||
name: '[PC1] Basic PC'
|
||||
price_unit: 200.0
|
||||
quantity: 1.0
|
||||
product_id: product.product_product_pc1
|
||||
uos_id: product.product_uom_unit
|
||||
journal_id: account.sales_journal
|
||||
partner_id: res_partner_clements0
|
||||
reference_type: none
|
||||
check_total : 200
|
||||
-
|
||||
I Validate invoice by clicking on Validate button
|
||||
-
|
||||
!workflow {model: account.invoice, action: invoice_open, ref: account_first_invoice_jan_suppl}
|
||||
-
|
||||
I check that first invoice move is correct for debtor account(debit - credit == -150)
|
||||
-
|
||||
!python {model: account.invoice}: |
|
||||
invoice_id = self.browse(cr, uid, ref("account_first_invoice_jan_suppl"))
|
||||
assert invoice_id.move_id, "Move not created for open invoice"
|
||||
move_line_obj = self.pool.get('account.move.line')
|
||||
move_lines = move_line_obj.search(cr, uid, [('move_id', '=', invoice_id.move_id.id), ('account_id', '=', invoice_id.account_id.id)])
|
||||
move_line = move_line_obj.browse(cr, uid, move_lines[0])
|
||||
assert (move_line.debit - move_line.credit == -150.00), "Invoice move is incorrect for debtors account"
|
||||
-
|
||||
I create the second invoice on 1st February for 100 USD
|
||||
-
|
||||
!record {model: account.invoice, id: account_second_invoice_feb_suppl}:
|
||||
account_id: account.a_pay
|
||||
address_contact_id: base.res_partner_address_3000
|
||||
address_invoice_id: base.res_partner_address_3000
|
||||
company_id: base.main_company
|
||||
currency_id: base.USD
|
||||
date_invoice: !eval "'%s-02-01' %(datetime.now().year)"
|
||||
period_id: account.period_2
|
||||
type : in_invoice
|
||||
invoice_line:
|
||||
- account_id: account.a_expense
|
||||
name: '[PC1] Basic PC'
|
||||
price_unit: 100.0
|
||||
quantity: 1.0
|
||||
product_id: product.product_product_pc1
|
||||
uos_id: product.product_uom_unit
|
||||
journal_id: account.sales_journal
|
||||
partner_id: res_partner_clements0
|
||||
reference_type: none
|
||||
check_total : 100.0
|
||||
-
|
||||
I Validate invoice by clicking on Validate button
|
||||
-
|
||||
!workflow {model: account.invoice, action: invoice_open, ref: account_second_invoice_feb_suppl}
|
||||
-
|
||||
I check that second invoice move is correct for debtor account (debit - credit == -80)
|
||||
-
|
||||
!python {model: account.invoice}: |
|
||||
invoice_id = self.browse(cr, uid, ref("account_second_invoice_feb_suppl"))
|
||||
assert invoice_id.move_id, "Move not created for open invoice"
|
||||
move_line_obj = self.pool.get('account.move.line')
|
||||
move_lines = move_line_obj.search(cr, uid, [('move_id', '=', invoice_id.move_id.id), ('account_id', '=', invoice_id.account_id.id)])
|
||||
move_line = move_line_obj.browse(cr, uid, move_lines[0])
|
||||
assert (move_line.debit - move_line.credit == -80), "Invoice move is incorrect for debtors account"
|
||||
-
|
||||
I create the first voucher of payment
|
||||
<create with values 240 EUR, journal EUR, and fills amount 180 for the invoice of 200$ and 70 for the invoice of 100$>
|
||||
-
|
||||
!python {model: account.voucher}: |
|
||||
import netsvc, time
|
||||
vals = {}
|
||||
res = self.onchange_partner_id(cr, uid, [], ref("res_partner_clements0"), ref('bank_journal_EUR'), 240.0, 2, ttype='payment', date=False)
|
||||
vals = {
|
||||
'account_id': ref('account.cash'),
|
||||
'amount': 240.0,
|
||||
'company_id': ref('base.main_company'),
|
||||
'currency_id': ref('base.EUR'),
|
||||
'journal_id': ref('bank_journal_EUR'),
|
||||
'partner_id': ref('res_partner_clements0'),
|
||||
'period_id': ref('account.period_3'),
|
||||
'type': 'payment',
|
||||
'date': time.strftime("%Y-03-01"),
|
||||
'payment_option': 'with_writeoff',
|
||||
'writeoff_acc_id': ref('account.a_expense'),
|
||||
'comment': 'Write Off',
|
||||
'name': 'First payment',
|
||||
}
|
||||
if not res['value']['line_dr_ids']:
|
||||
res['value']['line_dr_ids'] = [{'type': 'dr', 'account_id': ref('account.a_pay'),}]
|
||||
for item in res['value']['line_dr_ids']:
|
||||
if item['amount_unreconciled'] == 200.00:
|
||||
item['amount'] = 180.00
|
||||
else:
|
||||
item['amount'] = 70.00
|
||||
vals['line_dr_ids'] = [(0,0,i) for i in res['value']['line_dr_ids']]
|
||||
id = self.create(cr, uid, vals)
|
||||
voucher_id = self.browse(cr, uid, id)
|
||||
assert (voucher_id.state=='draft'), "Voucher is not in draft state"
|
||||
-
|
||||
I check that writeoff amount computed is -15.0
|
||||
-
|
||||
!python {model: account.voucher}: |
|
||||
voucher = self.search(cr, uid, [('name', '=', 'First payment'), ('partner_id', '=', ref('res_partner_clements0'))])
|
||||
voucher_id = self.browse(cr, uid, voucher[0])
|
||||
assert (voucher_id.writeoff_amount == -15.0), "Writeoff amount is not -15.0"
|
||||
-
|
||||
I check that currency rate difference is 34.0
|
||||
-
|
||||
!python {model: account.voucher}: |
|
||||
voucher = self.search(cr, uid, [('name', '=', 'First payment'), ('partner_id', '=', ref('res_partner_clements0'))])
|
||||
voucher_id = self.browse(cr, uid, voucher[0])
|
||||
assert (voucher_id.currency_rate_difference == 34.0), "Currency rate difference is not 34.0"
|
||||
-
|
||||
I confirm the voucher
|
||||
-
|
||||
!python {model: account.voucher}: |
|
||||
import netsvc
|
||||
voucher = self.search(cr, uid, [('name', '=', 'First payment'), ('partner_id', '=', ref('res_partner_clements0'))])
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
wf_service.trg_validate(uid, 'account.voucher', voucher[0], 'proforma_voucher', cr)
|
||||
-
|
||||
I check that the move of my voucher is valid
|
||||
-
|
||||
!python {model: account.voucher}: |
|
||||
voucher = self.search(cr, uid, [('name', '=', 'First payment'), ('partner_id', '=', ref('res_partner_clements0'))])
|
||||
voucher_id = self.browse(cr, uid, voucher[0])
|
||||
move_line_obj = self.pool.get('account.move.line')
|
||||
move_lines = move_line_obj.search(cr, uid, [('move_id', '=', voucher_id.move_id.id)])
|
||||
for move_line in move_line_obj.browse(cr, uid, move_lines):
|
||||
assert move_line.state == 'valid', "Voucher move is not valid"
|
||||
-
|
||||
I check that my creditor account is correct
|
||||
-
|
||||
I check that the creditor account has 2 new lines with 180 and 70 in amount_currency columns and their debit columns are respectively 135 and 56 and currency is USD($).
|
||||
-
|
||||
I check that my currency rate difference is correct. -34 in credit with no amount_currency
|
||||
-
|
||||
I check that my writeoff is correct. -15 in credit with no amount_currency
|
||||
-
|
||||
!python {model: account.voucher}: |
|
||||
voucher = self.search(cr, uid, [('name', '=', 'First payment'), ('partner_id', '=', ref('res_partner_clements0'))])
|
||||
voucher_id = self.browse(cr, uid, voucher[0])
|
||||
move_line_obj = self.pool.get('account.move.line')
|
||||
move_lines = move_line_obj.search(cr, uid, [('move_id', '=', voucher_id.move_id.id)])
|
||||
for move_line in move_line_obj.browse(cr, uid, move_lines):
|
||||
if move_line.amount_currency == 180.00:
|
||||
assert move_line.debit == 135.00, "Creditor account has wrong entry."
|
||||
elif move_line.amount_currency == 70.00:
|
||||
assert move_line.debit == 56.00, "Debtor account has wrong entry."
|
||||
elif move_line.debit == 34.00:
|
||||
assert move_line.amount_currency == 0.00, "Incorrect Currency Difference."
|
||||
elif move_line.debit == 15.00:
|
||||
assert move_line.amount_currency == 0.00, "Writeoff amount is wrong."
|
||||
-
|
||||
I check the residual amount of Invoice1, should be 20 in residual currency and 15 in amount_residual
|
||||
-
|
||||
!python {model: account.invoice}: |
|
||||
invoice_id = self.browse(cr, uid, ref("account_first_invoice_jan_suppl"))
|
||||
move_line_obj = self.pool.get('account.move.line')
|
||||
move_lines = move_line_obj.search(cr, uid, [('move_id', '=', invoice_id.move_id.id), ('invoice', '=', invoice_id.id), ('account_id', '=', invoice_id.account_id.id)])
|
||||
move_line = move_line_obj.browse(cr, uid, move_lines[0])
|
||||
assert (move_line.amount_residual_currency == 20.0 and move_line.amount_residual == 15) , "Residual amount is not correct for first Invoice"
|
||||
-
|
||||
I check the residual amuont of Invoice2, should be 30 in residual currency and 24 in amount_residual
|
||||
-
|
||||
!python {model: account.invoice}: |
|
||||
invoice_id = self.browse(cr, uid, ref("account_second_invoice_feb_suppl"))
|
||||
move_line_obj = self.pool.get('account.move.line')
|
||||
move_lines = move_line_obj.search(cr, uid, [('move_id', '=', invoice_id.move_id.id), ('invoice', '=', invoice_id.id), ('account_id', '=', invoice_id.account_id.id)])
|
||||
move_line = move_line_obj.browse(cr, uid, move_lines[0])
|
||||
assert (move_line.amount_residual_currency == 30 and move_line.amount_residual == 24) , "Residual amount is not correct for second Invoice"
|
||||
-
|
||||
I create the second voucher of payment
|
||||
<create with values 45 USD, journal USD, and fill amounts 20 for the invoice of 200$ and 30 for the invoice of 100$>
|
||||
-
|
||||
!python {model: account.voucher}: |
|
||||
import netsvc, time
|
||||
vals = {}
|
||||
res = self.onchange_partner_id(cr, uid, [], ref("res_partner_clements0"), ref('bank_journal_EUR'), 45.0, 2, ttype='payment', date=False)
|
||||
vals = {
|
||||
'account_id': ref('account.cash'),
|
||||
'amount': 45.0,
|
||||
'company_id': ref('base.main_company'),
|
||||
'currency_id': ref('base.USD'),
|
||||
'journal_id': ref('bank_journal_USD'),
|
||||
'partner_id': ref('res_partner_clements0'),
|
||||
'period_id': ref('account.period_3'),
|
||||
'type': 'payment',
|
||||
'date': time.strftime("%Y-04-01"),
|
||||
'payment_option': 'with_writeoff',
|
||||
'writeoff_acc_id': ref('account.a_expense'),
|
||||
'comment': 'Write Off',
|
||||
'name': 'Second payment',
|
||||
}
|
||||
if not res['value']['line_dr_ids']:
|
||||
res['value']['line_dr_ids'] = [{'type': 'dr', 'account_id': ref('account.a_pay'),}]
|
||||
for item in res['value']['line_dr_ids']:
|
||||
if item['amount_unreconciled'] == 20.00:
|
||||
item['amount'] = 20.00
|
||||
else:
|
||||
item['amount'] = 30.00
|
||||
vals['line_dr_ids'] = [(0,0,i) for i in res['value']['line_dr_ids']]
|
||||
id = self.create(cr, uid, vals)
|
||||
voucher_id = self.browse(cr, uid, id)
|
||||
assert (voucher_id.state=='draft'), "Voucher is not in draft state"
|
||||
-
|
||||
I check that writeoff amount computed is -5.0
|
||||
-
|
||||
!python {model: account.voucher}: |
|
||||
voucher = self.search(cr, uid, [('name', '=', 'Second payment'), ('partner_id', '=', ref('res_partner_clements0'))])
|
||||
voucher_id = self.browse(cr, uid, voucher[0])
|
||||
assert (voucher_id.writeoff_amount == 5.0), "Writeoff amount is not 5.0"
|
||||
-
|
||||
I check that currency rate difference is 8.50
|
||||
-
|
||||
!python {model: account.voucher}: |
|
||||
voucher = self.search(cr, uid, [('name', '=', 'Second payment'), ('partner_id', '=', ref('res_partner_clements0'))])
|
||||
voucher_id = self.browse(cr, uid, voucher[0])
|
||||
assert (voucher_id.currency_rate_difference == 8.50), "Currency rate difference is not 8.50"
|
||||
-
|
||||
I confirm the voucher
|
||||
-
|
||||
!python {model: account.voucher}: |
|
||||
import netsvc
|
||||
voucher = self.search(cr, uid, [('name', '=', 'Second payment'), ('partner_id', '=', ref('res_partner_clements0'))])
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
wf_service.trg_validate(uid, 'account.voucher', voucher[0], 'proforma_voucher', cr)
|
||||
-
|
||||
I check that my voucher state is posted
|
||||
-
|
||||
!python {model: account.voucher}: |
|
||||
voucher = self.search(cr, uid, [('name', '=', 'Second payment'), ('partner_id', '=', ref('res_partner_clements0'))])
|
||||
voucher_id = self.browse(cr, uid, voucher[0])
|
||||
assert voucher_id.state == 'posted', "Voucher state is not posted"
|
||||
-
|
||||
I check that my creditor account is correct
|
||||
-
|
||||
I check that the creditor account has 2 new lines with 20 and 30 in amount_currency columns and their debit columns are respectively 15 and 24 and currency is USD($).
|
||||
-
|
||||
I check that my currency rate difference is correct. 8.50 in debit with no amount_currency
|
||||
-
|
||||
I check that my writeoff is correct. 4.75 in credit and 5 in amount_currency
|
||||
-
|
||||
!python {model: account.voucher}: |
|
||||
voucher = self.search(cr, uid, [('name', '=', 'Second payment'), ('partner_id', '=', ref('res_partner_clements0'))])
|
||||
voucher_id = self.browse(cr, uid, voucher[0])
|
||||
move_line_obj = self.pool.get('account.move.line')
|
||||
move_lines = move_line_obj.search(cr, uid, [('move_id', '=', voucher_id.move_id.id)])
|
||||
for move_line in move_line_obj.browse(cr, uid, move_lines):
|
||||
if move_line.amount_currency == 20.00:
|
||||
assert move_line.debit == 15.00, "Debtor account has wrong entry."
|
||||
elif move_line.amount_currency == 30.00:
|
||||
assert move_line.debit == 24.00, "Debtor account has wrong entry."
|
||||
elif move_line.debit == 8.50:
|
||||
assert move_line.amount_currency == 0.00, "Incorrect Currency Difference."
|
||||
elif move_line.amount_currency == -5.00:
|
||||
assert move_line.credit == 4.75, "Writeoff amount is wrong."
|
||||
-
|
||||
I check the residual amount of invoice 1, should be 0 in residual currency and 0 in amount_residual and paid
|
||||
-
|
||||
!python {model: account.invoice}: |
|
||||
invoice_id = self.browse(cr, uid, ref("account_first_invoice_jan_suppl"))
|
||||
move_line_obj = self.pool.get('account.move.line')
|
||||
move_lines = move_line_obj.search(cr, uid, [('move_id', '=', invoice_id.move_id.id), ('invoice', '=', invoice_id.id), ('account_id', '=', invoice_id.account_id.id)])
|
||||
move_line = move_line_obj.browse(cr, uid, move_lines[0])
|
||||
assert (move_line.amount_residual_currency == 0.0 and move_line.amount_residual == 0.0 and invoice_id.state == 'paid') , "Residual amount is not correct for first Invoice"
|
||||
-
|
||||
I check the residual amount of invoice 2, should be 0 in residual currency and 0 in amount_residual and paid
|
||||
-
|
||||
!python {model: account.invoice}: |
|
||||
invoice_id = self.browse(cr, uid, ref("account_second_invoice_feb_suppl"))
|
||||
move_line_obj = self.pool.get('account.move.line')
|
||||
move_lines = move_line_obj.search(cr, uid, [('move_id', '=', invoice_id.move_id.id), ('invoice', '=', invoice_id.id), ('account_id', '=', invoice_id.account_id.id)])
|
||||
move_line = move_line_obj.browse(cr, uid, move_lines[0])
|
||||
assert (move_line.amount_residual_currency == 0.0 and move_line.amount_residual == 0.0 and invoice_id.state == 'paid') , "Residual amount is not correct for second Invoice"
|
|
@ -1,360 +0,0 @@
|
|||
-
|
||||
In order to check the Account_voucher module with multi-currency in OpenERP,
|
||||
I create 2 Invoices in USD and make 2 Payments one in USD and another in EUR, based on the currency rating on that particular date
|
||||
-
|
||||
I create currency USD in OpenERP for January of 1.333333 Rate
|
||||
-
|
||||
!python {model: res.currency.rate}: |
|
||||
from datetime import datetime
|
||||
curr_id = self.pool.get('res.currency').search(cr, uid, [('name', '=', 'USD')])
|
||||
date = '%s-01-01' %(datetime.now().year)
|
||||
ids = self.search(cr, uid, [('currency_id', '=', curr_id), ('name', '=', date)])
|
||||
self.write(cr, uid, ids, {'rate': 1.333333})
|
||||
-
|
||||
I create currency USD in OpenERP for February of 1.250000 Rate
|
||||
-
|
||||
!record {model: res.currency.rate, id: febr_usd}:
|
||||
currency_id: base.USD
|
||||
name: !eval "'%s-02-01' %(datetime.now().year)"
|
||||
rate: 1.250000
|
||||
-
|
||||
I create currency USD in OpenERP for March of 1.111111 Rate
|
||||
-
|
||||
!record {model: res.currency.rate, id: marc_usd}:
|
||||
currency_id: base.USD
|
||||
name: !eval "'%s-03-01' %(datetime.now().year)"
|
||||
rate: 1.111111
|
||||
-
|
||||
I create currency USD in OpenERP for April of 1.052632 Rate
|
||||
-
|
||||
!record {model: res.currency.rate, id: apri_usd}:
|
||||
currency_id: base.USD
|
||||
name: !eval "'%s-04-01' %(datetime.now().year)"
|
||||
rate: 1.052632
|
||||
-
|
||||
I create a bank journal with EUR as currency
|
||||
-
|
||||
!record {model: account.journal, id: bank_journal_EUR}:
|
||||
name: Bank Journal(EUR)
|
||||
code: BEUR
|
||||
type: bank
|
||||
analytic_journal_id: account.sit
|
||||
sequence_id: account.sequence_bank_journal
|
||||
default_debit_account_id: account.cash
|
||||
default_credit_account_id: account.cash
|
||||
currency: base.EUR
|
||||
company_id: base.main_company
|
||||
view_id: account.account_journal_bank_view
|
||||
-
|
||||
I create a bank journal with USD as currency
|
||||
-
|
||||
!record {model: account.journal, id: bank_journal_USD}:
|
||||
name: Bank Journal(USD)
|
||||
code: BUSD
|
||||
type: bank
|
||||
analytic_journal_id: account.sit
|
||||
sequence_id: account.sequence_bank_journal
|
||||
default_debit_account_id: account.cash
|
||||
default_credit_account_id: account.cash
|
||||
currency: base.USD
|
||||
company_id: base.main_company
|
||||
view_id: account.account_journal_bank_view
|
||||
-
|
||||
I set up some accounts for currency rate expense/income in my company
|
||||
-
|
||||
!record {model: res.company, id: base.main_company}:
|
||||
property_expense_currency_exchange: account.o_expense
|
||||
property_income_currency_exchange: account.o_income
|
||||
-
|
||||
I create a new partner Michael Geller
|
||||
-
|
||||
!record {model: res.partner, id: res_partner_michael0}:
|
||||
address:
|
||||
- city: paris
|
||||
country_id: base.fr
|
||||
name: Michael
|
||||
street: 1 rue Rockfeller
|
||||
type: invoice
|
||||
zip: '75016'
|
||||
name: Mr.Michael Geller
|
||||
-
|
||||
I create the first invoice on 1st January for 200 USD
|
||||
-
|
||||
!record {model: account.invoice, id: account_first_invoice_jan}:
|
||||
account_id: account.a_recv
|
||||
address_contact_id: base.res_partner_address_3000
|
||||
address_invoice_id: base.res_partner_address_3000
|
||||
company_id: base.main_company
|
||||
currency_id: base.USD
|
||||
date_invoice: !eval "'%s-01-01' %(datetime.now().year)"
|
||||
period_id: account.period_1
|
||||
invoice_line:
|
||||
- account_id: account.a_sale
|
||||
name: '[PC1] Basic PC'
|
||||
price_unit: 200.0
|
||||
quantity: 1.0
|
||||
product_id: product.product_product_pc1
|
||||
uos_id: product.product_uom_unit
|
||||
journal_id: account.sales_journal
|
||||
partner_id: res_partner_michael0
|
||||
reference_type: none
|
||||
-
|
||||
I Validate invoice by clicking on Validate button
|
||||
-
|
||||
!workflow {model: account.invoice, action: invoice_open, ref: account_first_invoice_jan}
|
||||
-
|
||||
I check that first invoice move is correct for debtor account(debit - credit == 150)
|
||||
-
|
||||
!python {model: account.invoice}: |
|
||||
invoice_id = self.browse(cr, uid, ref("account_first_invoice_jan"))
|
||||
assert invoice_id.move_id, "Move not created for open invoice"
|
||||
move_line_obj = self.pool.get('account.move.line')
|
||||
move_lines = move_line_obj.search(cr, uid, [('move_id', '=', invoice_id.move_id.id), ('account_id', '=', invoice_id.account_id.id)])
|
||||
move_line = move_line_obj.browse(cr, uid, move_lines[0])
|
||||
assert (move_line.debit - move_line.credit == 150.00), "Invoice move is incorrect for debtors account"
|
||||
-
|
||||
I create the second invoice on 1st February for 100 USD
|
||||
-
|
||||
!record {model: account.invoice, id: account_second_invoice_feb}:
|
||||
account_id: account.a_recv
|
||||
address_contact_id: base.res_partner_address_3000
|
||||
address_invoice_id: base.res_partner_address_3000
|
||||
company_id: base.main_company
|
||||
currency_id: base.USD
|
||||
date_invoice: !eval "'%s-02-01' %(datetime.now().year)"
|
||||
period_id: account.period_2
|
||||
invoice_line:
|
||||
- account_id: account.a_sale
|
||||
name: '[PC1] Basic PC'
|
||||
price_unit: 100.0
|
||||
quantity: 1.0
|
||||
product_id: product.product_product_pc1
|
||||
uos_id: product.product_uom_unit
|
||||
journal_id: account.sales_journal
|
||||
partner_id: res_partner_michael0
|
||||
reference_type: none
|
||||
-
|
||||
I Validate invoice by clicking on Validate button
|
||||
-
|
||||
!workflow {model: account.invoice, action: invoice_open, ref: account_second_invoice_feb}
|
||||
-
|
||||
I check that second invoice move is correct for debtor account (debit - credit == 80)
|
||||
-
|
||||
!python {model: account.invoice}: |
|
||||
invoice_id = self.browse(cr, uid, ref("account_second_invoice_feb"))
|
||||
assert invoice_id.move_id, "Move not created for open invoice"
|
||||
move_line_obj = self.pool.get('account.move.line')
|
||||
move_lines = move_line_obj.search(cr, uid, [('move_id', '=', invoice_id.move_id.id), ('account_id', '=', invoice_id.account_id.id)])
|
||||
move_line = move_line_obj.browse(cr, uid, move_lines[0])
|
||||
assert (move_line.debit - move_line.credit == 80), "Invoice move is incorrect for debtors account"
|
||||
-
|
||||
I create the first voucher of payment
|
||||
<create with values 240 EUR, journal EUR, and fills amount 180 for the invoice of 200$ and 70 for the invoice of 100$>
|
||||
-
|
||||
!python {model: account.voucher}: |
|
||||
import netsvc, time
|
||||
vals = {}
|
||||
res = self.onchange_partner_id(cr, uid, [], ref("res_partner_michael0"), ref('bank_journal_EUR'), 240.0, 2, ttype='receipt', date=False)
|
||||
vals = {
|
||||
'account_id': ref('account.cash'),
|
||||
'amount': 240.0,
|
||||
'company_id': ref('base.main_company'),
|
||||
'currency_id': ref('base.EUR'),
|
||||
'journal_id': ref('bank_journal_EUR'),
|
||||
'partner_id': ref('res_partner_michael0'),
|
||||
'period_id': ref('account.period_3'),
|
||||
'type': 'receipt',
|
||||
'date': time.strftime("%Y-03-01"),
|
||||
'payment_option': 'with_writeoff',
|
||||
'writeoff_acc_id': ref('account.a_expense'),
|
||||
'comment': 'Write Off',
|
||||
'name': 'First payment',
|
||||
}
|
||||
if not res['value']['line_cr_ids']:
|
||||
res['value']['line_cr_ids'] = [{'type': 'cr', 'account_id': ref('account.a_recv'),}]
|
||||
for item in res['value']['line_cr_ids']:
|
||||
if item['amount_unreconciled'] == 200.00:
|
||||
item['amount'] = 180.00
|
||||
else:
|
||||
item['amount'] = 70.00
|
||||
vals['line_cr_ids'] = [(0,0,i) for i in res['value']['line_cr_ids']]
|
||||
id = self.create(cr, uid, vals)
|
||||
voucher_id = self.browse(cr, uid, id)
|
||||
assert (voucher_id.state=='draft'), "Voucher is not in draft state"
|
||||
-
|
||||
I check that writeoff amount computed is 15.0
|
||||
-
|
||||
!python {model: account.voucher}: |
|
||||
voucher = self.search(cr, uid, [('name', '=', 'First payment'), ('partner_id', '=', ref('res_partner_michael0'))])
|
||||
voucher_id = self.browse(cr, uid, voucher[0])
|
||||
assert (voucher_id.writeoff_amount == 15.0), "Writeoff amount is not 15.0"
|
||||
-
|
||||
I check that currency rate difference is -34.0
|
||||
-
|
||||
!python {model: account.voucher}: |
|
||||
voucher = self.search(cr, uid, [('name', '=', 'First payment'), ('partner_id', '=', ref('res_partner_michael0'))])
|
||||
voucher_id = self.browse(cr, uid, voucher[0])
|
||||
assert (voucher_id.currency_rate_difference == -34.0), "Currency rate difference is not -34.0"
|
||||
-
|
||||
I confirm the voucher
|
||||
-
|
||||
!python {model: account.voucher}: |
|
||||
import netsvc
|
||||
voucher = self.search(cr, uid, [('name', '=', 'First payment'), ('partner_id', '=', ref('res_partner_michael0'))])
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
wf_service.trg_validate(uid, 'account.voucher', voucher[0], 'proforma_voucher', cr)
|
||||
-
|
||||
I check that the move of my voucher is valid
|
||||
-
|
||||
!python {model: account.voucher}: |
|
||||
voucher = self.search(cr, uid, [('name', '=', 'First payment'), ('partner_id', '=', ref('res_partner_michael0'))])
|
||||
voucher_id = self.browse(cr, uid, voucher[0])
|
||||
move_line_obj = self.pool.get('account.move.line')
|
||||
move_lines = move_line_obj.search(cr, uid, [('move_id', '=', voucher_id.move_id.id)])
|
||||
for move_line in move_line_obj.browse(cr, uid, move_lines):
|
||||
assert move_line.state == 'valid', "Voucher move is not valid"
|
||||
-
|
||||
I check that my debtor account is correct
|
||||
-
|
||||
I check that the debtor account has 2 new lines with -180 and -70 in amount_currency columns and their credit columns are respectively 135 and 56 and currency is USD($).
|
||||
-
|
||||
I check that my currency rate difference is correct. 34 in credit with no amount_currency
|
||||
-
|
||||
I check that my writeoff is correct. 15 in credit with no amount_currency
|
||||
-
|
||||
!python {model: account.voucher}: |
|
||||
voucher = self.search(cr, uid, [('name', '=', 'First payment'), ('partner_id', '=', ref('res_partner_michael0'))])
|
||||
voucher_id = self.browse(cr, uid, voucher[0])
|
||||
move_line_obj = self.pool.get('account.move.line')
|
||||
move_lines = move_line_obj.search(cr, uid, [('move_id', '=', voucher_id.move_id.id)])
|
||||
for move_line in move_line_obj.browse(cr, uid, move_lines):
|
||||
if move_line.amount_currency == -180.00:
|
||||
assert move_line.credit == 135.00, "Debtor account has wrong entry."
|
||||
elif move_line.amount_currency == -70.00:
|
||||
assert move_line.credit == 56.00, "Debtor account has wrong entry."
|
||||
elif move_line.credit == 34.00:
|
||||
assert move_line.amount_currency == 0.00, "Incorrect Currency Difference."
|
||||
elif move_line.credit == 15.00:
|
||||
assert move_line.amount_currency == 0.00, "Writeoff amount is wrong."
|
||||
-
|
||||
I check the residual amount of Invoice1, should be 20 in residual currency and 15 in amount_residual
|
||||
-
|
||||
!python {model: account.invoice}: |
|
||||
invoice_id = self.browse(cr, uid, ref("account_first_invoice_jan"))
|
||||
move_line_obj = self.pool.get('account.move.line')
|
||||
move_lines = move_line_obj.search(cr, uid, [('move_id', '=', invoice_id.move_id.id), ('invoice', '=', invoice_id.id), ('account_id', '=', invoice_id.account_id.id)])
|
||||
move_line = move_line_obj.browse(cr, uid, move_lines[0])
|
||||
assert (move_line.amount_residual_currency == 20.0 and move_line.amount_residual == 15) , "Residual amount is not correct for first Invoice"
|
||||
-
|
||||
I check the residual amuont of Invoice2, should be 30 in residual currency and 24 in amount_residual
|
||||
-
|
||||
!python {model: account.invoice}: |
|
||||
invoice_id = self.browse(cr, uid, ref("account_second_invoice_feb"))
|
||||
move_line_obj = self.pool.get('account.move.line')
|
||||
move_lines = move_line_obj.search(cr, uid, [('move_id', '=', invoice_id.move_id.id), ('invoice', '=', invoice_id.id), ('account_id', '=', invoice_id.account_id.id)])
|
||||
move_line = move_line_obj.browse(cr, uid, move_lines[0])
|
||||
assert (move_line.amount_residual_currency == 30 and move_line.amount_residual == 24) , "Residual amount is not correct for second Invoice"
|
||||
-
|
||||
I create the second voucher of payment
|
||||
<create with values 45 USD, journal USD, and fill amounts 20 for the invoice of 200$ and 30 for the invoice of 100$>
|
||||
-
|
||||
!python {model: account.voucher}: |
|
||||
import netsvc, time
|
||||
vals = {}
|
||||
res = self.onchange_partner_id(cr, uid, [], ref("res_partner_michael0"), ref('bank_journal_EUR'), 45.0, 2, ttype='receipt', date=False)
|
||||
vals = {
|
||||
'account_id': ref('account.cash'),
|
||||
'amount': 45.0,
|
||||
'company_id': ref('base.main_company'),
|
||||
'currency_id': ref('base.USD'),
|
||||
'journal_id': ref('bank_journal_USD'),
|
||||
'partner_id': ref('res_partner_michael0'),
|
||||
'period_id': ref('account.period_3'),
|
||||
'type': 'receipt',
|
||||
'date': time.strftime("%Y-04-01"),
|
||||
'payment_option': 'with_writeoff',
|
||||
'writeoff_acc_id': ref('account.a_expense'),
|
||||
'comment': 'Write Off',
|
||||
'name': 'Second payment',
|
||||
}
|
||||
if not res['value']['line_cr_ids']:
|
||||
res['value']['line_cr_ids'] = [{'type': 'cr', 'account_id': ref('account.a_recv'),}]
|
||||
for item in res['value']['line_cr_ids']:
|
||||
if item['amount_unreconciled'] == 20.00:
|
||||
item['amount'] = 20.00
|
||||
else:
|
||||
item['amount'] = 30.00
|
||||
vals['line_cr_ids'] = [(0,0,i) for i in res['value']['line_cr_ids']]
|
||||
id = self.create(cr, uid, vals)
|
||||
voucher_id = self.browse(cr, uid, id)
|
||||
assert (voucher_id.state=='draft'), "Voucher is not in draft state"
|
||||
-
|
||||
I check that writeoff amount computed is -5.0
|
||||
-
|
||||
!python {model: account.voucher}: |
|
||||
voucher = self.search(cr, uid, [('name', '=', 'Second payment'), ('partner_id', '=', ref('res_partner_michael0'))])
|
||||
voucher_id = self.browse(cr, uid, voucher[0])
|
||||
assert (voucher_id.writeoff_amount == -5.0), "Writeoff amount is not -5.0"
|
||||
-
|
||||
I check that currency rate difference is -8.50
|
||||
-
|
||||
!python {model: account.voucher}: |
|
||||
voucher = self.search(cr, uid, [('name', '=', 'Second payment'), ('partner_id', '=', ref('res_partner_michael0'))])
|
||||
voucher_id = self.browse(cr, uid, voucher[0])
|
||||
assert (voucher_id.currency_rate_difference == -8.50), "Currency rate difference is not -8.50"
|
||||
-
|
||||
I confirm the voucher
|
||||
-
|
||||
!python {model: account.voucher}: |
|
||||
import netsvc
|
||||
voucher = self.search(cr, uid, [('name', '=', 'Second payment'), ('partner_id', '=', ref('res_partner_michael0'))])
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
wf_service.trg_validate(uid, 'account.voucher', voucher[0], 'proforma_voucher', cr)
|
||||
-
|
||||
I check that my voucher state is posted
|
||||
-
|
||||
!python {model: account.voucher}: |
|
||||
voucher = self.search(cr, uid, [('name', '=', 'Second payment'), ('partner_id', '=', ref('res_partner_michael0'))])
|
||||
voucher_id = self.browse(cr, uid, voucher[0])
|
||||
assert voucher_id.state == 'posted', "Voucher state is not posted"
|
||||
-
|
||||
I check that my debtor account is correct
|
||||
-
|
||||
I check that the debtor account has 2 new lines with -20 and -30 in amount_currency columns and their credit columns are respectively 15 and 24 and currency is USD($).
|
||||
-
|
||||
I check that my currency rate difference is correct. 8.50 in credit with no amount_currency
|
||||
-
|
||||
I check that my writeoff is correct. 4.75 in debit and 5 in amount_currency
|
||||
-
|
||||
!python {model: account.voucher}: |
|
||||
voucher = self.search(cr, uid, [('name', '=', 'Second payment'), ('partner_id', '=', ref('res_partner_michael0'))])
|
||||
voucher_id = self.browse(cr, uid, voucher[0])
|
||||
move_line_obj = self.pool.get('account.move.line')
|
||||
move_lines = move_line_obj.search(cr, uid, [('move_id', '=', voucher_id.move_id.id)])
|
||||
for move_line in move_line_obj.browse(cr, uid, move_lines):
|
||||
if move_line.amount_currency == -20.00:
|
||||
assert move_line.credit == 15.00, "Debtor account has wrong entry."
|
||||
elif move_line.amount_currency == -30.00:
|
||||
assert move_line.credit == 24.00, "Debtor account has wrong entry."
|
||||
elif move_line.credit == 8.50:
|
||||
assert move_line.amount_currency == 0.00, "Incorrect Currency Difference."
|
||||
elif move_line.amount_currency == 5.00:
|
||||
assert move_line.debit == 4.75, "Writeoff amount is wrong."
|
||||
-
|
||||
I check the residual amount of invoice 1, should be 0 in residual currency and 0 in amount_residual and paid
|
||||
-
|
||||
!python {model: account.invoice}: |
|
||||
invoice_id = self.browse(cr, uid, ref("account_first_invoice_jan"))
|
||||
move_line_obj = self.pool.get('account.move.line')
|
||||
move_lines = move_line_obj.search(cr, uid, [('move_id', '=', invoice_id.move_id.id), ('invoice', '=', invoice_id.id), ('account_id', '=', invoice_id.account_id.id)])
|
||||
move_line = move_line_obj.browse(cr, uid, move_lines[0])
|
||||
assert (move_line.amount_residual_currency == 0.0 and move_line.amount_residual == 0.0 and invoice_id.state == 'paid') , "Residual amount is not correct for first Invoice"
|
||||
-
|
||||
I check the residual amuont of invoice 2, should be 0 in residual currency and 0 in amount_residual and paid
|
||||
-
|
||||
!python {model: account.invoice}: |
|
||||
invoice_id = self.browse(cr, uid, ref("account_second_invoice_feb"))
|
||||
move_line_obj = self.pool.get('account.move.line')
|
||||
move_lines = move_line_obj.search(cr, uid, [('move_id', '=', invoice_id.move_id.id), ('invoice', '=', invoice_id.id), ('account_id', '=', invoice_id.account_id.id)])
|
||||
move_line = move_line_obj.browse(cr, uid, move_lines[0])
|
||||
assert (move_line.amount_residual_currency == 0.0 and move_line.amount_residual == 0.0 and invoice_id.state == 'paid') , "Residual amount is not correct for second Invoice"
|
|
@ -1,331 +0,0 @@
|
|||
-
|
||||
In order to check the Account_voucher module with multi-currency in OpenERP,
|
||||
I create 2 Invoices in EUR and make 2 Payments in EUR based on the currency rating on that particular date.
|
||||
-
|
||||
I create currency EUR in OpenERP for January of 1.000000 Rate
|
||||
-
|
||||
!record {model: res.currency.rate, id: jan_eur}:
|
||||
currency_id: base.EUR
|
||||
name: !eval "'%s-01-01' %(datetime.now().year)"
|
||||
rate: 1.000000
|
||||
-
|
||||
I create currency EUR in OpenERP for February of 1.000000 Rate
|
||||
-
|
||||
!record {model: res.currency.rate, id: feb_eur}:
|
||||
currency_id: base.EUR
|
||||
name: !eval "'%s-02-01' %(datetime.now().year)"
|
||||
rate: 1.000000
|
||||
-
|
||||
I create currency EUR in OpenERP for March of 1.000000 Rate
|
||||
-
|
||||
!record {model: res.currency.rate, id: mar_eur}:
|
||||
currency_id: base.EUR
|
||||
name: !eval "'%s-03-01' %(datetime.now().year)"
|
||||
rate: 1.000000
|
||||
-
|
||||
I create currency EUR in OpenERP for April of 1.000000 Rate
|
||||
-
|
||||
!record {model: res.currency.rate, id: apr_eur}:
|
||||
currency_id: base.EUR
|
||||
name: !eval "'%s-04-01' %(datetime.now().year)"
|
||||
rate: 1.000000
|
||||
-
|
||||
I create a bank journal with EUR as currency
|
||||
-
|
||||
!record {model: account.journal, id: bank_journal_EUR}:
|
||||
name: Bank Journal(EUR)
|
||||
code: BEUR
|
||||
type: bank
|
||||
analytic_journal_id: account.sit
|
||||
sequence_id: account.sequence_bank_journal
|
||||
default_debit_account_id: account.cash
|
||||
default_credit_account_id: account.cash
|
||||
currency: base.EUR
|
||||
company_id: base.main_company
|
||||
view_id: account.account_journal_bank_view
|
||||
-
|
||||
I set up some accounts for currency rate expense/income in my company
|
||||
-
|
||||
!record {model: res.company, id: base.main_company}:
|
||||
property_expense_currency_exchange: account.o_expense
|
||||
property_income_currency_exchange: account.o_income
|
||||
-
|
||||
I create a new partner Peter Lawson.
|
||||
-
|
||||
!record {model: res.partner, id: res_partner_peter0}:
|
||||
address:
|
||||
- city: paris
|
||||
country_id: base.fr
|
||||
name: Peter
|
||||
street: 1 rue Rockfeller
|
||||
type: invoice
|
||||
zip: '75016'
|
||||
name: Mr.Peter Lawson
|
||||
-
|
||||
I create the first invoice on 1st January for 150 EUR
|
||||
-
|
||||
!record {model: account.invoice, id: account_first_invoice_jan_eur}:
|
||||
account_id: account.a_recv
|
||||
address_contact_id: base.res_partner_address_3000
|
||||
address_invoice_id: base.res_partner_address_3000
|
||||
company_id: base.main_company
|
||||
currency_id: base.EUR
|
||||
date_invoice: !eval "'%s-01-01' %(datetime.now().year)"
|
||||
period_id: account.period_1
|
||||
invoice_line:
|
||||
- account_id: account.a_sale
|
||||
name: '[PC1] Basic PC'
|
||||
price_unit: 150.0
|
||||
quantity: 1.0
|
||||
product_id: product.product_product_pc1
|
||||
uos_id: product.product_uom_unit
|
||||
journal_id: account.sales_journal
|
||||
partner_id: res_partner_peter0
|
||||
reference_type: none
|
||||
-
|
||||
I Validate invoice by clicking on Validate button
|
||||
-
|
||||
!workflow {model: account.invoice, action: invoice_open, ref: account_first_invoice_jan_eur}
|
||||
-
|
||||
I check that first invoice move is correct for debtor account(debit - credit == 150)
|
||||
-
|
||||
!python {model: account.invoice}: |
|
||||
invoice_id = self.browse(cr, uid, ref("account_first_invoice_jan_eur"))
|
||||
assert invoice_id.move_id, "Move not created for open invoice"
|
||||
move_line_obj = self.pool.get('account.move.line')
|
||||
move_lines = move_line_obj.search(cr, uid, [('move_id', '=', invoice_id.move_id.id), ('account_id', '=', invoice_id.account_id.id)])
|
||||
move_line = move_line_obj.browse(cr, uid, move_lines[0])
|
||||
assert (move_line.debit - move_line.credit == 150.00), "Invoice move is incorrect for debtors account"
|
||||
-
|
||||
I create the second invoice on 1st February for 80 EUR
|
||||
-
|
||||
!record {model: account.invoice, id: account_second_invoice_feb_eur}:
|
||||
account_id: account.a_recv
|
||||
address_contact_id: base.res_partner_address_3000
|
||||
address_invoice_id: base.res_partner_address_3000
|
||||
company_id: base.main_company
|
||||
currency_id: base.EUR
|
||||
date_invoice: !eval "'%s-02-01' %(datetime.now().year)"
|
||||
period_id: account.period_1
|
||||
invoice_line:
|
||||
- account_id: account.a_sale
|
||||
name: '[PC1] Basic PC'
|
||||
price_unit: 80.0
|
||||
quantity: 1.0
|
||||
product_id: product.product_product_pc1
|
||||
uos_id: product.product_uom_unit
|
||||
journal_id: account.sales_journal
|
||||
partner_id: res_partner_peter0
|
||||
reference_type: none
|
||||
-
|
||||
I Validate invoice by clicking on Validate button
|
||||
-
|
||||
!workflow {model: account.invoice, action: invoice_open, ref: account_second_invoice_feb_eur}
|
||||
-
|
||||
I check that second invoice move is correct for debtor account (debit - credit == 80)
|
||||
-
|
||||
!python {model: account.invoice}: |
|
||||
invoice_id = self.browse(cr, uid, ref("account_second_invoice_feb_eur"))
|
||||
assert invoice_id.move_id, "Move not created for open invoice"
|
||||
move_line_obj = self.pool.get('account.move.line')
|
||||
move_lines = move_line_obj.search(cr, uid, [('move_id', '=', invoice_id.move_id.id), ('account_id', '=', invoice_id.account_id.id)])
|
||||
move_line = move_line_obj.browse(cr, uid, move_lines[0])
|
||||
assert (move_line.debit - move_line.credit == 80.00), "Invoice move is incorrect for debtors account"
|
||||
-
|
||||
I create the first voucher of payment
|
||||
<create with values 120 EUR, journal EUR, and fill amounts 100 for the invoice of 150 EUR and 20 for the invoice of 80 EUR>
|
||||
-
|
||||
!python {model: account.voucher}: |
|
||||
import netsvc, time
|
||||
vals = {}
|
||||
res = self.onchange_partner_id(cr, uid, [], ref("res_partner_peter0"), ref('bank_journal_EUR'), 120.00, 2, ttype='receipt', date=False)
|
||||
vals = {
|
||||
'account_id': ref('account.cash'),
|
||||
'amount': 120.00,
|
||||
'company_id': ref('base.main_company'),
|
||||
'currency_id': ref('base.EUR'),
|
||||
'journal_id': ref('bank_journal_EUR'),
|
||||
'partner_id': ref('res_partner_peter0'),
|
||||
'period_id': ref('account.period_3'),
|
||||
'type': 'receipt',
|
||||
'date': time.strftime("%Y-03-01"),
|
||||
'payment_option': 'with_writeoff',
|
||||
'writeoff_acc_id': ref('account.a_expense'),
|
||||
'comment': 'Write Off',
|
||||
'name': 'First payment',
|
||||
}
|
||||
if not res['value']['line_cr_ids']:
|
||||
res['value']['line_cr_ids'] = [{'type': 'cr', 'account_id': ref('account.a_recv'),}]
|
||||
for item in res['value']['line_cr_ids']:
|
||||
if item['amount_unreconciled'] == 150.00:
|
||||
item['amount'] = 100.00
|
||||
else:
|
||||
item['amount'] = 20.00
|
||||
vals['line_cr_ids'] = [(0,0,i) for i in res['value']['line_cr_ids']]
|
||||
id = self.create(cr, uid, vals)
|
||||
voucher_id = self.browse(cr, uid, id)
|
||||
assert (voucher_id.state=='draft'), "Voucher is not in draft state"
|
||||
-
|
||||
I check that writeoff amount computed is 0.00
|
||||
-
|
||||
!python {model: account.voucher}: |
|
||||
voucher = self.search(cr, uid, [('name', '=', 'First payment'),('partner_id', '=', ref('res_partner_peter0'))])
|
||||
voucher_id = self.browse(cr, uid, voucher[0])
|
||||
assert (voucher_id.writeoff_amount == 0.00), "Writeoff amount is not 0.00"
|
||||
-
|
||||
I check that currency rate difference is 0.00
|
||||
-
|
||||
!python {model: account.voucher}: |
|
||||
voucher = self.search(cr, uid, [('name', '=', 'First payment'),('partner_id', '=', ref('res_partner_peter0'))])
|
||||
voucher_id = self.browse(cr, uid, voucher[0])
|
||||
assert (voucher_id.currency_rate_difference == 0.00), "Currency rate difference is not 0.00"
|
||||
-
|
||||
I confirm the voucher
|
||||
-
|
||||
!python {model: account.voucher}: |
|
||||
import netsvc
|
||||
voucher = self.search(cr, uid, [('name', '=', 'First payment'),('partner_id', '=', ref('res_partner_peter0'))])
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
wf_service.trg_validate(uid, 'account.voucher', voucher[0], 'proforma_voucher', cr)
|
||||
-
|
||||
I check that the move of my first voucher is valid
|
||||
-
|
||||
!python {model: account.voucher}: |
|
||||
voucher = self.search(cr, uid, [('name', '=', 'First payment'),('partner_id', '=', ref('res_partner_peter0'))])
|
||||
voucher_id = self.browse(cr, uid, voucher[0])
|
||||
move_line_obj = self.pool.get('account.move.line')
|
||||
move_lines = move_line_obj.search(cr, uid, [('move_id', '=', voucher_id.move_id.id)])
|
||||
for move_line in move_line_obj.browse(cr, uid, move_lines):
|
||||
assert move_line.state == 'valid', "Voucher move is not valid"
|
||||
-
|
||||
I check that my debtor account is correct
|
||||
-
|
||||
I check that the debtor account has 2 new lines with 0.00 and 0.00 in amount_currency columns and their credit are 20 and 100 respectively
|
||||
-
|
||||
!python {model: account.voucher}: |
|
||||
voucher = self.search(cr, uid, [('name', '=', 'First payment'),('partner_id', '=', ref('res_partner_peter0'))])
|
||||
voucher_id = self.browse(cr, uid, voucher[0])
|
||||
move_line_obj = self.pool.get('account.move.line')
|
||||
move_lines = move_line_obj.search(cr, uid, [('move_id', '=', voucher_id.move_id.id)])
|
||||
for move_line in move_line_obj.browse(cr, uid, move_lines):
|
||||
if move_line.credit == 20.00:
|
||||
assert move_line.amount_currency == 0.00, "Debtor account has wrong entry."
|
||||
elif move_line.credit == 100.00:
|
||||
assert move_line.amount_currency == 0.00, "Debtor account has wrong entry."
|
||||
-
|
||||
I check the residual amount of Invoice1 is 50
|
||||
-
|
||||
!python {model: account.invoice}: |
|
||||
invoice_id = self.browse(cr, uid, ref("account_first_invoice_jan_eur"))
|
||||
move_line_obj = self.pool.get('account.move.line')
|
||||
move_lines = move_line_obj.search(cr, uid, [('move_id', '=', invoice_id.move_id.id), ('invoice', '=', invoice_id.id), ('account_id', '=', invoice_id.account_id.id)])
|
||||
move_line = move_line_obj.browse(cr, uid, move_lines[0])
|
||||
assert (move_line.amount_residual_currency == 50.0 and move_line.amount_residual == 50.0) , "Residual amount is not correct for first Invoice"
|
||||
-
|
||||
I check the residual amuont of Invoice2 is 60
|
||||
-
|
||||
!python {model: account.invoice}: |
|
||||
invoice_id = self.browse(cr, uid, ref("account_second_invoice_feb_eur"))
|
||||
move_line_obj = self.pool.get('account.move.line')
|
||||
move_lines = move_line_obj.search(cr, uid, [('move_id', '=', invoice_id.move_id.id), ('invoice', '=', invoice_id.id), ('account_id', '=', invoice_id.account_id.id)])
|
||||
move_line = move_line_obj.browse(cr, uid, move_lines[0])
|
||||
assert (move_line.amount_residual_currency == 60.0 and move_line.amount_residual == 60.0) , "Residual amount is not correct for second Invoice"
|
||||
-
|
||||
I create the second voucher of payment and check to let open the debtor overpaid amount.
|
||||
<create with values 120 EUR, journal EUR, and fill amounts 50 for the invoice of 150 EUR and 70 for the invoice of 80 EUR>
|
||||
-
|
||||
!python {model: account.voucher}: |
|
||||
import netsvc, time
|
||||
vals = {}
|
||||
res = self.onchange_partner_id(cr, uid, [], ref("res_partner_peter0"), ref('bank_journal_EUR'), 120.00, 2, ttype='receipt', date=False)
|
||||
vals = {
|
||||
'account_id': ref('account.cash'),
|
||||
'amount': 120.00,
|
||||
'company_id': ref('base.main_company'),
|
||||
'currency_id': ref('base.EUR'),
|
||||
'journal_id': ref('bank_journal_EUR'),
|
||||
'partner_id': ref('res_partner_peter0'),
|
||||
'period_id': ref('account.period_3'),
|
||||
'type': 'receipt',
|
||||
'date': time.strftime("%Y-04-01"),
|
||||
'payment_option': 'with_writeoff',
|
||||
'writeoff_acc_id': ref('account.a_expense'),
|
||||
'comment': 'Write Off',
|
||||
'name': 'Second payment',
|
||||
}
|
||||
if not res['value']['line_cr_ids']:
|
||||
res['value']['line_cr_ids'] = [{'type': 'cr', 'account_id': ref('account.a_recv'),}]
|
||||
for item in res['value']['line_cr_ids']:
|
||||
if item['amount_unreconciled'] == 50.00:
|
||||
item['amount'] = 50.00
|
||||
elif item['amount_unreconciled'] == 60.00:
|
||||
item['amount'] = 70.00
|
||||
vals['line_cr_ids'] = [(0,0,i) for i in res['value']['line_cr_ids']]
|
||||
id = self.create(cr, uid, vals)
|
||||
voucher_id = self.browse(cr, uid, id)
|
||||
assert (voucher_id.state=='draft'), "Voucher is not in draft state"
|
||||
-
|
||||
I check that writeoff amount computed is 0.00
|
||||
-
|
||||
!python {model: account.voucher}: |
|
||||
voucher = self.search(cr, uid, [('name', '=', 'Second payment'),('partner_id', '=', ref('res_partner_peter0'))])
|
||||
voucher_id = self.browse(cr, uid, voucher[0])
|
||||
assert (voucher_id.writeoff_amount == 0.00), "Writeoff amount is not 0"
|
||||
-
|
||||
I check that currency rate difference is 0.00
|
||||
-
|
||||
!python {model: account.voucher}: |
|
||||
voucher = self.search(cr, uid, [('name', '=', 'Second payment'), ('partner_id', '=', ref('res_partner_peter0'))])
|
||||
voucher_id = self.browse(cr, uid, voucher[0])
|
||||
assert (voucher_id.currency_rate_difference == 0.00), "Currency rate difference is not 0"
|
||||
-
|
||||
I confirm the voucher
|
||||
-
|
||||
!python {model: account.voucher}: |
|
||||
import netsvc
|
||||
voucher = self.search(cr, uid, [('name', '=', 'Second payment'), ('partner_id', '=', ref('res_partner_peter0'))])
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
wf_service.trg_validate(uid, 'account.voucher', voucher[0], 'proforma_voucher', cr)
|
||||
-
|
||||
I check that the move of my second voucher is valid
|
||||
-
|
||||
!python {model: account.voucher}: |
|
||||
voucher = self.search(cr, uid, [('name', '=', 'Second payment'), ('partner_id', '=', ref('res_partner_peter0'))])
|
||||
voucher_id = self.browse(cr, uid, voucher[0])
|
||||
move_line_obj = self.pool.get('account.move.line')
|
||||
move_lines = move_line_obj.search(cr, uid, [('move_id', '=', voucher_id.move_id.id)])
|
||||
for move_line in move_line_obj.browse(cr, uid, move_lines):
|
||||
assert move_line.state == 'valid', "Voucher move is not valid"
|
||||
-
|
||||
I check that my debtor account is correct
|
||||
-
|
||||
I check that the debtor account has 2 new lines with 0.00 and 0.00 in amount_currency columns and their credit are 70 and 50
|
||||
-
|
||||
!python {model: account.voucher}: |
|
||||
voucher = self.search(cr, uid, [('name', '=', 'Second payment'), ('partner_id', '=', ref('res_partner_peter0'))])
|
||||
voucher_id = self.browse(cr, uid, voucher[0])
|
||||
move_line_obj = self.pool.get('account.move.line')
|
||||
move_lines = move_line_obj.search(cr, uid, [('move_id', '=', voucher_id.move_id.id)])
|
||||
for move_line in move_line_obj.browse(cr, uid, move_lines):
|
||||
if move_line.credit == 70.00:
|
||||
assert move_line.amount_currency == 0.00, "Debtor account has wrong entry."
|
||||
elif move_line.credit == 50.00:
|
||||
assert move_line.amount_currency == 0.00, "Debtor account has wrong entry."
|
||||
-
|
||||
I check the residual amount of Invoice1 is 0
|
||||
-
|
||||
!python {model: account.invoice}: |
|
||||
invoice_id = self.browse(cr, uid, ref("account_first_invoice_jan_eur"))
|
||||
move_line_obj = self.pool.get('account.move.line')
|
||||
move_lines = move_line_obj.search(cr, uid, [('move_id', '=', invoice_id.move_id.id), ('invoice', '=', invoice_id.id), ('account_id', '=', invoice_id.account_id.id)])
|
||||
move_line = move_line_obj.browse(cr, uid, move_lines[0])
|
||||
assert (move_line.amount_residual_currency == 0 and move_line.amount_residual == 0) , "Residual amount is not correct for first Invoice"
|
||||
-
|
||||
I check the residual amuont of Invoice2 is -10
|
||||
-
|
||||
!python {model: account.invoice}: |
|
||||
invoice_id = self.browse(cr, uid, ref("account_second_invoice_feb_eur"))
|
||||
move_line_obj = self.pool.get('account.move.line')
|
||||
move_lines = move_line_obj.search(cr, uid, [('move_id', '=', invoice_id.move_id.id), ('invoice', '=', invoice_id.id), ('account_id', '=', invoice_id.account_id.id)])
|
||||
move_line = move_line_obj.browse(cr, uid, move_lines[0])
|
||||
assert (move_line.amount_residual_currency == -10.0 and move_line.amount_residual == -10.0) , "Residual amount is not correct for second Invoice"
|
|
@ -1,194 +0,0 @@
|
|||
-
|
||||
In order to check the Account_voucher module with multi-currency in OpenERP,
|
||||
I create an invoice in CAD and make its Payment in CHF based on the currency rating on that particular date.
|
||||
-
|
||||
I create currency CAD in OpenERP for January of 1.338800 Rate
|
||||
-
|
||||
!record {model: res.currency.rate, id: jan_cad}:
|
||||
currency_id: base.CAD
|
||||
name: !eval "'%s-01-01' %(datetime.now().year)"
|
||||
rate: 1.338800
|
||||
-
|
||||
I create currency CAD in OpenERP for March of 2.000000 Rate
|
||||
-
|
||||
!record {model: res.currency.rate, id: mar_cad}:
|
||||
currency_id: base.CAD
|
||||
name: !eval "'%s-03-01' %(datetime.now().year)"
|
||||
rate: 2.000000
|
||||
-
|
||||
I create currency CHF in OpenERP for January of 1.308600 Rate
|
||||
-
|
||||
!record {model: res.currency.rate, id: jan_chf}:
|
||||
currency_id: base.CHF
|
||||
name: !eval "'%s-01-01' %(datetime.now().year)"
|
||||
rate: 1.308600
|
||||
-
|
||||
I create currency CHF in OpenERP for March of 1.250000 Rate
|
||||
-
|
||||
!record {model: res.currency.rate, id: mar_chf}:
|
||||
currency_id: base.CHF
|
||||
name: !eval "'%s-03-01' %(datetime.now().year)"
|
||||
rate: 1.250000
|
||||
-
|
||||
I create a bank journal with CHF as currency
|
||||
-
|
||||
!record {model: account.journal, id: bank_journal_CHF}:
|
||||
name: Bank Journal(CHF)
|
||||
code: BCHF
|
||||
type: bank
|
||||
analytic_journal_id: account.sit
|
||||
sequence_id: account.sequence_bank_journal
|
||||
default_debit_account_id: account.cash
|
||||
default_credit_account_id: account.cash
|
||||
currency: base.CHF
|
||||
company_id: base.main_company
|
||||
view_id: account.account_journal_bank_view
|
||||
-
|
||||
I set up some accounts for currency rate expense/income in my company
|
||||
-
|
||||
!record {model: res.company, id: base.main_company}:
|
||||
property_expense_currency_exchange: account.o_expense
|
||||
property_income_currency_exchange: account.o_income
|
||||
-
|
||||
I create a new partner John Armani.
|
||||
-
|
||||
!record {model: res.partner, id: res_partner_john0}:
|
||||
address:
|
||||
- city: paris
|
||||
country_id: base.fr
|
||||
name: John
|
||||
street: 1 rue Rockfeller
|
||||
type: invoice
|
||||
zip: '75016'
|
||||
name: Mr.John Armani
|
||||
-
|
||||
I create the first invoice on 1st January for 200 CAD
|
||||
-
|
||||
!record {model: account.invoice, id: account_first_invoice_jan_cad}:
|
||||
account_id: account.a_recv
|
||||
address_contact_id: base.res_partner_address_3000
|
||||
address_invoice_id: base.res_partner_address_3000
|
||||
company_id: base.main_company
|
||||
currency_id: base.CAD
|
||||
date_invoice: !eval "'%s-01-01' %(datetime.now().year)"
|
||||
period_id: account.period_1
|
||||
invoice_line:
|
||||
- account_id: account.a_sale
|
||||
name: '[PC1] Basic PC'
|
||||
price_unit: 200.0
|
||||
quantity: 1.0
|
||||
product_id: product.product_product_pc1
|
||||
uos_id: product.product_uom_unit
|
||||
journal_id: account.sales_journal
|
||||
partner_id: res_partner_john0
|
||||
reference_type: none
|
||||
-
|
||||
I Validate invoice by clicking on Validate button
|
||||
-
|
||||
!workflow {model: account.invoice, action: invoice_open, ref: account_first_invoice_jan_cad}
|
||||
-
|
||||
I check that first invoice move is correct for debtor account (debit - credit == 149.39)
|
||||
-
|
||||
!python {model: account.invoice}: |
|
||||
invoice_id = self.browse(cr, uid, ref("account_first_invoice_jan_cad"))
|
||||
assert invoice_id.move_id, "Move not created for open invoice"
|
||||
move_line_obj = self.pool.get('account.move.line')
|
||||
move_lines = move_line_obj.search(cr, uid, [('move_id', '=', invoice_id.move_id.id), ('account_id', '=', invoice_id.account_id.id)])
|
||||
move_line = move_line_obj.browse(cr, uid, move_lines[0])
|
||||
assert (move_line.debit - move_line.credit == 149.39), "Invoice move is incorrect for debtors account"
|
||||
-
|
||||
I create the first voucher of payment
|
||||
<create with values 300 CHF, journal CHF, and fill amounts 200 for the invoice of 200 CAD>
|
||||
-
|
||||
!python {model: account.voucher}: |
|
||||
import netsvc, time
|
||||
vals = {}
|
||||
res = self.onchange_partner_id(cr, uid, [], ref("res_partner_john0"), ref('bank_journal_CHF'), 300.00, 2, ttype='receipt', date=False)
|
||||
vals = {
|
||||
'account_id': ref('account.cash'),
|
||||
'amount': 300.00,
|
||||
'company_id': ref('base.main_company'),
|
||||
'currency_id': ref('base.CHF'),
|
||||
'journal_id': ref('bank_journal_CHF'),
|
||||
'partner_id': ref('res_partner_john0'),
|
||||
'period_id': ref('account.period_3'),
|
||||
'type': 'receipt',
|
||||
'date': time.strftime("%Y-03-01"),
|
||||
'payment_option': 'with_writeoff',
|
||||
'writeoff_acc_id': ref('account.a_expense'),
|
||||
'comment': 'Write Off',
|
||||
'name': 'First payment',
|
||||
}
|
||||
if not res['value']['line_cr_ids']:
|
||||
res['value']['line_cr_ids'] = [{'type': 'cr', 'account_id': ref('account.a_recv'),}]
|
||||
for item in res['value']['line_cr_ids']:
|
||||
if item['amount_unreconciled'] == 200.00:
|
||||
item['amount'] = 200.00
|
||||
vals['line_cr_ids'] = [(0,0,i) for i in res['value']['line_cr_ids']]
|
||||
id = self.create(cr, uid, vals)
|
||||
voucher_id = self.browse(cr, uid, id)
|
||||
assert (voucher_id.state=='draft'), "Voucher is not in draft state"
|
||||
-
|
||||
I check that writeoff amount computed is 175.0
|
||||
-
|
||||
!python {model: account.voucher}: |
|
||||
voucher = self.search(cr, uid, [('name', '=', 'First payment'), ('partner_id', '=', ref('res_partner_john0'))])
|
||||
voucher_id = self.browse(cr, uid, voucher[0])
|
||||
assert (voucher_id.writeoff_amount == 175.0), "Writeoff amount is not 175.0"
|
||||
-
|
||||
I check that currency rate difference is 49.39
|
||||
-
|
||||
!python {model: account.voucher}: |
|
||||
voucher = self.search(cr, uid, [('name', '=', 'First payment'), ('partner_id', '=', ref('res_partner_john0'))])
|
||||
voucher_id = self.browse(cr, uid, voucher[0])
|
||||
curr_diff = float(str(voucher_id.currency_rate_difference))
|
||||
assert (curr_diff == 49.39), "Currency rate difference is not 49.39"
|
||||
-
|
||||
I confirm the voucher
|
||||
-
|
||||
!python {model: account.voucher}: |
|
||||
import netsvc
|
||||
voucher = self.search(cr, uid, [('name', '=', 'First payment'), ('partner_id', '=', ref('res_partner_john0'))])
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
wf_service.trg_validate(uid, 'account.voucher', voucher[0], 'proforma_voucher', cr)
|
||||
-
|
||||
I check that the move of my voucher is valid
|
||||
-
|
||||
!python {model: account.voucher}: |
|
||||
voucher = self.search(cr, uid, [('name', '=', 'First payment'), ('partner_id', '=', ref('res_partner_john0'))])
|
||||
voucher_id = self.browse(cr, uid, voucher[0])
|
||||
move_line_obj = self.pool.get('account.move.line')
|
||||
move_lines = move_line_obj.search(cr, uid, [('move_id', '=', voucher_id.move_id.id)])
|
||||
for move_line in move_line_obj.browse(cr, uid, move_lines):
|
||||
assert move_line.state == 'valid', "Voucher move is not valid"
|
||||
assert voucher_id.state == 'posted', "Voucher state is not posted"
|
||||
-
|
||||
I check that my debtor account is correct
|
||||
-
|
||||
I check that the debtor account has 1 new line with -200 as amount_currency columns and 149.39 of credit and currency is CAD($).
|
||||
-
|
||||
I check that my currency rate difference is correct. 49.39 in debit with no amount_currency
|
||||
-
|
||||
I check that my writeoff is correct. 140 credit and -175 amount_currency
|
||||
-
|
||||
!python {model: account.voucher}: |
|
||||
voucher = self.search(cr, uid, [('name', '=', 'First payment'), ('partner_id', '=', ref('res_partner_john0'))])
|
||||
voucher_id = self.browse(cr, uid, voucher[0])
|
||||
move_line_obj = self.pool.get('account.move.line')
|
||||
move_lines = move_line_obj.search(cr, uid, [('move_id', '=', voucher_id.move_id.id)])
|
||||
for move_line in move_line_obj.browse(cr, uid, move_lines):
|
||||
if move_line.amount_currency == -200:
|
||||
assert move_line.credit == 149.39, "Debtor account has wrong entry."
|
||||
elif move_line.debit == 49.39:
|
||||
assert move_line.amount_currency == 0.00, "Incorrect Currency Difference."
|
||||
elif move_line.credit == 140.00:
|
||||
assert move_line.amount_currency == -175.00, "Writeoff amount is wrong."
|
||||
-
|
||||
I check the residual amount of Invoice1, should be 0 in residual currency and 0 in amount_residual and paid
|
||||
-
|
||||
!python {model: account.invoice}: |
|
||||
invoice_id = self.browse(cr, uid, ref("account_first_invoice_jan_cad"))
|
||||
move_line_obj = self.pool.get('account.move.line')
|
||||
move_lines = move_line_obj.search(cr, uid, [('move_id', '=', invoice_id.move_id.id), ('invoice', '=', invoice_id.id), ('account_id', '=', invoice_id.account_id.id)])
|
||||
move_line = move_line_obj.browse(cr, uid, move_lines[0])
|
||||
assert (move_line.amount_residual_currency == 0.0 and move_line.amount_residual == 0.0 and invoice_id.state == 'paid') , "Residual amount is not correct for first Invoice"
|
|
@ -74,24 +74,14 @@
|
|||
<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, date, context)"
|
||||
string="Supplier"/>
|
||||
<field name="partner_id" required="1" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date)" context="{'invoice_currency':currency_id}" string="Supplier"/>
|
||||
<field name="amount" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date)"/>
|
||||
<field name="journal_id"
|
||||
domain="[('type','in',['bank', 'cash'])]"
|
||||
widget="selection" select="1"
|
||||
on_change="onchange_partner_id(partner_id, journal_id, amount,
|
||||
currency_id, type, date, context)"
|
||||
on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date)"
|
||||
string="Payment Method"/>
|
||||
<field name="amount"
|
||||
on_change="onchange_partner_id(partner_id, journal_id, amount,
|
||||
currency_id, type, date, context)"/>
|
||||
<field name="date"
|
||||
select="1"
|
||||
on_change="onchange_date(partner_id, journal_id, amount,
|
||||
currency_id, type, date, context)"/>
|
||||
<field name="date" select="1" on_change="onchange_date(partner_id, journal_id, amount, currency_id, type, date)"/>
|
||||
<field name="reference" select="1" string="Payment Ref"/>
|
||||
<field name="name" colspan="2"/>
|
||||
<field name="account_id"
|
||||
|
@ -104,37 +94,25 @@
|
|||
<page string="Payment Information">
|
||||
<field name="line_dr_ids" attrs="{'invisible': [('type', '=', 'receipt')]}" default_get="{'journal_id':journal_id, 'type':type, 'partner_id':partner_id}" colspan="4" nolabel="1" height="140" on_change="onchange_line_ids(line_dr_ids, line_cr_ids, amount)">
|
||||
<tree string="Open Supplier Journal Entries" editable="bottom">
|
||||
<field name="move_line_id" required="1" context="{'journal_id':parent.journal_id, 'partner_id':parent.partner_id}"
|
||||
<field name="move_line_id" context="{'journal_id':parent.journal_id, 'partner_id':parent.partner_id}"
|
||||
on_change="onchange_move_line_id(move_line_id)"
|
||||
domain="[('account_id.type','=','payable'), ('reconcile_id','=', False), ('partner_id','=',parent.partner_id)]"
|
||||
/>
|
||||
<field name="account_id" groups="base.group_extended" domain="[('type','=','payable')]" invisible="1"/>
|
||||
<field name="account_id" groups="base.group_extended" domain="[('type','=','payable')]"/>
|
||||
<field name="date_original" readonly="1"/>
|
||||
<field name="date_due" readonly="1"/>
|
||||
<field name="currency_id" readonly="1"/>
|
||||
<field name="amount_original" readonly="1" invisible="1"/>
|
||||
<field name="amount_unreconciled" readonly="1"/>
|
||||
<field name="amount" on_change="onchange_amount(amount)"/>
|
||||
<field name="amount_in_voucher_currency" readonly="1" groups="base.group_no_one"/>
|
||||
<field name="voucher_currency_id" readonly="1" groups="base.group_no_one"/>
|
||||
<field name="amount_in_company_currency" readonly="1" invisible="1"/>
|
||||
<field name="company_currency_id" readonly="1" invisible="1"/>
|
||||
<field name="amount_original" readonly="1"/>
|
||||
<field name="amount_unreconciled" sum="Open Balance" readonly="1"/>
|
||||
<field name="amount" sum="Payment"/>
|
||||
</tree>
|
||||
</field>
|
||||
<field name="line_cr_ids" colspan="4" nolabel="1" attrs="{'invisible': [('type', '=', 'payment')]}" default_get="{'journal_id':journal_id, 'partner_id':partner_id}" on_change="onchange_line_ids(line_dr_ids, line_cr_ids, amount)">
|
||||
<tree string="Open Customer Journal Entries" editable="bottom">
|
||||
<field name="move_line_id" required="1"/>
|
||||
<field name="move_line_id"/>
|
||||
<field name="account_id" groups="base.group_extended" domain="[('type','=','receivable')]"/>
|
||||
<field name="date_original" readonly="1"/>
|
||||
<field name="date_due" readonly="1"/>
|
||||
<field name="currency_id" readonly="1"/>
|
||||
<field name="amount_original" readonly="1" invisible="1"/>
|
||||
<field name="amount_unreconciled" readonly="1"/>
|
||||
<field name="amount" on_change="onchange_amount(amount)"/>
|
||||
<field name="amount_in_voucher_currency" readonly="1" groups="base.group_no_one"/>
|
||||
<field name="voucher_currency_id" readonly="1" groups="base.group_no_one"/>
|
||||
<field name="amount_in_company_currency" readonly="1" invisible="1"/>
|
||||
<field name="company_currency_id" readonly="1" invisible="1"/>
|
||||
<field name="date_original"/>
|
||||
<field name="amount_original"/>
|
||||
<field name="amount" sum="Payment"/>
|
||||
</tree>
|
||||
</field>
|
||||
<group col="2" colspan="3">
|
||||
|
@ -159,28 +137,15 @@
|
|||
<field name="arch" type="xml">
|
||||
<form string="Bill Payment">
|
||||
<group col="6" colspan="4">
|
||||
<field name="partner_id"
|
||||
domain="[('supplier','=',True)]"
|
||||
required="1"
|
||||
invisible="context.get('line_type', False)"
|
||||
on_change="onchange_partner_id(partner_id, journal_id, amount,
|
||||
currency_id, type, date, context)"
|
||||
string="Supplier"/>
|
||||
<field name="partner_id" domain="[('supplier','=',True)]" required="1" invisible="context.get('line_type', False)" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date)" context="{'invoice_currency':currency_id}" string="Supplier"/>
|
||||
<field name="amount" invisible="context.get('line_type', False)" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date)"/>
|
||||
<field name="journal_id"
|
||||
domain="[('type','in',['bank', 'cash'])]"
|
||||
invisible="context.get('line_type', False)"
|
||||
widget="selection" select="1"
|
||||
on_change="onchange_partner_id(partner_id, journal_id, amount,
|
||||
currency_id, type, date, context)"
|
||||
on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date)"
|
||||
string="Payment Method"/>
|
||||
<field name="amount"
|
||||
invisible="context.get('line_type', False)"
|
||||
on_change="onchange_partner_id(partner_id, journal_id, amount,
|
||||
currency_id, type, date, context)"/>
|
||||
<field name="date"
|
||||
invisible="context.get('line_type', False)"
|
||||
on_change="onchange_date(partner_id, journal_id, amount,
|
||||
currency_id, type, date, context)"/>
|
||||
<field name="date" select="1" invisible="context.get('line_type', False)" on_change="onchange_date(partner_id, journal_id, amount, currency_id, type, date)"/>
|
||||
<field name="reference" select="1" invisible="context.get('line_type', False)" string="Payment Ref"/>
|
||||
<field name="name" colspan="2" invisible="context.get('line_type', False)"/>
|
||||
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
|
||||
|
@ -194,37 +159,26 @@
|
|||
<page string="Payment Information">
|
||||
<field name="line_dr_ids" default_get="{'journal_id':journal_id, 'type':type, 'partner_id':partner_id}" colspan="4" nolabel="1" height="140">
|
||||
<tree string="Supplier Invoices and Outstanding transactions" editable="bottom">
|
||||
<field name="move_line_id" required="1" context="{'journal_id':parent.journal_id, 'partner_id':parent.partner_id}"
|
||||
<field name="move_line_id" context="{'journal_id':parent.journal_id, 'partner_id':parent.partner_id}"
|
||||
on_change="onchange_move_line_id(move_line_id)"
|
||||
domain="[('account_id.type','=','payable'), ('reconcile_id','=', False), ('partner_id','=',parent.partner_id)]"
|
||||
required="1"
|
||||
/>
|
||||
<field name="account_id" groups="base.group_extended" domain="[('type','=','payable')]"/>
|
||||
<field name="account_id" groups="base.group_no_one" domain="[('type','=','payable')]"/>
|
||||
<field name="date_original" readonly="1"/>
|
||||
<field name="date_due" readonly="1"/>
|
||||
<field name="currency_id" readonly="1"/>
|
||||
<field name="amount_original" readonly="1" invisible="1"/>
|
||||
<field name="amount_unreconciled" readonly="1"/>
|
||||
<field name="amount" on_change="onchange_amount(amount)"/>
|
||||
<field name="amount_in_voucher_currency" readonly="1" groups="base.group_no_one"/>
|
||||
<field name="voucher_currency_id" readonly="1" groups="base.group_no_one"/>
|
||||
<field name="amount_in_company_currency" readonly="1" invisible="1"/>
|
||||
<field name="company_currency_id" readonly="1" invisible="1"/>
|
||||
<field name="amount_original" readonly="1"/>
|
||||
<field name="amount_unreconciled" sum="Open Balance" readonly="1"/>
|
||||
<field name="amount" sum="Payment"/>
|
||||
</tree>
|
||||
</field>
|
||||
<field name="line_cr_ids" colspan="4" nolabel="1" attrs="{'invisible': [('pre_line','=',False)]}" default_get="{'journal_id':journal_id, 'partner_id':partner_id}">
|
||||
<tree string="Credits" editable="bottom">
|
||||
<field name="move_line_id" required="1"/>
|
||||
<field name="move_line_id"/>
|
||||
<field name="account_id" groups="base.group_extended" domain="[('type','=','receivable')]"/>
|
||||
<field name="date_original" readonly="1"/>
|
||||
<field name="date_due" readonly="1"/>
|
||||
<field name="currency_id" readonly="1"/>
|
||||
<field name="amount_original" readonly="1" invisible="1"/>
|
||||
<field name="amount_unreconciled" readonly="1"/>
|
||||
<field name="amount" on_change="onchange_amount(amount)"/>
|
||||
<field name="amount_in_voucher_currency" readonly="1" groups="base.group_no_one"/>
|
||||
<field name="voucher_currency_id" readonly="1" groups="base.group_no_one"/>
|
||||
<field name="amount_in_company_currency" readonly="1" invisible="1"/>
|
||||
<field name="company_currency_id" readonly="1" invisible="1"/>
|
||||
<field name="date_original"/>
|
||||
<field name="amount_original"/>
|
||||
<field name="amount" sum="Payment"/>
|
||||
</tree>
|
||||
</field>
|
||||
<group col="2" colspan="3">
|
||||
|
@ -232,26 +186,27 @@
|
|||
<field name="narration" colspan="2" nolabel="1"/>
|
||||
</group>
|
||||
<group col="2" colspan="1">
|
||||
<group col="4" colspan="1">
|
||||
<separator string="Payment Options" colspan="4"/>
|
||||
<field name="payment_option" required="1" colspan="4"/>
|
||||
<field name="currency_rate_difference" attrs="{'invisible':[('payment_option','!=','with_writeoff')]}"/>
|
||||
<field name="company_currency" attrs="{'invisible':[('payment_option','!=','with_writeoff')]}" nolabel="1"/><newline/>
|
||||
<group col="2" colspan="1">
|
||||
<field name="exchange_acc_id"
|
||||
attrs="{'invisible':[('currency_id','=',False)]}"
|
||||
domain="[('type','=','other')]"/>
|
||||
<field name="analytic_id"
|
||||
groups="analytic.group_analytic_accounting"/>
|
||||
<separator string="Payment Options" colspan="2"/>
|
||||
<field name="payment_option" required="1"/>
|
||||
<field name="writeoff_amount"
|
||||
attrs="{'invisible':[('payment_option','!=','with_writeoff')]}"/>
|
||||
<field name="currency_id2" nolabel="1" attrs="{'invisible':[('payment_option','!=','with_writeoff')]}"/><newline/>
|
||||
<field name="writeoff_acc_id"
|
||||
attrs="{'invisible':[('payment_option','!=','with_writeoff')], 'required':[('payment_option','=','with_writeoff')]}"
|
||||
domain="[('type','=','other')]" colspan="4"/>
|
||||
domain="[('type','=','other')]"/>
|
||||
<field name="comment"
|
||||
attrs="{'invisible':[('payment_option','!=','with_writeoff')]}" colspan="4"/>
|
||||
<field name="analytic_id"
|
||||
attrs="{'invisible':[('payment_option','!=','with_writeoff')]}"
|
||||
groups="analytic.group_analytic_accounting" colspan="4"/>
|
||||
attrs="{'invisible':[('payment_option','!=','with_writeoff')]}"/>
|
||||
|
||||
</group>
|
||||
<separator string="Other Information" colspan="2"/>
|
||||
<group col="4" colspan="1">
|
||||
<group col="2" colspan="1">
|
||||
<field name="number"/>
|
||||
<field name="currency_id" invisible="1"/>
|
||||
</group>
|
||||
</group>
|
||||
</page>
|
||||
|
@ -280,7 +235,7 @@
|
|||
</page>
|
||||
</notebook>
|
||||
<group col="10" colspan="4">
|
||||
<field name="state"/>
|
||||
<field name="state" widget="statusbar" statusbar_visible="draft,posted" statusbar_colors='{"proforma":"blue"}'/>
|
||||
<button name="cancel_voucher" string="Cancel" states="draft,proforma" icon="gtk-cancel" invisible="context.get('line_type', False)"/>
|
||||
<button name="cancel_voucher" string="Unreconcile" type="object" states="posted" icon="terp-stock_effects-object-colorize" invisible="context.get('line_type', False)" confirm="Are you sure to unreconcile this record ?"/>
|
||||
<button name="action_cancel_draft" type="object" states="cancel" string="Set to Draft" icon="terp-stock_effects-object-colorize" invisible="context.get('line_type', False)"/>
|
||||
|
@ -318,88 +273,57 @@
|
|||
id="menu_action_vendor_payment" parent="account.menu_finance_payables"/>
|
||||
|
||||
<record model="ir.ui.view" id="view_vendor_receipt_form">
|
||||
<field name="name">voucher.form.customer.payment</field>
|
||||
<field name="name">account.voucher.receipt.form</field>
|
||||
<field name="model">account.voucher</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Customer Payment">
|
||||
<group col="12" colspan="4">
|
||||
<field name="partner_id"
|
||||
colspan="4"
|
||||
required="1"
|
||||
invisible="context.get('line_type', False)"
|
||||
on_change="onchange_partner_id(partner_id, journal_id, amount,
|
||||
currency_id, type, date, context)"
|
||||
string="Customer"/>
|
||||
<group col="6" colspan="4">
|
||||
<field name="partner_id" required="1" invisible="context.get('line_type', False)" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date)" string="Customer"/>
|
||||
<field name="amount"
|
||||
invisible="context.get('line_type', False)"
|
||||
string="Paid Amount"
|
||||
on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date)"/>
|
||||
<field name="journal_id"
|
||||
domain="[('type','in',['bank', 'cash'])]"
|
||||
invisible="context.get('line_type', False)"
|
||||
widget="selection"
|
||||
select="1"
|
||||
on_change="onchange_partner_id(partner_id, journal_id, amount,
|
||||
currency_id, type, date, context)"
|
||||
string="Payment Method"
|
||||
colspan="4"/>
|
||||
<field name="amount"
|
||||
colspan="1"
|
||||
invisible="context.get('line_type', False)"
|
||||
string="Paid Amount"
|
||||
on_change="onchange_partner_id(partner_id, journal_id, amount,
|
||||
currency_id, type, date, context)"/>
|
||||
<field name="currency_id" nolabel="1" invisible="1"/>
|
||||
<field name="date"
|
||||
colspan="4"
|
||||
select="1"
|
||||
invisible="context.get('line_type', False)"
|
||||
on_change="onchange_date(partner_id, journal_id, amount,
|
||||
currency_id, type, date, context)"/>
|
||||
<field name="reference" colspan="4" select="1" invisible="context.get('line_type', False)" string="Payment Ref"/>
|
||||
<field name="name" colspan="4" invisible="context.get('line_type', False)"/>
|
||||
<field name="company_id" colspan="4" widget="selection" groups="base.group_multi_company"/>
|
||||
<field name="account_id" colspan="4"
|
||||
widget="selection" select="1"
|
||||
on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date)"
|
||||
string="Payment Method"/>
|
||||
<field name="date" select="1" invisible="context.get('line_type', False)" on_change="onchange_date(partner_id, journal_id, amount, currency_id, type, date)"/>
|
||||
<field name="reference" select="1" invisible="context.get('line_type', False)" string="Payment Ref"/>
|
||||
<field name="name" colspan="2" invisible="context.get('line_type', False)"/>
|
||||
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
|
||||
<field name="account_id"
|
||||
widget="selection"
|
||||
invisible="True"/>
|
||||
<field name="pre_line" colspan="4" invisible="1"/>
|
||||
<field name="type" colspan="4" invisible="True"/>
|
||||
<field name="pre_line" invisible="1"/>
|
||||
<field name="type" invisible="True"/>
|
||||
</group>
|
||||
<notebook colspan="4">
|
||||
<page string="Payment Information">
|
||||
<field name="line_cr_ids" default_get="{'journal_id':journal_id, 'type':type, 'partner_id':partner_id}" colspan="4" nolabel="1" height="140" on_change="onchange_line_ids(line_dr_ids, line_cr_ids, amount, date, context)">
|
||||
<field name="line_cr_ids" default_get="{'journal_id':journal_id, 'type':type, 'partner_id':partner_id}" colspan="4" nolabel="1" height="140" on_change="onchange_line_ids(line_dr_ids, line_cr_ids, amount)">
|
||||
<tree string="Invoices and outstanding transactions" editable="bottom">
|
||||
<field name="move_line_id" required="1" context="{'journal_id':parent.journal_id, 'partner_id':parent.partner_id}"
|
||||
<field name="move_line_id" context="{'journal_id':parent.journal_id, 'partner_id':parent.partner_id}"
|
||||
on_change="onchange_move_line_id(move_line_id)"
|
||||
domain="[('account_id.type','in',('receivable','payable')), ('reconcile_id','=', False), ('partner_id','=',parent.partner_id)]"
|
||||
required="1"
|
||||
/>
|
||||
<field name="account_id" groups="base.group_extended" domain="[('type','=','receivable')]" invisible="1"/>
|
||||
<field name="account_id" groups="base.group_no_one" domain="[('type','=','receivable')]"/>
|
||||
<field name="date_original" readonly="1"/>
|
||||
<field name="date_due" readonly="1"/>
|
||||
<field name="currency_id" readonly="1"/>
|
||||
<field name="amount_original" readonly="1" invisible="1"/>
|
||||
<field name="amount_unreconciled" readonly="1"/>
|
||||
<field name="amount" on_change="onchange_amount(amount)"/>
|
||||
<field name="amount_in_voucher_currency" readonly="1" groups="base.group_no_one"/>
|
||||
<field name="voucher_currency_id" readonly="1" groups="base.group_no_one"/>
|
||||
<field name="amount_in_company_currency" readonly="1" invisible="1"/>
|
||||
<field name="company_currency_id" readonly="1" invisible="1"/>
|
||||
<field name="amount_original" readonly="1"/>
|
||||
<field name="amount_unreconciled" sum="Open Balance" readonly="1"/>
|
||||
<field name="amount" sum="Payment"/>
|
||||
</tree>
|
||||
</field>
|
||||
<field name="line_dr_ids" colspan="4" nolabel="1" attrs="{'invisible': [('pre_line','=',False)]}" default_get="{'journal_id':journal_id, 'partner_id':partner_id}" on_change="onchange_line_ids(line_dr_ids, line_cr_ids, amount, date, context)">
|
||||
<field name="line_dr_ids" colspan="4" nolabel="1" attrs="{'invisible': [('pre_line','=',False)]}" default_get="{'journal_id':journal_id, 'partner_id':partner_id}" on_change="onchange_line_ids(line_dr_ids, line_cr_ids, amount)">
|
||||
<tree string="Credits" editable="bottom">
|
||||
<field name="move_line_id" required="1" context="{'journal_id':parent.journal_id, 'partner_id':parent.partner_id}"
|
||||
on_change="onchange_move_line_id(move_line_id)"
|
||||
domain="[('account_id.type','in',('receivable','payable')), ('reconcile_id','=', False), ('partner_id','=',parent.partner_id)]"
|
||||
/>
|
||||
<field name="account_id" groups="base.group_extended" domain="[('type','=','receivable')]" invisible="1"/>
|
||||
<field name="date_original" readonly="1"/>
|
||||
<field name="date_due" readonly="1"/>
|
||||
<field name="currency_id" readonly="1"/>
|
||||
<field name="amount_original" readonly="1" invisible="1"/>
|
||||
<field name="amount_unreconciled" readonly="1"/>
|
||||
<field name="amount" on_change="onchange_amount(amount)"/>
|
||||
<field name="amount_in_voucher_currency" readonly="1" groups="base.group_no_one"/>
|
||||
<field name="voucher_currency_id" readonly="1" groups="base.group_no_one"/>
|
||||
<field name="amount_in_company_currency" readonly="1" invisible="1"/>
|
||||
<field name="company_currency_id" readonly="1" invisible="1"/>
|
||||
<field name="move_line_id"/>
|
||||
<field name="account_id" groups="base.group_extended" domain="[('type','=','receivable')]"/>
|
||||
<field name="date_original"/>
|
||||
<field name="amount_original"/>
|
||||
<field name="amount" sum="Payment"/>
|
||||
</tree>
|
||||
</field>
|
||||
<group col="2" colspan="3">
|
||||
|
@ -407,22 +331,21 @@
|
|||
<field name="narration" colspan="2" nolabel="1"/>
|
||||
</group>
|
||||
<group col="2" colspan="1">
|
||||
<group col="4" colspan="1">
|
||||
<separator string="Payment Options" colspan="4"/>
|
||||
<field name="payment_option" required="1" colspan="4"/>
|
||||
<field name="currency_rate_difference" attrs="{'invisible':[('payment_option','!=','with_writeoff')]}"/>
|
||||
<field name="company_currency" attrs="{'invisible':[('payment_option','!=','with_writeoff')]}" nolabel="1"/><newline/>
|
||||
<group col="2" colspan="1">
|
||||
<separator string="Payment Options" colspan="2"/>
|
||||
<field name="analytic_id"
|
||||
groups="analytic.group_analytic_accounting"/>
|
||||
<field name="exchange_acc_id"
|
||||
attrs="{'invisible':[('currency_id','=',False)]}"
|
||||
domain="[('type','=','other')]"/>
|
||||
<field name="payment_option" required="1"/>
|
||||
<field name="writeoff_amount"
|
||||
attrs="{'invisible':[('payment_option','!=','with_writeoff')]}"/>
|
||||
<field name="currency_id2" nolabel="1" attrs="{'invisible':[('payment_option','!=','with_writeoff')]}"/><newline/>
|
||||
<field name="writeoff_acc_id"
|
||||
attrs="{'invisible':[('payment_option','!=','with_writeoff')], 'required':[('payment_option','=','with_writeoff')]}"
|
||||
domain="[('type','=','other')]" colspan="4"/>
|
||||
domain="[('type','=','other')]"/>
|
||||
<field name="comment"
|
||||
attrs="{'invisible':[('payment_option','!=','with_writeoff')]}" colspan="4"/>
|
||||
<field name="analytic_id"
|
||||
attrs="{'invisible':[('payment_option','!=','with_writeoff')]}"
|
||||
groups="analytic.group_analytic_accounting" colspan="4"/>
|
||||
attrs="{'invisible':[('payment_option','!=','with_writeoff')]}"/>
|
||||
</group>
|
||||
<separator string="Other Information" colspan="2"/>
|
||||
<group col="4" colspan="1">
|
||||
|
@ -455,7 +378,7 @@
|
|||
</page>
|
||||
</notebook>
|
||||
<group col="10" colspan="4">
|
||||
<field name="state"/>
|
||||
<field name="state" widget="statusbar" statusbar_visible="draft,posted" statusbar_colors='{"proforma":"blue"}'/>
|
||||
<button name="cancel_voucher" string="Cancel" states="draft,proforma" icon="gtk-cancel" invisible="context.get('line_type', False)"/>
|
||||
<button name="cancel_voucher" string="Unreconcile" type="object" states="posted" invisible="context.get('line_type', False)" icon="terp-stock_effects-object-colorize" confirm="Are you sure to unreconcile this record ?"/>
|
||||
<button name="action_cancel_draft" type="object" states="cancel" string="Set to Draft" icon="terp-stock_effects-object-colorize" invisible="context.get('line_type', False)"/>
|
||||
|
|
|
@ -83,7 +83,7 @@
|
|||
<form string="Sales Receipt">
|
||||
<group col="6" colspan="4">
|
||||
<field name="partner_id" required="1" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date)" string="Customer"/>
|
||||
<field name="date" on_change="onchange_date(partner_id, journal_id, amount, currency_id, type, date, context)"/>
|
||||
<field name="date" on_change="onchange_date(partner_id, journal_id, amount, currency_id, type, date)"/>
|
||||
<field name="journal_id" domain="[('type','in',['sale','sale_refund'])]" widget="selection" on_change="onchange_journal(journal_id, line_cr_ids, tax_id, partner_id)"/>
|
||||
<field name="number"/>
|
||||
<field name="name" colspan="2"/>
|
||||
|
@ -149,7 +149,7 @@
|
|||
</page>
|
||||
</notebook>
|
||||
<group col="8" colspan="4">
|
||||
<field name="state"/>
|
||||
<field name="state" widget="statusbar" statusbar_visible="draft,posted" statusbar_colors='{"proforma":"blue"}'/>
|
||||
<button name="cancel_voucher" string="Cancel" states="draft,proforma" icon="gtk-cancel"/>
|
||||
<button name="cancel_voucher" string="Cancel" type="object" states="posted" icon="terp-stock_effects-object-colorize" confirm="Are you sure to confirm this record ?"/>
|
||||
<button name="proforma_voucher" string="Validate" states="draft" icon="gtk-go-forward"/>
|
||||
|
@ -210,7 +210,7 @@
|
|||
<form string="Supplier Voucher">
|
||||
<group col="6" colspan="4">
|
||||
<field name="partner_id" domain="[('supplier','=',True)]" required="1" string="Supplier" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date)"/>
|
||||
<field name="date" string="Bill Date" select="1" on_change="onchange_date(partner_id, journal_id, amount, currency_id, type, date, context)"/>
|
||||
<field name="date" string="Bill Date" select="1" on_change="onchange_date(partner_id, journal_id, amount, currency_id, type, date)"/>
|
||||
<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="2"/>
|
||||
|
@ -270,7 +270,7 @@
|
|||
</page>
|
||||
</notebook>
|
||||
<group col="10" colspan="4">
|
||||
<field name="state"/>
|
||||
<field name="state" widget="statusbar" statusbar_visible="draft,posted" statusbar_colors='{"proforma":"blue"}'/>
|
||||
<button name="cancel_voucher" string="Cancel" states="draft,proforma" icon="gtk-cancel"/>
|
||||
<button name="cancel_voucher" string="Cancel" type="object" states="posted" icon="terp-stock_effects-object-colorize" confirm="Are you sure to confirm this record ?"/>
|
||||
<group attrs="{'invisible':['|', ('state','!=','posted'), ('paid','=',True)]}">
|
||||
|
|
|
@ -75,7 +75,7 @@ class account_statement_from_invoice_lines(osv.osv_memory):
|
|||
statement.currency.id, amount, context=ctx)
|
||||
|
||||
context.update({'move_line_ids': [line.id]})
|
||||
result = voucher_obj.onchange_partner_id(cr, uid, [], partner_id=line.partner_id.id, journal_id=statement.journal_id.id, price=abs(amount), voucher_currency_id= statement.currency.id, ttype=(amount < 0 and 'payment' or 'receipt'), date=line_date, context=context)
|
||||
result = voucher_obj.onchange_partner_id(cr, uid, [], partner_id=line.partner_id.id, journal_id=statement.journal_id.id, price=abs(amount), currency_id= statement.currency.id, ttype=(amount < 0 and 'payment' or 'receipt'), date=line_date, context=context)
|
||||
voucher_res = { 'type':(amount < 0 and 'payment' or 'receipt'),
|
||||
'name': line.name,
|
||||
'partner_id': line.partner_id.id,
|
||||
|
|
|
@ -168,7 +168,7 @@ class account_analytic_account(osv.osv):
|
|||
'date_start': fields.date('Date Start'),
|
||||
'date': fields.date('Date End', select=True),
|
||||
'company_id': fields.many2one('res.company', 'Company', required=False), #not required because we want to allow different companies to use the same chart of account, except for leaf accounts.
|
||||
'state': fields.selection([('draft','Draft'),('open','Open'), ('pending','Pending'),('cancelled', 'Cancelled'),('close','Closed'),('template', 'Template')], 'State', required=True,
|
||||
'state': fields.selection([('draft','New'),('open','Started'), ('pending','Pending'),('cancelled', 'Cancelled'),('close','Closed'),('template', 'Template')], 'State', required=True,
|
||||
help='* When an account is created its in \'Draft\' state.\
|
||||
\n* If any associated partner is there, it can be in \'Open\' state.\
|
||||
\n* If any pending balance is there it can be in \'Pending\'. \
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -21,14 +21,15 @@
|
|||
|
||||
from report.interface import report_int
|
||||
import netsvc
|
||||
import openerp.pooler
|
||||
|
||||
class report_artistlot(report_int):
|
||||
def __init__(self, name):
|
||||
report_int.__init__(self, name)
|
||||
|
||||
def create(self, cr, uid, ids, datas, context):
|
||||
service = netsvc.LocalService("object_proxy")
|
||||
lots = service.execute(cr.dbname, uid, 'auction.lots', 'read', ids, ['artist_id'])
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
lots = pool.get('auction.lots').read(cr, uid, ids, ['artist_id'])
|
||||
artists = []
|
||||
for lot in lots:
|
||||
if lot['artist_id'] and lot['artist_id'] not in artists:
|
||||
|
|
|
@ -20,15 +20,15 @@
|
|||
##############################################################################
|
||||
|
||||
from report.interface import report_int
|
||||
import netsvc
|
||||
import openerp.pooler
|
||||
|
||||
class auction_seller(report_int):
|
||||
def __init__(self, name):
|
||||
report_int.__init__(self, name)
|
||||
|
||||
def create(self, cr, uid, ids, datas, context):
|
||||
service = netsvc.LocalService("object_proxy")
|
||||
lots = service.execute(cr.dbname, uid, 'auction.lots', 'read', ids, ['bord_vnd_id'])
|
||||
pool = openerp.pooler.get_pool(cr.dbname)
|
||||
lots = pool.get('auction.lots').read(cr, uid, ids, ['bord_vnd_id'])
|
||||
|
||||
bords = {}
|
||||
for l in lots:
|
||||
|
@ -37,7 +37,7 @@ class auction_seller(report_int):
|
|||
new_ids = bords.keys()
|
||||
|
||||
parts = {}
|
||||
partners = service.execute(cr.dbname, uid, 'auction.deposit', 'read', new_ids, ['partner_id'])
|
||||
partners = pool.get('auction.deposit').read(cr, uid, new_ids, ['partner_id'])
|
||||
for l in partners:
|
||||
if l['partner_id']:
|
||||
parts[l['partner_id'][0]]=True
|
||||
|
|
|
@ -32,10 +32,8 @@ class report_custom(report_rml):
|
|||
report_rml.__init__(self, name, table, tmpl, xsl)
|
||||
|
||||
def create_xml(self, cr, uid, ids, datas, context=None):
|
||||
service = netsvc.LocalService("object_proxy")
|
||||
|
||||
lots = service.execute(cr.dbname, uid, 'auction.lots', 'read', ids, ['obj_price','ach_login','obj_comm','lot_est1','lot_est2','bord_vnd_id','ach_emp','auction_id'])
|
||||
auction = service.execute(cr.dbname, uid, 'auction.dates', 'read', [lots[0]['auction_id'][0]])[0]
|
||||
lots = self.pool.get('auction.lots').read(cr, uid , ids, ['obj_price','ach_login','obj_comm','lot_est1','lot_est2','bord_vnd_id','ach_emp','auction_id'])
|
||||
auction = self.pool.get('auction.dates').read(cr, uid, [lots[0]['auction_id'][0]])[0]
|
||||
|
||||
unsold = comm = emp = paid = unpaid = 0
|
||||
est1 = est2 = adj = 0
|
||||
|
@ -75,7 +73,7 @@ class report_custom(report_rml):
|
|||
|
||||
|
||||
debit = adj
|
||||
costs = service.execute(cr.dbname, uid, 'auction.lots', 'compute_seller_costs', ids)
|
||||
costs = self.pool.get('auction.lots').compute_seller_costs(cr, uid, ids)
|
||||
for cost in costs:
|
||||
debit += cost['amount']
|
||||
|
||||
|
|
|
@ -141,9 +141,8 @@ class auction_lots_send_aie(osv.osv_memory):
|
|||
|
||||
|
||||
def _photos_send(cr, uid, uname, passwd, did, ids):
|
||||
service = netsvc.LocalService("object_proxy")
|
||||
for (ref,id) in ids:
|
||||
datas = service.execute(cr.db_name, uid, 'auction.lots', 'read', [id], ['name','image'])
|
||||
datas = self.pool.get('auction.lots').read(cr, uid, [id], ['name','image'])
|
||||
if len(datas):
|
||||
bin = base64.decodestring(datas[0]['image'])
|
||||
fname = datas[0]['name']
|
||||
|
@ -186,8 +185,7 @@ class auction_lots_send_aie(osv.osv_memory):
|
|||
if context is None:
|
||||
context = {}
|
||||
|
||||
service = netsvc.LocalService("object_proxy")
|
||||
lots = service.execute(cr.dbname, uid, 'auction.lots', 'read', context.get('active_ids',[]), ['obj_num','lot_num','obj_desc','bord_vnd_id','lot_est1','lot_est2','artist_id','lot_type','aie_categ'])
|
||||
lots = self.pool.get('auction.lots').read(cr, uid, context.get('active_ids',[]), ['obj_num','lot_num','obj_desc','bord_vnd_id','lot_est1','lot_est2','artist_id','lot_type','aie_categ'])
|
||||
lots_ids = []
|
||||
datas = self.read(cr, uid, ids[0],['uname','login','lang','numerotation','dates'])
|
||||
for l in lots:
|
||||
|
|
|
@ -132,9 +132,8 @@ class auction_lots_pay(osv.osv_memory):
|
|||
if context is None:
|
||||
context = {}
|
||||
import pickle
|
||||
service = netsvc.LocalService("object_proxy")
|
||||
datas = self.read(cr, uid, ids[0],['uname','password','dates'])
|
||||
lots = service.execute(cr.dbname, uid, 'auction.lots', 'read', context['active_ids'], ['obj_num','obj_price'])
|
||||
lots = self.pool.get('auction.lots').read(cr, uid, context['active_ids'], ['obj_num','obj_price'])
|
||||
args = pickle.dumps(lots)
|
||||
self._catalog_send(datas['uname'], datas['password'], datas['dates'], args)
|
||||
return {'type': 'ir.actions.act_window_close'}
|
||||
|
|
|
@ -49,9 +49,8 @@ class auction_lots_invoice(osv.osv_memory):
|
|||
if context is None:
|
||||
context = {}
|
||||
res = super(auction_lots_invoice, self).default_get(cr, uid, fields, context=context)
|
||||
service = netsvc.LocalService("object_proxy")
|
||||
lots = service.execute(cr.dbname, uid, 'auction.lots', 'read', context.get('active_ids', []))
|
||||
auction = service.execute(cr.dbname, uid, 'auction.dates', 'read', [lots[0]['auction_id'][0]])[0]
|
||||
lots = self.pool.get('auction.lots').read(cr, uid, context.get('active_ids', []))
|
||||
auction = self.pool.get('auction.dates').read(cr, uid, [lots[0]['auction_id'][0]])[0]
|
||||
|
||||
price = 0.0
|
||||
price_topay = 0.0
|
||||
|
@ -59,7 +58,7 @@ class auction_lots_invoice(osv.osv_memory):
|
|||
for lot in lots:
|
||||
price_lot = lot['obj_price'] or 0.0
|
||||
|
||||
costs = service.execute(cr.dbname, uid, 'auction.lots', 'compute_buyer_costs', [lot['id']])
|
||||
costs = self.pool.get('auction.lots').compute_buyer_costs(cr, uid, [lot['id']])
|
||||
price_lot += costs['amount']
|
||||
price += price_lot
|
||||
|
||||
|
@ -68,7 +67,7 @@ class auction_lots_invoice(osv.osv_memory):
|
|||
raise osv.except_osv(_('UserError'), _('Two different buyers for the same invoice !\nPlease correct this problem before invoicing'))
|
||||
uid = lot['ach_uid'][0]
|
||||
elif lot['ach_login']:
|
||||
refs = service.execute(uid, 'res.partner', 'search', [('ref','=',lot['ach_login'])])
|
||||
refs = self.pool.get('res.partner').search(cr, uid, [('ref','=',lot['ach_login'])])
|
||||
if len(refs):
|
||||
uid = refs[-1]
|
||||
if 'ach_pay_id' in lot and lot['ach_pay_id']:
|
||||
|
@ -105,7 +104,6 @@ class auction_lots_invoice(osv.osv_memory):
|
|||
"""
|
||||
if context is None:
|
||||
context = {}
|
||||
service = netsvc.LocalService("object_proxy")
|
||||
datas = {'ids' : context.get('active_ids',[])}
|
||||
res = self.read(cr, uid, ids, ['number','ach_uid'])
|
||||
res = res and res[0] or {}
|
||||
|
|
|
@ -0,0 +1,502 @@
|
|||
# Danish translation for openobject-addons
|
||||
# Copyright (c) 2011 Rosetta Contributors and Canonical Ltd 2011
|
||||
# This file is distributed under the same license as the openobject-addons package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, 2011.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: openobject-addons\n"
|
||||
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"POT-Creation-Date: 2011-01-11 11:14+0000\n"
|
||||
"PO-Revision-Date: 2011-09-26 15:35+0000\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: Danish <da@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2011-09-27 04:47+0000\n"
|
||||
"X-Generator: Launchpad (build 14028)\n"
|
||||
|
||||
#. module: base_action_rule
|
||||
#: help:base.action.rule,act_mail_to_user:0
|
||||
msgid ""
|
||||
"Check this if you want the rule to send an email to the responsible person."
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: field:base.action.rule,act_remind_partner:0
|
||||
msgid "Remind Partner"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: field:base.action.rule,trg_partner_categ_id:0
|
||||
msgid "Partner Category"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: field:base.action.rule,act_mail_to_watchers:0
|
||||
msgid "Mail to Watchers (CC)"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: field:base.action.rule,trg_state_to:0
|
||||
msgid "Button Pressed"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: field:base.action.rule,model_id:0
|
||||
msgid "Object"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: field:base.action.rule,act_mail_to_email:0
|
||||
msgid "Mail to these Emails"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: field:base.action.rule,act_state:0
|
||||
msgid "Set State to"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: field:base.action.rule,act_email_from:0
|
||||
msgid "Email From"
|
||||
msgstr "E-mail fra"
|
||||
|
||||
#. module: base_action_rule
|
||||
#: view:base.action.rule:0
|
||||
msgid "Email Body"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: selection:base.action.rule,trg_date_range_type:0
|
||||
msgid "Days"
|
||||
msgstr "Dage"
|
||||
|
||||
#. module: base_action_rule
|
||||
#: field:base.action.rule,last_run:0
|
||||
msgid "Last Run"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: code:addons/base_action_rule/base_action_rule.py:313
|
||||
#, python-format
|
||||
msgid "Error!"
|
||||
msgstr "Fejl!"
|
||||
|
||||
#. module: base_action_rule
|
||||
#: field:base.action.rule,act_reply_to:0
|
||||
msgid "Reply-To"
|
||||
msgstr "Svar til"
|
||||
|
||||
#. module: base_action_rule
|
||||
#: help:base.action.rule,act_email_cc:0
|
||||
msgid ""
|
||||
"These people will receive a copy of the future communication between partner "
|
||||
"and users by email"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: selection:base.action.rule,trg_date_range_type:0
|
||||
msgid "Minutes"
|
||||
msgstr "Minutter"
|
||||
|
||||
#. module: base_action_rule
|
||||
#: field:base.action.rule,name:0
|
||||
msgid "Rule Name"
|
||||
msgstr "Regel Navn"
|
||||
|
||||
#. module: base_action_rule
|
||||
#: help:base.action.rule,act_remind_partner:0
|
||||
msgid ""
|
||||
"Check this if you want the rule to send a reminder by email to the partner."
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: view:base.action.rule:0
|
||||
msgid "Conditions on Model Partner"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: selection:base.action.rule,trg_date_type:0
|
||||
msgid "Deadline"
|
||||
msgstr "Deadline"
|
||||
|
||||
#. module: base_action_rule
|
||||
#: field:base.action.rule,trg_partner_id:0
|
||||
msgid "Partner"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: view:base.action.rule:0
|
||||
msgid "%(object_subject)s = Object subject"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: view:base.action.rule:0
|
||||
msgid "Email Reminders"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: view:base.action.rule:0
|
||||
msgid "Special Keywords to Be Used in The Body"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: field:base.action.rule,trg_state_from:0
|
||||
msgid "State"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: model:ir.actions.act_window,help:base_action_rule.base_action_rule_act
|
||||
msgid ""
|
||||
"Use automated actions to automatically trigger actions for various screens. "
|
||||
"Example: a lead created by a specific user may be automatically set to a "
|
||||
"specific sales team, or an opportunity which still has status pending after "
|
||||
"14 days might trigger an automatic reminder email."
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: help:base.action.rule,act_mail_to_email:0
|
||||
msgid "Email-id of the persons whom mail is to be sent"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: view:base.action.rule:0
|
||||
#: model:ir.module.module,shortdesc:base_action_rule.module_meta_information
|
||||
msgid "Action Rule"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: view:base.action.rule:0
|
||||
msgid "Fields to Change"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: selection:base.action.rule,trg_date_type:0
|
||||
msgid "Creation Date"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: selection:base.action.rule,trg_date_type:0
|
||||
msgid "Last Action Date"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: selection:base.action.rule,trg_date_range_type:0
|
||||
msgid "Hours"
|
||||
msgstr "Timer"
|
||||
|
||||
#. module: base_action_rule
|
||||
#: view:base.action.rule:0
|
||||
msgid "%(object_id)s = Object ID"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: view:base.action.rule:0
|
||||
msgid "Delay After Trigger Date"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: field:base.action.rule,act_remind_attach:0
|
||||
msgid "Remind with Attachment"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: constraint:ir.cron:0
|
||||
msgid "Invalid arguments"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: field:base.action.rule,act_user_id:0
|
||||
msgid "Set Responsible to"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: selection:base.action.rule,trg_date_type:0
|
||||
msgid "None"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: help:base.action.rule,act_email_to:0
|
||||
msgid ""
|
||||
"Use a python expression to specify the right field on which one than we will "
|
||||
"use for the 'To' field of the header"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: view:base.action.rule:0
|
||||
msgid "%(object_user_phone)s = Responsible phone"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: view:base.action.rule:0
|
||||
msgid ""
|
||||
"The rule uses the AND operator. The model must match all non-empty fields so "
|
||||
"that the rule executes the action described in the 'Actions' tab."
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: field:base.action.rule,trg_date_range_type:0
|
||||
msgid "Delay type"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: help:base.action.rule,regex_name:0
|
||||
msgid ""
|
||||
"Regular expression for matching name of the resource\n"
|
||||
"e.g.: 'urgent.*' will search for records having name starting with the "
|
||||
"string 'urgent'\n"
|
||||
"Note: This is case sensitive search."
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: field:base.action.rule,act_method:0
|
||||
msgid "Call Object Method"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: field:base.action.rule,act_email_to:0
|
||||
msgid "Email To"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: help:base.action.rule,act_mail_to_watchers:0
|
||||
msgid ""
|
||||
"Check this if you want the rule to mark CC(mail to any other person defined "
|
||||
"in actions)."
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: view:base.action.rule:0
|
||||
msgid "%(partner)s = Partner name"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: view:base.action.rule:0
|
||||
msgid "Note"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: help:base.action.rule,act_email_from:0
|
||||
msgid ""
|
||||
"Use a python expression to specify the right field on which one than we will "
|
||||
"use for the 'From' field of the header"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: field:base.action.rule,trg_date_range:0
|
||||
msgid "Delay after trigger date"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: view:base.action.rule:0
|
||||
msgid "Conditions"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: help:base.action.rule,trg_date_range:0
|
||||
msgid ""
|
||||
"Delay After Trigger Date,specifies you can put a negative number. If you "
|
||||
"need a delay before the trigger date, like sending a reminder 15 minutes "
|
||||
"before a meeting."
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: field:base.action.rule,active:0
|
||||
msgid "Active"
|
||||
msgstr "Aktiv"
|
||||
|
||||
#. module: base_action_rule
|
||||
#: code:addons/base_action_rule/base_action_rule.py:314
|
||||
#, python-format
|
||||
msgid "No E-Mail ID Found for your Company address!"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: field:base.action.rule,act_remind_user:0
|
||||
msgid "Remind Responsible"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: model:ir.module.module,description:base_action_rule.module_meta_information
|
||||
msgid "This module allows to implement action rules for any object."
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: help:base.action.rule,sequence:0
|
||||
msgid "Gives the sequence order when displaying a list of rules."
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: selection:base.action.rule,trg_date_range_type:0
|
||||
msgid "Months"
|
||||
msgstr "Måneder"
|
||||
|
||||
#. module: base_action_rule
|
||||
#: field:base.action.rule,filter_id:0
|
||||
msgid "Filter"
|
||||
msgstr "Filter"
|
||||
|
||||
#. module: base_action_rule
|
||||
#: selection:base.action.rule,trg_date_type:0
|
||||
msgid "Date"
|
||||
msgstr "Dato"
|
||||
|
||||
#. module: base_action_rule
|
||||
#: help:base.action.rule,server_action_id:0
|
||||
msgid ""
|
||||
"Describes the action name.\n"
|
||||
"eg:on which object which action to be taken on basis of which condition"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: model:ir.model,name:base_action_rule.model_ir_cron
|
||||
msgid "ir.cron"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: view:base.action.rule:0
|
||||
msgid "%(object_description)s = Object description"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: constraint:base.action.rule:0
|
||||
msgid "Error: The mail is not well formated"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: view:base.action.rule:0
|
||||
msgid "Email Actions"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: view:base.action.rule:0
|
||||
msgid "Email Information"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: model:ir.model,name:base_action_rule.model_base_action_rule
|
||||
msgid "Action Rules"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: help:base.action.rule,act_mail_body:0
|
||||
msgid "Content of mail"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: field:base.action.rule,trg_user_id:0
|
||||
msgid "Responsible"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: view:base.action.rule:0
|
||||
msgid "%(partner_email)s = Partner Email"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: view:base.action.rule:0
|
||||
msgid "%(object_date)s = Creation date"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: view:base.action.rule:0
|
||||
msgid "%(object_user_email)s = Responsible Email"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: field:base.action.rule,act_mail_body:0
|
||||
msgid "Mail body"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: help:base.action.rule,act_remind_user:0
|
||||
msgid ""
|
||||
"Check this if you want the rule to send a reminder by email to the user."
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: view:base.action.rule:0
|
||||
msgid "Server Action to be Triggered"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: field:base.action.rule,act_mail_to_user:0
|
||||
msgid "Mail to Responsible"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: field:base.action.rule,act_email_cc:0
|
||||
msgid "Add Watchers (Cc)"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: view:base.action.rule:0
|
||||
msgid "Conditions on Model Fields"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: model:ir.actions.act_window,name:base_action_rule.base_action_rule_act
|
||||
#: model:ir.ui.menu,name:base_action_rule.menu_base_action_rule_form
|
||||
msgid "Automated Actions"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: field:base.action.rule,server_action_id:0
|
||||
msgid "Server Action"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: field:base.action.rule,regex_name:0
|
||||
msgid "Regex on Resource Name"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: help:base.action.rule,act_remind_attach:0
|
||||
msgid ""
|
||||
"Check this if you want that all documents attached to the object be attached "
|
||||
"to the reminder email sent."
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: view:base.action.rule:0
|
||||
msgid "Conditions on Timing"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: field:base.action.rule,sequence:0
|
||||
msgid "Sequence"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: view:base.action.rule:0
|
||||
msgid "Actions"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: help:base.action.rule,active:0
|
||||
msgid ""
|
||||
"If the active field is set to False, it will allow you to hide the rule "
|
||||
"without removing it."
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: view:base.action.rule:0
|
||||
msgid "%(object_user)s = Responsible name"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: field:base.action.rule,create_date:0
|
||||
msgid "Create Date"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: view:base.action.rule:0
|
||||
msgid "Conditions on States"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_action_rule
|
||||
#: field:base.action.rule,trg_date_type:0
|
||||
msgid "Trigger Date"
|
||||
msgstr ""
|
File diff suppressed because it is too large
Load Diff
|
@ -128,6 +128,12 @@ class res_partner_bank(osv.osv):
|
|||
return _('The IBAN does not seem to be correct. You should have entered something like this %s'), (iban_example)
|
||||
return _('The IBAN is invalid, it should begin with the country code'), ()
|
||||
|
||||
def _check_bank(self, cr, uid, ids, context=None):
|
||||
for partner_bank in self.browse(cr, uid, ids, context=context):
|
||||
if partner_bank.state == 'iban' and not partner_bank.bank.bic:
|
||||
return False
|
||||
return True
|
||||
|
||||
def get_bban_from_iban(self, cr, uid, ids, context=None):
|
||||
'''
|
||||
This function returns the bank account number computed from the iban account number, thanks to the mapping_list dictionary that contains the rules associated to its country.
|
||||
|
@ -157,7 +163,10 @@ class res_partner_bank(osv.osv):
|
|||
# to not break community modules.
|
||||
'iban': fields.related('acc_number', string='IBAN', size=34, readonly=True, help="International Bank Account Number", type="char"),
|
||||
}
|
||||
_constraints = [(check_iban, _construct_constraint_msg, ["acc_number"])]
|
||||
_constraints = [
|
||||
(check_iban, _construct_constraint_msg, ["iban"]),
|
||||
(_check_bank, '\nPlease define BIC/Swift code on bank for bank type IBAN Account to make valid payments', ['bic'])
|
||||
]
|
||||
|
||||
res_partner_bank()
|
||||
|
||||
|
|
|
@ -0,0 +1,92 @@
|
|||
# Danish translation for openobject-addons
|
||||
# Copyright (c) 2011 Rosetta Contributors and Canonical Ltd 2011
|
||||
# This file is distributed under the same license as the openobject-addons package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, 2011.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: openobject-addons\n"
|
||||
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"POT-Creation-Date: 2011-01-11 11:14+0000\n"
|
||||
"PO-Revision-Date: 2011-09-23 16:04+0000\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: Danish <da@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2011-09-24 04:58+0000\n"
|
||||
"X-Generator: Launchpad (build 14012)\n"
|
||||
|
||||
#. module: base_iban
|
||||
#: model:ir.module.module,shortdesc:base_iban.module_meta_information
|
||||
msgid "Create IBAN bank accounts"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_iban
|
||||
#: code:addons/base_iban/base_iban.py:120
|
||||
#, python-format
|
||||
msgid ""
|
||||
"The IBAN does not seems to be correct. You should have entered something "
|
||||
"like this %s"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_iban
|
||||
#: model:res.partner.bank.type.field,name:base_iban.bank_zip_field
|
||||
msgid "zip"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_iban
|
||||
#: help:res.partner.bank,iban:0
|
||||
msgid "International Bank Account Number"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_iban
|
||||
#: model:ir.model,name:base_iban.model_res_partner_bank
|
||||
msgid "Bank Accounts"
|
||||
msgstr "Bankkonti"
|
||||
|
||||
#. module: base_iban
|
||||
#: model:res.partner.bank.type.field,name:base_iban.bank_country_field
|
||||
msgid "country_id"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_iban
|
||||
#: model:res.partner.bank.type.field,name:base_iban.bank_swift_field
|
||||
msgid "bic"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_iban
|
||||
#: model:res.partner.bank.type.field,name:base_iban.bank_iban_field
|
||||
msgid "iban"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_iban
|
||||
#: code:addons/base_iban/base_iban.py:121
|
||||
#, python-format
|
||||
msgid "The IBAN is invalid, It should begin with the country code"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_iban
|
||||
#: field:res.partner.bank,iban:0
|
||||
msgid "IBAN"
|
||||
msgstr "IBAN"
|
||||
|
||||
#. module: base_iban
|
||||
#: model:res.partner.bank.type,name:base_iban.bank_iban
|
||||
msgid "IBAN Account"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_iban
|
||||
#: model:ir.module.module,description:base_iban.module_meta_information
|
||||
msgid ""
|
||||
"\n"
|
||||
"This module installs the base for IBAN (International Bank Account Number) "
|
||||
"bank accounts and checks for its validity.\n"
|
||||
"\n"
|
||||
" "
|
||||
msgstr ""
|
||||
|
||||
#. module: base_iban
|
||||
#: model:res.partner.bank.type.field,name:base_iban.bank_acc_number_field
|
||||
msgid "acc_number"
|
||||
msgstr ""
|
|
@ -8,14 +8,15 @@ msgstr ""
|
|||
"Project-Id-Version: openobject-addons\n"
|
||||
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"POT-Creation-Date: 2011-01-11 11:14+0000\n"
|
||||
"PO-Revision-Date: 2011-01-12 20:19+0000\n"
|
||||
"Last-Translator: Quentin THEURET <Unknown>\n"
|
||||
"PO-Revision-Date: 2011-09-26 12:09+0000\n"
|
||||
"Last-Translator: Maxime Chambreuil (http://www.savoirfairelinux.com) "
|
||||
"<maxime.chambreuil@savoirfairelinux.com>\n"
|
||||
"Language-Team: French <fr@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2011-09-05 05:42+0000\n"
|
||||
"X-Generator: Launchpad (build 13830)\n"
|
||||
"X-Launchpad-Export-Date: 2011-09-27 04:47+0000\n"
|
||||
"X-Generator: Launchpad (build 14028)\n"
|
||||
|
||||
#. module: base_module_quality
|
||||
#: code:addons/base_module_quality/object_test/object_test.py:187
|
||||
|
@ -390,7 +391,7 @@ msgstr "Erreur ! Le module n'est pas correctement chargé/installé."
|
|||
#: code:addons/base_module_quality/speed_test/speed_test.py:116
|
||||
#, python-format
|
||||
msgid "Error in Read method: %s"
|
||||
msgstr ""
|
||||
msgstr "Erreur dans la méthode Read : %s"
|
||||
|
||||
#. module: base_module_quality
|
||||
#: code:addons/base_module_quality/speed_test/speed_test.py:138
|
||||
|
|
|
@ -70,6 +70,7 @@
|
|||
</record>
|
||||
<record id="base_setup_installer_todo" model="ir.actions.todo">
|
||||
<field name="action_id" ref="action_base_setup_installer"/>
|
||||
<field name="category_id" ref="base.category_administration_config"/>
|
||||
<field name="sequence">2</field>
|
||||
</record>
|
||||
|
||||
|
@ -89,18 +90,18 @@
|
|||
</record>
|
||||
|
||||
<!-- Import or create customers configartion view -->
|
||||
<record id="action_import_create_installer" model="ir.actions.act_window">
|
||||
<field name="name">Import or Create Customers</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">res.partner</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="base.view_partner_tree"/>
|
||||
<field name="help">Create some Customers, Suppliers and their contacts manually from this form or you can import your existing partners by CSV spreadsheet from "Import Data" wizard</field>
|
||||
</record>
|
||||
<record id="config_wizard_action_import_create_installer" model="ir.actions.todo">
|
||||
<field name="action_id" ref="action_import_create_installer"/>
|
||||
<field name="category_id" ref="base.category_administration_config"/>
|
||||
<record id="action_import_create_installer" model="ir.actions.act_window">
|
||||
<field name="name">Create or Import Customers</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">res.partner</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="base.view_partner_tree"/>
|
||||
<field name="help">Create or Import Customers and their contacts manually from this form or you can import your existing partners by CSV spreadsheet from "Import Data" wizard</field>
|
||||
</record>
|
||||
<record id="config_wizard_action_import_create_installer" model="ir.actions.todo">
|
||||
<field name="action_id" ref="action_import_create_installer"/>
|
||||
<field name="category_id" ref="base.category_sales_management_config"/>
|
||||
</record>
|
||||
|
||||
<!-- Define default users preferences-->
|
||||
|
@ -221,6 +222,7 @@
|
|||
</record>
|
||||
<record id="base_setup_company_todo" model="ir.actions.todo">
|
||||
<field name="action_id" ref="action_base_setup_company"/>
|
||||
<field name="category_id" ref="base.category_administration_config"/>
|
||||
<field name="sequence">1</field>
|
||||
</record>
|
||||
<!-- register Upload Logo configuration wizard -->
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
# Danish translation for openobject-addons
|
||||
# Copyright (c) 2011 Rosetta Contributors and Canonical Ltd 2011
|
||||
# This file is distributed under the same license as the openobject-addons package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, 2011.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: openobject-addons\n"
|
||||
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"POT-Creation-Date: 2011-01-11 11:14+0000\n"
|
||||
"PO-Revision-Date: 2011-09-23 15:37+0000\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: Danish <da@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2011-09-24 04:59+0000\n"
|
||||
"X-Generator: Launchpad (build 14012)\n"
|
||||
|
||||
#. module: base_tools
|
||||
#: model:ir.module.module,shortdesc:base_tools.module_meta_information
|
||||
msgid "Common base for tools modules"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_tools
|
||||
#: model:ir.module.module,description:base_tools.module_meta_information
|
||||
msgid ""
|
||||
"\n"
|
||||
" "
|
||||
msgstr ""
|
||||
"\n"
|
||||
" "
|
|
@ -126,6 +126,11 @@ Creates a dashboard for CRM that includes:
|
|||
'test/test_crm_recurrent_meeting.yml',
|
||||
'test/test_crm_stage_changes.yml',
|
||||
'test/test_crm_recurrent_meeting_case2.yml',
|
||||
'test/test_crm_lead_case2.yml',
|
||||
'test/test_crm_opportunity_case2.yml',
|
||||
'test/test_crm_phonecall_case2.yml',
|
||||
'test/test_crm_partner2opportunity.yml',
|
||||
'test/test_crm_segmentation.yml',
|
||||
],
|
||||
'installable': True,
|
||||
'active': False,
|
||||
|
|
|
@ -29,8 +29,8 @@ from tools.translate import _
|
|||
|
||||
MAX_LEVEL = 15
|
||||
AVAILABLE_STATES = [
|
||||
('draft', 'Draft'),
|
||||
('open', 'Open'),
|
||||
('draft', 'New'),
|
||||
('open', 'In Progress'),
|
||||
('cancel', 'Cancelled'),
|
||||
('done', 'Closed'),
|
||||
('pending', 'Pending'),
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
</record>
|
||||
|
||||
<record model="ir.actions.act_window" id="crm_case_section_view_form_installer">
|
||||
<field name="name">Create Sales Team</field>
|
||||
<field name="name">Define Sales Team</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">crm.case.section</field>
|
||||
<field name="view_type">form</field>
|
||||
|
@ -39,6 +39,7 @@
|
|||
<field name="action_id" ref="crm_case_section_view_form_installer"/>
|
||||
<field name="category_id" ref="base.category_sales_management_config"/>
|
||||
<field name="sequence">10</field>
|
||||
<field name="groups_id" eval="[(6, 0, [ref('base.group_extended')])]" />
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window" id="crm_case_stage_form_installer">
|
||||
|
@ -54,8 +55,8 @@
|
|||
<record id="crm_case_stage_installer_todo" model="ir.actions.todo">
|
||||
<field name="action_id" ref="crm_case_stage_form_installer"/>
|
||||
<field name="category_id" ref="base.category_sales_management_config"/>
|
||||
<field name="groups_id" eval="[(6, 0, [ref('base.group_extended')])]" />
|
||||
<field name="sequence">10</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<field name="domain">['|', ('type','=','lead'), ('type','=',False)]</field>
|
||||
<field name="view_id" ref="crm_case_tree_view_leads"/>
|
||||
<field name="search_view_id" ref="crm.view_crm_case_leads_filter"/>
|
||||
<field name="context">{'search_default_current':1, 'default_type': 'lead', 'search_default_section_id': section_id, 'stage_type': 'lead'}</field>
|
||||
<field name="context">{'search_default_new':1, 'default_type': 'lead', 'search_default_section_id': section_id, 'stage_type': 'lead'}</field>
|
||||
<field name="help">Leads allow you to manage and keep track of all initial contacts with a prospect or partner showing interest in your products or services. A lead is usually the first step in your sales cycle. Once qualified, a lead may be converted into a business opportunity, while creating the related partner for further detailed tracking of any linked activities. You can import a database of prospects, keep track of your business cards or integrate your website's contact form with the OpenERP Leads. Leads can be connected to the email gateway: new emails may create leads, each of them automatically gets the history of the conversation with the prospect.</field>
|
||||
</record>
|
||||
|
||||
|
@ -62,7 +62,7 @@
|
|||
<field name="res_model">crm.lead</field>
|
||||
<field name="view_mode">tree,form,graph,calendar,kanban</field>
|
||||
<field name="domain">[('type','=','opportunity')]</field>
|
||||
<field name="context">{'search_default_user_id':uid,'search_default_current':1, 'search_default_section_id':section_id, 'stage_type': 'opportunity', 'default_type': 'opportunity'}</field>
|
||||
<field name="context">{'search_default_user_id':uid,'search_default_new':1, 'search_default_open':1, 'search_default_section_id':section_id, 'stage_type': 'opportunity', 'default_type': 'opportunity'}</field>
|
||||
<field name="view_id" ref="crm_case_tree_view_oppor"/>
|
||||
<field name="search_view_id" ref="crm.view_crm_case_opportunities_filter"/>
|
||||
<field name="help">With opportunities you can manage and keep track of your sales pipeline by creating specific customer- or prospect-related sales documents to follow up potential sales. Information such as expected revenue, opportunity stage, expected closing date, communication history and much more can be stored. Opportunities can be connected to the email gateway: new emails may create opportunities, each of them automatically gets the history of the conversation with the customer.
|
||||
|
|
|
@ -120,7 +120,7 @@
|
|||
<field name="description" nolabel="1" colspan="4"/>
|
||||
<separator colspan="4"/>
|
||||
<group col="8" colspan="4">
|
||||
<field name="state"/>
|
||||
<field name="state" widget="statusbar" statusbar_visible="draft,open,done" statusbar_colors='{"pending":"blue"}'/>
|
||||
<button name="case_cancel" string="Cancel"
|
||||
states="draft,open,pending" type="object"
|
||||
icon="gtk-cancel" />
|
||||
|
@ -195,7 +195,7 @@
|
|||
<field name="email_cc" size="512" attrs="{'invisible': [('email_from', '=', False)]}"/>
|
||||
</group>
|
||||
<field name="subject" colspan="4" widget="char" attrs="{'invisible': [('email_from', '=', False)]}" size="512"/>
|
||||
<field name="body_text" colspan="4" attrs="{'invisible': [('email_from', '!=', False)]}"/>
|
||||
<field name="display_text" colspan="4" attrs="{'invisible': [('email_from', '!=', False)]}"/>
|
||||
</group>
|
||||
<notebook colspan="4">
|
||||
<page string="Details" attrs="{'invisible': [('email_from', '=', False)]}">
|
||||
|
@ -302,7 +302,7 @@
|
|||
<field name="state"/>
|
||||
<field name="color"/>
|
||||
<field name="priority"/>
|
||||
<field name="planned_revenue"/>
|
||||
<field name="planned_revenue" sum="Expected Revenues"/>
|
||||
<field name="user_email"/>
|
||||
<templates>
|
||||
<t t-name="kanban-box">
|
||||
|
@ -372,13 +372,15 @@
|
|||
<search string="Search Leads">
|
||||
<filter icon="terp-check"
|
||||
string="New"
|
||||
name="current" help="New Leads"
|
||||
name="new" help="New Leads"
|
||||
domain="[('state','=','draft')]"/>
|
||||
<filter icon="terp-camera_test"
|
||||
string="Open"
|
||||
name="open"
|
||||
domain="[('state','=','open')]"/>
|
||||
<filter icon="terp-gtk-media-pause"
|
||||
string="Pending"
|
||||
name="pending"
|
||||
domain="[('state','=','pending')]"/>
|
||||
|
||||
<separator orientation="vertical"/>
|
||||
|
@ -515,7 +517,7 @@
|
|||
|
||||
<separator colspan="4"/>
|
||||
<group col="10" colspan="4">
|
||||
<field name="state"/>
|
||||
<field name="state" widget="statusbar" statusbar_visible="draft,open,done" statusbar_colors='{"pending":"blue"}'/>
|
||||
<button name="case_cancel" string="Cancel" states="draft" type="object" icon="gtk-cancel" />
|
||||
<button name="case_mark_lost" string="Mark Lost" states="open,pending" type="object" icon="gtk-cancel" />
|
||||
<button name="case_reset" string="Reset to Draft" states="done,cancel" type="object" icon="gtk-convert" />
|
||||
|
@ -580,7 +582,7 @@
|
|||
<field name="email_cc" size="512" attrs="{'invisible': [('email_from', '=', False)]}"/>
|
||||
</group>
|
||||
<field name="subject" colspan="4" widget="char" attrs="{'invisible': [('email_from', '=', False)]}" size="512"/>
|
||||
<field name="body_text" colspan="4" attrs="{'invisible': [('email_from', '!=', False)]}"/>
|
||||
<field name="display_text" colspan="4" attrs="{'invisible': [('email_from', '!=', False)]}"/>
|
||||
</group>
|
||||
<notebook colspan="4">
|
||||
<page string="Details" attrs="{'invisible': [('email_from', '=', False)]}">
|
||||
|
@ -675,13 +677,15 @@
|
|||
<search string="Search Opportunities">
|
||||
<filter icon="terp-check"
|
||||
string="New" help="New Opportunities"
|
||||
name="current"
|
||||
name="new"
|
||||
domain="[('state','=','draft')]"/>
|
||||
<filter icon="terp-camera_test"
|
||||
string="Open" help="Open Opportunities"
|
||||
name="open"
|
||||
domain="[('state','=','open')]"/>
|
||||
<filter icon="terp-gtk-media-pause"
|
||||
string="Pending" help="Pending Opportunities"
|
||||
name="pending"
|
||||
domain="[('state','=','pending')]"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="name" string="Opportunity"/>
|
||||
|
|
|
@ -107,7 +107,7 @@
|
|||
<field name="description" nolabel="1" colspan="4" />
|
||||
<separator colspan="4" />
|
||||
<group col="8" colspan="4">
|
||||
<field name="state" select="1" />
|
||||
<field name="state" widget="statusbar" statusbar_visible="open,done" statusbar_colors='{"pending":"red"}' select="1"/>
|
||||
<button name="case_cancel" string="Cancel"
|
||||
states="open,pending" type="object"
|
||||
icon="gtk-cancel" />
|
||||
|
|
|
@ -7,14 +7,14 @@ msgstr ""
|
|||
"Project-Id-Version: OpenERP Server 6.0dev\n"
|
||||
"Report-Msgid-Bugs-To: support@openerp.com\n"
|
||||
"POT-Creation-Date: 2011-01-11 11:15+0000\n"
|
||||
"PO-Revision-Date: 2011-01-18 16:45+0000\n"
|
||||
"Last-Translator: Fabien (Open ERP) <fp@tinyerp.com>\n"
|
||||
"PO-Revision-Date: 2011-09-26 12:10+0000\n"
|
||||
"Last-Translator: lholivier <olivier.lenoir@free.fr>\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2011-09-05 05:06+0000\n"
|
||||
"X-Generator: Launchpad (build 13830)\n"
|
||||
"X-Launchpad-Export-Date: 2011-09-27 04:47+0000\n"
|
||||
"X-Generator: Launchpad (build 14028)\n"
|
||||
|
||||
#. module: crm
|
||||
#: view:crm.lead.report:0
|
||||
|
@ -2512,7 +2512,7 @@ msgstr "L'étape de l'opportunité \"%s\" a été changé à \"%s\"."
|
|||
#: code:addons/crm/crm_lead.py:282
|
||||
#, python-format
|
||||
msgid "Changed Stage to: %s"
|
||||
msgstr ""
|
||||
msgstr "Etape passée à : %s"
|
||||
|
||||
#. module: crm
|
||||
#: selection:crm.segmentation.line,operator:0
|
||||
|
|
|
@ -1,8 +1,18 @@
|
|||
- |
|
||||
- |
|
||||
In order to test the CRM in OpenERP,
|
||||
I will do a customer qualification process that
|
||||
starts with a fist contact with a customer (a lead), which will be converted to a
|
||||
business opportunity and a partner.
|
||||
-
|
||||
I check installer report.
|
||||
-
|
||||
!record {model: base.setup.installer , id: base_action_rule_0_1}:
|
||||
name: Test_action
|
||||
-
|
||||
I create the view at the time of setup.
|
||||
-
|
||||
!python {model: base.setup.installer}: |
|
||||
self.fields_view_get(cr, uid,view_id=None, view_type='form', context=None, toolbar=False, submenu=False)
|
||||
- |
|
||||
In order to test the flow, I create a two new users "user_crm" and
|
||||
I assign the group "salesman".
|
||||
|
@ -25,26 +35,36 @@
|
|||
email_from: info@mycustomer.com
|
||||
name: New Customer
|
||||
partner_name: Capegemini
|
||||
partner_id: base.res_partner_9
|
||||
phone: (855) 924-4364
|
||||
mobile: (333) 715-1450
|
||||
section_id: crm.section_sales_department
|
||||
referred: False
|
||||
- |
|
||||
I check that the lead is in 'draft' state,
|
||||
I check that the lead is in 'draft' state.
|
||||
-
|
||||
!assert {model: crm.lead, id: crm_lead_newcustomer0, string: Lead in Draft}:
|
||||
- state == "draft"
|
||||
-
|
||||
I open lead by click on "Open" button,
|
||||
I open lead by click on "Open" button.
|
||||
-
|
||||
!python {model: crm.lead}: |
|
||||
self.case_open(cr, uid, [ref("crm_lead_newcustomer0")])
|
||||
fields={
|
||||
'day_open': 0.0,
|
||||
'day_close': 0.0
|
||||
}
|
||||
self._compute_day(cr, uid, [ref("crm_lead_newcustomer0")], fields, context)
|
||||
- |
|
||||
I check that lead is now in 'open' state.
|
||||
-
|
||||
!assert {model: crm.lead, id: crm_lead_newcustomer0, string: Lead in open state}:
|
||||
- state == "open"
|
||||
|
||||
-
|
||||
I search id for case object.
|
||||
-
|
||||
!python {model: crm.case.categ}: |
|
||||
self._find_object_id(cr, uid, context)
|
||||
- |
|
||||
As the lead seems to be a real business opportunity, I will convert it to a
|
||||
partner
|
||||
|
@ -56,16 +76,40 @@
|
|||
assert action['res_model'] == 'crm.lead2opportunity.partner'
|
||||
-
|
||||
|
|
||||
Now, select "create a new partner" option in this wizard.
|
||||
I select "create a new partner" option.
|
||||
-
|
||||
!record {model: crm.lead2opportunity.partner, id: crm_lead2opportunity_partner_create_0}:
|
||||
action: 'create'
|
||||
name: 'convert'
|
||||
-
|
||||
Then, Click on "Create Opportunity" button of this wizard.
|
||||
Then, Click on "Create Opportunity" button.
|
||||
-
|
||||
!python {model: crm.lead2opportunity.partner}: |
|
||||
self.action_apply(cr, uid, [ref("crm_lead2opportunity_partner_create_0")], {'active_ids': [ref("crm_lead_newcustomer0")], 'active_id': ref("crm_lead_newcustomer0")})
|
||||
-
|
||||
|
|
||||
I select "Link to an existing partner" option.
|
||||
-
|
||||
!record {model: crm.lead2opportunity.partner, id: crm_lead2opportunity_partner_create_1}:
|
||||
action: 'exist'
|
||||
name: 'existing partner'
|
||||
-
|
||||
Then, Click on "Create Opportunity" button.
|
||||
-
|
||||
!python {model: crm.lead2opportunity.partner}: |
|
||||
self.action_apply(cr, uid, [ref("crm_lead2opportunity_partner_create_1")], {'active_ids': [ref("crm_lead_newcustomer0")], 'active_id': ref("crm_lead_newcustomer0")})
|
||||
-
|
||||
|
|
||||
I select "Do not link to a partner" option.
|
||||
-
|
||||
!record {model: crm.lead2opportunity.partner, id: crm_lead2opportunity_partner_create_2}:
|
||||
action: 'nothing'
|
||||
name: 'Do not link to a partner'
|
||||
-
|
||||
Then, Click on "Create Opportunity" button.
|
||||
-
|
||||
!python {model: crm.lead2opportunity.partner}: |
|
||||
self.action_apply(cr, uid, [ref("crm_lead2opportunity_partner_create_2")], {'active_ids': [ref("crm_lead_newcustomer0")], 'active_id': ref("crm_lead_newcustomer0")})
|
||||
- |
|
||||
In order to check the opportunity is created or not, I check type.
|
||||
-
|
||||
|
@ -73,6 +117,39 @@
|
|||
lead = self.browse(cr, uid, ref("crm_lead_newcustomer0"))
|
||||
assert lead.type == 'opportunity'
|
||||
|
||||
-
|
||||
I create mass report of lead to opprtunity partner.
|
||||
-
|
||||
!record {model: crm.lead2opportunity.partner.mass, id: crm_lead2opportunity_partner_mass0}:
|
||||
user_ids:
|
||||
- base.user_root
|
||||
section_id: crm.section_sales_department
|
||||
-
|
||||
Then, execute that mass wizard.
|
||||
-
|
||||
!python {model: crm.lead2opportunity.partner.mass}: |
|
||||
self.mass_convert(cr, uid, [ref("crm_lead2opportunity_partner_mass0")],{'active_ids': [ref("crm_lead_newcustomer0")], 'active_id': ref("crm_lead_newcustomer0")})
|
||||
-
|
||||
I close lead by click on "close" button.
|
||||
-
|
||||
!python {model: crm.lead}: |
|
||||
self.case_close(cr, uid, [ref("crm_lead_newcustomer0")])
|
||||
- |
|
||||
I check that lead is now in 'done' state.
|
||||
-
|
||||
!assert {model: crm.lead, id: crm_lead_newcustomer0, string: Lead in done state}:
|
||||
- state == "done"
|
||||
-
|
||||
I cancel lead by click on "cancel" button.
|
||||
-
|
||||
!python {model: crm.lead}: |
|
||||
self.case_cancel(cr, uid, [ref("crm_lead_newcustomer0")])
|
||||
- |
|
||||
I check that lead is now in 'cancel' state.
|
||||
-
|
||||
!assert {model: crm.lead, id: crm_lead_newcustomer0, string: Lead in cancel state}:
|
||||
- state == "cancel"
|
||||
|
||||
#-
|
||||
# |
|
||||
# yaml is also not working with smtp server and send new email.
|
||||
|
@ -89,4 +166,3 @@
|
|||
- |
|
||||
I Reply to last Email to lead with some document attached.and check that communication history generated or not.
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,151 @@
|
|||
-
|
||||
In order to do complete test the CRM in OpenERP,
|
||||
I will create new full configured record and carry test on it.
|
||||
- |
|
||||
I Start by creating "Test Sales Team" with No Unlink.
|
||||
I create a crm.case.section record.
|
||||
-
|
||||
!record {model: crm.case.section, id: crm_case_section_demosalesteam}:
|
||||
code: DEMO
|
||||
complete_name: Test Sales Team
|
||||
name: Test Sales Team
|
||||
allow_unlink: False
|
||||
member_ids:
|
||||
- base.user_admin
|
||||
stage_ids:
|
||||
- crm.stage_lead1
|
||||
- crm.stage_lead2
|
||||
- crm.stage_lead3
|
||||
- crm.stage_lead4
|
||||
- crm.stage_lead5
|
||||
- crm.stage_lead6
|
||||
working_hours: 0.0
|
||||
resource_calendar_id: resource.timesheet_group1
|
||||
parent_id: crm.section_sales_department
|
||||
-
|
||||
I assign segmentation.
|
||||
-
|
||||
!record {model: res.users, id: res_users_usercrm0}:
|
||||
context_section_id: crm_case_section_demosalesteam
|
||||
- |
|
||||
I create a new lead "Test Customer" and I provide an address to this
|
||||
demo customer and email "info@democustomer.com" and Also "Test Sales Team".
|
||||
-
|
||||
!record {model: crm.lead, id: crm_lead_democustomer}:
|
||||
email_from: info@democustomer.com
|
||||
name: Test Customer
|
||||
partner_name: NotSoTinySARL
|
||||
phone: (+32).81.81.37.00
|
||||
mobile: (+32).81.81.37.00
|
||||
section_id: crm_case_section_demosalesteam
|
||||
referred: False
|
||||
type: lead
|
||||
-
|
||||
I check that the lead is in 'draft' state.
|
||||
-
|
||||
!assert {model: crm.lead, id: crm_lead_democustomer, string: Lead in Draft}:
|
||||
- state == "draft"
|
||||
-
|
||||
I create categories.
|
||||
-
|
||||
!record {model: crm.case.categ, id: crm_case_categ0}:
|
||||
name: crm_case_section_demosalesteam
|
||||
section_id: crm_case_section_demosalesteam
|
||||
-
|
||||
I assigning contact detail to the Lead "Test Customer" without address.
|
||||
-
|
||||
!python {model: crm.lead}: |
|
||||
self.onchange_partner_address_id(cr, uid, ref("crm_lead_democustomer"), None, email=False)
|
||||
|
||||
-
|
||||
I assigning contact detail to the Lead "Test Customer" with address.
|
||||
-
|
||||
!python {model: crm.lead}: |
|
||||
self.onchange_partner_address_id(cr, uid, ref("crm_lead_democustomer"), ref("base.res_partner_address_notsotinysarl0"), email=False)
|
||||
|
||||
-
|
||||
I selecting email "Opt-out" option for the "Test Customer" Lead.
|
||||
-
|
||||
!python {model: crm.lead}: |
|
||||
self.on_change_optout(cr, uid, ref("crm_lead_democustomer"), True)
|
||||
|
||||
-
|
||||
I change the Opt-out to Opt-in to show email receive preference.
|
||||
-
|
||||
!python {model: crm.lead}: |
|
||||
self.on_change_optin(cr, uid, ref("crm_lead_democustomer"), True)
|
||||
-
|
||||
I open lead by click on "Open" button.
|
||||
-
|
||||
!python {model: crm.lead}: |
|
||||
self.case_open(cr, uid, [ref("crm_lead_democustomer")])
|
||||
-
|
||||
I check that lead "Test Customer" is now in 'open' state.
|
||||
-
|
||||
!assert {model: crm.lead, id: crm_lead_democustomer, string: Lead in open state}:
|
||||
- state == "open"
|
||||
-
|
||||
I reset the lead "Test Customer".
|
||||
-
|
||||
!python {model: crm.lead}: |
|
||||
self.case_reset(cr, uid, [ref("crm_lead_democustomer")])
|
||||
-
|
||||
I again opening lead by click on "Open" button.
|
||||
-
|
||||
!python {model: crm.lead}: |
|
||||
self.case_open(cr, uid, [ref("crm_lead_democustomer")])
|
||||
-
|
||||
I setting stage "New" for the lead "Test Customer".
|
||||
-
|
||||
!python {model: crm.lead}: |
|
||||
self.stage_next(cr, uid, [ref("crm_lead_democustomer")], context={'stage_type': 'lead'})
|
||||
-
|
||||
I try to Unlink the Lead "Test Customer" demo Lead.
|
||||
-
|
||||
!python {model: crm.lead}: |
|
||||
try:
|
||||
self.unlink(cr, uid, [ref("crm_lead_democustomer")])
|
||||
except:
|
||||
pass
|
||||
-
|
||||
I setting Lead "Test Customer" to Pending State.
|
||||
-
|
||||
!python {model: crm.lead}: |
|
||||
self.case_pending(cr, uid, [ref("crm_lead_democustomer")])
|
||||
-
|
||||
I check that lead "Test Customer" is now in 'Pending' state.
|
||||
-
|
||||
!assert {model: crm.lead, id: crm_lead_democustomer, string: Lead in Pending state}:
|
||||
- state == "pending"
|
||||
-
|
||||
I Escalate the Lead "Test Customer" Parent "Sales Team".
|
||||
-
|
||||
!python {model: crm.lead}: |
|
||||
self.case_escalate(cr, uid, [ref("crm_lead_democustomer")])
|
||||
-
|
||||
I add Internal Note Saying Escalated Reason.
|
||||
-
|
||||
!record {model: crm.add.note, id: crm_add_note_0}:
|
||||
body: Sales Lead Has Been Escalated Due to Some Technical reason to the parent 'Sales
|
||||
Team'
|
||||
state: unchanged
|
||||
-
|
||||
I click a note button to attach the record.
|
||||
-
|
||||
!python {model: crm.add.note}: |
|
||||
context['active_model'] = "crm.lead"
|
||||
context['active_ids'] = [ref("crm_lead_democustomer")]
|
||||
self.action_add(cr, uid, [ref("crm_add_note_0")], context=context)
|
||||
|
||||
-
|
||||
I Copying this lead "Test Customer" to New Lead.
|
||||
-
|
||||
!python {model: crm.lead}: |
|
||||
self.copy(cr, uid, ref("crm_lead_democustomer"))
|
||||
-
|
||||
I checking the Lead Copied or Not.
|
||||
-
|
||||
!python {model: crm.lead}: |
|
||||
sid = self.search(cr, uid, [('name', '=', 'Test Customer'),('state', '=', 'draft')])
|
||||
if not sid:
|
||||
raise AssertionError("Lead is not copied Successfully")
|
|
@ -1,9 +1,9 @@
|
|||
- |
|
||||
Now I will test Meetings which may be customer meeting or phonecall meeting or
|
||||
I will test Meetings which may be customer meeting or phonecall meeting or
|
||||
internal Meeting.
|
||||
- |
|
||||
I start by creating a new Meeting.
|
||||
-
|
||||
I start by creating a new Meeting.
|
||||
-
|
||||
!record {model: crm.meeting, id: crm_meeting_regardingpresentation0}:
|
||||
categ_id: crm.categ_meet2
|
||||
date: !eval time.strftime('%Y-%m-%d 16:04:00')
|
||||
|
@ -18,14 +18,14 @@
|
|||
section_id: crm.section_sales_department
|
||||
- |
|
||||
I check that the Meetings is in 'UnConfirmed' state.
|
||||
-
|
||||
-
|
||||
!assert {model: crm.meeting, id: crm_meeting_regardingpresentation0}:
|
||||
- state == "draft"
|
||||
- state == "draft"
|
||||
- |
|
||||
I can set reminder on meeting if I put reminder "40 minutes before"
|
||||
I can set reminder on meeting if I put reminder "40 minutes before" .
|
||||
- |
|
||||
For that, I first create alarm.
|
||||
-
|
||||
-
|
||||
!record {model: res.alarm, id: res_alarm_minituesbefore0}:
|
||||
name: 40 minutes before
|
||||
trigger_duration: 40
|
||||
|
@ -33,51 +33,51 @@
|
|||
trigger_occurs: before
|
||||
trigger_related: start
|
||||
- |
|
||||
Now I will assign this reminder.
|
||||
|
||||
I will assign this reminder.
|
||||
|
||||
- !python {model: crm.meeting}: |
|
||||
self.write(cr, uid, [ref('crm_meeting_regardingpresentation0')], {'alarm_id': ref("res_alarm_minituesbefore0")})
|
||||
- |
|
||||
In order to check recurrence on meetings I will set Recurrency to Custom
|
||||
and I set the fields so that the meeting will occur weekly on Monday and Friday 10 times
|
||||
and I set the fields so that the meeting will occur weekly on Monday and Friday 10 times.
|
||||
-
|
||||
!python {model: crm.meeting}: |
|
||||
self.write(cr, uid, [ref("crm_meeting_regardingpresentation0")], {'fr': 1, 'mo': 1, 'th': 1, 'tu': 1, 'we':1, 'count':10, 'interval': 1, 'rrule_type': 'weekly'})
|
||||
|
||||
|
||||
- |
|
||||
I can see from the calendar view that the meeting is scheduled on Monday and Friday
|
||||
for 10 times,
|
||||
|
||||
for 10 times.
|
||||
|
||||
-
|
||||
!python {model: crm.meeting}: |
|
||||
self.fields_view_get(cr, uid, False, 'calendar', context)
|
||||
- |
|
||||
- |
|
||||
I will search for one of the recurrent event and count the number of meeting.
|
||||
-
|
||||
!python {model: crm.meeting}: |
|
||||
import time
|
||||
from datetime import datetime, date, timedelta
|
||||
ids = self.search(cr, uid, [('date', '>=', time.strftime('%Y-%m-%d 00:00:00')), ('date', '<=', (datetime.now()+timedelta(31)).strftime('%Y-%m-%d 00:00:00')), ('name', '=', 'Regarding Presentation')], context={'virtual_id': True})
|
||||
assert len(ids) == 10
|
||||
assert len(ids) == 10
|
||||
|
||||
- |
|
||||
Now If I want to edit meetings information for all occurrence I click on "Edit All" button.
|
||||
If I want to edit meetings information for all occurrence I click on "Edit All" button.
|
||||
-
|
||||
!python {model: crm.meeting}: |
|
||||
self.write(cr, uid, [ref('crm_meeting_regardingpresentation0')], {'edit_all':'True'},context)
|
||||
- |
|
||||
I can see that new meeting form is opened with same value
|
||||
I change some data for meeting and save it
|
||||
I can see from meeting's calendar view that all meeting occurrences are changed accordingly
|
||||
-
|
||||
- |
|
||||
I can see that new meeting form is opened with same value.
|
||||
I change some data for meeting and save it.
|
||||
I can see from meeting's calendar view that all meeting occurrences are changed accordingly.
|
||||
-
|
||||
!record {model: crm.meeting, id: crm.crm_meeting_regardingpresentation0}:
|
||||
alarm_id: base_calendar.alarm9
|
||||
rrule_type: weekly
|
||||
|
||||
- |
|
||||
- |
|
||||
In order to invite people for this meetings, I click on "Invite People" button
|
||||
I can invite internal user.
|
||||
-
|
||||
I can invite internal user.
|
||||
-
|
||||
!record {model: base_calendar.invite.attendee, id: base_calendar_invite_attendee_0}:
|
||||
type: internal
|
||||
send_mail: False
|
||||
|
@ -85,13 +85,13 @@
|
|||
user_ids:
|
||||
- base.user_demo
|
||||
-
|
||||
I click on "Invite" button of "Invite attendee" wizard.
|
||||
I click on "Invite" button of "Invite attendee" wizard.
|
||||
-
|
||||
!python {model: base_calendar.invite.attendee}: |
|
||||
self.do_invite(cr, uid, [ref('base_calendar_invite_attendee_0')], {'active_id': ref('crm_meeting_regardingpresentation0'), 'model' : 'crm.meeting', 'attendee_field':'attendee_ids'})
|
||||
self.do_invite(cr, uid, [ref('base_calendar_invite_attendee_0')], {'active_id': ref('crm_meeting_regardingpresentation0'), 'model' : 'crm.meeting', 'attendee_field':'attendee_ids'})
|
||||
|
||||
- |
|
||||
After direct/indirect confirmation for meetings I can confirm meeting
|
||||
After direct/indirect confirmation for meetings I can confirm meeting.
|
||||
-
|
||||
!python {model: crm.meeting}: |
|
||||
self.case_open(cr, uid, [ref('crm_meeting_regardingpresentation0')])
|
||||
|
|
|
@ -11,18 +11,17 @@
|
|||
stage_id: crm.stage_lead1
|
||||
categ_id: crm.categ_oppor2
|
||||
section_id: crm.section_sales_department
|
||||
|
||||
- |
|
||||
I check that the opportunity is in 'New' state.
|
||||
-
|
||||
!assert {model: crm.lead, id: crm_opportunity_abcfuelcounits0}:
|
||||
- state == "draft"
|
||||
- |
|
||||
I open opportunity by click on "Open" button,
|
||||
-
|
||||
!python {model: crm.lead}: |
|
||||
self.case_open(cr, uid, [ref("crm_opportunity_abcfuelcounits0")])
|
||||
|
||||
- |
|
||||
I check that phonecall record is created for that opportunity.
|
||||
-
|
||||
!python {model: crm.phonecall}: |
|
||||
phone_obj = self.pool.get('crm.phonecall')
|
||||
- |
|
||||
I schedule Meeting on this current opportunity by clicking on "schedule
|
||||
Meeting".
|
||||
|
@ -33,7 +32,7 @@
|
|||
- |
|
||||
I can see that Meeting's calendar view is shown.
|
||||
then I click on the date on which I want to schedule meeting.
|
||||
I fill proper data for that meeting and save it
|
||||
I fill proper data for that meeting and save it.
|
||||
-
|
||||
!record {model: crm.meeting, id: crm_meeting_abcfuelcounits0}:
|
||||
date: !eval time.strftime('%Y-%m-%d 00:00:00')
|
||||
|
@ -51,13 +50,13 @@
|
|||
I click on "schedule call" button and select planned date for the call.
|
||||
-
|
||||
!record {model: crm.opportunity2phonecall, id: crm_opportunity2phonecall_abcfuelcounits0}:
|
||||
date: !eval "(datetime.now() + timedelta(1)).strftime('%Y-%m-%d 11:15:00')"
|
||||
date: !eval "(datetime.now() + timedelta(1)).strftime('%Y-%m-%d 11:15:00')"
|
||||
name: 'ABC FUEL CO 829264 - 10002 units'
|
||||
section_id: crm.section_sales_department
|
||||
user_id: base.user_demo
|
||||
categ_id: crm.categ_phone1
|
||||
- |
|
||||
schedule phonecall by apply (action_apply)function of opportunity2phoncall wizard
|
||||
schedule phonecall by opportunity2phoncall wizard.
|
||||
-
|
||||
!python {model: crm.opportunity2phonecall}: |
|
||||
self.action_apply(cr, uid, [ref('crm_opportunity2phonecall_abcfuelcounits0')], {'active_ids': [ref("crm_opportunity_abcfuelcounits0")]})
|
||||
|
@ -72,10 +71,43 @@
|
|||
I can see phonecall record after click on "Schedule call" wizard.
|
||||
-
|
||||
!record {model: crm.phonecall, id: crm_phonecall_abcfuelcounits0}:
|
||||
date: !eval "(datetime.now() + timedelta(1)).strftime('%Y-%m-%d 11:15:00')"
|
||||
date: !eval "(datetime.now() + timedelta(1)).strftime('%Y-%m-%d 11:15:00')"
|
||||
duration: 3.0
|
||||
name: 'ABC FUEL CO 829264 - 10002 units'
|
||||
partner_address_id: base.res_partner_address_1
|
||||
partner_id: base.res_partner_9
|
||||
section_id: crm.section_sales_department
|
||||
|
||||
- |
|
||||
I Merge the opportunities.
|
||||
-
|
||||
for that create two opportunities first opportunity 'Test FUEL CO'.
|
||||
-
|
||||
!record {model: crm.lead, id: crm_opportunity_1}:
|
||||
email_from: info@balmerinc.be
|
||||
name: 'Test FUEL CO 829264 - 10002 units'
|
||||
partner_address_id: base.res_partner_address_1
|
||||
partner_id: base.res_partner_9
|
||||
probability: 1.0
|
||||
stage_id: crm.stage_lead1
|
||||
categ_id: crm.categ_oppor2
|
||||
section_id: crm.section_sales_department
|
||||
-
|
||||
I create the opportunity 'FUEL CO'.
|
||||
-
|
||||
!record {model: crm.lead, id: crm_opportunity_2}:
|
||||
email_from: info@balmerinc.be
|
||||
name: 'FUEL CO 829264 - 10002 units'
|
||||
partner_address_id: base.res_partner_address_1
|
||||
partner_id: base.res_partner_9
|
||||
probability: 1.0
|
||||
stage_id: crm.stage_lead1
|
||||
categ_id: crm.categ_oppor2
|
||||
section_id: crm.section_sales_department
|
||||
- |
|
||||
I Merge two Opportunities.
|
||||
-
|
||||
!python {model: crm.merge.opportunity}: |
|
||||
op_list = [ref('crm_opportunity_1'),ref('crm_opportunity_2')]
|
||||
op_ids=self.pool.get('crm.lead').browse(cr,uid,op_list)
|
||||
lead_ids = [ref('crm_lead_newcustomer0')]
|
||||
self.merge(cr, uid, op_ids, {'lead_ids': lead_ids})
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
- |
|
||||
I start by creating a new Opportunity. And I select partner for opportunity.
|
||||
I can see that after selecting partner his contact and email is automatically filled.
|
||||
-
|
||||
!record {model: crm.lead, id: crm_opportunity_demotestopportunity}:
|
||||
email_from: info@balmerinc.be
|
||||
name: 'Demo Test Opportunity'
|
||||
partner_address_id: base.res_partner_address_1
|
||||
partner_id: base.res_partner_9
|
||||
probability: 1.0
|
||||
categ_id: crm.categ_oppor2
|
||||
section_id: crm.section_sales_department
|
||||
type: opportunity
|
||||
-
|
||||
I check that the opportunity is in 'New' state.
|
||||
-
|
||||
!assert {model: crm.lead, id: crm_opportunity_demotestopportunity, string: Opportunity in Draft}:
|
||||
- state == "draft"
|
||||
-
|
||||
I open opportunity by click on "Open" button.
|
||||
-
|
||||
!python {model: crm.lead}: |
|
||||
self.case_open(cr, uid, [ref("crm_opportunity_demotestopportunity")])
|
||||
-
|
||||
I change partner of the opportunity.
|
||||
-
|
||||
!python {model: crm.lead}: |
|
||||
self.onchange_partner_id(cr, uid, [ref("crm_opportunity_demotestopportunity")], ref("base.res_partner_agrolait"))
|
||||
|
||||
-
|
||||
I change Contact Detail of the opportunity.
|
||||
-
|
||||
!python {model: crm.lead}: |
|
||||
self.onchange_partner_address_id(cr, uid,[ref("crm_opportunity_demotestopportunity")], ref("base.res_partner_address_8invoice"))
|
||||
|
||||
-
|
||||
I change Opportunity to Won State.
|
||||
-
|
||||
!python {model: crm.lead}: |
|
||||
self.case_mark_won(cr, uid, [ref("crm_opportunity_demotestopportunity")])
|
||||
-
|
||||
I check that the opportunity is in 'Done' state.
|
||||
-
|
||||
!assert {model: crm.lead, id: crm_opportunity_demotestopportunity, string: Opportunity is Won}:
|
||||
- state == "done"
|
|
@ -0,0 +1,25 @@
|
|||
- |
|
||||
I start by creating a new opportunity from partner.
|
||||
-
|
||||
!record {model: crm.partner2opportunity, id: crm_partner2opportunity_id_0}:
|
||||
name: test
|
||||
planned_revenue: 0.0
|
||||
partner_id: base.res_partner_9
|
||||
probability: 0.0
|
||||
-
|
||||
I click on "Create Opportunity" button of this wizard.
|
||||
-
|
||||
!python {model: crm.partner2opportunity}: |
|
||||
fields = {
|
||||
'name': 'test',
|
||||
'planned_revenue': '0.0',
|
||||
'partner_id': ref('base.res_partner_9'),
|
||||
'probability': '0.0'
|
||||
}
|
||||
self.default_get(cr, uid, fields, {"active_ids": [ref("crm_partner2opportunity_id_0")]})
|
||||
- |
|
||||
In order to check the opportunity is created or not, I check type.
|
||||
-
|
||||
!python {model: crm.partner2opportunity}: |
|
||||
opportunity = self.make_opportunity(cr, uid, [ref("crm_partner2opportunity_id_0")], {"active_ids": [ref("crm_partner2opportunity_id_0")]})
|
||||
assert True
|
|
@ -7,16 +7,19 @@
|
|||
duration: 2.0
|
||||
section_id: crm.section_sales_department
|
||||
-
|
||||
Now , I select partner by click on "Create a Partner" button.
|
||||
I select partner by click on "Create a Partner" button.
|
||||
-
|
||||
!record {model: crm.phonecall2partner, id: crm_phonecall2partner_1}:
|
||||
action: exist
|
||||
partner_id: base.res_partner_9
|
||||
|
||||
-
|
||||
Now, click on "Continue" button of this wizard.
|
||||
I click on "Continue" button of this wizard and make partner.
|
||||
-
|
||||
!python {model: crm.phonecall2partner}: |
|
||||
|
||||
self._select_partner(cr, uid,{"active_ids": [ref("crm_phonecall_interviewcall0")]})
|
||||
self.open_create_partner(cr, uid, [ref("crm_phonecall2partner_1")], {"active_ids": [ref("crm_phonecall_interviewcall0")]})
|
||||
self.make_partner(cr, uid, [ref("crm_phonecall2partner_1")], {"active_ids": [ref("crm_phonecall_interviewcall0")]})
|
||||
|
||||
- |
|
||||
|
@ -28,31 +31,28 @@
|
|||
partner_id: base.res_partner_9
|
||||
planned_revenue: 0.0
|
||||
probability: 0.0
|
||||
-
|
||||
Now, I click on "Convert" button of this wizard.
|
||||
-
|
||||
!python {model: crm.phonecall2opportunity}: |
|
||||
self.action_apply(cr, uid, [ref("crm_phonecall2opportunity_interviewcall0")], {"active_id": ref("crm_phonecall_interviewcall0")})
|
||||
|
||||
- |
|
||||
I can see that a business opportunity is now assigned to this phonecall
|
||||
-
|
||||
!assert {model: crm.phonecall, id: crm_phonecall_interviewcall0}:
|
||||
- opportunity_id != False
|
||||
|
||||
-
|
||||
I click on "Convert" button of this wizard.
|
||||
-
|
||||
!python {model: crm.phonecall2opportunity}: |
|
||||
self.action_apply(cr, uid, [ref("crm_phonecall2opportunity_interviewcall0")], {"active_id": ref("crm_phonecall_interviewcall0")})
|
||||
- |
|
||||
And I check that the phonecall and the newly created business opportunity is linked
|
||||
to same partner
|
||||
to same partner.
|
||||
-
|
||||
!python {model: crm.phonecall}: |
|
||||
obj_phonecall = self.browse(cr, uid, ref('crm_phonecall_interviewcall0'))
|
||||
ids = self.pool.get('crm.lead').search(cr, uid, [('name', '=', obj_phonecall.opportunity_id.name)])
|
||||
obj_opp = self.pool.get('crm.lead').browse(cr, uid, ids)[0]
|
||||
assert obj_phonecall.partner_id == obj_opp.partner_id
|
||||
|
||||
- |
|
||||
I schedule Meeting on this current phonecall by clicking on "schedule
|
||||
Meeting"
|
||||
Meeting".
|
||||
-
|
||||
!python {model: crm.phonecall}: |
|
||||
self.action_make_meeting(cr, uid, [ref('crm_phonecall_interviewcall0')])
|
||||
|
@ -60,7 +60,7 @@
|
|||
- |
|
||||
I can see that Meeting's calendar view is shown.
|
||||
then I click on the date on which I want schedule meeting.
|
||||
I fill proper data for that meeting and save it
|
||||
I fill proper data for that meeting and save it.
|
||||
-
|
||||
!record {model: crm.meeting, id: crm_meeting_interviewcall0}:
|
||||
alarm_id: base_calendar.alarm3
|
||||
|
@ -85,9 +85,32 @@
|
|||
name: Interview call
|
||||
section_id: crm.section_sales_department
|
||||
user_id: base.user_root
|
||||
action: schedule
|
||||
categ_id: crm.categ_phone1
|
||||
-
|
||||
I click on "schedule other call" button. and plan for other call.
|
||||
-
|
||||
!record {model: crm.phonecall2phonecall, id: crm_phonecall2phonecall_interviewcall1}:
|
||||
date: !eval "'%s-%s-%s 19:49:00' %(datetime.now().year,datetime.now().month,datetime.now().day)"
|
||||
name: Interview call
|
||||
section_id: crm.section_sales_department
|
||||
user_id: base.user_root
|
||||
action: log
|
||||
categ_id: crm.categ_phone1
|
||||
- |
|
||||
I click on "Schedule" button of this wizard.
|
||||
-
|
||||
!python {model: crm.phonecall2phonecall}: |
|
||||
fields = {
|
||||
'name': 'Interview call',
|
||||
'section_id': ref('crm.section_sales_department'),
|
||||
'user_id': ref('base.user_root'),
|
||||
'categ_id': ref('crm.categ_phone1')
|
||||
}
|
||||
self.default_get(cr, uid, fields,{'active_id': ref('crm_phonecall_interviewcall0')})
|
||||
self.action_apply(cr, uid, [ref('crm_phonecall2phonecall_interviewcall0')], {'active_id': ref('crm_phonecall_interviewcall0')})
|
||||
- |
|
||||
I click on "Schedule" button of this wizard with log option.
|
||||
-
|
||||
!python {model: crm.phonecall2phonecall}: |
|
||||
self.action_apply(cr, uid, [ref('crm_phonecall2phonecall_interviewcall1')], {'active_id': ref('crm_phonecall_interviewcall0')})
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
- |
|
||||
I start by creating a new phonecall.
|
||||
-
|
||||
!record {model: crm.phonecall, id: crm_phonecall_dummycall}:
|
||||
date: !eval time.strftime('%Y-%m-%d 08:00:00')
|
||||
name: Dummy call
|
||||
duration: 0.0
|
||||
section_id: crm.section_sales_department
|
||||
partner_id: base.res_partner_agrolait
|
||||
state: open
|
||||
-
|
||||
I change Contact Detail of the Partner.
|
||||
-
|
||||
!python {model: crm.phonecall}: |
|
||||
self.onchange_partner_address_id(cr, uid,[ref("crm_phonecall_dummycall")], ref("base.res_partner_address_8invoice"))
|
||||
|
||||
-
|
||||
I setting Phone call to Held (Done).
|
||||
-
|
||||
!python {model: crm.phonecall}: |
|
||||
self.case_close(cr, uid, [ref("crm_phonecall_dummycall")])
|
||||
-
|
||||
I check that the hone call is in 'Held' state.
|
||||
-
|
||||
!assert {model: crm.phonecall, id: crm_phonecall_dummycall, string: Phone call Helded}:
|
||||
- state == "done"
|
|
@ -21,7 +21,7 @@
|
|||
meeting_ids = self.search(cr, uid, [('id', 'in', [ref('crm_meeting_testmeeting0')]),('date','>=','2011-03-13'), ('date_deadline', '<=', '2011-05-13')], context={'virtual_id': True})
|
||||
assert len(meeting_ids) == 5, 'Recurrent daily meetings are not created !'
|
||||
-
|
||||
Now I create a weekly meeting till a particular end date.
|
||||
I create a weekly meeting till a particular end date.
|
||||
-
|
||||
!record {model: crm.meeting, id: crm_meeting_reviewcodewithprogrammer0}:
|
||||
date: '2011-04-18 11:47:00'
|
||||
|
@ -95,4 +95,3 @@
|
|||
meeting_ids = self.search(cr, uid, [('recurrent_uid', '=', ref('crm_meeting_reviewcodewithprogrammer0')), ('recurrent_id','=','2011-04-25 12:47:00')], context)
|
||||
assert meeting_ids, 'Meeting is not edited !'
|
||||
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
- |
|
||||
I will test segmentation which create specific partner categories criteria.
|
||||
-
|
||||
I create a new segmentation record.
|
||||
-
|
||||
!record {model: crm.segmentation, id: crm_segmentation_id_0}:
|
||||
categ_id: base.res_partner_category_5
|
||||
exclusif: true
|
||||
name: segment
|
||||
som_interval: 0.0
|
||||
sales_purchase_active : True
|
||||
-
|
||||
I start the process.
|
||||
-
|
||||
!python {model: crm.segmentation}: |
|
||||
self.process_start(cr, uid, [ref("crm_segmentation_id_0")],context)
|
||||
-
|
||||
I continue the segmentation process.
|
||||
-
|
||||
!python {model: crm.segmentation}: |
|
||||
context.update({'start': True})
|
||||
self.process_continue(cr, uid, [ref("crm_segmentation_id_0")], context)
|
||||
-
|
||||
I create the segmentation line.
|
||||
-
|
||||
!record {model: crm.segmentation.line, id: crm_segmentation_line_id_0}:
|
||||
expr_name: sale
|
||||
expr_operator: '>'
|
||||
expr_value: 1000.0
|
||||
name: Rule1
|
||||
operator: or
|
||||
segmentation_id: crm_segmentation_id_0
|
||||
|
||||
-
|
||||
I check the Segmentation line record.
|
||||
-
|
||||
!python {model: crm.segmentation.line}: |
|
||||
self.test(cr, uid, [ref("crm_segmentation_line_id_0")],partner_id=0)
|
|
@ -1,10 +1,10 @@
|
|||
-
|
||||
In order to test the changes on stage of a lead or an opportunity with OpenERP,
|
||||
I create some leads and test the stage changes.
|
||||
-
|
||||
-
|
||||
I want to change the probability to 0.0 when the opportunity is marked as lost.
|
||||
So I set its Change probability automatically true.
|
||||
-
|
||||
-
|
||||
!record {model: crm.case.stage, id: crm.stage_lead6}:
|
||||
name: Lost
|
||||
on_change: true
|
||||
|
@ -12,9 +12,9 @@
|
|||
section_ids:
|
||||
- crm.section_sales_department
|
||||
sequence: 0
|
||||
-
|
||||
-
|
||||
I create a lead 'Test Lead1'.
|
||||
-
|
||||
-
|
||||
!record {model: crm.lead, id: crm_lead_openerppresentation0}:
|
||||
categ_id: crm.categ_oppor4
|
||||
day_close: 0.0
|
||||
|
@ -29,7 +29,17 @@
|
|||
!python {model: crm.lead}: |
|
||||
self.case_open(cr, uid, [ref('crm_lead_openerppresentation0')])
|
||||
-
|
||||
I find that this lead can be converted to opportunity.
|
||||
I assigning stage.
|
||||
-
|
||||
!python {model: crm.lead}: |
|
||||
self.onchange_stage_id(cr, uid, [ref('crm_lead_openerppresentation0')], [], context)
|
||||
-
|
||||
I assigning percent.
|
||||
-
|
||||
!python {model: crm.lead}: |
|
||||
self.stage_find_percent(cr, uid, 10.0, [])
|
||||
-
|
||||
I find that this lead can be converted to opportunity.
|
||||
-
|
||||
!record {model: crm.lead2opportunity.partner, id: crm_lead2opportunity_partner0}:
|
||||
action: 'create'
|
||||
|
@ -51,7 +61,7 @@
|
|||
!python {model: crm.lead}: |
|
||||
self.case_mark_lost(cr, uid, [ref('crm_lead_openerppresentation0')])
|
||||
-
|
||||
Now I check whether the probability is set according to stage change or not.
|
||||
I check whether the probability is set according to stage change or not.
|
||||
-
|
||||
!python {model: crm.lead}: |
|
||||
opportunity = self.browse(cr, uid, ref('crm_lead_openerppresentation0'))
|
||||
|
|
|
@ -158,6 +158,7 @@ class crm_lead2partner(osv.osv_memory):
|
|||
'name': lead.partner_name or lead.contact_name or lead.name,
|
||||
'user_id': lead.user_id.id,
|
||||
'comment': lead.description,
|
||||
'address': []
|
||||
})
|
||||
contact_obj.create(cr, uid, {
|
||||
'partner_id': partner_id,
|
||||
|
|
|
@ -31,17 +31,16 @@
|
|||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
</record>
|
||||
|
||||
<!-- partner To Opportunity wizard -->
|
||||
<!-- partner To Opportunity wizard -->
|
||||
|
||||
<act_window id="crm_partner2opportunity"
|
||||
key2="client_action_multi" name="Create Opportunity"
|
||||
res_model="crm.partner2opportunity" src_model="res.partner"
|
||||
view_id="view_crm_partner2opportunity"
|
||||
view_mode="form" target="new" view_type="form"
|
||||
groups="base.group_extended"/>
|
||||
|
||||
</data>
|
||||
<act_window id="crm_partner2opportunity"
|
||||
key2="client_action_multi" name="Create Opportunity"
|
||||
res_model="crm.partner2opportunity" src_model="res.partner"
|
||||
view_id="view_crm_partner2opportunity"
|
||||
view_mode="form" target="new" view_type="form"
|
||||
groups="base.group_extended"/>
|
||||
</data>
|
||||
|
||||
</openerp>
|
||||
|
|
|
@ -106,7 +106,7 @@
|
|||
<field name="description" colspan="4" nolabel="1"/>
|
||||
<separator colspan="4" string=""/>
|
||||
<group col="8" colspan="4">
|
||||
<field name="state" select="1"/>
|
||||
<field name="state" select="1" widget="statusbar" statusbar_visible="draft,open,done" statusbar_colors='{"pending":"blue"}'/>
|
||||
<button name="case_cancel" string="Cancel"
|
||||
states="draft,open,pending" type="object"
|
||||
icon="gtk-cancel" />
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
- |
|
||||
Now I check claims which contain customer claim information about document
|
||||
related problem, product related problem.
|
||||
I check claims which contain customer claim information about document
|
||||
related problem, product related problem.
|
||||
- |
|
||||
I start by creating new claims for Damaged product as Value Claims with priority High and specify
|
||||
I start by creating new claims for Damaged product as Value Claims with priority High and specify
|
||||
date of claim at which claim is created.
|
||||
-
|
||||
-
|
||||
!record {model: crm.claim, id: crm_claim_damagedproduct0}:
|
||||
categ_id: crm_claim.categ_claim2
|
||||
date: !eval time.strftime('%Y-%m-%d %H:%M:%S')
|
||||
|
@ -21,13 +21,24 @@
|
|||
!assert {model: crm.claim, id: crm_claim_damagedproduct0}:
|
||||
- state == 'draft'
|
||||
- |
|
||||
I can change that stage by next button right on it
|
||||
I can change that stage by next button right on it.
|
||||
-
|
||||
!python {model: crm.claim}: |
|
||||
self.stage_next(cr, uid, [ref('crm_claim_damagedproduct0')])
|
||||
self.stage_next(cr, uid, [ref('crm_claim_damagedproduct0')])
|
||||
- |
|
||||
I make this claim as Open
|
||||
I make this claim as Open.
|
||||
-
|
||||
!python {model: crm.claim}: |
|
||||
self.case_open(cr, uid, [ref('crm_claim_damagedproduct0')])
|
||||
|
||||
self.case_open(cr, uid, [ref('crm_claim_damagedproduct0')])
|
||||
- |
|
||||
I am changing partner Assigned to the Claim.
|
||||
-
|
||||
!python {model: crm.claim}: |
|
||||
self.onchange_partner_id(cr, uid, [ref('crm_claim_damagedproduct0')], [])
|
||||
self.onchange_partner_id(cr, uid, [ref('crm_claim_damagedproduct0')], ref('base.res_partner_10'))
|
||||
- |
|
||||
I am changing partner Address to the Claim.
|
||||
-
|
||||
!python {model: crm.claim}: |
|
||||
self.onchange_partner_address_id(cr, uid, [ref('crm_claim_damagedproduct0')], [], email = False)
|
||||
|
||||
|
|
|
@ -110,7 +110,7 @@
|
|||
<field name="description" nolabel="1" colspan="4"/>
|
||||
<separator colspan="4"/>
|
||||
<group col="8" colspan="4">
|
||||
<field name="state"/>
|
||||
<field name="state" widget="statusbar" statusbar_visible="draft,open,done" statusbar_colors='{"pending":"blue"}'/>
|
||||
<button name="case_cancel" string="Cancel"
|
||||
states="draft,open,pending" type="object"
|
||||
icon="gtk-cancel" />
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
- |
|
||||
Now I start test Fund Raising which contain information about Donation or charity
|
||||
I start test Fund Raising which contain information about Donation or charity
|
||||
given by user.
|
||||
- |
|
||||
I start by creating new Funds entry for donation for books to poor school children
|
||||
I start by creating new Funds entry for donation for books to poor school children
|
||||
with cost 500000.00 and category as "Learning And Education"
|
||||
I make payment by Cheque so I make sure that the mode on fund is selected as cheque
|
||||
-
|
||||
I make payment by Cheque so I make sure that the mode on fund is selected as cheque.
|
||||
-
|
||||
!record {model: crm.fundraising, id: crm_fundraising_donationforbookstopoorschoolchildren0}:
|
||||
categ_id: crm_fundraising.categ_fund2
|
||||
email_from: info@balmerinc.be
|
||||
|
@ -21,12 +21,25 @@
|
|||
!assert {model: crm.fundraising, id: crm_fundraising_donationforbookstopoorschoolchildren0}:
|
||||
- state == 'draft'
|
||||
- |
|
||||
Now I open Funds by click on "Open" button
|
||||
I open Funds by click on "Open" button.
|
||||
-
|
||||
!python {model: crm.fundraising}: |
|
||||
self.case_open(cr, uid, [ref('crm_fundraising_donationforbookstopoorschoolchildren0')])
|
||||
- |
|
||||
I can close Funds by click on "Done" button.
|
||||
self.case_open(cr, uid, [ref('crm_fundraising_donationforbookstopoorschoolchildren0')])
|
||||
-
|
||||
I create the message regarding the all details of fundraising.
|
||||
-
|
||||
!python {model: crm.fundraising}: |
|
||||
self.case_close(cr, uid, [ref('crm_fundraising_donationforbookstopoorschoolchildren0')])
|
||||
msg = {
|
||||
'subject': 'fundraising_email',
|
||||
'body_text': 'fundraising details',
|
||||
'from': 'Administrator <admin@openerp.com>',
|
||||
'priority':'3',
|
||||
}
|
||||
context = None
|
||||
self.message_new(cr, uid,msg,context)
|
||||
|
||||
- |
|
||||
After a request via email now I close this fundraising Request by clicking on "Done" button.
|
||||
-
|
||||
!python {model: crm.fundraising}: |
|
||||
self.case_close(cr, uid, [ref('crm_fundraising_donationforbookstopoorschoolchildren0')])
|
||||
|
|
|
@ -71,10 +71,10 @@ class crm_helpdesk(crm.crm_case, osv.osv):
|
|||
'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Priority'),
|
||||
'probability': fields.float('Probability (%)'),
|
||||
'categ_id': fields.many2one('crm.case.categ', 'Category', \
|
||||
domain="[('section_id','=',section_id),\
|
||||
('object_id.model', '=', 'crm.helpdesk')]"),
|
||||
'duration': fields.float('Duration', states={'done': [('readonly', True)]}),
|
||||
'state': fields.selection(crm.AVAILABLE_STATES, 'State', size=16, readonly=True,
|
||||
domain="['|',('section_id','=',False),('section_id','=',section_id),\
|
||||
('object_id.model', '=', 'crm.helpdesk')]"),
|
||||
'duration': fields.float('Duration', states={'done': [('readonly', True)]}),
|
||||
'state': fields.selection(crm.AVAILABLE_STATES, 'State', size=16, readonly=True,
|
||||
help='The state is set to \'Draft\', when a case is created.\
|
||||
\nIf the case is in progress the state is set to \'Open\'.\
|
||||
\nWhen the case is over, the state is set to \'Done\'.\
|
||||
|
|
|
@ -69,7 +69,7 @@
|
|||
<field name="description" colspan="4" nolabel="1" />
|
||||
<separator colspan="4"/>
|
||||
<group col="8" colspan="4">
|
||||
<field name="state" select="1"/>
|
||||
<field name="state" select="1" widget="statusbar" statusbar_visible="draft,open,done" statusbar_colors='{"pending":"blue"}'/>
|
||||
<button name="case_cancel"
|
||||
states="draft,open,pending" string="Cancel"
|
||||
type="object" icon="gtk-cancel" />
|
||||
|
|
|
@ -10,6 +10,17 @@
|
|||
partner_address_id: base.res_partner_address_1
|
||||
partner_id: base.res_partner_9
|
||||
section_id: crm.section_sales_department
|
||||
-
|
||||
I create the message.
|
||||
-
|
||||
!python {model: crm.helpdesk}: |
|
||||
msg = {
|
||||
'subject': 'test_email',
|
||||
'body_text': 'Testing',
|
||||
'from': 'Administrator <admin@openerp.com>',
|
||||
}
|
||||
context = None
|
||||
self.message_new(cr, uid,msg,context)
|
||||
|
||||
- |
|
||||
I check that the Helpdesk request is in 'Draft' state.
|
||||
|
@ -17,10 +28,27 @@
|
|||
!assert {model: crm.helpdesk, id: crm_helpdesk_somefunctionalquestion0}:
|
||||
- state == 'draft'
|
||||
- |
|
||||
In order to make this helpdesk request to be considered I make it "Open"
|
||||
I make it "Open".
|
||||
-
|
||||
!python {model: crm.helpdesk}: |
|
||||
self.case_open(cr, uid, [ref('crm_helpdesk_somefunctionalquestion0')])
|
||||
-
|
||||
Update the created message.
|
||||
-
|
||||
!python {model: crm.helpdesk}: |
|
||||
vals = {}
|
||||
msg = {
|
||||
'subject': 'test_email',
|
||||
'body_text': 'Testing',
|
||||
'from': 'Administrator <admin@openerp.com>',
|
||||
'priority': 'done'
|
||||
}
|
||||
context = None
|
||||
default_act = 'pending'
|
||||
try:
|
||||
self.message_update(cr, uid,[ref('crm_helpdesk_somefunctionalquestion0')], msg,context)
|
||||
except:
|
||||
pass
|
||||
- |
|
||||
After a proper communication for the request via email I make sure that the request is fulfilled and
|
||||
I close this HelpDesk Request by clicking on "Close" button.
|
||||
|
|
|
@ -30,6 +30,11 @@
|
|||
-
|
||||
!record {model: res.partner, id: base.res_partner_desertic_hispafuentes}:
|
||||
grade_id: res_partner_grade_first0
|
||||
-
|
||||
I change the User email id or partner if needed.
|
||||
-
|
||||
!python {model: res.partner}: |
|
||||
self.geo_localize(cr, uid, [ref('base.res_partner_desertic_hispafuentes')], context)
|
||||
-
|
||||
I assgin a reply-to email address to Sales Team.
|
||||
-
|
||||
|
@ -57,7 +62,44 @@
|
|||
probability: 0.0
|
||||
type: opportunity
|
||||
-
|
||||
Now I click on Forward button.
|
||||
I change the assigned partner.
|
||||
-
|
||||
!python {model: crm.lead}: |
|
||||
self.onchange_assign_id(cr, uid, [ref('crm_lead_questionnaireonopenerp0')], ref('base.res_partner_desertic_hispafuentes'), context)
|
||||
self.assign_partner(cr, uid, [ref('crm_lead_questionnaireonopenerp0')], context)
|
||||
-
|
||||
I change the User email id or partner if needed.
|
||||
-
|
||||
!python {model: crm.lead.forward.to.partner}: |
|
||||
context.update({'history': 'latest', })
|
||||
user = ref('base.user_root')
|
||||
self.on_change_email(cr, uid, [ref('crm_lead_questionnaireonopenerp0')], user)
|
||||
self.on_change_partner(cr, uid, [ref('crm_lead_questionnaireonopenerp0')], ref('base.res_partner_desertic_hispafuentes'))
|
||||
-
|
||||
I change in history define.
|
||||
-
|
||||
!python {model: crm.lead.forward.to.partner}: |
|
||||
context.update({'history': 'info', })
|
||||
self.on_change_history(cr, uid, [ref('crm_lead_questionnaireonopenerp0')], context.get('history'), context)
|
||||
-
|
||||
I check the case history.
|
||||
-
|
||||
!python {model: crm.lead.forward.to.partner}: |
|
||||
context.update({'history': 'latest', })
|
||||
self._get_case_history(cr, uid, context.get('history'), ref('crm_lead_questionnaireonopenerp0'), context=context)
|
||||
|
||||
context.update({'history': 'info', })
|
||||
self._get_case_history(cr, uid, context.get('history'), ref('crm_lead_questionnaireonopenerp0'), context=context)
|
||||
|
||||
context.update({'history': 'whole', })
|
||||
self._get_case_history(cr, uid, context.get('history'), ref('crm_lead_questionnaireonopenerp0'), context=context)
|
||||
-
|
||||
I get lead details.
|
||||
-
|
||||
!python {model: crm.lead.forward.to.partner}: |
|
||||
self.get_lead_details(cr, uid, ref('crm_lead_questionnaireonopenerp0'), context)
|
||||
-
|
||||
I click on Forward button.
|
||||
-
|
||||
!python {model: crm.lead.forward.to.partner}: |
|
||||
from tools import config
|
||||
|
@ -67,9 +109,29 @@
|
|||
'email_from': 'Administrator <admin@openerp.com>',
|
||||
'reply_to': 'sales_openerp@openerp.com',
|
||||
'state': 'draft',
|
||||
'history': 'latest',
|
||||
}
|
||||
ids = self.create(cr, uid, vals, context={'active_id': ref('crm_lead_questionnaireonopenerp0'), 'active_model': 'crm.lead'})
|
||||
host = config.get('smtp_user', '127.0.0.1')
|
||||
assert config.get(host, True), 'SMTP not configured !'
|
||||
self.action_forward(cr, uid, [ids], context={'active_id': ref('crm_lead_questionnaireonopenerp0'), 'active_model': 'crm.lead'})
|
||||
|
||||
try:
|
||||
self.action_forward(cr, uid, [ids], context={'active_id': ref('crm_lead_questionnaireonopenerp0'), 'active_model': 'crm.lead'})
|
||||
except:
|
||||
pass
|
||||
-
|
||||
I create the opportunity.
|
||||
-
|
||||
!record {model: crm.lead, id: crm_opportunity2}:
|
||||
email_from: info@balmerinc.be
|
||||
name: 'FUEL CO 829264 - 10002 units'
|
||||
partner_address_id: base.res_partner_address_1
|
||||
partner_id: base.res_partner_9
|
||||
probability: 1.0
|
||||
stage_id: crm.stage_lead1
|
||||
categ_id: crm.categ_oppor2
|
||||
section_id: crm.section_sales_department
|
||||
- |
|
||||
I Update the data.
|
||||
-
|
||||
!python {model: crm.merge.opportunity}: |
|
||||
self._update_data([ref('crm_opportunity2')], ref('crm_lead_questionnaireonopenerp0'))
|
||||
|
|
|
@ -41,6 +41,7 @@ It also has been merged with the earlier CRM & SRM segmentation tool because the
|
|||
'init_xml': [],
|
||||
'update_xml': ['security/ir.model.access.csv', 'crm_profiling_view.xml'],
|
||||
'demo_xml': ['crm_profiling_demo.xml'],
|
||||
'test': ['test/test_crm_profiling.yml'],
|
||||
'installable': True,
|
||||
'active': False,
|
||||
'certificate': '0033984979005',
|
||||
|
|
|
@ -0,0 +1,77 @@
|
|||
- |
|
||||
I check segmentation which allows users to perform segmentation within partners.
|
||||
-
|
||||
I create a crm profiling question record.
|
||||
-
|
||||
!record {model: crm_profiling.question, id: crm_profiling_question_openerppartner0}:
|
||||
answers_ids:
|
||||
- name: 'no'
|
||||
name: OpenERP partner?
|
||||
-
|
||||
I create a crm profiling answer record.
|
||||
-
|
||||
!record {model: crm_profiling.answer, id: crm_profiling_answer_openerppartner0}:
|
||||
name: 'yes'
|
||||
question_id: crm_profiling_question_openerppartner0
|
||||
-
|
||||
I create Partner category Customers.
|
||||
-
|
||||
!record {model: res.partner.category, id: res_partner_category_customers0}:
|
||||
name: Customers
|
||||
- |
|
||||
I'm creating new partner "John" with his email "info@mycustomer.com".
|
||||
-
|
||||
!record {model: res.partner, id: res_partner_john0}:
|
||||
address:
|
||||
- city: Bruxelles
|
||||
country_id: base.be
|
||||
street: Rue des Palais 51, bte 33
|
||||
type: default
|
||||
zip: '1000'
|
||||
email: 'info@mycustomer.com'
|
||||
name: John
|
||||
category_id:
|
||||
- res_partner_category_customers0
|
||||
answers_ids:
|
||||
- crm_profiling_answer_openerppartner0
|
||||
|
||||
-
|
||||
Define the answers and category to partner.
|
||||
-
|
||||
!python {model: res.partner}: |
|
||||
data ={'form': {'questionnaire_name': ref('res_partner_john0')}, 'ids': [ref('res_partner_john0')], 'report_type': 'pdf', 'model': 'res.partner', 'id': ref('res_partner_john0')}
|
||||
self._questionnaire_compute(cr, uid, data, context)
|
||||
- |
|
||||
I start by creating new Questionnaire.
|
||||
-
|
||||
!record {model: crm_profiling.questionnaire, id: crm_profiling_questionnaire_basequestionnaire0}:
|
||||
description: First questionnaire.
|
||||
name: Base questionnaire
|
||||
questions_ids:
|
||||
- crm_profiling.activity_sector
|
||||
- crm_profiling.nb_employees
|
||||
- crm_profiling.partner_level
|
||||
- |
|
||||
I create the form for the "Base questionnaire".
|
||||
-
|
||||
!python {model: crm_profiling.questionnaire}: |
|
||||
context.update({'active_id':ref('res_partner_john0')})
|
||||
data ={'form': {'questionnaire_name': ref('res_partner_john0')}, 'ids': [ref('res_partner_john0')], 'report_type': 'pdf', 'model': 'res.partner', 'id': ref('res_partner_john0')}
|
||||
self.build_form(cr, uid, data, context)
|
||||
-
|
||||
I create a segmentation record.
|
||||
-
|
||||
!record {model: crm.segmentation, id: crm_segmentation_test1}:
|
||||
answer_yes:
|
||||
- crm_profiling_answer_openerppartner0
|
||||
categ_id: res_partner_category_customers0
|
||||
name: test
|
||||
parent_id: crm_profiling.crm_segmentation0
|
||||
profiling_active: true
|
||||
som_interval: 0.0
|
||||
- |
|
||||
I continue the process of segmentation.
|
||||
-
|
||||
!python {model: crm.segmentation}: |
|
||||
self.process_continue(cr, uid, [ref('crm_segmentation_test1')], start=False)
|
||||
|
|
@ -238,6 +238,25 @@ class delivery_grid_line(osv.osv):
|
|||
|
||||
delivery_grid_line()
|
||||
|
||||
class define_delivery_steps(osv.osv_memory):
|
||||
_name = 'delivery.define.delivery.steps.wizard'
|
||||
|
||||
_columns = {
|
||||
'picking_policy' : fields.selection([('direct', 'Partial Delivery'), ('one', 'Complete Delivery'),],
|
||||
'Picking Policy', required=True),
|
||||
}
|
||||
|
||||
def apply_cb(self, cr, uid, ids, context=None):
|
||||
ir_values_obj = self.pool.get('ir.values')
|
||||
|
||||
wizard = self.browse(cr, uid, ids, context=context)[0]
|
||||
|
||||
ir_values_obj.set(cr, uid, 'default', False, 'picking_policy', ['sale.order'], wizard.picking_policy)
|
||||
|
||||
return {'type' : 'ir.actions.act_window_close'}
|
||||
|
||||
define_delivery_steps()
|
||||
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@
|
|||
</record>
|
||||
|
||||
<record id="action_delivery_carrier_form1" model="ir.actions.act_window">
|
||||
<field name="name">Delivery Method</field>
|
||||
<field name="name">Define Delivery Methods</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">delivery.carrier</field>
|
||||
<field name="view_type">form</field>
|
||||
|
@ -332,8 +332,36 @@
|
|||
|
||||
<record id="delivery_method_form_view_todo" model="ir.actions.todo">
|
||||
<field name="action_id" ref="action_delivery_carrier_form1"/>
|
||||
<field name="category_id" ref="stock.category_stock_management_config" />
|
||||
<field name="sequence">10</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="define_delivery_steps_form">
|
||||
<field name="name">delivery.define_delivery_steps</field>
|
||||
<field name="model">delivery.define.delivery.steps.wizard</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Define Delivery Steps">
|
||||
<label string="" />
|
||||
<field name="picking_policy" />
|
||||
<group colspan="4">
|
||||
<button string="Cancel" icon="gtk-cancel" special="cancel" />
|
||||
<button string="Apply" icon="gtk-apply" name="apply_cb" type="object" />
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window" id="action_define_delivery_steps">
|
||||
<field name="name">Setup Your Delivery Steps</field>
|
||||
<field name="res_model">delivery.define.delivery.steps.wizard</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.todo" id="todo_define_delivery_steps">
|
||||
<field name="action_id" ref="action_define_delivery_steps" />
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
|
@ -455,7 +455,7 @@ class openerp_dav_handler(dav_interface):
|
|||
def get_cr(self, uri, allow_last=False):
|
||||
""" Split the uri, grab a cursor for that db
|
||||
"""
|
||||
pdb = self.parent.auth_proxy.last_auth
|
||||
pdb = self.parent.auth_provider.last_auth
|
||||
dbname, uri2 = self.get_db(uri, rest_ret=True, allow_last=allow_last)
|
||||
uri2 = (uri2 and uri2.split('/')) or []
|
||||
if not dbname:
|
||||
|
@ -463,10 +463,10 @@ class openerp_dav_handler(dav_interface):
|
|||
# if dbname was in our uri, we should have authenticated
|
||||
# against that.
|
||||
assert pdb == dbname, " %s != %s" %(pdb, dbname)
|
||||
res = self.parent.auth_proxy.auth_creds.get(dbname, False)
|
||||
res = self.parent.auth_provider.auth_creds.get(dbname, False)
|
||||
if not res:
|
||||
self.parent.auth_proxy.checkRequest(self.parent, uri, dbname)
|
||||
res = self.parent.auth_proxy.auth_creds[dbname]
|
||||
self.parent.auth_provider.checkRequest(self.parent, uri, dbname)
|
||||
res = self.parent.auth_provider.auth_creds[dbname]
|
||||
user, passwd, dbn2, uid = res
|
||||
db,pool = pooler.get_db_and_pool(dbname)
|
||||
cr = db.cursor()
|
||||
|
|
|
@ -40,7 +40,7 @@ from dav_fs import openerp_dav_handler
|
|||
from tools.config import config
|
||||
from DAV.WebDAVServer import DAVRequestHandler
|
||||
from service import http_server
|
||||
from service.websrv_lib import HTTPDir, FixSendError, HttpOptions
|
||||
from service.websrv_lib import FixSendError, HttpOptions
|
||||
from BaseHTTPServer import BaseHTTPRequestHandler
|
||||
import urlparse
|
||||
import urllib
|
||||
|
@ -174,11 +174,11 @@ class DAVHandler(HttpOptions, FixSendError, DAVRequestHandler):
|
|||
pass
|
||||
elif self.close_connection == 1: # close header already sent
|
||||
pass
|
||||
else:
|
||||
if headers is None:
|
||||
headers = {}
|
||||
if self.headers.get('Connection',False) == 'Keep-Alive':
|
||||
headers['Connection'] = 'keep-alive'
|
||||
elif headers and self.headers.get('Connection',False) == 'Keep-Alive':
|
||||
headers['Connection'] = 'keep-alive'
|
||||
|
||||
if headers is None:
|
||||
headers = {}
|
||||
|
||||
DAVRequestHandler.send_body(self, DATA, code=code, msg=msg, desc=desc,
|
||||
ctype=ctype, headers=headers)
|
||||
|
@ -572,7 +572,7 @@ try:
|
|||
|
||||
conf = OpenDAVConfig(**_dc)
|
||||
handler._config = conf
|
||||
reg_http_service(HTTPDir(directory,DAVHandler,DAVAuthProvider()))
|
||||
reg_http_service(directory, DAVHandler, DAVAuthProvider)
|
||||
logging.getLogger('webdav').info("WebDAV service registered at path: %s/ "% directory)
|
||||
|
||||
if not (config.get_misc('webdav', 'no_root_hack', False)):
|
||||
|
@ -592,9 +592,7 @@ try:
|
|||
# the StaticHttpHandler can find its dir_path.
|
||||
config.misc.setdefault('static-http',{})['dir_path'] = dir_path
|
||||
|
||||
if reg_http_service(HTTPDir('/', DAVStaticHandler)):
|
||||
logging.getLogger("web-services").info("WebDAV registered HTTP dir %s for /" % \
|
||||
(dir_path))
|
||||
reg_http_service('/', DAVStaticHandler)
|
||||
|
||||
except Exception, e:
|
||||
logging.getLogger('webdav').error('Cannot launch webdav: %s' % e)
|
||||
|
@ -613,8 +611,7 @@ def init_well_known():
|
|||
reps['/'+uri] = path
|
||||
|
||||
if int(num_svcs):
|
||||
if http_server.reg_http_service(HTTPDir('/.well-known', RedirectHTTPHandler)):
|
||||
logging.getLogger("web-services").info("Registered HTTP redirect handler at /.well-known" )
|
||||
reg_http_service('/.well-known', RedirectHTTPHandler)
|
||||
|
||||
init_well_known()
|
||||
|
||||
|
@ -641,7 +638,7 @@ def init_principals_redirect():
|
|||
dbname = config.get('db_name', False)
|
||||
if dbname:
|
||||
PrincipalsRedirect.redirect_paths[''] = '/webdav/%s/principals' % dbname
|
||||
reg_http_service(HTTPDir('/principals', PrincipalsRedirect))
|
||||
reg_http_service('/principals', PrincipalsRedirect)
|
||||
logging.getLogger("web-services").info(
|
||||
"Registered HTTP redirect handler for /principals to the %s db.",
|
||||
dbname)
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue