[MERGE] Merge with trunk addons

bzr revid: mra@mra-laptop-20100611040706-2ezapnahmnyyq342
This commit is contained in:
Mustufa Rangwala 2010-06-11 09:37:06 +05:30
commit 9134be65e6
208 changed files with 3793 additions and 1706 deletions

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

View File

@ -36,7 +36,7 @@
* My Latest Objects (list)
* My Latest Deposits (list)
* Objects Statistics (list)
* My Objects By Day (list)
* My Objects By Day (list)
""",
'author': 'Tiny',
'depends': ['base', 'account', 'hr_attendance'],
@ -59,13 +59,13 @@
# 'wizard/auction_aie_send_result_view.xml',
'wizard/auction_lots_buyer_map_view.xml',
# 'wizard/auction_lots_numerotate_view.xml',
'auction_view.xml',
'auction_report.xml',
'auction_wizard.xml',
'board_auction_view.xml',
'board_auction_manager_view.xml',
],
'demo_xml': ['auction_demo.xml','board_auction_demo.xml'],
'installable': True,

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

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

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!')

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!')

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 -->

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

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"

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"

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:

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:

View File

@ -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>

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 users 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 users ID for security checks,
@ -177,11 +177,11 @@ class crm_case(object):
@param uid: the current users 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 users 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()

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">

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>

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">

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

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

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

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 = {}

View File

@ -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',

View File

@ -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"/>

View File

@ -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:

View File

@ -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>

View File

@ -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"/>

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

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"

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

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"

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

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"

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

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
@ -34,7 +35,7 @@ _intervalTypes = {
'years': lambda interval: relativedelta(years=interval),
}
class marketing_campaign(osv.osv): #{{{
class marketing_campaign(osv.osv):
_name = "marketing.campaign"
_description = "Marketing Campaign"
@ -42,12 +43,16 @@ class marketing_campaign(osv.osv): #{{{
'name': fields.char('Name', size=64, 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'),
@ -56,7 +61,7 @@ class marketing_campaign(osv.osv): #{{{
'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',
@ -66,15 +71,12 @@ class marketing_campaign(osv.osv): #{{{
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
@ -83,16 +85,16 @@ class marketing_campaign(osv.osv): #{{{
[('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"
@ -104,17 +106,17 @@ class marketing_campaign_segment(osv.osv): #{{{
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'),
'date_run': fields.datetime('Launching Date'),
'date_done': fields.datetime('End Date'),
}
_defaults = {
@ -128,69 +130,73 @@ class marketing_campaign_segment(osv.osv): #{{{
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')
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):
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)])
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})
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',
@ -198,16 +204,15 @@ class marketing_campaign_activity(osv.osv): #{{{
'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"),
'start': fields.boolean('Start',help= "This activity is launched when the campaign starts."),
'condition': fields.char('Condition', size=256, required=True,
help="Condition that is to be tested before \
action is executed"),
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_directory_id': fields.many2one('document.directory','Directory',
@ -226,13 +231,19 @@ class marketing_campaign_activity(osv.osv): #{{{
'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,
context=None, count=False):
@ -248,58 +259,65 @@ class marketing_campaign_activity(osv.osv): #{{{
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)
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
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_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)
#???
#Create partly the mail and later update attachments
mail_id = self.pool.get('email_template.mailbox').create(cr, uid, vals, context)
return True
marketing_campaign_activity()#}}}
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"
@ -313,7 +331,7 @@ class marketing_campaign_transition(osv.osv): #{{{
'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,
@ -322,9 +340,9 @@ class marketing_campaign_transition(osv.osv): #{{{
value[context['type_id']] = context['activity_id']
return value
marketing_campaign_transition() #}}}
marketing_campaign_transition()
class marketing_campaign_workitem(osv.osv): #{{{
class marketing_campaign_workitem(osv.osv):
_name = "marketing.campaign.workitem"
_description = "Campaign Workitem"
@ -352,7 +370,7 @@ class marketing_campaign_workitem(osv.osv): #{{{
'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),
'partner_id': fields.many2one('res.partner', 'Partner'),
'state': fields.selection([('todo', 'ToDo'), ('inprogress', 'In Progress'),
('exception', 'Exception'), ('done', 'Done'),
('cancelled', 'Cancelled')], 'State'),
@ -365,33 +383,32 @@ class marketing_campaign_workitem(osv.osv): #{{{
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,
@ -403,14 +420,11 @@ 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 :
@ -418,13 +432,23 @@ class marketing_campaign_workitem(osv.osv): #{{{
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"
@ -434,9 +458,7 @@ class email_template(osv.osv):
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 = {}
@ -447,5 +469,4 @@ class report_xml(osv.osv):
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:

View File

@ -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>

View File

@ -154,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" />
<!--
@ -181,9 +181,11 @@
<field name="object_id" invisible="1" readonly="True"/>
</group>
<group colspan="2" col="2">
<separator string="Synchronization" colspan="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"/>
@ -194,8 +196,8 @@
<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>
@ -209,9 +211,8 @@
<tree string="Segments">
<field name="name"/>
<field name="campaign_id"/>
<field name="object_id"/>
<field name="date_run"/>
<field name="date_done"/>
<field name="sync_last_date"/>
<field name="state" />
</tree>
</field>
@ -223,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"/>
@ -242,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>
@ -250,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" />
@ -393,7 +394,7 @@
<separator string="Date" colspan="2"/>
<field name="date"/>
<label string="" colspan="1"/>
<button string="Preview" states="todo" name="preview" icon="gtk-apply"/>
<button string="Preview" states="todo" name="preview" icon="gtk-apply" type="object"/>
</group>
</group>
<separator string="Status" colspan="4"/>
@ -445,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>

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:

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.
@ -82,7 +82,7 @@
'report/mrp_production_order_view.xml',
'board_manufacturing_view.xml',
],
'demo_xml': ['mrp_demo.xml', 'mrp_order_point.xml','board_manufacturing_demo.xml'],
'test': [

View File

@ -16,6 +16,7 @@
<action colspan="4" height="200" name="%(mrp.mrp_production_action2)d" string="Next production orders" width="510"/>
<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>
<child2>
<action colspan="4" name="%(mrp.action_report_workcenter_load_tree)d" string="Work Center future load"/>

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

View File

@ -247,7 +247,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 = {
@ -823,7 +809,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:
@ -917,7 +903,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'})

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>

View File

@ -255,12 +255,12 @@
<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">

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>

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"/>

View File

@ -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"/>

View File

@ -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"/>

View File

@ -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:

View File

@ -26,30 +26,6 @@ from tools.translate import _
class product_product(osv.osv):
_inherit = "product.product"
def get_product_accounts(self, cr, uid, product_id, context={}):
""" To get the stock input account, stock output account and stock journal related to product.
@param product_id: product id
@return: dictionary which contains information regarding stock input account, stock output account and stock journal
"""
product_obj = self.pool.get('product.product').browse(cr, uid, product_id, False)
stock_input_acc = product_obj.property_stock_account_input and product_obj.property_stock_account_input.id or False
if not stock_input_acc:
stock_input_acc = product_obj.categ_id.property_stock_account_input_categ and product_obj.categ_id.property_stock_account_input_categ.id or False
stock_output_acc = product_obj.property_stock_account_output and product_obj.property_stock_account_output.id or False
if not stock_output_acc:
stock_output_acc = product_obj.categ_id.property_stock_account_output_categ and product_obj.categ_id.property_stock_account_output_categ.id or False
journal_id = product_obj.categ_id.property_stock_journal and product_obj.categ_id.property_stock_journal.id or False
res = {}
res.update({'stock_account_input': stock_input_acc})
res.update({'stock_account_output': stock_output_acc})
res.update({'stock_journal': journal_id})
return res
def do_change_standard_price(self, cr, uid, ids, datas, context={}):
""" Changes the Standard Price of Product and parent products and creates an account move accordingly.
@param datas: dict. contain default datas like new_price, stock_output_account, stock_input_account, stock_journal

View File

@ -265,10 +265,10 @@
<para style="terp_default_Centre_8">[[ formatLang(o.date_planned, date_time = True) ]]</para>
</td>
<td>
<para style="terp_default_Centre_8">[[ o.sale_ref or ' ' ]]</para>
<para style="terp_default_Centre_8">[[ o.sale_ref or removeParentNode('para')]]</para>
</td>
<td>
<para style="terp_default_Centre_8">[[ o.sale_name or '' ]]</para>
<para style="terp_default_Centre_8">[[ o.sale_name or removeParentNode('para') ]]</para>
</td>
</tr>
</blockTable>

View File

