[MERGE] merged the xrg branch containing several bugfixes

bzr revid: qdp-launchpad@tinyerp.com-20101230115309-drnbznu04hx52cbj
This commit is contained in:
qdp-launchpad@tinyerp.com 2010-12-30 12:53:09 +01:00
commit 32589e25b4
20 changed files with 108 additions and 96 deletions

View File

@ -479,7 +479,7 @@
<para style="terp_default_Bold_9_Right">[[ formatLang(sum_balance_account(o), digits=get_digits(dp='Account')) ]] [[ company.currency_id.symbol ]]</para>
</td>
<td>
<para style="terp_default_Bold_9_Right">[[ o.currency_id and formatLang(sum_currency_amount_account(o), digits=get_digits(dp='Account')) + o.currency_id.code or '' ]]</para>
<para style="terp_default_Bold_9_Right">[[ o.currency_id and formatLang(sum_currency_amount_account(o), digits=get_digits(dp='Account')) + o.currency_id.symbol or '' ]]</para>
</td>
</tr>
</blockTable>
@ -616,4 +616,4 @@
</section>
</pto>
</story>
</document>
</document>

View File

@ -508,7 +508,7 @@
<para style="terp_default_Bold_7_Right">[[ formatLang(sum_balance_account(o), digits=get_digits(dp='Account')) ]] [[ company.currency_id.symbol ]]</para>
</td>
<td>
<para style="terp_default_Bold_7_Right">[[ o.currency_id and formatLang(sum_currency_amount_account(o), digits=get_digits(dp='Account')) + o.currency_id.code or '' ]]</para>
<para style="terp_default_Bold_7_Right">[[ o.currency_id and formatLang(sum_currency_amount_account(o), digits=get_digits(dp='Account')) + o.currency_id.symbol or '' ]]</para>
</td>
</tr>
</blockTable>

View File

