[FIX] s/profil/profile

(lp:c2c-financial-addons/6.1 rev 78.1.1)
This commit is contained in:
Alexandre Fayolle @ camptocamp
2012-08-02 14:46:12 +02:00
parent 9fb2fd48c2
commit 5addefbfbf
9 changed files with 45 additions and 45 deletions

View File

@@ -39,11 +39,11 @@ class ErrorTooManyPartner(Exception):
class AccountStatementProfil(Model): class AccountStatementProfil(Model):
""" """
Extend the class to add rules per profil that will match at least the partner, Extend the class to add rules per profile that will match at least the partner,
but it could also be used to match other values as well. but it could also be used to match other values as well.
""" """
_inherit = "account.statement.profil" _inherit = "account.statement.profile"
_columns={ _columns={
# @Akretion : For now, we don't implement this features, but this would probably be there: # @Akretion : For now, we don't implement this features, but this would probably be there:
@@ -115,7 +115,7 @@ class AccountStatementCompletionRule(Model):
_columns={ _columns={
'sequence': fields.integer('Sequence', help="Lower means paresed first."), 'sequence': fields.integer('Sequence', help="Lower means paresed first."),
'name': fields.char('Name', size=128), 'name': fields.char('Name', size=128),
'profile_ids': fields.many2many('account.statement.profil', 'profile_ids': fields.many2many('account.statement.profile',
rel='as_rul_st_prof_rel', rel='as_rul_st_prof_rel',
string='Related statement profiles'), string='Related statement profiles'),
'function_to_call': fields.selection(_get_functions, 'Method'), 'function_to_call': fields.selection(_get_functions, 'Method'),
@@ -296,7 +296,7 @@ class AccountStatementLine(Model):
the statement line or {}. The first dict has statement line ID as a key: the statement line or {}. The first dict has statement line ID as a key:
{117009: {'partner_id': 100997, 'account_id': 489L}} {117009: {'partner_id': 100997, 'account_id': 489L}}
""" """
profile_obj = self.pool.get('account.statement.profil') profile_obj = self.pool.get('account.statement.profile')
st_obj = self.pool.get('account.bank.statement.line') st_obj = self.pool.get('account.bank.statement.line')
res={} res={}
errors_stack = [] errors_stack = []

View File

@@ -48,8 +48,8 @@
</record> </record>
<record id="statement_rules_view_form" model="ir.ui.view"> <record id="statement_rules_view_form" model="ir.ui.view">
<field name="name">account.statement.profil.view</field> <field name="name">account.statement.profile.view</field>
<field name="model">account.statement.profil</field> <field name="model">account.statement.profile</field>
<field name="inherit_id" ref="account_statement_ext.statement_importer_view_form"/> <field name="inherit_id" ref="account_statement_ext.statement_importer_view_form"/>
<field name="type">form</field> <field name="type">form</field>
<field name="arch" type="xml"> <field name="arch" type="xml">

View File

@@ -41,7 +41,7 @@
* ref : the SO number, INV number or any matching ref found. It'll be used as reference * ref : the SO number, INV number or any matching ref found. It'll be used as reference
in the generated entries and will be useful for reconciliation process in the generated entries and will be useful for reconciliation process
* date : date of the payment * date : date of the payment
* amount : amount paid in the currency of the journal used in the importation profil * amount : amount paid in the currency of the journal used in the importation profile
* commission_amount : amount of the comission for each line * commission_amount : amount of the comission for each line
* label : the comunication given by the payment office, used as communication in the * label : the comunication given by the payment office, used as communication in the
generated entries. generated entries.

View File

@@ -31,7 +31,7 @@ import sys
import traceback import traceback
class AccountStatementProfil(Model): class AccountStatementProfil(Model):
_inherit = "account.statement.profil" _inherit = "account.statement.profile"
def get_import_type_selection(self, cr, uid, context=None): def get_import_type_selection(self, cr, uid, context=None):
@@ -48,7 +48,7 @@ class AccountStatementProfil(Model):
'last_import_date': fields.datetime("Last Import Date"), 'last_import_date': fields.datetime("Last Import Date"),
'rec_log': fields.text('log', readonly=True), 'rec_log': fields.text('log', readonly=True),
'import_type': fields.selection(get_import_type_selection, 'Type of import', required=True, 'import_type': fields.selection(get_import_type_selection, 'Type of import', required=True,
help = "Choose here the method by which you want to import bank statement for this profil."), help = "Choose here the method by which you want to import bank statement for this profile."),
} }
@@ -152,7 +152,7 @@ class AccountStatementProfil(Model):
statement_obj = self.pool.get('account.bank.statement') statement_obj = self.pool.get('account.bank.statement')
statement_line_obj = self.pool.get('account.bank.statement.line') statement_line_obj = self.pool.get('account.bank.statement.line')
attachment_obj = self.pool.get('ir.attachment') attachment_obj = self.pool.get('ir.attachment')
prof_obj = self.pool.get("account.statement.profil") prof_obj = self.pool.get("account.statement.profile")
if not profile_id: if not profile_id:
raise osv.except_osv( raise osv.except_osv(
_("No Profile !"), _("No Profile !"),

View File

@@ -4,8 +4,8 @@
<record id="statement_importer_view_form" model="ir.ui.view"> <record id="statement_importer_view_form" model="ir.ui.view">
<field name="name">account.statement.profil.view</field> <field name="name">account.statement.profile.view</field>
<field name="model">account.statement.profil</field> <field name="model">account.statement.profile</field>
<field name="inherit_id" ref="account_statement_ext.statement_importer_view_form"/> <field name="inherit_id" ref="account_statement_ext.statement_importer_view_form"/>
<field name="type">form</field> <field name="type">form</field>
<field name="arch" type="xml"> <field name="arch" type="xml">

View File

@@ -33,7 +33,7 @@ class CreditPartnerStatementImporter(osv.osv_memory):
def default_get(self, cr, uid, fields, context=None): def default_get(self, cr, uid, fields, context=None):
if context is None: context = {} if context is None: context = {}
res = {} res = {}
if (context.get('active_model', False) == 'account.statement.profil' and if (context.get('active_model', False) == 'account.statement.profile' and
context.get('active_ids', False)): context.get('active_ids', False)):
ids = context['active_ids'] ids = context['active_ids']
assert len(ids) == 1, 'You cannot use this on more than one profile !' assert len(ids) == 1, 'You cannot use this on more than one profile !'
@@ -43,7 +43,7 @@ class CreditPartnerStatementImporter(osv.osv_memory):
return res return res
_columns = { _columns = {
'profile_id': fields.many2one('account.statement.profil', 'profile_id': fields.many2one('account.statement.profile',
'Import configuration parameter', 'Import configuration parameter',
required=True), required=True),
'input_statement': fields.binary('Statement file', required=True), 'input_statement': fields.binary('Statement file', required=True),
@@ -76,7 +76,7 @@ class CreditPartnerStatementImporter(osv.osv_memory):
def onchange_profile_id(self, cr, uid, ids, profile_id, context=None): def onchange_profile_id(self, cr, uid, ids, profile_id, context=None):
res={} res={}
if profile_id: if profile_id:
c = self.pool.get("account.statement.profil").browse(cr,uid,profile_id) c = self.pool.get("account.statement.profile").browse(cr,uid,profile_id)
res = {'value': {'partner_id': c.partner_id and c.partner_id.id or False, res = {'value': {'partner_id': c.partner_id and c.partner_id.id or False,
'journal_id': c.journal_id and c.journal_id.id or False, 'commission_account_id': \ 'journal_id': c.journal_id and c.journal_id.id or False, 'commission_account_id': \
c.commission_account_id and c.commission_account_id.id or False, c.commission_account_id and c.commission_account_id.id or False,
@@ -101,7 +101,7 @@ class CreditPartnerStatementImporter(osv.osv_memory):
importer = self.browse(cursor, uid, req_id, context) importer = self.browse(cursor, uid, req_id, context)
ftype = self._check_extension(importer.file_name) ftype = self._check_extension(importer.file_name)
sid = self.pool.get( sid = self.pool.get(
'account.statement.profil').statement_import( 'account.statement.profile').statement_import(
cursor, cursor,
uid, uid,
False, False,

View File

@@ -32,7 +32,7 @@ class AccountStatementProfil(Model):
bank statement, and related generated entries. It defines the bank statement, and related generated entries. It defines the
journal to use, the partner and commision account and so on. journal to use, the partner and commision account and so on.
""" """
_name = "account.statement.profil" _name = "account.statement.profile"
_description = "Statement Profil" _description = "Statement Profil"
_columns = { _columns = {
@@ -85,9 +85,9 @@ class AccountBankSatement(Model):
""" """
We improve the bank statement class mostly for : We improve the bank statement class mostly for :
- Removing the period and compute it from the date of each line. - Removing the period and compute it from the date of each line.
- Allow to remove the balance check depending on the chosen profil - Allow to remove the balance check depending on the chosen profile
- Report errors on confirmation all at once instead of crashing onr by one - Report errors on confirmation all at once instead of crashing onr by one
- Add a profil notion that can change the generated entries on statement - Add a profile notion that can change the generated entries on statement
confirmation. confirmation.
For this, we had to override quite some long method and we'll need to maintain For this, we had to override quite some long method and we'll need to maintain
them up to date. Changes are point up by '#Chg' comment. them up to date. Changes are point up by '#Chg' comment.
@@ -96,7 +96,7 @@ class AccountBankSatement(Model):
_inherit = "account.bank.statement" _inherit = "account.bank.statement"
_columns = { _columns = {
'profile_id': fields.many2one('account.statement.profil', 'profile_id': fields.many2one('account.statement.profile',
'Profil', required=True, readonly=True, states={'draft': [('readonly', False)]}), 'Profil', required=True, readonly=True, states={'draft': [('readonly', False)]}),
'credit_partner_id': fields.related( 'credit_partner_id': fields.related(
'profile_id', 'profile_id',
@@ -129,8 +129,8 @@ class AccountBankSatement(Model):
"""Need to pass the journal_id in vals anytime because of account.cash.statement """Need to pass the journal_id in vals anytime because of account.cash.statement
need it.""" need it."""
if 'profile_id' in vals: if 'profile_id' in vals:
profil_obj = self.pool.get('account.statement.profil') profile_obj = self.pool.get('account.statement.profile')
profile = profil_obj.browse(cr,uid,vals['profile_id'],context) profile = profile_obj.browse(cr,uid,vals['profile_id'],context)
vals['journal_id'] = profile.journal_id.id vals['journal_id'] = profile.journal_id.id
return super(AccountBankSatement, self).create(cr, uid, vals, context=context) return super(AccountBankSatement, self).create(cr, uid, vals, context=context)
@@ -185,7 +185,7 @@ class AccountBankSatement(Model):
Override a large portion of the code to compute the periode for each line instead of Override a large portion of the code to compute the periode for each line instead of
taking the period of the whole statement. taking the period of the whole statement.
Remove the entry posting on generated account moves. Remove the entry posting on generated account moves.
We change the move line generated from the lines depending on the profil: We change the move line generated from the lines depending on the profile:
- If receivable_account_id is set, we'll use it instead of the "partner" one - If receivable_account_id is set, we'll use it instead of the "partner" one
- If partner_id is set, we'll us it for the commission (when imported throufh the wizard) - If partner_id is set, we'll us it for the commission (when imported throufh the wizard)
- If partner_id is set and force_partner_on_bank is ticked, we'll let the partner of each line - If partner_id is set and force_partner_on_bank is ticked, we'll let the partner of each line
@@ -310,19 +310,19 @@ class AccountBankSatement(Model):
account_move_obj.post(cr, uid, [move_id], context=context) account_move_obj.post(cr, uid, [move_id], context=context)
return move_id return move_id
def _get_st_number_period_profil(self, cr, uid, date, profile_id): def _get_st_number_period_profile(self, cr, uid, date, profile_id):
""" """
Retrieve the name of bank statement from sequence, according to the period Retrieve the name of bank statement from sequence, according to the period
corresponding to the date passed in args. Add a prefix if set in the profil. corresponding to the date passed in args. Add a prefix if set in the profile.
:param: date: date of the statement used to compute the right period :param: date: date of the statement used to compute the right period
:param: int/long: profile_id: the account.statement.profil ID from which to take the :param: int/long: profile_id: the account.statement.profile ID from which to take the
bank_statement_prefix for the name bank_statement_prefix for the name
:return: char: name of the bank statement (st_number) :return: char: name of the bank statement (st_number)
""" """
year = self.pool.get('account.period').browse(cr, uid, self._get_period(cr, uid, date)).fiscalyear_id.id year = self.pool.get('account.period').browse(cr, uid, self._get_period(cr, uid, date)).fiscalyear_id.id
profile = self.pool.get('account.statement.profil').browse(cr,uid, profile_id) profile = self.pool.get('account.statement.profile').browse(cr,uid, profile_id)
c = {'fiscalyear_id': year} c = {'fiscalyear_id': year}
obj_seq = self.pool.get('ir.sequence') obj_seq = self.pool.get('ir.sequence')
journal_sequence_id = profile.journal_id.sequence_id and profile.journal_id.sequence_id.id or False journal_sequence_id = profile.journal_id.sequence_id and profile.journal_id.sequence_id.id or False
@@ -364,7 +364,7 @@ class AccountBankSatement(Model):
st_number = st.name st_number = st.name
else: else:
# Begin Changes # Begin Changes
st_number = self._get_st_number_period_profil(cr, uid, st.date, st.profile_id.id) st_number = self._get_st_number_period_profile(cr, uid, st.date, st.profile_id.id)
# End Changes # End Changes
for line in st.move_line_ids: for line in st.move_line_ids:
if line.state <> 'valid': if line.state <> 'valid':
@@ -466,7 +466,7 @@ class AccountBankSatement(Model):
def balance_check(self, cr, uid, st_id, journal_type='bank', context=None): def balance_check(self, cr, uid, st_id, journal_type='bank', context=None):
""" """
Balance check depends on the profil. If no check for this profil is required, Balance check depends on the profile. If no check for this profile is required,
return True and do nothing, otherwise call super. return True and do nothing, otherwise call super.
:param int/long st_id: ID of the concerned account.bank.statement :param int/long st_id: ID of the concerned account.bank.statement
@@ -488,7 +488,7 @@ class AccountBankSatement(Model):
""" """
if not profile_id: if not profile_id:
return {} return {}
import_config = self.pool.get("account.statement.profil").browse(cr,uid,profile_id) import_config = self.pool.get("account.statement.profile").browse(cr,uid,profile_id)
journal_id = import_config.journal_id.id journal_id = import_config.journal_id.id
account_id = import_config.journal_id.default_debit_account_id.id account_id = import_config.journal_id.default_debit_account_id.id
credit_partner_id = import_config.partner_id and import_config.partner_id.id or False credit_partner_id = import_config.partner_id and import_config.partner_id.id or False
@@ -531,7 +531,7 @@ class AccountBankSatementLine(Model):
def get_values_for_line(self, cr, uid, profile_id = False, partner_id = False, line_type = False, amount = False, context = None): def get_values_for_line(self, cr, uid, profile_id = False, partner_id = False, line_type = False, amount = False, context = None):
""" """
Return the account_id to be used in the line of a bank statement. It'll base the result as follow: Return the account_id to be used in the line of a bank statement. It'll base the result as follow:
- If a receivable_account_id is set in the profil, return this value and type = general - If a receivable_account_id is set in the profile, return this value and type = general
- Elif line_type is given, take the partner receivable/payable property (payable if type= supplier, receivable - Elif line_type is given, take the partner receivable/payable property (payable if type= supplier, receivable
otherwise) otherwise)
- Elif amount is given, take the partner receivable/payable property (receivable if amount >= 0.0, - Elif amount is given, take the partner receivable/payable property (receivable if amount >= 0.0,
@@ -558,9 +558,9 @@ class AccountBankSatementLine(Model):
obj_partner = self.pool.get('res.partner') obj_partner = self.pool.get('res.partner')
obj_stat = self.pool.get('account.bank.statement') obj_stat = self.pool.get('account.bank.statement')
receiv_account = pay_account = account_id = False receiv_account = pay_account = account_id = False
# If profil has a receivable_account_id, we return it in any case # If profile has a receivable_account_id, we return it in any case
if profile_id: if profile_id:
profile = self.pool.get("account.statement.profil").browse(cr,uid,profile_id) profile = self.pool.get("account.statement.profile").browse(cr,uid,profile_id)
if profile.receivable_account_id: if profile.receivable_account_id:
res['account_id'] = profile.receivable_account_id.id res['account_id'] = profile.receivable_account_id.id
res['type'] = 'general' res['type'] = 'general'

View File

@@ -28,8 +28,8 @@
</record> </record>
<record id="statement_importer_view_form" model="ir.ui.view"> <record id="statement_importer_view_form" model="ir.ui.view">
<field name="name">account.statement.profil.view</field> <field name="name">account.statement.profile.view</field>
<field name="model">account.statement.profil</field> <field name="model">account.statement.profile</field>
<field name="type">form</field> <field name="type">form</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<form string="Import statement"> <form string="Import statement">
@@ -48,8 +48,8 @@
</record> </record>
<record id="statement_importer_view_tree" model="ir.ui.view"> <record id="statement_importer_view_tree" model="ir.ui.view">
<field name="name">account.statement.profil.view</field> <field name="name">account.statement.profile.view</field>
<field name="model">account.statement.profil</field> <field name="model">account.statement.profile</field>
<field name="type">tree</field> <field name="type">tree</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<tree string="Import statement"> <tree string="Import statement">
@@ -64,14 +64,14 @@
</tree> </tree>
</field> </field>
</record> </record>
<record id="action_treasury_statement_profil_tree" model="ir.actions.act_window"> <record id="action_treasury_statement_profile_tree" model="ir.actions.act_window">
<field name="name">Bank Statements Profile</field> <field name="name">Bank Statements Profile</field>
<field name="res_model">account.statement.profil</field> <field name="res_model">account.statement.profile</field>
<field name="view_type">form</field> <field name="view_type">form</field>
<field name="view_mode">tree,form</field> <field name="view_mode">tree,form</field>
</record> </record>
<menuitem string="Bank Statements Profile" action="action_treasury_statement_profil_tree" id="menu_treasury_statement_profil_tree" parent="account.menu_configuration_misc" sequence="30"/> <menuitem string="Bank Statements Profile" action="action_treasury_statement_profile_tree" id="menu_treasury_statement_profile_tree" parent="account.menu_configuration_misc" sequence="30"/>
<record model="ir.ui.view" id="id_in_statement_line"> <record model="ir.ui.view" id="id_in_statement_line">
<field name="name">account.bank.statement.line.inherit</field> <field name="name">account.bank.statement.line.inherit</field>
@@ -136,7 +136,7 @@
</xpath> </xpath>
<xpath expr="/form/group/field[@name='date']" position="replace"> <xpath expr="/form/group/field[@name='date']" position="replace">
</xpath> </xpath>
<!-- Add a new group before the first one with name, profil and date --> <!-- Add a new group before the first one with name, profile and date -->
<xpath expr="/form/group[@col='7']" position="before"> <xpath expr="/form/group[@col='7']" position="before">
<group col="8" colspan="4"> <group col="8" colspan="4">
<field name="profile_id" select="1" required="1" on_change="onchange_imp_config_id(profile_id)" widget="selection"/> <field name="profile_id" select="1" required="1" on_change="onchange_imp_config_id(profile_id)" widget="selection"/>
@@ -145,7 +145,7 @@
</group> </group>
<separator string="Profile Details" colspan="4"/> <separator string="Profile Details" colspan="4"/>
</xpath> </xpath>
<!-- Make balance visible or not depending on profil --> <!-- Make balance visible or not depending on profile -->
<xpath expr="/form/group/field[@name='balance_start']" position="replace"> <xpath expr="/form/group/field[@name='balance_start']" position="replace">
</xpath> </xpath>
<xpath expr="/form/group/field[@name='balance_end_real']" position="replace"> <xpath expr="/form/group/field[@name='balance_end_real']" position="replace">
@@ -199,7 +199,7 @@
<act_window id="act_bank_statement_from_profile" <act_window id="act_bank_statement_from_profile"
name="Open Statements" name="Open Statements"
res_model="account.bank.statement" res_model="account.bank.statement"
src_model="account.statement.profil" src_model="account.statement.profile"
domain="[('profile_id','=',active_id),]" domain="[('profile_id','=',active_id),]"
view_type="form"/> view_type="form"/>

View File

@@ -23,7 +23,7 @@ from openerp.osv.orm import Model, fields
from openerp.osv import fields, osv from openerp.osv import fields, osv
class AccountStatementProfil(Model): class AccountStatementProfil(Model):
_inherit = "account.statement.profil" _inherit = "account.statement.profile"
def get_import_type_selection(self, cr, uid, context=None): def get_import_type_selection(self, cr, uid, context=None):
@@ -37,7 +37,7 @@ class AccountStatementProfil(Model):
_columns = { _columns = {
'import_type': fields.selection(get_import_type_selection, 'Type of import', required=True, 'import_type': fields.selection(get_import_type_selection, 'Type of import', required=True,
help = "Choose here the method by which you want to import bank statement for this profil."), help = "Choose here the method by which you want to import bank statement for this profile."),
} }