@ -7,7 +7,7 @@
"access_mrp_production","mrp.production","model_mrp_production","mrp.group_mrp_user",1,1,1,1
"access_mrp_production_workcenter_line","mrp.production.workcenter.line","model_mrp_production_workcenter_line","mrp.group_mrp_user",1,1,1,1
"access_mrp_production_product_line","mrp.production.product.line","model_mrp_production_product_line","mrp.group_mrp_user",1,1,1,1
"access_mrp_procurement","mrp.procurement","model_mrp_procurement","mrp.group_mrp_user",1,1,1,1
"access_procurement","procurement.order","model_procurement_order","mrp.group_mrp_user",1,1,1,1
"access_mrp_workcenter_manager","mrp.workcenter.manager","model_mrp_workcenter","mrp.group_mrp_user",1,1,1,1
"access_mrp_routing_manager","mrp.routing.manager","model_mrp_routing","mrp.group_mrp_manager",1,1,1,1
"access_mrp_routing_workcenter_manager","mrp.routing.workcenter.manager","model_mrp_routing_workcenter","mrp.group_mrp_manager",1,1,1,1
@ -22,7 +22,7 @@
"access_purchase_order_mrp_worker","purchase.order mrp_worker","purchase.model_purchase_order","mrp.group_mrp_user",1,0,0,0
"access_purchase_order_line_mrp_worker","purchase.order.line mrp_worker","purchase.model_purchase_order_line","mrp.group_mrp_user",1,0,0,0
"access_hr_timesheet_group_mrp_worker","resource.calendar mrp_worker","resource.model_resource_calendar","mrp.group_mrp_user",1,0,0,0
"access_mrp_procurement_stock_worker","mrp.procurement stock_worker","model_mrp_procurement","stock.group_stock_user",1,1,1,1
"access_procurement_stock_worker","procurement.order stock_worker","model_procurement_order","stock.group_stock_user",1,1,1,1
"access_mrp_production_stock_worker","mrp.production stock_worker","model_mrp_production","stock.group_stock_user",1,0,0,0
"access_mrp_installer","mrp.installer","model_mrp_installer","mrp.group_mrp_user",1,0,0,0
"access_mrp_product_produce","mrp.product.produce","model_mrp_product_produce","mrp.group_mrp_user",1,0,0,0

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
7 access_mrp_production mrp.production model_mrp_production mrp.group_mrp_user 1 1 1 1
8 access_mrp_production_workcenter_line mrp.production.workcenter.line model_mrp_production_workcenter_line mrp.group_mrp_user 1 1 1 1
9 access_mrp_production_product_line mrp.production.product.line model_mrp_production_product_line mrp.group_mrp_user 1 1 1 1
10 access_mrp_procurement access_procurement mrp.procurement procurement.order model_mrp_procurement model_procurement_order mrp.group_mrp_user 1 1 1 1
11 access_mrp_workcenter_manager mrp.workcenter.manager model_mrp_workcenter mrp.group_mrp_user 1 1 1 1
12 access_mrp_routing_manager mrp.routing.manager model_mrp_routing mrp.group_mrp_manager 1 1 1 1
13 access_mrp_routing_workcenter_manager mrp.routing.workcenter.manager model_mrp_routing_workcenter mrp.group_mrp_manager 1 1 1 1
22 access_purchase_order_mrp_worker purchase.order mrp_worker purchase.model_purchase_order mrp.group_mrp_user 1 0 0 0
23 access_purchase_order_line_mrp_worker purchase.order.line mrp_worker purchase.model_purchase_order_line mrp.group_mrp_user 1 0 0 0
24 access_hr_timesheet_group_mrp_worker resource.calendar mrp_worker resource.model_resource_calendar mrp.group_mrp_user 1 0 0 0
25 access_mrp_procurement_stock_worker access_procurement_stock_worker mrp.procurement stock_worker procurement.order stock_worker model_mrp_procurement model_procurement_order stock.group_stock_user 1 1 1 1
26 access_mrp_production_stock_worker mrp.production stock_worker model_mrp_production stock.group_stock_user 1 0 0 0
27 access_mrp_installer mrp.installer model_mrp_installer mrp.group_mrp_user 1 0 0 0
28 access_mrp_product_produce mrp.product.produce model_mrp_product_produce mrp.group_mrp_user 1 0 0 0

View File

