diff options
| author | rpa (Open ERP) <rpa@tinyerp.com> | 2010-09-27 10:45:55 +0530 |
|---|---|---|
| committer | rpa (Open ERP) <rpa@tinyerp.com> | 2010-09-27 10:45:55 +0530 |
| commit | 070e389ebab7e5c6e1f9927445892d12ebce3faa (patch) | |
| tree | 651a9c425cfaf6cd329697500ddf86f94bd2e654 | |
| parent | 621f24aee4ded5f4982e4c16c0f8cb46f1a3607a (diff) | |
| parent | 937d8fe3306a1cb31ccbe532531eaadc4ff639d6 (diff) | |
[MERGE]: Merge with lp:openobject-addons
bzr revid: rpa@tinyerp.com-20100927051555-5iblvte0fy3api58
| -rw-r--r-- | addons/account_payment/account_payment_demo.xml | 2 | ||||
| -rw-r--r-- | addons/account_payment/account_payment_view.xml | 4 | ||||
| -rw-r--r-- | addons/auction/report/auction_artists.rml | 2 | ||||
| -rw-r--r-- | addons/base_calendar/base_calendar.py | 6 | ||||
| -rw-r--r-- | addons/base_contact/base_contact.py | 15 | ||||
| -rw-r--r-- | addons/document_email/__openerp__.py | 2 | ||||
| -rw-r--r-- | addons/hr_timesheet/test/hr_timesheet_report.yml | 4 | ||||
| -rw-r--r-- | addons/hr_timesheet_invoice/report/account_analytic_profit.rml | 118 | ||||
| -rw-r--r-- | addons/hr_timesheet_invoice/test/hr_timesheet_invoice_report.yml | 2 | ||||
| -rw-r--r-- | addons/point_of_sale/wizard/pos_payment.py | 13 | ||||
| -rw-r--r-- | addons/product_margin/product_margin.py | 6 | ||||
| -rw-r--r-- | addons/project_planning/project_planning.py | 37 |
12 files changed, 123 insertions, 88 deletions
diff --git a/addons/account_payment/account_payment_demo.xml b/addons/account_payment/account_payment_demo.xml index 25fe4a2c55b..37705a05b07 100644 --- a/addons/account_payment/account_payment_demo.xml +++ b/addons/account_payment/account_payment_demo.xml @@ -5,7 +5,7 @@ <field name="name">Reserve Bank</field> <field name="acc_number">00987654321</field> <field name="partner_id" ref="base.res_partner_agrolait"></field> - <field name="state" eval="bank"/> + <field name="state">bank</field> </record> <record id="payment_mode_1" model="payment.mode"> <field name="name">Direct Payment</field> diff --git a/addons/account_payment/account_payment_view.xml b/addons/account_payment/account_payment_view.xml index 93ba4b85de0..b7cef21f8e0 100644 --- a/addons/account_payment/account_payment_view.xml +++ b/addons/account_payment/account_payment_view.xml @@ -38,7 +38,7 @@ </field> </record> - <menuitem id="menu_main" name="Payment" parent="account.menu_finance" sequence="6"/> + <menuitem id="menu_main_payment" name="Payment" parent="account.menu_finance" sequence="6"/> <record id="view_payment_mode_tree" model="ir.ui.view"> <field name="name">payment.mode.tree</field> @@ -203,7 +203,7 @@ <field name="search_view_id" ref="view_payment_order_search"/> </record> - <menuitem action="action_payment_order_tree" id="menu_action_payment_order_form" parent="account_payment.menu_main" sequence="3"/> + <menuitem action="action_payment_order_tree" id="menu_action_payment_order_form" parent="menu_main_payment" sequence="3"/> <record id="action_payment_order_tree_new" model="ir.actions.act_window"> <field name="name">New Payment Order</field> diff --git a/addons/auction/report/auction_artists.rml b/addons/auction/report/auction_artists.rml index dfe81549245..1a0688825d4 100644 --- a/addons/auction/report/auction_artists.rml +++ b/addons/auction/report/auction_artists.rml @@ -62,7 +62,7 @@ </para> <para style="P6">[[o.artist2_id and 'Artist2: '+o.artist2_id.name or False]]</para> <para style="P8"> - <font face="Courier">[[o.artist_id2 and 'Biography: '+o.artist_id2.biography or False]]</font> + <font face="Courier">[[o.artist2_id and 'Biography: '+o.artist2_id.biography or False]]</font> </para> </td> </tr> diff --git a/addons/base_calendar/base_calendar.py b/addons/base_calendar/base_calendar.py index facb598427b..5ccfbdb23d8 100644 --- a/addons/base_calendar/base_calendar.py +++ b/addons/base_calendar/base_calendar.py @@ -1531,8 +1531,12 @@ true, it will allow you to hide the event alarm information without removing it. result = [] if fields and 'date' not in fields: fields.append('date') + + real_ids = [item2 for item1, item2 in select] + event_values = dict([(res['id'], res) for res in super(calendar_event, self).read(cr, uid, real_ids, fields=fields, context=context, load=load)]) + for base_calendar_id, real_id in select: - res = super(calendar_event, self).read(cr, uid, real_id, fields=fields, context=context, load=load) + res = event_values[real_id] ls = base_calendar_id2real_id(base_calendar_id, with_date=res and res.get('duration', 0) or 0) if not isinstance(ls, (str, int, long)) and len(ls) >= 2: res['date'] = ls[1] diff --git a/addons/base_contact/base_contact.py b/addons/base_contact/base_contact.py index 1c0525931c7..8e3a4ded7eb 100644 --- a/addons/base_contact/base_contact.py +++ b/addons/base_contact/base_contact.py @@ -61,7 +61,7 @@ class res_partner_contact(osv.osv): 'function': fields.related('job_ids', 'function', type='char', \ string='Main Function'), 'job_id': fields.function(_main_job, method=True, type='many2one',\ - relation='res.partner.job', string='Main Job'), + relation='res.partner.job', string='Main Job', store=True), 'email': fields.char('E-Mail', size=240), 'comment': fields.text('Notes', translate=True), 'photo': fields.binary('Image'), @@ -151,10 +151,15 @@ class res_partner_job(osv.osv): if not len(ids): return [] res = [] - for r in self.browse(cr, uid, ids): - funct = r.function and (", " + r.function) or "" - res.append((r.id, self.pool.get('res.partner.contact').name_get(cr, uid, \ - [r.contact_id.id])[0][1] + funct)) + + jobs = self.browse(cr, uid, ids) + contact_ids = [rec.contact_id.id for rec in jobs] + contact_names = dict(self.pool.get('res.partner.contact').name_get(cr, uid, contact_ids, context=context)) + + for r in jobs: + function_name = r.function + funct = function_name and (", " + function_name) or "" + res.append((r.id, contact_names.get(r.contact_id.id, '') + funct)) return res def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False): diff --git a/addons/document_email/__openerp__.py b/addons/document_email/__openerp__.py index e341678e009..9ac6dc2fd84 100644 --- a/addons/document_email/__openerp__.py +++ b/addons/document_email/__openerp__.py @@ -24,7 +24,7 @@ { "name" : "Email Integrated Document", "version" : "1.1", - "depends" : ["base", "document", "mail_gateway"], + "depends" : ["base", "document", "fetchmail","mail_gateway"], "author" : "Tiny", "description": """Email Integrated Document * Email based Document submission diff --git a/addons/hr_timesheet/test/hr_timesheet_report.yml b/addons/hr_timesheet/test/hr_timesheet_report.yml index 811858eb7f2..2f19f75618f 100644 --- a/addons/hr_timesheet/test/hr_timesheet_report.yml +++ b/addons/hr_timesheet/test/hr_timesheet_report.yml @@ -1,5 +1,5 @@ - - In order to test the PDF reports defined on HR Timesheet User Report, we will print a HR Timesheet User Report + In order to test the PDF reports defined on Employee, we will print Timesheet of a User - !python {model: hr.employee}: | import netsvc, tools, os, time @@ -11,7 +11,7 @@ file(os.path.join(tools.config['test_report_directory'], 'hr_timesheet-user_report.'+format), 'wb+').write(data) - - In order to test the PDF reports defined on HR Timesheet Users Report, we will print a HR Timesheet Users Report + In order to test the PDF reports defined on Employee, we will print Timesheet of Users - !python {model: hr.employee}: | import netsvc, tools, os, time diff --git a/addons/hr_timesheet_invoice/report/account_analytic_profit.rml b/addons/hr_timesheet_invoice/report/account_analytic_profit.rml index 3cb4b150395..b6d9f155cab 100644 --- a/addons/hr_timesheet_invoice/report/account_analytic_profit.rml +++ b/addons/hr_timesheet_invoice/report/account_analytic_profit.rml @@ -74,24 +74,24 @@ <blockAlignment value="LEFT"/> <blockValign value="TOP"/> </blockTableStyle> - <blockTableStyle id="Table_Move_line"> + <blockTableStyle id="Table1"> <blockAlignment value="LEFT"/> <blockValign value="TOP"/> </blockTableStyle> <initialize> <paraStyle name="all" alignment="justify"/> </initialize> - <paraStyle name="Standard" fontName="Times-Roman"/> - <paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/> + <paraStyle name="Standard" fontName="Helvetica"/> + <paraStyle name="Text body" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/> <paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/> - <paraStyle name="List" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/> - <paraStyle name="Table Contents" fontName="Times-Roman"/> - <paraStyle name="Table Heading" fontName="Times-Roman" alignment="CENTER"/> - <paraStyle name="Caption" fontName="Times-Roman" fontSize="12.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="Index" fontName="Times-Roman"/> + <paraStyle name="List" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/> + <paraStyle name="Table Contents" fontName="Helvetica"/> + <paraStyle name="Table Heading" fontName="Helvetica" alignment="CENTER"/> + <paraStyle name="Caption" fontName="Helvetica" fontSize="12.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/> + <paraStyle name="Index" fontName="Helvetica"/> <paraStyle name="Preformatted Text" fontName="Courier" fontSize="10.0" leading="13" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="Footer" fontName="Times-Roman"/> - <paraStyle name="Horizontal Line" fontName="Times-Roman" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="14.0"/> + <paraStyle name="Footer" fontName="Helvetica"/> + <paraStyle name="Horizontal Line" fontName="Helvetica" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="14.0"/> <paraStyle name="terp_header" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/> <paraStyle name="Heading 9" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" spaceBefore="12.0" spaceAfter="6.0"/> <paraStyle name="terp_tblheader_General" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/> @@ -115,8 +115,8 @@ <paraStyle name="terp_default_2" fontName="Helvetica" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> <paraStyle name="terp_default_Right_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> <paraStyle name="terp_default_Right_9_bold_U" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> + <images/> </stylesheet> - <images/> <story> <blockTable colWidths="175.0,175.0,175.0" repeatRows="1" style="Table_Title"> <tr> @@ -157,12 +157,10 @@ <blockTable colWidths="175.0,175.0,175.0" style="Table_Content_Date"> <tr> <td> - <para style="terp_default_Centre_8">[[ formatLang (data['form']['date_from'],date=True) -]]</para> + <para style="terp_default_Centre_8">[[ formatLang(data['form']['date_from'],date=True) ]]</para> </td> <td> - <para style="terp_default_Centre_8">[[ formatLang (data['form']['date_to'],date=True) - ]]</para> + <para style="terp_default_Centre_8">[[ formatLang (data['form']['date_to'] ,date=True)]]</para> </td> <td> <para style="terp_default_Centre_8">[[ company.currency_id.name ]]</para> @@ -209,7 +207,7 @@ <para style="terp_default_Bold_9">Totals:</para> </td> <td> - <para style="terp_default_Right_9_bold_U"><u>[[ reduce(lambda x, y: x+y['unit_amount'], line(data['form'], data['form']['journal_ids'][0][2], data['form']['employee_ids'][0][2]), 0) ]]</u></para> + <para style="terp_default_Right_9_bold_U">[[ reduce(lambda x, y: x+y['unit_amount'], line(data['form'], data['form']['journal_ids'][0][2], data['form']['employee_ids'][0][2]), 0) ]]</para> </td> <td> <para style="terp_default_Right_9_bold"> @@ -217,47 +215,47 @@ </para> </td> <td> - <para style="terp_default_Right_9_bold_U"><u>[[ reduce(lambda x, y: x+y['amount'], line(data['form'],data['form']['journal_ids'][0][2], data['form']['employee_ids'][0][2]), 0) ]]</u></para> + <para style="terp_default_Right_9_bold_U">[[ reduce(lambda x, y: x+y['amount'], line(data['form'],data['form']['journal_ids'][0][2], data['form']['employee_ids'][0][2]), 0) ]]</para> </td> <td> - <para style="terp_default_Right_9_bold_U"><u>[[ reduce(lambda x, y: x+y['cost'], line(data['form'],data['form']['journal_ids'][0][2], data['form']['employee_ids'][0][2]), 0) ]]</u></para> + <para style="terp_default_Right_9_bold_U">[[ reduce(lambda x, y: x+y['cost'], line(data['form'],data['form']['journal_ids'][0][2], data['form']['employee_ids'][0][2]), 0) ]]</para> </td> <td> - <para style="terp_default_Right_9_bold_U"><u>[[ reduce(lambda x, y: x+y['profit'], line(data['form'],data['form']['journal_ids'][0][2], data['form']['employee_ids'][0][2]), 0) ]]</u></para> + <para style="terp_default_Right_9_bold_U">[[ reduce(lambda x, y: x+y['profit'], line(data['form'],data['form']['journal_ids'][0][2], data['form']['employee_ids'][0][2]), 0) ]]</para> </td> <td> - <para style="terp_default_Right_9_bold_U"><u>[[ reduce(lambda x, y: x+y['cost'], line(data['form'],data['form']['journal_ids'][0][2], data['form']['employee_ids'][0][2]), 0) and round(reduce(lambda x, y: x+y['amount'], line(data['form'],data['form']['journal_ids'][0][2], data['form']['employee_ids'][0][2]), 0)/reduce(lambda x, y: x+y['cost'], line(data['form'],data['form']['journal_ids'][0][2], data['form']['employee_ids'][0][2]), 0)* -100, 2)]] %</u></para> + <para style="terp_default_Right_9_bold_U">[[ reduce(lambda x, y: x+y['cost'], line(data['form'],data['form']['journal_ids'][0][2], data['form']['employee_ids'][0][2]), 0) and round(reduce(lambda x, y: x+y['amount'], line(data['form'],data['form']['journal_ids'][0][2], data['form']['employee_ids'][0][2]), 0)/reduce(lambda x, y: x+y['cost'], line(data['form'],data['form']['journal_ids'][0][2], data['form']['employee_ids'][0][2]), 0)* -100, 2)]] %</para> </td> </tr> </blockTable> <para style="terp_default_2"/> <section> <para style="terp_default_8">[[ repeatIn(user_ids(lines(data['form'])), 'e') ]]</para> - <blockTable colWidths="137.0,16.0,65.0,61.0,71.0,66.0,52.0,51.0" style="Table_Journal_Total_detail"> + <blockTable colWidths="137.0,29.0,52.0,61.0,71.0,66.0,52.0,51.0" style="Table_Journal_Total_detail"> <tr> <td> <para style="terp_default_Bold_9">[[ e.name ]]</para> </td> <td> - <para style="terp_default_8">[[ repeatIn(journal_ids(data['form'], e.id), 'j') ]]</para> + <para style="terp_default_8">[[ repeatIn(journal_ids(data['form'], [e.id]), 'j') ]]</para> </td> <td> - <para style="terp_default_Right_9_bold_U"><u>[[ reduce(lambda x, y: x+y['unit_amount'], line(data['form'], [j.id], [e.id]), 0) ]]</u></para> + <para style="terp_default_Right_9_bold_U">[[ reduce(lambda x, y: x+y['unit_amount'], line(data['form'], [j.id], [e.id]), 0) ]]</para> </td> <td> - <para style="terp_default_Right_9_bold_U"><u>[[ reduce(lambda x, y: x+y['amount_th'], line(data['form'], [j.id], [e.id]), 0) ]]</u></para> + <para style="terp_default_Right_9_bold_U">[[ reduce(lambda x, y: x+y['amount_th'], line(data['form'], [j.id], [e.id]), 0) ]]</para> </td> <td> - <para style="terp_default_Right_9_bold_U"><u>[[ reduce(lambda x, y: x+y['amount'], line(data['form'], [j.id], [e.id]), 0) ]]</u></para> + <para style="terp_default_Right_9_bold_U">[[ reduce(lambda x, y: x+y['amount'], line(data['form'], [j.id], [e.id]), 0) ]]</para> </td> <td> - <para style="terp_default_Right_9_bold_U"><u>[[ reduce(lambda x, y: x+y['cost'], line(data['form'], [j.id], [e.id]), 0) ]]</u></para> + <para style="terp_default_Right_9_bold_U">[[ reduce(lambda x, y: x+y['cost'], line(data['form'], [j.id], [e.id]), 0) ]]</para> </td> <td> - <para style="terp_default_Right_9_bold_U"><u>[[ reduce(lambda x, y: x+y['profit'], line(data['form'], [j.id], [e.id]), 0) ]]</u></para> + <para style="terp_default_Right_9_bold_U">[[ reduce(lambda x, y: x+y['profit'], line(data['form'], [j.id], [e.id]), 0) ]]</para> </td> <td> - <para style="terp_default_Right_9_bold_U"><u>[[ reduce(lambda x, y: x+y['cost'], line(data['form'], [j.id], [e.id]), 0) and (reduce(lambda x, y: x+y['amount'], line(data['form'], [j.id], [e.id]), 0) / reduce(lambda x, y: x+y['cost'], line(data['form'], [j.id], [e.id]), 0) * 100.0)]] %</u></para> + <para style="terp_default_Right_9_bold_U">[[reduce(lambda x, y: x+y['cost'], line(data['form'], [j.id], [e.id]), 0) and '%d' % (reduce(lambda x, y: x+y['amount'], line(data['form'], [j.id], [e.id]), 0) / reduce(lambda x, y: x+y['cost'], line(data['form'], [j.id], [e.id]), 0) * 100.0, 2)]] %</para> </td> </tr> </blockTable> @@ -298,35 +296,41 @@ </td> </tr> </blockTable> - </section> + <para style="terp_default_2"> + <font color="white"> </font> + </para> <section> - <para style="terp_default_8">[[ repeatIn(line(data['form'], [j.id],[e.id]), 'l') ]] </para> - <blockTable colWidths="155.0,64.0,61.0,71.0,66.0,52.0,50.0" style="Table_Move_line"> - <tr> - <td> - <para style="terp_default_8">[[ l['name'] ]]</para> - </td> - <td> - <para style="terp_default_Right_9">[[ l['unit_amount'] ]]</para> - </td> - <td> - <para style="terp_default_Right_9">[[ l['amount_th'] ]]</para> - </td> - <td> - <para style="terp_default_Right_9">[[ l['amount'] ]]</para> - </td> - <td> - <para style="terp_default_Right_9">[[ l['cost'] ]]</para> - </td> - <td> - <para style="terp_default_Right_9">[[ l['profit'] ]]</para> - </td> - <td> - <para style="terp_default_Right_9">[[ l['eff'] ]] %</para> - </td> - </tr> - </blockTable> - <para style="terp_default_9"> + <para style="terp_default_8">[[ repeatIn(line(data['form'], [j.id],[e.id]), 'l') ]] </para> + <blockTable colWidths="155.0,64.0,61.0,71.0,66.0,52.0,50.0" style="Table1"> + <tr> + <td> + <para style="terp_default_8">[[ l['name'] ]]</para> + </td> + <td> + <para style="terp_default_Right_9">[[ l['unit_amount'] ]]</para> + </td> + <td> + <para style="terp_default_Right_9">[[ l['amount_th'] ]]</para> + </td> + <td> + <para style="terp_default_Right_9">[[ l['amount'] ]]</para> + </td> + <td> + <para style="terp_default_Right_9">[[ l['cost'] ]]</para> + </td> + <td> + <para style="terp_default_Right_9">[[ l['profit'] ]]</para> + </td> + <td> + <para style="terp_default_Right_9">[[ l['eff'] ]] %</para> + </td> + </tr> + </blockTable> + <para style="terp_default_2"> + <font color="white"> </font> + </para> + </section> + <para style="terp_default_2"> <font color="white"> </font> </para> </section> @@ -334,4 +338,4 @@ <font color="white"> </font> </para> </story> -</document>
\ No newline at end of file +</document> diff --git a/addons/hr_timesheet_invoice/test/hr_timesheet_invoice_report.yml b/addons/hr_timesheet_invoice/test/hr_timesheet_invoice_report.yml index ecdd486a65e..32f22e7eb4b 100644 --- a/addons/hr_timesheet_invoice/test/hr_timesheet_invoice_report.yml +++ b/addons/hr_timesheet_invoice/test/hr_timesheet_invoice_report.yml @@ -3,7 +3,7 @@ - !python {model: account.analytic.line}: | import netsvc, tools, os, time - data_dict = {'model': 'ir.ui.menu', 'form': {'date_from': time.strftime('%Y-%m-01'), 'employee_ids': [[6,0,[ref('hr.employee1'), ref('hr.employee2'),ref('hr.employee3')]]], 'journal_ids': [[6,0,[ref('account.cose_journal_sale'),ref('account.exp'),ref('account.sit')]]], 'date_to': time.strftime('%Y-%m-%d')}} + data_dict = {'model': 'ir.ui.menu', 'form': {'date_from': time.strftime('%Y-%m-01'), 'employee_ids': [[6,0,[ref('hr.employee1'), ref('hr.employee2'),ref('hr.employee3')]]], 'journal_ids': [[6,0,[ref('hr_timesheet.analytic_journal')]]], 'date_to': time.strftime('%Y-%m-%d')}} (data, format) = netsvc.LocalService('report.account.analytic.profit').create(cr, uid, [], data_dict, {}) if tools.config['test_report_directory']: file(os.path.join(tools.config['test_report_directory'], 'hr_timesheet_invoice-account_analytic_profit_report.'+format), 'wb+').write(data) diff --git a/addons/point_of_sale/wizard/pos_payment.py b/addons/point_of_sale/wizard/pos_payment.py index 27c04a6dfba..8330be2772c 100644 --- a/addons/point_of_sale/wizard/pos_payment.py +++ b/addons/point_of_sale/wizard/pos_payment.py @@ -19,14 +19,10 @@ # ############################################################################## -import netsvc from osv import osv,fields from tools.translate import _ import pos_box_entries import time -from decimal import Decimal -from tools.translate import _ -import pos_receipt class pos_make_payment(osv.osv_memory): _name = 'pos.make.payment' @@ -43,7 +39,6 @@ class pos_make_payment(osv.osv_memory): @return: A dictionary which of fields with values. """ res = super(pos_make_payment, self).default_get(cr, uid, fields, context=context) - active_id = context and context.get('active_id',False) if active_id: j_obj = self.pool.get('account.journal') @@ -51,11 +46,7 @@ class pos_make_payment(osv.osv_memory): j_ids = map(lambda x1: x1[0], cr.fetchall()) journal = j_obj.search(cr, uid, [('type', '=', 'cash'), ('id', 'in', j_ids)]) - if journal: - journal = journal[0] - else: - journal = None - wf_service = netsvc.LocalService("workflow") + journal = journal and journal[0] or False order_obj=self.pool.get('pos.order') order = order_obj.browse(cr, uid, active_id, context) @@ -92,7 +83,7 @@ class pos_make_payment(osv.osv_memory): if active_id: order = self.pool.get('pos.order').browse(cr, uid, active_id) if not order.lines: - raise osv.except_osv('Error!','No order lines defined for this sale ') + raise osv.except_osv(_('Error!'),_('No order lines defined for this sale ')) return True def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): diff --git a/addons/product_margin/product_margin.py b/addons/product_margin/product_margin.py index ad6ef680a98..d8d6d7a1702 100644 --- a/addons/product_margin/product_margin.py +++ b/addons/product_margin/product_margin.py @@ -36,11 +36,11 @@ class product_product(osv.osv): date_to = context.get('date_to', time.strftime('%Y-12-31')) invoice_state = context.get('invoice_state', 'open_paid') if 'date_from' in field_names: - res[val.id]['date_from']=date_from + res[val.id]['date_from']=date_from if 'date_to' in field_names: res[val.id]['date_to']=date_to if 'invoice_state' in field_names: - res[val.id]['invoice_state']=invoice_state + res[val.id]['invoice_state']=invoice_state invoice_types = () states = () if invoice_state=='paid': @@ -114,4 +114,4 @@ class product_product(osv.osv): product_product() -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/project_planning/project_planning.py b/addons/project_planning/project_planning.py index e248fe1c050..2044772e6cc 100644 --- a/addons/project_planning/project_planning.py +++ b/addons/project_planning/project_planning.py @@ -25,6 +25,7 @@ import mx.DateTime from osv import fields, osv from tools.translate import _ +import tools class one2many_mod3(fields.one2many): @@ -35,8 +36,9 @@ class one2many_mod3(fields.one2many): for obj in obj.browse(cr, user, ids, context=context): res[obj.id] = [] list_ids = [] - for item in obj.user_id.child_ids: - list_ids.append(item.id) + children = obj.pool.get('report_account_analytic.planning')._child_compute(cr, user, [obj.user_id.id], '', []) + for u_id in children.get(obj.user_id.id, []): + list_ids.append(u_id) list_ids.append(obj.user_id.id) ids2 = obj.pool.get(self._obj).search(cr, user, ['&',(self._fields_id,'=',obj.id),'|',('user_id','in',list_ids),('user_id','=',False)], limit=self._limit) for r in obj.pool.get(self._obj)._read_flat(cr, user, ids2, [self._fields_id], context=context, load='_classic_write'): @@ -49,6 +51,35 @@ class report_account_analytic_planning(osv.osv): _name = "report_account_analytic.planning" _description = "Planning" + def _child_compute(self, cr, uid, ids, name, args, context=None): + if context is None: + context = {} + obj_dept = self.pool.get('hr.department') + obj_user = self.pool.get('res.users') + result = {} + for user_id in ids: + child_ids = [] + cr.execute('SELECT dept.id FROM hr_department AS dept \ + LEFT JOIN hr_employee AS emp ON dept.manager_id = emp.id \ + WHERE emp.id IN \ + (SELECT emp.id FROM hr_employee \ + JOIN resource_resource r ON r.id = emp.resource_id WHERE r.user_id=' + str(user_id) + ') ') + mgnt_dept_ids = [x[0] for x in cr.fetchall()] + ids_dept = obj_dept.search(cr, uid, [('id', 'child_of', mgnt_dept_ids)], context=context) + if ids_dept: + data_dept = obj_dept.read(cr, uid, ids_dept, ['member_ids'], context=context) + childs = map(lambda x: x['member_ids'], data_dept) + childs = tools.flatten(childs) + childs = obj_user.search(cr, uid, [('id', 'in', childs),('active', '=', True)], context=context) + if user_id in childs: + childs.remove(user_id) + child_ids.extend(tools.flatten(childs)) + set = {} + map(set.__setitem__, child_ids, []) + child_ids = set.keys() + result[user_id] = child_ids + return result + def _get_total_planned(self, cr, uid, ids, name, args, context=None): result = {} for plan in self.browse(cr, uid, ids, context): @@ -583,4 +614,4 @@ class res_company(osv.osv): } res_company() -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
