diff options
| author | uco (OpenERP) <uco@tinyerp.com> | 2010-10-28 12:35:42 +0530 |
|---|---|---|
| committer | uco (OpenERP) <uco@tinyerp.com> | 2010-10-28 12:35:42 +0530 |
| commit | ffbb15e03e0cd46c7384f8787b8f97a3dde3623f (patch) | |
| tree | 893b61e24c00580ed6b53b2db499f66458404f65 | |
| parent | eccc1d33b21d603511ea17420a05516447024dba (diff) | |
| parent | 98f3c3334b3c1619dcda33f3e538908f14c71b18 (diff) | |
[MERGE]: Merged with team1.
bzr revid: uco@tinyerp.com-20101028070542-fhe8w6z1ggb4crne
48 files changed, 432 insertions, 376 deletions
diff --git a/addons/account/account_cash_statement.py b/addons/account/account_cash_statement.py index 13c6464f888..818bfef978e 100644 --- a/addons/account/account_cash_statement.py +++ b/addons/account/account_cash_statement.py @@ -240,6 +240,8 @@ class account_cash_statement(osv.osv): } def create(self, cr, uid, vals, context=None): + if 'journal_id' not in vals: + raise osv.except_osv('Error', _('You cannot create a bank or cash register without a journal!')) sql = [ ('journal_id', '=', vals.get('journal_id', False)), ('state', '=', 'open') @@ -326,8 +328,8 @@ class account_cash_statement(osv.osv): statement_pool = self.pool.get('account.bank.statement') for statement in statement_pool.browse(cr, uid, ids, context=context): vals = {} - - if not self._user_allow(cr, uid, statement.id, context=context): + force_allow = context.get('force_allow',False) + if not force_allow and not self._user_allow(cr, uid, statement.id, context=context): raise osv.except_osv(_('Error !'), _('User %s does not have rights to access %s journal !' % (statement.user_id.name, statement.journal_id.name))) if statement.name and statement.name == '/': diff --git a/addons/account/invoice.py b/addons/account/invoice.py index 83e82a279b1..44ebafb9bbd 100644 --- a/addons/account/invoice.py +++ b/addons/account/invoice.py @@ -380,7 +380,6 @@ class account_invoice(osv.osv): raise orm.except_orm(_('Configuration Error!'), _('There is no Accounting Journal of type Sale/Purchase defined!')) else: - raise raise orm.except_orm(_('UnknownError'), str(e)) def confirm_paid(self, cr, uid, ids, context=None): @@ -1656,3 +1655,5 @@ class res_partner(osv.osv): } res_partner() + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account/project/project_view.xml b/addons/account/project/project_view.xml index e2f0bdf5709..22e0221ac8b 100644 --- a/addons/account/project/project_view.xml +++ b/addons/account/project/project_view.xml @@ -16,6 +16,7 @@ <field name="date"/> <field name="user_id" invisible="1"/> <field name="parent_id" invisible="1"/> + <field name="partner_id" invisible="1"/> </tree> </field> </record> diff --git a/addons/account/test/account_cash_statement.yml b/addons/account/test/account_cash_statement.yml index 03d0d54db83..67e6d4d2607 100644 --- a/addons/account/test/account_cash_statement.yml +++ b/addons/account/test/account_cash_statement.yml @@ -26,7 +26,7 @@ I clicked on Open CashBox button to open the cashbox - !python {model: account.bank.statement}: | - self.button_open(cr, uid, [ref("account_bank_statement_1")], {"lang": "en_US", "tz": False, "active_model": "account.bank.statement", "active_ids": [ref("account_bank_statement_1")], "active_id": ref("account_bank_statement_1"), }) + self.button_open(cr, uid, [ref("account_bank_statement_1")], {"force_allow":True, "lang": "en_US", "tz": False, "active_model": "account.bank.statement", "active_ids": [ref("account_bank_statement_1")], "active_id": ref("account_bank_statement_1"), }) - I check that now bank statement is in the "Open" state diff --git a/addons/account_coda/i18n/el.po b/addons/account_coda/i18n/el.po index c5e8af09286..48a3ab5184c 100644 --- a/addons/account_coda/i18n/el.po +++ b/addons/account_coda/i18n/el.po @@ -103,11 +103,7 @@ msgstr "Δημιουργημένος τραπεζικός λογαριασμός #: model:ir.actions.act_window,name:account_coda.act_account_payment_account_bank_statement #: model:ir.actions.act_window,name:account_coda.action_account_coda msgid "Coda import" -<<<<<<< TREE -msgstr "" -======= msgstr "Εισαγωγή Coda" ->>>>>>> MERGE-SOURCE #. module: account_coda #: field:account.coda,user_id:0 @@ -122,11 +118,7 @@ msgstr "Λανθασμένο XML για αρχιτεκτονική όψης!" #. module: account_coda #: model:ir.model,name:account_coda.model_account_coda msgid "coda for an Account" -<<<<<<< TREE -msgstr "" -======= msgstr "coda για εναν λογαριασμό" ->>>>>>> MERGE-SOURCE #. module: account_coda #: wizard_field:account.coda_import,init,def_payable:0 @@ -136,20 +128,12 @@ msgstr "Προεπιλεγμένος λογαριασμός πληρωμής" #. module: account_coda #: model:ir.ui.menu,name:account_coda.menu_account_coda msgid "Coda Statements" -<<<<<<< TREE -msgstr "" -======= msgstr "Λογαριασμοί Coda" ->>>>>>> MERGE-SOURCE #. module: account_coda #: model:ir.ui.menu,name:account_coda.menu_account_coda_wizard msgid "Import Coda Statements" -<<<<<<< TREE -msgstr "" -======= msgstr "Εισαγωγή λογαριασμών Coda" ->>>>>>> MERGE-SOURCE #. module: account_coda #: wizard_button:account.coda_import,init,extraction:0 @@ -160,20 +144,12 @@ msgstr "_Εντάξει" #: wizard_view:account.coda_import,extraction:0 #: wizard_view:account.coda_import,init:0 msgid "Import Coda Statement" -<<<<<<< TREE -msgstr "" -======= msgstr "Εισαγωγή λογαριασμών Coda" ->>>>>>> MERGE-SOURCE #. module: account_coda #: field:account.bank.statement,coda_id:0 msgid "Coda" -<<<<<<< TREE -msgstr "" -======= msgstr "Coda" ->>>>>>> MERGE-SOURCE #. module: account_coda #: wizard_view:account.coda_import,extraction:0 diff --git a/addons/association/profile_association.xml b/addons/association/profile_association.xml index d5a5baab946..7b9ddb4ebc3 100644 --- a/addons/association/profile_association.xml +++ b/addons/association/profile_association.xml @@ -54,7 +54,6 @@ </record> <menuitem name="Association" id="base.menu_association" icon="terp-calendar" sequence="9" groups="base.group_extended"/> - <menuitem name="Events Organisation" id="base.menu_event_main" parent="base.menu_association" /> <menuitem name="Configuration" id="base.menu_event_config" parent="base.menu_association" sequence="30" groups="base.group_extended"/> <menuitem name="Reporting" id="base.menu_report_association" parent="base.menu_association" sequence="20"/> </data> diff --git a/addons/auction/report/buyer_form_report.py b/addons/auction/report/buyer_form_report.py index 2de994050d0..ceffc87e557 100644 --- a/addons/auction/report/buyer_form_report.py +++ b/addons/auction/report/buyer_form_report.py @@ -44,7 +44,7 @@ class buyer_form_report(report_sxw.rml_parse): taxes.append(lot.author_right) if lot.auction_id: taxes += lot.auction_id.buyer_costs - tax=self.pool.get('account.tax').compute(self.cr, self.uid, taxes, lot.obj_price, 1) + tax=self.pool.get('account.tax').compute_all(self.cr, self.uid, taxes, lot.obj_price, 1) for t in tax: amount+=t['amount'] return amount diff --git a/addons/auction/report/seller_form_report.py b/addons/auction/report/seller_form_report.py index d033720d615..5a67d5be51a 100644 --- a/addons/auction/report/seller_form_report.py +++ b/addons/auction/report/seller_form_report.py @@ -35,7 +35,7 @@ class seller_form_report(report_sxw.rml_parse): 'sum_taxes': self.sum_taxes, 'sellerinfo' : self.seller_info, 'grand_total' : self.grand_seller_total, -}) + }) def sum_taxes(self, lot): @@ -45,7 +45,7 @@ class seller_form_report(report_sxw.rml_parse): taxes.append(lot.bord_vnd_id.tax_id) elif lot.auction_id and lot.auction_id.seller_costs: taxes += lot.auction_id.seller_costs - tax=self.pool.get('account.tax').compute(self.cr, self.uid, taxes, lot.obj_price, 1) + tax=self.pool.get('account.tax').compute_all(self.cr, self.uid, taxes, lot.obj_price, 1) for t in tax: amount+=t['amount'] return amount diff --git a/addons/auction/security/ir.model.access.csv b/addons/auction/security/ir.model.access.csv index 5458e6c2ac3..94c9c1f83aa 100644 --- a/addons/auction/security/ir.model.access.csv +++ b/addons/auction/security/ir.model.access.csv @@ -1,11 +1,13 @@ "id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink" "access_auction_artists","auction.artists","model_auction_artists","group_auction_manager",1,1,1,1 +"access_auction_dates_user","auction.dates user","model_auction_dates","group_auction_user",1,0,0,0 "access_auction_dates_manager","auction.dates manager","model_auction_dates","group_auction_manager",1,1,1,1 "access_auction_deposit_manager","auction.deposit manager","model_auction_deposit","group_auction_manager",1,1,1,1 +"access_auction_deposit_user","auction.deposit user","model_auction_deposit","group_auction_user",1,0,0,0 "access_auction_deposit_cost","auction.deposit.cost","model_auction_deposit_cost","group_auction_manager",1,1,1,1 "access_auction_lot_category","auction.lot.category","model_auction_lot_category","group_auction_user",1,0,0,0 "access_auction_lot_category_manager","auction.lot.category manager","model_auction_lot_category","group_auction_manager",1,1,1,1 -"access_auction_lots","auction.lots","model_auction_lots","group_auction_user",1,1,1,1 +"access_auction_lots","auction.lots","model_auction_lots","group_auction_user",1,1,1,0 "access_auction_lots_manager","auction.lots manager","model_auction_lots","group_auction_manager",1,0,0,0 "access_auction_bid","auction.bid","model_auction_bid","group_auction_user",1,1,1,1 "access_auction_bid_manager","auction.bid manager","model_auction_bid","group_auction_manager",1,0,0,0 @@ -18,6 +20,7 @@ "access_report_auction_adjudication","report.auction.adjudication","model_report_auction_adjudication","group_auction_manager",1,1,1,1 "access_report_object_encoded","report.object.encoded","model_report_object_encoded","group_auction_manager",1,1,1,1 "access_aie_category","aie.category","model_aie_category","group_auction_manager",1,1,1,1 +"access_auction_account_tax_user","account.tax user","account.model_account_tax","group_auction_user",1,0,0,0 "access_auction_account_tax","account.tax manager","account.model_account_tax","group_auction_manager",1,1,1,0 "access_auction_account_fiscalyear","account.fiscalyear manager","account.model_account_fiscalyear","group_auction_manager",1,1,1,0 "access_auction_account_journal","account.journal manager","account.model_account_journal","group_auction_manager",1,1,1,0 diff --git a/addons/base_calendar/test/base_calendar_test.yml b/addons/base_calendar/test/base_calendar_test.yml index a9a1c039e62..8c5f7acaaa5 100644 --- a/addons/base_calendar/test/base_calendar_test.yml +++ b/addons/base_calendar/test/base_calendar_test.yml @@ -27,8 +27,8 @@ I will search for one of the recurrent event and count the number of events - !python {model: calendar.event}: | - ids = self.search(cr, uid, [('date', '>=', '2010-05-01 00:00:00'), ('date', '<=', '2010-05-31 00:00:00')] ) - assert len(ids) == 9 + ids = self.search(cr, uid, [('date', '>=', '2010-04-30 16:00:00'), ('date', '<=', '2010-05-31 00:00:00')] ) + assert len(ids) == 10 - | Now I will make All day event and test it - diff --git a/addons/caldav/caldav_view.xml b/addons/caldav/caldav_view.xml index 97656a954ad..6238ee1441d 100644 --- a/addons/caldav/caldav_view.xml +++ b/addons/caldav/caldav_view.xml @@ -2,67 +2,65 @@ <openerp> <data> <record model="ir.ui.view" id="view_calendar_collection_form"> - <field name="name">Calendar Collections : Form</field> - <field name="model">document.directory</field> - <field name="type">form</field> - <field name="arch" type="xml"> - <form string="Calendar Collections"> - <field name="name" select="1" colspan="4"/> - <field name="user_id"/> - <field name="parent_id"/> - <field name="calendar_ids" colspan="4" nolabel="1"/> - </form> - </field> - </record> - <record model="ir.ui.view" id="view_calendar_collection_tree"> - <field name="name">Calendar Collections : Tree</field> - <field name="model">document.directory</field> - <field name="type">tree</field> - <field name="arch" type="xml"> - <tree string="Calendar Collections" toolbar="1"> - <field name="name"/> - <field name="user_id"/> - <field name="create_date"/> - <field name="write_date"/> - </tree> - </field> - </record> + <field name="name">Calendar Collections : Form</field> + <field name="model">document.directory</field> + <field name="type">form</field> + <field name="arch" type="xml"> + <form string="Calendar Collections"> + <field name="name" select="1" colspan="4"/> + <field name="user_id"/> + <field name="parent_id"/> + <field name="calendar_ids" colspan="4" nolabel="1"/> + </form> + </field> + </record> + + <record model="ir.ui.view" id="view_calendar_collection_tree"> + <field name="name">Calendar Collections : Tree</field> + <field name="model">document.directory</field> + <field name="type">tree</field> + <field name="arch" type="xml"> + <tree string="Calendar Collections" toolbar="1"> + <field name="name"/> + <field name="user_id"/> + <field name="create_date"/> + <field name="write_date"/> + </tree> + </field> + </record> - <record model="ir.actions.act_window" id="action_calendar_collection_form"> - <field name="name">Calendar Collections</field> - <field name="type">ir.actions.act_window</field> - <field name="res_model">document.directory</field> - <field name="view_type">form</field> - <field name="view_mode">tree,form</field> - <field name="domain">[('calendar_collection','=',True)]</field> - </record> + <record model="ir.actions.act_window" id="action_calendar_collection_form"> + <field name="name">Calendar Collections</field> + <field name="type">ir.actions.act_window</field> + <field name="res_model">document.directory</field> + <field name="view_type">form</field> + <field name="view_mode">tree,form</field> + <field name="domain">[('calendar_collection','=',True)]</field> + </record> - <record model="ir.actions.act_window" id="document.action_document_directory_form"> - <field name="domain">[('calendar_collection','=',False)]</field> - </record> + <record model="ir.actions.act_window" id="document.action_document_directory_form"> + <field name="domain">[('calendar_collection','=',False)]</field> + </record> - <record id="action_dir_view1" model="ir.actions.act_window.view"> - <field eval="10" name="sequence"/> - <field name="view_mode">tree</field> - <field name="view_id" ref="view_calendar_collection_tree"/> - <field name="act_window_id" ref="action_calendar_collection_form"/> - </record> - <record id="action_dir_view2" model="ir.actions.act_window.view"> - <field eval="20" name="sequence"/> - <field name="view_mode">form</field> - <field name="view_id" ref="view_calendar_collection_form"/> - <field name="act_window_id" ref="action_calendar_collection_form"/> - </record> + <record id="action_dir_view1" model="ir.actions.act_window.view"> + <field eval="10" name="sequence"/> + <field name="view_mode">tree</field> + <field name="view_id" ref="view_calendar_collection_tree"/> + <field name="act_window_id" ref="action_calendar_collection_form"/> + </record> + + <record id="action_dir_view2" model="ir.actions.act_window.view"> + <field eval="20" name="sequence"/> + <field name="view_mode">form</field> + <field name="view_id" ref="view_calendar_collection_form"/> + <field name="act_window_id" ref="action_calendar_collection_form"/> + </record> - <menuitem - id="menu_calendar" - name="Calendar" - parent="knowledge.menu_document_configuration"/> + <menuitem id="menu_calendar" name="Calendar" + parent="knowledge.menu_document_configuration" /> - <menuitem - action="action_calendar_collection_form" - id="menu_calendar_collection" - parent="menu_calendar"/> + <menuitem action="action_calendar_collection_form" + id="menu_calendar_collection" parent="menu_calendar" /> <record model="ir.ui.view" id="view_caldav_form"> <field name="name">Calendar : Form</field> @@ -100,7 +98,7 @@ <separator string="Value Mapping" colspan="4" /> <field name="mapping" select="1" colspan="4" nolabel="1" /> </form> - </field> + </field> </form> <tree string="Calendar Lines" editable="bottom"> <field name="name" select="1" /> @@ -118,45 +116,64 @@ </record> - <record model="ir.ui.view" id="view_caldav_tree"> - <field name="name">Calendar : Tree</field> - <field name="model">basic.calendar</field> - <field name="type">tree</field> - <field name="arch" type="xml"> - <tree string="Calendars" toolbar="1"> - <field name="name"/> - <field name="type"/> - <field name="user_id"/> - <field name="create_date"/> - <field name="write_date"/> - </tree> - </field> - </record> + <record model="ir.ui.view" id="view_caldav_tree"> + <field name="name">Calendar : Tree</field> + <field name="model">basic.calendar</field> + <field name="type">tree</field> + <field name="arch" type="xml"> + <tree string="Calendars" toolbar="1"> + <field name="name"/> + <field name="type"/> + <field name="user_id"/> + <field name="create_date"/> + <field name="write_date"/> + </tree> + </field> + </record> + + <record model="ir.ui.view" id="view_caldav_search"> + <field name="name">Calendar: Search</field> + <field name="model">basic.calendar</field> + <field name="type">search</field> + <field name="arch" type="xml"> + <search string="Calendars"> + <filter string="WebCal" icon="terp-calendar" domain="[('has_webcal', '=', True)]" help="Webcal Calendar"/> + <filter string="Event" icon="terp-calendar" domain="[('type', '=', 'vevent')]"/> + <filter string="Todo" icon="terp-calendar" domain="[('type', '=', 'vtodo')]"/> + <separator orientation="vertical"/> + <field name="name"/> + <field name="type"/> + <field name="user_id" widget="selection"> + <filter icon="terp-personal" domain="[('user_id', '=', uid)]" help="My Calendar(s)" string="MY"/> + </field> + <field name="collection_id" required="1"/> + </search> + </field> + </record> + + <record model="ir.actions.act_window" id="action_caldav_form"> + <field name="name">Calendars</field> + <field name="type">ir.actions.act_window</field> + <field name="res_model">basic.calendar</field> + <field name="view_type">form</field> + <field name="view_mode">tree,form</field> + </record> - <record model="ir.actions.act_window" id="action_caldav_form"> - <field name="name">Calendars</field> - <field name="type">ir.actions.act_window</field> - <field name="res_model">basic.calendar</field> - <field name="view_type">form</field> - <field name="view_mode">tree,form</field> - </record> + <record id="action_caldav_view1" model="ir.actions.act_window.view"> + <field eval="10" name="sequence"/> + <field name="view_mode">tree</field> + <field name="view_id" ref="view_caldav_tree"/> + <field name="act_window_id" ref="action_caldav_form"/> + </record> + <record id="action_caldav_view2" model="ir.actions.act_window.view"> + <field eval="20" name="sequence"/> + <field name="view_mode">form</field> + <field name="view_id" ref="view_caldav_form"/> + <field name="act_window_id" ref="action_caldav_form"/> + </record> - <record id="action_caldav_view1" model="ir.actions.act_window.view"> - <field eval="10" name="sequence"/> - <field name="view_mode">tree</field> - <field name="view_id" ref="view_caldav_tree"/> - <field name="act_window_id" ref="action_caldav_form"/> - </record> - <record id="action_caldav_view2" model="ir.actions.act_window.view"> - <field eval="20" name="sequence"/> - <field name="view_mode">form</field> - <field name="view_id" ref="view_caldav_form"/> - <field name="act_window_id" ref="action_caldav_form"/> - </record> + <menuitem action="action_caldav_form" + id="menu_caldav_directories" parent="menu_calendar" /> - <menuitem - action="action_caldav_form" - id="menu_caldav_directories" - parent="menu_calendar"/> </data> </openerp> diff --git a/addons/crm/board_crm_statistical_view.xml b/addons/crm/board_crm_statistical_view.xml index bd952d9e9ba..ae76031ecc0 100644 --- a/addons/crm/board_crm_statistical_view.xml +++ b/addons/crm/board_crm_statistical_view.xml @@ -48,7 +48,7 @@ <field name="view_type">form</field> <field name="view_mode">graph,tree,form</field> <field name="view_id" ref="view_crm_opportunity_categ_graph"/> - <field name="domain">[('state','!=','done'),('state','!=','cancel')]</field> + <field name="domain">[('state', 'not in', ('done', 'cancel')), ('type', '=', 'opportunity')]</field> </record> <record model="ir.actions.act_window" id="act_opportunity_stage"> @@ -56,7 +56,7 @@ <field name="view_type">form</field> <field name="view_mode">graph,tree,form</field> <field name="view_id" ref="view_crm_opportunity_stage_graph"/> - <field name="domain">[('state','!=','done'),('state','!=','cancel')]</field> + <field name="domain">[('state', 'not in', ('done', 'cancel')), ('type', '=', 'opportunity')]</field> </record> <record model="ir.actions.act_window" id="act_oppor_stage_user"> diff --git a/addons/crm_claim/crm_claim_view.xml b/addons/crm_claim/crm_claim_view.xml index 975e8d33bec..8175dd20da6 100644 --- a/addons/crm_claim/crm_claim_view.xml +++ b/addons/crm_claim/crm_claim_view.xml @@ -325,7 +325,7 @@ <act_window domain="[('partner_address_id', '=', active_id)]" - context="{'default_partner_address_id': active_id}" + context="{'default_partner_id': partner_id}" id="act_claim_partner_address" name="Report a Claim" view_mode="form,tree" diff --git a/addons/crm_profiling/security/ir.model.access.csv b/addons/crm_profiling/security/ir.model.access.csv index 6ba022b2535..fb110ba70d1 100644 --- a/addons/crm_profiling/security/ir.model.access.csv +++ b/addons/crm_profiling/security/ir.model.access.csv @@ -3,3 +3,5 @@ "access_crm_profiling_answer_manager","crm_profiling.answer manager","model_crm_profiling_answer","base.group_sale_manager",1,0,0,0 "access_crm_profiling_question_manager","crm_profiling.question manager","model_crm_profiling_question","base.group_sale_salesman",1,1,1,0 "access_crm_profiling_question_user","crm_profiling.question user","model_crm_profiling_question","base.group_sale_manager",1,0,0,0 +"access_crm_profiling_questionnarie_user","crm_profiling.questionnarie user","model_crm_profiling_questionnaire","base.group_sale_salesman",1,0,0,0 +"access_crm_profiling_questionnarie_manager","crm_profiling.questionnarie manager","model_crm_profiling_questionnaire","base.group_sale_manager",1,1,1,1 diff --git a/addons/delivery/__openerp__.py b/addons/delivery/__openerp__.py index ad88d552e6b..baca1113190 100644 --- a/addons/delivery/__openerp__.py +++ b/addons/delivery/__openerp__.py @@ -40,7 +40,7 @@ 'partner_view.xml' ], 'demo_xml': ['delivery_demo.xml'], - 'test':['test/delivery_test.yml','test/delivery_report.yml'], + 'test':['test/delivery_report.yml'], 'installable': True, 'active': False, 'certificate': '0033981912253', diff --git a/addons/email_template/email_template.py b/addons/email_template/email_template.py index fb843300412..5db7538d952 100644 --- a/addons/email_template/email_template.py +++ b/addons/email_template/email_template.py @@ -661,6 +661,7 @@ This is useful for CRM leads for example"), user, mailbox_values, context) + return mailbox_id @@ -731,6 +732,8 @@ class email_template_preview(osv.osv_memory): ref_obj_name = self.pool.get('ir.model').read(cr, uid, ref_obj_id['object_name'][0], ['model'], context)['model'] model_obj = self.pool.get(ref_obj_name) ref_obj_ids = model_obj.search(cr, uid, [], 0, 20, 'id desc', context=context) + if not ref_obj_ids: + ref_obj_ids = [] # also add the default one if requested, otherwise it won't be available for selection: default_id = context.get('default_rel_model_ref') @@ -761,7 +764,7 @@ class email_template_preview(osv.osv_memory): user, context['template_id'], ['object_name'], - context)['object_name'] + context).get('object_name', False) _columns = { 'ref_template':fields.many2one( @@ -788,7 +791,7 @@ class email_template_preview(osv.osv_memory): 'report':fields.char('Report Name', size=100, readonly=True), } _defaults = { - 'ref_template': lambda self, cr, uid, ctx:ctx['template_id'], + 'ref_template': lambda self, cr, uid, ctx:ctx['template_id'] or False, 'rel_model': _default_model, } def on_change_ref(self, cr, uid, ids, rel_model_ref, context=None): diff --git a/addons/event/security/ir.model.access.csv b/addons/event/security/ir.model.access.csv index 9ee5ae7ec80..a2e4b55bed5 100644 --- a/addons/event/security/ir.model.access.csv +++ b/addons/event/security/ir.model.access.csv @@ -13,3 +13,4 @@ "access_event_event_sale_salesman","event.event.sale","model_event_event","base.group_sale_salesman",1,0,0,0 "access_account_account_invoice_manager","account.account.invoice","account.model_account_invoice","base.group_marketing_manager",1,0,0,0 "access_event_registration_badge","event.registration.badge","model_event_registration_badge","marketing.group_marketing_user",1,0,0,0 +"access_event_registration_sale_user","event.registration.sale.user","model_event_registration","base.group_sale_salesman",1,0,0,0 diff --git a/addons/hr_payroll/hr_payroll.py b/addons/hr_payroll/hr_payroll.py index 39633eda44c..ec05a1ca372 100644 --- a/addons/hr_payroll/hr_payroll.py +++ b/addons/hr_payroll/hr_payroll.py @@ -86,7 +86,7 @@ class hr_payroll_structure(osv.osv): - Allowlance - Deductions """ - + _name = 'hr.payroll.structure' _description = 'Salary Structure' _columns = { @@ -130,14 +130,14 @@ class hr_contract(osv.osv): Employee contract based on the visa, work permits allowas to configure different Salary structure """ - + def compute_basic(self, cr, uid, ids, context={}): res = {} ids += context.get('employee_structure', []) - + slip_pool = self.pool.get('hr.payslip') slip_line_pool = self.pool.get('hr.payslip.line') - + for contract in self.browse(cr, uid, ids, context): all_per = 0.0 ded_per = 0.0 @@ -154,20 +154,20 @@ class hr_contract(osv.osv): if contract.wage_type_id.type == 'basic': obj['basic'] = contract.wage update['basic'] = contract.wage - + sal_type = contract.wage_type_id.type function = contract.struct_id.id lines = contract.struct_id.line_ids if not contract.struct_id: res[contract.id] = obj['basic'] - continue - + continue + ad = [] c_type = {} for line in lines: cd = line.code.lower() obj[cd] = line.amount or 0.0 - + for line in lines: if line.category_id.code in ad: continue @@ -237,16 +237,16 @@ class hr_contract(osv.osv): basic = (sal * 100) / final else: basic = contract.wage - + res[contract.id] = basic return res - + def check_vals(self, val1, val2): if val1 == val2 and val1 == 0: return True return False - + def _calculate_salary(self, cr, uid, ids, field_names, arg, context=None): res = self.compute_basic(cr, uid, ids, context) vals = {} @@ -259,7 +259,7 @@ class hr_contract(osv.osv): obj['gross'] = rs.wage if rs.wage_type_id.type == 'net': obj['net'] = rs.net - + if not rs.struct_id: if self.check_vals(obj['basic'], obj['gross']): obj['gross'] = obj['basic'] = obj['net'] @@ -276,7 +276,7 @@ class hr_contract(osv.osv): } vals[rs.id] = record continue - + for line in rs.struct_id.line_ids: amount = 0.0 if line.amount_type == 'per': @@ -288,7 +288,7 @@ class hr_contract(osv.osv): amount = line.amount cd = line.category_id.code.lower() obj[cd] = amount - + if line.type == 'allowance': allow += amount elif line.type == 'deduction': @@ -334,7 +334,7 @@ class payroll_register(osv.osv): """ Payroll Register """ - + _name = 'hr.payroll.register' _description = 'Payroll Register' @@ -425,6 +425,18 @@ class payroll_register(osv.osv): self.write(cr, uid, ids, {'state':'draft', 'number':number}, context=context) return True + def set_to_draft(self, cr, uid, ids, context=None): + if context is None: + context = {} + self.write(cr, uid, ids, {'state':'draft'}, context=context) + return True + + def cancel_sheet(self, cr, uid, ids, context=None): + if context is None: + context = {} + self.write(cr, uid, ids, {'state':'cancel'}, context=context) + return True + def verify_sheet(self, cr, uid, ids, context=None): if context is None: context = {} @@ -453,7 +465,7 @@ class payroll_register(osv.osv): wf_service = netsvc.LocalService("workflow") for sid in sids: wf_service.trg_validate(uid, 'hr.payslip', sid, 'final_verify_sheet', cr) - + company_name = users_pool.browse(cr, uid, uid, context=context).company_id.name for reg in self.browse(cr, uid, ids, context=context): advice = { @@ -462,7 +474,7 @@ class payroll_register(osv.osv): 'register_id':reg.id } pid = advice_pool.create(cr, uid, advice, context=context) - + for slip in reg.line_ids: if not slip.employee_id.bank_account_id: raise osv.except_osv(_('Error !'), _('Please define bank account for the %s employee' % (slip.employee_id.name))) @@ -495,7 +507,7 @@ class payroll_advice(osv.osv): ''' Bank Advice Note ''' - + _name = 'hr.payroll.advice' _description = 'Bank Advice Note' _columns = { @@ -557,7 +569,7 @@ class payroll_advice_line(osv.osv): ''' Bank Advice Lines ''' - + _name = 'hr.payroll.advice.line' _description = 'Bank Advice Lines' _columns = { @@ -595,7 +607,7 @@ class contrib_register(osv.osv): ''' Contribution Register ''' - + _name = 'hr.contibution.register' _description = 'Contribution Register' @@ -635,7 +647,7 @@ class contrib_register_line(osv.osv): ''' Contribution Register Line ''' - + _name = 'hr.contibution.register.line' _description = 'Contribution Register Line' @@ -745,7 +757,7 @@ class company_contribution(osv.osv): self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.id, } - + def _execute_function(self, cr, uid, id, value, context=None): """ self: pointer to self object @@ -764,7 +776,7 @@ class company_contribution(osv.osv): else: res = line_pool.browse(cr, uid, ids, context=context)[0].value return res - + def compute(self, cr, uid, id, value, context={}): contrib = self.browse(cr, uid, id, context) if contrib.amount_type == 'fix': @@ -798,7 +810,7 @@ class company_contribution_line(osv.osv): company_contribution_line() class hr_holidays_status(osv.osv): - + _inherit = "hr.holidays.status" _columns = { 'company_id':fields.many2one('res.company', 'Company', required=False), @@ -823,7 +835,7 @@ class hr_payslip(osv.osv): ''' Pay Slip ''' - + _name = 'hr.payslip' _description = 'Pay Slip' @@ -981,12 +993,12 @@ class hr_payslip(osv.osv): context = {} self.write(cr, uid, ids, {'paid':True, 'state':'done'}, context=context) return True - + def verify_sheet(self, cr, uid, ids, context={}): payslip_pool = self.pool.get('hr.payslip.line') register_pool = self.pool.get('company.contribution') register_line_pool = self.pool.get('hr.contibution.register.line') - + for slip in self.browse(cr, uid, ids, context=context): base = { 'basic':slip.basic, @@ -1009,7 +1021,7 @@ class hr_payslip(osv.osv): 'total':line.total + line.total } register_line_pool.create(cr, uid, reg_line) - + self.write(cr, uid, ids, {'state':'confirm'}, context=context) return True @@ -1084,7 +1096,7 @@ class hr_payslip(osv.osv): count += 1 return count - for slip in self.browse(cr, uid, ids, context=context): + for slip in self.browse(cr, uid, ids, context=context): old_slip_ids = slip_line_pool.search(cr, uid, [('slip_id','=',slip.id)], context=context) slip_line_pool.unlink(cr, uid, old_slip_ids, context=context) update = {} @@ -1224,7 +1236,7 @@ class hr_payslip(osv.osv): 'contract_id':contract.id, 'company_id':slip.employee_id.company_id.id }) - + for line in slip.employee_id.line_ids: vals = { 'amount':line.amount, @@ -1234,7 +1246,7 @@ class hr_payslip(osv.osv): 'base':base } slip_line_pool.copy(cr, uid, line.id, vals, {}) - + self.write(cr, uid, [slip.id], update, context=context) for slip in self.browse(cr, uid, ids, context=context): @@ -1260,7 +1272,7 @@ class hr_payslip(osv.osv): for hday in holiday_pool.browse(cr, uid, leave_ids, context=context): if not hday.holiday_status_id.head_id: raise osv.except_osv(_('Error !'), _('Please check configuration of %s, payroll head is missing' % (hday.holiday_status_id.name))) - + res = { 'slip_id':slip.id, 'name':hday.holiday_status_id.name + '-%s' % (hday.number_of_days), @@ -1281,7 +1293,7 @@ class hr_payslip(osv.osv): # res['type'] = 'allowance' # leave += days # total += perday * days - + elif hday.holiday_status_id.type == 'halfpaid': paid_leave += (days / 2) res['name'] = hday.holiday_status_id.name + '-%s/2' % (days) @@ -1315,7 +1327,7 @@ class hr_payslip_line(osv.osv): ''' Payslip Line ''' - + _name = 'hr.payslip.line' _description = 'Payslip Line' @@ -1346,7 +1358,7 @@ class hr_payslip_line(osv.osv): 'employee_id':fields.many2one('hr.employee', 'Employee', required=False), 'name':fields.char('Name', size=256, required=True, readonly=False), 'base':fields.char('Formula', size=1024, required=False, readonly=False), - 'code':fields.char('Code', size=64, required=False, readonly=False), + 'code':fields.char('Code', size=64, required=False, readonly=False), 'category_id':fields.many2one('hr.allounce.deduction.categoty', 'Category', required=True), 'type':fields.selection([ ('allowance','Allowance'), @@ -1397,7 +1409,7 @@ class hr_payslip_line_line(osv.osv): ''' Function Line ''' - + _name = 'hr.payslip.line.line' _description = 'Function Line' _order = 'sequence' @@ -1418,28 +1430,28 @@ class hr_employee(osv.osv): ''' Employee ''' - + _inherit = 'hr.employee' _description = 'Employee' - + def _calculate_salary(self, cr, uid, ids, field_names, arg, context=None): vals = {} slip_line_pool = self.pool.get('hr.payslip.line') - + for employee in self.browse(cr, uid, ids, context): if not employee.contract_id: vals[employee.id] = {'basic':0.0, 'gross':0.0, 'net':0.0, 'advantages_gross':0.0, 'advantages_net':0.0} continue - + basic = employee.contract_id.basic gross = employee.contract_id.gross net = employee.contract_id.net allowance = employee.contract_id.advantages_gross deduction = employee.contract_id.advantages_net - + obj = { - 'basic':basic, - 'gross':gross, + 'basic':basic, + 'gross':gross, 'net':net } for line in employee.line_ids: @@ -1455,27 +1467,27 @@ class hr_employee(osv.osv): amount = slip_line_pool.execute_function(cr, uid, line.id, amt, context) elif line.amount_type == 'fix': amount = line.amount - + if line.type == 'allowance': allowance += amount elif line.type == 'deduction': deduction += amount - + vals[employee.id] = { - 'basic':basic, - 'advantages_gross':allowance, - 'gross':basic + allowance, + 'basic':basic, + 'advantages_gross':allowance, + 'gross':basic + allowance, 'advantages_net':deduction, 'net':basic + allowance - deduction } return vals - + _columns = { 'passport_id':fields.many2one('hr.passport', 'Passport', required=False, domain="[('employee_id','=',active_id), ('address_id','=',address_home_id)]", help="Employee Passport Information"), 'line_ids':fields.one2many('hr.payslip.line', 'employee_id', 'Salary Structure', required=False), 'slip_ids':fields.one2many('hr.payslip', 'employee_id', 'Payslips', required=False, readonly=True), 'otherid': fields.char('Other Id', size=64), - + 'basic': fields.function(_calculate_salary, method=True, multi='dc', type='float', string='Basic Salary', digits=(14,2)), 'gross': fields.function(_calculate_salary, method=True, multi='dc', type='float', string='Gross Salary', digits=(14,2)), 'net': fields.function(_calculate_salary, method=True, multi='dc', type='float', string='Net Salary', digits=(14,2)), diff --git a/addons/hr_payroll_account/__openerp__.py b/addons/hr_payroll_account/__openerp__.py index 30e806ee046..e3ebdf625e7 100644 --- a/addons/hr_payroll_account/__openerp__.py +++ b/addons/hr_payroll_account/__openerp__.py @@ -38,6 +38,7 @@ 'init_xml': [ ], 'update_xml': [ + "security/ir.model.access.csv", "hr_payroll_account_view.xml", ], 'demo_xml': [ @@ -47,4 +48,4 @@ 'active': False, } -# 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/hr_payroll_account/security/ir.model.access.csv b/addons/hr_payroll_account/security/ir.model.access.csv new file mode 100644 index 00000000000..d71b8404a12 --- /dev/null +++ b/addons/hr_payroll_account/security/ir.model.access.csv @@ -0,0 +1,2 @@ +"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink" +"access_hr_payslip_account_move_user","access.hr.payslip.account.move.user","model_hr_payslip_account_move","base.group_user",1,0,0,0 diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml b/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml index f95a2b5aba0..2e1bf6c5149 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml @@ -127,9 +127,9 @@ </group> </page> </notebook> - <field name="state"/> - <group col="4" colspan="2"> - <button name="button_confirm" states="draft" string="Close" type="object" icon="terp-check"/> + <group col="6" colspan="4"> + <field name="state"/> + <button name="button_confirm" states="draft" string="Confirm" type="object" icon="terp-check"/> <button name="action_set_to_draft" states="done" string="Set to Draft" type="object" icon="terp-stock_effects-object-colorize"/> <button name="cancel" states="confirm" string="Refuse" type="workflow" icon="gtk-cancel"/> <button name="done" states="confirm" string="Approve" type="workflow" icon="terp-camera_test"/> diff --git a/addons/mail_gateway/mail_gateway.py b/addons/mail_gateway/mail_gateway.py index e7ec11c9ec5..a116a18b56d 100644 --- a/addons/mail_gateway/mail_gateway.py +++ b/addons/mail_gateway/mail_gateway.py @@ -140,7 +140,7 @@ class mailgate_thread(osv.osv): 'description': details or (hasattr(case, 'description') and case.description or False), 'attachment_ids': [(6, 0, attachments)] } - attachments = [] + if history: for param in (email, email_cc, email_bcc): if isinstance(param, list): diff --git a/addons/mail_gateway/security/ir.model.access.csv b/addons/mail_gateway/security/ir.model.access.csv index db70d947de2..25aca3518c3 100644 --- a/addons/mail_gateway/security/ir.model.access.csv +++ b/addons/mail_gateway/security/ir.model.access.csv @@ -1,3 +1,4 @@ "id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink" "mail_gateway_mailgate_message","mail_gateway.mailgate.message","model_mailgate_message","base.group_system",1,1,1,1 "mail_gateway_mailgate_thread","mail_gateway.mailgate.thread","model_mailgate_thread","base.group_system",1,1,1,1 +"mail_gateway_message_internal_user","mail_gateway.mailgate.message.internal","model_mailgate_message","base.group_user",1,0,0,0 diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py index fecb0e104e7..c71565442e5 100644 --- a/addons/mrp/mrp.py +++ b/addons/mrp/mrp.py @@ -244,7 +244,7 @@ class mrp_bom(osv.osv): v['name'] = prod.name return {'value': v} return {} - + def _bom_find(self, cr, uid, product_id, product_uom, properties=[]): """ Finds BoM for particular product and product uom. @param product_id: Selected product. diff --git a/addons/product/product.py b/addons/product/product.py index 2ef500c467a..b43f40b1cbc 100644 --- a/addons/product/product.py +++ b/addons/product/product.py @@ -177,15 +177,7 @@ class product_category(osv.osv): 'child_id': fields.one2many('product.category', 'parent_id', string='Child Categories'), 'sequence': fields.integer('Sequence', help="Gives the sequence order when displaying a list of product categories."), 'type': fields.selection([('view','View'), ('normal','Normal')], 'Category Type'), - 'property_stock_variation': fields.property( - 'account.account', - type='many2one', - relation='account.account', - string="Stock variation Account", - method=True, - view_load=True, help="This account will be used in product when valuation type is real-time valuation ",), } - _defaults = { @@ -738,6 +730,7 @@ class pricelist_partnerinfo(osv.osv): } _order = 'min_quantity asc' pricelist_partnerinfo() +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: class res_users(osv.osv): _inherit = 'res.users' @@ -757,5 +750,3 @@ class res_users(osv.osv): } res_users() - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/product/product_view.xml b/addons/product/product_view.xml index fa2abbd672b..2bd4e95f29d 100644 --- a/addons/product/product_view.xml +++ b/addons/product/product_view.xml @@ -110,7 +110,7 @@ <group colspan="2" col="2" name="status" groups="base.group_extended"> <separator string="Status" colspan="2"/> - <field name="categ_id" select="1" groups="base.group_extended"/> + <field name="categ_id"/> <field name="state"/> <field name="product_manager"/> </group> @@ -220,7 +220,6 @@ <field name="name" select="1"/> <field name="parent_id"/> <field name="sequence" invisible="1"/> - <field name="property_stock_variation"/> <field name="type"/> <newline/> </form> diff --git a/addons/product_expiry/product_expiry.py b/addons/product_expiry/product_expiry.py index fbfa7dc1610..01ce50dead8 100644 --- a/addons/product_expiry/product_expiry.py +++ b/addons/product_expiry/product_expiry.py @@ -40,7 +40,7 @@ class stock_production_lot(osv.osv): # set date to False when no expiry time specified on the product date = duration and (datetime.datetime.today() + datetime.timedelta(days=duration)) - return date and date.strftime('%Y-%m-%d %H:%M:%S') + return date and date.strftime('%Y-%m-%d %H:%M:%S') or False return calc_date _columns = { diff --git a/addons/project/project_view.xml b/addons/project/project_view.xml index 01b5999cdcd..45862a252a6 100644 --- a/addons/project/project_view.xml +++ b/addons/project/project_view.xml @@ -325,7 +325,7 @@ <field name="progress" widget="progressbar" invisible="context.get('set_visible',False)"/> <field name="state" invisible="context.get('set_visible',False)"/> <button name="do_cancel" states="draft,open,pending" string="Cancel" type="object" icon="gtk-cancel" help="For cancelling the task"/> - <button name="do_open" states="pending,draft,done,cancel" string="Start Task" type="object" icon="gtk-execute" help="For changing to open state" invisible="context.get('set_visible',False)"/> + <button name="do_open" states="pending,draft,done,cancelled" string="Start Task" type="object" icon="gtk-execute" help="For changing to open state" invisible="context.get('set_visible',False)"/> <button groups="base.group_extended" name="%(action_project_task_delegate)d" states="pending,open,draft" string="Delegate" type="action" icon="gtk-sort-descending" help="For changing to delegate state"/> <button name="action_close" states="draft,pending,open" string="Done" type="object" icon="terp-dialog-close" help="For changing to done state"/> </tree> diff --git a/addons/project/report/project_report_view.xml b/addons/project/report/project_report_view.xml index 53d97c02802..aec1296b3c4 100644 --- a/addons/project/report/project_report_view.xml +++ b/addons/project/report/project_report_view.xml @@ -149,7 +149,7 @@ <field name="help">This report allows you to analyse the performance of your projects and users. You can analyse the quantities of tasks, the hours spent compared to the planned hours, the average number of days to open or close a task, etc.</field> </record> - <menuitem id="menu_tasks_config" name="Tasks" parent="project.menu_definitions" sequence="1"/> + <menuitem action="action_project_task_user_tree" id="menu_project_task_user_tree" parent="base.menu_project_report" groups="project.group_project_manager"/> <!-- Views and action for project dashboard --> <record id="view_project_vs_remaining_hours_tree" model="ir.ui.view"> diff --git a/addons/project/test/test_project.yml b/addons/project/test/test_project.yml index 8cf8e0afb19..bca3bcbff41 100644 --- a/addons/project/test/test_project.yml +++ b/addons/project/test/test_project.yml @@ -1,108 +1,108 @@ - Test project template feature -- +- Create project 'OpenERP Training Programme' -- +- !record {model: project.project, id: project_project_openerptrainingprogramme0}: company_id: base.main_company - name: OpenERP Training Programme -- + name: OpenERP Training Programme +- Create task 'Technical Training' for this project -- +- !record {model: project.task, id: project_task_technicaltraining0}: date_start: '2010-05-31 11:48:38' name: Technical Training planned_hours: 30.0 project_id: project_project_openerptrainingprogramme0 remaining_hours: 30.0 - state: draft -- + state: draft +- Create task 'Functional Training' for this project -- +- !record {model: project.task, id: project_task_functionaltraining0}: date_start: '2010-05-31 11:49:11' name: Functional Training planned_hours: 30.0 project_id: project_project_openerptrainingprogramme0 remaining_hours: 30.0 - state: draft -- + state: draft +- Set project as project template -- +- !python {model: project.project}: | self.set_template(cr, uid, [ref("project_project_openerptrainingprogramme0")], {"lang": "en_US", "active_model": "ir.ui.menu", "active_ids": [ref("project.menu_open_view_project_all")], "tz": False, "active_id": ref("project.menu_open_view_project_all"), }) -- +- Check if project in template state -- +- !assert {model: project.project, id: project_project_openerptrainingprogramme0, severity: error, string: Project is in template state}: - - state == "template" -- + - state == "template" +- Create new project based on this template -- +- !python {model: project.project}: | new_prj = self.duplicate_template(cr, uid, [ref("project_project_openerptrainingprogramme0")], {"lang": "en_US", "active_model": "ir.ui.menu", "active_ids": [ref("project.menu_open_view_project_all")], "tz": False, "active_id": ref("project.menu_open_view_project_all"), }) if not new_prj: - raise Exception( "New project based on template not created") + raise Exception( "New project based on template not created") new_id = new_prj['res_id'] new_prj = self.read(cr, uid, [new_id], ['name', 'state'])[0] state = new_prj['state'] - name = new_prj['name'] - assert state == 'open', "Project in %s state. Project created from template project must be in open state"%state -- - Reset project template to normal project -- + name = new_prj['name'] + assert state == 'open', "Project in %s state. Project created from template project must be in open state"%state +- + Reset project template to normal project +- !python {model: project.project}: | self.reset_project(cr, uid, [ref("project_project_openerptrainingprogramme0")], {"lang": "en_US", "active_ids": [ref("project.menu_open_view_project_all")], "tz": False, "active_model": "ir.ui.menu", "project_id": False, "active_id": ref("project.menu_open_view_project_all"), }) -- +- Check if project in open state -- +- !assert {model: project.project, id: project_project_openerptrainingprogramme0, severity: error, string: Project is in open state}: - state == "open" - - Test for different project-states -- + Test for different project-states +- Keep project pending -- +- !python {model: project.project}: | self.set_pending(cr, uid, [ref("project_project_openerptrainingprogramme0")], {"lang": "en_US", "active_ids": [ref("project.menu_open_view_project_all")], "tz": False, "active_model": "ir.ui.menu", "project_id": False, "active_id": ref("project.menu_open_view_project_all"), }) -- +- Check if project in pending state -- +- !assert {model: project.project, id: project_project_openerptrainingprogramme0, severity: error, string: Project is in pending state}: - - state == "pending" -- + - state == "pending" +- Cancel the project -- +- !python {model: project.project}: | self.set_cancel(cr, uid, [ref("project_project_openerptrainingprogramme0")], {"lang": "en_US", "active_ids": [ref("project.menu_open_view_project_all")], "tz": False, "active_model": "ir.ui.menu", "project_id": False, "active_id": ref("project.menu_open_view_project_all"), }) -- +- Check if project in cancel state -- +- !assert {model: project.project, id: project_project_openerptrainingprogramme0, severity: error, string: Project is in cancel state}: - state == "cancelled" -- +- Re-open the project -- +- !python {model: project.project}: | self.set_open(cr, uid, [ref("project_project_openerptrainingprogramme0")], {"lang": "en_US", "active_ids": [ref("project.menu_open_view_project_all")], "tz": False, "active_model": "ir.ui.menu", "project_id": False, "active_id": ref("project.menu_open_view_project_all"), }) -- +- Check if project in open state -- +- !assert {model: project.project, id: project_project_openerptrainingprogramme0, severity: error, string: Project is in open state}: - state == "open" - @@ -124,17 +124,17 @@ self.compute_hours(cr, uid, [ref('project_task_technicaltraining_remainingwiz0')], {'active_id': ref("project_task_technicaltraining0"),'button_reactivate': True}) - | Check if task 'Technical Training' in open state and for other initial values -- +- !assert {model: project.task, id: project_task_technicaltraining0, severity: error, string: Project is in open state}: - state == "open" - planned_hours == 30 - remaining_hours == 30 - delay_hours == 0.0 - - effective_hours == 0.0 -- + - effective_hours == 0.0 +- Make a work task entry 'Training on OpenERP modules, models and classes' of 10 hours -- - !record {model: project.task, id: project_task_technicaltraining0}: +- + !record {model: project.task, id: project_task_technicaltraining0, context:{'no_analytic_entry':True}}: work_ids: - date: '2010-05-31 15:04:22' hours: 10.0 @@ -146,10 +146,10 @@ !assert {model: project.task, id: project_task_technicaltraining0, severity: error, string: After work task of 10 hours effective_hours must be equal to 10}: - remaining_hours == 20 - effective_hours == 10.0 -- +- Make a work task entry 'Training on OpenERP xml views' of 10 hours -- - !record {model: project.task, id: project_task_technicaltraining0}: +- + !record {model: project.task, id: project_task_technicaltraining0, context:{'no_analytic_entry':True}}: work_ids: - date: '2010-06-01 15:04:46' hours: 10.0 @@ -161,10 +161,10 @@ !assert {model: project.task, id: project_task_technicaltraining0, severity: error, string: After one more work task of 10 hours effective_hours must be equal to 20}: - remaining_hours == 10 - effective_hours == 20.0 -- - Make a work task entry 'Training on workflows' of 10 hours -- - !record {model: project.task, id: project_task_technicaltraining0}: +- + Make a work task entry 'Training on workflows' of 10 hours +- + !record {model: project.task, id: project_task_technicaltraining0, context:{'no_analytic_entry':True}}: work_ids: - date: '2010-06-02 15:05:24' hours: 10.0 @@ -176,20 +176,20 @@ !assert {model: project.task, id: project_task_technicaltraining0, severity: error, string: After one more work task of 10 hours effective_hours must be equal to 30}: - remaining_hours == 0 - effective_hours == 30.0 -- - Set remaining hours of 10 hours for reevaluating the task -- +- + Set remaining hours of 10 hours for reevaluating the task +- !record {model: project.task.reevaluate, id: config_compute_remaining_0}: remaining_hours: 10.0 - Reevaluate the task -- +- !python {model: project.task.reevaluate}: | self.compute_hours(cr, uid, [ref("config_compute_remaining_0")], {"lang": "en_US", "project_id": False, "tz": False, "active_model": "project.task", "search_default_project_id": False, "search_default_user_id": 1, "search_default_current": 1, "active_ids": [ref("project_task_technicaltraining0")], "active_id": ref("project_task_technicaltraining0"), }) - + - Check for effective hours and remaining hours, remaining_hours must be 10 while planned_hours remains 30 - @@ -197,10 +197,10 @@ - planned_hours == 30 - remaining_hours == 10.0 - effective_hours == 30.0 -- +- Make a work task entry 'Training on reports and wizards' of 10 hours -- - !record {model: project.task, id: project_task_technicaltraining0}: +- + !record {model: project.task, id: project_task_technicaltraining0, context:{'no_analytic_entry':True}}: work_ids: - date: '2010-05-31 15:08:40' hours: 10.0 @@ -213,28 +213,28 @@ - planned_hours == 30 - remaining_hours == 0 - effective_hours == 40.0 -- +- Close the task -- +- !python {model: project.task}: | self.do_close(cr, uid, [ref("project_task_technicaltraining0")], {'mail_send': False}) -- +- Check if task in done state -- +- !assert {model: project.task, id: project_task_technicaltraining0, severity: error, string: Task is in done state}: - - state == "done" - - + - state == "done" + + - - Test for task reactivation + Test for task reactivation +- + Reactivate task - - Reactivate task -- !record {model: project.task.reevaluate, id: config_compute_remaining_1}: - remaining_hours: 10.0 -- + remaining_hours: 10.0 +- Reevaluate the task with 10 hours remaining -- +- !python {model: project.task.reevaluate}: | self.compute_hours(cr, uid, [ref("config_compute_remaining_1")], {"lang": "en_US", "project_id": False, "tz": False, "button_reactivate": True, "active_model": @@ -248,10 +248,10 @@ - planned_hours == 30 - remaining_hours == 10.0 - effective_hours == 40.0 -- +- Make a work task entry 'Training on yml' of 5 hours -- - !record {model: project.task, id: project_task_technicaltraining0}: +- + !record {model: project.task, id: project_task_technicaltraining0, context:{'no_analytic_entry':True}}: work_ids: - date: '2010-05-31 16:55:27' hours: 5.0 @@ -264,16 +264,16 @@ - planned_hours == 30 - remaining_hours == 5.0 - effective_hours == 45.0 -- +- Close the task -- +- !python {model: project.task}: | self.do_close(cr, uid, [ref("project_task_technicaltraining0")], {'mail_send': False}) -- +- Check if task in done state -- +- !assert {model: project.task, id: project_task_technicaltraining0, severity: error}: - - state == "done" + - state == "done" - Check for effective hours and remaining hours - @@ -281,16 +281,16 @@ - planned_hours == 30 - remaining_hours == 0.0 - effective_hours == 45.0 -- +- Close project 'OpenERP Training Programme' -- +- !python {model: project.project}: | self.set_done(cr, uid, [ref("project_project_openerptrainingprogramme0")], {"lang": "en_US", "active_ids": [ref("project.menu_open_view_project_all")], "tz": False, "active_model": "ir.ui.menu", "project_id": False, "active_id": ref("project.menu_open_view_project_all"), }) -- +- Check if project in close state -- +- !assert {model: project.project, id: project_project_openerptrainingprogramme0, severity: error, string: "Project must be in closed state"}: - - state == "close" - + - state == "close" + diff --git a/addons/project/wizard/project_task_close_view.xml b/addons/project/wizard/project_task_close_view.xml index 6c064784827..d6bed92824d 100644 --- a/addons/project/wizard/project_task_close_view.xml +++ b/addons/project/wizard/project_task_close_view.xml @@ -7,14 +7,14 @@ <field name="model">project.task.close</field> <field name="type">form</field> <field name="arch" type="xml"> - <form string="Send Email" > + <form string="Send Email"> <group colspan="4" col="4"> <field name="manager_warn" invisible="1"/> - <field name="manager_email" widget="email" attrs="{'invisible':[('manager_warn','=',False)], 'required':[('manager_warn','=',True)]}"/> + <field name="manager_email" widget="email" attrs="{'invisible':[('manager_warn','=',False)], 'required':[('manager_warn','=',True)]}" width="250"/> <field name="partner_warn" invisible="1"/> <field name="partner_email" widget="email" attrs="{'invisible':[('partner_warn','=',False)], 'required':[('partner_warn','=',True)]}"/> <separator string="Warn Message" colspan="4"/> - <field name="description" nolabel="1" colspan="4"/> + <field name="description" nolabel="1" colspan="4" width="200" height="150"/> </group> <separator string="" colspan="4"/> <group colspan="2" col="2"> diff --git a/addons/project_caldav/project_caldav.py b/addons/project_caldav/project_caldav.py index ea6c02bc2cb..fb2d62a9684 100644 --- a/addons/project_caldav/project_caldav.py +++ b/addons/project_caldav/project_caldav.py @@ -32,6 +32,7 @@ class project_task(osv.osv): # force inherit from project.project_task so that # calendar.todo.active is masked oute 'active': base_project_task._columns['active'], + 'date_deadline': base_project_task._columns['date_deadline'], 'write_date': fields.datetime('Write Date'), 'create_date': fields.datetime('Create Date', readonly=True), 'attendee_ids': fields.many2many('calendar.attendee', \ diff --git a/addons/project_issue/project_issue_view.xml b/addons/project_issue/project_issue_view.xml index 3894740f0f1..e3493f5af9b 100644 --- a/addons/project_issue/project_issue_view.xml +++ b/addons/project_issue/project_issue_view.xml @@ -93,7 +93,7 @@ <button name="case_reset" string="Reset to Draft" states="done,cancel" type="object" icon="gtk-convert"/> </group> </page> - <page string="Emails" groups="base.group_extended"> + <page string="History" groups="base.group_extended"> <group colspan="4"> <field colspan="4" name="email_cc" string="Global CC" widget="url"/> </group> @@ -146,7 +146,7 @@ context="{'mail':'new', 'model': 'project.issue'}" icon="terp-mail-message-new" type="action" /> </page> - <page string="History" groups="base.group_extended"> + <page string="Extra Info" groups="base.group_extended"> <group col="2" colspan="2"> <separator colspan="2" string="Date"/> <field name="create_date"/> diff --git a/addons/project_long_term/project_long_term_view.xml b/addons/project_long_term/project_long_term_view.xml index b0647968e84..79f11af4bbd 100644 --- a/addons/project_long_term/project_long_term_view.xml +++ b/addons/project_long_term/project_long_term_view.xml @@ -346,6 +346,30 @@ </field> </record> + <record id="view_phase_task_search_form_group" model="ir.ui.view"> + <field name="name">phase.task.search.form.group</field> + <field name="model">project.task</field> + <field name="type">search</field> + <field name="inherit_id" ref="project.view_task_search_form"/> + <field name="arch" type="xml"> + <filter string="Project" name="group_project_id" icon="terp-folder-violet" domain="[]" context="{'group_by':'project_id'}" position="after"> + <filter string="Project Phase" name="group_project_id_phase" icon="terp-folder-violet" domain="[]" context="{'group_by':'phase_id'}" groups="base.group_extended"/> + </filter> + </field> + </record> + + <record id="view_phase_task_search_form_tree" model="ir.ui.view"> + <field name="name">phase.task.search.form.tree</field> + <field name="model">project.task</field> + <field name="type">tree</field> + <field name="inherit_id" ref="project.view_task_tree2"/> + <field name="arch" type="xml"> + <field name="project_id" position="after"> + <field name="phase_id" invisible="1" groups="base.group_extended"/> + </field> + </field> + </record> + <act_window id="project_phase_task_list" name="Related Tasks" diff --git a/addons/project_timesheet/project_timesheet.py b/addons/project_timesheet/project_timesheet.py index 601fbfa578b..42104fcddc1 100644 --- a/addons/project_timesheet/project_timesheet.py +++ b/addons/project_timesheet/project_timesheet.py @@ -80,42 +80,42 @@ class project_work(osv.osv): vals_line = {} context = kwargs.get('context', {}) + if not context.get('no_analytic_entry',False): + obj_task = task_obj.browse(cr, uid, vals['task_id']) + result = self.get_user_related_details(cr, uid, vals.get('user_id', uid)) + vals_line['name'] = '%s: %s' % (tools.ustr(obj_task.name), tools.ustr(vals['name']) or '/') + vals_line['user_id'] = vals['user_id'] + vals_line['product_id'] = result['product_id'] + vals_line['date'] = vals['date'][:10] + + #calculate quantity based on employee's product's uom + vals_line['unit_amount'] = vals['hours'] + + default_uom = self.pool.get('res.users').browse(cr, uid, uid).company_id.project_time_mode_id.id + if result['product_uom_id'] != default_uom: + vals_line['unit_amount'] = uom_obj._compute_qty(cr, uid, default_uom, vals['hours'], result['product_uom_id']) + acc_id = obj_task.project_id and obj_task.project_id.analytic_account_id.id or False + if acc_id: + vals_line['account_id'] = acc_id + res = obj_timesheet.on_change_account_id(cr, uid, False, acc_id) + if res.get('value'): + vals_line.update(res['value']) + vals_line['general_account_id'] = result['general_account_id'] + vals_line['journal_id'] = result['journal_id'] + vals_line['amount'] = 0.0 + vals_line['product_uom_id'] = result['product_uom_id'] + amount = vals_line['unit_amount'] + prod_id = vals_line['product_id'] + unit = False + timeline_id = obj_timesheet.create(cr, uid, vals=vals_line, context=context) - obj_task = task_obj.browse(cr, uid, vals['task_id']) - result = self.get_user_related_details(cr, uid, vals.get('user_id', uid)) - vals_line['name'] = '%s: %s' % (tools.ustr(obj_task.name), tools.ustr(vals['name']) or '/') - vals_line['user_id'] = vals['user_id'] - vals_line['product_id'] = result['product_id'] - vals_line['date'] = vals['date'][:10] - - #calculate quantity based on employee's product's uom - vals_line['unit_amount'] = vals['hours'] - - default_uom = self.pool.get('res.users').browse(cr, uid, uid).company_id.project_time_mode_id.id - if result['product_uom_id'] != default_uom: - vals_line['unit_amount'] = uom_obj._compute_qty(cr, uid, default_uom, vals['hours'], result['product_uom_id']) - acc_id = obj_task.project_id and obj_task.project_id.analytic_account_id.id or False - if acc_id: - vals_line['account_id'] = acc_id - res = obj_timesheet.on_change_account_id(cr, uid, False, acc_id) - if res.get('value'): - vals_line.update(res['value']) - vals_line['general_account_id'] = result['general_account_id'] - vals_line['journal_id'] = result['journal_id'] - vals_line['amount'] = 0.0 - vals_line['product_uom_id'] = result['product_uom_id'] - amount = vals_line['unit_amount'] - prod_id = vals_line['product_id'] - unit = False - timeline_id = obj_timesheet.create(cr, uid, vals=vals_line, context=context) - - # Compute based on pricetype - amount_unit = obj_timesheet.on_change_unit_amount(cr, uid, timeline_id, - prod_id, amount, False, unit, context=context) - if amount_unit and 'amount' in amount_unit.get('value',{}): - updv = { 'amount': amount_unit['value']['amount'] } - obj_timesheet.write(cr, uid, [timeline_id], updv, context=context) - vals['hr_analytic_timesheet_id'] = timeline_id + # Compute based on pricetype + amount_unit = obj_timesheet.on_change_unit_amount(cr, uid, timeline_id, + prod_id, amount, False, unit, context=context) + if amount_unit and 'amount' in amount_unit.get('value',{}): + updv = { 'amount': amount_unit['value']['amount'] } + obj_timesheet.write(cr, uid, [timeline_id], updv, context=context) + vals['hr_analytic_timesheet_id'] = timeline_id return super(project_work,self).create(cr, uid, vals, *args, **kwargs) def write(self, cr, uid, ids, vals, context=None): diff --git a/addons/sale/__openerp__.py b/addons/sale/__openerp__.py index 33ec602f6fd..6978a0bb072 100644 --- a/addons/sale/__openerp__.py +++ b/addons/sale/__openerp__.py @@ -67,7 +67,7 @@ 'board_sale_view.xml', 'process/sale_process.xml', ], -# 'demo_xml': ['sale_demo.xml'], + 'demo_xml': ['sale_demo.xml'], 'test': [ 'test/data_test.yml', 'test/manual_order_policy.yml', diff --git a/addons/sale/sale.py b/addons/sale/sale.py index f96ddb054f6..97b5be91848 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -931,9 +931,10 @@ class sale_order_line(osv.osv): 'for this product: "%s" (id:%d)') % \ (line.product_id.name, line.product_id.id,)) else: - a = self.pool.get('ir.property').get(cr, uid, + prop = self.pool.get('ir.property').get(cr, uid, 'property_account_income_categ', 'product.category', - context=context).id + context=context) + a = prop and prop.id or False uosqty = _get_line_qty(line) uos_id = _get_line_uom(line) pu = 0.0 diff --git a/addons/sale/sale_view.xml b/addons/sale/sale_view.xml index b9eabcaa02e..3431c911a97 100644 --- a/addons/sale/sale_view.xml +++ b/addons/sale/sale_view.xml @@ -292,6 +292,7 @@ <field name="view_type">form</field> <field name="view_mode">tree,form,calendar,graph</field> <field name="search_view_id" ref="view_sales_order_filter"/> + <field name="context">{"search_default_user_id":uid}</field> <field name="help">Sales Orders helps you manage quotations and orders done with your customers. OpenERP suggests that you to start by creating a quotation. Once the order is confirmed, the quotation is converted into a Sale Order. OpenERP can handle several types of products so that a sales order can trigger tasks, delivery orders, manufacturing orders, purchases and so on. Based on the configuration of the sale order, a draft invoice will be generated so that you just have to confirm it when you want to bill your customer.</field> </record> <menuitem action="action_order_form" id="menu_sale_order" parent="base.menu_sales" sequence="3" groups="base.group_sale_salesman,base.group_sale_manager"/> diff --git a/addons/sale/security/sale_security.xml b/addons/sale/security/sale_security.xml index 36a8fc15118..27852979773 100644 --- a/addons/sale/security/sale_security.xml +++ b/addons/sale/security/sale_security.xml @@ -31,6 +31,19 @@ <field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field> </record> + <record id="sale_order_personal_rule" model="ir.rule"> + <field name="name">Personal Orders</field> + <field ref="model_sale_order" name="model_id"/> + <field name="domain_force">['|',('user_id','=',user.id),('user_id','=',False)]</field> + <field name="groups" eval="[(4, ref('base.group_sale_salesman'))]"/> + </record> + + <record id="sale_order_line_personal_rule" model="ir.rule"> + <field name="name">Personal Order Lines</field> + <field ref="model_sale_order_line" name="model_id"/> + <field name="domain_force">['|',('order_id.user_id','=',user.id),('order_id.user_id','=',False)]</field> + <field name="groups" eval="[(4, ref('base.group_sale_salesman'))]"/> + </record> </data> </openerp> diff --git a/addons/sale_layout/sale_layout_view.xml b/addons/sale_layout/sale_layout_view.xml index f184f79da49..3eac7eb1f3f 100755 --- a/addons/sale_layout/sale_layout_view.xml +++ b/addons/sale_layout/sale_layout_view.xml @@ -10,7 +10,7 @@ <field name="inherit_id" ref="sale.view_order_line_form2"/> <field name="type">form</field> <field name="arch" type="xml"> - <xpath expr="/form/notebook/page/field[@name='name']" position="before"> + <xpath expr="/form/group/field[@name='name']" position="before"> <field name="layout_type" select="1" on_change="onchange_sale_order_line_view(layout_type)" /> <field name="sequence"/> </xpath> diff --git a/addons/share/__openerp__.py b/addons/share/__openerp__.py index 4f2eafb4e52..21b63fd3bc1 100644 --- a/addons/share/__openerp__.py +++ b/addons/share/__openerp__.py @@ -43,7 +43,6 @@ 'website': 'http://www.openerp.com', 'data': [ 'security/share_security.xml', - 'security/ir.model.access.csv', 'share_view.xml', 'res_users_view.xml', 'wizard/share_wizard_view.xml' diff --git a/addons/share/security/ir.model.access.csv b/addons/share/security/ir.model.access.csv deleted file mode 100644 index a8f37d300c6..00000000000 --- a/addons/share/security/ir.model.access.csv +++ /dev/null @@ -1,2 +0,0 @@ -"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink" -"access_share_wizard_user","access_share_wizard_user","model_share_wizard","share.group_share_user",1,1,1,1
\ No newline at end of file diff --git a/addons/stock/product.py b/addons/stock/product.py index c84aafba844..ddb582f4a3c 100644 --- a/addons/stock/product.py +++ b/addons/stock/product.py @@ -423,6 +423,7 @@ class product_template(osv.osv): string='Stock Output Account', method=True, view_load=True, help='When doing real-time inventory valuation, counterpart Journal Items for all outgoing stock moves will be posted in this account. If not set on the product, the one from the product category is used.'), } + product_template() class product_category(osv.osv): @@ -448,6 +449,7 @@ class product_category(osv.osv): method=True, view_load=True, help="When real-time inventory valuation is enabled on a product, this account will hold the current value of the products.",), } + product_category() # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/stock_invoice_directly/test/stock_invoice_directly.yml b/addons/stock_invoice_directly/test/stock_invoice_directly.yml index 4a0708b84d9..b5ecb83caf2 100644 --- a/addons/stock_invoice_directly/test/stock_invoice_directly.yml +++ b/addons/stock_invoice_directly/test/stock_invoice_directly.yml @@ -60,16 +60,12 @@ } pick_obj.do_partial(cr, uid, [ref('stock_picking_out0')], partial_datas, context=context) - - As the Invoice state of the picking order is To be invoiced. I create a record for create invoice. -- - !record {model: stock.invoice.onshipping, id: stock_invoice_onshipping_0}: - invoice_date: '2010-08-04' - journal_id: account.bank_journal -- - I create a Customer invoice for my outgoing picking order. + As the Invoice state of the picking order is To be invoiced. I create invoice for my outgoing picking order. - !python {model: stock.invoice.onshipping}: | - self.create_invoice(cr, uid, [ref("stock_invoice_onshipping_0")], {"lang": "en_US", + wiz_id = self.create(cr, uid, {'invoice_date': '2010-08-04', 'journal_id': ref('account.bank_journal')}, + {'active_ids': [ref("stock_picking_out0")]}) + self.create_invoice(cr, uid, [wiz_id], {"lang": "en_US", "search_default_available": 1, "tz": False, "active_model": "stock.picking", "contact_display": "partner", "active_ids": [ref("stock_picking_out0")], "active_id": ref("stock_picking_out0")}) - diff --git a/addons/survey/report/survey_browse_response.py b/addons/survey/report/survey_browse_response.py index 269b3fc43cb..8e8c195aa59 100644 --- a/addons/survey/report/survey_browse_response.py +++ b/addons/survey/report/survey_browse_response.py @@ -201,11 +201,11 @@ class survey_browse_response(report_rml): for survey in surv_obj.browse(cr, uid, [response.survey_id.id]): tbl_width = float(_tbl_widths.replace('cm', '')) colwidth = "4.6cm,5cm," + str(tbl_width - 16.4) +"cm,4cm,3cm" + resp_create = tools.ustr(time.strftime('%d-%m-%Y %I:%M:%S %p', time.strptime(response.date_create.split('.')[0], '%Y-%m-%d %H:%M:%S'))) rml += """<blockTable colWidths='""" + colwidth + """' style="Table_heading"> <tr> <td><para style="terp_tblheader_General_Centre">Answer Create Date:- </para></td> - # *-* formatting hard coded, breaks with utf8 - <td><para style="terp_tblheader_General_Centre_simple">""" + to_xml(time.strftime('%d-%m-%Y %I:%M:%S %p', time.strptime(response.date_create.split('.')[0], '%Y-%m-%d %H:%M:%S'))) + """</para></td> + <td><para style="terp_tblheader_General_Centre_simple">""" + to_xml(resp_create) + """</para></td> <td><para style="terp_tblheader_General_Centre"></para></td> <td><para style="terp_tblheader_General_right">Answer By:- </para></td> <td><para style="terp_tblheader_General_right_simple">""" + to_xml(response.user_id.login or '') + """</para></td> diff --git a/addons/survey/wizard/survey_answer.py b/addons/survey/wizard/survey_answer.py index 4d623b4b6ac..f803ab88803 100644 --- a/addons/survey/wizard/survey_answer.py +++ b/addons/survey/wizard/survey_answer.py @@ -1,21 +1,20 @@ -# -*- encoding: utf-8 -*- +## -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution -# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved -# $Id$ +# 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 General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. +# 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 General Public License for more details. +# GNU Affero General Public License for more details. # -# You should have received a copy of the GNU General Public License +# 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/>. # ############################################################################## @@ -78,31 +77,42 @@ class survey_question_wiz(osv.osv_memory): sur_name_rec = surv_name_wiz.browse(cr, uid, wiz_id) context.update({'sur_name_id' :wiz_id}) else: - sur_name_rec = surv_name_wiz.browse(cr, uid, context.get('sur_name_id', False)) + sur_name_rec = surv_name_wiz.browse(cr, uid, context['sur_name_id']) if context.has_key('active_id'): context.pop('active_id') survey_id = context.get('survey_id', False) if not survey_id: - return {} + # Try one more time to find it + if 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!")) + # If this function is called without a survey_id in + # its context, it makes no sense to return any view. + # Just return the default, empty view for this object, + # in order to please random calls to this fn(). + return super(survey_question_wiz, self).\ + fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, + toolbar=toolbar, submenu=submenu) sur_rec = survey_obj.browse(cr, uid, survey_id) p_id = map(lambda x:x.id, sur_rec.page_ids) total_pages = len(p_id) pre_button = False readonly = 0 - if context.has_key('response_id') and context.get('response_id', False) \ + if context.get('response_id', False) \ and int(context['response_id'][0]) > 0: readonly = 1 if not sur_name_rec.page_no + 1 : - surv_name_wiz.write(cr, uid, [context.get('sur_name_id',False)], {'store_ans':{}}) + surv_name_wiz.write(cr, uid, [context['sur_name_id'],], {'store_ans':{}}) - sur_name_read = surv_name_wiz.browse(cr, uid, context.get('sur_name_id',False)) + sur_name_read = surv_name_wiz.browse(cr, uid, context['sur_name_id']) page_number = int(sur_name_rec.page_no) if sur_name_read.transfer or not sur_name_rec.page_no + 1: - surv_name_wiz.write(cr, uid, [context.get('sur_name_id', False)], {'transfer':False}) + surv_name_wiz.write(cr, uid, [context['sur_name_id']], {'transfer':False}) flag = False fields = {} if sur_name_read.page == "next" or sur_name_rec.page_no == -1: @@ -123,7 +133,7 @@ class survey_question_wiz(osv.osv_memory): survey_obj.write(cr, uid, survey_id, {'state':'close', 'date_close':strftime("%Y-%m-%d %H:%M:%S")}) p_id = p_id[sur_name_rec.page_no + 1] - surv_name_wiz.write(cr, uid, [context.get('sur_name_id', False)], {'page_no' : sur_name_rec.page_no + 1}) + surv_name_wiz.write(cr, uid, [context['sur_name_id'],], {'page_no' : sur_name_rec.page_no + 1}) flag = True page_number += 1 if sur_name_rec.page_no > - 1: @@ -131,7 +141,7 @@ class survey_question_wiz(osv.osv_memory): else: if sur_name_rec.page_no != 0: p_id = p_id[sur_name_rec.page_no - 1] - surv_name_wiz.write(cr, uid, [context.get('sur_name_id', False)],\ + surv_name_wiz.write(cr, uid, [context['sur_name_id'],],\ {'page_no' : sur_name_rec.page_no - 1}) flag = True page_number -= 1 @@ -144,6 +154,7 @@ class survey_question_wiz(osv.osv_memory): xml_group = etree.SubElement(xml_form, 'group', {'col': '1', 'colspan': '4'}) if context.has_key('response_id') and context.get('response_id', False) \ and int(context.get('response_id',0)[0]) > 0: + # TODO: l10n, cleanup this code to make it readable. Or template? xml_group = etree.SubElement(xml_form, 'group', {'col': '40', 'colspan': '4'}) record = sur_response_obj.browse(cr, uid, context['response_id'][context['response_no']]) etree.SubElement(xml_group, 'label', {'string': to_xml(tools.ustr('Answer Of :- ' + record.user_id.name + ', Date :- ' + record.date_create.split('.')[0] )), 'align':"0.0"}) diff --git a/addons/survey/wizard/survey_selection.py b/addons/survey/wizard/survey_selection.py index 0f7ca8628f0..2ef83d38fcf 100644 --- a/addons/survey/wizard/survey_selection.py +++ b/addons/survey/wizard/survey_selection.py @@ -27,7 +27,7 @@ from tools.translate import _ class survey_name_wiz(osv.osv_memory): _name = 'survey.name.wiz' - def default_get(self, cr, uid, fields, context={}): + def default_get(self, cr, uid, fields, context=None): """ Set the default value in survey_id field. if open this wizard in survey form then set the default value in survey_id = active survey id. @@ -38,7 +38,7 @@ class survey_name_wiz(osv.osv_memory): @param context: A standard dictionary for contextual values @return : Dictionary value for created survey statistics report """ - if not context: + if context is None: context = {} data = super(survey_name_wiz, self).default_get(cr, uid, fields, context) if context.has_key('survey_id'): @@ -75,7 +75,7 @@ class survey_name_wiz(osv.osv_memory): u_list.append(use.id) if uid in u_list: result.append((sur.id, sur.title)) - return result + return result for sur in surv_obj.browse(cr, uid, surv_obj.search(cr, uid, [])): if sur.state == 'open': res = False diff --git a/addons/survey/wizard/survey_send_invitation.py b/addons/survey/wizard/survey_send_invitation.py index 8c61a9b4393..62be63dc755 100644 --- a/addons/survey/wizard/survey_send_invitation.py +++ b/addons/survey/wizard/survey_send_invitation.py @@ -1,22 +1,21 @@ -# -*- encoding: utf-8 -*- +# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution -# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved -# $Id$ +# 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 General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. +# 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 General Public License for more details. +# GNU Affero General Public License for more details # -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. +# 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/> # ############################################################################## |