@ -28,82 +28,12 @@ import netsvc
import time
class stock_warehouse_orderpoint(osv.osv):
"""
Defines Minimum stock rules.
"""
_name = "stock.warehouse.orderpoint"
_description = "Minimum Inventory Rule"
_columns = {
'name': fields.char('Name', size=32, required=True),
'active': fields.boolean('Active', help="If the active field is set to true, it will allow you to hide the orderpoint without removing it."),
'logic': fields.selection([('max','Order to Max'),('price','Best price (not yet active!)')], 'Reordering Mode', required=True),
'warehouse_id': fields.many2one('stock.warehouse', 'Warehouse', required=True, ondelete="cascade"),
'location_id': fields.many2one('stock.location', 'Location', required=True, ondelete="cascade"),
'product_id': fields.many2one('product.product', 'Product', required=True, ondelete='cascade', domain=[('type','=','product')]),
'product_uom': fields.many2one('product.uom', 'Product UOM', required=True),
'product_min_qty': fields.float('Min Quantity', required=True,
help="When the virtual stock goes belong the Min Quantity, Open ERP generates "\
"a procurement to bring the virtual stock to the Max Quantity."),
'product_max_qty': fields.float('Max Quantity', required=True,
help="When the virtual stock goes belong the Min Quantity, Open ERP generates "\
"a procurement to bring the virtual stock to the Max Quantity."),
'qty_multiple': fields.integer('Qty Multiple', required=True,
help="The procurement quantity will by rounded up to this multiple."),
'procurement_id': fields.many2one('mrp.procurement', 'Latest procurement', ondelete="set null"),
'company_id': fields.many2one('res.company','Company',required=True),
}
_defaults = {
'active': lambda *a: 1,
'logic': lambda *a: 'max',
'qty_multiple': lambda *a: 1,
'name': lambda x,y,z,c: x.pool.get('ir.sequence').get(y,z,'mrp.warehouse.orderpoint') or '',
'product_uom': lambda sel, cr, uid, context: context.get('product_uom', False),
'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'stock.warehouse.orderpoint', context=c)
}
_sql_constraints = [
('qty_multiple_check', 'CHECK( qty_multiple > 0 )', _('Qty Multiple must be greater than zero.')),
]
def onchange_warehouse_id(self, cr, uid, ids, warehouse_id, context={}):
""" Finds location id for changed warehouse.
@param warehouse_id: Changed id of warehouse.
@return: Dictionary of values.
"""
if warehouse_id:
w = self.pool.get('stock.warehouse').browse(cr, uid, warehouse_id, context)
v = {'location_id': w.lot_stock_id.id}
return {'value': v}
return {}
def onchange_product_id(self, cr, uid, ids, product_id, context={}):
""" Finds UoM for changed product.
@param product_id: Changed id of product.
@return: Dictionary of values.
"""
if product_id:
prod = self.pool.get('product.product').browse(cr,uid,product_id)
v = {'product_uom': prod.uom_id.id}
return {'value': v}
return {}
def copy(self, cr, uid, id, default=None,context={}):
if not default:
default = {}
default.update({
'name': self.pool.get('ir.sequence').get(cr, uid, 'mrp.warehouse.orderpoint') or '',
})
return super(stock_warehouse_orderpoint, self).copy(cr, uid, id, default, context)
stock_warehouse_orderpoint()
class StockMove(osv.osv):
_inherit = 'stock.move'
_columns = {
'production_id': fields.many2one('mrp.production', 'Production', select=True),
'procurements': fields.one2many('mrp.procurement', 'move_id', 'Procurements'),
'procurements': fields.one2many('procurement.order', 'move_id', 'Procurements'),
}
def copy(self, cr, uid, id, default=None, context=None):
@ -118,7 +48,7 @@ class StockMove(osv.osv):
"""
bom_obj = self.pool.get('mrp.bom')
move_obj = self.pool.get('stock.move')
procurement_obj = self.pool.get('mrp.procurement')
procurement_obj = self.pool.get('procurement.order')
product_obj = self.pool.get('product.product')
wf_service = netsvc.LocalService("workflow")
if move.product_id.supply_method == 'produce' and move.product_id.procure_method == 'make_to_order':
@ -166,7 +96,7 @@ class StockMove(osv.osv):
'move_id': mid,
'company_id': line['company_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)
move_obj.write(cr, uid, [move.id], {
'location_id': move.location_dest_id.id,
'auto_validate': True,
@ -175,7 +105,7 @@ class StockMove(osv.osv):
'state': 'waiting'
})
for m in procurement_obj.search(cr, uid, [('move_id','=',move.id)], context):
wf_service.trg_validate(uid, 'mrp.procurement', m, 'button_wait_done', cr)
wf_service.trg_validate(uid, 'procurement.order', m, 'button_wait_done', cr)
return True
def action_consume(self, cr, uid, ids, product_qty, location_id=False, context=None):
@ -231,7 +161,7 @@ class StockPicking(osv.osv):
for move in picking.move_lines:
if move.state == 'done' and move.procurements:
for procurement in move.procurements:
wf_service.trg_validate(user, 'mrp.procurement',
wf_service.trg_validate(user, 'procurement.order',
procurement.id, 'button_check', cursor)
return res

View File

@ -9,6 +9,8 @@
factor: 1.0
name: Litre
rounding: 0.01
-
I create record for product Orange Juice.
-
!record {model: product.product, id: product_product_orangejuice0}:
categ_id: product.cat1
@ -18,6 +20,8 @@
type: product
uom_id: product_uom_litre0
uom_po_id: product_uom_litre0
-
I create record for product Orange.
-
!record {model: product.product, id: product_product_orange0}:
categ_id: product.cat1
@ -31,6 +35,8 @@
type: product
uom_id: product.product_uom_kgm
uom_po_id: product.product_uom_kgm
-
I create record for product Sugar.
-
!record {model: product.product, id: product_product_sugar0}:
categ_id: product.cat1
@ -44,6 +50,8 @@
type: product
uom_id: product.product_uom_kgm
uom_po_id: product.product_uom_kgm
-
I create record for product Water.
-
!record {model: product.product, id: product_product_water0}:
categ_id: product.cat1
@ -54,7 +62,7 @@
uom_id: product_uom_litre0
uom_po_id: product_uom_litre0
-
I define the BoM to produce an orange juice
I define the BoM to produce an orange juice.
-
!record {model: mrp.bom, id: mrp_bom_orangejuice0}:
company_id: base.main_company
@ -64,6 +72,8 @@
product_qty: 1.0
product_uom: product_uom_litre0
type: phantom
-
I create bom lines for BoM for Orange Juice.
-
!record {model: mrp.bom, id: mrp_bom_orangejuice0}:
bom_lines:
@ -92,7 +102,7 @@
product_uom: product_uom_litre0
type: normal
-
I define Minimum stock rules for my stockable products orange and sugar
I define Minimum stock rules for my stockable product "Orange".
-
!record {model: stock.warehouse.orderpoint, id: stock_warehouse_orderpoint_op0}:
company_id: base.main_company
@ -105,6 +115,8 @@
product_uom: product.product_uom_kgm
qty_multiple: 1
warehouse_id: stock.warehouse0
-
I define Minimum stock rules for my stockable product "Sugar".
-
!record {model: stock.warehouse.orderpoint, id: stock_warehouse_orderpoint_op1}:
company_id: base.main_company
@ -168,23 +180,23 @@
-
I am checking Procurement orders. There are 3 orders generated for Oranges, Sugar and Water.
-
!python {model: mrp.procurement}: |
!python {model: procurement.order}: |
from tools.translate import _
proc_ids = self.search(cr, uid, [('state','!=','cofirmed')])
assert proc_ids, _('No Procurements!')
-
The scheduler runs.
-
!function {model: mrp.procurement, name: run_scheduler}:
- model: mrp.procurement
search: "[('origin','=',':MO/00002')]"
!function {model: procurement.order, name: run_scheduler}:
- model: procurement.order
search: "[('state','!=','cofirmed')]"
-
I am checking Internal picking. I see one picking for Orange juice and its
stock moves for Oranges, Sugar and Water made correctly.
-
!python {model: stock.picking}: |
from tools.translate import _
pick_ids = self.search(cr, uid, [('origin','=',':MO/00002'),('type','=','internal')])
pick_ids = self.search(cr, uid, [('type','=','internal')])
assert pick_ids, _('No Internal Pickings!')
-
According to minimum stock rules. I have 2 purchase orders for
@ -220,11 +232,15 @@
assert pick_ids, _('No Incoming Shipments found!')
-
I receive both the products. My incoming pickings are done.
-
I create record for the incoming picking wizard.
-
!record {model: stock.partial.picking, id: stock_partial_picking0}:
date: '2010-04-30 16:53:36'
partner_id: base.res_partner_asus
address_id: base.res_partner_address_tang
-
I make my pickings done.
-
!python {model: stock.partial.picking}: |
pick_obj = self.pool.get('stock.picking')

View File

@ -4,7 +4,7 @@
-
I am creating products.
-
Creating a product.product record
I create record for product Shirt.
-
!record {model: product.product, id: product_product_shirt0}:
categ_id: product.cat1
@ -27,7 +27,7 @@
weight: 0.0
weight_net: 0.0
-
Creating a product.product record
I create record for product Cloth.
-
!record {model: product.product, id: product_product_cloth0}:
categ_id: product.cat1
@ -53,7 +53,7 @@
weight: 0.0
weight_net: 0.0
-
Creating a product.product record
I create record for product Buttons.
-
!record {model: product.product, id: product_product_buttons0}:
categ_id: product.cat1
@ -81,7 +81,7 @@
-
I am creating bills of material for 'Shirt'.
-
Creating a mrp.bom record
I create bills of material for Shirt.
-
!record {model: mrp.bom, id: mrp_bom_shirt0}:
bom_lines:
@ -129,7 +129,7 @@
-
I create a procurement order for product Shirt.
-
!record {model: mrp.procurement, id: mrp_procurement_shirt0}:
!record {model: procurement.order, id: procurement_order_shirt0}:
name: 'PROC: Shirt'
product_id: product_product_shirt0
product_qty: 5.00
@ -138,11 +138,11 @@
-
I confirm the procurement order.
-
!workflow {model: mrp.procurement, action: button_confirm, ref: mrp_procurement_shirt0}
!workflow {model: procurement.order, action: button_confirm, ref: procurement_order_shirt0}
-
I run the procurement.
-
!workflow {model: mrp.procurement, action: button_check, ref: mrp_procurement_shirt0}
!workflow {model: procurement.order, action: button_check, ref: procurement_order_shirt0}
-
I see that there is a manufacturing order for Shirt.
-
@ -153,15 +153,15 @@
-
I also check that there are two more procurement orders for sub products Cloth and Buttons.
-
!python {model: mrp.procurement}: |
!python {model: procurement.order}: |
from tools.translate import _
proc_ids = self.search(cr, uid, [('product_id','in',[ref('product_product_cloth0'),ref('product_product_buttons0')])])
assert proc_ids, 'No Procurements.'
-
The scheduler runs.
-
!function {model: mrp.procurement, name: run_scheduler}:
- model: mrp.procurement
!function {model: procurement.order, name: run_scheduler}:
- model: procurement.order
search: "[]"
-
I check that there is one purchase order for Cloth.
@ -216,11 +216,15 @@
from tools.translate import _
pick_ids = self.search(cr, uid, [('address_id.name','=','Wong'),('state','=','assigned')])
assert pick_ids, _('No Incoming Shipments found!')
-
I create record for partial picking.
-
!record {model: stock.partial.picking, id: stock_partial_picking0}:
date: '2010-04-30 16:53:36'
partner_id: base.res_partner_maxtor
address_id: base.res_partner_address_wong
-
I make my picking done.
-
!python {model: stock.partial.picking}: |
pick_obj = self.pool.get('stock.picking')
@ -245,17 +249,21 @@
})
pick_obj.do_partial(cr, uid, picking_ids, partial_datas, context=context)
-
I Check incoming shipments for buttons. And receive products.
I Check incoming shipments for buttons and receive products.
-
!python {model: stock.picking}: |
from tools.translate import _
pick_ids = self.search(cr, uid, [('address_id.name','=','Tang'),('state','=','assigned')])
assert pick_ids, _('No Incoming Shipments found!')
-
I create record for partial picking.
-
!record {model: stock.partial.picking, id: stock_partial_picking0}:
date: '2010-04-30 16:53:36'
partner_id: base.res_partner_maxtor
address_id: base.res_partner_address_wong
-
I make my picking done.
-
!python {model: stock.partial.picking}: |
pick_obj = self.pool.get('stock.picking')
@ -282,8 +290,8 @@
-
Run scheduler again.
-
!function {model: mrp.procurement, name: run_scheduler}:
- model: mrp.procurement
!function {model: procurement.order, name: run_scheduler}:
- model: procurement.order
search: "[]"
-
Check state of manufacturing order for Shirt.
@ -303,22 +311,30 @@
wf_service = netsvc.LocalService("workflow")
for p_id in prod_ids:
wf_service.trg_validate(uid, 'mrp.production', p_id, 'button_produce', cr)
-
I create record for producing products with quantity 5.00.
-
!record {model: mrp.product.produce, id: mrp_product_produce0}:
product_qty: 5.00
mode: 'consume_produce'
-
I produce 2 products with 5.00 quantities each.
-
!python {model: mrp.product.produce}: |
from tools.translate import _
prod_obj = self.pool.get('mrp.production')
prod_ids = prod_obj.search(cr, uid, [('product_id.name','=','Shirt')])
self.do_produce(cr, uid, [1], context={'active_ids': prod_ids})
-
I create record for remaining products with quantity 35.00.
-
!record {model: stock.move.consume, id: stock_move_consume0}:
product_id: product_product_buttons0
product_qty: 35.00
product_uom: product.product_uom_unit
location_id: stock.stock_location_stock
-
I produce remaining product Buttons with 35.00 quantity.
-
!python {model: stock.move.consume}: |
from tools.translate import _

View File

@ -18,7 +18,7 @@
product_uom: product.product_uom_unit
product_uos_qty: 0.0
-
Creating a mrp.production.workcenter.line record
I create a record for Workcenter line.
-
!record {model: mrp.production.workcenter.line, id: mrp_production_workcenter_line_assemblyline0}:
cycle: 5.0
@ -28,7 +28,7 @@
sequence: 0.0
workcenter_id: mrp.mrp_workcenter_0
-
Creating a mrp.production.product.line record
I create second record for Workcenter line.
-
!record {model: mrp.production.product.line, id: mrp_production_product_line_regularprocessorconfig0}:
name: Regular processor config
@ -38,7 +38,7 @@
product_uos_qty: 0.0
production_id: mrp_production_mo0
-
Creating a mrp.production.product.line record
I create third record for Workcenter line.
-
!record {model: mrp.production.product.line, id: mrp_production_product_line_hddseagategb0}:
name: HDD Seagate 7200.8 80GB
@ -48,7 +48,7 @@
product_uos_qty: 0.0
production_id: mrp_production_mo0
-
Creating a mrp.production.product.line record
I create fourth record for Workcenter line.
-
!record {model: mrp.production.product.line, id: mrp_production_product_line_atxmidsizetower0}:
name: ATX Mid-size Tower
@ -58,7 +58,7 @@
product_uos_qty: 0.0
production_id: mrp_production_mo0
-
Creating a mrp.production.product.line record
I create a record for production line.
-
!record {model: mrp.production.product.line, id: mrp_production_product_line_mouse0}:
name: Mouse
@ -68,7 +68,7 @@
product_uos_qty: 0.0
production_id: mrp_production_mo0
-
Creating a mrp.production.product.line record
I create second record for production line.
-
!record {model: mrp.production.product.line, id: mrp_production_product_line_keyboard0}:
name: Keyboard
@ -84,15 +84,15 @@
-
I am checking Procurement orders.
-
!python {model: mrp.procurement}: |
!python {model: procurement.order}: |
from tools.translate import _
proc_ids = self.search(cr, uid, [('state','!=','confirmed')])
assert proc_ids, _('No Procurements!')
-
The scheduler runs.
-
!function {model: mrp.procurement, name: run_scheduler}:
- model: mrp.procurement
!function {model: procurement.order, name: run_scheduler}:
- model: procurement.order
search: "[('state','=','confirmed')]"
-
I am checking Internal picking.
@ -102,7 +102,7 @@
pick_ids = self.search(cr, uid, [('state','!=','done'),('type','=','internal')])
assert pick_ids, _('No Internal Pickings!')
-
I see that there is a manufacturing order for the subproduct of PC1 with ready state.
I see that there is a manufacturing order for the sub product of PC1 with ready state.
-
!python {model: mrp.production}: |
from tools.translate import _
@ -110,17 +110,21 @@
assert order_ids, _('No manufacturing order!')
-
I start producing that product first. So I marked it as started.
-
I create record for producing products with quantity 5.00.
-
!record {model: mrp.product.produce, id: mrp_product_produce0}:
product_qty: 5.00
mode: 'consume_produce'
-
I produce the product.
-
!python {model: mrp.product.produce}: |
prod_obj = self.pool.get('mrp.production')
prod_ids = prod_obj.search(cr, uid, [('state','=','confirmed')])
self.do_produce(cr, uid, [1], context={'active_ids': prod_ids})
-
Now the manufacturing order for subproduct CPU_GEN is done. And manufacturing
Now the manufacturing order for subproduct CPU_GEN is done and manufacturing
order for PC1 is in ready state.
-
!python {model: mrp.production}: |
@ -131,6 +135,8 @@
I start producing the product PC1.
-
!workflow {model: mrp.production, action: button_produce, ref: mrp_production_mo0}
-
Finally my production order is done.
-
!python {model: mrp.product.produce}: |
from tools.translate import _

View File

@ -40,7 +40,7 @@
""",
'author': 'Tiny',
'depends': ['mrp_procurement'],
'depends': ['procurement'],
'update_xml': ['mrp_jit.xml'],
'demo_xml': [],
'installable': True,

