[MERGE]: Merge with lp:openobject-trunk-dev-addons2

bzr revid: ksa@tinyerp.co.in-20100611130548-sr0i7od1jqa3bdnu
This commit is contained in:
ksa (Open ERP)
2010-06-11 18:35:48 +05:30
245 changed files with 4410 additions and 2329 deletions
+1 -1
View File
@@ -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
+4
View File
@@ -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
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
+4
View File
@@ -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
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
+1
View File
@@ -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',
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
+204
View File
@@ -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!')
+248
View File
@@ -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!')
+235 -331
View File
@@ -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()
+4 -8
View File
@@ -63,9 +63,10 @@
<!--<field name="view_id" ref="view_audittrail_rule_form" />-->
</record>
<menuitem name="Audittrails" id="menu_action_audittrail"
<menuitem name="Audittrail" id="menu_action_audittrail"
groups="base.group_extended"
parent="base.menu_administration" />
<menuitem name="Rules" id="menu_action_audittrail_rule_tree"
action="action_audittrail_rule_tree" parent="menu_action_audittrail" />
@@ -93,9 +94,8 @@
<field name="name" readonly="1" select="1"/>
<field name="res_id" readonly="1"/>
<field name="object_id" select="1" readonly="1"/>
<field name="method_name" select="1" readonly="1"/>
<field name="line_ids" colspan="4" mode="tree,form"
widget="one2many_list" readonly="1">
widget="one2many_list" readonly="1" nolabel="1">
<form string="Log Lines">
<field name="field_id" colspan="4"
readonly="1" />
@@ -157,11 +157,7 @@
<field name="view_type">form</field>
</record>
<menuitem name="Logs" id="menu_action_audittrail_log_tree"
action="action_audittrail_log_tree" parent="menu_action_audittrail" />
<!-- <wizard string="View log" menu="False" model="audittrail.log" name="audittrail.view.log" id="wizard_audittrail_log"/>-->
<menuitem name="View Logs" id="menu_action_log_tree2"
action="action_audittrail_view_log" parent="menu_action_audittrail" />
action="action_audittrail_log_tree" parent="menu_action_audittrail" />
</data>
</openerp>
+4
View File
@@ -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
+1 -1
View File
@@ -138,7 +138,7 @@
<!-- Calenadar's menu -->
<menuitem id="base.menu_calendar_configuration" name="Calendar"
parent="base.menu_config_address_book" sequence="15" />
parent="base.menu_address_book" sequence="15" />
<!-- Invitation menu -->
+2
View File
@@ -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',\
+4
View File
@@ -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
@@ -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()
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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"
+1 -1
View File
@@ -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"
@@ -14,8 +14,8 @@
<hpaned position="100">
<child1>
<action colspan="4" height="200" name="%(mrp.mrp_production_action2)d" string="Next production orders" width="510"/>
<action colspan="4" name="%(stock.action_picking_all)d" string="Deliveries (Out picking)" domain="[('state','=','assigned'),('type','=','out')]"/>
<action colspan="4" name="%(mrp_procurement.mrp_procurement_action4)d" string="Procurements in Exception"/>
<action colspan="4" name="%(stock.action_picking_tree)d" string="Deliveries (Out picking)" domain="[('state','=','assigned'),('type','=','out')]"/>
<action colspan="4" name="%(procurement.procurement_action4)d" string="Procurements in Exception"/>
</child1>
@@ -23,7 +23,7 @@
<form string="Warehouse board">
<hpaned position="100">
<child1>
<action colspan="4" name="%(mrp_procurement.mrp_procurement_action5)d" string="Procurement Exceptions" width="510" />
<action colspan="4" name="%(procurement.procurement_action5)d" string="Procurement Exceptions" width="510" />
<action colspan="4" name="%(action_reception_picking_move_board)d" string="Products To Receive" />
</child1>
+3 -10
View File
@@ -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"
@@ -13,8 +13,8 @@
</group>
<separator string="" colspan="4" />
<group colspan="4" col="6">
<button name="process_export_ics" icon="gtk-execute" string="Genetate ics" type="object"/>
<button icon="gtk-cancel" special="cancel" string="_Cancel"/>
<label string=""/>
<button icon="gtk-close" special="cancel" string="_Close"/>
</group>
</form>
</field>
+22
View File
@@ -0,0 +1,22 @@
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# 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 Affero General Public License for more details.
#
# 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/>.
#
##############################################################################
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+35
View File
@@ -0,0 +1,35 @@
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# 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 Affero General Public License for more details.
#
# 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/>.
#
##############################################################################
{
"name" : "Claim from delivery",
"version" : "1.0",
"author" : "Tiny",
"category" : "Enterprise Specific Modules/Food Industries",
"depends" : ["base", "crm_claim", "stock"],
"init_xml" : [],
"demo_xml" : [],
"description": '''Create Claim from delivery order:
''',
"update_xml" : ["claim_delivery_view.xml"],
"active": False,
"installable": True
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -0,0 +1,12 @@
<openerp>
<data>
<act_window
id="act_claim_from_delivery"
name="Claim"
target="current"
view_mode="form"
res_model="crm.claim"
src_model="stock.picking"/>
</data>
</openerp>
+45 -45
View File
@@ -30,19 +30,19 @@ from tools.translate import _
MAX_LEVEL = 15
AVAILABLE_STATES = [
('draft', 'Draft'),
('open', 'Open'),
('cancel', 'Cancelled'),
('done', 'Closed'),
('draft', 'Draft'),
('open', 'Open'),
('cancel', 'Cancelled'),
('done', 'Closed'),
('pending', 'Pending'),
]
AVAILABLE_PRIORITIES = [
('1', 'Highest'),
('2', 'High'),
('3', 'Normal'),
('4', 'Low'),
('5', 'Lowest'),
('2', 'High'),
('3', 'Normal'),
('4', 'Low'),
('5', 'Lowest'),
]
class crm_case(object):
@@ -107,10 +107,10 @@ class crm_case(object):
"""
user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
return user.context_section_id.id or False
def stage_next(self, cr, uid, ids, context=None):
"""This function computes next stage for case from its current stage
using available stage for that case type
using available stage for that case type
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current user’s ID for security checks,
@@ -151,7 +151,7 @@ class crm_case(object):
def stage_previous(self, cr, uid, ids, context=None):
"""This function computes previous stage for case from its current stage
using available stage for that case type
using available stage for that case type
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current user’s ID for security checks,
@@ -177,11 +177,11 @@ class crm_case(object):
@param uid: the current user’s ID for security checks,
@param ids: List of case IDs
@param part: Partner's id
@email: Partner's email ID
@email: Partner's email ID
"""
if not part:
return {'value': {'partner_address_id': False,
'email_from': False,
return {'value': {'partner_address_id': False,
'email_from': False,
}}
addr = self.pool.get('res.partner').address_get(cr, uid, [part], ['contact'])
data = {'partner_address_id': addr['contact']}
@@ -195,13 +195,13 @@ class crm_case(object):
@param uid: the current user’s ID for security checks,
@param ids: List of case IDs
@param add: Id of Partner's address
@email: Partner's email ID
@email: Partner's email ID
"""
if not add:
return {'value': {'email_from': False}}
address = self.pool.get('res.partner.address').browse(cr, uid, add)
return {'value': {'email_from': address.email}}
def _history(self, cr, uid, cases, keyword, history=False, subject=None, email=False, details=None, email_from=False, message_id=False, attach=[], context={}):
mailgate_pool = self.pool.get('mailgate.thread')
return mailgate_pool._history(cr, uid, cases, keyword, history=history,\
@@ -209,7 +209,7 @@ class crm_case(object):
details=details, email_from=email_from,\
message_id=message_id, attach=attach, \
context=context)
def case_open(self, cr, uid, ids, *args):
"""Opens Case
@param self: The object pointer
@@ -265,7 +265,7 @@ class crm_case(object):
if case.section_id.parent_id.user_id:
data['user_id'] = case.section_id.parent_id.user_id.id
else:
raise osv.except_osv(_('Error !'), _('You can not escalate this case.\nYou are already at the top level.'))
raise osv.except_osv(_('Error !'), _('You can not escalate, You are already at the top level regarding your sales-team category.'))
self.write(cr, uid, [case.id], data)
cases = self.browse(cr, uid, ids)
self._history(cr, uid, cases, _('Escalate'))
@@ -317,7 +317,7 @@ class crm_case(object):
self.write(cr, uid, ids, {'state': 'draft', 'active': True})
self._action(cr, uid, cases, 'draft')
return True
def remind_partner(self, cr, uid, ids, context={}, attach=False):
"""
@@ -350,7 +350,7 @@ class crm_case(object):
src = case.email_from
dest = case.section_id.reply_to
body = ""
body = case.email_last or case.description
body = case.email_last or case.description
if not destination:
src, dest = dest, src
if body and case.user_id.signature:
@@ -381,7 +381,7 @@ class crm_case(object):
# raise osv.except_osv(_('Email!'),("Email Successfully Sent"))
#else:
# raise osv.except_osv(_('Email Fail!'),("Email is not sent successfully"))
return True
return True
def _check(self, cr, uid, ids=False, context={}):
"""
@@ -428,12 +428,12 @@ class crm_case_section(osv.osv):
_order = "name"
_columns = {
'name': fields.char('Sales Team', size=64, required=True, translate=True),
'code': fields.char('Code', size=8),
'name': fields.char('Sales Team', size=64, required=True, translate=True),
'code': fields.char('Code', size=8),
'active': fields.boolean('Active', help="If the active field is set to \
true, it will allow you to hide the sales team without removing it."),
'allow_unlink': fields.boolean('Allow Delete', help="Allows to delete non draft cases"),
'user_id': fields.many2one('res.users', 'Responsible User'),
true, it will allow you to hide the sales team without removing it."),
'allow_unlink': fields.boolean('Allow Delete', help="Allows to delete non draft cases"),
'user_id': fields.many2one('res.users', 'Responsible User'),
'member_ids':fields.many2many('res.users', 'sale_member_rel', 'section_id', 'member_id', 'Team Members'),
'reply_to': fields.char('Reply-To', size=64, help="The email address put \
in the 'Reply-To' of all emails sent by Open ERP about cases in this sales team"),
@@ -445,8 +445,8 @@ class crm_case_section(osv.osv):
}
_defaults = {
'active': lambda *a: 1,
'allow_unlink': lambda *a: 1,
'active': lambda *a: 1,
'allow_unlink': lambda *a: 1,
}
_sql_constraints = [
@@ -463,7 +463,7 @@ class crm_case_section(osv.osv):
@param ids: List of Sales team ids
"""
level = 100
while len(ids):
cr.execute('select distinct parent_id from crm_case_section where id =ANY(%s)', (ids,))
ids = filter(None, map(lambda x: x[0], cr.fetchall()))
@@ -509,9 +509,9 @@ class crm_case_categ(osv.osv):
_description = "Category of case"
_columns = {
'name': fields.char('Case Category Name', size=64, required=True, translate=True),
'section_id': fields.many2one('crm.case.section', 'Sales Team'),
'object_id': fields.many2one('ir.model', 'Object Name'),
'name': fields.char('Case Category Name', size=64, required=True, translate=True),
'section_id': fields.many2one('crm.case.section', 'Sales Team'),
'object_id': fields.many2one('ir.model', 'Object Name'),
}
def _find_object_id(self, cr, uid, context=None):
@@ -541,9 +541,9 @@ class crm_case_resource_type(osv.osv):
_rec_name = "name"
_columns = {
'name': fields.char('Case Resource Type', size=64, required=True, translate=True),
'section_id': fields.many2one('crm.case.section', 'Sales Team'),
'object_id': fields.many2one('ir.model', 'Object Name'),
'name': fields.char('Case Resource Type', size=64, required=True, translate=True),
'section_id': fields.many2one('crm.case.section', 'Sales Team'),
'object_id': fields.many2one('ir.model', 'Object Name'),
}
def _find_object_id(self, cr, uid, context=None):
"""Finds id for case object
@@ -572,14 +572,14 @@ class crm_case_stage(osv.osv):
_order = "sequence"
_columns = {
'name': fields.char('Stage Name', size=64, required=True, translate=True),
'section_id': fields.many2one('crm.case.section', 'Sales Team'),
'name': fields.char('Stage Name', size=64, required=True, translate=True),
'section_id': fields.many2one('crm.case.section', 'Sales Team'),
'sequence': fields.integer('Sequence', help="Gives the sequence order \
when displaying a list of case stages."),
'object_id': fields.many2one('ir.model', 'Object Name'),
'probability': fields.float('Probability (%)', required=True),
when displaying a list of case stages."),
'object_id': fields.many2one('ir.model', 'Object Name'),
'probability': fields.float('Probability (%)', required=True),
'on_change': fields.boolean('Change Probability Automatically', \
help="Change Probability on next and previous stages."),
help="Change Probability on next and previous stages."),
'requirements': fields.text('Requirements')
}
def _find_object_id(self, cr, uid, context=None):
@@ -594,8 +594,8 @@ class crm_case_stage(osv.osv):
return ids and ids[0]
_defaults = {
'sequence': lambda *args: 1,
'probability': lambda *args: 0.0,
'sequence': lambda *args: 1,
'probability': lambda *args: 0.0,
'object_id' : _find_object_id
}
@@ -619,7 +619,7 @@ class users(osv.osv):
_inherit = 'res.users'
_description = "Users"
_columns = {
'context_section_id': fields.many2one('crm.case.section', 'Sales Team'),
'context_section_id': fields.many2one('crm.case.section', 'Sales Team'),
}
users()
@@ -627,7 +627,7 @@ users()
class res_partner(osv.osv):
_inherit = 'res.partner'
_columns = {
'section_id': fields.many2one('crm.case.section', 'Sales Team'),
'section_id': fields.many2one('crm.case.section', 'Sales Team'),
}
res_partner()
+2 -1
View File
@@ -32,10 +32,11 @@ class crm_lead(osv.osv, crm_case):
""" CRM Lead Case """
_name = "crm.lead"
_description = "Lead"
_description = "Lead/Opportunity"
_order = "priority, id desc"
_inherit = ['res.partner.address']
_inherits = {'mailgate.thread': 'thread_id'}
_log_create=True
def _compute_day(self, cr, uid, ids, fields, args, context={}):
"""
+2 -1
View File
@@ -48,7 +48,7 @@
<field name="date_deadline"/>
<button
name="convert_opportunity"
string="Convert"
string="Convert to Opportunity"
help="Convert to Opportunity"
icon="gtk-index"
type="object"/>
@@ -66,6 +66,7 @@
states="open,pending" type="object"
icon="gtk-go-forward" />
</group>
<field name="type" readonly="1"/>
</group>
<notebook colspan="4">
<page string="Lead">
+1
View File
@@ -45,6 +45,7 @@ class crm_meeting(osv.osv, crm_case):
_order = "id desc"
_inherit = ["calendar.event"]
_inherits = {'mailgate.thread': 'thread_id'}
_log_create=True
_columns = {
# From crm.case
-1
View File
@@ -37,7 +37,6 @@ AVAILABLE_STATES = [
class crm_opportunity(osv.osv):
""" Opportunity Cases """
_name = "crm.lead"
_description = "Opportunity"
_order = "priority,date_action,id desc"
_inherit = 'crm.lead'
_columns = {
+3 -3
View File
@@ -26,10 +26,10 @@
<field name="name">Opportunities</field>
<field name="res_model">crm.lead</field>
<field name="view_mode">tree,form,graph</field>
<field name="domain">[('type','=','opportunity')]</field>
<field name="context">{'search_default_current':1, 'default_type': 'opportunity'}</field>
<field name="domain">['|',('type','=','opportunity'),('state','=','draft')]</field>
<field name="context">{'search_default_user_id':uid,'search_default_current':1}</field>
<field name="view_id" ref="crm_case_tree_view_oppor"/>
<field name="context">{"search_default_user_id":uid}</field>
<field name="context">{'search_default_current':1, 'default_type': 'opportunity'}</field>
<field name="search_view_id" ref="crm.view_crm_case_opportunities_filter"/>
</record>
+1
View File
@@ -82,6 +82,7 @@
<newline/>
<field name="date_action"/>
<field name="priority" string="Priority"/>
<field name="type" readonly="1"/>
</group>
<notebook colspan="4">
<page string="Opportunity">
+1
View File
@@ -32,6 +32,7 @@ class crm_phonecall(osv.osv, crm_case):
_description = "Phonecall"
_order = "id desc"
_inherits = {'mailgate.thread': 'thread_id'}
_log_create=True
_columns = {
# From crm.case
+1 -1
View File
@@ -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: crm
+4
View File
@@ -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:01+0000\n"
>>>>>>> MERGE-SOURCE
"X-Generator: Launchpad (build Unknown)\n"
#. module: crm
+1
View File
@@ -30,6 +30,7 @@ class crm_claim(osv.osv, crm.crm_case):
_description = "Claim Cases"
_order = "id desc"
_inherits = {'mailgate.thread': 'thread_id'}
_log_create=True
_columns = {
'thread_id': fields.many2one('mailgate.thread', 'Thread', required=False),
@@ -29,6 +29,7 @@ class crm_fundraising(osv.osv, crm.crm_case):
_description = "Fund Raising Cases"
_order = "id desc"
_inherits = {'mailgate.thread': 'thread_id'}
_log_create=True
_columns = {
'thread_id': fields.many2one('mailgate.thread', 'Thread', required=False),
+1
View File
@@ -29,6 +29,7 @@ class crm_helpdesk(osv.osv, crm.crm_case):
_description = "Helpdesk Cases"
_order = "id desc"
_inherits = {'mailgate.thread': 'thread_id'}
_log_create=True
_columns = {
'thread_id': fields.many2one('mailgate.thread', 'Thread', required=False),
+1
View File
@@ -158,6 +158,7 @@ class questionnaire(osv.osv):
_name="crm_profiling.questionnaire"
_description= "Questionnaire"
_log_create = True
def build_form(self, cr, uid, data, context):
"""
+1 -1
View File
@@ -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: crm_vertical
+2
View File
@@ -47,6 +47,8 @@ class document_directory_content(osv.osv):
_name = 'document.directory.content'
_description = 'Directory Content'
_order = "sequence"
_log_create = True
def _extension_get(self, cr, uid, context={}):
cr.execute('select code,name from document_directory_content_type where active')
res = cr.fetchall()
+2
View File
@@ -41,6 +41,8 @@ DMS_ROOT_PATH = tools.config.get('document_path', os.path.join(tools.config['roo
class document_file(osv.osv):
_inherit = 'ir.attachment'
_rec_name = 'datas_fname'
_log_create=True
def _get_filestore(self, cr):
return os.path.join(DMS_ROOT_PATH, cr.dbname)
+3 -1
View File
@@ -33,6 +33,8 @@ class document_directory(osv.osv):
_name = 'document.directory'
_description = 'Directory'
_order = 'name desc'
_log_create=True
_columns = {
'name': fields.char('Name', size=64, required=True, select=1),
'write_date': fields.datetime('Date Modified', readonly=True),
@@ -112,7 +114,7 @@ class document_directory(osv.osv):
while d2 and d2.parent_id:
s = d2.name + (s and ('/' + s) or '')
d2 = d2.parent_id
res.append((d.id, s))
res.append((d.id, s or d.name))
return res
def get_full_path(self, cr, uid, dir_id, context=None):
+2
View File
@@ -96,6 +96,8 @@ class document_storage(osv.osv):
"""
_name = 'document.storage'
_description = 'Storage Media'
_log_create=True
_columns = {
'name': fields.char('Name', size=64, required=True, select=1),
'write_date': fields.datetime('Date Modified', readonly=True),
+1 -1
View File
@@ -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: document_ics
+10 -22
View File
@@ -102,9 +102,15 @@ class email_template(osv.osv):
}
_columns = {
'name' : fields.char('Name of Template', size=100, required=True),
'name' : fields.char('Name', size=100, required=True),
'object_name':fields.many2one('ir.model', 'Model'),
'model_int_name':fields.char('Model Internal Name', size=200,),
'enforce_from_account':fields.many2one(
'email_template.account',
string="Enforce From Account",
help="Emails will be sent only from this account."),
'from_email' : fields.related('enforce_from_account', 'email_id',
type='char', string='From',),
'def_to':fields.char(
'Recepient (To)',
size=250,
@@ -141,7 +147,7 @@ class email_template(osv.osv):
help="The text version of the mail",
translate=True),
'use_sign':fields.boolean(
'Use Signature',
'Signature',
help="the signature from the User details"
"will be appened to the mail"),
'file_name':fields.char(
@@ -168,11 +174,6 @@ class email_template(osv.osv):
string="Allowed User Groups",
help="Only users from these groups will be"
" allowed to send mails from this Template"),
'enforce_from_account':fields.many2one(
'email_template.account',
string="Enforce From Account",
help="Emails will be sent only from this account.",
domain="[('company','=','yes')]"),
'model_object_field':fields.many2one(
'ir.model.fields',
string="Field",
@@ -218,6 +219,7 @@ class email_template(osv.osv):
}
_defaults = {
'template_language' : lambda *a:'mako',
}
_sql_constraints = [
@@ -623,19 +625,6 @@ class email_template_preview(osv.osv_memory):
_name = "email_template.preview"
_description = "Email Template Preview"
def _get_model_recs(self, cr, uid, context=None):
if context is None:
context = {}
#Fills up the selection box which allows records from the selected object to be displayed
self.context = context
if 'active_id' in context.keys():
# context['active_id'] = 5
ref_obj_id = self.pool.get('email.template').read(cr, uid, context['active_id'], ['object_name'], context)
ref_obj_name = self.pool.get('ir.model').read(cr, uid, ref_obj_id[0], ['model'], context)['model']
ref_obj_ids = self.pool.get(ref_obj_name).search(cr, uid, [], context=context)
ref_obj_recs = self.pool.get(ref_obj_name).name_get(cr, uid, ref_obj_ids, context)
return ref_obj_recs
def _default_model(self, cursor, user, context=None):
"""
Returns the default value for model field
@@ -655,7 +644,6 @@ class email_template_preview(osv.osv_memory):
'email.template',
'Template', readonly=True),
'rel_model':fields.many2one('ir.model', 'Model', readonly=True),
'rel_model_ref':fields.selection(_get_model_recs, 'Referred Document'),
'to':fields.char('To', size=250, readonly=True),
'cc':fields.char('CC', size=250, readonly=True),
'bcc':fields.char('BCC', size=250, readonly=True),
@@ -668,7 +656,7 @@ class email_template_preview(osv.osv_memory):
'ref_template': lambda self, cr, uid, ctx:ctx['active_id'],
'rel_model': _default_model
}
# Need to check
def on_change_ref(self, cr, uid, ids, rel_model_ref, context=None):
if context is None:
context = {}
@@ -30,7 +30,7 @@ class email_template_account(osv.osv):
'text/html'
]
_columns = {
'name': fields.char('Email Account Desc',
'name': fields.char('Description',
size=64, required=True,
readonly=True, select=True,
states={'draft':[('readonly', False)]}),
@@ -56,22 +56,16 @@ class email_template_account(osv.osv):
size=120, invisible=True,
required=False, readonly=True,
states={'draft':[('readonly', False)]}),
'smtptls':fields.boolean('Use TLS',
'smtptls':fields.boolean('TLS',
states={'draft':[('readonly', False)]}, readonly=True),
'smtpssl':fields.boolean('Use SSL/TLS (only in python 2.6)',
'smtpssl':fields.boolean('SSL/TLS (only in python 2.6)',
states={'draft':[('readonly', False)]}, readonly=True),
'send_pref':fields.selection([
('html', 'HTML otherwise Text'),
('text', 'Text otherwise HTML'),
('both', 'Both HTML & Text')
], 'Mail Format', required=True),
'allowed_groups':fields.many2many(
'res.groups',
'account_group_rel', 'templ_id', 'group_id',
string="Allowed User Groups",
help="Only users from these groups will be" \
"allowed to send mails from this ID"),
'company':fields.selection([
('yes', 'Yes'),
('no', 'No')
@@ -89,7 +83,7 @@ class email_template_account(osv.osv):
('suspended', 'Suspended'),
('approved', 'Approved')
],
'Account Status', required=True, readonly=True),
'Status', required=True, readonly=True),
}
_defaults = {
@@ -102,7 +96,6 @@ class email_template_account(osv.osv):
['name'],
context
)['name'],
'smtpssl':lambda * a:True,
'state':lambda * a:'draft',
'user':lambda self, cursor, user, context:user,
'send_pref':lambda * a: 'html',
@@ -36,9 +36,6 @@
<field name="send_pref" colspan="2" />
</group>
</page>
<page string="security" attrs="{'invisible':[('company','!=','yes')]}">
<field name="allowed_groups" attrs="{'required':[('company','=','yes')]}" nolabel="1"/>
</page>
</notebook>
<group colspan="4" col="10">
<field name="state" select="1"/>
@@ -52,7 +52,6 @@ class email_template_mailbox(osv.osv):
for attid in values['attachments_ids']:
attachment = self.pool.get('ir.attachment').browse(cr, uid, attid, context)#,['datas_fname','datas'])
payload[attachment.datas_fname] = attachment.datas
print "233333333333333"
result = account_obj.send_mail(cr, uid,
[values['account_id'][0]],
{'To':values.get('email_to', u'') or u'', 'CC':values.get('email_cc', u'') or u'', 'BCC':values.get('email_bcc', u'') or u''},
@@ -153,30 +152,6 @@ class email_template_mailbox(osv.osv):
'folder': lambda * a: 'outbox',
}
def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False):
if context is None:
context = {}
if context.get('company', False):
users_groups = self.pool.get('res.users').browse(cr, uid, uid, context).groups_id
group_acc_rel = {}
#get all accounts and get a table of {group1:[account1,account2],group2:[account1]}
for each_account_id in self.pool.get('email_template.account').search(cr, uid, [('state', '=', 'approved'), ('company', '=', 'yes')], context=context):
account = self.pool.get('email_template.account').browse(cr, uid, each_account_id, context)
for each_group in account.allowed_groups:
if not account.id in group_acc_rel.get(each_group, []):
groups = group_acc_rel.get(each_group, [])
groups.append(account.id)
group_acc_rel[each_group] = groups
users_company_accounts = []
for each_group in group_acc_rel.keys():
if each_group in users_groups:
for each_account in group_acc_rel[each_group]:
if not each_account in users_company_accounts:
users_company_accounts.append(each_account)
args.append(('account_id', 'in', users_company_accounts))
return super(osv.osv, self).search(cr, uid, args, offset, limit,
order, context=context, count=count)
email_template_mailbox()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -53,8 +53,8 @@
</notebook>
<separator colspan="4" string="" />
<group col="4" colspan="4">
<field name="state" colspan="2" readonly="1" />
<button name="complete_mail" type="object" string="Download Full Mail" colspan="2" states="read,unread" />
<field name="state" readonly="1" />
<button name="complete_mail" type="object" string="Download Full Mail" states="read,unread" />
<button name="send_this_mail" type="object" string="Send Mail" />
</group>
</form>
@@ -62,9 +62,8 @@
</record>
<!--============================================= TREE VIEWS =============================================-->
<!--DRAFTS-->
<record model="ir.ui.view" id="email_template_drafts_tree">
<field name="name">email_template.mailbox.draftstree</field>
<record id="view_email_template_mailbox_tree" model="ir.ui.view">
<field name="name">email_template.mailbox.tree</field>
<field name="model">email_template.mailbox</field>
<field name="type">tree</field>
<field name="arch" type="xml">
@@ -77,51 +76,6 @@
</tree>
</field>
</record>
<!--OUTBOX-->
<record model="ir.ui.view" id="email_template_outbox_tree">
<field name="name">email_template.mailbox.outboxtree</field>
<field name="model">email_template.mailbox</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Outbox">
<field name="user" />
<field name="email_from" select="1" />
<field name="subject" select="1" />
<field name="attachments_ids" select="2" />
<field name="date_mail" select="2" />
</tree>
</field>
</record>
<!--SENT-->
<record model="ir.ui.view" id="email_template_sentbox_tree">
<field name="name">email_template.mailbox.sentboxtree</field>
<field name="model">email_template.mailbox</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Sent">
<field name="user" />
<field name="email_from" select="1" />
<field name="subject" select="1" />
<field name="attachments_ids" select="2" />
<field name="date_mail" select="2" />
</tree>
</field>
</record>
<!--TRASH-->
<record model="ir.ui.view" id="email_template_trashbox_tree">
<field name="name">email_template.mailbox.trashboxtree</field>
<field name="model">email_template.mailbox</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Trash">
<field name="user" />
<field name="email_from" select="1" />
<field name="subject" select="1" />
<field name="attachments_ids" select="2" />
<field name="date_mail" select="2" />
</tree>
</field>
</record>
<record id="view_email_template_mailbox_search" model="ir.ui.view">
<field name="name">email_template.mailbox.search</field>
@@ -150,7 +104,7 @@
<field name="res_model">email_template.mailbox</field>
<field name="view_type">form</field>
<field name="view_mode">form,tree</field>
<field name="view_id" ref="email_template_outbox_tree" />
<field name="view_id" ref="view_email_template_mailbox_tree" />
<field name="context">{'group_by': [], 'search_default_draft': 1, 'search_default_outbox': 1}</field>
<field name="search_view_id" ref="view_email_template_mailbox_search"/>
</record>
@@ -62,7 +62,9 @@
<field name="model_int_name" invisible="1" />
<notebook colspan="4">
<page string="Mail Details">
<field name="enforce_from_account" required= "1"/>
<group col="4" colspan="2">
<field name="from_email"/>
<field name="def_to" colspan="4" required="1" />
<field name="def_cc" colspan="4" />
<field name="def_bcc" colspan="4" />
@@ -109,15 +111,7 @@
type="action" colspan="4" target="new" />
</group>
</page>
<page string="Security">
<separator colspan="4" string="Allowed User Groups" />
<field name="allowed_groups" string="Allowed User Groups"
nolabel="1" />
</page>
<page string="Advanced">
<separator string="Automatic Email" colspan="4" />
<field name="enforce_from_account" attrs="{'required':[('auto_email','=',True)]}" />
<newline/>
<field name="ref_ir_act_window" />
<field name="ref_ir_value" />
<separator string="Attachments (Report to attach)" colspan="4"/>
+1 -1
View File
@@ -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: event
+1 -1
View File
@@ -24,7 +24,7 @@
{
"name" : "Fetchmail Server",
"version" : "1.0",
"depends" : ["base"],
"depends" : ["base", 'mail_gateway'],
"author" : "Tiny",
"description": """Fetchmail:
* Fetch email from Pop / IMAP server
+25 -18
View File
@@ -181,7 +181,7 @@ class email_server(osv.osv):
context.update({
'server_id':server.id
})
history_pool = self.pool.get('mail.server.history')
history_pool = self.pool.get('mailgate.message')
msg_txt = email.message_from_string(message)
message_id = msg_txt.get('Message-ID', False)
@@ -282,7 +282,6 @@ class email_server(osv.osv):
ref = msg.get('references').split('\r\n')
else:
ref = msg.get('references').split(' ')
if ref:
hids = history_pool.search(cr, uid, [('name','=',ref[0].strip())])
if hids:
@@ -306,9 +305,18 @@ class email_server(osv.osv):
if hasattr(model_pool, 'message_new'):
res_id = model_pool.message_new(cr, uid, msg, context)
else:
logger.notifyChannel('imap', netsvc.LOG_WARNING, 'method def message_new is not define in model %s' % (model_pool._name))
return False
data = {
'name': msg.get('subject'),
'email_from': msg.get('from'),
'email_cc': msg.get('cc'),
'user_id': False,
'description': msg.get('body'),
'state' : 'draft',
}
res_id = model_pool.create(cr, uid, data, context=context)
logger.notifyChannel('imap', netsvc.LOG_WARNING, 'method def message_new is not define in model %s. Using default method' % (model_pool._name))
att_ids = []
if server.attach:
for attactment in attachents or []:
data_attach = {
@@ -319,19 +327,25 @@ class email_server(osv.osv):
'res_model': server.object_id.model,
'res_id': res_id,
}
self.pool.get('ir.attachment').create(cr, uid, data_attach)
att_ids.append(self.pool.get('ir.attachment').create(cr, uid, data_attach))
if server.action_id:
action_pool = self.pool.get('ir.actions.server')
action_pool.run(cr, uid, [server.action_id.id], {'active_id':res_id, 'active_ids':[res_id]})
res = {
'name': message_id,
'name': msg.get('subject', 'No subject'),
'message_id': message_id,
'date': msg.get('date'),
'res_id': res_id,
'email_from': msg.get('from'),
'email_to': msg.get('to'),
'email_cc': msg.get('cc'),
'model': server.object_id.model,
'server_id': server.id,
'note': msg.get('body', msg.get('from')),
'description': msg.get('body', msg.get('from')),
'ref_id':msg.get('references', msg.get('id')),
'type':server.type
'type':server.type,
'attachment_ids': [(6, 0, att_ids)]
}
his_id = history_pool.create(cr, uid, res)
@@ -412,17 +426,10 @@ email_server()
class mail_server_history(osv.osv):
_name = "mail.server.history"
_description = "Mail Server History"
_inherit = "mailgate.message"
_columns = {
'name': fields.char('Message Id', size=256, readonly=True, help="Message Id in Email Server.", select=True),
'ref_id': fields.char('Referance Id', size=256, readonly=True, help="Message Id in Email Server.", select=True),
'res_id': fields.integer("Resource ID", readonly=True, select=True),
'server_id': fields.many2one('email.server',"Mail Server", readonly=True, select=True),
'model_id':fields.related('server_id', 'object_id', type='many2one', relation='ir.model', string='Model', readonly=True, select=True),
'note': fields.text('Notes', readonly=True),
'create_date': fields.datetime('Created Date', readonly=True),
'type':fields.selection([
('pop','POP Server'),
('imap','IMAP Server'),
+22 -50
View File
@@ -103,82 +103,54 @@
action="action_email_server_tree_imap"
/>
<record model="ir.ui.view" id="view_mail_server_history_tree">
<field name="name">mail.server.history.tree</field>
<field name="model">mail.server.history</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Received Mail History">
<field name="server_id" select="1"/>
<field name="create_date" select="1"/>
<field name="model_id"/>
<field name="name" select="1"/>
<field name="ref_id"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="view_email_server_history_form">
<field name="name">mail.server.history.form</field>
<field name="model">mail.server.history</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Email History">
<group col="6" colspan="4">
<record model="ir.ui.view" id="mailgate_message_tree_view">
<field name="name">mailgate.message.tree</field>
<field name="model">mailgate.message</field>
<field name="type">tree</field>
<field name="inherit_id" ref="mail_gateway.view_mailgate_message_tree"/>
<field name="arch" type="xml">
<field name="user_id" position="after">
<field name="server_id" select="1"/>
<field name="create_date" select="1"/>
</group>
<group col="2" colspan="2">
<separator string="Resource Information" colspan="2"/>
<field name="model_id" select="1"/>
<field name="res_id"/>
</group>
<group col="2" colspan="2">
<separator string="Meta Information" colspan="2"/>
<field name="name" select="1"/>
<field name="ref_id"/>
</group>
<newline/>
<separator string="Description" colspan="4"/>
<field name="note" colspan="4" nolabel="1"/>
</form>
</field>
</record>
</field>
</field>
</record>
<act_window
context="{'server_id': active_id}"
domain="[('server_id', '=', active_id)]"
id="act_server_history" name="Email History"
res_model="mail.server.history" src_model="email.server"/>
res_model="mailgate.message" src_model="email.server"/>
<record model="ir.actions.act_window" id="action_email_server_history_tree">
<record model="ir.actions.act_window" id="action_mailgate_message_tree">
<field name="name">Received Email History</field>
<field name="res_model">mail.server.history</field>
<field name="res_model">mailgate.message</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_mail_server_history_tree"/>
<field name="view_id" ref="mailgate_message_tree_view"/>
<field name="context">{'type':'imap'}</field>
<field name="domain">[('type','=','imap')]</field>
</record>
<menuitem
parent="menu_action_email_server_tree_imap"
id="menu_action_email_server_history_tree"
action="action_email_server_history_tree"/>
id="menu_action_mailgate_message_tree"
action="action_mailgate_message_tree"/>
<record model="ir.actions.act_window" id="action_email_server_history_tree_pop">
<record model="ir.actions.act_window" id="action_mailgate_message_tree_pop">
<field name="name">Received Email History</field>
<field name="res_model">mail.server.history</field>
<field name="res_model">mailgate.message</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_mail_server_history_tree"/>
<field name="view_id" ref="mailgate_message_tree_view"/>
<field name="context">{'type':'pop'}</field>
<field name="domain">[('type','=','pop')]</field>
</record>
<menuitem
parent="menu_action_email_server_tree"
id="menu_action_email_server_history_tree_pop"
action="action_email_server_history_tree_pop"/>
id="menu_action_mailgate_message_tree_pop"
action="action_mailgate_message_tree_pop"/>
</data>
</openerp>
@@ -1,4 +1,3 @@
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
"access_email_server","email.server","model_email_server",,1,1,1,1
"access_mail_server_history","mail.server.history","model_mail_server_history",,1,1,1,1
"access_email_server_tools","email.server.tools","model_email_server_tools",,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_email_server email.server model_email_server 1 1 1 1
access_mail_server_history mail.server.history model_mail_server_history 1 1 1 1
3 access_email_server_tools email.server.tools model_email_server_tools 1 1 1 1
+1 -1
View File
@@ -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"
"Language: hr\n"
+1 -1
View File
@@ -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: hr_evaluation
+4
View File
@@ -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-07 03:46+0000\n"
=======
"X-Launchpad-Export-Date: 2010-04-17 04:11+0000\n"
>>>>>>> MERGE-SOURCE
"X-Generator: Launchpad (build Unknown)\n"
#. module: hr_timesheet
+1 -1
View File
@@ -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"
+1 -1
View File
@@ -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: hr_timesheet_invoice
+1 -1
View File
@@ -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"
+3
View File
@@ -33,6 +33,7 @@ class idea_category(osv.osv):
_name = "idea.category"
_description = "Idea Category"
_log_create=True
_columns = {
'name': fields.char('Category', size=64, required=True),
@@ -52,6 +53,7 @@ class idea_idea(osv.osv):
""" Idea """
_name = 'idea.idea'
_rec_name = 'title'
_log_create=True
def _vote_avg_compute(self, cr, uid, ids, name, arg, context = None):
@@ -302,6 +304,7 @@ class idea_vote(osv.osv):
_name = 'idea.vote'
_description = 'Idea Vote'
_rec_name = 'score'
_log_create = True
_columns = {
'user_id': fields.many2one('res.users', 'By user', readonly="True"),
+1 -1
View File
@@ -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: l10n_fr
+1
View File
@@ -115,6 +115,7 @@ class lunch_order(osv.osv):
_name = 'lunch.order'
_description = "Lunch Order"
_rec_name = "user_id"
_log_create=True
def _price_get(self, cr, uid, ids, name, args, context=None):
+3 -1
View File
@@ -75,7 +75,6 @@ class mailgate_thread(osv.osv):
if all(isinstance(case_id, (int, long)) for case_id in cases) and context.get('model'):
cases = self.pool.get(context['model']).browse(cr, uid, cases, context=context)
model_obj = self.pool.get('ir.model')
att_obj = self.pool.get('ir.attachment')
obj = self.pool.get('mailgate.message')
@@ -114,6 +113,7 @@ class mailgate_thread(osv.osv):
'attachment_ids': [(6, 0, attachments)]
}
res = obj.create(cr, uid, data, context)
case._table.log(cr, uid, case.id, case._description + " '" + case.name + "': " + keyword, context=context)
return True
_history = __history
@@ -129,10 +129,12 @@ class mailgate_message(osv.osv):
_name = 'mailgate.message'
_description = 'Mailgateway Message'
_order = 'date desc'
_log_create=True
_columns = {
'name':fields.char('Message', size=64),
'thread_id':fields.many2one('mailgate.thread', 'Thread'),
'ref_id': fields.char('Reference Id', size=256, readonly=True, help="Message Id in Email Server.", select=True),
'date': fields.datetime('Date'),
'history': fields.boolean('Is History?', required=False),
'user_id': fields.many2one('res.users', 'User Responsible', readonly=True),
+2 -1
View File
@@ -26,7 +26,8 @@
<separator string="Message Details" colspan="4"/>
<field name="model" readonly="1"/>
<field name="res_id" readonly="1"/>
<field name="message_id" />
<field name="message_id" />
<field name="ref_id" />
</group>
<separator string="Description" colspan="4"/>
<field name="description" nolabel="1" colspan="4" />
@@ -177,13 +177,19 @@ class email_parser(object):
s = decode_header(s.replace('\r', ''))
return ''.join(map(lambda x:self._to_decode(x[0], [x[1]]), s or []))
def history(self, model, new_id, msg_id, subject, msg_to, msg_from, body, attach):
def history(self, model, new_id, msg_id, ref_id, subject, msg_to, msg_from, body, attach):
try:
thread_id = self.rpc(model, 'read', new_id, ['thread_id'])['thread_id'][0]
except Exception, e:
thread_id = None
msg_data = {
'name': subject,
'history': True,
'model': model,
'res_id': new_id,
'thread_id': thread_id,
'message_id': msg_id,
'ref_id': ref_id or '',
'user_id': self.rpc.user_id,
'date': time.strftime('%Y-%m-%d %H:%M:%S'),
'email_from': msg_from,
@@ -228,7 +234,7 @@ class email_parser(object):
try:
self.rpc(self.model, 'history', [new_id], 'Receive', True, msg_to, message['body'], msg_from, False, {'model' : self.model})
except Exception, e:
self.history(self.model, new_id, msg['Message-Id'], msg_subject, msg_to, msg_from, message['body'], att_ids)
self.history(self.model, new_id, msg['Message-Id'], msg['References'], msg_subject, msg_to, msg_from, message['body'], att_ids)
except Exception, e:
if getattr(e, 'faultCode', '') and 'AccessError' in e.faultCode:
e = '\n\nThe Specified user does not have an access to the Model.'
@@ -294,22 +300,23 @@ class email_parser(object):
return False
del msg['To']
msg['To'] = emails[0]
msg['Subject'] = 'OpenERP Record-id:' + msg['Subject']
if len(emails)>1:
if 'Cc' in msg:
del msg['Cc']
msg['Cc'] = ','.join(emails[1:])
del msg['Reply-To']
msg['Reply-To'] = self.email
s = smtplib.SMTP(self.smtp_server, self.smtp_port)
s.ehlo()
s.starttls()
s.ehlo()
if self.smtp_user and self.smtp_password:
s = smtplib.SMTP(self.smtp_server, self.smtp_port)
s.ehlo()
s.starttls()
s.ehlo()
s.login(self.smtp_user, self.smtp_password)
s.sendmail(self.email, emails, msg.as_string())
s.close()
return True
s.close()
return True
return False
def parse(self, msg):
@@ -319,7 +326,7 @@ class email_parser(object):
if msg.get('Subject', ''):
del msg['Subject']
msg['Subject'] = '['+str(res_id)+'] '+subject
msg['Message-Id'] = '<'+str(time.time())+'-openerpcrm-'+str(res_id)+'@'+socket.gethostname()+'>'
# msg['Message-Id'] = '<'+str(time.time())+'-openerpcrm-'+str(res_id)+'@'+socket.gethostname()+'>'
mm = [self._decode_header(msg['From']), self._decode_header(msg['To'])]+self._decode_header(msg.get('Cc', '')).split(',')
msg_mails = map(self.email_get, filter(None, mm))
+1
View File
@@ -31,6 +31,7 @@
<group colspan="8">
<field name="marketing_campaign" />
<field name="crm_profiling" />
<field name="marketing_campaign_mailchimp" />
</group>
</data>
</field>
+2
View File
@@ -28,6 +28,8 @@ class marketing_installer(osv.osv_memory):
# Generic modules
'marketing_campaign':fields.boolean('Marketing Campaigns',
help="Helps you to manage marketing campaigns and automate actions and communication steps."),
'marketing_campaign_mailchimp':fields.boolean('Mailchimp Integration',
help="This modules integrate mailchimp.com's service with OpenERP to automate mass mailings."),
'crm_profiling':fields.boolean('Profiling Tools',
help="Helps you to perform segmentation within partners and design questionaires.")
}
+235 -197
View File
@@ -2,7 +2,7 @@
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
# Copyright (C) 2004-2010 OpenERP SA (<http://openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
@@ -18,6 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import time
import base64
from datetime import datetime
@@ -25,7 +26,7 @@ from dateutil.relativedelta import relativedelta
from osv import fields, osv
import netsvc
import tools
import tools
_intervalTypes = {
'hours': lambda interval: relativedelta(hours=interval),
@@ -34,184 +35,186 @@ _intervalTypes = {
'years': lambda interval: relativedelta(years=interval),
}
class marketing_campaign(osv.osv): #{{{
class marketing_campaign(osv.osv):
_name = "marketing.campaign"
_description = "Marketing Campaign"
_columns = {
'name': fields.char('Name', size=64, required=True),
'object_id': fields.many2one('ir.model', 'Objects', required=True,
'object_id': fields.many2one('ir.model', 'Object', required=True,
help="Choose the Object on which you want \
this campaign to be run"),
'mode':fields.selection([('test', 'Test'),
('test_realtime', 'Realtime'),
('manual', 'Manual'),
('active', 'Active')],
'Mode', required=True),
this campaign to be run"),
'mode':fields.selection([('test', 'Test Directly'),
('test_realtime', 'Test in Realtime'),
('manual', 'With Manual Confirmation'),
('active', 'Normal')],
'Mode', required=True, help= \
"""Test - It creates and process all the workitems directly (without waiting for the delay on transitions) but do not send emails or produce reports.
Test in Realtime - It creates and process all the workitems directly but do not send emails or produce reports.
With Manual Confirmation - the campaigns runs normally, but the user has to validate all workitem manually.
Normal - the campaign runs normally and automatically sends all emails and reports"""),
'state': fields.selection([('draft', 'Draft'),
('running', 'Running'),
('done', 'Done'),
('cancelled', 'Cancelled'),],
'State',),
'activity_ids': fields.one2many('marketing.campaign.activity',
'State',),
'activity_ids': fields.one2many('marketing.campaign.activity',
'campaign_id', 'Activities'),
'fixed_cost': fields.float('Fixed Cost', help="The fixed cost is cost\
you required for the campaign"),
you required for the campaign"),
}
_defaults = {
'state': lambda *a: 'draft',
'mode': lambda *a: 'test',
'mode': lambda *a: 'test',
}
def state_running_set(self, cr, uid, ids, *args):
campaign = self.browse(cr, uid, ids[0])
if not campaign.activity_ids :
raise osv.except_osv("Error", "There is no associate activitity for the campaign")
raise osv.except_osv("Error", "There is no activitity in the campaign")
act_ids = [ act_id.id for act_id in campaign.activity_ids]
act_ids = self.pool.get('marketing.campaign.activity').search(cr, uid,
[('id', 'in', act_ids), ('start', '=', True)])
if not act_ids :
raise osv.except_osv("Error", "There is no associate activitity for the campaign")
segment_ids = self.pool.get('marketing.campaign.segment').search(cr, uid,
[('campaign_id', '=', campaign.id),
('state', '=', 'draft')])
raise osv.except_osv("Error", "There is no starting activitity in the campaign")
self.write(cr, uid, ids, {'state': 'running'})
return True
def state_done_set(self, cr, uid, ids, *args):
segment_ids = self.pool.get('marketing.campaign.segment').search(cr, uid,
[('campaign_id', 'in', ids),
('state', '=', 'running')])
if segment_ids :
raise osv.except_osv("Error", "Camapign cannot be done before all segments are done")
raise osv.except_osv("Error", "Campaign cannot be marked as done before all segments are done")
self.write(cr, uid, ids, {'state': 'done'})
return True
def state_cancel_set(self, cr, uid, ids, *args):
self.write(cr, uid, ids, {'state': 'cancelled'})
return True
marketing_campaign()#}}}
marketing_campaign()
class marketing_campaign_segment(osv.osv): #{{{
class marketing_campaign_segment(osv.osv):
_name = "marketing.campaign.segment"
_description = "Campaign Segment"
_columns = {
'name': fields.char('Name', size=64,required=True),
'campaign_id': fields.many2one('marketing.campaign', 'Campaign',
'campaign_id': fields.many2one('marketing.campaign', 'Campaign',
required=True),
'object_id': fields.related('campaign_id','object_id',
type='many2one', relation='ir.model',
string='Object'),
'ir_filter_id': fields.many2one('ir.filters', 'Filter', help=""),
'sync_last_date': fields.datetime('Date'),
'sync_mode': fields.selection([('create_date', 'Create'),
('write_date', 'Write')],
'Mode'),
'sync_last_date': fields.datetime('Latest Synchronization'),
'sync_mode': fields.selection([('create_date', 'Sync only on creation'),
('write_date', 'Sync at each modification')],
'Synchronization Mode'),
'state': fields.selection([('draft', 'Draft'),
('running', 'Running'),
('done', 'Done'),
('cancelled', 'Cancelled')],
'State',),
'date_run': fields.datetime('Running'),
'date_done': fields.datetime('Done'),
'State',),
'date_run': fields.datetime('Launching Date'),
'date_done': fields.datetime('End Date'),
}
_defaults = {
'state': lambda *a: 'draft',
'sync_mode': lambda *a: 'create_date',
}
def state_running_set(self, cr, uid, ids, *args):
segment = self.browse(cr, uid, ids[0])
curr_date = time.strftime('%Y-%m-%d %H:%M:%S')
vals = {'state': 'running'}
if not segment.date_run:
vals['date_run'] = time.strftime('%Y-%m-%d %H:%M:%S')
if not segment.sync_last_date:
vals['sync_last_date']=curr_date
if not segment.date_done:
vals['date_done']= (datetime.now() + _intervalTypes['years'](1) \
).strftime('%Y-%m-%d %H:%M:%S')
vals['date_run'] = time.strftime('%Y-%m-%d %H:%M:%S')
self.write(cr, uid, ids, vals)
return True
def state_done_set(self, cr, uid, ids, *args):
date_done = self.browse(cr, uid, ids[0]).date_done
if (date_done > time.strftime('%Y-%m-%d %H:%M:%S')):
raise osv.except_osv("Error", "Segment cannot be closed before end date")
wi_ids = self.pool.get("marketing.campaign.workitem").search(cr, uid,
[('state', 'in', ['inprogress', 'todo']),
('segment_id', '=', ids[0])])
if wi_ids :
raise osv.except_osv("Error", "Segment cannot be done before all workitems are processed")
self.write(cr, uid, ids, {'state': 'done'})
[('state', '=', 'todo'), ('segment_id', 'in', ids)])
self.pool.get("marketing.campaign.workitem").write(cr, uid, wi_ids, {'state':'cancelled'})
self.write(cr, uid, ids, {'state': 'done','date_done': time.strftime('%Y-%m-%d %H:%M:%S')})
return True
def state_cancel_set(self, cr, uid, ids, *args):
self.write(cr, uid, ids, {'state': 'cancelled'})
wi_ids = self.pool.get("marketing.campaign.workitem").search(cr, uid,
[('state', '=', 'todo'), ('segment_id', 'in', ids)])
self.pool.get("marketing.campaign.workitem").write(cr, uid, wi_ids, {'state':'cancelled'})
self.write(cr, uid, ids, {'state': 'cancelled','date_done': time.strftime('%Y-%m-%d %H:%M:%S')})
return True
def process_segment(self, cr, uid, context={}):
segment_ids = self.search(cr, uid, [('state', '=', 'running')])
def synchroniz(self, cr, uid, ids, *args):
self.process_segment(cr, uid, ids)
return True
def process_segment(self, cr, uid, segment_ids=None, context={}):
if not segment_ids:
segment_ids = self.search(cr, uid, [('state', '=', 'running')], context=context)
action_date = time.strftime('%Y-%m-%d %H:%M:%S')
last_action_date = (datetime.now() + _intervalTypes['days'](-1) \
).strftime('%Y-%m-%d %H:%M:%S')
for segment in self.browse(cr, uid, segment_ids):
act_ids = self.pool.get('marketing.campaign.activity').search(cr,
uid, [('start', '=', True),
('campaign_id', '=', segment.campaign_id.id)])
if (segment.sync_last_date and \
segment.sync_last_date <= action_date )\
or not segment.sync_last_date :
model_obj = self.pool.get(segment.object_id.model)
object_ids = model_obj.search(cr, uid, [
(segment.sync_mode, '<=', action_date),
(segment.sync_mode, '>=', last_action_date)])
for o_ids in model_obj.read(cr, uid, object_ids) :
partner_id = 'partner_id' in o_ids and o_ids['partner_id'] \
or False
if partner_id:
for act_id in act_ids:
wi_vals = {'segment_id': segment.id,
'activity_id': act_id,
'date': action_date,
'partner_id': partner_id[0],
'state': 'todo',
}
self.pool.get('marketing.campaign.workitem').create(
cr, uid, wi_vals)
self.write(cr, uid, segment.id, {'sync_last_date':action_date})
campaigns = {}
for segment in self.browse(cr, uid, segment_ids, context=context):
campaigns[segment.campaign_id.id] = True
act_ids = self.pool.get('marketing.campaign.activity').search(cr,
uid, [('start', '=', True), ('campaign_id', '=', segment.campaign_id.id)])
model_obj = self.pool.get(segment.object_id.model)
criteria = []
if segment.sync_last_date:
criteria += [(segment.sync_mode, '>', segment.sync_last_date)]
if segment.ir_filter_id:
criteria += eval(segment.ir_filter_id.domain)
object_ids = model_obj.search(cr, uid, criteria, context=context)
for o_ids in model_obj.browse(cr, uid, object_ids, context=context) :
# avoid duplicated workitem for the same resource
if segment.sync_mode == 'write_date':
segids = self.pool.get('marketing.campaign.workitem').search(cr, uid, [('res_id','=',o_ids.id),('segment_id','=',segment.id)])
if segids:
continue
for act_id in act_ids:
wi_vals = {
'segment_id': segment.id,
'activity_id': act_id,
'date': action_date,
'partner_id': o_ids.partner_id and o_ids.partner_id.id or False,
'state': 'todo',
'res_id': o_ids.id
}
self.pool.get('marketing.campaign.workitem').create(cr, uid, wi_vals)
self.write(cr, uid, segment.id, {'sync_last_date':action_date})
self.pool.get('marketing.campaign.workitem').process_all(cr, uid, campaigns.keys(), context=context)
return True
marketing_campaign_segment()#}}}
marketing_campaign_segment()
class marketing_campaign_activity(osv.osv): #{{{
class marketing_campaign_activity(osv.osv):
_name = "marketing.campaign.activity"
_description = "Campaign Activity"
_actions_type = [('email', 'E-mail'), ('paper', 'Paper'), ('action', 'Action'),
('subcampaign', 'Sub-Campaign')]
_columns = {
'name': fields.char('Name', size=128, required=True),
'campaign_id': fields.many2one('marketing.campaign', 'Campaign',
'campaign_id': fields.many2one('marketing.campaign', 'Campaign',
required = True, ondelete='cascade'),
'object_id': fields.related('campaign_id','object_id',
type='many2one', relation='ir.model',
string='Object'),
'start': fields.boolean('Start',help= "Its necessary to start activity \
before running campaign"),
'condition': fields.char('Condition', size=256, required=True,
help="Condition that is to be tested before \
action is executed"),
'start': fields.boolean('Start',help= "This activity is launched when the campaign starts."),
'condition': fields.char('Condition', size=256, required=True,
help="Python condition to know if the activity can be launched"),
'type': fields.selection([('email', 'E-mail'),
('paper', 'Paper'),
('action', 'Action'),
('subcampaign', 'Sub-Campaign')],
'Type', required=True),
'Type', required=True,
help="Describe type of action to be performed on the Activity.Eg : Send email,Send paper.."),
'email_template_id': fields.many2one('email.template','Email Template'),
'report_id': fields.many2one('ir.actions.report.xml', 'Reports', ),
'report_id': fields.many2one('ir.actions.report.xml', 'Reports', ),
'report_directory_id': fields.many2one('document.directory','Directory',
help="Folder is used to store the generated reports"),
'server_action_id': fields.many2one('ir.actions.server', string='Action',
@@ -222,21 +225,27 @@ class marketing_campaign_activity(osv.osv): #{{{
'Next Activities'),
'from_ids': fields.one2many('marketing.campaign.transition',
'activity_to_id',
'Previous Activities'),
'Previous Activities'),
'subcampaign_id': fields.many2one('marketing.campaign', 'Sub-Campaign'),
'subcampaign_segment_id': fields.many2one('marketing.campaign.segment',
'Sub Campaign Segment'),
'variable_cost': fields.float('Variable Cost'),
'revenue': fields.float('Revenue')
}
}
_defaults = {
'type': lambda *a: 'email',
'condition': lambda *a: 'True',
'object_id' : lambda obj, cr, uid, context : context.get('object_id',False),
}
def __init__(self, *args):
self._actions = {'paper' : self.process_wi_report,
'email' : self.process_wi_email,
'server_action' : self.process_wi_action,
}
return super(marketing_campaign_activity, self).__init__(*args)
def search(self, cr, uid, args, offset=0, limit=None, order=None,
def search(self, cr, uid, args, offset=0, limit=None, order=None,
context=None, count=False):
if context == None:
context = {}
@@ -247,61 +256,68 @@ class marketing_campaign_activity(osv.osv): #{{{
for activity in segment_obj.campaign_id.activity_ids:
act_ids.append(activity.id)
return act_ids
return super(marketing_campaign_activity, self).search(cr, uid, args,
return super(marketing_campaign_activity, self).search(cr, uid, args,
offset, limit, order, context, count)
def process(self, cr, uid, act_id, wi_id, context={}):
activity = self.browse(cr, uid, act_id)
workitem_obj = self.pool.get('marketing.campaign.workitem')
workitem = workitem_obj.browse(cr, uid, wi_id)
if activity.type == 'paper' :
service = netsvc.LocalService('report.%s'%activity.report_id.report_name)
(report_data, format) = service.create(cr, uid, [], {}, {})
attach_vals = {
'name': '%s_%s_%s'%(activity.report_id.report_name,
activity.name,workitem.partner_id.name),
'datas_fname': '%s.%s'%(activity.report_id.report_name,
activity.report_id.report_type),
'parent_id': activity.report_directory_id.id,
'datas': base64.encodestring(report_data),
'file_type': format
}
self.pool.get('ir.attachment').create(cr, uid, attach_vals)
elif activity.type == 'email' :
context = {}
template = activity.email_template_id
accounts = template.enforce_from_account
if not template.enforce_from_account:
return {'error_msg' : "There is no account defined for the email"}
if not workitem.partner_id.email:
return {'error_msg' : "There is no email defined for the partner"}
vals = {
'email_from': tools.ustr(accounts.name) + "<" + tools.ustr(accounts.email_id) + ">",
'email_to': workitem.partner_id.email,
'subject': template.def_subject,
'body_text': template.def_body_text,
'body_html': template.def_body_html,
'account_id':accounts.id,
'state':'na',
'mail_type':'multipart/alternative' #Options:'multipart/mixed','multipart/alternative','text/plain','text/html'
}
def process_wi_report(self, cr, uid, activity, workitem):
service = netsvc.LocalService('report.%s'%activity.report_id.report_name)
(report_data, format) = service.create(cr, uid, [], {}, {})
attach_vals = {
'name': '%s_%s_%s'%(activity.report_id.report_name,
activity.name,workitem.partner_id.name),
'datas_fname': '%s.%s'%(activity.report_id.report_name,
activity.report_id.report_type),
'parent_id': activity.report_directory_id.id,
'datas': base64.encodestring(report_data),
'file_type': format
}
self.pool.get('ir.attachment').create(cr, uid, attach_vals)
return True
def process_wi_email(self, cr, uid, activity, workitem):
template = activity.email_template_id
accounts = template.enforce_from_account
if not template.enforce_from_account:
return {'error_msg' : "There is no account defined for the email"}
if not workitem.partner_id.email:
return {'error_msg' : "There is no email defined for the partner"}
vals = {
'email_from': tools.ustr(accounts.name) + "<" + tools.ustr(accounts.email_id) + ">",
'email_to': workitem.partner_id.email,
'subject': template.def_subject,
'body_text': template.def_body_text,
'body_html': template.def_body_html,
'account_id':accounts.id,
'state':'na',
'mail_type':'multipart/alternative' #Options:'multipart/mixed','multipart/alternative','text/plain','text/html'
}
# if accounts.use_sign:
# signature = self.pool.get('res.users').read(cr, uid, uid, ['signature'], context)['signature']
# if signature:
# vals['pem_body_text'] = tools.ustr(vals['pem_body_text'] or '') + signature
# vals['pem_body_html'] = tools.ustr(vals['pem_body_html'] or '') + signature
#Create partly the mail and later update attachments
mail_id = self.pool.get('email_template.mailbox').create(cr, uid, vals, context)
elif activity.type == 'action' :
server_obj = self.pool.get('ir.actions.server')
server_obj.run(cr, uid, [activity.server_action_id.id], context)
#???
return True
marketing_campaign_activity()#}}}
#Create partly the mail and later update attachments
mail_id = self.pool.get('email_template.mailbox').create(cr, uid, vals, context)
return True
def process_wi_action(self, cr, uid, activity, workitem):
context = {}
server_obj = self.pool.get('ir.actions.server')
server_obj.run(cr, uid, [activity.server_action_id.id], context)
return True
class marketing_campaign_transition(osv.osv): #{{{
def process(self, cr, uid, act_id, wi_id, context={}):
activity = self.browse(cr, uid, act_id)
workitem_obj = self.pool.get('marketing.campaign.workitem')
workitem = workitem_obj.browse(cr, uid, wi_id)
self._actions[activity.type](cr, uid, activity, workitem)
return True
marketing_campaign_activity()
class marketing_campaign_transition(osv.osv):
_name = "marketing.campaign.transition"
_description = "Campaign Transition"
_rec_name = "interval_type"
@@ -309,13 +325,13 @@ class marketing_campaign_transition(osv.osv): #{{{
_columns = {
'activity_from_id': fields.many2one('marketing.campaign.activity',
'Source Activity'),
'activity_to_id': fields.many2one('marketing.campaign.activity',
'activity_to_id': fields.many2one('marketing.campaign.activity',
'Destination Activity'),
'interval_nbr': fields.integer('Interval No.'),
'interval_type': fields.selection([('hours', 'Hours'), ('days', 'Days'),
'interval_type': fields.selection([('hours', 'Hours'), ('days', 'Days'),
('months', 'Months'),
('years','Years')],'Interval Type')
}
}
def default_get(self, cr, uid, fields, context={}):
value = super(marketing_campaign_transition, self).default_get(cr, uid,
@@ -323,57 +339,76 @@ class marketing_campaign_transition(osv.osv): #{{{
if context.has_key('type_id'):
value[context['type_id']] = context['activity_id']
return value
marketing_campaign_transition() #}}}
class marketing_campaign_workitem(osv.osv): #{{{
marketing_campaign_transition()
class marketing_campaign_workitem(osv.osv):
_name = "marketing.campaign.workitem"
_description = "Campaign Workitem"
def _res_name_get(self, cr, uid, ids, field_name, arg, context=None):
res = {}
for obj in self.browse(cr, uid, ids, context=context):
if obj.res_id:
try:
res[obj.id] = self.pool.get(obj.object_id.model).name_get(cr, uid, [obj.res_id], context=context)[0][1]
except:
res[obj.id] = '/'
else:
res[obj.id] = '/'
return res
_columns = {
'segment_id': fields.many2one('marketing.campaign.segment', 'Segment',
required=True),
required=True),
'activity_id': fields.many2one('marketing.campaign.activity','Activity',
required=True),
'object_id': fields.related('segment_id', 'campaign_id', 'object_id',
type='many2one', relation='ir.model',
string='Object'),
'res_id': fields.integer('Results'),
required=True),
'campaign_id': fields.related('segment_id', 'campaign_id',
type='many2one', relation='marketing.campaign', string='Campaign', readonly=True),
'object_id': fields.related('segment_id', 'campaign_id', 'object_id',
type='many2one', relation='ir.model', string='Object'),
'res_id': fields.integer('Resource ID'),
'res_name': fields.function(_res_name_get, method=True, string='Resource Name', type="char", size=64),
'date': fields.datetime('Execution Date'),
'partner_id': fields.many2one('res.partner', 'Partner',required=True),
'state': fields.selection([('todo', 'ToDo'), ('inprogress', 'In Progress'),
'partner_id': fields.many2one('res.partner', 'Partner'),
'state': fields.selection([('todo', 'ToDo'), ('inprogress', 'In Progress'),
('exception', 'Exception'), ('done', 'Done'),
('cancelled', 'Cancelled')], 'State'),
'error_msg' : fields.text('Error Message')
}
}
_defaults = {
'state': lambda *a: 'draft',
'state': lambda *a: 'todo',
}
def process_chain(self, cr, uid, workitem_id, context={}):
workitem = self.browse(cr, uid, workitem_id)
mct_obj = self.pool.get('marketing.campaign.transition')
process_to_id = mct_obj.search(cr,uid, [
('activity_from_id','=', workitem.activity_id.id)])
for mct_id in mct_obj.browse(cr, uid, process_to_id):
for mct_id in workitem.activity_id.to_ids:
launch_date = time.strftime('%Y-%m-%d %H:%M:%S')
if mct_id.interval_type and mct_id.interval_nbr :
launch_date = (datetime.now() + _intervalTypes[ \
mct_id.interval_type](mct_id.interval_nbr) \
).strftime('%Y-%m-%d %H:%M:%S')
launch_date = time.strftime('%Y-%m-%d %H:%M:%S')
workitem_vals = {'segment_id': workitem.segment_id.id,
'activity_id': mct_id.activity_to_id.id,
'date': launch_date,
'partner_id': workitem.partner_id.id,
'state': 'todo',
}
workitem_vals = {
'segment_id': workitem.segment_id.id,
'activity_id': mct_id.activity_to_id.id,
'date': launch_date,
'partner_id': workitem.partner_id.id,
'res_id': workitem.res_id,
'state': 'todo',
}
self.create(cr, uid, workitem_vals)
return True
def button_cancel(self, cr, uid, workitem_ids, context={}):
for wi in self.browse(cr, uid, workitem_ids):
if wi.state in ('todo','exception'):
self.write(cr, uid, [wi.id], {'state':'cancelled'}, context=context)
return True
def process(self, cr, uid, workitem_ids, context={}):
for wi in self.browse(cr, uid, workitem_ids):
if wi.state == 'todo':# we searched the wi which are in todo state
#then y v keep this filter again
if wi.state == 'todo':
eval_context = {
'pool': self.pool,
'cr': cr,
@@ -385,50 +420,53 @@ class marketing_campaign_workitem(osv.osv): #{{{
expr = eval(str(wi.activity_id.condition), eval_context)
if expr:
try :
res = self.pool.get('marketing.campaign.activity').process(
cr, uid, wi.activity_id.id, wi.id, context)
if res :
self.write(cr, uid, wi.id, {'state': 'done'})
self.process_chain(cr, uid, wi.id, context)
else :
self.write(cr, uid, wi.id, {'state': 'exception',
'error_msg': res['error_msg']})
if wi.campaign_id.mode in ('manual','active'):
self.pool.get('marketing.campaign.activity').process(
cr, uid, wi.activity_id.id, wi.id, context)
self.write(cr, uid, wi.id, {'state': 'done'})
self.process_chain(cr, uid, wi.id, context)
except Exception,e:
self.write(cr, uid, wi.id, {'state': 'exception'})
else :
self.write(cr, uid, wi.id, {'state': 'cancelled'})
return True
def process_all(self, cr, uid, context={}):
workitem_ids = self.search(cr, uid, [('state', '=', 'todo'),
def process_all(self, cr, uid, camp_ids=None, context={}):
camp_obj = self.pool.get('marketing.campaign')
if not camp_ids:
camp_ids = camp_obj.search(cr, uid, [('state','=','running')], context=context)
for camp in camp_obj.browse(cr, uid, camp_ids, context=context):
if camp.mode in ('test_realtime','active'):
workitem_ids = self.search(cr, uid, [('state', '=', 'todo'),
('date','<=', time.strftime('%Y-%m-%d %H:%M:%S'))])
elif camp.mode == 'test':
workitem_ids = self.search(cr, uid, [('state', '=', 'todo')])
else:
# manual states are not processed automatically
pass
if workitem_ids:
self.process(cr, uid, workitem_ids, context)
marketing_campaign_workitem() #}}}
marketing_campaign_workitem()
class email_template(osv.osv):
_inherit = "email.template"
_defaults = {
'object_name': lambda obj, cr, uid, context: context.get('object_id',False),
}
email_template()
email_template()
class report_xml(osv.osv):
_inherit = 'ir.actions.report.xml'
def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False):
if not context:
context = {}
if context and 'object_id' in context and context['object_id']:
model = self.pool.get('ir.model').browse(cr, uid,
model = self.pool.get('ir.model').browse(cr, uid,
context['object_id']).model
args.append(('model', '=', model))
return super(report_xml, self).search(cr, uid, args, offset, limit, order, context, count)
report_xml()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
report_xml()
@@ -1,7 +1,7 @@
<?xml version="1.0" ?>
<openerp>
<data>
<data>
<!-- Document directory -->
<record id="document_directory_marketingcampaign" model="document.directory">
<field eval="0" name="ressource_tree"/>
@@ -20,33 +20,27 @@
<field name="parent_id" ref="document_directory_marketingcampaign"/>
<field eval="&quot;&quot;&quot;ressource&quot;&quot;&quot;" name="type"/>
<field name="ressource_type_id" ref="model_marketing_campaign"/>
</record>
<!-- Email tempalte -->
<record id="email_template_1" model="email.template">
<field name="def_subject">Thanks for showing interest in OpenERP</field>
<field name="def_to">info@tinyerp.com</field>
<field eval="[(6,0,[])]" name="allowed_groups"/>
<field eval="0" name="auto_email"/>
<field model="ir.actions.act_window" name="ref_ir_act_window" search="[('name', '=', u'For OpenERP OnDemand Free Trial 2010 Mail Form')]"/>
<field eval="[(6,0,[])]" name="table_required_fields"/>
<field model="ir.values" name="ref_ir_value" search="[('name', '=', u'Send Mail (For OpenERP OnDemand Free Trial 2010)')]"/>
<field name="object_name" ref="crm.model_crm_lead"/>
<field eval="0" name="use_sign"/>
<field name="def_body_text">Hello,Thanks for generous interest you have shown in the open ERP.Regards,OpenERP Team,</field>
<field name="template_language">mako</field>
<field eval="0" name="send_on_create"/>
<field name="name">For OpenERP OnDemand Free Trial 2010</field>
<field name="model_int_name">crm.lead</field>
<field eval="0" name="send_on_write"/>
</record>
<record id="email_template_2" model="email.template">
</record>
<!-- Email tempalte -->
<record id="email_template_1" model="email.template">
<field name="def_subject">Thanks for showing interest in OpenERP</field>
<field name="def_to">info@tinyerp.com</field>
<field eval="[(6,0,[])]" name="allowed_groups"/>
<field model="ir.actions.act_window" name="ref_ir_act_window" search="[('name', '=', u'For OpenERP OnDemand Free Trial 2010 Mail Form')]"/>
<field model="ir.values" name="ref_ir_value" search="[('name', '=', u'Send Mail (For OpenERP OnDemand Free Trial 2010)')]"/>
<field name="object_name" ref="crm.model_crm_lead"/>
<field eval="0" name="use_sign"/>
<field name="def_body_text">Hello,Thanks for generous interest you have shown in the open ERP.Regards,OpenERP Team,</field>
<field name="template_language">mako</field>
<field name="name">For OpenERP OnDemand Free Trial 2010</field>
<field name="model_int_name">crm.lead</field>
</record>
<record id="email_template_2" model="email.template">
<field name="def_subject">Propose to subscribe to the Open ERP Discovery Day on May 2010</field>
<field name="def_to">info@tinyerp.com</field>
<field eval="[(6,0,[])]" name="allowed_groups"/>
<field eval="0" name="auto_email"/>
<field model="ir.actions.act_window" name="ref_ir_act_window" search="[('name', '=', u'For OpenERP OnDemand Free Trial 2010 Mail Form')]"/>
<field eval="[(6,0,[])]" name="table_required_fields"/>
<field model="ir.values" name="ref_ir_value" search="[('name', '=', u'Send Mail (For OpenERP OnDemand Free Trial 2010)')]"/>
<field name="object_name" ref="crm.model_crm_lead"/>
<field eval="0" name="use_sign"/>
@@ -56,19 +50,15 @@
We really appreciate your co-operation on this.
Regards,OpenERP Team,</field>
<field name="template_language">mako</field>
<field eval="0" name="send_on_create"/>
<field name="name">For Open ERP Discovery Day on May 2010</field>
<field name="model_int_name">crm.lead</field>
<field eval="0" name="send_on_write"/>
</record>
</record>
<record id="email_template_3" model="email.template">
<field name="def_subject">Thanks for subscribing to the Open ERP Discovery Day</field>
<field name="def_to">info@tinyerp.com</field>
<field eval="[(6,0,[])]" name="allowed_groups"/>
<field eval="0" name="auto_email"/>
<field model="ir.actions.act_window" name="ref_ir_act_window" search="[('name', '=', u'For OpenERP OnDemand Free Trial 2010 Mail Form')]"/>
<field eval="[(6,0,[])]" name="table_required_fields"/>
<field model="ir.values" name="ref_ir_value" search="[('name', '=', u'Send Mail (For OpenERP OnDemand Free Trial 2010)')]"/>
<field name="object_name" ref="crm.model_crm_lead"/>
<field eval="0" name="use_sign"/>
@@ -77,19 +67,15 @@
I really appreciate your co-operation on this.
Regards,OpenERP Team,</field>
<field name="template_language">mako</field>
<field eval="0" name="send_on_create"/>
<field name="name">For Open ERP Discovery Day</field>
<field name="model_int_name">crm.lead</field>
<field eval="0" name="send_on_write"/>
</record>
</record>
<record id="email_template_4" model="email.template">
<field name="def_subject">Thanks for buying the Open ERP book</field>
<field name="def_to">info@tinyerp.com</field>
<field eval="[(6,0,[])]" name="allowed_groups"/>
<field eval="0" name="auto_email"/>
<field model="ir.actions.act_window" name="ref_ir_act_window" search="[('name', '=', u'For OpenERP OnDemand Free Trial 2010 Mail Form')]"/>
<field eval="[(6,0,[])]" name="table_required_fields"/>
<field model="ir.values" name="ref_ir_value" search="[('name', '=', u'Send Mail (For OpenERP OnDemand Free Trial 2010)')]"/>
<field name="object_name" ref="crm.model_crm_lead"/>
<field eval="0" name="use_sign"/>
@@ -98,19 +84,15 @@
I really appreciate your co-operation on this.
Regards,OpenERP Team,</field>
<field name="template_language">mako</field>
<field eval="0" name="send_on_create"/>
<field name="name">For Open ERP book</field>
<field name="model_int_name">crm.lead</field>
<field eval="0" name="send_on_write"/>
</record>
<record id="email_template_5" model="email.template">
<field name="def_subject">Propose a free technical training to Gold partners</field>
<field name="def_to">info@tinyerp.com</field>
<field eval="[(6,0,[])]" name="allowed_groups"/>
<field eval="0" name="auto_email"/>
<field model="ir.actions.act_window" name="ref_ir_act_window" search="[('name', '=', u'For OpenERP OnDemand Free Trial 2010 Mail Form')]"/>
<field eval="[(6,0,[])]" name="table_required_fields"/>
<field model="ir.values" name="ref_ir_value" search="[('name', '=', u'Send Mail (For OpenERP OnDemand Free Trial 2010)')]"/>
<field name="object_name" ref="crm.model_crm_lead"/>
<field eval="0" name="use_sign"/>
@@ -120,19 +102,15 @@
I really appreciate your co-operation on this.
Regards,OpenERP Team,</field>
<field name="template_language">mako</field>
<field eval="0" name="send_on_create"/>
<field name="name">For technical training to Gold partners</field>
<field name="model_int_name">crm.lead</field>
<field eval="0" name="send_on_write"/>
</record>
<record id="email_template_6" model="email.template">
<field name="def_subject">Propose paid training to Silver partners</field>
<field name="def_to">info@tinyerp.com</field>
<field eval="[(6,0,[])]" name="allowed_groups"/>
<field eval="0" name="auto_email"/>
<field model="ir.actions.act_window" name="ref_ir_act_window" search="[('name', '=', u'For OpenERP OnDemand Free Trial 2010 Mail Form')]"/>
<field eval="[(6,0,[])]" name="table_required_fields"/>
<field model="ir.values" name="ref_ir_value" search="[('name', '=', u'Send Mail (For OpenERP OnDemand Free Trial 2010)')]"/>
<field name="object_name" ref="crm.model_crm_lead"/>
<field eval="0" name="use_sign"/>
@@ -142,19 +120,15 @@
I really appreciate your co-operation on this.
Regards,OpenERP Team,</field>
<field name="template_language">mako</field>
<field eval="0" name="send_on_create"/>
<field name="name">For training to Silver partners</field>
<field name="model_int_name">crm.lead</field>
<field eval="0" name="send_on_write"/>
</record>
<record id="email_template_7" model="email.template">
<field name="def_subject">Propose gold partnership to silver partners</field>
<field name="def_to">info@tinyerp.com</field>
<field eval="[(6,0,[])]" name="allowed_groups"/>
<field eval="0" name="auto_email"/>
<field model="ir.actions.act_window" name="ref_ir_act_window" search="[('name', '=', u'For OpenERP OnDemand Free Trial 2010 Mail Form')]"/>
<field eval="[(6,0,[])]" name="table_required_fields"/>
<field model="ir.values" name="ref_ir_value" search="[('name', '=', u'Send Mail (For OpenERP OnDemand Free Trial 2010)')]"/>
<field name="object_name" ref="crm.model_crm_lead"/>
<field eval="0" name="use_sign"/>
@@ -164,73 +138,67 @@
I really appreciate your co-operation on this.
Regards,OpenERP Team,</field>
<field name="template_language">mako</field>
<field eval="0" name="send_on_create"/>
<field name="name">For gold partnership to silver partners</field>
<field name="model_int_name">crm.lead</field>
<field eval="0" name="send_on_write"/>
</record>
<record id="email_template_8" model="email.template">
<field name="def_subject">Thanks for subscribing to technical training</field>
<field name="def_to">info@tinyerp.com</field>
<field eval="[(6,0,[])]" name="allowed_groups"/>
<field eval="0" name="auto_email"/>
<field model="ir.actions.act_window" name="ref_ir_act_window" search="[('name', '=', u'For OpenERP OnDemand Free Trial 2010 Mail Form')]"/>
<field eval="[(6,0,[])]" name="table_required_fields"/>
<field model="ir.values" name="ref_ir_value" search="[('name', '=', u'Send Mail (For OpenERP OnDemand Free Trial 2010)')]"/>
<field name="object_name" ref="crm.model_crm_lead"/>
<field eval="0" name="use_sign"/>
<field name="def_body_text">Hello, Thanks for showing intrest and for subscribing to technical training.If any further information required kindly revert back.I really appreciate your co-operation on this.
Regards,OpenERP Team,</field>
<field name="template_language">mako</field>
<field eval="0" name="send_on_create"/>
<field name="name">For subscribing to technical training</field>
<field name="model_int_name">crm.lead</field>
<field eval="0" name="send_on_write"/>
</record>
<!-- Report -->
<record id="mc_crm_lead_demo_report" model="ir.actions.report.xml">
<field name="name">Marketing campaign demo report</field>
<field name="type">ir.actions.report.xml</field>
<field name="model">crm.lead</field>
<field name="report_name">crm.lead.demo</field>
<field name="report_rml">marketing_campaign/report/crm_lead_mc_demo_report.rml</field>
<field name="report_type">pdf</field>
</record>
<!-- Campaign -->
<record id="marketing_campaign_openerpondemandfreetrial0" model="marketing.campaign">
<field name="name">OpenERP OnDemand Free Trial 2010</field>
<field name="object_id" ref="crm.model_crm_lead"/>
</record>
<!-- Activity -->
<record id="marketing_campaign_activity_0" model="marketing.campaign.activity">
<field name="name">Propose a 1 month free trial for an OnDemand offer</field>
<field name="server_action_id" ref="base.action_start_configurator"/>
<field model="marketing.campaign" name="campaign_id" ref="marketing_campaign_openerpondemandfreetrial0"/>
<field name="report_directory_id" ref="document_directory_campaign1"/>
<field name="type">paper</field>
<field eval="1" name="start"/>
<field name="report_id" ref="mc_crm_lead_demo_report"/>
</record>
<record id="marketing_campaign_activity_1" model="marketing.campaign.activity">
<field name="name">Thanks for showing interest</field>
<field name="server_action_id" ref="base.action_start_configurator"/>
<field model="marketing.campaign" name="campaign_id" ref="marketing_campaign_openerpondemandfreetrial0"/>
<field name="email_template_id" ref="email_template_1"/>
</record>
<record id="marketing_campaign_activity_2" model="marketing.campaign.activity">
<!-- Report -->
<record id="mc_crm_lead_demo_report" model="ir.actions.report.xml">
<field name="name">Marketing campaign demo report</field>
<field name="type">ir.actions.report.xml</field>
<field name="model">crm.lead</field>
<field name="report_name">crm.lead.demo</field>
<field name="report_rml">marketing_campaign/report/crm_lead_mc_demo_report.rml</field>
<field name="report_type">pdf</field>
</record>
<!-- Campaign -->
<record id="marketing_campaign_openerpondemandfreetrial0" model="marketing.campaign">
<field name="name">OpenERP OnDemand Free Trial 2010</field>
<field name="object_id" ref="crm.model_crm_lead"/>
</record>
<!-- Activity -->
<record id="marketing_campaign_activity_0" model="marketing.campaign.activity">
<field name="name">Propose a 1 month free trial for an OnDemand offer</field>
<field name="server_action_id" ref="base.action_start_configurator"/>
<field model="marketing.campaign" name="campaign_id" ref="marketing_campaign_openerpondemandfreetrial0"/>
<field name="report_directory_id" ref="document_directory_campaign1"/>
<field name="type">paper</field>
<field eval="1" name="start"/>
<field name="report_id" ref="mc_crm_lead_demo_report"/>
</record>
<record id="marketing_campaign_activity_1" model="marketing.campaign.activity">
<field name="name">Thanks for showing interest</field>
<field name="server_action_id" ref="base.action_start_configurator"/>
<field model="marketing.campaign" name="campaign_id" ref="marketing_campaign_openerpondemandfreetrial0"/>
<field name="email_template_id" ref="email_template_1"/>
</record>
<record id="marketing_campaign_activity_2" model="marketing.campaign.activity">
<field name="name">Propose to subscribe to the Open ERP Discovery Day on May 2010</field>
<field name="server_action_id" ref="base.action_start_configurator"/>
<field model="marketing.campaign" name="campaign_id" ref="marketing_campaign_openerpondemandfreetrial0"/>
<field name="email_template_id" ref="email_template_2"/>
</record>
<record id="marketing_campaign_activity_3" model="marketing.campaign.activity">
<record id="marketing_campaign_activity_3" model="marketing.campaign.activity">
<field name="name">Thanks for subscribing to the Open ERP Discovery Day</field>
<field name="server_action_id" ref="base.action_start_configurator"/>
<field model="marketing.campaign" name="campaign_id" ref="marketing_campaign_openerpondemandfreetrial0"/>
@@ -244,7 +212,7 @@
<field name="type">paper</field>
<field name="report_id" ref="mc_crm_lead_demo_report"/>
</record>
<record id="marketing_campaign_activity_5" model="marketing.campaign.activity">
<field name="name">Thanks for buying the Open ERP book</field>
<field name="server_action_id" ref="base.action_start_configurator"/>
@@ -263,28 +231,28 @@
<field model="marketing.campaign" name="campaign_id" ref="marketing_campaign_openerpondemandfreetrial0"/>
<field name="email_template_id" ref="email_template_6"/>
</record>
<record id="marketing_campaign_activity_8" model="marketing.campaign.activity">
<field name="name">Propose gold partnership to silver partners</field>
<field name="server_action_id" ref="base.action_start_configurator"/>
<field model="marketing.campaign" name="campaign_id" ref="marketing_campaign_openerpondemandfreetrial0"/>
<field name="email_template_id" ref="email_template_7"/>
</record>
<record id="marketing_campaign_activity_9" model="marketing.campaign.activity">
<field name="name">Thanks for subscribing to technical training</field>
<field name="server_action_id" ref="base.action_start_configurator"/>
<field model="marketing.campaign" name="campaign_id" ref="marketing_campaign_openerpondemandfreetrial0"/>
<field name="email_template_id" ref="email_template_8"/>
</record>
<!-- Tranisition -->
<record id="marketing_campaign_transition_0" model="marketing.campaign.transition">
<field model="marketing.campaign.activity" name="activity_from_id" ref = "marketing_campaign_activity_0"/>
<field model="marketing.campaign.activity" name="activity_to_id" ref = "marketing_campaign_activity_1"/>
</record>
<record id="marketing_campaign_transition_1" model="marketing.campaign.transition">
<!-- Tranisition -->
<record id="marketing_campaign_transition_0" model="marketing.campaign.transition">
<field model="marketing.campaign.activity" name="activity_from_id" ref = "marketing_campaign_activity_0"/>
<field model="marketing.campaign.activity" name="activity_to_id" ref = "marketing_campaign_activity_1"/>
</record>
<record id="marketing_campaign_transition_1" model="marketing.campaign.transition">
<field model="marketing.campaign.activity" name="activity_from_id" ref = "marketing_campaign_activity_0"/>
<field model="marketing.campaign.activity" name="activity_to_id" ref = "marketing_campaign_activity_2"/>
</record>
@@ -324,15 +292,15 @@
<field model="marketing.campaign.activity" name="activity_from_id" ref = "marketing_campaign_activity_9"/>
<field model="marketing.campaign.activity" name="activity_to_id" ref = "marketing_campaign_activity_1"/>
</record>
<!-- Segment -->
<record id="marketing_campaign_segment_bosslistusassociationslist0" model="marketing.campaign.segment">
<field eval="time.strftime('%Y-%m-%d %H:%M:%S')" name="date_run"/>
<field name="name">BossList US Associations List-0/90</field>
<field name="sync_mode">create_date</field>
<field name="campaign_id" ref="marketing_campaign_openerpondemandfreetrial0"/>
<field name="state">draft</field>
</record>
</data>
</openerp>
<!-- Segment -->
<record id="marketing_campaign_segment_bosslistusassociationslist0" model="marketing.campaign.segment">
<field eval="time.strftime('%Y-%m-%d %H:%M:%S')" name="date_run"/>
<field name="name">BossList US Associations List-0/90</field>
<field name="sync_mode">create_date</field>
<field name="campaign_id" ref="marketing_campaign_openerpondemandfreetrial0"/>
<field name="state">draft</field>
</record>
</data>
</openerp>
@@ -14,75 +14,67 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Campaign">
<group colspan="4">
<group colspan="4" col="6">
<field name="name" select="1"/>
<field name="object_id" select="1"/>
<field name="mode"/>
<field name="fixed_cost"/>
</group>
<field name="activity_ids" nolabel = "1" colspan="4" default_get="{'object_id':object_id}">
<form string="Activities">
<field name="name" select="1" />
<field name="object_id" readonly="True"/>
<field name="variable_cost" select="1"/>
<field name="start"/>
<field name="condition" colspan="4"/>
<form string="Activities">
<group colspan="4" col="6">
<separator string="Activity Definition" colspan="4"/>
<separator string="Cost Control" colspan="2"/>
<field name="name" select="1" />
<field name="start"/>
<field name="variable_cost" select="1"/>
</group>
<group colspan="2" col="2">
<separator string="Condition" colspan="2"/>
<field name="condition"/>
</group>
<group colspan="2" col="2">
<separator string="Action" colspan="2"/>
<field name="type" colspan="4"/>
<group colspan="4" attrs="{'invisible':[('type','!=','email')]}" >
<field name="email_template_id" attrs="{'required':[('type','=','email')]}" />
</group>
<group colspan="4" attrs="{'invisible':[('type','!=','paper')]}" >
<field name="report_id" attrs="{'required':[('type','=','paper')]}"/>
<field name="report_directory_id" attrs="{'required':[('type','=','paper')]}" />
</group>
<group colspan="4" attrs="{'invisible':[('type','!=','action')]}" >
<field name="server_action_id" attrs="{'required':[('type','=','action')]}" />
</group>
<group colspan="4" attrs="{'invisible':[('type','!=','subcampaign')]}" >
<field name="subcampaign_id" attrs="{'required':[('type','=','subcampaign')]}" />
<field name="subcampaign_segment_id" attrs="{'required':[('type','=','subcampaign')]}" />
</group>
</group>
<newline/>
<field name="type" colspan="4"/>
<group colspan="4" attrs="{'invisible':[('type','!=','email')]}" >
<field name="email_template_id" attrs="{'required':[('type','=','email')]}" />
</group>
<group colspan="4" attrs="{'invisible':[('type','!=','paper')]}" >
<field name="report_id" attrs="{'required':[('type','=','paper')]}"/>
<field name="report_directory_id" attrs="{'required':[('type','=','paper')]}" />
</group>
<group colspan="4" attrs="{'invisible':[('type','!=','action')]}" >
<field name="server_action_id" attrs="{'required':[('type','=','action')]}" />
</group>
<group colspan="4" attrs="{'invisible':[('type','!=','subcampaign')]}" >
<field name="subcampaign_id" attrs="{'required':[('type','=','subcampaign')]}" />
<field name="subcampaign_segment_id" attrs="{'required':[('type','=','subcampaign')]}" />
</group>
<field name="to_ids" nolabel="1" colspan="4" mode="tree" default_get="{'type_id':'activity_from_id','activity_id':active_id or False}">
<form string="Out Transitions" >
<field name="activity_from_id" readonly="True"/>
<field name="activity_to_id"/>
<field name="interval_nbr"/>
<field name="interval_type"/>
</form>
<tree string="Out Transitions" editable="bottom">
<field name="activity_from_id"/>
<field name="activity_to_id"/>
<field name="interval_nbr"/>
<field name="interval_type"/>
</tree>
</field>
<field name="from_ids" nolabel="1" colspan="4" mode="tree" default_get="{'type_id':'activity_to_id','activity_id':active_id or False}">
<form string="In Transitions" >
<field name="activity_from_id"/>
<field name="activity_to_id" readonly="True"/>
<field name="interval_nbr"/>
<field name="interval_type"/>
</form>
<tree string="In Transitions" editable="bottom">
<field name="activity_from_id"/>
<field name="activity_to_id"/>
<field name="interval_nbr"/>
<field name="interval_type"/>
</tree>
</field>
<group colspan="4" col="4">
<separator string="Transitions" colspan="4"/>
<field name="to_ids" nolabel="1" colspan="2" mode="tree" default_get="{'type_id':'activity_from_id','activity_id':active_id or False}">
<tree string="Outgoing Transitions" editable="bottom">
<field name="activity_to_id"/>
<field name="interval_nbr"/>
<field name="interval_type"/>
</tree>
</field>
<field name="from_ids" nolabel="1" colspan="2" mode="tree" default_get="{'type_id':'activity_to_id','activity_id':active_id or False}">
<tree string="Incoming Transitions" editable="bottom">
<field name="activity_from_id"/>
<field name="interval_nbr"/>
<field name="interval_type"/>
</tree>
</field>
</group>
</form>
<tree string="Activities">
<field name="name" select="1"/>
<field name="object_id"/>
<field name="name"/>
<field name="start"/>
<field name="condition"/>
<field name="variable_cost" select="1"/>
<field name="type"/>
<field name="report_id"/>
<field name="to_ids"/>
<field name="subcampaign_id"/>
<field name="subcampaign_segment_id"/>
</tree>
</field>
<separator string="Status" colspan="4" />
@@ -105,7 +97,6 @@
<field name="name" select="1"/>
<field name="object_id" select="1"/>
<field name="mode"/>
<field name="fixed_cost"/>
<field name="state"/>
</tree>
</field>
@@ -122,13 +113,13 @@
<field name="type"/>
<field name="start" invisible="1"/>
<field name="condition"/>
</node>
<arrow object="marketing.campaign.transition" source="activity_from_id" destination="activity_to_id" label="['interval_type']">
</node>
<arrow object="marketing.campaign.transition" source="activity_from_id" destination="activity_to_id" label="['interval_type']">
<field name="activity_from_id"/>
<field name="activity_to_id"/>
<field name="interval_nbr"/>
<field name="interval_type"/>
</arrow>
<field name="interval_type"/>
</arrow>
</diagram>
</field>
</record>
@@ -163,12 +154,12 @@
<field name="view_type">form</field>
<field name="view_mode">tree,form,diagram</field>
<field name="view_id" ref="view_marketing_campaign_tree"/>
<field name="context">{'group_by': [], 'search_default_draft': 1, 'search_default_test': 1}</field>
<field name="context">{'group_by': []}</field>
<field name="search_view_id" ref="view_marketing_campaign_search"/>
</record>
<menuitem name="Campaigns" id="menu_marketing_campaign" parent="marketing.marketing_menu"/>
<menuitem name="Campaigns" id="menu_marketing_campaign" parent="marketing.marketing_menu"/>
<menuitem id="menu_marketing_campaign_form" parent="menu_marketing_campaign" action="action_marketing_campaign_form" sequence="10" />
<!--
@@ -183,26 +174,30 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Segments">
<group colspan="4">
<field name="name" select="1" colspan="4"/>
<newline/>
<group colspan="4" col="6">
<field name="name"/>
<field name="campaign_id" select="1"/>
<field name="object_id" select="1" readonly="True"/>
<newline/>
<field name="ir_filter_id" select="1"/>
<newline/>
<field name="object_id" invisible="1" readonly="True"/>
</group>
<group colspan="2" col="2">
<separator string="Synchronization" colspan="2"/>
<field name="sync_last_date"/>
<field name="sync_mode" required="True"/>
<label string="" colspan="1"/>
<button string="Synchronize" states="running" name="synchroniz" icon="gtk-apply" type="object"/>
</group>
<group colspan="2" col="2">
<separator string="Dates" colspan="2"/>
<field name="date_run" attrs="{'readonly':[('date_run','!=',False),('state','=','running')]}"/>
<field name="date_done"/>
<separator string="Synchronization" colspan="4" />
<field name="sync_last_date"/>
<field name="sync_mode" required="True"/>
</group>
<separator string="Status" colspan="4" />
<separator string="Status" colspan="4"/>
<group col="10" colspan="4">
<field name="state" readonly="1" select="2" nolabel="1"/>
<button name="state_running_set" string="Run" states="draft" icon="gtk-apply"/>
<button name="state_done_set" string="Done" states="running" icon="gtk-ok"/>
<button name="state_cancel_set" string="Cancelled" states="running" icon="gtk-cancel"/>
<button name="state_done_set" string="Close" states="running" icon="gtk-ok"/>
<button name="state_cancel_set" string="Cancel" states="running" icon="gtk-cancel"/>
</group>
</form>
</field>
@@ -214,13 +209,10 @@
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Segments">
<field name="name" select="1"/>
<field name="campaign_id" select="1"/>
<field name="object_id" select="1" />
<field name="name"/>
<field name="campaign_id"/>
<field name="date_run"/>
<field name="date_done"/>
<field name="sync_last_date" string="Sync Date"/>
<field name="sync_mode" string="Sync Mode"/>
<field name="sync_last_date"/>
<field name="state" />
</tree>
</field>
@@ -232,10 +224,10 @@
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Segments">
<filter icon="terp-document-new" string="Draft" name="draft" domain="[('state','=','draft')]"/>
<filter icon="terp-check" string="Running" domain="[('state','=','running')]"/>
<filter icon="terp-document-new" string="Draft" domain="[('state','=','draft')]"/>
<filter icon="terp-check" string="Running" name="running" domain="[('state','=','running')]"/>
<separator orientation="vertical"/>
<filter icon="terp-go-month" string="Create Date" name="create_date" domain="[('sync_mode','=','create_date')]"/>
<filter icon="terp-go-month" string="Create Date" domain="[('sync_mode','=','create_date')]"/>
<filter icon="terp-go-month" string="Write Date" domain="[('sync_mode','=','write_date')]"/>
<separator orientation="vertical"/>
<field name="name" select="1"/>
@@ -251,7 +243,7 @@
</search>
</field>
</record>
+
<record model="ir.actions.act_window" id="action_marketing_campaign_segment_form">
<field name="name">Segments</field>
<field name="type">ir.actions.act_window</field>
@@ -259,8 +251,8 @@
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_marketing_campaign_segment_tree"/>
<field name="search_view_id" ref="view_marketing_campaign_segment_search"/>
<field name="context">{'group_by': [], 'search_default_draft': 1, 'search_default_create_date': 1}</field>
<field name="search_view_id" ref="view_marketing_campaign_segment_search"/>
<field name="context">{'group_by': [], 'search_default_running': 1}</field>
</record>
<menuitem id="menu_marketing_campaign_segment_form" parent="menu_marketing_campaign" action="action_marketing_campaign_segment_form" sequence="20" />
@@ -277,54 +269,55 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Activities">
<field name="name" select="1" />
<field name="start"/>
<field name="campaign_id" select="1"/>
<field name="object_id" readonly="True"/>
<group colspan="4" col="6">
<separator string="Activity Definition" colspan="4"/>
<separator string="Cost Control" colspan="2"/>
<field name="name" select="1" />
<field name="start"/>
<field name="variable_cost" select="1"/>
<field name="object_id" invisible="1"/>
</group>
<group colspan="2" col="2">
<separator string="Condition" colspan="2"/>
<field name="condition"/>
</group>
<group colspan="2" col="2">
<separator string="Action"/>
<field name="type" colspan="4"/>
<group colspan="4" attrs="{'invisible':[('type','!=','email')]}" >
<field name="email_template_id" attrs="{'required':[('type','=','email')]}" />
</group>
<group colspan="4" attrs="{'invisible':[('type','!=','paper')]}" >
<field name="report_id" attrs="{'required':[('type','=','paper')]}"/>
<field name="report_directory_id" attrs="{'required':[('type','=','paper')]}" />
</group>
<group colspan="4" attrs="{'invisible':[('type','!=','action')]}" >
<field name="server_action_id" attrs="{'required':[('type','=','action')]}" />
</group>
<group colspan="4" attrs="{'invisible':[('type','!=','subcampaign')]}" >
<field name="subcampaign_id" attrs="{'required':[('type','=','subcampaign')]}" />
<field name="subcampaign_segment_id" attrs="{'required':[('type','=','subcampaign')]}" />
</group>
</group>
<newline/>
<field name="type"/>
<group colspan="4" attrs="{'invisible':[('type','!=','email')]}" >
<field name="email_template_id" attrs="{'required':[('type','=','email')]}" />
<group colspan="4" col="4">
<separator string="Transitions" colspan="4"/>
<field name="to_ids" nolabel="1" colspan="2" mode="tree" default_get="{'type_id':'activity_from_id','activity_id':active_id or False}">
<tree string="Outgoing Transitions" editable="bottom">
<field name="activity_to_id"/>
<field name="interval_nbr"/>
<field name="interval_type"/>
</tree>
</field>
<field name="from_ids" nolabel="1" colspan="2" mode="tree" default_get="{'type_id':'activity_to_id','activity_id':active_id or False}">
<tree string="Incoming Transitions" editable="bottom">
<field name="activity_from_id"/>
<field name="interval_nbr"/>
<field name="interval_type"/>
</tree>
</field>
</group>
<group colspan="4" attrs="{'invisible':[('type','!=','paper')]}" >
<field name="report_id" attrs="{'required':[('type','=','paper')]}" />
<field name="report_directory_id" attrs="{'required':[('type','=','paper')]}" />
</group>
<group colspan="4" attrs="{'invisible':[('type','!=','action')]}" >
<field name="server_action_id" attrs="{'required':[('type','=','action')]}" />
</group>
<group colspan="4" attrs="{'invisible':[('type','!=','subcampaign')]}" >
<field name="subcampaign_id" attrs="{'required':[('type','=','subcampaign')]}" />
<field name="subcampaign_segment_id" attrs="{'required':[('type','=','subcampaign')]}" />
</group>
<field name="to_ids" nolabel="1" colspan="4" mode="tree" default_get="{'type_id':'activity_from_id','activity_id':active_id or False}">
<form string="Out Transitions" >
<field name="activity_from_id" readonly="True"/>
<field name="activity_to_id"/>
<field name="interval_nbr"/>
<field name="interval_type"/>
</form>
<tree string="Out Transitions" editable="bottom">
<field name="activity_from_id"/>
<field name="activity_to_id"/>
<field name="interval_nbr"/>
<field name="interval_type"/>
</tree>
</field>
<field name="from_ids" nolabel="1" colspan="4" mode="tree" default_get="{'type_id':'activity_to_id','activity_id':active_id or False}">
<form string="In Transitions" >
<field name="activity_from_id"/>
<field name="activity_to_id" readonly="True"/>
<field name="interval_nbr"/>
<field name="interval_type"/>
</form>
<tree string="In Transitions" editable="bottom">
<field name="activity_from_id"/>
<field name="activity_to_id"/>
<field name="interval_nbr"/>
<field name="interval_type"/>
</tree>
</field>
</form>
</field>
</record>
@@ -338,13 +331,8 @@
<field name="name" select="1"/>
<field name="campaign_id" select="1"/>
<field name="start"/>
<field name="object_id"/>
<field name="condition"/>
<field name="type"/>
<field name="report_id"/>
<field name="to_ids" />
<field name="subcampaign_id"/>
<field name="subcampaign_segment_id"/>
</tree>
</field>
</record>
@@ -374,11 +362,12 @@
<tree string="Workitems">
<field name="segment_id"/>
<field name="activity_id" />
<field name="object_id"/>
<field name="partner_id" select="1"/>
<field name="res_id" />
<field name="res_name" />
<field name="partner_id"/>
<field name="date"/>
<field name="state"/>
<button string="Process" states="todo" name="process" type="object" icon="gtk-ok"/>
<button string="Cancel" states="todo" name="button_cancel" type="object" icon="gtk-cancel"/>
</tree>
</field>
</record>
@@ -389,14 +378,31 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Workitem">
<field name="segment_id" select="1"/>
<field name="activity_id" context="{'segment_id':segment_id}" select="1"/>
<field name="object_id" readonly="True"/>
<field name="partner_id" select="1"/>
<field name="res_id"/>
<field name="date" select="1"/>
<group colspan="4" col="6">
<group colspan="2" col="2">
<separator string="Campaign Step" colspan="2"/>
<field name="campaign_id" select="1"/>
<field name="segment_id" select="1"/>
<field name="activity_id" context="{'segment_id':segment_id}" select="1"/>
</group><group colspan="2" col="2">
<separator string="Related Resource" colspan="2"/>
<field name="object_id" readonly="True"/>
<field name="res_name"/>
<field name="res_id"/>
<field name="partner_id" select="1"/>
</group><group colspan="2" col="2">
<separator string="Date" colspan="2"/>
<field name="date"/>
<label string="" colspan="1"/>
<button string="Preview" states="todo" name="preview" icon="gtk-apply" type="object"/>
</group>
</group>
<separator string="Status" colspan="4"/>
<field name="state" nolabel="1" colspan="4" readonly="True" select="1"/>
<group colspan="4" col="11">
<field name="state" nolabel="1" readonly="True" select="1"/>
<button string="Process" states="todo" name="process" type="object" icon="gtk-ok"/>
<button string="Cancel" states="todo" name="button_cancel" type="object" icon="gtk-cancel"/>
</group>
</form>
</field>
</record>
@@ -440,5 +446,14 @@
<menuitem id="menu_action_marketing_campaign_workitem" parent="menu_marketing_campaign" action="action_marketing_campaign_workitem" sequence="30" groups="base.group_extended"/>
<act_window name="All Segments"
res_model="marketing.campaign.segment"
src_model="marketing.campaign"
view_type="form"
view_mode="tree,form"
id="act_marketing_campaing_segment_opened"
domain="[('campaign_id','=',active_id)]"
/>
</data>
</openerp>
+1 -1
View File
@@ -26,6 +26,6 @@ import installer
import wizard
import report
import company
import mrp_procurement
import procurement
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+2 -2
View File
@@ -26,7 +26,7 @@
"author" : "Tiny",
"website" : "http://www.openerp.com",
"category" : "Generic Modules/Production",
"depends" : ["mrp_procurement", "stock", "resource", "purchase", "product","process"],
"depends" : ["procurement", "stock", "resource", "purchase", "product","process"],
"description": """
This is the base module to manage the manufacturing process in Open ERP.
@@ -76,7 +76,7 @@
'report/mrp_report_view.xml',
'report/mrp_production_order_view.xml',
],
'demo_xml': ['mrp_demo.xml', 'mrp_order_point.xml'],
'demo_xml': ['mrp_demo.xml'],
'test': [
'test/mrp_phantom_bom.yml',
'test/mrp_production_order.yml',
+11 -11
View File
@@ -8,13 +8,13 @@ msgstr ""
"Project-Id-Version: openobject-addons\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
"POT-Creation-Date: 2009-08-28 16:01+0000\n"
"PO-Revision-Date: 2010-06-08 13:08+0000\n"
"PO-Revision-Date: 2010-06-10 09:51+0000\n"
"Last-Translator: vir (Open ERP) <vir@tinyerp.com>\n"
"Language-Team: Hindi <hi@li.org>\n"
"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: mrp
@@ -81,7 +81,7 @@ msgstr ""
#. module: mrp
#: field:mrp.production,picking_id:0
msgid "Packing list"
msgstr ""
msgstr "पैकिंग सूची"
#. module: mrp
#: model:process.node,name:mrp.process_node_stock0
@@ -347,23 +347,23 @@ msgstr ""
#. module: mrp
#: view:mrp.procurement:0
msgid "Details"
msgstr ""
msgstr "विवरण"
#. module: mrp
#: model:process.process,name:mrp.process_process_procurementprocess0
msgid "Procurement Process"
msgstr ""
msgstr "खरीद प्रक्रिया"
#. module: mrp
#: field:mrp.production,date_planned_date:0
msgid "Scheduled Date"
msgstr ""
msgstr "अनुसूचित तिथि"
#. module: mrp
#: selection:mrp.procurement,priority:0
#: selection:mrp.production,priority:0
msgid "Urgent"
msgstr ""
msgstr "तत्काल"
#. module: mrp
#: help:mrp.bom,product_rounding:0
@@ -387,7 +387,7 @@ msgstr ""
#. module: mrp
#: field:mrp.procurement,move_id:0
msgid "Reservation"
msgstr ""
msgstr "आरक्षण"
#. module: mrp
#: model:ir.actions.act_window,name:mrp.action2
@@ -397,12 +397,12 @@ msgstr ""
#. module: mrp
#: wizard_field:product.product.procurement,init,product_id:0
msgid "product"
msgstr ""
msgstr "उत्पाद"
#. module: mrp
#: selection:mrp.property,composition:0
msgid "max"
msgstr ""
msgstr "अधिकतम"
#. module: mrp
#: model:process.transition,name:mrp.process_transition_producttostockrules0
@@ -412,7 +412,7 @@ msgstr ""
#. module: mrp
#: wizard_button:product_price,init,price:0
msgid "Print product price"
msgstr ""
msgstr "प्रिंट उत्पाद मूल्य"
#. module: mrp
#: wizard_view:product.product.procurement,done:0
+3 -17
View File
@@ -248,7 +248,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.
@@ -460,18 +460,6 @@ class mrp_production(osv.osv):
result[prod.id] = prod.date_planned[:10]
return result
def _ref_calc(self, cr, uid, ids, field_names=None, arg=False, context={}):
""" Finds reference sale order for production order.
@param field_names: Names of fields.
@param arg: User defined arguments
@return: Dictionary of values.
"""
res = {}
for f in field_names:
for order_id in ids:
res[order_id] = {f:False}
return res
_columns = {
'name': fields.char('Reference', size=64, required=True),
'origin': fields.char('Source Document', size=64, help="Reference of the document that generated this production order request."),
@@ -512,8 +500,6 @@ class mrp_production(osv.osv):
'hour_total': fields.function(_production_calc, method=True, type='float', string='Total Hours', multi='workorder'),
'cycle_total': fields.function(_production_calc, method=True, type='float', string='Total Cycles', multi='workorder'),
'sale_name': fields.function(_ref_calc, method=True, multi='sale_name', type='char', string='Sale Name', help='Indicate the name of sale order.'),
'sale_ref': fields.function(_ref_calc, method=True, multi='sale_ref', type='char', string='Sale Reference', help='Indicate the Customer Reference from sale order.'),
'company_id': fields.many2one('res.company','Company',required=True),
}
_defaults = {
@@ -831,7 +817,7 @@ class mrp_production(osv.osv):
seq_obj = self.pool.get('ir.sequence')
pick_obj = self.pool.get('stock.picking')
move_obj = self.pool.get('stock.move')
proc_obj = self.pool.get('mrp.procurement')
proc_obj = self.pool.get('procurement.order')
wf_service = netsvc.LocalService("workflow")
for production in self.browse(cr, uid, ids):
if not production.product_lines:
@@ -925,7 +911,7 @@ class mrp_production(osv.osv):
'move_id': move_id,
'company_id': production.company_id.id,
})
wf_service.trg_validate(uid, 'mrp.procurement', proc_id, 'button_confirm', cr)
wf_service.trg_validate(uid, 'procurement.order', proc_id, 'button_confirm', cr)
proc_ids.append(proc_id)
wf_service.trg_validate(uid, 'stock.picking', picking_id, 'button_confirm', cr)
self.write(cr, uid, [production.id], {'picking_id': picking_id, 'move_lines': [(6,0,moves)], 'state':'confirmed'})
-15
View File
@@ -16,20 +16,5 @@
<field name="number_increment">1</field>
</record>
<record id="sequence_mrp_op_type" model="ir.sequence.type">
<field name="name">Stock orderpoint</field>
<field name="code">mrp.warehouse.orderpoint</field>
</record>
<record id="sequence_mrp_op" model="ir.sequence">
<field name="name">Stock orderpoint</field>
<field name="code">mrp.warehouse.orderpoint</field>
<field name="prefix">OP/</field>
<field name="padding">5</field>
<field name="number_next">1</field>
<field name="number_increment">1</field>
</record>
</data>
</openerp>
+10 -12
View File
@@ -248,19 +248,19 @@
<field name="name" select="1"/>
<field name="code" select="1" string="Reference" groups="base.group_extended"/>
<newline/>
<field name="product_uom" widget="selection"/>
<field name="product_uom"/>
<field name="product_qty"/>
<field name="routing_id" widget="selection" groups="base.group_extended"/>
<newline/>
<field name="product_uos" groups="product.group_uos,base.group_extended" widget="selection"/>
<field name="product_uos_qty" groups="product.group_uos,base.group_extended" />
<newline/>
<field name="multi_level_bom" />
<field name="multi_level_bom"/>
<field name="type" groups="base.group_extended"/>
<field name="company_id" select="1" groups="base.group_multi_company" widget="selection"/>
</group>
<notebook colspan="4" >
<page string="Components" attrs="{'invisible': [('bom_id','!=',False),('multi_level_bom','=',False)]}">
<page string="Components" attrs="{'invisible': [('multi_level_bom','=',False)]}">
<field colspan="4" name="bom_lines" nolabel="1" widget="one2many_list" />
</page>
<page string="Revisions" groups="base.group_extended" attrs="{'invisible': [('bom_id','!=',False),('multi_level_bom','=',False)]}">
@@ -406,18 +406,18 @@
Procurement
-->
<menuitem action="mrp_procurement.mrp_procurement_action" id="menu_mrp_procurement_action"
<menuitem action="procurement.procurement_action" id="menu_mrp_procurement_action"
parent="mrp.menu_mrp_manufacturing" sequence="2" />
<!-- <menuitem action="mrp_procurement.mrp_procurement_action5" id="menu_mrp_procurement_exception_action"-->
<!-- <menuitem action="procurement.procurement_action5" id="menu_mrp_procurement_exception_action"-->
<!-- parent="mrp.menu_mrp_control" sequence="1" />-->
<menuitem id="menu_mrp_scheduler" name="Schedulers" parent="base.menu_mrp_root" sequence="4"/>
<menuitem action="mrp_procurement.action_compute_schedulers" id="mrp_Sched_all" parent="mrp.menu_mrp_scheduler" sequence="90"/>
<menuitem action="procurement.action_compute_schedulers" id="mrp_Sched_all" parent="mrp.menu_mrp_scheduler" sequence="90"/>
<!--
Order Point
-->
<menuitem action="mrp_procurement.action_orderpoint_form" id="menu_action_orderpoint_form" parent="mrp.menu_mrp_reordering"/>
<menuitem action="procurement.action_orderpoint_form" id="menu_action_orderpoint_form" parent="mrp.menu_mrp_reordering"/>
<!--
Production Management
@@ -640,8 +640,6 @@
<field name="date_finnished"/>
<field name="picking_id" groups="base.group_extended"/>
<field name="move_prod_id" groups="base.group_extended"/>
<field name="sale_name" groups="base.group_extended"/>
<field name="sale_ref" groups="base.group_extended"/>
</page>
</notebook>
</form>
@@ -813,9 +811,9 @@
-->
<record id="view_procurement_form_inherit" model="ir.ui.view">
<field name="name">mrp.procurement.form.inherit</field>
<field name="model">mrp.procurement</field>
<field name="inherit_id" ref="mrp_procurement.mrp_procurement_form_view"/>
<field name="name">procurement.order.form.inherit</field>
<field name="model">procurement.order</field>
<field name="inherit_id" ref="procurement.procurement_form_view"/>
<field name="type">form</field>
<field name="arch" type="xml">
<xpath expr="/form/notebook/page/field[@name='move_id']" position="before">
+4 -4
View File
@@ -117,7 +117,7 @@
<!-- Procurement -->
<record id="act_produce" model="workflow.activity">
<field name="wkf_id" ref="mrp_procurement.wkf_procurement"/>
<field name="wkf_id" ref="procurement.wkf_procurement"/>
<field name="name">produce</field>
<field name="kind">subflow</field>
<field name="subflow_id" search="[('osv','=','mrp.production')]"/>
@@ -125,20 +125,20 @@
</record>
<record id="trans_product_check_produce" model="workflow.transition">
<field name="act_from" ref="mrp_procurement.act_produce_check"/>
<field name="act_from" ref="procurement.act_produce_check"/>
<field name="act_to" ref="act_produce"/>
<field name="condition">check_product()</field>
</record>
<record id="trans_produce_cancel" model="workflow.transition">
<field name="act_from" ref="act_produce"/>
<field name="act_to" ref="mrp_procurement.act_cancel"/>
<field name="act_to" ref="procurement.act_cancel"/>
<field name="signal">subflow.cancel</field>
</record>
<record id="trans_produce_make_done" model="workflow.transition">
<field name="act_from" ref="act_produce"/>
<field name="act_to" ref="mrp_procurement.act_make_done"/>
<field name="act_to" ref="procurement.act_make_done"/>
<field name="signal">subflow.done</field>
</record>
+18 -18
View File
@@ -4,11 +4,11 @@
<record id="process_node_procureproducts0" model="process.node">
<field name="menu_id" ref="mrp.menu_mrp_procurement_action"/>
<field name="model_id" ref="mrp_procurement.model_mrp_procurement"/>
<field name="model_id" ref="procurement.model_procurement_order"/>
<field eval="&quot;&quot;&quot;state&quot;&quot;&quot;" name="kind"/>
<field eval="&quot;&quot;&quot;The way to procurement depends on the product type.&quot;&quot;&quot;" name="note"/>
<field eval="&quot;&quot;&quot;Procure Products&quot;&quot;&quot;" name="name"/>
<field name="process_id" ref="mrp_procurement.process_process_procurementprocess0"/>
<field name="process_id" ref="procurement.process_process_procurementprocess0"/>
<field eval="&quot;&quot;&quot;object.state in ('draft', 'confirmed', 'cancel', 'exception', 'running', 'done', 'waiting')&quot;&quot;&quot;" name="model_states"/>
<field eval="0" name="flow_start"/>
</record>
@@ -19,94 +19,94 @@
<field eval="&quot;&quot;&quot;state&quot;&quot;&quot;" name="kind"/>
<field eval="&quot;&quot;&quot;Drives the procurement orders for raw material.&quot;&quot;&quot;" name="note"/>
<field eval="&quot;&quot;&quot;Production Order&quot;&quot;&quot;" name="name"/>
<field name="process_id" ref="mrp_procurement.process_process_procurementprocess0"/>
<field name="process_id" ref="procurement.process_process_procurementprocess0"/>
<field eval="&quot;&quot;&quot;object.state in ('draft', 'picking_except', 'confirmed', 'ready', 'in_production', 'cancel', 'done')&quot;&quot;&quot;" name="model_states"/>
<field eval="1" name="flow_start"/>
</record>
<record id="process_node_procureproducts0" model="process.node">
<field name="menu_id" ref="mrp.menu_mrp_procurement_action"/>
<field name="model_id" ref="mrp.model_mrp_procurement"/>
<field name="model_id" ref="mrp.model_procurement_order"/>
<field eval="&quot;&quot;&quot;state&quot;&quot;&quot;" name="kind"/>
<field eval="&quot;&quot;&quot;The way to procurement depends on the product type.&quot;&quot;&quot;" name="note"/>
<field eval="&quot;&quot;&quot;Procure Products&quot;&quot;&quot;" name="name"/>
<field name="process_id" ref="mrp_procurement.process_process_procurementprocess0"/>
<field name="process_id" ref="procurement.process_process_procurementprocess0"/>
<field eval="&quot;&quot;&quot;object.state in ('draft', 'confirmed', 'cancel', 'exception', 'running', 'done', 'waiting')&quot;&quot;&quot;" name="model_states"/>
<field eval="0" name="flow_start"/>
</record>
<record id="process_node_minimumstockrule0" model="process.node">
<field name="menu_id" ref="mrp.menu_action_orderpoint_form"/>
<field name="model_id" ref="mrp_procurement.model_stock_warehouse_orderpoint"/>
<field name="model_id" ref="procurement.model_stock_warehouse_orderpoint"/>
<field eval="&quot;&quot;&quot;state&quot;&quot;&quot;" name="kind"/>
<field eval="&quot;&quot;&quot;Linked to the 'Minimum stock rule' supplying method.&quot;&quot;&quot;" name="note"/>
<field eval="&quot;&quot;&quot;Minimum Stock&quot;&quot;&quot;" name="name"/>
<field name="process_id" ref="mrp_procurement.process_process_procurementprocess0"/>
<field name="process_id" ref="procurement.process_process_procurementprocess0"/>
<field eval="1" name="flow_start"/>
</record>
<record id="process_node_stockproduct0" model="process.node">
<field name="menu_id" ref="mrp.menu_mrp_procurement_action"/>
<field name="model_id" ref="mrp.model_mrp_procurement"/>
<field name="model_id" ref="mrp.model_procurement_order"/>
<field eval="&quot;&quot;&quot;subflow&quot;&quot;&quot;" name="kind"/>
<field eval="&quot;&quot;&quot;Product type is Stockable or Consumable.&quot;&quot;&quot;" name="note"/>
<field eval="&quot;&quot;&quot;Stockable Product&quot;&quot;&quot;" name="name"/>
<field name="subflow_id" ref="process_process_stockableproductprocess0"/>
<field name="process_id" ref="mrp_procurement.process_process_procurementprocess0"/>
<field name="process_id" ref="procurement.process_process_procurementprocess0"/>
<field eval="&quot;&quot;&quot;object.state in ('draft', 'confirmed', 'cancel', 'exception', 'running', 'done', 'waiting')&quot;&quot;&quot;" name="model_states"/>
<field eval="0" name="flow_start"/>
</record>
<record id="process_node_stockproduct1" model="process.node">
<field name="menu_id" ref="mrp.menu_mrp_procurement_action"/>
<field name="model_id" ref="mrp.model_mrp_procurement"/>
<field name="model_id" ref="mrp.model_procurement_order"/>
<field eval="&quot;&quot;&quot;subflow&quot;&quot;&quot;" name="kind"/>
<field eval="&quot;&quot;&quot;For stockable products and consumables&quot;&quot;&quot;" name="note"/>
<field eval="&quot;&quot;&quot;Stockable Product&quot;&quot;&quot;" name="name"/>
<field name="process_id" ref="mrp.process_process_stockableproductprocess0"/>
<field name="subflow_id" ref="mrp_procurement.process_process_procurementprocess0"/>
<field name="subflow_id" ref="procurement.process_process_procurementprocess0"/>
<field eval="&quot;&quot;&quot;object.state in ('draft', 'confirmed', 'cancel', 'exception', 'running', 'done', 'waiting')&quot;&quot;&quot;" name="model_states"/>
<field eval="1" name="flow_start"/>
</record>
<record id="process_node_serviceproduct0" model="process.node">
<field name="menu_id" ref="mrp.menu_mrp_procurement_action"/>
<field name="model_id" ref="mrp.model_mrp_procurement"/>
<field name="model_id" ref="mrp.model_procurement_order"/>
<field eval="&quot;&quot;&quot;subflow&quot;&quot;&quot;" name="kind"/>
<field eval="&quot;&quot;&quot;Product type is service&quot;&quot;&quot;" name="note"/>
<field eval="&quot;&quot;&quot;Service&quot;&quot;&quot;" name="name"/>
<field name="subflow_id" ref="process_process_serviceproductprocess0"/>
<field name="process_id" ref="mrp_procurement.process_process_procurementprocess0"/>
<field name="process_id" ref="procurement.process_process_procurementprocess0"/>
<field eval="&quot;&quot;&quot;object.state in ('draft', 'confirmed', 'cancel', 'exception', 'running', 'done', 'waiting')&quot;&quot;&quot;" name="model_states"/>
<field eval="0" name="flow_start"/>
</record>
<record id="process_node_serviceproduct1" model="process.node">
<field name="menu_id" ref="mrp.menu_mrp_procurement_action"/>
<field name="model_id" ref="mrp.model_mrp_procurement"/>
<field name="model_id" ref="mrp.model_procurement_order"/>
<field eval="&quot;&quot;&quot;subflow&quot;&quot;&quot;" name="kind"/>
<field eval="&quot;&quot;&quot;For Services.&quot;&quot;&quot;" name="note"/>
<field eval="&quot;&quot;&quot;Service&quot;&quot;&quot;" name="name"/>
<field name="process_id" ref="mrp.process_process_serviceproductprocess0"/>
<field name="subflow_id" ref="mrp_procurement.process_process_procurementprocess0"/>
<field name="subflow_id" ref="procurement.process_process_procurementprocess0"/>
<field eval="&quot;&quot;&quot;object.state in ('draft', 'confirmed', 'cancel', 'exception', 'running', 'done', 'waiting')&quot;&quot;&quot;" name="model_states"/>
<field eval="1" name="flow_start"/>
</record>
<record id="process_node_purchaseprocure0" model="process.node">
<field name="menu_id" ref="mrp.menu_mrp_procurement_action"/>
<field name="model_id" ref="mrp.model_mrp_procurement"/>
<field name="model_id" ref="mrp.model_procurement_order"/>
<field eval="&quot;&quot;&quot;subflow&quot;&quot;&quot;" name="kind"/>
<field eval="&quot;&quot;&quot;Procurement Orders&quot;&quot;&quot;" name="name"/>
<field eval="&quot;&quot;&quot;For purchased material&quot;&quot;&quot;" name="note"/>
<field name="subflow_id" ref="mrp_procurement.process_process_procurementprocess0"/>
<field name="subflow_id" ref="procurement.process_process_procurementprocess0"/>
<field name="process_id" ref="purchase.process_process_purchaseprocess0"/>
<field eval="1" name="flow_start"/>
</record>
<record id="process_node_productminimumstockrule0" model="process.node">
<field name="menu_id" ref="mrp.menu_action_orderpoint_form"/>
<field name="model_id" ref="mrp_procurement.model_stock_warehouse_orderpoint"/>
<field name="model_id" ref="procurement.model_stock_warehouse_orderpoint"/>
<field eval="&quot;&quot;&quot;state&quot;&quot;&quot;" name="kind"/>
<field eval="&quot;&quot;&quot;Minimum Stock&quot;&quot;&quot;" name="name"/>
<field eval="&quot;&quot;&quot;Automatic procurement rule&quot;&quot;&quot;" name="note"/>
@@ -8,7 +8,7 @@
<record id="process_process_serviceproductprocess0" model="process.process">
<field eval="&quot;&quot;&quot;Service&quot;&quot;&quot;" name="name"/>
<field name="model_id" ref="mrp.model_mrp_procurement"/>
<field name="model_id" ref="mrp.model_procurement_order"/>
<field eval="1" name="active"/>
</record>
@@ -18,7 +18,7 @@
<record id="process_node_serviceonorder0" model="process.node">
<field name="menu_id" ref="mrp.menu_mrp_procurement_action"/>
<field name="model_id" ref="mrp.model_mrp_procurement"/>
<field name="model_id" ref="mrp.model_procurement_order"/>
<field eval="&quot;&quot;&quot;state&quot;&quot;&quot;" name="kind"/>
<field eval="&quot;&quot;&quot;Assignment from Production or Purchase Order.&quot;&quot;&quot;" name="note"/>
<field eval="&quot;&quot;&quot;Make to Order&quot;&quot;&quot;" name="name"/>
@@ -29,7 +29,7 @@
<record id="process_node_servicemts0" model="process.node">
<field name="menu_id" ref="mrp.menu_mrp_procurement_action"/>
<field name="model_id" ref="mrp.model_mrp_procurement"/>
<field name="model_id" ref="mrp.model_procurement_order"/>
<field eval="&quot;&quot;&quot;state&quot;&quot;&quot;" name="kind"/>
<field eval="&quot;&quot;&quot;Assignment from stock.&quot;&quot;&quot;" name="note"/>
<field eval="&quot;&quot;&quot;Make to stock&quot;&quot;&quot;" name="name"/>
@@ -8,7 +8,7 @@
<record id="process_process_stockableproductprocess0" model="process.process">
<field eval="&quot;&quot;&quot;Stockable Product&quot;&quot;&quot;" name="name"/>
<field name="model_id" ref="mrp.model_mrp_procurement"/>
<field name="model_id" ref="mrp.model_procurement_order"/>
<field eval="1" name="active"/>
</record>
@@ -18,7 +18,7 @@
<record id="process_node_mts0" model="process.node">
<field name="menu_id" ref="mrp.menu_mrp_procurement_action"/>
<field name="model_id" ref="mrp.model_mrp_procurement"/>
<field name="model_id" ref="mrp.model_procurement_order"/>
<field eval="&quot;&quot;&quot;state&quot;&quot;&quot;" name="kind"/>
<field eval="&quot;&quot;&quot;Assignment from stock.&quot;&quot;&quot;" name="note"/>
<field eval="&quot;&quot;&quot;Make to Stock&quot;&quot;&quot;" name="name"/>
@@ -29,7 +29,7 @@
<record id="process_node_stock0" model="process.node">
<field name="menu_id" ref="mrp.menu_mrp_procurement_action"/>
<field name="model_id" ref="mrp.model_mrp_procurement"/>
<field name="model_id" ref="mrp.model_procurement_order"/>
<field eval="&quot;&quot;&quot;state&quot;&quot;&quot;" name="kind"/>
<field eval="&quot;&quot;&quot;Assignment from Production or Purchase Order.&quot;&quot;&quot;" name="note"/>
<field eval="&quot;&quot;&quot;Make to Order&quot;&quot;&quot;" name="name"/>
@@ -27,17 +27,20 @@ import ir
import netsvc
import time
class mrp_procurement(osv.osv):
_inherit = 'mrp.procurement'
class procurement_order(osv.osv):
_inherit = 'procurement.order'
_columns = {
'bom_id': fields.many2one('mrp.bom', 'BoM', ondelete='cascade', select=True),
}
def check_produce_product(self, cr, uid, procurement, context=[]):
""" Finds the bill of material for the product from procurement order.
@return: True or False
"""
properties = [x.id for x in procurement.property_ids]
bom_id = self.pool.get('mrp.bom')._bom_find(cr, uid, procurement.product_id.id, procurement.product_uom.id, properties)
if not bom_id:
cr.execute('update mrp_procurement set message=%s where id=%s', (_('No BoM defined for this product !'), procurement.id))
cr.execute('update procurement_order set message=%s where id=%s', (_('No BoM defined for this product !'), procurement.id))
return False
return True
@@ -45,7 +48,7 @@ class mrp_procurement(osv.osv):
""" This is action which call from workflow to assign production order to procurements
@return: True
"""
procurement_obj = self.pool.get('mrp.procurement')
procurement_obj = self.pool.get('procurement.order')
res = procurement_obj.make_mo(cr, uid, ids, context=context)
res = res.values()
return len(res) and res[0] or 0 #TO CHECK: why workflow is generated error if return not integer value
@@ -59,7 +62,7 @@ class mrp_procurement(osv.osv):
production_obj = self.pool.get('mrp.production')
move_obj = self.pool.get('stock.move')
wf_service = netsvc.LocalService("workflow")
procurement_obj = self.pool.get('mrp.procurement')
procurement_obj = self.pool.get('procurement.order')
for procurement in procurement_obj.browse(cr, uid, ids):
res_id = procurement.move_id.id
loc_id = procurement.location_id.id
@@ -88,6 +91,6 @@ class mrp_procurement(osv.osv):
{'location_id': procurement.location_id.id})
return res
mrp_procurement()
procurement_order()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

Some files were not shown because too many files have changed in this diff Show More