bzr revid: pso@tinyerp.com-20101104072520-it1ccngp8p4ufocu
This commit is contained in:
pso
2010-11-04 12:55:20 +05:30
16 changed files with 142 additions and 83 deletions
+7 -7
View File
@@ -2959,18 +2959,18 @@ class wizard_multi_charts_accounts(osv.osv_memory):
wizard_multi_charts_accounts()
class account_bank_accounts_wizard(osv.osv_memory):
_name='account.bank.accounts.wizard'
_name = 'account.bank.accounts.wizard'
_columns = {
'acc_name':fields.char('Account Name.', size=64, required=True),
'bank_account_id':fields.many2one('wizard.multi.charts.accounts', 'Bank Account', required=True),
'currency_id':fields.many2one('res.currency', 'Currency'),
'account_type':fields.selection([('cash','Cash'),('check','Check'),('bank','Bank')], 'Type', size=32),
'acc_name': fields.char('Account Name.', size=64, required=True),
'bank_account_id': fields.many2one('wizard.multi.charts.accounts', 'Bank Account', required=True),
'currency_id': fields.many2one('res.currency', 'Currency'),
'account_type': fields.selection([('cash','Cash'),('check','Check'),('bank','Bank')], 'Type', size=32),
}
_defaults = {
'currency_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.currency_id.id,
}
}
account_bank_accounts_wizard()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+1 -1
View File
@@ -141,7 +141,7 @@ class account_bank_statement(osv.osv):
res[statement_id] = (currency_id, currency_names[currency_id])
return res
_order = "date desc"
_order = "date desc, id desc"
_name = "account.bank.statement"
_description = "Bank Statement"
_columns = {
@@ -162,7 +162,6 @@ class account_move_journal(osv.osv_memory):
result = data_pool.get_object_reference(cr, uid, 'account', 'view_account_move_line_filter')
res_id = result and result[1] or False
return {
'name': name,
'view_type': 'form',
@@ -37,13 +37,12 @@ class report_rappel(report_sxw.rml_parse):
'get_text': self._get_text
})
def _ids_to_objects(self, partners_ids):
def _ids_to_objects(self, partner_ids):
pool = pooler.get_pool(self.cr.dbname)
all_partners = []
for partner in partners_ids:
partners = pool.get('account_followup.stat').browse(self.cr, self.uid, [partner])
for par in partners:
all_partners.append(par.name)
for partner in pool.get('res.partner').browse(self.cr, self.uid, partner_ids):
if partner not in all_partners:
all_partners.append(partner)
return all_partners
def _adr_get(self, partner, type):
@@ -22,20 +22,13 @@
from osv import fields, osv
import tools
def _code_get(self, cr, uid, context={}):
acc_type_obj = self.pool.get('account.account.type')
ids = acc_type_obj.search(cr, uid, [])
res = acc_type_obj.read(cr, uid, ids, ['code', 'name'], context)
return [(r['code'], r['name']) for r in res]
class account_followup_stat(osv.osv):
_name = "account_followup.stat"
_description = "Followup Statistics"
_rec_name = 'partner_id'
_auto = False
_columns = {
'name': fields.many2one('res.partner', 'Partner', readonly=True),
'account_type': fields.selection(_code_get, 'Account Type', readonly=True),
'partner_id': fields.many2one('res.partner', 'Partner', readonly=True),
'date_move':fields.date('First move', readonly=True),
'date_move_last':fields.date('Last move', readonly=True),
'date_followup':fields.date('Latest followup', readonly=True),
@@ -58,10 +51,7 @@ class account_followup_stat(osv.osv):
current_year = self.pool.get('account.fiscalyear').find(cr, uid)
ids = self.pool.get('account.fiscalyear').read(cr, uid, [current_year], ['period_ids'])[0]['period_ids']
args.append(['period_id','in',ids])
for a in [['period_id','in','current_year']]:
temp_args = tuple(a)
if temp_args in args:
args.remove(temp_args)
args.remove(arg)
return super(account_followup_stat, self).search(cr, uid, args=args, offset=offset, limit=limit, order=order,
context=context, count=count)
@@ -72,47 +62,37 @@ class account_followup_stat(osv.osv):
current_year = self.pool.get('account.fiscalyear').find(cr, uid)
ids = self.pool.get('account.fiscalyear').read(cr, uid, [current_year], ['period_ids'])[0]['period_ids']
domain.append(['period_id','in',ids])
todel.append(arg)
for a in [['period_id','in','current_year']]:
temp_args = tuple(a)
if temp_args in domain:
domain.remove(temp_args)
domain.remove(arg)
return super(account_followup_stat, self).read_group(cr, uid, domain, fields, groupby, offset, limit, context)
def init(self, cr):
tools.drop_view_if_exists(cr, 'account_followup_stat')
cr.execute("""
create or replace view account_followup_stat as (
select
l.partner_id as id,
l.partner_id as name,
min(l.date) as date_move,
max(l.date) as date_move_last,
max(l.followup_date) as date_followup,
max(l.followup_line_id) as followup_id,
sum(l.debit) as debit,
sum(l.credit) as credit,
sum(l.debit - l.credit) as balance,
a.type as account_type,
l.company_id as company_id,
l.blocked,
am.period_id as period_id
from
SELECT
l.id AS id,
l.partner_id AS partner_id,
min(l.date) AS date_move,
max(l.date) AS date_move_last,
max(l.followup_date) AS date_followup,
max(l.followup_line_id) AS followup_id,
sum(l.debit) AS debit,
sum(l.credit) AS credit,
sum(l.debit - l.credit) AS balance,
l.company_id AS company_id,
l.blocked as blocked,
l.period_id AS period_id
FROM
account_move_line l
LEFT JOIN account_account a ON (l.account_id=a.id)
LEFT JOIN res_company c ON (l.company_id=c.id)
LEFT JOIN account_move am ON (am.id=l.move_id)
LEFT JOIN account_period p ON (am.period_id=p.id)
where
l.reconcile_id is NULL and
a.type = 'receivable'
and a.active and
l.partner_id is not NULL and
l.company_id is not NULL and
l.blocked is not NULL
group by
l.partner_id, a.type, l.company_id,l.blocked,am.period_id
LEFT JOIN account_account a ON (l.account_id = a.id)
WHERE
a.active AND
a.type = 'receivable' AND
l.reconcile_id is NULL AND
l.partner_id IS NOT NULL
GROUP BY
l.id, l.partner_id, l.company_id, l.blocked, l.period_id
)""")
account_followup_stat()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -8,15 +8,15 @@
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Follow-Up lines">
<field name="name"/>
<field name="partner_id"/>
<field name="date_move"/>
<field name="date_move_last"/>
<field name="date_followup" />
<field name="followup_id" />
<field name="balance" sum="Balance"/>
<field name="debit"/>
<field name="credit"/>
<field name="company_id"/>
<field name="balance" sum="Balance"/>
<field name="company_id" groups="base.group_multi_company"/>
<field name="blocked" invisible="1" />
<field name="period_id" invisible="1" />
@@ -30,7 +30,7 @@
<field name="type">graph</field>
<field name="arch" type="xml">
<graph string="Follow-Up lines" type="bar">
<field name="name"/>
<field name="partner_id"/>
<field name="balance" operator="+"/>
</graph>
</field>
@@ -51,18 +51,20 @@
domain="[('blocked','=', False)]"
help = "Including journal entries marked as a litigation"/>
<separator orientation="vertical"/>
<field name="name"/>
<field name="partner_id"/>
<field name="balance" />
<field name="date_move" />
<field name="date_move_last" />
</group>
<newline/>
<group expand="1" string="Group By...">
<filter string="Followup Level" icon="terp-stock_effects-object-colorize" name="followup_level" context="{'group_by':'followup_id'}" />
<filter string="Latest Followup Date" icon="terp-go-month" context="{'group_by':'date_followup'}" />
<filter string="Partner" icon="terp-partner" context="{'group_by':'partner_id'}" />
<separator orientation="vertical"/>
<filter string="Litigation" icon="terp-camera_test" context="{'group_by':'blocked'}" />
<separator orientation="vertical"/>
<filter string="Followup Level" icon="terp-stock_effects-object-colorize" name="followup_level" context="{'group_by':'followup_id'}" />
<filter string="Latest Followup Date" icon="terp-go-month" context="{'group_by':'date_followup'}" />
<separator orientation="vertical" groups="base.group_multi_company"/>
<filter string="Company" groups="base.group_multi_company" icon="terp-go-home" context="{'group_by':'company_id'}" />
</group>
</search>
@@ -76,9 +78,8 @@
<field name="context">{'search_default_followup_level':1,'search_default_fiscalyear':1}</field>
<field name="search_view_id" ref="view_account_followup_stat_search"/>
</record>
<!-- <menuitem name="Partners Follow-Ups" id="menu_action_followup_stat" parent="account.menu_finance_generic_reporting"/> -->
<menuitem action="action_followup_stat" id="menu_action_followup_stat_follow" parent="account.next_id_22"/>
<menuitem action="action_followup_stat" id="menu_action_followup_stat_follow" parent="account.next_id_22" groups="account.group_account_user"/>
</data>
</openerp>
@@ -4,3 +4,4 @@
"access_account_followup_followup_line_manager","account_followup.followup.line.manager","model_account_followup_followup_line","account.group_account_manager",1,1,1,1
"access_account_followup_followup_accountant","account_followup.followup user","model_account_followup_followup","account.group_account_user",1,0,0,0
"access_account_followup_stat_invoice","account_followup.stat.invoice","model_account_followup_stat","account.group_account_invoice",1,1,1,1
"access_account_followup_stat_by_partner_manager","account_followup.stat.by.partner","model_account_followup_stat_by_partner","account.group_account_manager",1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
4 access_account_followup_followup_line_manager account_followup.followup.line.manager model_account_followup_followup_line account.group_account_manager 1 1 1 1
5 access_account_followup_followup_accountant account_followup.followup user model_account_followup_followup account.group_account_user 1 0 0 0
6 access_account_followup_stat_invoice account_followup.stat.invoice model_account_followup_stat account.group_account_invoice 1 1 1 1
7 access_account_followup_stat_by_partner_manager account_followup.stat.by.partner model_account_followup_stat_by_partner account.group_account_manager 1 1 1 1
@@ -67,14 +67,55 @@ class account_followup_print(osv.osv_memory):
'date': time.strftime('%Y-%m-%d'),
'followup_id': _get_followup,
}
account_followup_print()
class account_followup_stat_by_partner(osv.osv):
_name = "account_followup.stat.by.partner"
_description = "Followup Statistics by Partner"
_rec_name = 'partner_id'
_auto = False
_columns = {
'partner_id': fields.many2one('res.partner', 'Partner', readonly=True),
'date_move':fields.date('First move', readonly=True),
'date_move_last':fields.date('Last move', readonly=True),
'date_followup':fields.date('Latest followup', readonly=True),
'max_followup_id': fields.many2one('account_followup.followup.line',
'Max Follow Up Level', readonly=True, ondelete="cascade"),
'balance':fields.float('Balance', readonly=True),
'company_id': fields.many2one('res.company', 'Company', readonly=True),
}
def init(self, cr):
tools.drop_view_if_exists(cr, 'account_followup_stat_by_partner')
cr.execute("""
create or replace view account_followup_stat_by_partner as (
SELECT
l.partner_id AS id,
l.partner_id AS partner_id,
min(l.date) AS date_move,
max(l.date) AS date_move_last,
max(l.followup_date) AS date_followup,
max(l.followup_line_id) AS max_followup_id,
sum(l.debit - l.credit) AS balance,
l.company_id company_id
FROM
account_move_line l
LEFT JOIN account_account a ON (l.account_id = a.id)
WHERE
a.active AND
a.type = 'receivable' AND
l.reconcile_id is NULL AND
l.partner_id IS NOT NULL
GROUP BY
l.partner_id, l.company_id
)""")
account_followup_stat_by_partner()
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', 'partner_stat_rel', 'followup_id', 'stat_id', 'Partners', required=True),
'partner_ids': fields.many2many('account_followup.stat.by.partner', 'partner_stat_rel', 'osv_memory_id', 'partner_id', 'Partners', required=True, domain="[('account_id.type', '=', 'receivable'), ('account_id.reconcile', '=', True), ('reconcile_id','=', False), ('state', '!=', 'draft'), ('account_id.active', '=' True), ('debit', '>', 0)]"),
'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'),
@@ -94,7 +135,7 @@ class account_followup_print_all(osv.osv_memory):
_defaults = {
'email_body': _get_msg,
'email_subject': 'Invoices Reminder',
'email_subject': _('Invoices Reminder'),
'partner_lang': True,
'partner_ids': _get_partners,
'summary': _get_summary,
@@ -295,4 +336,4 @@ class account_followup_print_all(osv.osv_memory):
account_followup_print_all()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -36,8 +36,38 @@
parent="account.menu_finance_periodical_processing_billing"
sequence="10"/>
<record id="account_followup_stat_by_partner_search" model="ir.ui.view">
<field name="name">account_followup.stat.by.partner.search</field>
<field name="model">account_followup.stat.by.partner</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Partner to Remind">
<filter string="Balance > 0" domain="[('balance','&gt;',0)]" icon="terp-dolar" name="balance_positive"/>
<separator orientation="vertical"/>
<field name="partner_id"/>
<field name="max_followup_id"/>
<field name="date_followup"/>
<field name="company_id" groups="base.group_multi_company"/>
</search>
</field>
</record>
<!-- Screen2 -->
<record id="account_followup_stat_by_partner_tree" model="ir.ui.view">
<field name="name">account_followup.stat.by.partner.tree</field>
<field name="model">account_followup.stat.by.partner</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Partner to Remind">
<field name="partner_id"/>
<field name="balance"/>
<field name="max_followup_id"/>
<field name="date_followup"/>
<field name="date_move_last"/>
<field name="company_id" groups="base.group_multi_company"/>
</tree>
</field>
</record>
<record id="view_account_followup_print_all" model="ir.ui.view">
<field name="name">account.followup.print.all.form</field>
@@ -48,8 +78,8 @@
<group col="4" colspan="6">
<notebook>
<page string="Partner Selection">
<separator string="Select partners to remind" colspan="4"/>
<field name="partner_ids" colspan="4" nolabel="1"/>
<separator string="Select Partners to Remind" colspan="4"/>
<field name="partner_ids" colspan="4" nolabel="1" context="{'search_default_balance_positive': 1}"/>
</page>
<page string="Email Settings">
<field name="email_conf" colspan="4"/>
+2 -2
View File
@@ -32,7 +32,7 @@ class payment_mode(osv.osv):
'bank_id': fields.many2one('res.partner.bank', "Bank account",
required=True,help='Bank Account for the Payment Mode'),
'journal': fields.many2one('account.journal', 'Journal', required=True,
domain=[('type', '=', 'cash')], help='Cash Journal for the Payment Mode'),
domain=[('type', 'in', ('bank','cash'))], help='Bank or Cash Journal for the Payment Mode'),
'company_id': fields.many2one('res.company', 'Company', required=True),
}
_defaults = {
@@ -452,4 +452,4 @@ class payment_line(osv.osv):
payment_line()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+1 -1
View File
@@ -9,7 +9,7 @@
res_model="crm.phonecall"
src_model="crm.lead"
view_mode="tree,calendar,form"
context="{'default_duration': 1.0 ,'default_opportunity_id': active_id}"
context="{'default_duration': 1.0 ,'default_opportunity_id': active_id,'default_partner_phone':phone}"
domain="[('opportunity_id', '=', active_id)]"
view_type="form"/>
+1 -1
View File
@@ -243,7 +243,7 @@ class hr_expense_line(osv.osv):
'unit_quantity': 1,
'date_value': time.strftime('%Y-%m-%d'),
}
_order = "sequence"
_order = "sequence, date_value desc"
def onchange_product_id(self, cr, uid, ids, product_id, uom_id, employee_id, context=None):
if context is None:
@@ -120,5 +120,7 @@ class hr_expense_report(osv.osv):
s.employee_id
)
""")
hr_expense_report()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+2
View File
@@ -6725,6 +6725,7 @@
<field name="name">TVA 21% Services</field>
<field name="description">V-NAT-S 21</field>
<field eval="0.21" name="amount"/>
<field eval="0" name="sequence"/>
<field name="type">percent</field>
<field name="account_collected_id" ref="vat_payable21"/>
<field name="account_paid_id" ref="vat_payable21"/>
@@ -6899,6 +6900,7 @@
<field name="name">Services Divers Déductibles 21%</field>
<field name="description">A-NAT-S 21</field>
<field eval="1.00" name="amount"/>
<field eval="0" name="sequence"/>
<field name="type">percent</field>
<field eval="1" name="child_depend"/>
<field name="type_tax_use">purchase</field>
+6 -3
View File
@@ -174,16 +174,19 @@ class sale_order(osv.osv):
if not len(args):
return []
clause = ''
sale_clause = ''
no_invoiced = False
for arg in args:
if arg[1] == '=':
if arg[2]:
clause += 'AND inv.state = \'paid\''
else:
clause += 'AND inv.state <> \'paid\''
clause += 'AND inv.state != \'cancel\' AND sale.state != \'cancel\' AND inv.state <> \'paid\' AND rel.order_id = sale.id '
sale_clause = ', sale_order AS sale '
no_invoiced = True
cursor.execute('SELECT rel.order_id ' \
'FROM sale_order_invoice_rel AS rel, account_invoice AS inv ' \
'FROM sale_order_invoice_rel AS rel, account_invoice AS inv '+ sale_clause + \
'WHERE rel.invoice_id = inv.id ' + clause)
res = cursor.fetchall()
if no_invoiced:
@@ -191,7 +194,7 @@ class sale_order(osv.osv):
'FROM sale_order AS sale ' \
'WHERE sale.id NOT IN ' \
'(SELECT rel.order_id ' \
'FROM sale_order_invoice_rel AS rel)')
'FROM sale_order_invoice_rel AS rel) and sale.state != \'cancel\'')
res.extend(cursor.fetchall())
if not res:
return [('id', '=', 0)]
+1
View File
@@ -82,6 +82,7 @@
<field name="name">sale.order.tree</field>
<field name="model">sale.order</field>
<field name="type">tree</field>
<field name="priority">2</field>
<field name="arch" type="xml">
<tree string="Sales Orders" colors="grey:state=='done'">
<field name="name"/>