View File

@ -2,7 +2,7 @@
<openerp>
<data>
<record model="workflow.transition" id="mrp_procurement.trans_confirm_confirm_wait">
<record model="workflow.transition" id="procurement.trans_confirm_confirm_wait">
<field name="signal" eval="False"/>
</record>

View File

@ -61,6 +61,7 @@
'process/mrp_operation_process.xml'
],
'demo_xml': ['mrp_operation_data.xml'],
'test': ['test/mrp_operations.yml'],
'installable': True,
'active': False,
'certificate': '0056233813133',

View File

@ -47,6 +47,9 @@ stock_move()
class mrp_production_workcenter_line(osv.osv):
def _get_date_date(self, cr, uid, ids, field_name, arg, context):
""" Finds starting date.
@return: Dictionary of values.
"""
res={}
for op in self.browse(cr, uid, ids, context=context):
if op.date_start:
@ -54,7 +57,11 @@ class mrp_production_workcenter_line(osv.osv):
else:
res[op.id]=False
return res
def _get_date_end(self, cr, uid, ids, field_name, arg, context):
""" Finds ending date.
@return: Dictionary of values.
"""
res = {}
for op in self.browse(cr, uid, ids, context=context):
res[op.id]= False
@ -66,8 +73,10 @@ class mrp_production_workcenter_line(osv.osv):
else:
res[op.id] = op.date_planned
return res
_inherit = 'mrp.production.workcenter.line'
_order = "sequence, date_planned"
_columns = {
'state': fields.selection([('draft','Draft'),('startworking', 'In Progress'),('pause','Pause'),('cancel','Canceled'),('done','Finished')],'State', readonly=True,
help="* When a work order is created it is set in 'Draft' state.\n" \
@ -90,16 +99,21 @@ class mrp_production_workcenter_line(osv.osv):
'qty':fields.related('production_id','product_qty',type='float',string='Qty',readonly=True),
'uom':fields.related('production_id','product_uom',type='many2one',relation='product.uom',string='UOM',readonly=True),
}
_defaults = {
'state': lambda *a: 'draft',
'delay': lambda *a: 0.0
}
def modify_production_order_state(self,cr,uid,ids,action):
def modify_production_order_state(self, cr, uid, ids, action):
""" Modifies production order state if work order state is changed.
@param action: Action to perform.
@return: Nothing
"""
wf_service = netsvc.LocalService("workflow")
oper_obj=self.browse(cr,uid,ids)[0]
prod_obj=oper_obj.production_id
if action=='start':
oper_obj = self.browse(cr, uid, ids)[0]
prod_obj = oper_obj.production_id
if action == 'start':
if prod_obj.state =='confirmed':
self.pool.get('mrp.production').force_production(cr, uid, [prod_obj.id])
wf_service.trg_validate(uid, 'mrp.production', prod_obj.id, 'button_produce', cr)
@ -110,12 +124,12 @@ class mrp_production_workcenter_line(osv.osv):
else:
raise osv.except_osv(_('Error!'),_('Production Order Cannot start in [%s] state') % (prod_obj.state,))
else:
oper_ids=self.search(cr,uid,[('production_id','=',prod_obj.id)])
obj=self.browse(cr,uid,oper_ids)
flag=True
oper_ids = self.search(cr,uid,[('production_id','=',prod_obj.id)])
obj = self.browse(cr,uid,oper_ids)
flag = True
for line in obj:
if line.state!='done':
flag=False
if line.state != 'done':
flag = False
if flag:
wf_service.trg_validate(uid, 'mrp.production', oper_obj.production_id.id, 'button_produce_done', cr)
return
@ -132,15 +146,24 @@ class mrp_production_workcenter_line(osv.osv):
return result
def action_draft(self, cr, uid, ids):
""" Sets state to draft.
@return: True
"""
self.write(cr, uid, ids, {'state':'draft'})
return True
def action_start_working(self, cr, uid, ids):
self.modify_production_order_state(cr,uid,ids,'start')
""" Sets state to start working and writes starting date.
@return: True
"""
self.modify_production_order_state(cr, uid, ids, 'start')
self.write(cr, uid, ids, {'state':'startworking', 'date_start': time.strftime('%Y-%m-%d %H:%M:%S')})
return True
def action_done(self, cr, uid, ids):
""" Sets state to done, writes finish date and calculates delay.
@return: True
"""
delay = 0.0
date_now = time.strftime('%Y-%m-%d %H:%M:%S')
obj_line = self.browse(cr, uid, ids[0])
@ -155,14 +178,23 @@ class mrp_production_workcenter_line(osv.osv):
return True
def action_cancel(self, cr, uid, ids):
""" Sets state to cancel.
@return: True
"""
self.write(cr, uid, ids, {'state':'cancel'})
return True
def action_pause(self, cr, uid, ids):
""" Sets state to pause.
@return: True
"""
self.write(cr, uid, ids, {'state':'pause'})
return True
def action_resume(self, cr, uid, ids):
""" Sets state to startworking.
@return: True
"""
self.write(cr, uid, ids, {'state':'startworking'})
return True
@ -175,6 +207,9 @@ class mrp_production(osv.osv):
}
def _production_date_end(self, cr, uid, ids, prop, unknow_none, context={}):
""" Calculates planned end date of production order.
@return: Dictionary of values
"""
result = {}
for prod in self.browse(cr, uid, ids, context=context):
result[prod.id] = prod.date_planned
@ -183,10 +218,13 @@ class mrp_production(osv.osv):
return result
def action_production_end(self, cr, uid, ids):
obj=self.browse(cr,uid,ids)[0]
""" Finishes work order if production order is done.
@return: Super method
"""
obj = self.browse(cr, uid, ids)[0]
for workcenter_line in obj.workcenter_lines:
tmp = self.pool.get('mrp.production.workcenter.line').action_done(cr,uid,[workcenter_line.id])
return super(mrp_production,self).action_production_end(cr,uid,ids)
tmp = self.pool.get('mrp.production.workcenter.line').action_done(cr, uid, [workcenter_line.id])
return super(mrp_production,self).action_production_end(cr, uid, ids)
def action_in_production(self, cr, uid, ids):
""" Changes state to In Production and writes starting date.
@ -199,12 +237,18 @@ class mrp_production(osv.osv):
return super(mrp_production,self).action_in_production(cr, uid, ids)
def action_cancel(self, cr, uid, ids):
obj=self.browse(cr,uid,ids)[0]
""" Cancels work order if production order is canceled.
@return: Super method
"""
obj = self.browse(cr, uid, ids)[0]
for workcenter_line in obj.workcenter_lines:
tmp=self.pool.get('mrp.production.workcenter.line').action_cancel(cr,uid,[workcenter_line.id])
tmp = self.pool.get('mrp.production.workcenter.line').action_cancel(cr, uid, [workcenter_line.id])
return super(mrp_production,self).action_cancel(cr,uid,ids)
def _compute_planned_workcenter(self, cr, uid, ids, context={}, mini=False):
""" Computes planned and finished dates for work order.
@return: Calculated date
"""
dt_end = DateTime.now()
for po in self.browse(cr, uid, ids, context=context):
dt_end = DateTime.strptime(po.date_start or po.date_planned, '%Y-%m-%d %H:%M:%S')
@ -241,6 +285,9 @@ class mrp_production(osv.osv):
return dt_end
def _move_pass(self, cr, uid, ids, context={}):
""" Calculates start date for stock moves finding interval from resource calendar.
@return: True
"""
for po in self.browse(cr, uid, ids, context):
if po.allow_reorder:
continue
@ -251,7 +298,7 @@ class mrp_production(osv.osv):
if l.state in ('done','cancel','draft'):
continue
todo += l.move_dest_id_lines
if l.production_id and (l.production_id.date_finnished>dt):
if l.production_id and (l.production_id.date_finnished > dt):
if l.production_id.state not in ('done','cancel'):
for wc in l.production_id.workcenter_lines:
i = self.pool.get('resource.calendar').interval_min_get(
@ -261,11 +308,14 @@ class mrp_production(osv.osv):
dt, wc.hour or 0.0
)
dt = i[0][0]
if l.production_id.date_start>dt.strftime('%Y-%m-%d %H:%M:%S'):
if l.production_id.date_start > dt.strftime('%Y-%m-%d %H:%M:%S'):
self.write(cr, uid, [l.production_id.id], {'date_start':dt.strftime('%Y-%m-%d %H:%M:%S')}, mini=True)
return True
def _move_futur(self, cr, uid, ids, context={}):
""" Calculates start date for stock moves.
@return: True
"""
for po in self.browse(cr, uid, ids, context):
if po.allow_reorder:
continue
@ -277,8 +327,8 @@ class mrp_production(osv.osv):
break
if l.production_id.state in ('done','cancel'):
break
if l.production_id and (l.production_id.date_start<po.date_finnished):
self.write(cr, uid, [l.production_id.id], {'date_start':po.date_finnished})
if l.production_id and (l.production_id.date_start < po.date_finnished):
self.write(cr, uid, [l.production_id.id], {'date_start': po.date_finnished})
break
@ -291,17 +341,21 @@ class mrp_production(osv.osv):
if (vals.get('workcenter_lines', False) or vals.get('date_start', False)) and update:
self._compute_planned_workcenter(cr, uid, ids, context=context, mini=mini)
for d in direction:
if direction[d]==1:
if direction[d] == 1:
# the production order has been moved to the passed
self._move_pass(cr, uid, [d], context=context)
pass
elif direction[d]==-1:
elif direction[d] == -1:
self._move_futur(cr, uid, [d], context=context)
# the production order has been moved to the future
pass
return result
def action_compute(self, cr, uid, ids, properties=[]):
""" Computes bills of material of a product and planned date of work order.
@param properties: List containing dictionaries of properties.
@return: No. of products.
"""
result = super(mrp_production, self).action_compute(cr, uid, ids, properties=properties)
self._compute_planned_workcenter(cr, uid, ids, context={})
return result
@ -321,25 +375,34 @@ class mrp_operations_operation(osv.osv):
_name="mrp_operations.operation"
def _order_date_search_production(self, cr, uid, ids, context=None):
operation_ids=self.pool.get('mrp_operations.operation').search(cr, uid, [('production_id','=',ids[0])], context=context)
""" Finds operations for a production order.
@return: List of ids
"""
operation_ids = self.pool.get('mrp_operations.operation').search(cr, uid, [('production_id','=',ids[0])], context=context)
return operation_ids
def _get_order_date(self, cr, uid, ids, field_name, arg, context):
""" Calculates planned date for an operation.
@return: Dictionary of values
"""
res={}
operation_obj=self.browse(cr, uid, ids, context=context)
operation_obj = self.browse(cr, uid, ids, context=context)
for operation in operation_obj:
res[operation.id]=operation.production_id.date_planned
res[operation.id] = operation.production_id.date_planned
return res
def calc_delay(self,cr,uid,vals):
code_lst=[]
time_lst=[]
def calc_delay(self, cr, uid, vals):
""" Calculates delay of work order.
@return: Delay
"""
code_lst = []
time_lst = []
code_ids=self.pool.get('mrp_operations.operation.code').search(cr,uid,[('id','=',vals['code_id'])])
code=self.pool.get('mrp_operations.operation.code').browse(cr,uid,code_ids)[0]
code_ids = self.pool.get('mrp_operations.operation.code').search(cr, uid, [('id','=',vals['code_id'])])
code = self.pool.get('mrp_operations.operation.code').browse(cr, uid, code_ids)[0]
oper_ids=self.search(cr,uid,[('production_id','=',vals['production_id']),('workcenter_id','=',vals['workcenter_id'])])
oper_objs=self.browse(cr,uid,oper_ids)
oper_ids = self.search(cr,uid,[('production_id','=',vals['production_id']),('workcenter_id','=',vals['workcenter_id'])])
oper_objs = self.browse(cr,uid,oper_ids)
for oper in oper_objs:
code_lst.append(oper.code_id.start_stop)
@ -349,7 +412,7 @@ class mrp_operations_operation(osv.osv):
time_lst.append(vals['date_start'])
diff = 0
for i in range(0,len(code_lst)):
if code_lst[i]=='pause' or code_lst[i]=='done' or code_lst[i]=='cancel':
if code_lst[i] == 'pause' or code_lst[i] == 'done' or code_lst[i] == 'cancel':
if not i: continue
if code_lst[i-1] not in ('resume','start'):
continue
@ -359,7 +422,11 @@ class mrp_operations_operation(osv.osv):
diff += (b-a).seconds / float(60*60)
return diff
def check_operation(self,cr,uid,vals):
def check_operation(self, cr, uid, vals):
""" Finds which operation is called ie. start, pause, done, cancel.
@param vals: Dictionary of values.
@return: True or False
"""
code_ids=self.pool.get('mrp_operations.operation.code').search(cr,uid,[('id','=',vals['code_id'])])
code=self.pool.get('mrp_operations.operation.code').browse(cr,uid,code_ids)[0]
code_lst = []

View File

@ -0,0 +1,151 @@
-
In order to test mrp_operations module in OpenERP I will put a Production order
and check its effects on Work orders.
-
I create a production order.
-
!record {model: mrp.production, id: mrp_production_mo0}:
company_id: base.main_company
date_planned: '2010-05-25 11:17:34'
location_dest_id: stock.stock_location_stock
location_src_id: stock.stock_location_stock
name: MO/00002
product_id: product.product_product_pc1
product_qty: 5.0
product_uom: product.product_uom_unit
product_uos_qty: 0.0
-
I am computing the data.
-
!python {model: mrp.production}: |
self.action_compute(cr, uid, [ref("mrp_production_mo0")], {"lang": "en_US", "tz":
False, "search_default_current": 1, "active_model": "ir.ui.menu", "active_ids":
[ref("mrp.menu_mrp_production_action")], "active_id": ref("mrp.menu_mrp_production_action"),
})
-
Now I confirm my production order.
-
!workflow {model: mrp.production, action: button_confirm, ref: mrp_production_mo0}
-
I check that there is one Work order generated related to my production order.
-
!python {model: mrp.production.workcenter.line}: |
from tools.translate import _
order_id = self.search(cr, uid, [('production_id','=', ref('mrp_production_mo0')),('state','=','draft')])
assert order_id, _('No Work order!')
-
I am checking Procurement orders.
-
!python {model: procurement.order}: |
from tools.translate import _
proc_ids = self.search(cr, uid, [('state','=','confirmed')])
assert proc_ids, _('No Procurements!')
-
The scheduler runs.
-
!function {model: procurement.order, name: run_scheduler}:
- model: procurement.order
search: "[('state','=','confirmed')]"
-
I am checking Internal picking.
-
!python {model: stock.picking}: |
from tools.translate import _
pick_ids = self.search(cr, uid, [('state','!=','done'),('type','=','internal')])
assert pick_ids, _('No Internal Pickings!')
-
I see that there is a manufacturing order for the sub product CPU_GEN of PC1 with ready state.
-
!python {model: mrp.production}: |
from tools.translate import _
order_ids = self.search(cr, uid, [('state','=','ready')])
assert order_ids, _('No new manufacturing order!')
-
I check that there one more work order created for new production order.
-
!python {model: mrp.production.workcenter.line}: |
from tools.translate import _
prod_obj = self.pool.get('mrp.production')
prod_order_ids = prod_obj.search(cr, uid, [('state','=','ready')])
workorder_id = self.search(cr, uid, [('production_id','=', prod_order_ids[0]),('state','=','draft')])
assert workorder_id, _('No Work order!')
-
I start the second production order of the CPU_GEN product.
-
!python {model: mrp.production}: |
import netsvc
wf_service = netsvc.LocalService("workflow")
prod_order_ids = self.search(cr, uid, [('state','=','ready')])
for po in prod_order_ids:
wf_service.trg_validate(uid, 'mrp.production', po, 'button_produce', cr)
-
I am creating a mrp.product.produce record
-
!record {model: mrp.product.produce, id: mrp_product_produce_0}:
mode: consume_produce
product_qty: 5.0
-
I produce the product CPU_GEN.
-
!python {model: mrp.product.produce}: |
prod_obj = self.pool.get('mrp.production')
prod_order_ids = prod_obj.search(cr, uid, [('state','=','in_production')])
self.do_produce(cr, uid, [ref("mrp_product_produce_0")], {"lang": "en_US", "tz":
False, "search_default_current": 1, "active_model": "mrp.production", "active_ids":
prod_order_ids, "active_id": prod_order_ids[0], })
-
I check that my production order and its related work order is in done state.
-
!python {model: mrp.production.workcenter.line}: |
from tools.translate import _
prod_obj = self.pool.get('mrp.production')
prod_order_ids = prod_obj.search(cr, uid, [('state','=','done')])
workorder_id = self.search(cr, uid, [('production_id','=', prod_order_ids[0]),('state','=','done')])
assert workorder_id, _('Work order is not done!')
-
Now I check my original production order is now ready.
-
!python {model: mrp.production}: |
from tools.translate import _
prod_ids = self.search(cr, uid, [('id','=',ref('mrp_production_mo0')),('state','=','ready')])
assert prod_ids, _('Production order is not ready!')
-
I check that both internal pickings are done.
-
!python {model: stock.picking}: |
from tools.translate import _
pick_ids = self.search(cr, uid, [('state','=','done'),('type','=','internal')])
assert pick_ids, _('Internal pickings are not done!')
-
Now I start my first production order.
-
!workflow {model: mrp.production, action: button_produce, ref: mrp_production_mo0}
-
I check that the related work order is in progress state.
-
!python {model: mrp.production.workcenter.line}: |
from tools.translate import _
order_id = self.search(cr, uid, [('production_id','=', ref('mrp_production_mo0')),('state','=','startworking')])
assert order_id, _('Work order not started yet!')
-
I am creating a mrp.product.produce record.
-
!record {model: mrp.product.produce, id: mrp_product_produce_0}:
mode: consume_produce
product_qty: 5.0
-
I produce the product PC1.
-
!python {model: mrp.product.produce}: |
prod_obj = self.pool.get('mrp.production')
prod_order_ids = prod_obj.search(cr, uid, [('state','=','in_production')])
self.do_produce(cr, uid, [ref("mrp_product_produce_0")], {"lang": "en_US", "tz":
False, "search_default_current": 1, "active_model": "mrp.production", "active_ids":
[ref("mrp_production_mo0")], "active_id": ref("mrp_production_mo0"), })
-
I check the related work order is done.
-
!python {model: mrp.production.workcenter.line}: |
from tools.translate import _
order_id = self.search(cr, uid, [('production_id','=', ref('mrp_production_mo0')),('state','=','done')])
assert order_id, _('Work order not done yet!')

View File

@ -44,7 +44,7 @@ class repair_cancel(osv.osv_memory):
if repair_order.invoiced or repair_order.invoice_method == 'none':
repair_order_obj.action_cancel(cr, uid, [record_id], context=context)
else:
raise osv.except_osv(_('Warning!'),_('Repair is not cancelled. It is not invoiced.'))
raise osv.except_osv(_('Warning!'),_('Repair order is not invoiced.'))
return {}

View File

@ -35,10 +35,15 @@ class mrp_subproduct(osv.osv):
_defaults={
'subproduct_type': lambda *args: 'fixed'
}
def onchange_product_id(self, cr, uid, ids, product_id,context={}):
""" Changes UoM if product_id changes.
@param product_id: Changed product_id
@return: Dictionary of changed values
"""
if product_id:
prod=self.pool.get('product.product').browse(cr,uid,product_id)
v = {'product_uom':prod.uom_id.id}
prod = self.pool.get('product.product').browse(cr, uid, product_id)
v = {'product_uom': prod.uom_id.id}
return {'value': v}
return {}
@ -48,6 +53,7 @@ class mrp_bom(osv.osv):
_name = 'mrp.bom'
_description = 'Bill of Material'
_inherit='mrp.bom'
_columns={
'sub_products':fields.one2many('mrp.subproduct', 'bom_id', 'sub_products'),
}
@ -59,7 +65,10 @@ class mrp_production(osv.osv):
_inherit= 'mrp.production'
def action_confirm(self, cr, uid, ids):
picking_id=super(mrp_production,self).action_confirm(cr, uid, ids)
""" Confirms production order and calculates quantity based on subproduct_type.
@return: Newly generated picking Id.
"""
picking_id = super(mrp_production,self).action_confirm(cr, uid, ids)
for production in self.browse(cr, uid, ids):
source = production.product_id.product_tmpl_id.property_stock_production.id
if not production.bom_id:
@ -67,13 +76,13 @@ class mrp_production(osv.osv):
for sub_product in production.bom_id.sub_products:
qty1 = sub_product.product_qty
qty2 = production.product_uos and production.product_uos_qty or False
if sub_product.subproduct_type=='variable':
if sub_product.subproduct_type == 'variable':
if production.product_qty:
qty1 *= production.product_qty / (production.bom_id.product_qty or 1.0)
if production.product_uos_qty:
qty2 *= production.product_uos_qty / (production.bom_id.product_uos_qty or 1.0)
data = {
'name':'PROD:'+production.name,
'name': 'PROD:'+production.name,
'date_planned': production.date_planned,
'product_id': sub_product.product_id.id,
'product_qty': qty1,
@ -84,9 +93,9 @@ class mrp_production(osv.osv):
'location_dest_id': production.location_dest_id.id,
'move_dest_id': production.move_prod_id.id,
'state': 'waiting',
'production_id':production.id
'production_id': production.id
}
sub_prod_ids=self.pool.get('stock.move').create(cr, uid,data)
sub_prod_ids = self.pool.get('stock.move').create(cr, uid, data)
return picking_id
mrp_production()

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: olap

View File

@ -23,7 +23,6 @@
import pos
import account_bank_statement
import pos_account_bank_statement
import stock
import wizard
import report

View File

@ -463,12 +463,13 @@ class pos_order(osv.osv):
"""Create a picking for each order and validate it."""
picking_obj = self.pool.get('stock.picking')
pick_name=self.pool.get('ir.sequence').get(cr, uid, 'stock.picking.out')
orders = self.browse(cr, uid, ids, context)
for order in orders:
if not order.picking_id:
new = True
picking_id = picking_obj.create(cr, uid, {
'name':pick_name,
'origin': order.name,
'type': 'out',
'state': 'draft',
@ -504,7 +505,7 @@ class pos_order(osv.osv):
if line.qty < 0:
location_id, stock_dest_id = stock_dest_id, location_id
self.pool.get('stock.move').create(cr, uid, {
self.pool.get('stock.move').create(cr, uid, {
'name': 'Stock move (POS %d)' % (order.id, ),
'product_uom': line.product_id.uom_id.id,
'product_uos': line.product_id.uom_id.id,
@ -1086,17 +1087,18 @@ class pos_order_line(osv.osv):
raise osv.except_osv(_('No Pricelist !'),
_('You have to select a pricelist in the sale form !\n' \
'Please set one before choosing a product.'))
p_obj = self.pool.get('product.product').browse(cr,uid,product_id).list_price
p_obj = self.pool.get('product.product').browse(cr,uid,[product_id])[0]
uom_id=p_obj.uom_po_id.id
price = self.pool.get('product.pricelist').price_get(cr, uid,
[pricelist], product_id, qty or 1.0, partner_id)[pricelist]
# Todo need to check
# if price is False:
# raise osv.except_osv(_('No valid pricelist line found !'),
# _("Couldn't find a pricelist line matching this product" \
# " and quantity.\nYou have to change either the product," \
# " the quantity or the pricelist."))
return price or p_obj
[pricelist], product_id, qty or 1.0, partner_id,{'uom': uom_id})[pricelist]
unit_price=price or p_obj.list_price
if unit_price is False:
raise osv.except_osv(_('No valid pricelist line found !'),
_("Couldn't find a pricelist line matching this product" \
" and quantity.\nYou have to change either the product," \
" the quantity or the pricelist."))
return unit_price
def onchange_product_id(self, cr, uid, ids, pricelist, product_id, qty=0, partner_id=False):
price = self.price_by_product(cr, uid, ids, pricelist, product_id, qty, partner_id)
self.write(cr,uid,ids,{'price_unit':price})
@ -1329,4 +1331,13 @@ class product_product(osv.osv):
'disc_controle': lambda *a: True,
}
product_product()
class stock_picking(osv.osv):
_inherit = 'stock.picking'
_columns = {
'pos_order': fields.many2one('pos.order', 'Pos order'),
}
stock_picking()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -66,7 +66,7 @@
<button name="%(action_report_pos_receipt)d" string="_Reprint" icon="gtk-print" type="action" states="paid,done,invoiced"/>
<button name="set_to_draft" string="Set to draft" states="paid" icon="gtk-execute" type="object" />
<button name="%(action_view_pos_return)d" string="Return Picking" type="action" icon="gtk-ok" states="paid"
attrs="{'invisible':[('state','!=','paid'),('state','!=','invoiced')]}"/>
attrs="{'invisible':[('state','!=','paid'),('state','!=','invoiced')]}" context="{'return':'return'}" />
</group>
</page>
@ -85,6 +85,7 @@
<field name="date_order"/>
<field name="date_validation" />
<field name="date_payment" groups="base.group_extended"/>
<field name="type_rec" colspan="4"/>
</group>
<group colspan="4">
<separator string="Invoicing" colspan="4"/>
@ -109,12 +110,9 @@
</form>
</field>
</page>
<page string="Notes" >
<separator string="Notes" colspan="4" />
<group colspan="4">
<field name="type_rec" colspan="4"/>
<field name="note" colspan="4"/>
</group>
<field colspan="4" name="note" nolabel="1"/>
</page>
</notebook>

View File

@ -95,7 +95,7 @@
ref('stock.menu_action_picking_tree7'),
ref('stock.menu_action_picking_tree8'),
ref('stock.menu_action_picking_tree9'),
ref('mrp_procurement.menu_mrp_procurement_action3'),
ref('procurement.menu_mrp_procurement_action3'),
ref('point_of_sale.menu_point_root')])]" name="menu_access"/>
<field eval="[(6,0,[ref('res_users_shopuser0'),ref('res_users_shopuser1')])]" name="users"/>
<field eval="[(6,0,[ref('point_of_sale.ir_rule_group_point0'),ref('point_of_sale.ir_rule_group_poslinecompany0'),ref('point_of_sale.ir_rule_group_posreporting0')])]" name="rule_groups"/>
@ -132,7 +132,7 @@
</record>
<record id="ir_modelsmrp_pdt0" model="ir.model.access">
<field name="model_id" ref="mrp_procurement.model_mrp_procurement"/>
<field name="model_id" ref="procurement.model_procurement_order"/>
<field eval="1" name="perm_read"/>
<field eval="&quot;&quot;&quot;MRP - Procurement&quot;&quot;&quot;" name="name"/>
<field eval="0" name="perm_unlink"/>
@ -206,7 +206,7 @@
<field name="group_id" ref="res_groups_posuser0"/>
</record>
<record id="ir_model_access_stockwarehouseorderpoint0" model="ir.model.access">
<field name="model_id" ref="mrp_procurement.model_stock_warehouse_orderpoint"/>
<field name="model_id" ref="procurement.model_stock_warehouse_orderpoint"/>
<field eval="1" name="perm_read"/>
<field eval="&quot;&quot;&quot;stock.warehouse.orderpoint&quot;&quot;&quot;" name="name"/>
<field eval="0" name="perm_unlink"/>
@ -474,12 +474,12 @@
<field name="group_id" ref="res_groups_posuser0"/>
</record>
<record id="ir_model_access_procurement0" model="ir.model.access">
<field name="model_id" ref="mrp_procurement.model_mrp_procurement" />
<field name="model_id" ref="procurement.model_procurement_order" />
<field eval="1" name="perm_read" />
<field eval="1" name="perm_write" />
<field eval="1" name="perm_create" />
<field eval="0" name="perm_unlink" />
<field name="name" eval="&quot;&quot;&quot;mrp.procurement&quot;&quot;&quot;" />
<field name="name" eval="&quot;&quot;&quot;procurement.order&quot;&quot;&quot;" />
<field name="group_id" ref="res_groups_posuser0"/>
</record>
<record id="ir_model_access_tax0" model="ir.model.access">
@ -497,7 +497,7 @@
name="Reporting"
parent="stock.menu_stock_root" groups="base.group_user"/>
<menuitem action="stock.action_picking_tree" id="stock.menu_action_picking_tree" parent="stock.menu_stock_warehouse_mgmt" sequence="19" groups="res_groups_posuser0"/>
<!-- <menuitem id="mrp_procurement.menu_mrp_reordering" name="Automatic Procurements" parent="stock.menu_stock_root" sequence="4" groups="base.group_user"/>-->
<!-- <menuitem id="procurement.menu_mrp_reordering" name="Automatic Procurements" parent="stock.menu_stock_root" sequence="4" groups="base.group_user"/>-->
<menuitem parent="stock.next_id_61" action="stock.action_stock_line_date" id="stock.menu_report_stock_line_date" groups="base.group_user"/>
</data>

View File

@ -177,7 +177,7 @@
ref('stock.menu_action_picking_tree7'),
ref('stock.menu_action_picking_tree8'),
ref('stock.menu_action_picking_tree9'),
ref('mrp_procurement.menu_mrp_procurement_action3'),
ref('procurement.menu_mrp_procurement_action3'),
ref('point_of_sale.menu_point_root')])]" name="menu_access"/>
<field eval="[(6,0,[ref('point_of_sale.ir_rule_group_point0'),ref('point_of_sale.ir_rule_group_poslinecompany0'),ref('point_of_sale.ir_rule_group_posreporting0')])]" name="rule_groups"/>
<field eva="[(6,0,[ref('res_users_shopuser0'),ref('res_users_shopuser1')])]" name="users"/>
@ -214,7 +214,7 @@
</record>
<record id="ir_modelsmrp_pdt0" model="ir.model.access">
<field name="model_id" ref="mrp_procurement.model_mrp_procurement"/>
<field name="model_id" ref="procurement.model_procurement_order"/>
<field eval="1" name="perm_read"/>
<field eval="&quot;&quot;&quot;MRP - Procurement&quot;&quot;&quot;" name="name"/>
<field eval="0" name="perm_unlink"/>
@ -557,12 +557,12 @@
<field name="group_id" ref="res_groups_posuser0"/>
</record>
<record id="ir_model_access_procurement0" model="ir.model.access">
<field name="model_id" ref="mrp_procurement.model_mrp_procurement" />
<field name="model_id" ref="procurement.model_procurement_order" />
<field eval="1" name="perm_read" />
<field eval="1" name="perm_write" />
<field eval="1" name="perm_create" />
<field eval="0" name="perm_unlink" />
<field name="name" eval="&quot;&quot;&quot;mrp.procurement&quot;&quot;&quot;" />
<field name="name" eval="&quot;&quot;&quot;procurement.order&quot;&quot;&quot;" />
<field name="group_id" ref="res_groups_posuser0"/>
</record>
<record id="ir_model_access_tax0" model="ir.model.access">

View File

@ -33,7 +33,7 @@
<field eval="1" name="global"/>
</record>
<record id="point_of_sale.res_groups_posuser0" model="res.groups">
<field eval="[(6,0,[ref('product.menu_config_product'),ref('product.menu_product_category_action_form'),ref('point_of_sale.menu_point_ofsale'),ref('point_of_sale.menu_point_config'),ref('point_of_sale.menu_statement_tree_all'),ref('stock.menu_stock_root'),ref('stock.menu_action_location_form'),ref('stock.menu_action_location_tree'),ref('stock.menu_picking_waiting'),ref('stock.menu_action_picking_tree3'),ref('stock.menu_action_picking_tree5'),ref('stock.menu_action_picking_form'),ref('stock.menu_action_picking_tree7'),ref('stock.menu_action_picking_tree8'),ref('stock.menu_action_picking_tree9'),ref('mrp_procurement.menu_mrp_procurement_action3'),ref('mrp_procurement.menu_mrp_procurement_new'),ref('mrp.next_id_77'),ref('mrp.menu_report_workcenter_load'),ref('mrp.menu_report_in_out_picking'),ref('base.menu_sales'),ref('sale.menu_action_shop_form'),ref('sale.menu_sale_order'),ref('sale.menu_action_order_tree'),ref('sale.menu_action_order_tree_all'),ref('sale.menu_action_order_tree2'),ref('sale.menu_action_order_tree3'),ref('sale.menu_action_order_tree7'),ref('sale.menu_action_order_tree8'),ref('sale.menu_action_order_line_tree1'),ref('delivery.menu_action_delivery_carrier_form'),ref('delivery.menu_action_delivery_grid_form'),ref('point_of_sale.menu_point_root')])]" name="menu_access"/>
<field eval="[(6,0,[ref('product.menu_config_product'),ref('product.menu_product_category_action_form'),ref('point_of_sale.menu_point_ofsale'),ref('point_of_sale.menu_point_config'),ref('point_of_sale.menu_statement_tree_all'),ref('stock.menu_stock_root'),ref('stock.menu_action_location_form'),ref('stock.menu_action_location_tree'),ref('stock.menu_picking_waiting'),ref('stock.menu_action_picking_tree3'),ref('stock.menu_action_picking_tree5'),ref('stock.menu_action_picking_form'),ref('stock.menu_action_picking_tree7'),ref('stock.menu_action_picking_tree8'),ref('stock.menu_action_picking_tree9'),ref('procurement.menu_mrp_procurement_action3'),ref('procurement.menu_mrp_procurement_new'),ref('mrp.next_id_77'),ref('mrp.menu_report_workcenter_load'),ref('mrp.menu_report_in_out_picking'),ref('base.menu_sales'),ref('sale.menu_action_shop_form'),ref('sale.menu_sale_order'),ref('sale.menu_action_order_tree'),ref('sale.menu_action_order_tree_all'),ref('sale.menu_action_order_tree2'),ref('sale.menu_action_order_tree3'),ref('sale.menu_action_order_tree7'),ref('sale.menu_action_order_tree8'),ref('sale.menu_action_order_line_tree1'),ref('delivery.menu_action_delivery_carrier_form'),ref('delivery.menu_action_delivery_grid_form'),ref('point_of_sale.menu_point_root')])]" name="menu_access"/>
<field eval="[(6,0,[ref('ir_rule_group_bankstatementcompany0'),ref('ir_rule_group_bankstatementlinecompany0'),ref('point_of_sale.ir_rule_group_point0'),ref('point_of_sale.ir_rule_group_poslinecompany0'),ref('point_of_sale.ir_rule_group_posreporting0')])]" name="rule_groups"/>
<field eval="&quot;&quot;&quot;POS_user&quot;&quot;&quot;" name="name"/>
</record>

View File

@ -1,37 +0,0 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from osv import osv, fields
import time
import netsvc
class stock_picking(osv.osv):
_inherit = 'stock.picking'
_columns = {
'pos_order': fields.many2one('pos.order', 'Pos order'),
}
stock_picking()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -62,6 +62,14 @@ class add_product(osv.osv_memory):
'type': 'ir.actions.act_window',
}
def close_action(self, cr, uid, ids, context):
"""
To get the product and Make the payment .
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param context: A standard dictionary
@return : Return the Make Payment
"""
record_id = context and context.get('active_id', False)
order_obj= self.pool.get('pos.order')

View File

@ -37,6 +37,14 @@ class pos_discount(osv.osv_memory):
def view_init(self, cr, uid, fields_list, context=None):
"""
Creates view dynamically and adding fields at runtime.
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param context: A standard dictionary
@return: New arch of view with new columns.
"""
res = super(pos_discount, self).view_init(cr, uid, fields_list, context=context)
record_id = context and context.get('active_id', False) or False
order = self.pool.get('pos.order').browse(cr, uid, record_id)

View File

@ -123,7 +123,7 @@ class pos_make_payment(osv.osv_memory):
"""
return result
def check(self, cr, uid, ids, context=None):
def check(self, cr, uid, ids, context):
"""Check the order:
if the order is not paid: continue payment,
@ -153,8 +153,11 @@ class pos_make_payment(osv.osv_memory):
return self.create_invoice(cr,uid,ids,context)
else:
context.update({'flag': True})
order_obj.action_paid(cr,uid,[active_id],context)
order_obj.write(cr, uid, [active_id],{'state':'paid'})
order_obj.action_paid(cr,uid,[active_id],context)
if context.get('return'):
order_obj.write(cr, uid, [active_id],{'state':'done'})
else:
order_obj.write(cr, uid, [active_id],{'state':'paid'})
return self.print_report(cr, uid, ids, context)
if order.amount_paid > 0.0:
context.update({'flag': True})
@ -166,6 +169,10 @@ class pos_make_payment(osv.osv_memory):
def create_invoice(self, cr, uid, ids, context):
"""
Create a invoice
"""
wf_service = netsvc.LocalService("workflow")
active_ids = [context and context.get('active_id',False)]
for i in active_ids:
@ -178,8 +185,6 @@ class pos_make_payment(osv.osv_memory):
}
def print_report(self, cr, uid, ids, context=None):
if not context:
context={}
"""
@summary: To get the date and print the report
@param self: The object pointer.
@ -187,7 +192,9 @@ class pos_make_payment(osv.osv_memory):
@param uid: ID of the user currently logged in
@param context: A standard dictionary
@return : retrun report
"""
"""
if not context:
context={}
active_id=context.get('active_id',[])
datas = {'ids' : [active_id]}
res = {}

