diff --git a/addons/account/i18n/ca.po b/addons/account/i18n/ca.po index 448bb5f1aee..d2a9cba7042 100644 --- a/addons/account/i18n/ca.po +++ b/addons/account/i18n/ca.po @@ -14,7 +14,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2010-06-09 03:35+0000\n" +"X-Launchpad-Export-Date: 2010-06-11 03:42+0000\n" "X-Generator: Launchpad (build Unknown)\n" #. module: account diff --git a/addons/account/i18n/cs.po b/addons/account/i18n/cs.po index 09125a2706f..be9a9612f42 100644 --- a/addons/account/i18n/cs.po +++ b/addons/account/i18n/cs.po @@ -13,7 +13,11 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +<<<<<<< TREE +"X-Launchpad-Export-Date: 2010-04-03 03:54+0000\n" +======= "X-Launchpad-Export-Date: 2010-04-17 04:05+0000\n" +>>>>>>> MERGE-SOURCE "X-Generator: Launchpad (build Unknown)\n" #. module: account diff --git a/addons/account/i18n/de.po b/addons/account/i18n/de.po index edecdea43d1..5fdf89c5773 100644 --- a/addons/account/i18n/de.po +++ b/addons/account/i18n/de.po @@ -13,7 +13,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2010-06-10 03:36+0000\n" +"X-Launchpad-Export-Date: 2010-06-11 03:42+0000\n" "X-Generator: Launchpad (build Unknown)\n" #. module: account diff --git a/addons/account/i18n/it.po b/addons/account/i18n/it.po index de27e9bfec9..4a6d2d3a2b8 100644 --- a/addons/account/i18n/it.po +++ b/addons/account/i18n/it.po @@ -13,7 +13,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2010-06-09 03:35+0000\n" +"X-Launchpad-Export-Date: 2010-06-11 03:42+0000\n" "X-Generator: Launchpad (build Unknown)\n" #. module: account diff --git a/addons/account/i18n/zh_CN.po b/addons/account/i18n/zh_CN.po index 8340b713eb7..862b42608ca 100644 --- a/addons/account/i18n/zh_CN.po +++ b/addons/account/i18n/zh_CN.po @@ -13,7 +13,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2010-06-10 03:36+0000\n" +"X-Launchpad-Export-Date: 2010-06-11 03:43+0000\n" "X-Generator: Launchpad (build Unknown)\n" #. module: account diff --git a/addons/account_analytic_analysis/i18n/el.po b/addons/account_analytic_analysis/i18n/el.po index c456eeacf69..80f23d4494d 100644 --- a/addons/account_analytic_analysis/i18n/el.po +++ b/addons/account_analytic_analysis/i18n/el.po @@ -14,7 +14,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2010-06-10 03:36+0000\n" +"X-Launchpad-Export-Date: 2010-06-11 03:43+0000\n" "X-Generator: Launchpad (build Unknown)\n" #. module: account_analytic_analysis diff --git a/addons/account_anglo_saxon/i18n/el.po b/addons/account_anglo_saxon/i18n/el.po index 774d8d4856c..a9aa4a7f36b 100644 --- a/addons/account_anglo_saxon/i18n/el.po +++ b/addons/account_anglo_saxon/i18n/el.po @@ -14,7 +14,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2010-06-10 03:36+0000\n" +"X-Launchpad-Export-Date: 2010-06-11 03:43+0000\n" "X-Generator: Launchpad (build Unknown)\n" #. module: account_anglo_saxon diff --git a/addons/account_balance/i18n/el.po b/addons/account_balance/i18n/el.po index c65e185fcc9..06b70a7e7d9 100644 --- a/addons/account_balance/i18n/el.po +++ b/addons/account_balance/i18n/el.po @@ -14,7 +14,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2010-06-10 03:36+0000\n" +"X-Launchpad-Export-Date: 2010-06-11 03:43+0000\n" "X-Generator: Launchpad (build Unknown)\n" #. module: account_balance diff --git a/addons/account_coda/i18n/el.po b/addons/account_coda/i18n/el.po index a3890e92939..a38c20e7a9e 100644 --- a/addons/account_coda/i18n/el.po +++ b/addons/account_coda/i18n/el.po @@ -14,7 +14,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2010-06-10 03:36+0000\n" +"X-Launchpad-Export-Date: 2010-06-11 03:43+0000\n" "X-Generator: Launchpad (build Unknown)\n" #. module: account_coda diff --git a/addons/account_coda/i18n/et.po b/addons/account_coda/i18n/et.po index ca0c9a210fb..9a173c51337 100644 --- a/addons/account_coda/i18n/et.po +++ b/addons/account_coda/i18n/et.po @@ -14,7 +14,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2010-06-09 03:36+0000\n" +"X-Launchpad-Export-Date: 2010-06-11 03:43+0000\n" "X-Generator: Launchpad (build Unknown)\n" #. module: account_coda diff --git a/addons/account_followup/i18n/hr.po b/addons/account_followup/i18n/hr.po index 32aaa2a926d..07a1d41c617 100644 --- a/addons/account_followup/i18n/hr.po +++ b/addons/account_followup/i18n/hr.po @@ -13,7 +13,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2010-06-09 03:35+0000\n" +"X-Launchpad-Export-Date: 2010-06-11 03:42+0000\n" "X-Generator: Launchpad (build Unknown)\n" #. module: account_followup diff --git a/addons/account_invoice_layout/i18n/el.po b/addons/account_invoice_layout/i18n/el.po index 6ea0abbb2fe..daa8336dcf9 100644 --- a/addons/account_invoice_layout/i18n/el.po +++ b/addons/account_invoice_layout/i18n/el.po @@ -14,7 +14,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2010-06-10 03:36+0000\n" +"X-Launchpad-Export-Date: 2010-06-11 03:43+0000\n" "X-Generator: Launchpad (build Unknown)\n" #. module: account_invoice_layout diff --git a/addons/account_payment/i18n/cs.po b/addons/account_payment/i18n/cs.po index eec828ea2ae..1b10c28c59e 100644 --- a/addons/account_payment/i18n/cs.po +++ b/addons/account_payment/i18n/cs.po @@ -13,7 +13,11 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +<<<<<<< TREE +"X-Launchpad-Export-Date: 2010-03-30 04:07+0000\n" +======= "X-Launchpad-Export-Date: 2010-04-17 04:11+0000\n" +>>>>>>> MERGE-SOURCE "X-Generator: Launchpad (build Unknown)\n" #. module: account_payment diff --git a/addons/account_payment/i18n/el.po b/addons/account_payment/i18n/el.po index d08e0672262..876540bedc1 100644 --- a/addons/account_payment/i18n/el.po +++ b/addons/account_payment/i18n/el.po @@ -14,7 +14,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2010-06-10 03:36+0000\n" +"X-Launchpad-Export-Date: 2010-06-11 03:43+0000\n" "X-Generator: Launchpad (build Unknown)\n" #. module: account_payment diff --git a/addons/account_payment/i18n/zh_CN.po b/addons/account_payment/i18n/zh_CN.po index 28a412cb5c6..24600a62e0e 100644 --- a/addons/account_payment/i18n/zh_CN.po +++ b/addons/account_payment/i18n/zh_CN.po @@ -13,7 +13,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2010-06-09 03:35+0000\n" +"X-Launchpad-Export-Date: 2010-06-11 03:43+0000\n" "X-Generator: Launchpad (build Unknown)\n" #. module: account_payment diff --git a/addons/account_tax_include/i18n/ru.po b/addons/account_tax_include/i18n/ru.po index ea07038c8ce..e4c0cb46a55 100644 --- a/addons/account_tax_include/i18n/ru.po +++ b/addons/account_tax_include/i18n/ru.po @@ -13,7 +13,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2010-06-09 03:35+0000\n" +"X-Launchpad-Export-Date: 2010-06-11 03:42+0000\n" "X-Generator: Launchpad (build Unknown)\n" #. module: account_tax_include diff --git a/addons/account_voucher_payment/i18n/ca.po b/addons/account_voucher_payment/i18n/ca.po index b06ebff8a16..20f86c1846e 100644 --- a/addons/account_voucher_payment/i18n/ca.po +++ b/addons/account_voucher_payment/i18n/ca.po @@ -14,7 +14,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2010-06-09 03:36+0000\n" +"X-Launchpad-Export-Date: 2010-06-11 03:43+0000\n" "X-Generator: Launchpad (build Unknown)\n" #. module: account_voucher_payment diff --git a/addons/account_voucher_payment/i18n/es.po b/addons/account_voucher_payment/i18n/es.po index 80c07e08abb..d169c1cd6ed 100644 --- a/addons/account_voucher_payment/i18n/es.po +++ b/addons/account_voucher_payment/i18n/es.po @@ -14,7 +14,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2010-06-09 03:36+0000\n" +"X-Launchpad-Export-Date: 2010-06-11 03:43+0000\n" "X-Generator: Launchpad (build Unknown)\n" #. module: account_voucher_payment diff --git a/addons/account_voucher_payment/i18n/et.po b/addons/account_voucher_payment/i18n/et.po index 591a7595d36..1541fa67aaf 100644 --- a/addons/account_voucher_payment/i18n/et.po +++ b/addons/account_voucher_payment/i18n/et.po @@ -14,7 +14,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2010-06-09 03:36+0000\n" +"X-Launchpad-Export-Date: 2010-06-11 03:43+0000\n" "X-Generator: Launchpad (build Unknown)\n" #. module: account_voucher_payment diff --git a/addons/auction/__openerp__.py b/addons/auction/__openerp__.py index cd27c60fdb7..0959d6a4dd9 100644 --- a/addons/auction/__openerp__.py +++ b/addons/auction/__openerp__.py @@ -60,6 +60,7 @@ 'auction_wizard.xml' ], 'demo_xml': ['auction_demo.xml'], +# 'test' : ['test/auction.yml','test/auction_wizard.yml'], 'installable': True, 'active': False, 'certificate': '0039333102717', diff --git a/addons/auction/i18n/pl.po b/addons/auction/i18n/pl.po index ca940cf469a..257ff775684 100644 --- a/addons/auction/i18n/pl.po +++ b/addons/auction/i18n/pl.po @@ -13,7 +13,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2010-06-09 03:35+0000\n" +"X-Launchpad-Export-Date: 2010-06-11 03:43+0000\n" "X-Generator: Launchpad (build Unknown)\n" #. module: auction diff --git a/addons/auction/i18n/zh_CN.po b/addons/auction/i18n/zh_CN.po index eb36642e385..15f3fbc92fe 100644 --- a/addons/auction/i18n/zh_CN.po +++ b/addons/auction/i18n/zh_CN.po @@ -13,7 +13,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2010-06-09 03:36+0000\n" +"X-Launchpad-Export-Date: 2010-06-11 03:43+0000\n" "X-Generator: Launchpad (build Unknown)\n" #. module: auction diff --git a/addons/auction/test/auction.yml b/addons/auction/test/auction.yml new file mode 100644 index 00000000000..968bb5f6bbf --- /dev/null +++ b/addons/auction/test/auction.yml @@ -0,0 +1,204 @@ +- + In order to test the auction module in the Open-ERP I start the process by creating a product. +- + I create a new product furniture. +- + !record {model: product.product, id: product_product_furniture0}: + categ_id: product.cat1 + cost_method: standard + mes_type: fixed + name: Furniture + procure_method: make_to_stock + standard_price: 1.0 + supply_method: buy + type: product + uom_id: product.product_uom_unit + uom_po_id: product.product_uom_unit + volume: 0.0 + warranty: 0.0 + weight: 0.0 + weight_net: 0.0 +- + I create a new artist for an object. +- + !record {model: auction.artists, id: auction_artists_vincentvangogh0}: + birth_death_dates: 1853-1900 + name: Vincent van Gogh +- + Now I want to associate an object with the auction so for that I create an auction "Antique furniture exhibition" +- + !record {model: auction.dates, id: auction_dates_antiquefurnitureexhibition0}: + acc_expense: account.a_pay + acc_income: account.a_recv + account_analytic_id: account.analytic_root + auction1: '2010-05-20' + auction2: '2010-05-21' + expo1: '2010-05-18' + expo2: '2010-05-19' + journal_id: account.expenses_journal + journal_seller_id: account.sales_journal + name: Antique furniture exhibition +- + An object is being deposited for an auction,I create a seller's deposit record. +- + !record {model: auction.deposit, id: auction_deposit_ad0}: + date_dep: '2010-05-18' + method: keep + name: AD/006 + partner_id: base.res_partner_4 +- + I create a new object wooden-chair which is to be auctioned. +- + !record {model: auction.lots, id: auction_lots_woodenchair0}: + ach_uid: base.res_partner_2 + artist_id: auction_artists_vincentvangogh0 + auction_id: auction_dates_antiquefurnitureexhibition0 + bord_vnd_id: auction_deposit_ad0 + lot_est1: 3000.0 + lot_est2: 5000.0 + lot_num: 1 + name: wooden-chair + name2: antique wooden chair + obj_num: 1 + obj_price: 4000.0 + obj_ret: 5000.0 + product_id: 'product_product_furniture0' + state: draft + vnd_lim: 5000.0 +- + I create a bid for an object "wooden-chair" which is to be auctioned in Antique furniture exhibition. +- + !record {model: auction.bid, id: auction_bid_bid0}: + auction_id: auction_dates_antiquefurnitureexhibition0 + contact_tel: (+32)2 211 34 83 + name: bid/001 + partner_id: auction.partner_record1 +- + I create a bid line. +- + !record {model: auction.bid_line, id: auction_bid_line_0}: + auction: Antique furniture exhibition + bid_id: auction_bid_bid0 + lot_id: auction.auction_lots_woodenchair0 + price: 3500.0 +- + I create another bid for an object "wooden-chair" bided by a different partner +- + !record {model: auction.bid, id: auction_bid_bid1}: + auction_id: auction_dates_antiquefurnitureexhibition0 + name: bid/002 + partner_id: base.res_partner_2 +- + I create a bid line. +- + !record {model: auction.bid_line, id: auction_bid_line_1}: + auction: Antique furniture exhibition + bid_id: 'auction_bid_bid1' + call: 1 + lot_id: auction.auction_lots_woodenchair0 + price: 4000.0 +- + I check that buyer price and seller price gets bind with the value +- + !python {model: auction.lots}: | + from tools.translate import _ + auc_id=self.browse(cr, uid, ref("auction_lots_woodenchair0")) + assert(auc_id.buyer_price,auc_id.seller_price), _('Buyer price and seller price are not available!') +- + I check that a record gets created in the Seller's Summary. +- + !python {model: auction.lots}: | + from tools.translate import _ + auc_id=self.browse(cr, uid, ref("auction_lots_woodenchair0")) + auc_deposit_obj=self.pool.get('auction.deposit') + rep_sell_obj = self.pool.get('report.seller.auction') + ids =rep_sell_obj.search(cr, uid, [('auction', '=', auc_id.auction_id.id),('seller', '=',auc_id.bord_vnd_id.partner_id.id)]) + assert ids, _('No record found!') +- + I check that a record gets created in the Seller's Revenues. +- + !python {model: auction.lots}: | + from tools.translate import _ + auc_id=self.browse(cr, uid, ref("auction_lots_woodenchair0")) + auc_deposit_obj=self.pool.get('auction.deposit') + rep_sell_obj = self.pool.get('report.seller.auction2') + ids =rep_sell_obj.search(cr, uid, [('auction', '=', auc_id.auction_id.id),('seller', '=',auc_id.bord_vnd_id.partner_id.id)]) + assert ids, _('No record found!') +- + I check that a record gets created in the Buyer's Summary. +- + !python {model: auction.lots}: | + from tools.translate import _ + auc_id1=self.browse(cr, uid, ref("auction_lots_woodenchair0")) + rep_buy_obj1 = self.pool.get('report.buyer.auction') + ids1=rep_buy_obj1.search(cr, uid, [('auction', '=', auc_id1.auction_id.id),('buyer', '=',auc_id1.ach_uid.id)]) + assert ids1, _('No record found!') +- + I check that a record gets created in the Buyer's Revenue. +- + !python {model: auction.lots}: | + from tools.translate import _ + auc_id1=self.browse(cr, uid, ref("auction_lots_woodenchair0")) + rep_buy_obj1 = self.pool.get('report.buyer.auction2') + ids1=rep_buy_obj1.search(cr, uid, [('auction', '=', auc_id1.auction_id.id),('buyer', '=',auc_id1.ach_uid.id)]) + assert ids1, _('No record found!') +- + I check that a record gets created in the Auction's Summary. +- + !python {model: auction.lots}: | + from tools.translate import _ + auc_id2=self.browse(cr, uid, ref("auction_lots_woodenchair0")) + rep_auc_obj1 = self.pool.get('report.auction.view') + ids2=rep_auc_obj1.search(cr, uid, [('auction_id', '=', auc_id2.auction_id.id)]) + assert ids2, _('No record found!') +- + I check that a record gets created in the Auction's Revenues. +- + !python {model: auction.lots}: | + from tools.translate import _ + auc_id3=self.browse(cr, uid, ref("auction_lots_woodenchair0")) + rep_auc_obj1 = self.pool.get('report.auction.view2') + ids3=rep_auc_obj1.search(cr, uid, [('auction', '=', auc_id3.auction_id.id)]) + assert ids3, _('No record found!') +- + An object has been sold,so I click on the "Sold" button. +- + !python {model: auction.lots}: | + self.button_bought(cr, uid, [ref("auction_lots_woodenchair0")], {"lang": "en_US", "tz": + False, "active_model": "ir.ui.menu", "active_ids": [ref("auction.auction_lots_woodenchair0")], + "active_id": ref("auction.auction_lots_woodenchair0")}) +- + I check that the order which was initially in the draft state has transit to sold state. +- + !python {model: auction.lots}: | + from tools.translate import _ + auc_id=self.browse(cr, uid, ref("auction_lots_woodenchair0")) + assert(auc_id.state == 'sold'), _('State not changed!') +- + Then I click on the Taken Away button. +- + !python {model: auction.lots}: | + self.button_taken_away(cr, uid, [ref("auction_lots_woodenchair0")], {"lang": + "en_US", "tz": False, "active_model": "ir.ui.menu", "active_ids": [ref("auction.auction_all_objects_menu")], + "active_id": ref("auction.auction_all_objects_menu")}) +- + I check that the order which was initially in the sold state has transit to taken away state. +- + !python {model: auction.lots}: | + from tools.translate import _ + auc_id=self.browse(cr, uid, ref("auction_lots_woodenchair0")) + assert(auc_id.state == 'taken_away'), _('State not changed!') +- + I click on the "Close + Create all invoices" button +- + !python {model: auction.dates}: | + self.close(cr, uid, [ref("auction.auction_dates_antiquefurnitureexhibition0")], + {"lang": "en_US", "tz": False, "active_model": "ir.ui.menu", "active_ids": + [ref("auction.menu_auction_dates_next1")], "active_id": ref("auction.menu_auction_dates_next1")}) +- + I check that a record gets created in the "Supplier Invoices". +- + !python {model: auction.lots}: | + from tools.translate import _ + auc_id=self.browse(cr, uid, ref("auction_lots_woodenchair0")) + assert(auc_id.sel_inv_id), _('Seller Invoice has not been created!') diff --git a/addons/auction/test/auction_wizard.yml b/addons/auction/test/auction_wizard.yml new file mode 100644 index 00000000000..0998e7a03a5 --- /dev/null +++ b/addons/auction/test/auction_wizard.yml @@ -0,0 +1,248 @@ +- + In order to test the wizards of auction module I create a new record. +- + I start the process by creating a new product Paintings. +- + !record {model: product.product, id: product_product_paintings0}: + categ_id: product.cat1 + cost_method: standard + mes_type: fixed + name: Paintings + procure_method: make_to_stock + standard_price: 1.0 + supply_method: buy + type: product + uom_id: product.product_uom_unit + uom_po_id: product.product_uom_unit + volume: 0.0 + warranty: 0.0 + weight: 0.0 + weight_net: 0.0 +- + I create a new artist-Picasso's record. +- + !record {model: auction.artists, id: auction_artists_picasso0}: + birth_death_dates: 1881-1973 + name: Picasso +- + Now I want to associate an object with the auction so for that I create an auction "Picasso's painting exhibition" +- + !record {model: auction.dates, id: auction_dates_picassospaintingexhibition0}: + acc_expense: account.a_pay + acc_income: account.a_recv + account_analytic_id: account.analytic_root + auction1: '2010-05-24' + auction2: '2010-05-25' + expo1: '2010-05-21' + expo2: '2010-05-22' + journal_id: account.expenses_journal + journal_seller_id: account.sales_journal + name: Picasso's painting exhibition +- + An object is being deposited for an auction,I create a seller's deposit record. +- + !record {model: auction.deposit, id: auction_deposit_ad1}: + date_dep: '2010-05-18' + method: keep + name: AD/007 + partner_id: base.res_partner_9 +- + I create a new object painting which is to be auctioned. +- + !record {model: auction.lots, id: auction_lots_painting0}: + ach_login: 'Mr.Chang' + artist_id: auction.auction_artists_picasso0 + auction_id: auction_dates_picassospaintingexhibition0 + bord_vnd_id: auction_deposit_ad1 + lot_est1: 2000.0 + lot_est2: 4000.0 + lot_num: 2 + name: painting + name2: picasso_painting + obj_num: 2 + obj_price: 3500.0 + obj_ret: 4000.0 + product_id: auction.product_product_paintings0 + state: draft + vnd_lim: 4000.0 +- + I assign the buyer through "Map buyer user name to Partners" wizard. +- + !record {model: auction.lots.buyer_map, id: auction_lots_buyer_map_0}: + ach_login: 'Mr.Chang' + ach_uid: base.res_partner_3 +- + I click on the "Update" button. +- + !python {model: auction.lots.buyer_map}: | + auc_obj=self.pool.get('auction.lots') + ids=self.browse(cr, uid, ref("auction_lots_painting0")) + self.buyer_map_set(cr, uid, [ref("auction_lots_buyer_map_0")], {"lang": "en_US", + "tz": False, "active_model": "auction.lots", "active_ids": [ref("auction_lots_painting0")], + "active_id": ref("auction_lots_painting0")}) +- + I check that the buyer field gets bind with the value. +- + !python {model: auction.lots}: | + from tools.translate import _ + auc_id=self.browse(cr, uid, ref("auction_lots_painting0")) + assert(auc_id.ach_uid), _('Buyer not assigned!') +- + I mark that a seller has been paid by using the "Mark as paid for seller" wizard. +- + !record {model: auction.payer.sel, id: auction_payer_sel_0}: + {} +- + I click on the "Pay" button. +- + !python {model: auction.payer.sel}: | + self.payer_sel(cr, uid, [ref("auction_payer_sel_0")], {"lang": "en_US", "tz": + False, "active_model": "auction.lots", "active_ids": [ref("auction_lots_painting0")], "active_id": ref("auction_lots_painting0")}) +- + I check that the Seller paid field is set to True. +- + !python {model: auction.lots}: | + from tools.translate import _ + auc_id=self.browse(cr, uid, ref("auction_lots_painting0")) + assert(auc_id.paid_vnd == True), _('Seller paid is not marked!') +- + I use the "Mark as taken away" wizard to indicate that an object is taken away. +- + !record {model: auction.lots.able, id: auction_lots_able_0}: + {} +- + Then I click on the "Able Taken away" wizard. +- + !python {model: auction.lots.able}: | + self.confirm_able(cr, uid, [ref("auction_lots_able_0")], {"lang":"en_US", "tz": + False, "active_model": "auction.lots", "active_ids": [ref("auction_lots_painting0")], + "active_id": ref("auction_lots_painting0")}) +- + I check that Taken away field is set to True. +- + !python {model: auction.lots}: | + from tools.translate import _ + auc_id=self.browse(cr, uid, ref("auction_lots_painting0")) + assert(auc_id.ach_emp == True), _('Taken away is not marked!') +- + I use the "Unmark as taken away" wizard to unmark the Taken Away field. +- + !record {model: auction.lots.enable, id: auction_lots_enable_0}: + confirm_en: 0.0 +- + Then I click on the "Enable Taken away" button. +- + !python {model: auction.lots.enable}: | + self.confirm_enable(cr, uid, [ref("auction_lots_enable_0")], {"lang": "en_US", + "tz": False, "active_model": "auction.lots", "active_ids": [ref("auction_lots_painting0")], + "active_id": ref("auction_lots_painting0"),}) +- + I check that Taken away field is set to False. +- + !python {model: auction.lots}: | + from tools.translate import _ + auc_id=self.browse(cr, uid, ref("auction_lots_painting0")) + assert(auc_id.ach_emp == False), _('Taken away is marked!') +- + I create statement lines for an object's payment by using the "Pay objects of the buyer" wizard +- + I create a bank statement. +- + !record {model: account.bank.statement, id: account_bank_statement_st0}: + balance_end_real: 0.0 + date: '2010-05-19' + journal_id: account.bank_journal + name: St. 05/19 + period_id: account.period_5 + state: draft +- + I create auction payment record. +- + !record {model: auction.pay.buy, id: auction_pay_buy_0}: + amount: 2000.0 + amount2: 1000.0 + amount3: 1000.0 + buyer_id: base.res_partner_2 + statement_id1: account_bank_statement_st0 + statement_id2: account_bank_statement_st0 + statement_id3: account_bank_statement_st0 + total: 4000.0 +- + Then I click "Pay" button. +- + !python {model: auction.pay.buy}: | + self.pay_and_reconcile(cr, uid, [ref("auction_pay_buy_0")], {"lang": "en_US", "tz": + False, "active_model": "auction.lots", "active_ids": [ref("auction_lots_painting0")], + "active_id": ref("auction_lots_painting0"),}) +- + I check that a record gets created in the 'auction_statement_line_rel' table +- + !python {model: auction.lots}: | + from tools.translate import _ + cr.execute("select statement from auction_statement_line_rel,auction_lots where auction_lots.id=auction_statement_line_rel.auction_id AND auction_lots.name='painting'") + ans=cr.fetchall() + assert ans, _('statement_id not found!') +- + I create the seller's invoice by using the "Invoice Seller objects" wizard. +- + !record {model: auction.lots.make.invoice, id: auction_lots_make_invoice_0}: + amount: 3500.0 + number: 2010/002 + objects: 1 +- + Then I click on the "Create Invoices" button. +- + !python {model: auction.lots.make.invoice}: | + self.makeInvoices(cr, uid, [ref("auction_lots_make_invoice_0")], {"lang": "en_US", + "active_model": "auction.lots", "active_ids": [ref("auction_lots_painting0")], + "tz": False, "active_id": ref("auction_lots_painting0"),}) +- + I check that a "Seller Invoice" field gets bind with the value. +- + !python {model: auction.lots}: | + from tools.translate import _ + auc_id=self.browse(cr, uid, ref("auction_lots_painting0")) + assert(auc_id.sel_inv_id), _('Seller Invoice has not been created!') +- + I create a buyer's invoice by using the "Invoice Buyer objects" wizard. +- + !record {model: auction.lots.make.invoice.buyer, id: auction_lots_make_invoice_buyer_0}: + amount: 3500.0 + buyer_id: base.res_partner_3 + number: 2010/003 + objects: 1 +- + Then I click on the "Create Invoices" button. +- + !python {model: auction.lots.make.invoice.buyer}: | + self.makeInvoices(cr, uid, [ref("auction_lots_make_invoice_buyer_0")], {"lang": + "en_US", "active_model": "auction.lots", "active_ids": [ref("auction_lots_painting0")], + "tz": False, "active_id": ref("auction_lots_painting0"), }) +- + I check that a "Buyer Invoice" field gets bind with the value. +- + !python {model: auction.lots}: | + from tools.translate import _ + auc_id=self.browse(cr, uid, ref("auction_lots_painting0")) + assert(auc_id.ach_inv_id), _('Seller Invoice has not been created!') +- + In order to change the auction for an object I use the "Change auction date" wizard. +- + !record {model: auction.lots.auction.move, id: auction_lots_auction_move_0}: + auction_id: auction.auction_date_2 +- + Then I click on the "Move to Auction date" button. +- + !python {model: auction.lots.auction.move}: | + self.auction_move_set(cr, uid, [ref("auction_lots_auction_move_0")], {"lang": + "en_US", "tz": False, "active_model": "auction.lots", "active_ids": [ref("auction_lots_painting0")], + "active_id": ref("auction_lots_painting0"), }) +- + I check that a record gets created in the lot history. +- + !python {model: auction.lots}: | + from tools.translate import _ + auc_id=self.browse(cr, uid, ref("auction_lots_painting0")) + auc_lot_his=self.pool.get('auction.lot.history') + ids=auc_lot_his.search(cr, uid, [('lot_id', '=', auc_id.id)]) + assert ids, _('Auction history does not exists!') diff --git a/addons/audittrail/audittrail.py b/addons/audittrail/audittrail.py index 620ef30a821..1a72a26ea5f 100644 --- a/addons/audittrail/audittrail.py +++ b/addons/audittrail/audittrail.py @@ -88,10 +88,10 @@ class audittrail_rule(osv.osv): "domain": "[('object_id','=', " + str(thisrule.object_id.id) + "), ('res_id', '=', active_id)]" } - id = obj_action.create(cr, uid, val) - self.write(cr, uid, [thisrule.id], {"state": "subscribed", "action_id": id}) + action_id = obj_action.create(cr, uid, val) + self.write(cr, uid, [thisrule.id], {"state": "subscribed", "action_id": action_id}) keyword = 'client_action_relate' - value = 'ir.actions.act_window,' + str(id) + value = 'ir.actions.act_window,' + str(action_id) res = obj_model.ir_set(cr, uid, 'action', keyword, 'View_log_' + thisrule.object_id.model, [thisrule.object_id.model], value, replace=True, isobject=True, xml_id=False) #End Loop return True @@ -135,15 +135,9 @@ class audittrail_log(osv.osv): "name": fields.char("Name", size=32), "object_id": fields.many2one('ir.model', 'Object'), "user_id": fields.many2one('res.users', 'User'), - "method": fields.selection((('read', 'Read'), - ('write', 'Write'), - ('unlink', 'Delete'), - ('create', 'Create'), - ('action','Action'), - ('workflow','Workflow')), "Method"), + "method": fields.char("Method", size=64), "timestamp": fields.datetime("Date"), "res_id": fields.integer('Resource Id'), - "method_name": fields.char("Method Name", size=32), "line_ids": fields.one2many('audittrail.log.line', 'log_id', 'Log lines'), } @@ -178,7 +172,7 @@ audittrail_log_line() class audittrail_objects_proxy(osv_pool): """ Uses Object proxy for auditing changes on object of subscribed Rules""" - def get_value_text(self, cr, uid, field_name, values, object, context=None): + def get_value_text(self, cr, uid, field_name, values, model, context=None): """ Gets textual values for the fields e.g.: For field of type many2one it gives its name value instead of id @@ -192,86 +186,85 @@ class audittrail_objects_proxy(osv_pool): if not context: context = {} pool = pooler.get_pool(cr.dbname) - f_id = pool.get('ir.model.fields').search(cr, uid, [('name', '=', field_name), ('model_id', '=', object.id)]) - if f_id: - field = pool.get('ir.model.fields').read(cr, uid, f_id)[0] - model = field['relation'] + field_pool = pool.get('ir.model.fields') + field_ids = field_pool.search(cr, uid, [('name', '=', field_name), ('model_id', '=', model.id)]) + field_id = field_ids and field_ids[0] or False + assert field_id, _("'%s' field is not exits in '%s' model" %(field_name, model.model)) + + field = field_pool.read(cr, uid, field_id) + relation_model = field['relation'] + relation_model_pool = relation_model and pool.get(relation_model) or False + + if field['ttype'] == 'many2one': + res = False + relation_id = False + if values and type(values) == tuple: + relation_id = values[0] + if relation_id and relation_model_pool: + relation_model_object = relation_model_pool.read(cr, uid, relation_id, [relation_model_pool._rec_name]) + res = relation_model_object[relation_model_pool._rec_name] + return res - if field['ttype'] == 'many2one': - if values: - if type(values) == tuple: - values = values[0] - val = pool.get(model).read(cr, uid, [values], [pool.get(model)._rec_name]) - if val: - return val[0][pool.get(model)._rec_name] - elif field['ttype'] == 'many2many': - value = [] - if values: - for id in values: - val = pool.get(model).read(cr, uid, [id], [pool.get(model)._rec_name]) - if val: - value.append(val[0][pool.get(model)._rec_name]) - return value + elif field['ttype'] in ('many2many','one2many'): + res = [] + for relation_model_object in relation_model_pool.read(cr, uid, values, [relation_model_pool._rec_name]): + res.append(relation_model_object[relation_model_pool._rec_name]) + return res + + return values - elif field['ttype'] == 'one2many': - if values: - value = [] - for id in values: - val = pool.get(model).read(cr, uid, [id], [pool.get(model)._rec_name]) - - if val: - value.append(val[0][pool.get(model)._rec_name]) - return value - return values - - def create_log_line(self, cr, uid, id, object, lines=[]): + def create_log_line(self, cr, uid, log_id, model, lines=[]): """ Creates lines for changed fields with its old and new values @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, - @param object: Object who's values are being changed + @param model: Object who's values are being changed @param lines: List of values for line is to be created """ pool = pooler.get_pool(cr.dbname) - obj = pool.get(object.model) + obj_pool = pool.get(model.model) + model_pool = pool.get('ir.model') + field_pool = pool.get('ir.model.fields') + log_line_pool = pool.get('audittrail.log.line') #start Loop for line in lines: - if obj._inherits: - inherits_ids = pool.get('ir.model').search(cr, uid, [('model', '=', obj._inherits.keys()[0])]) - f_id = pool.get('ir.model.fields').search(cr, uid, [('name', '=', line['name']), ('model_id', 'in', (object.id, inherits_ids[0]))]) + if obj_pool._inherits: + inherits_ids = model_pool.search(cr, uid, [('model', '=', obj_pool._inherits.keys()[0])]) + field_ids = field_pool.search(cr, uid, [('name', '=', line['name']), ('model_id', 'in', (model.id, inherits_ids[0]))]) else: - f_id = pool.get('ir.model.fields').search(cr, uid, [('name', '=', line['name']), ('model_id', '=', object.id)]) - if f_id: - fields = pool.get('ir.model.fields').read(cr, uid, f_id) - old_value = 'old_value' in line and line['old_value'] or '' - new_value = 'new_value' in line and line['new_value'] or '' - old_value_text = 'old_value_text' in line and line['old_value_text'] or '' - new_value_text = 'new_value_text' in line and line['new_value_text'] or '' + field_ids = field_pool.search(cr, uid, [('name', '=', line['name']), ('model_id', '=', model.id)]) + field_id = field_ids and field_ids[0] or False + assert field_id, _("'%s' field is not exits in '%s' model" %(line['name'], model.model)) + + field = field_pool.read(cr, uid, field_id) + old_value = 'old_value' in line and line['old_value'] or '' + new_value = 'new_value' in line and line['new_value'] or '' + old_value_text = 'old_value_text' in line and line['old_value_text'] or '' + new_value_text = 'new_value_text' in line and line['new_value_text'] or '' - if old_value_text == new_value_text: - continue - if fields[0]['ttype'] == 'many2one': - if type(old_value) == tuple: - old_value = old_value[0] - if type(new_value) == tuple: - new_value = new_value[0] - vals = { - "log_id": id, - "field_id": f_id[0], - "old_value": old_value, - "new_value": new_value, - "old_value_text": old_value_text, - "new_value_text": new_value_text, - "field_description": fields[0]['field_description'] - } - line_id = pool.get('audittrail.log.line').create(cr, uid, vals) - cr.commit() - #End Loop + if old_value_text == new_value_text: + continue + if field['ttype'] == 'many2one': + if type(old_value) == tuple: + old_value = old_value[0] + if type(new_value) == tuple: + new_value = new_value[0] + vals = { + "log_id": log_id, + "field_id": field_id, + "old_value": old_value, + "new_value": new_value, + "old_value_text": old_value_text, + "new_value_text": new_value_text, + "field_description": field['field_description'] + } + line_id = log_line_pool.create(cr, uid, vals) + #End Loop return True - def log_fct(self, db, uid, object, method, fct_src, *args): + def log_fct(self, db, uid, model, method, fct_src, *args): """ Logging function: This function is performs logging oprations according to method @param db: the current database @@ -282,203 +275,163 @@ class audittrail_objects_proxy(osv_pool): @return: Returns result as per method of Object proxy """ - logged_uids = [] res2 = args pool = pooler.get_pool(db) cr = pooler.get_db(db).cursor() - obj_ids = pool.get('ir.model').search(cr, uid, [('model', '=', object)]) - model_object = pool.get('ir.model').browse(cr, uid, obj_ids)[0] - res_id = fct_src(db, uid, object, method, *args) + resource_pool = pool.get(model) + log_pool = pool.get('audittrail.log') + model_pool = pool.get('ir.model') + + model_ids = model_pool.search(cr, uid, [('model', '=', model)]) + model_id = model_ids and model_ids[0] or False + assert model_id, _("'%s' Model is not exits..." %(model)) + model = model_pool.browse(cr, uid, model_id) if method in ('create'): + res_id = fct_src(db, uid, model.model, method, *args) + cr.commit() + resource = resource_pool.read(cr, uid, res_id, args[0].keys()) + vals = { + "method": method, + "object_id": model.id, + "user_id": uid, + "res_id": resource['id'], + } + if 'id' in resource: + del resource['id'] + log_id = log_pool.create(cr, uid, vals) + lines = [] + for field in resource: + line = { + 'name': field, + 'new_value': resource[field], + 'new_value_text': self.get_value_text(cr, uid, field, resource[field], model) + } + lines.append(line) + self.create_log_line(cr, uid, log_id, model, lines) cr.commit() - new_value = pool.get(model_object.model).read(cr, uid, [res_id], args[0].keys())[0] - if 'id' in new_value: - del new_value['id'] + cr.close() + return res_id - resource_pool = pool.get(model_object.model) - try: - resource_name = resource_pool.name_get(cr, uid, [res_id]) - resource_name = resource_name and resource_name[0][1] or '' - - if not logged_uids or uid in logged_uids: - vals = { - "method": method, - "object_id": model_object.id, - "user_id": uid, "res_id": res_id, - "name": resource_name - } - id = pool.get('audittrail.log').create(cr, uid, vals) - lines = [] - for field in new_value: - if new_value[field]: - line = { - 'name': field, - 'new_value': new_value[field], - 'new_value_text': self.get_value_text(cr, uid, field, new_value[field], model_object) - } - lines.append(line) - self.create_log_line(cr, uid, id, model_object, lines) - except Exception: - if not hasattr(resource_pool,'name_get'): - resource_name = resource_pool.read(cr, uid, [args[0]]) - resource_name = resource_name and resource_name[0][1] or '' - - cr.commit() - cr.close() - return res_id - - if method in ('write'): - res_ids = args[0] - for res_id in res_ids: - old_values = pool.get(model_object.model).read(cr, uid, res_id, args[1].keys()) - old_values_text = {} - for field in args[1].keys(): - old_values_text[field] = self.get_value_text(cr, uid, field, old_values[field], model_object) - res = fct_src(db, uid, object, method, *args) - cr.commit() - if res: - new_values = pool.get(model_object.model).read(cr, uid, res_ids, args[1].keys())[0] - if not logged_uids or uid in logged_uids: - resource_name = pool.get(model_object.model).name_get(cr, uid, [res_id]) - resource_name = resource_name and resource_name[0][1] or '' - id = pool.get('audittrail.log').create(cr, uid, {"method": method, "object_id": model_object.id, "user_id": uid, "res_id": res_id, "name": resource_name}) - lines = [] - for field in args[1].keys(): - if args[1].keys(): - line = { - 'name': field, - 'new_value': field in new_values and new_values[field] or '', - 'old_value': field in old_values and old_values[field] or '', - 'new_value_text': self.get_value_text(cr, uid, field, new_values[field], model_object), - 'old_value_text': old_values_text[field] - } - lines.append(line) - cr.commit() - self.create_log_line(cr, uid, id, model_object, lines) - cr.close() - return res - - if method in ('read'): + elif method in ('read'): res_ids = args[0] old_values = {} - res = fct_src(db, uid, object, method, *args) + res = fct_src(db, uid, model, method, *args) if type(res) == list: - for v in res: old_values[v['id']] = v else: old_values[res['id']] = res for res_id in old_values: - if not logged_uids or uid in logged_uids: - resource_name = pool.get(model_object.model).name_get(cr, uid, [res_id]) - resource_name = resource_name and resource_name[0][1] or '' - id = pool.get('audittrail.log').create(cr, uid, {"method": method, "object_id": model_object.id, "user_id": uid, "res_id": res_id, "name": resource_name}) - lines = [] - for field in old_values[res_id]: - if old_values[res_id][field]: - line = { - 'name': field, - 'old_value': old_values[res_id][field], - 'old_value_text': self.get_value_text(cr, uid, field, old_values[res_id][field], model_object) - } - lines.append(line) - cr.commit() - self.create_log_line(cr, uid, id, model_object, lines) + vals = { + "method": method, + "object_id": model.id, + "user_id": uid, + "res_id": res_id, + + } + log_id = log_pool.create(cr, uid, vals) + lines = [] + for field in old_values[res_id]: + line = { + 'name': field, + 'old_value': old_values[res_id][field], + 'old_value_text': self.get_value_text(cr, uid, field, old_values[res_id][field], model) + } + lines.append(line) + + self.create_log_line(cr, uid, log_id, model, lines) + cr.close() return res - if method in ('unlink'): + elif method in ('unlink'): res_ids = args[0] old_values = {} for res_id in res_ids: - old_values[res_id] = pool.get(model_object.model).read(cr, uid, res_id, []) + old_values[res_id] = resource_pool.read(cr, uid, res_id) for res_id in res_ids: - if not logged_uids or uid in logged_uids: - resource_name = pool.get(model_object.model).name_get(cr, uid, [res_id]) - resource_name = resource_name and resource_name[0][1] or '' - id = pool.get('audittrail.log').create(cr, uid, {"method": method, "object_id": model_object.id, "user_id": uid, "res_id": res_id, "name": resource_name}) - lines = [] - for field in old_values[res_id]: - if old_values[res_id][field]: - line = { - 'name': field, - 'old_value': old_values[res_id][field], - 'old_value_text': self.get_value_text(cr, uid, field, old_values[res_id][field], model_object) - } - lines.append(line) - cr.commit() - self.create_log_line(cr, uid, id, model_object, lines) - res = fct_src(db, uid, object, method, *args) + vals = { + "method": method, + "object_id": model.id, + "user_id": uid, + "res_id": res_id, + + } + log_id = log_pool.create(cr, uid, vals) + lines = [] + for field in old_values[res_id]: + line = { + 'name': field, + 'old_value': old_values[res_id][field], + 'old_value_text': self.get_value_text(cr, uid, field, old_values[res_id][field], model) + } + lines.append(line) + + self.create_log_line(cr, uid, log_id, model, lines) + res = fct_src(db, uid, model, method, *args) + cr.commit() cr.close() return res - cr.close() + else: + res_ids = args[0] + old_values = {} + fields = [] + if len(args)>1 and type(args[1]) == dict: + fields = args[1].keys() + if type(res_ids) in (long, int): + res_ids = [res_ids] + if res_ids: + for resource in resource_pool.read(cr, uid, res_ids, fields): + resource_id = resource['id'] + if 'id' in resource: + del resource['id'] + old_values_text = {} + old_value = {} + for field in resource.keys(): + old_value[field] = resource[field] + old_values_text[field] = self.get_value_text(cr, uid, field, resource[field], model) + old_values[resource_id] = {'text':old_values_text, 'value': old_value} - def action_log(self, db, uid, object, method, fct_src, *args): - """ - Logging function: This function is performs logging oprations according to method - @param db: the current database - @param uid: the current user’s ID for security checks, - @param object: Object who's values are being changed - @param method: get any method and create log - @param fct_src: execute method of Object proxy + res = fct_src(db, uid, model.model, method, *args) + cr.commit() - @return: Returns result as per method of Object proxy - """ - logged_uids = [] - pool = pooler.get_pool(db) - cr = pooler.get_db(db).cursor() - obj_ids = pool.get('ir.model').search(cr, uid, [('model', '=', object)]) - model_object = pool.get('ir.model').browse(cr, uid, obj_ids)[0] + if res_ids: + for resource in resource_pool.read(cr, uid, res_ids, fields): + resource_id = resource['id'] + if 'id' in resource: + del resource['id'] + vals = { + "method": method, + "object_id": model.id, + "user_id": uid, + "res_id": resource_id, + } + + + log_id = log_pool.create(cr, uid, vals) + lines = [] + for field in resource.keys(): + line = { + 'name': field, + 'new_value': resource[field], + 'old_value': old_values[resource_id]['value'][field], + 'new_value_text': self.get_value_text(cr, uid, field, resource[field], model), + 'old_value_text': old_values[resource_id]['text'][field] + } + lines.append(line) + + self.create_log_line(cr, uid, log_id, model, lines) + cr.commit() + cr.close() + return res + return True - res_id = args[0] + - old_values_text = {} - old_values = {} - new_values = {} - old_values = pool.get(model_object.model).read(cr, uid, res_id,[])[0] - for field in old_values.keys(): - old_values_text[field] = self.get_value_text(cr, uid, field, old_values[field], model_object) - - res = super(audittrail_objects_proxy, self).execute(db, uid, object, method,*args) - cr.commit() - new_values = pool.get(model_object.model).read(cr, uid, res_id,[])[0] - - resource_pool = pool.get(model_object.model) - resource_name = hasattr(resource_pool,'name_get') - if not resource_name: - resource_name = pool.get(model_object.model).name_get(cr, uid, args[0]) - resource_name = resource_name and resource_name[0][1] or '' - id =args and args[0] and args[0][0] - l_id = pool.get('audittrail.log').create(cr, uid, {"method": 'action', "object_id": model_object.id, "user_id": uid, "res_id": id, "name": resource_name, "method_name": method}) - diff = {} - log_line_pool = pool.get('audittrail.log.line') - for field in old_values.keys(): - if old_values[field] == new_values[field]: - continue - else: - diff.update({field: (old_values[field], new_values[field])}) - - if model_object._inherits: - inherits_ids = pool.get('ir.model').search(cr, uid, [('model', '=', model_object._inherits.keys()[0])]) - f_id = pool.get('ir.model.fields').search(cr, uid, [('name', '=', field), ('model_id', 'in', (model_object.id, inherits_ids[0]))]) - else: - f_id = pool.get('ir.model.fields').search(cr, uid, [('name', '=', field), ('model_id', '=', model_object.id)]) - if f_id: - fields = pool.get('ir.model.fields').read(cr, uid, f_id) - log_line_pool.create(cr, uid, {'field_id': f_id[0], 'log_id': l_id, \ - 'old_value': str(old_values[field]),\ - 'new_value': str(new_values[field]),\ - 'old_value_text':str(old_values_text[field]), - 'new_value_text':self.get_value_text(cr, uid, field, new_values[field], model_object), - }) - cr.commit() - cr.close() - return res - - def execute(self, db, uid, object, method, *args, **kw): + def execute(self, db, uid, model, method, *args, **kw): """ Overrides Object Proxy execute method @param db: the current database @@ -488,131 +441,82 @@ class audittrail_objects_proxy(osv_pool): @return: Returns result as per method of Object proxy """ - pool = pooler.get_pool(db) + model_pool = pool.get('ir.model') + rule_pool = pool.get('audittrail.rule') cr = pooler.get_db(db).cursor() cr.autocommit(True) logged_uids = [] fct_src = super(audittrail_objects_proxy, self).execute - def my_fct(db, uid, object, method, *args): - field = method + def my_fct(db, uid, model, method, *args): rule = False - obj_ids = pool.get('ir.model').search(cr, uid, [('model', '=', object)]) - for obj_name in pool.obj_list(): - if obj_name == 'audittrail.rule': + model_ids = model_pool.search(cr, uid, [('model', '=', model)]) + model_id = model_ids and model_ids[0] or False + + for model_name in pool.obj_list(): + if model_name == 'audittrail.rule': rule = True if not rule: - return fct_src(db, uid, object, method, *args) - if not obj_ids: - return fct_src(db, uid, object, method, *args) - rule_ids = pool.get('audittrail.rule').search(cr, uid, [('object_id', '=', obj_ids[0]), ('state', '=', 'subscribed')]) - if not rule_ids: - return fct_src(db, uid, object, method, *args) + return fct_src(db, uid, model, method, *args) + if not model_id: + return fct_src(db, uid, model, method, *args) - for thisrule in pool.get('audittrail.rule').browse(cr, uid, rule_ids): + rule_ids = rule_pool.search(cr, uid, [('object_id', '=', model_id), ('state', '=', 'subscribed')]) + if not rule_ids: + return fct_src(db, uid, model, method, *args) + + for thisrule in rule_pool.browse(cr, uid, rule_ids): for user in thisrule.user_id: logged_uids.append(user.id) if not logged_uids or uid in logged_uids: - if field in ('read', 'write', 'create', 'unlink'): + if method in ('read', 'write', 'create', 'unlink'): + if getattr(thisrule, 'log_' + method): + return self.log_fct(db, uid, model, method, fct_src, *args) - if getattr(thisrule, 'log_' + field): - return self.log_fct(db, uid, object, method, fct_src, *args) - - elif field not in ('default_get','read','fields_view_get','fields_get','search','search_count','name_search','name_get','get','request_get', 'get_sc', 'unlink') and (field != 'write' and field != 'create'): + elif method not in ('default_get','read','fields_view_get','fields_get','search','search_count','name_search','name_get','get','request_get', 'get_sc', 'unlink', 'write', 'create'): if thisrule.log_action: - return self.action_log(db, uid, object, method, fct_src, *args) - return fct_src(db, uid, object, method, *args) - res = my_fct(db, uid, object, method, *args) + return self.log_fct(db, uid, model, method, fct_src, *args) + + return fct_src(db, uid, model, method, *args) + res = my_fct(db, uid, model, method, *args) cr.close() - return res + return res - def workflow_log(self, db, uid, object, method,*args, **argv): - """ - Logging function: This function is performs logging oprations according to method - @param db: the current database - @param uid: the current user’s ID for security checks, - @param object: Object who's values are being changed - @param method: get any method and create log - @param fct_src: execute method of Object proxy - - @return: Returns result as per method of Object proxy - """ - - logged_uids = [] - pool = pooler.get_pool(db) - cr = pooler.get_db(db).cursor() - obj_ids = pool.get('ir.model').search(cr, uid, [('model', '=', object)]) - model_object = pool.get('ir.model').browse(cr, uid, obj_ids)[0] - - workflow_obj = pool.get('workflow') - wkf_ids = workflow_obj.search(cr, uid, [('osv', '=', object)]) - wkf_name= workflow_obj.browse(cr, uid, wkf_ids)[0].name - - res_id = args[0] - old_values_text = {} - old_values = pool.get(model_object.model).read(cr, uid, res_id) - for field in old_values.keys(): - old_values_text[field] = self.get_value_text(cr, uid, field, old_values[field], model_object) - - res = super(audittrail_objects_proxy, self).exec_workflow(db, uid, object, method, *args, **argv) - cr.commit() - new_values = pool.get(model_object.model).read(cr, uid, res_id) - - resource_name = pool.get(model_object.model).name_get(cr, uid, [args[0]]) - resource_name = resource_name and resource_name[0][1] or '' - l_id = pool.get('audittrail.log').create(cr, uid, {"method": 'workflow', "object_id": model_object.id, "user_id": uid, "res_id": args[0], "name": resource_name +"/"+ wkf_name }) - lines = [] - diff = {} - log_line_pool = pool.get('audittrail.log.line') - - for field in old_values.keys(): - if old_values[field] == new_values[field]: - continue - else: - diff.update({field: (old_values[field], new_values[field])}) - f_id = pool.get('ir.model.fields').search(cr, uid, [('name', '=', field), ('model_id', '=', model_object.id)]) - log_line_pool.create(cr, uid, {'field_id': f_id[0], 'log_id': l_id, \ - 'old_value': str(old_values[field]),\ - 'new_value': str(new_values[field]),\ - 'old_value_text':str(old_values_text[field]), - 'new_value_text':self.get_value_text(cr, uid, field, new_values[field], model_object), - }) - cr.commit() - cr.close() - return res - - - def exec_workflow(self, db, uid, object, method, *args, **argv): + def exec_workflow(self, db, uid, model, method, *args, **argv): pool = pooler.get_pool(db) cr = pooler.get_db(db).cursor() cr.autocommit(True) logged_uids = [] - fct_src = super(audittrail_objects_proxy, self).execute + fct_src = super(audittrail_objects_proxy, self).exec_workflow field = method rule = False - obj_ids = pool.get('ir.model').search(cr, uid, [('model', '=', object)]) + model_pool = pool.get('ir.model') + rule_pool = pool.get('audittrail.rule') + model_ids = model_pool.search(cr, uid, [('model', '=', model)]) for obj_name in pool.obj_list(): if obj_name == 'audittrail.rule': rule = True if not rule: - return super(audittrail_objects_proxy, self).exec_workflow(db, uid, object, method, *args, **argv) - if not obj_ids: - return super(audittrail_objects_proxy, self).exec_workflow(db, uid, object, method, *args, **argv) - rule_ids = pool.get('audittrail.rule').search(cr, uid, [('object_id', '=', obj_ids[0]), ('state', '=', 'subscribed')]) - if not rule_ids: - res = super(audittrail_objects_proxy, self).exec_workflow(db, uid, object, method, *args, **argv) + return super(audittrail_objects_proxy, self).exec_workflow(db, uid, model, method, *args, **argv) + if not model_ids: + return super(audittrail_objects_proxy, self).exec_workflow(db, uid, model, method, *args, **argv) - for thisrule in pool.get('audittrail.rule').browse(cr, uid, rule_ids): + rule_ids = rule_pool.search(cr, uid, [('object_id', 'in', model_ids), ('state', '=', 'subscribed')]) + if not rule_ids: + return super(audittrail_objects_proxy, self).exec_workflow(db, uid, model, method, *args, **argv) + + for thisrule in rule_pool.browse(cr, uid, rule_ids): for user in thisrule.user_id: logged_uids.append(user.id) if not logged_uids or uid in logged_uids: if thisrule.log_workflow: - return self.workflow_log(db, uid, object, method, *args,**argv) - return super(audittrail_objects_proxy, self).exec_workflow(db, uid, object, method, *args, **argv) + return self.log_fct(db, uid, model, method, fct_src, *args) + return super(audittrail_objects_proxy, self).exec_workflow(db, uid, model, method, *args, **argv) cr.close() + return True audittrail_objects_proxy() diff --git a/addons/audittrail/audittrail_view.xml b/addons/audittrail/audittrail_view.xml index c34feacd865..17b2594d470 100644 --- a/addons/audittrail/audittrail_view.xml +++ b/addons/audittrail/audittrail_view.xml @@ -63,9 +63,10 @@ - + @@ -93,9 +94,8 @@ - + widget="one2many_list" readonly="1" nolabel="1">
@@ -157,11 +157,7 @@ form - - - + action="action_audittrail_log_tree" parent="menu_action_audittrail" /> diff --git a/addons/audittrail/i18n/it.po b/addons/audittrail/i18n/it.po index 08587530a61..f795546b2fe 100644 --- a/addons/audittrail/i18n/it.po +++ b/addons/audittrail/i18n/it.po @@ -13,7 +13,11 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +<<<<<<< TREE +"X-Launchpad-Export-Date: 2010-03-30 04:13+0000\n" +======= "X-Launchpad-Export-Date: 2010-04-17 04:17+0000\n" +>>>>>>> MERGE-SOURCE "X-Generator: Launchpad (build Unknown)\n" #. module: audittrail diff --git a/addons/base_calendar/base_calendar_view.xml b/addons/base_calendar/base_calendar_view.xml index d0c1a57ba84..79c8a0207a3 100644 --- a/addons/base_calendar/base_calendar_view.xml +++ b/addons/base_calendar/base_calendar_view.xml @@ -138,7 +138,7 @@ + parent="base.menu_address_book" sequence="15" /> diff --git a/addons/base_contact/base_contact.py b/addons/base_contact/base_contact.py index 23589fd2d6d..75cbfd20c03 100644 --- a/addons/base_contact/base_contact.py +++ b/addons/base_contact/base_contact.py @@ -26,6 +26,7 @@ class res_partner_contact(osv.osv): _name = "res.partner.contact" _description = "Contact" + _log_create = True def _title_get(self,cr, user, context={}): """ @@ -207,6 +208,7 @@ class res_partner_job(osv.osv): _name = 'res.partner.job' _description ='Contact Partner Function' _order = 'sequence_contact' + _log_create = True _columns = { 'name': fields.related('address_id', 'partner_id', type='many2one',\ diff --git a/addons/base_contact/i18n/ko.po b/addons/base_contact/i18n/ko.po index a5dbaad3f46..d209a3d2db3 100644 --- a/addons/base_contact/i18n/ko.po +++ b/addons/base_contact/i18n/ko.po @@ -14,7 +14,11 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +<<<<<<< TREE +"X-Launchpad-Export-Date: 2010-04-07 03:46+0000\n" +======= "X-Launchpad-Export-Date: 2010-04-17 04:03+0000\n" +>>>>>>> MERGE-SOURCE "X-Generator: Launchpad (build Unknown)\n" #. module: base_contact diff --git a/addons/base_contact/migrations/1.2/pre-10-res_partner_address_change.py b/addons/base_contact/migrations/1.2/pre-10-res_partner_address_change.py new file mode 100644 index 00000000000..26deac23e7f --- /dev/null +++ b/addons/base_contact/migrations/1.2/pre-10-res_partner_address_change.py @@ -0,0 +1,32 @@ +# -*- coding: utf8 -*- + +__name__ = "res.partner.adress: for each address it should create a contact with the name of the address" + +def migrate(cr, version): + generate_contact(cr) + +def generate_contact(cr): + cr.execute("""DROP TRIGGER IF EXISTS contactjob on res_partner_contact; + DROP LANGUAGE IF EXISTS plpgsql CASCADE; + CREATE LANGUAGE plpgsql ; + CREATE OR REPLACE FUNCTION add_to_job() RETURNS TRIGGER AS $contactjob$ + DECLARE + new_name varchar; + new_phonenum varchar; + BEGIN + IF(TG_OP='INSERT') THEN + INSERT INTO res_partner_job(contact_id, address_id, function, state) VALUES(NEW.id, NEW.website::integer,NEW.first_name, 'current'); + UPDATE res_partner_contact set first_name=Null, website=Null, active=True where id=NEW.id; + END IF; + RETURN NEW; + END; + $contactjob$ LANGUAGE plpgsql; + CREATE TRIGGER contactjob AFTER INSERT ON res_partner_contact FOR EACH ROW EXECUTE PROCEDURE add_to_job();""") + cr.commit() + + cr.execute("INSERT into res_partner_contact (name, title, email, first_name, website) (SELECT coalesce(name, 'Noname'), title, email, function , to_char(id, '99999999') from res_partner_address)") + cr.commit() + cr.execute("DROP TRIGGER IF EXISTS contactjob on res_partner_contact") + cr.execute("DROP LANGUAGE IF EXISTS plpgsql CASCADE;") + cr.execute("DROP FUNCTION IF EXISTS add_to_job()") + cr.commit() \ No newline at end of file diff --git a/addons/base_module_quality/i18n/zh_CN.po b/addons/base_module_quality/i18n/zh_CN.po index 63aa756e8d6..f9b78c86564 100644 --- a/addons/base_module_quality/i18n/zh_CN.po +++ b/addons/base_module_quality/i18n/zh_CN.po @@ -14,7 +14,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2010-06-10 03:36+0000\n" +"X-Launchpad-Export-Date: 2010-06-11 03:43+0000\n" "X-Generator: Launchpad (build Unknown)\n" #. module: base_module_quality diff --git a/addons/base_report_designer/i18n/hr.po b/addons/base_report_designer/i18n/hr.po index 8b4c87f5583..56742afa154 100644 --- a/addons/base_report_designer/i18n/hr.po +++ b/addons/base_report_designer/i18n/hr.po @@ -13,7 +13,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2010-06-09 03:35+0000\n" +"X-Launchpad-Export-Date: 2010-06-11 03:43+0000\n" "X-Generator: Launchpad (build Unknown)\n" "Language: hr\n" diff --git a/addons/base_setup/i18n/hr.po b/addons/base_setup/i18n/hr.po index 2cf88ec82e1..236c8a46a53 100644 --- a/addons/base_setup/i18n/hr.po +++ b/addons/base_setup/i18n/hr.po @@ -13,7 +13,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2010-06-09 03:35+0000\n" +"X-Launchpad-Export-Date: 2010-06-11 03:42+0000\n" "X-Generator: Launchpad (build Unknown)\n" "Language: hr\n" diff --git a/addons/board_manufacturing/board_manufacturing_view.xml b/addons/board_manufacturing/board_manufacturing_view.xml index 191f1818612..37624d6e025 100644 --- a/addons/board_manufacturing/board_manufacturing_view.xml +++ b/addons/board_manufacturing/board_manufacturing_view.xml @@ -14,8 +14,8 @@ - - + + diff --git a/addons/board_warehouse/board_warehouse_view.xml b/addons/board_warehouse/board_warehouse_view.xml index af797401935..08ece3f821d 100644 --- a/addons/board_warehouse/board_warehouse_view.xml +++ b/addons/board_warehouse/board_warehouse_view.xml @@ -23,7 +23,7 @@ - + diff --git a/addons/caldav/wizard/calendar_event_export.py b/addons/caldav/wizard/calendar_event_export.py index 856d9e9bc91..0be54df9f56 100644 --- a/addons/caldav/wizard/calendar_event_export.py +++ b/addons/caldav/wizard/calendar_event_export.py @@ -32,16 +32,6 @@ class calendar_event_export(osv.osv_memory): """ Export Calendar Event. """ - def process_export_ics(self, cr, uid, ids, context): - """ - Get Default value for file_path field. - """ - model = context.get('model', 'basic.calendar') - model_obj = self.pool.get(model) - - calendar = model_obj.export_cal(cr, uid, context['active_ids'], context) - self.write(cr, uid, ids, {'file_path': base64.encodestring(calendar)}) - return False def default_get(self, cr, uid, fields, context): """ @@ -54,6 +44,9 @@ class calendar_event_export(osv.osv_memory): name = 'OpenERP %s.ics' % (model_obj._description) if 'name' in fields: res.update({'name': name}) + if 'file_path' in fields: + calendar = model_obj.export_cal(cr, uid, context['active_ids'], context) + res.update({'file_path': base64.encodestring(calendar)}) return res _name = "calendar.event.export" diff --git a/addons/caldav/wizard/calendar_event_export_view.xml b/addons/caldav/wizard/calendar_event_export_view.xml index 227822966d0..cfadf945bf4 100644 --- a/addons/caldav/wizard/calendar_event_export_view.xml +++ b/addons/caldav/wizard/calendar_event_export_view.xml @@ -13,8 +13,8 @@ -