@ -28,8 +28,6 @@ from common_report_header import common_report_header
class partner_balance(report_sxw.rml_parse, common_report_header):
def __init__(self, cr, uid, name, context=None):
if context is None:
context = {}
super(partner_balance, self).__init__(cr, uid, name, context=context)
self.account_ids = []
self.localcontext.update( {
@ -276,6 +274,7 @@ class partner_balance(report_sxw.rml_parse, common_report_header):
return temp_res
def _sum_litige(self):
#gives the total of move lines with blocked boolean set to TRUE for the report selection
move_state = ['draft','posted']
if self.target_move == 'posted':
move_state = ['posted']
@ -296,12 +295,15 @@ class partner_balance(report_sxw.rml_parse, common_report_header):
return temp_res
def _get_partners(self):
cr, uid = self.cr, self.uid
context = self.localcontext # all of it?
if self.result_selection == 'customer':
return 'Receivable Accounts'
return _('Receivable Accounts')
elif self.result_selection == 'supplier':
return 'Payable Accounts'
return _('Payable Accounts')
elif self.result_selection == 'customer_supplier':
return 'Receivable and Payable Accounts'
return _('Receivable and Payable Accounts')
return ''
report_sxw.report_sxw('report.account.partner.balance', 'res.partner', 'account/report/account_partner_balance.rml',parser=partner_balance, header="internal")

View File

@ -384,7 +384,7 @@ class account_analytic_account(osv.osv):
'ca_to_invoice': fields.function(_analysis_all, method=True, multi='analytic_analysis', type='float', string='Uninvoiced Amount',
help="If invoice from analytic account, the remaining amount you can invoice to the customer based on the total costs.",
digits_compute=dp.get_precision('Account')),
'ca_theorical': fields.function(_analysis_all, method=True, multi='analytic_analysis', type='float', string='Theorical Revenue',
'ca_theorical': fields.function(_analysis_all, method=True, multi='analytic_analysis', type='float', string='Theoretical Revenue',
help="Based on the costs you had on the project, what would have been the revenue if all these costs have been invoiced at the normal sale price provided by the pricelist.",
digits_compute=dp.get_precision('Account')),
'hours_quantity': fields.function(_analysis_all, method=True, multi='analytic_analysis', type='float', string='Hours Tot',
@ -410,7 +410,7 @@ class account_analytic_account(osv.osv):
'real_margin': fields.function(_real_margin_calc, method=True, type='float', string='Real Margin',
help="Computed using the formula: Invoiced Amount - Total Costs.",
digits_compute=dp.get_precision('Account')),
'theorical_margin': fields.function(_theorical_margin_calc, method=True, type='float', string='Theorical Margin',
'theorical_margin': fields.function(_theorical_margin_calc, method=True, type='float', string='Theoretical Margin',
help="Computed using the formula: Theorial Revenue - Total Costs",
digits_compute=dp.get_precision('Account')),
'real_margin_rate': fields.function(_real_margin_rate_calc, method=True, type='float', string='Real Margin Rate (%)',

View File

@ -4,11 +4,7 @@
<record id="demo_message1" model="notify.message">
<field name="name">OpenERP SA</field>
<field name="msg">ERP &amp; CRM Solutions....</field>
</record>
<record id="demo_message1" model="notify.message">
<field name="name">Tiny sprl</field>
<field name="msg">Be Expert with the Experts...</field>
<field name="msg">ERP &amp; CRM Solutions...</field>
</record>
</data>
</openerp>

View File

@ -776,7 +776,7 @@ class account_voucher(osv.osv):
'date': inv.date,
'credit': diff > 0 and diff or 0.0,
'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,
'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,
}

View File

@ -1,12 +1,12 @@
- |
In order to test the CRM in OpenERP,
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.
- |
In order to test the flow, I create a two new users "user_crm" and
I assign the group "salesman".
-
-
!record {model: res.users, id: res_users_usercrm0}:
company_id: base.main_company
context_lang: en_US
@ -16,11 +16,11 @@
login: user_crm
name: user_crm
password: user_crm
- |
I start by creating a new lead "New Customer" and I provide an address to this
new customer, as well as an email "info@mycustomer.com".
-
-
!record {model: crm.lead, id: crm_lead_newcustomer0}:
email_from: info@mycustomer.com
name: New Customer
@ -30,26 +30,26 @@
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,
-
-
!python {model: crm.lead}: |
self.case_open(cr, uid, [ref("crm_lead_newcustomer0")])
- |
I check that lead is now in 'open' state.
-
!assert {model: crm.lead, id: crm_lead_newcustomer0, string: Lead in open state}:
- state == "open"
- state == "open"
- |
As the lead seems to be a real business opportunity, I will convert it to a
partner
partner
and a business opportunity by clicking on the "Convert" button.
-
-
!python {model: crm.lead}: |
lead = self.browse(cr, uid, ref('crm_lead_newcustomer0'))
action = self.convert_opportunity(cr, uid, [ref("crm_lead_newcustomer0")], {'active_ids': [ref("crm_lead_newcustomer0")]})
@ -66,21 +66,21 @@
!python {model: crm.lead2opportunity.partner}: |
self.make_partner(cr, uid, [ref("crm_lead2opportunity_partner_create_0")], {'active_ids': [ref("crm_lead_newcustomer0")]})
-
Now, I give value to this wizard field.
Now, I give value to this wizard field.
-
!record {model: crm.lead2opportunity, id: crm_lead2opportunity_stonage_0}:
!record {model: crm.lead2opportunity, id: crm_lead2opportunity_stonage_0}:
name: Capegemini
planned_revenue: 0.00
probability: 0.00
-
Then, Click on "Create Opportunity" button of this wizard.
-
-
!python {model: crm.lead2opportunity}: |
self.action_apply(cr, uid, [ref('crm_lead2opportunity_stonage_0')], {'active_id': ref('crm_lead_newcustomer0')})
- |
In order to check the opportunity is created or not, I check type.
-
-
!python {model: crm.lead}: |
lead = self.browse(cr, uid, ref("crm_lead_newcustomer0"))
assert lead.type == 'opportunity'

View File

@ -11,13 +11,13 @@
stage_id: crm.stage_opportunity1
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}: |
@ -29,7 +29,7 @@
-
!python {model: crm.lead}: |
self.action_makeMeeting(cr, uid, [ref("crm_opportunity_abcfuelcounits0")])
- |
I can see that Meeting's calendar view is shown.
then I click on the date on which I want to schedule meeting.
@ -49,26 +49,27 @@
- |
In order to schedule a phonecall to the partner
I click on "schedule call" button and select planned date for the call.
-
-
!record {model: crm.opportunity2phonecall, id: crm_opportunity2phonecall_abcfuelcounits0}:
date: '2010-04-17 11:15:00'
name: 'ABC FUEL CO 829264 - 10002 units'
section_id: crm.section_sales_department
user_id: base.user_demo
- |
schedule phonecall by apply (action_apply)function of opportunity2phoncall wizard
-
categ_id: crm.categ_phone1
- |
schedule phonecall by apply (action_apply)function of opportunity2phoncall wizard
-
!python {model: crm.opportunity2phonecall}: |
self.action_apply(cr, uid, [ref('crm_opportunity2phonecall_abcfuelcounits0')], {'active_ids': [ref("crm_opportunity_abcfuelcounits0")]})
- |
I check that phonecall record is created for that opportunity.
-
I check that phonecall record is created for that opportunity.
-
!python {model: crm.phonecall}: |
phone_obj = self.pool.get('crm.phonecall')
ids = phone_obj.search(cr, uid, [('name', '=', 'ABC FUEL CO 829264 - 10002 units')])
assert len(ids)
- |
I can see phonecall record after click on "Schedule call" wizard.
- |
I can see phonecall record after click on "Schedule call" wizard.
-
!record {model: crm.phonecall, id: crm_phonecall_abcfuelcounits0}:
date: '2010-04-17 11:15:00'
@ -77,4 +78,4 @@
partner_address_id: base.res_partner_address_1
partner_id: base.res_partner_9
section_id: crm.section_sales_department

View File

@ -1,36 +1,35 @@
- |
I start by creating a new phonecall.
-
-
!record {model: crm.phonecall, id: crm_phonecall_interviewcall0}:
date: '2010-04-21 18:59:00'
name: Interview call
section_id: crm.section_sales_department
- |
-
Now , 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.
-
-
!python {model: crm.phonecall2partner}: |
self.make_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")]})
- |
As the success of phonecall seems to be a real business opportunity, I will convert
it to opportunity by clicking on the "Convert to Opportunity" button.
-
-
!record {model: crm.phonecall2opportunity, id: crm_phonecall2opportunity_interviewcall0}:
name: Interview call
partner_id: base.res_partner_9
planned_revenue: 0.0
probability: 0.0
probability: 0.0
-
Now, I click on "Convert" button of this wizard.
-
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")})
@ -39,29 +38,29 @@
-
!assert {model: crm.phonecall, id: crm_phonecall_interviewcall0}:
- opportunity_id != False
- |
And I check that the phonecall and the newly created business opportunity is linked
to same partner
-
!python {model: crm.phonecall}: |
!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"
-
!python {model: crm.phonecall}: |
self.action_make_meeting(cr, uid, [ref('crm_phonecall_interviewcall0')])
- |
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
-
-
!record {model: crm.meeting, id: crm_meeting_interviewcall0}:
alarm_id: base_calendar.alarm3
date: '2010-04-20 00:00:00'
@ -73,20 +72,21 @@
partner_id: base.res_partner_9
phonecall_id: 'crm_phonecall_interviewcall0'
state: open
- |
In order to schedule other phonecall to the partner
I click on "schedule other call" button. and plan for other call
I can see that it will open other phonecall view with some data same as current
phonecall.
-
-
!record {model: crm.phonecall2phonecall, id: crm_phonecall2phonecall_interviewcall0}:
date: '2010-04-21 19:49:00'
name: Interview call
section_id: crm.section_sales_department
user_id: base.user_root
categ_id: crm.categ_phone1
- |
I click on "Schedule" button of this wizard.
I click on "Schedule" button of this wizard.
-
!python {model: crm.phonecall2phonecall}: |
self.action_apply(cr, uid, [ref('crm_phonecall2phonecall_interviewcall0')], {'active_id': ref('crm_phonecall_interviewcall0')})
self.action_apply(cr, uid, [ref('crm_phonecall2phonecall_interviewcall0')], {'active_id': ref('crm_phonecall_interviewcall0')})

View File

@ -85,7 +85,7 @@ class crm_opportunity2phonecall(osv.osv_memory):
This converts Opportunity to Phonecall and opens Phonecall view
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param uid: the current user's ID for security checks,
@param ids: List of Opportunity to Phonecall IDs
@param context: A standard dictionary for contextual values

View File

@ -1,12 +1,6 @@
<?xml version="1.0"?>
<openerp>
<data noupdate="0">
<record model="document.directory.content.type" id="pdf">
<field name="code">.pdf</field>
<field name="name">PDF Report</field>
<field name="mimetype">application/pdf</field>
</record>
<data noupdate="1">
<record model="document.storage" id="storage_default">
<field name="name">Database storage</field>
@ -28,6 +22,14 @@
<field name="ressource_id">0</field>
</record>
</data>
<data noupdate="0">
<record model="document.directory.content.type" id="pdf">
<field name="code">.pdf</field>
<field name="name">PDF Report</field>
<field name="mimetype">application/pdf</field>
</record>
<record model="document.directory" id="dir_partner_category">
<field name="name">Partners by Category</field>

View File

@ -142,7 +142,7 @@ class hr_expense_expense(osv.osv):
else:
acc = property_obj.get(cr, uid, 'property_account_expense_categ', 'product.category')
if not acc:
raise osv.except_osv(_('Error !'), _('Please configure Default Expanse account for Product purchase, `property_account_expense_categ`'))
raise osv.except_osv(_('Error !'), _('Please configure Default Expense account for Product purchase, `property_account_expense_categ`'))
lines.append((0, False, {
'name': l.name,

View File

@ -64,7 +64,7 @@ class hr_employee(osv.osv):
method=True,
domain="[('type', '=', 'liquidity')]",
view_load=True,
help="Select Bank Account from where Salary Expanse will be Paid"),
help="Select Bank Account from where Salary Expense will be Paid"),
'salary_account':fields.property(
'account.account',
type='many2one',
@ -73,7 +73,7 @@ class hr_employee(osv.osv):
method=True,
domain="[('type', '=', 'other')]",
view_load=True,
help="Expanse account when Salary Expanse will be recorded"),
help="Expense account when Salary Expense will be recorded"),
'employee_account':fields.property(
'account.account',
type='many2one',
@ -99,7 +99,7 @@ class payroll_register(osv.osv):
_description = 'Payroll Register'
_columns = {
'journal_id': fields.many2one('account.journal', 'Expanse Journal'),
'journal_id': fields.many2one('account.journal', 'Expense Journal'),
'bank_journal_id': fields.many2one('account.journal', 'Bank Journal'),
'period_id': fields.many2one('account.period', 'Force Period', domain=[('state','<>','done')], help="Keep empty to use the period of the validation(Payslip) date."),
}
@ -213,7 +213,7 @@ class hr_payslip(osv.osv):
_description = 'Pay Slip'
_columns = {
'journal_id': fields.many2one('account.journal', 'Expanse Journal'),
'journal_id': fields.many2one('account.journal', 'Expense Journal'),
'bank_journal_id': fields.many2one('account.journal', 'Bank Journal'),
'move_ids':fields.one2many('hr.payslip.account.move', 'slip_id', 'Accounting vouchers'),
'move_line_ids':fields.many2many('account.move.line', 'payslip_lines_rel', 'slip_id', 'line_id', 'Accounting Lines', readonly=True),
@ -336,7 +336,7 @@ class hr_payslip(osv.osv):
name = '[%s]-%s' % (slip.number, line.name)
invoice_pool.pay_and_reconcile(cr, uid, invids, amount, acc_id, period_id, journal_id, False, period_id, False, context, name)
other_pay -= amount
#TODO: link this account entries to the Payment Lines also Expanse Entries to Account Lines
#TODO: link this account entries to the Payment Lines also Expense Entries to Account Lines
l_ids = movel_pool.search(cr, uid, [('name','=',name)], context=context)
line_ids += l_ids

View File

@ -40,14 +40,14 @@ class l10n_chart_it_report_libroIVA (osv.osv):
_columns = {
'name': fields.char('Fiscal year',size=64),
'company_id': fields.many2one('res.company', 'Company'),
'company_id': fields.many2one('res.company', 'Company'),
}
def init (self, cr) :
cr.execute("""DROP VIEW IF EXISTS account_report_libroiva""")
cr.execute("""
CREATE VIEW account_report_libroiva AS (
SELECT id, name, company_id FROM account_fiscalyear
cr.execute("""
CREATE VIEW account_report_libroiva AS (
SELECT id, name, company_id FROM account_fiscalyear
)""")
l10n_chart_it_report_libroIVA()

View File

@ -27,7 +27,7 @@ class make_invoice(osv.osv_memory):
_description = 'Make Invoice'
_columns = {
'group': fields.boolean('Group by partner invoice address'),
'group': fields.boolean('Group by partner invoice address'),
}
def make_invoices(self, cr, uid, ids, context=None):

View File

@ -63,14 +63,19 @@ class order(report_sxw.rml_parse):
WHERE absl.pos_statement_id = %d"""%(order_id.id)
self.cr.execute(sql)
res = self.cr.fetchone()
lst.append(res[0])
if not res:
return ['', 0.0]
lst.append(res[0]) # todo: improve
sql2 = """ select sum(absl.amount) as amt from account_bank_statement as abs
LEFT JOIN account_bank_statement_line as absl ON abs.id = absl.statement_id
LEFT JOIN account_journal as aj ON aj.id = abs.journal_id
where aj.name = '%s' """%(res[0])
self.cr.execute(sql2)
res1 = self.cr.fetchone()
lst.append(res1[0])
if res1:
lst.append(res1[0])
else:
lst.append(0.0)
return lst
report_sxw.report_sxw('report.pos.receipt.with.remboursment', 'pos.order', 'addons/point_of_sale/report/pos_receipt_with_remboursment.rml', parser=order, header=False)

View File

@ -63,14 +63,19 @@ class order(report_sxw.rml_parse):
WHERE absl.pos_statement_id = %d"""%(order_id.id)
self.cr.execute(sql)
res = self.cr.fetchone()
lst.append(res[0])
if not res:
return ['', 0.0]
lst.append(res[0]) # todo: improve
sql2 = """ select sum(absl.amount) as amt from account_bank_statement as abs
LEFT JOIN account_bank_statement_line as absl ON abs.id = absl.statement_id
LEFT JOIN account_journal as aj ON aj.id = abs.journal_id
where aj.name = '%s' """%(res[0])
self.cr.execute(sql2)
res1 = self.cr.fetchone()
lst.append(res1[0])
if res1:
lst.append(res1[0])
else:
lst.append(0.0)
return lst
report_sxw.report_sxw('report.pos.receipt.without.remboursment', 'pos.order', 'addons/point_of_sale/report/pos_receipt_without_remboursment.rml', parser=order, header=False)

View File

@ -103,9 +103,9 @@ class purchase_report(osv.osv):
extract(epoch from age(l.date_planned,s.date_order))/(24*60*60)::decimal(16,2) as delay_pass,
count(*) as nbr,
(l.price_unit*l.product_qty*u.factor)::decimal(16,2) as price_total,
avg(100.0 * (l.price_unit*l.product_qty*u.factor) / (t.standard_price*l.product_qty*u.factor))::decimal(16,2) as negociation,
avg(100.0 * (l.price_unit*l.product_qty*u.factor) / NULLIF(t.standard_price*l.product_qty*u.factor, 0.0))::decimal(16,2) as negociation,
sum(t.standard_price*l.product_qty*u.factor)::decimal(16,2) as price_standard,
(sum(l.product_qty*l.price_unit)/sum(l.product_qty/u.factor))::decimal(16,2) as price_average
(sum(l.product_qty*l.price_unit)/NULLIF(sum(l.product_qty*u.factor),0.0))::decimal(16,2) as price_average
from purchase_order s
left join purchase_order_line l on (s.id=l.order_id)
left join product_product p on (l.product_id=p.id)

View File

@ -95,8 +95,8 @@ class sale_report(osv.osv):
else
u.name
end) as uom_name,
sum(l.product_uom_qty/u.factor) as product_uom_qty,
sum(l.product_uom_qty*l.price_unit) as price_total,
sum(l.product_uom_qty * u.factor) as product_uom_qty,
sum(l.product_uom_qty * l.price_unit) as price_total,
pt.categ_id, l.order_id
from
sale_order_line l ,product_uom u, product_product p, product_template pt

View File

@ -65,7 +65,10 @@ class survey_question_wiz(osv.osv_memory):
context = {}
if view_type in ['form']:
wiz_id = 0
if not context.has_key('sur_name_id'):
sur_name_rec = None
if 'sur_name_id' in context:
sur_name_rec = surv_name_wiz.browse(cr, uid, context['sur_name_id'], context=context)
elif 'survey_id' in context:
res_data = {
'survey_id': context.get('survey_id', False),
'page_no': -1,
@ -76,16 +79,14 @@ class survey_question_wiz(osv.osv_memory):
wiz_id = surv_name_wiz.create(cr, uid, res_data)
sur_name_rec = surv_name_wiz.browse(cr, uid, wiz_id, context=context)
context.update({'sur_name_id' :wiz_id})
else:
sur_name_rec = surv_name_wiz.browse(cr, uid, context['sur_name_id'], context=context)
if context.has_key('active_id'):
context.pop('active_id')
survey_id = context.get('survey_id', False)
if not survey_id:
# Try one more time to find it
if sur_name_rec.survey_id:
if sur_name_rec and sur_name_rec.survey_id:
survey_id = sur_name_rec.survey_id[0]
else:
# raise osv.except_osv(_('Error!'), _("Cannot locate survey for the question wizard!"))