View File

@ -26,9 +26,6 @@ import time
class pos_payment_report_date(osv.osv_memory):
'''
Open ERP Model
'''
_name = 'pos.payment.report.date'
_description = 'POS Payment Report according to date'
def print_report(self, cr, uid, ids, context=None):

View File

@ -25,9 +25,6 @@ from osv import fields
class pos_payment_report_user(osv.osv_memory):
'''
Open ERP Model
'''
_name = 'pos.payment.report.user'
_description = 'Sales lines by Users'
def print_report(self, cr, uid, ids, context=None):

View File

@ -32,6 +32,14 @@ class pos_receipt(osv.osv_memory):
}
def view_init(self, cr, uid, fields_list, context=None):
"""
Creates view dynamically and adding fields at runtime.
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param context: A standard dictionary
@return: New arch of view with new columns.
"""
order_lst = self. pool.get('pos.order').browse(cr, uid, context['active_id'])
for order in order_lst:
if order.state_2 in ('to_verify'):

View File

@ -63,6 +63,14 @@ class pos_return(osv.osv_memory):
return res
def view_init(self, cr, uid, fields_list, context=None):
"""
Creates view dynamically and adding fields at runtime.
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param context: A standard dictionary
@return: New arch of view with new columns.
"""
res = super(pos_return, self).view_init(cr, uid, fields_list, context=context)
order_obj=self.pool.get('pos.order')
if not context:
@ -77,6 +85,18 @@ class pos_return(osv.osv_memory):
return res
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False,submenu=False):
"""
Changes the view dynamically
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param context: A standard dictionary
@return: New arch of view.
"""
result = super(pos_return, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar,submenu)
if not context:
context={}
@ -123,6 +143,15 @@ class pos_return(osv.osv_memory):
def create_returns(self, cr, uid, data, context):
"""
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param context: A standard dictionary
@return: Return the add product form again for adding more product
"""
return {
'name': _('Add Product'),
'view_type': 'form',
@ -186,6 +215,7 @@ class pos_return(osv.osv_memory):
line_obj.copy(cr,uid,line.id,{'qty':-qty ,
'order_id': new_order,
})
order_obj.write(cr,uid, active_id, {'state':'done'})
order_obj.write(cr,uid, new_order, {'state':'done'})
wf_service.trg_validate(uid, 'stock.picking',new_picking,'button_confirm', cr)
picking_obj.force_assign(cr, uid, [new_picking], context)
@ -334,8 +364,9 @@ class add_product(osv.osv_memory):
})
wf_service.trg_validate(uid, 'stock.picking',new_picking,'button_confirm', cr)
picking_obj.force_assign(cr, uid, [new_picking], context)
obj=order_obj.browse(cr,uid, active_ids[0])
obj=order_obj.browse(cr,uid, active_ids[0])
context.update({'return':'return'})
if obj.amount_total != obj.amount_paid:
return {
'name': _('Make Payment'),

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"

View File

@ -19,7 +19,7 @@
#
##############################################################################
import mrp_procurement
import procurement
import wizard
import schedulers
import company

View File

@ -33,19 +33,19 @@
'init_xml': [],
'update_xml': [
'security/ir.model.access.csv',
'security/mrp_procurement_security.xml',
'mrp_procurement_data.xml',
'security/procurement_security.xml',
'procurement_data.xml',
'wizard/make_procurement_view.xml',
'wizard/mrp_procurement_view.xml',
'wizard/orderpoint_procurement_view.xml',
'mrp_procurement_view.xml',
'procurement_view.xml',
'wizard/schedulers_all_view.xml',
'mrp_procurement_workflow.xml',
'procurement_workflow.xml',
'process/procurement_process.xml',
"company_view.xml",
'board_mrp_procurement_view.xml',
],
# 'demo_xml': [],
'demo_xml': ['stock_orderpoint.xml'],
'installable': True,
'active': False,
'certificate': '',

View File

@ -8,7 +8,7 @@
<record id="process_process_procurementprocess0" model="process.process">
<field eval="&quot;&quot;&quot;Procurement&quot;&quot;&quot;" name="name"/>
<field name="model_id" ref="mrp_procurement.model_mrp_procurement"/>
<field name="model_id" ref="procurement.model_procurement_order"/>
<field eval="1" name="active"/>
</record>

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