@@ -942,6 +942,9 @@ class account_invoice(osv.osv):
|
||||
number = self.pool.get('ir.sequence').get_id(cr, uid, sid, 'id', {'fiscalyear_id': obj_inv.period_id.fiscalyear_id.id})
|
||||
else:
|
||||
number = self.pool.get('ir.sequence').get(cr, uid, 'account.invoice.' + invtype)
|
||||
|
||||
if not number:
|
||||
raise osv.except_osv(_('Warning !'), _('There is no active invoice sequence defined for the journal !'))
|
||||
|
||||
if invtype in ('in_invoice', 'in_refund'):
|
||||
ref = reference
|
||||
|
||||
+35
-33
@@ -72,14 +72,14 @@ class auction_dates(osv.osv):
|
||||
|
||||
_columns = {
|
||||
'name': fields.char('Auction Name', size=64, required=True),
|
||||
'expo1': fields.date('First Exposition Day', required=True),
|
||||
'expo2': fields.date('Last Exposition Day', required=True),
|
||||
'auction1': fields.date('First Auction Day', required=True),
|
||||
'auction2': fields.date('Last Auction Day', required=True),
|
||||
'journal_id': fields.many2one('account.journal', 'Buyer Journal', required=True),
|
||||
'journal_seller_id': fields.many2one('account.journal', 'Seller Journal', required=True),
|
||||
'buyer_costs': fields.many2many('account.tax', 'auction_buyer_taxes_rel', 'auction_id', 'tax_id', 'Buyer Costs'),
|
||||
'seller_costs': fields.many2many('account.tax', 'auction_seller_taxes_rel', 'auction_id', 'tax_id', 'Seller Costs'),
|
||||
'expo1': fields.date('First Exposition Day', required=True, help="Beginning Exposition Date For Auction"),
|
||||
'expo2': fields.date('Last Exposition Day', required=True, help="Last Exposition Date For Auction"),
|
||||
'auction1': fields.date('First Auction Day', required=True, help="Start Date Of Auction"),
|
||||
'auction2': fields.date('Last Auction Day', required=True, help="End Date Of Auction"),
|
||||
'journal_id': fields.many2one('account.journal', 'Buyer Journal', required=True, help="Account Journal For Buyer"),
|
||||
'journal_seller_id': fields.many2one('account.journal', 'Seller Journal', required=True, help="Account Journal For Seller"),
|
||||
'buyer_costs': fields.many2many('account.tax', 'auction_buyer_taxes_rel', 'auction_id', 'tax_id', 'Buyer Costs', help="Account Tax For Buyer"),
|
||||
'seller_costs': fields.many2many('account.tax', 'auction_seller_taxes_rel', 'auction_id', 'tax_id', 'Seller Costs', help="Account Tax For Seller"),
|
||||
'acc_income': fields.many2one('account.account', 'Income Account', required=True),
|
||||
'acc_expense': fields.many2one('account.account', 'Expense Account', required=True),
|
||||
'adj_total': fields.function(_adjudication_get, method=True, string='Total Adjudication', store=True),
|
||||
@@ -289,6 +289,7 @@ class auction_lots(osv.osv):
|
||||
elif name == "gross_revenue":
|
||||
if lot.auction_id:
|
||||
result = lot.buyer_price - lot.seller_price
|
||||
|
||||
elif name == "net_revenue":
|
||||
if lot.auction_id:
|
||||
result = lot.buyer_price - lot.seller_price - lot.costs
|
||||
@@ -343,39 +344,40 @@ class auction_lots(osv.osv):
|
||||
|
||||
_columns = {
|
||||
'bid_lines':fields.one2many('auction.bid_line', 'lot_id', 'Bids'),
|
||||
'auction_id': fields.many2one('auction.dates', 'Auction Date', select=1),
|
||||
'bord_vnd_id': fields.many2one('auction.deposit', 'Depositer Inventory', required=True),
|
||||
'name': fields.char('Short Description', size=64, required=True),
|
||||
'auction_id': fields.many2one('auction.dates', 'Auctions', select=1, help="Auction For Objects"),
|
||||
'bord_vnd_id': fields.many2one('auction.deposit', 'Depositer Inventory', required=True, help="Auction Deposit For Deposit Inventory"),
|
||||
'name': fields.char('Title', size=64, required=True, help='Auction Objects Name'),
|
||||
'name2': fields.char('Short Description (2)', size=64),
|
||||
'lot_type': fields.selection(_type_get, 'Object category', size=64),
|
||||
'author_right': fields.many2one('account.tax', 'Author rights'),
|
||||
'lot_est1': fields.float('Minimum Estimation'),
|
||||
'lot_est2': fields.float('Maximum Estimation'),
|
||||
'lot_num': fields.integer('List Number', required=True, select=1),
|
||||
'author_right': fields.many2one('account.tax', 'Author rights', help="Account Tax For Author Commission"),
|
||||
'lot_est1': fields.float('Minimum Estimation', help="Minimum Estimate Price Of Objects"),
|
||||
'lot_est2': fields.float('Maximum Estimation', help="Maximum Estimate Price Of Objects"),
|
||||
'lot_num': fields.integer('List Number', required=True, select=1, help="List Number For selected Object in Deposit"),
|
||||
'create_uid': fields.many2one('res.users', 'Created by', readonly=True),
|
||||
'history_ids':fields.one2many('auction.lot.history', 'lot_id', 'Auction history'),
|
||||
'lot_local':fields.char('Location', size=64),
|
||||
'lot_local':fields.char('Location', size=64, help="Auction Location"),
|
||||
'artist_id':fields.many2one('auction.artists', 'Artist/Author'),
|
||||
'artist2_id':fields.many2one('auction.artists', 'Artist/Author 2'),
|
||||
'artist2_id':fields.many2one('auction.artists', 'Artist/Author2'),
|
||||
'important':fields.boolean('To be Emphatized'),
|
||||
'product_id':fields.many2one('product.product', 'Product', required=True),
|
||||
'obj_desc': fields.text('Object Description'),
|
||||
'obj_num': fields.integer('Catalog Number'),
|
||||
'obj_ret': fields.float('Price retired'),
|
||||
'obj_ret': fields.float('Price retired', help="Objects Ret"),
|
||||
'obj_comm': fields.boolean('Commission'),
|
||||
'obj_price': fields.float('Adjudication price'),
|
||||
'obj_price': fields.float('Adjudication price', help="Objects Price"),
|
||||
'ach_avance': fields.float('Buyer Advance'),
|
||||
'ach_login': fields.char('Buyer Username', size=64),
|
||||
'ach_uid': fields.many2one('res.partner', 'Buyer'),
|
||||
'ach_emp': fields.boolean('Taken Away', readonly=True),
|
||||
'is_ok': fields.boolean('Buyer\'s payment'),
|
||||
'ach_uid': fields.many2one('res.partner', 'Buyer'),
|
||||
'seller_id': fields.related('bord_vnd_id','partner_id', type='many2one', relation='res.partner', string='Seller', readonly=True, help="Seller who is related to depositor Inventory"),
|
||||
'ach_emp': fields.boolean('Taken Away', readonly=True, help="When This Field is True means, Objects is taken away by Buyer"),
|
||||
'is_ok': fields.boolean('Buyer\'s payment', help="When Buyer Pay For Account Bank statement', This field is selected as True.", readonly=True),
|
||||
'ach_inv_id': fields.many2one('account.invoice', 'Buyer Invoice', readonly=True, states={'draft':[('readonly', False)]}),
|
||||
'sel_inv_id': fields.many2one('account.invoice', 'Seller Invoice', readonly=True, states={'draft':[('readonly', False)]}),
|
||||
'vnd_lim': fields.float('Seller limit'),
|
||||
'vnd_lim_net': fields.boolean('Net limit ?', readonly=True),
|
||||
'image': fields.binary('Image'),
|
||||
'paid_vnd':fields.function(_getprice, string='Seller Paid', method=True, type='boolean', store=True, multi="paid_vnd"),
|
||||
'paid_ach':fields.function(_getprice, string='Buyer invoice reconciled', method=True, type='boolean', store=True, multi="paid_ach"),
|
||||
'image': fields.binary('Image', help="Object Image"),
|
||||
'paid_vnd':fields.function(_getprice, string='Seller Paid', method=True, type='boolean', store=True, multi="paid_vnd", help="When state of Seller Invoice is 'Paid', This field is selected as True."),
|
||||
'paid_ach':fields.function(_getprice, string='Buyer Invoice Reconciled', method=True, type='boolean', store=True, multi="paid_ach", help="When state of Buyer Invoice is 'Paid', This field is selected as True."),
|
||||
'state': fields.selection((
|
||||
('draft', 'Draft'),
|
||||
('unsold', 'Unsold'),
|
||||
@@ -386,14 +388,14 @@ class auction_lots(osv.osv):
|
||||
\n* The \'Unsold\' state is used when object does not sold for long time, user can also set it as draft state after unsold. \
|
||||
\n* The \'Paid\' state is used when user pay for the object \
|
||||
\n* The \'Sold\' state is used when user buy the object.'),
|
||||
'buyer_price': fields.function(_getprice, method=True, string='Buyer price', store=True, multi="buyer_price"),
|
||||
'seller_price': fields.function(_getprice, method=True, string='Seller price', store=True, multi="seller_price"),
|
||||
'gross_revenue':fields.function(_getprice, method=True, string='Gross revenue', store=True, multi="gross_revenue"),
|
||||
'gross_margin':fields.function(_getprice, method=True, string='Gross Margin (%)', store=True, multi="gross_margin"),
|
||||
'costs':fields.function(_getprice, method=True, string='Indirect costs', store=True, multi="costs"),
|
||||
'statement_id': fields.many2many('account.bank.statement.line', 'auction_statement_line_rel', 'auction_id', 'statement', 'Payment'),
|
||||
'net_revenue':fields.function(_getprice, method=True, string='Net revenue', store=True, multi="net_revenue"),
|
||||
'net_margin':fields.function(_getprice, method=True, string='Net Margin (%)', store=True, multi="net_margin"),
|
||||
'buyer_price': fields.function(_getprice, method=True, string='Buyer price', store=True, multi="buyer_price", help="Objects Price which Buyer Given For Objects"),
|
||||
'seller_price': fields.function(_getprice, method=True, string='Seller price', store=True, multi="seller_price", help="Seller Price"),
|
||||
'gross_revenue':fields.function(_getprice, method=True, string='Gross revenue', store=True, multi="gross_revenue", help="Revenue Minus Cost Of Objects Sold."),
|
||||
'gross_margin':fields.function(_getprice, method=True, string='Gross Margin (%)', store=True, multi="gross_margin", help="Gross Income Divided by Net Sales"),
|
||||
'costs':fields.function(_getprice, method=True, string='Indirect costs', store=True, multi="costs", help="Total credit of analytic account"),
|
||||
'statement_id': fields.many2many('account.bank.statement.line', 'auction_statement_line_rel', 'auction_id', 'statement', 'Payment', help="Account Bank statement Line For Given Buyer"),
|
||||
'net_revenue':fields.function(_getprice, method=True, string='Net revenue', store=True, multi="net_revenue", help="Total Revenue Minus Returns"),
|
||||
'net_margin':fields.function(_getprice, method=True, string='Net Margin (%)', store=True, multi="net_margin", help="The ratio of net profits to revenues"),
|
||||
}
|
||||
_defaults = {
|
||||
'state':lambda *a: 'draft',
|
||||
|
||||
+129
-101
@@ -55,6 +55,7 @@
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="view_auction_object_categories_form">
|
||||
<field name="name">auction.lot.category.form</field>
|
||||
<field name="model">auction.lot.category</field>
|
||||
@@ -91,7 +92,6 @@
|
||||
<field name="auction2" string="End of auction"/>
|
||||
<field name="name" string="Names"/>
|
||||
<field name="state"/>
|
||||
<button string="Create Invoices" help="Create Invoices" name="close" states="draft" type="object" icon="gtk-yes"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
@@ -111,7 +111,7 @@
|
||||
<separator string="Auction Dates" colspan="4"/>
|
||||
<field name="auction1" select="1"/>
|
||||
<field name="auction2" select="1"/>
|
||||
<label string="" colspan="4"/>
|
||||
<separator string="" colspan="4"/>
|
||||
<field name="state"/>
|
||||
<button name="close" states="draft" string="Create Invoices" type="object" colspan="2" icon="gtk-yes"/>
|
||||
</page>
|
||||
@@ -183,7 +183,7 @@
|
||||
<field name="priority" eval="2"/>
|
||||
<field name="arch" type="xml">
|
||||
<calendar string="Next Auction"
|
||||
date_start="auction1" color="name">
|
||||
date_start="auction1" color="">
|
||||
<field name="name" />
|
||||
<field name="auction1"/>
|
||||
</calendar>
|
||||
@@ -191,7 +191,7 @@
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window" id="action_auction_dates_next">
|
||||
<field name="name">Next Auctions Dates</field>
|
||||
<field name="name">Auctions</field>
|
||||
<field name="res_model">auction.dates</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form,calendar</field>
|
||||
@@ -206,9 +206,8 @@
|
||||
id="act_auction_lot_line_open"/>
|
||||
|
||||
|
||||
<menuitem name="Auction Dates" parent="auction_menu_root" id="auction_date_menu" sequence="1"/>
|
||||
<menuitem name="Next Auction Dates" parent="auction_date_menu" id="menu_auction_dates_next1" action="action_auction_dates_next"/>
|
||||
|
||||
<menuitem name="Auctions" parent="auction_menu_root" id="auction_date_menu" sequence="1"/>
|
||||
<menuitem name="Auctions" parent="auction_date_menu" id="menu_auction_dates_next1" action="action_auction_dates_next"/>
|
||||
|
||||
|
||||
<record model="ir.ui.view" id="view_auction_lot_tree">
|
||||
@@ -221,16 +220,11 @@
|
||||
<field name="obj_num" string="Ref" select="1"/>
|
||||
<field name="name" select="1"/>
|
||||
<field name="ach_uid"/>
|
||||
<field name="ach_login"/>
|
||||
<field name="obj_price" sum="Total Adj."/>
|
||||
<field name="state" select="1"/>
|
||||
<field name="obj_comm"/>
|
||||
<field name="bord_vnd_id"/>
|
||||
<field name="lot_num"/>
|
||||
<field name="lot_est1"/>
|
||||
<field name="lot_est2"/>
|
||||
<field name="lot_type" select="1"/>
|
||||
<field name="auction_id"/>
|
||||
<field name="state" select="1"/>
|
||||
<button name="button_bought" string="Sold" states="draft" type="object" icon="gtk-jump-to"/>
|
||||
<button name="button_not_bought" string="Not sold" states="draft" type="object" icon="gtk-undo"/>
|
||||
<button name="button_taken_away" string="Taken away" states="sold" type="object" icon="gtk-goto-last"/>
|
||||
@@ -246,100 +240,91 @@
|
||||
<field name="priority" eval="8"/>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Objects">
|
||||
<group colspan="4" col="4">
|
||||
<group colspan="2" col="4">
|
||||
<field colspan="2" name="name"/>
|
||||
<field name="obj_num" select="1"/>
|
||||
<field name="lot_type"/>
|
||||
<field name="auction_id" select="1"/>
|
||||
<field name="artist_id"/>
|
||||
<field name="artist2_id"/>
|
||||
<field name="lot_est1"/>
|
||||
<field name="lot_est2"/>
|
||||
<field name="product_id"/>
|
||||
<field name="lot_local"/>
|
||||
<field name="bord_vnd_id" select="1"/>
|
||||
<field name="lot_num"/>
|
||||
<newline/>
|
||||
</group>
|
||||
<group colspan="2" col="1">
|
||||
<field name="image" widget='image' nolabel="1"/>
|
||||
</group>
|
||||
</group>
|
||||
<group colspan="4" col="8">
|
||||
<field name="name" colspan="4"/>
|
||||
<field name="obj_num"/>
|
||||
<newline/>
|
||||
<field name="auction_id"/>
|
||||
<field name="lot_type"/>
|
||||
<field name="lot_local"/>
|
||||
</group>
|
||||
<notebook colspan="4">
|
||||
<page string="Buyer">
|
||||
<separator string="Buyer information" colspan="4"/>
|
||||
<page string="Catalog">
|
||||
<separator string="Inventory" colspan="2"/>
|
||||
<group colspan="4" col="6">
|
||||
<field name="ach_uid" />
|
||||
<field name="ach_login" select="1" />
|
||||
<field name="author_right" domain="[('domain','=','sabam'),('parent_id','=',False),('type_tax_use','<>','sale')]"/>
|
||||
<field name="obj_price"/>
|
||||
<field name="obj_ret"/>
|
||||
<field name="obj_comm"/>
|
||||
<field name="buyer_price"/>
|
||||
<field name="seller_price"/>
|
||||
<field name="ach_emp"/>
|
||||
<field name="gross_revenue"/>
|
||||
<field name="net_revenue"/>
|
||||
<field name="gross_margin"/>
|
||||
<field name="net_margin"/>
|
||||
<field name="costs"/>
|
||||
<newline/>
|
||||
<field name="ach_inv_id"/>
|
||||
<field name="paid_ach"/>
|
||||
<field name="is_ok"/>
|
||||
</group>
|
||||
<field name="statement_id" domain="[('state','=','draft')]" colspan="4" nolabel="1"
|
||||
widget="one2many_list">
|
||||
<tree string="Payment's history">
|
||||
<field name="statement_id"/>
|
||||
<field name="amount"/>
|
||||
<field name="date"/>
|
||||
</tree>
|
||||
<form string="Bank Statement">
|
||||
<field name="name"/>
|
||||
<field name="sequence"/>
|
||||
<field name="date"/>
|
||||
<field name="partner_id"/>
|
||||
<field name="account_id"/>
|
||||
<field name="type"/>
|
||||
<field name="statement_id"/>
|
||||
<field name="reconcile_id"/>
|
||||
<field name="amount"/>
|
||||
<field name="reconcile_amount"/>
|
||||
</form>
|
||||
</field>
|
||||
<field name="state" colspan="1"/>
|
||||
<group col="8" colspan="2">
|
||||
<button name="button_bought" string="Sold" states="draft" type="object" icon="gtk-jump-to"/>
|
||||
<button name="button_not_bought" string="Not sold" states="draft" type="object" icon="gtk-undo"/>
|
||||
<button name="button_taken_away" string="Taken away" states="sold" type="object" icon="gtk-goto-last"/>
|
||||
<button name="button_unpaid" string="Set to draft" states="sold,unsold,paid" type="object" icon="gtk-convert"/>
|
||||
</group>
|
||||
<group colspan="2" col="4">
|
||||
<field name="product_id" colspan="4"/>
|
||||
<field name="lot_num" select="1" />
|
||||
<field name="bord_vnd_id"/>
|
||||
</group>
|
||||
<group colspan="2" col="1">
|
||||
<field name="image" widget='image' nolabel="1"/>
|
||||
</group>
|
||||
</group>
|
||||
<group colspan="4" col="6">
|
||||
<group colspan="2" col="1">
|
||||
<separator string="Authors" colspan="2"/>
|
||||
<field name="artist_id"/>
|
||||
<field name="artist2_id"/>
|
||||
<field name="author_right" domain="[('domain','=','sabam'),('parent_id','=',False),('type_tax_use','<>','sale')]"/>
|
||||
</group>
|
||||
<group colspan="2" col="1">
|
||||
<separator string="Price" colspan="4"/>
|
||||
<field name="lot_est1"/>
|
||||
<field name="lot_est2"/>
|
||||
<field name="obj_price"/>
|
||||
<field name="seller_price"/>
|
||||
<field name="buyer_price"/>
|
||||
<field name="obj_comm"/>
|
||||
</group>
|
||||
<group colspan="2" col="1">
|
||||
<separator string="Statistical" colspan="4"/>
|
||||
<field name="gross_revenue"/>
|
||||
<field name="net_revenue"/>
|
||||
<field name="gross_margin"/>
|
||||
<field name="net_margin"/>
|
||||
<field name="costs"/>
|
||||
</group>
|
||||
</group>
|
||||
<group colspan="4" col="4">
|
||||
<group colspan="2" col="4">
|
||||
<separator string="Buyer Information" colspan="4"/>
|
||||
<field name="ach_uid"/>
|
||||
<field name="is_ok"/>
|
||||
<field name="ach_login" />
|
||||
<field name="paid_ach"/>
|
||||
<field name="ach_inv_id"/>
|
||||
<field name="ach_emp"/>
|
||||
</group>
|
||||
<group colspan="2" col="4">
|
||||
<separator string="Seller Information" colspan="4"/>
|
||||
<field name="seller_id"/>
|
||||
<newline/>
|
||||
<field name="vnd_lim"/>
|
||||
<field name="vnd_lim_net"/>
|
||||
<field name="sel_inv_id"/>
|
||||
<field name="paid_vnd"/>
|
||||
</group>
|
||||
</group>
|
||||
<group colspan="4" col="4">
|
||||
<separator string="" colspan="4"/>
|
||||
<field name="state" colspan="1"/>
|
||||
<group col="8" colspan="2">
|
||||
<button name="button_bought" string="Sold" states="draft" type="object" icon="gtk-jump-to"/>
|
||||
<button name="button_not_bought" string="Not sold" states="draft" type="object" icon="gtk-undo"/>
|
||||
<button name="button_taken_away" string="Taken away" states="sold" type="object" icon="gtk-goto-last"/>
|
||||
<button name="button_unpaid" string="Set to draft" states="sold,unsold,paid" type="object" icon="gtk-convert"/>
|
||||
</group>
|
||||
</group>
|
||||
</page>
|
||||
<page string="Seller">
|
||||
<separator string="Seller information" colspan="4"/>
|
||||
<field name="vnd_lim"/>
|
||||
<field name="vnd_lim_net"/>
|
||||
<field name="sel_inv_id"/>
|
||||
<field name="paid_vnd"/>
|
||||
<field name="history_ids" colspan="4" readonly="1" nolabel="1">
|
||||
<tree string="History">
|
||||
<field name="name"/>
|
||||
<field name="lot_id"/>
|
||||
<field name="auction_id"/>
|
||||
<field name="price"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
<page string="Bids">
|
||||
<field name="bid_lines" colspan="4" nolabel="1" editable="top">
|
||||
<tree string="Bids" editable="top">
|
||||
<page string="Bids">
|
||||
<field name="bid_lines" colspan="4" nolabel="1" editable="top">
|
||||
<tree string="Bids Details" editable="top">
|
||||
<field name="bid_id"/>
|
||||
<field name="price"/>
|
||||
<field name="call"/>
|
||||
</tree>
|
||||
<form string="Bids" >
|
||||
<form string="Bids Details" >
|
||||
<field name="bid_id"/>
|
||||
<field name="lot_id" domain="[('auction_id','=',parent['auction_id'])]" on_change="onchange_name(lot_id)"/>
|
||||
<field name="price"/>
|
||||
@@ -350,6 +335,41 @@
|
||||
<page string="Note">
|
||||
<field name="obj_desc" colspan="4" nolabel="1"/>
|
||||
</page>
|
||||
<page string="History" groups="base.group_extended">
|
||||
<group colspan="2" col="2">
|
||||
<field name="statement_id" domain="[('state','=','draft')]" colspan="4" nolabel="1"
|
||||
widget="one2many_list">
|
||||
<tree string="Buyer's Payment History">
|
||||
<field name="statement_id"/>
|
||||
<field name="amount"/>
|
||||
<field name="date"/>
|
||||
</tree>
|
||||
<form string="Buyer's Payment History">
|
||||
<field name="name"/>
|
||||
<field name="sequence"/>
|
||||
<field name="date"/>
|
||||
<field name="partner_id"/>
|
||||
<field name="account_id"/>
|
||||
<field name="type"/>
|
||||
<field name="statement_id"/>
|
||||
<field name="reconcile_id"/>
|
||||
<field name="amount"/>
|
||||
<field name="reconcile_amount"/>
|
||||
</form>
|
||||
</field>
|
||||
</group>
|
||||
<group colspan="2" col="2">
|
||||
<field name="history_ids" colspan="4" readonly="1" nolabel="1">
|
||||
<tree string="History">
|
||||
<field name="name"/>
|
||||
<field name="lot_id"/>
|
||||
<field name="auction_id"/>
|
||||
<field name="price"/>
|
||||
</tree>
|
||||
</field>
|
||||
</group>
|
||||
</page>
|
||||
|
||||
</notebook>
|
||||
</form>
|
||||
</field>
|
||||
@@ -421,6 +441,14 @@
|
||||
<field name="search_view_id" ref="view_auction_lots_filter"/>
|
||||
<field name="context">{"search_default_draft": "1"}</field>
|
||||
</record>
|
||||
|
||||
<!-- Action for Bids -->
|
||||
|
||||
<act_window name="Open Bids"
|
||||
domain="[('lot_id', '=', active_id)]"
|
||||
res_model="auction.bid_line"
|
||||
src_model="auction.lots"
|
||||
id="act_auction_lot_open_bid"/>
|
||||
|
||||
<menuitem name="Objects" parent="auction_menu_root" id="auction_objects_menu" sequence="2"/>
|
||||
<menuitem name="Objects" action="action_all_objects" parent="auction_objects_menu" id="auction_all_objects_menu"/>
|
||||
@@ -684,7 +712,7 @@
|
||||
|
||||
<menuitem name="Reporting" id="auction_report_menu" parent="auction_menu_root" sequence="6"/>
|
||||
|
||||
<act_window name="Bordereau de dépôt"
|
||||
<act_window name="Deposit slip"
|
||||
domain="[('partner_id', '=', active_id)]"
|
||||
res_model="auction.deposit"
|
||||
src_model="res.partner"
|
||||
|
||||
@@ -7,16 +7,15 @@
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Change Auction Date">
|
||||
<label string="Warning, this will erase the object adjudication price and its buyer!" colspan="4"/>
|
||||
<newline/>
|
||||
<separator string="" colspan="4"/>
|
||||
<field name="auction_id"/>
|
||||
<separator string="" colspan="4" />
|
||||
<label string ="Warning, This will Erase The Object Adjudication Price and Its Buyer!" colspan="4"/>
|
||||
<separator string="" colspan="4"/>
|
||||
<field name="auction_id"/>
|
||||
<separator string="" colspan="4"/>
|
||||
<group colspan="4" col="4">
|
||||
<label string=" " colspan="2"/>
|
||||
<button icon="gtk-close" special="cancel" string="Close"/>
|
||||
<button icon="gtk-redo" string="Move to Auction date" name="auction_move_set" type="object"/>
|
||||
</group>
|
||||
<label string=" " colspan="2"/>
|
||||
<button icon="gtk-close" special="cancel" string="Close"/>
|
||||
<button icon="gtk-redo" string="Move to Auction date" name="auction_move_set" type="object"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -31,7 +31,7 @@ class auction_lots_make_invoice(osv.osv_memory):
|
||||
_description = "Make invoice"
|
||||
|
||||
_columns = {
|
||||
'amount': fields.float('Invoiced Amount', required =True, readonly=True),
|
||||
'amount': fields.float('Invoiced Amount', required =True, readonly=True, help="Seller Price"),
|
||||
'objects':fields.integer('# of objects', required =True, readonly=True),
|
||||
'number':fields.char('Invoice Number', size=64),
|
||||
}
|
||||
|
||||
@@ -25,14 +25,12 @@ class auction_lots_make_invoice_buyer(osv.osv_memory):
|
||||
|
||||
_name = "auction.lots.make.invoice.buyer"
|
||||
_description = __doc__
|
||||
|
||||
_columns= {
|
||||
'amount': fields.float('Invoiced Amount', required =True, readonly=True),
|
||||
'amount': fields.float('Invoiced Amount', required =True, readonly=True, help="Buyer Price"),
|
||||
'objects':fields.integer('# of objects', required =True, readonly=True),
|
||||
'number':fields.char('Invoice Number', size=64),
|
||||
'buyer_id':fields.many2one('res.partner', 'Buyer', required=True),
|
||||
}
|
||||
|
||||
_defaults={
|
||||
'number': lambda *a: False,
|
||||
}
|
||||
|
||||
@@ -6,16 +6,18 @@
|
||||
<field name="model">auction.lots.make.invoice.buyer</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Paid">
|
||||
<form string="Buyer Invoice">
|
||||
<group colspan="4" >
|
||||
<separator string="Create Invoices For Buyer" colspan="4"/>
|
||||
<field name="amount"/>
|
||||
<field name="objects"/>
|
||||
<field name="number"/>
|
||||
<label string="(Keep empty for automatic number)" colspan="2"/>
|
||||
<field name="buyer_id"/>
|
||||
</group>
|
||||
<separator string="" colspan="4" />
|
||||
<separator string="" colspan="4" />
|
||||
<group colspan="4" col="6">
|
||||
<label string=" " colspan="2"/>
|
||||
<button icon="gtk-close" special="cancel" string="Close"/>
|
||||
<button icon="gtk-yes" string="Create invoices" name="makeInvoices" type="object"/>
|
||||
</group>
|
||||
|
||||
@@ -6,13 +6,15 @@
|
||||
<field name="model">auction.lots.make.invoice</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Paid">
|
||||
<form string="Seller Invoice">
|
||||
<group colspan="4" >
|
||||
<separator string="Create Invoices For Seller" colspan="4"/>
|
||||
<field name="amount"/>
|
||||
<field name="objects"/>
|
||||
<field name="number" colspan="3"/>
|
||||
<field name="number" colspan="1"/>
|
||||
<label string="(Keep empty for automatic number)" colspan="2"/>
|
||||
</group>
|
||||
<separator string="" colspan="4" />
|
||||
<separator string="" colspan="4"/>
|
||||
<group colspan="4" col="6">
|
||||
<button icon="gtk-close" special="cancel" string="Close"/>
|
||||
<button icon="gtk-yes" string="Create invoices" name="makeInvoices" type="object"/>
|
||||
|
||||
@@ -28,14 +28,14 @@ class auction_pay_buy(osv.osv_memory):
|
||||
_name = "auction.pay.buy"
|
||||
_description = "Pay buy"
|
||||
_columns= {
|
||||
'amount': fields.float('Amount paid', digits= (16, 2)),
|
||||
'amount': fields.float('Amount', digits= (16, 2), help="Amount For First Bank Statement"),
|
||||
'buyer_id':fields.many2one('res.partner', 'Buyer'),
|
||||
'statement_id1':fields.many2one('account.bank.statement', 'Statement', required=True),
|
||||
'amount2': fields.float('Amount paid', digits= (16, 2)),
|
||||
'statement_id2':fields.many2one('account.bank.statement', 'Statement'),
|
||||
'amount3': fields.float('Amount paid', digits = (16, 2)),
|
||||
'statement_id3':fields.many2one('account.bank.statement', 'Statement'),
|
||||
'total': fields.float('Amount paid', digits = (16, 2), readonly =True),
|
||||
'statement_id1':fields.many2one('account.bank.statement', 'Statement', required=True, help="First Bank Statement For Buyer"),
|
||||
'amount2': fields.float('Amount', digits= (16, 2), help="Amount For Second Bank Statement"),
|
||||
'statement_id2':fields.many2one('account.bank.statement', 'Statement', help="Second Bank Statement For Buyer"),
|
||||
'amount3': fields.float('Amount', digits = (16, 2), help="Amount For Third Bank Statement"),
|
||||
'statement_id3':fields.many2one('account.bank.statement', 'Statement', help="Third Bank Statement For Buyer"),
|
||||
'total': fields.float('Total Amount', digits = (16, 2), readonly =True),
|
||||
}
|
||||
|
||||
def default_get(self, cr, uid, fields, context=None):
|
||||
|
||||
@@ -7,23 +7,33 @@
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Pay objects">
|
||||
<group colspan="4" >
|
||||
<separator string="Pay Objects" colspan="4" />
|
||||
<field name="amount"/>
|
||||
<field name="statement_id1" domain="[('state','=','draft')]"/>
|
||||
<field name="amount2"/>
|
||||
<field name="statement_id2" domain="[('state','=','draft')]"/>
|
||||
<field name="amount3"/>
|
||||
<field name="statement_id3" domain="[('state','=','draft')]"/>
|
||||
<newline/>
|
||||
<field name="buyer_id"/>
|
||||
<field name="total"/>
|
||||
</group>
|
||||
<separator string="" colspan="4" />
|
||||
<group colspan="4" col="6">
|
||||
<button icon="gtk-close" special="cancel" string="Close"/>
|
||||
<button icon="gtk-yes" string="Pay" name="pay_and_reconcile" type="object"/>
|
||||
</group>
|
||||
<group colspan="4" col="4" >
|
||||
<separator string="Pay Objects" colspan="4" />
|
||||
<field name="buyer_id"/>
|
||||
<field name="total"/>
|
||||
<newline/>
|
||||
</group>
|
||||
<separator string="Payment Lines" colspan="4"/>
|
||||
<group colspan="4" col="4">
|
||||
<label string="Line1"/>
|
||||
<field name="amount"/>
|
||||
<field name="statement_id1" domain="[('state','=','draft')]"/>
|
||||
</group>
|
||||
<group colspan="4" col="4">
|
||||
<label string="Line2"/>
|
||||
<field name="amount2"/>
|
||||
<field name="statement_id2" domain="[('state','=','draft')]"/>
|
||||
</group>
|
||||
<group colspan="4" col="4">
|
||||
<label string="Line3" />
|
||||
<field name="amount3"/>
|
||||
<field name="statement_id3" domain="[('state','=','draft')]"/>
|
||||
</group>
|
||||
<separator string="" colspan="4" />
|
||||
<group colspan="4" col="6">
|
||||
<button icon="gtk-close" special="cancel" string="Close"/>
|
||||
<button icon="gtk-yes" string="Pay" name="pay_and_reconcile" type="object"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -45,9 +45,9 @@ class res_partner_contact(osv.osv):
|
||||
return res
|
||||
|
||||
_columns = {
|
||||
'name': fields.char('Last Name', size=30, required=True),
|
||||
'first_name': fields.char('First Name', size=30),
|
||||
'mobile': fields.char('Mobile', size=30),
|
||||
'name': fields.char('Last Name', size=64, required=True),
|
||||
'first_name': fields.char('First Name', size=64),
|
||||
'mobile': fields.char('Mobile', size=64),
|
||||
'title': fields.many2one('res.partner.title','Title'),
|
||||
'website': fields.char('Website', size=120),
|
||||
'lang_id': fields.many2one('res.lang', 'Language'),
|
||||
@@ -203,7 +203,7 @@ class res_partner_job(osv.osv):
|
||||
'address_id': fields.many2one('res.partner.address', 'Address', \
|
||||
help='Address which is linked to the Partner'), # TO Correct: domain=[('partner_id', '=', name)]
|
||||
'contact_id': fields.many2one('res.partner.contact','Contact', required=True, ondelete='cascade'),
|
||||
'function': fields.char('Partner Function', size=34, help="Function of this contact with this partner"),
|
||||
'function': fields.char('Partner Function', size=64, help="Function of this contact with this partner"),
|
||||
'sequence_contact': fields.integer('Contact Seq.',help='Order of\
|
||||
importance of this address in the list of addresses of the linked contact'),
|
||||
'sequence_partner': fields.integer('Partner Seq.',help='Order of importance\
|
||||
|
||||
@@ -23,18 +23,17 @@
|
||||
<attribute name="string">Install Generic Modules</attribute>
|
||||
</separator>
|
||||
<group colspan="8">
|
||||
<field name="crm" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,association,auction,profile_bookstore)"/> <field name="sale" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,association,auction,profile_bookstore)"/>
|
||||
<field name="project" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,association,auction,profile_bookstore)"/> <field name="knowledge" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,association,auction,profile_bookstore)"/>
|
||||
<field name="stock" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,association,auction,profile_bookstore)"/> <field name="mrp" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,association,auction,profile_bookstore)"/>
|
||||
<field name="account" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,association,auction,profile_bookstore)"/> <field name="purchase" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,association,auction,profile_bookstore)"/>
|
||||
<field name="hr" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,association,auction,profile_bookstore)"/> <field name="point_of_sale" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,association,auction,profile_bookstore)"/>
|
||||
<field name="marketing" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,association,auction,profile_bookstore)"/> <field name="misc_tools" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,association,auction,profile_bookstore)"/>
|
||||
<field name="report_designer" groups="base.group_extended" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,association,auction,profile_bookstore)"/>
|
||||
<field name="crm" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,association,auction)"/> <field name="sale" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,association,auction)"/>
|
||||
<field name="project" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,association,auction)"/> <field name="knowledge" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,association,auction)"/>
|
||||
<field name="stock" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,association,auction)"/> <field name="mrp" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,association,auction)"/>
|
||||
<field name="account" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,association,auction)"/> <field name="purchase" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,association,auction)"/>
|
||||
<field name="hr" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,association,auction)"/> <field name="point_of_sale" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,association,auction)"/>
|
||||
<field name="marketing" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,association,auction)"/> <field name="misc_tools" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,association,auction)"/>
|
||||
<field name="report_designer" groups="base.group_extended" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,association,auction)"/>
|
||||
<separator string="Install Specific Business Modules" colspan="4"/>
|
||||
<field name="association" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,association,auction,profile_bookstore)"/>
|
||||
<field name="auction" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,association,auction,profile_bookstore)"/>
|
||||
<field name="profile_bookstore" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,association,auction,profile_bookstore)"/>
|
||||
<field name="product_expiry" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,association,auction,profile_bookstore)"/>
|
||||
<field name="association" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,association,auction)"/>
|
||||
<field name="auction" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,association,auction)"/>
|
||||
<field name="product_expiry" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,association,auction)"/>
|
||||
</group>
|
||||
</data>
|
||||
</field>
|
||||
|
||||
@@ -86,10 +86,6 @@ class base_setup_installer(osv.osv_memory):
|
||||
help="Installs a preselected set of OpenERP "
|
||||
"applications selected to help you manage your auctions "
|
||||
"as well as the business processes around them."),
|
||||
'profile_bookstore':fields.boolean('Book Stores',
|
||||
help="Installs a preselected set of OpenERP "
|
||||
"applications which will help you manage your book store "
|
||||
"or your library."),
|
||||
}
|
||||
_defaults = {
|
||||
'crm': True,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
##############################################################################
|
||||
|
||||
import time
|
||||
import netsvc
|
||||
from osv import fields,osv
|
||||
from tools.translate import _
|
||||
|
||||
|
||||
@@ -19,10 +19,8 @@
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import netsvc
|
||||
from osv import fields,osv
|
||||
from tools.translate import _
|
||||
import tools
|
||||
|
||||
import decimal_precision as dp
|
||||
|
||||
|
||||
@@ -234,16 +234,16 @@ class mailgate_tool(osv.osv_memory):
|
||||
msg_pool = self.pool.get('mailgate.message')
|
||||
for res_id in res_ids:
|
||||
msg_data = {
|
||||
'name': msg.get('subject', 'No subject'),
|
||||
'date': msg.get('date') ,
|
||||
'description': msg.get('body', msg.get('from')),
|
||||
'name': msg.get('subject', 'No subject'),
|
||||
'date': msg.get('date'),
|
||||
'description': msg.get('body', msg.get('from')),
|
||||
'history': True,
|
||||
'res_model': model,
|
||||
'email_cc': msg.get('cc'),
|
||||
'email_from': msg.get('from'),
|
||||
'res_model': model,
|
||||
'email_cc': msg.get('cc'),
|
||||
'email_from': msg.get('from'),
|
||||
'email_to': msg.get('to'),
|
||||
'message_id': msg.get('message-id'),
|
||||
'references': msg.get('references'),
|
||||
'message_id': msg.get('message-id'),
|
||||
'references': msg.get('references') or msg.get('in-reply-to'),
|
||||
'res_id': res_id,
|
||||
'user_id': uid,
|
||||
'attachment_ids': [(6, 0, attach)]
|
||||
@@ -380,6 +380,9 @@ class mailgate_tool(osv.osv_memory):
|
||||
if 'References' in fields:
|
||||
msg['references'] = msg_txt.get('References')
|
||||
|
||||
if 'In-Reply-To' in fields:
|
||||
msg['in-reply-to'] = msg_txt.get('In-Reply-To')
|
||||
|
||||
if 'X-Priority' in fields:
|
||||
msg['priority'] = msg_txt.get('X-Priority', '3 (Normal)').split(' ')[0]
|
||||
|
||||
@@ -425,12 +428,12 @@ class mailgate_tool(osv.osv_memory):
|
||||
res_ids = []
|
||||
attachment_ids = []
|
||||
new_res_id = False
|
||||
if msg.get('references'):
|
||||
references = msg.get('references')
|
||||
if msg.get('references') or msg.get('in-reply-to'):
|
||||
references = msg.get('references') or msg.get('in-reply-to')
|
||||
if '\r\n' in references:
|
||||
references = msg.get('references').split('\r\n')
|
||||
references = references.split('\r\n')
|
||||
else:
|
||||
references = msg.get('references').split(' ')
|
||||
references = references.split(' ')
|
||||
for ref in references:
|
||||
ref = ref.strip()
|
||||
res_id = tools.misc.reference_re.search(ref)
|
||||
@@ -464,7 +467,7 @@ class mailgate_tool(osv.osv_memory):
|
||||
email_from = msg.get('from'),
|
||||
email_cc = msg.get('cc'),
|
||||
message_id = msg.get('message-id'),
|
||||
references = msg.get('references', False),
|
||||
references = msg.get('references', False) or msg.get('in-reply-to', False),
|
||||
attach = attachments.items(),
|
||||
context = context)
|
||||
else:
|
||||
|
||||
@@ -23,15 +23,15 @@
|
||||
"version" : "1.0",
|
||||
"author" : "OpenERP SA",
|
||||
"website" : "http://www.openerp.com/",
|
||||
"depends" : ["base"],
|
||||
"depends" : ["base", "mail_gateway"],
|
||||
"category" : "Generic Modules/Outlook interface",
|
||||
"description": '''
|
||||
This module provide the Outlook plug-in.
|
||||
|
||||
Outlook plug-in allows you to select an object that you’d like to add
|
||||
to your email and its attachments from MS Outlook. You can select a partner, a task,
|
||||
a project, an analytical account, or any other object and attach selected
|
||||
mail as .eml file in attachment of selected record.
|
||||
a project, an analytical account, or any other object and Archived selected
|
||||
mail in mailgate.messages with attachments.
|
||||
|
||||
''',
|
||||
"init_xml" : [],
|
||||
|
||||
@@ -711,7 +711,7 @@ def SearchObjectsForText(btnProcessor,*args):
|
||||
|
||||
search_txt = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[0])
|
||||
if not search_txt:
|
||||
win32ui.MessageBox("Enter text to search for", "", flag_info)
|
||||
win32ui.MessageBox("Enter text to search for", "Archive to OpenERP", flag_info)
|
||||
return
|
||||
# Get titles from list
|
||||
obj_titles=[]
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 78 KiB |
File diff suppressed because one or more lines are too long
@@ -33,8 +33,7 @@ STYLE DS_SETFONT | WS_POPUP | WS_CAPTION | WS_SYSMENU | DS_MODALFRAME
|
||||
CAPTION "OpenERP Configuarion"
|
||||
FONT 8, "Tahoma", 1000, 0, 0x0
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "Done",ID_DONE,400,239,50,14//,WS_VISIBLE //| WS_TABSTOP
|
||||
PUSHBUTTON "Cancel",IDCANCEL,340,239,50,14//, WS_VISIBLE //| WS_TABSTOP
|
||||
DEFPUSHBUTTON "Cancel",ID_DONE,400,239,50,14//,WS_VISIBLE //| WS_TABSTOP
|
||||
CONTROL "",IDC_TAB,"SysTabControl32",0x0,8,7,440,228
|
||||
CONTROL "",IDC_LIST,"SysListView32",WS_CHILD | WS_VISIBLE | WS_BORDER | WS_HSCROLL | WS_VSCROLL |
|
||||
LVS_SHOWSELALWAYS | LVS_REPORT | LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES,0,0,0,0
|
||||
@@ -57,7 +56,7 @@ BEGIN
|
||||
EDITTEXT ID_USERNAME,85,70,154,12,ES_AUTOHSCROLL | WS_VISIBLE | WS_TABSTOP
|
||||
LTEXT "Password : ",IDC_STATIC,30,90,100,17
|
||||
EDITTEXT ID_PASSWORD,85,90,154,12,ES_AUTOHSCROLL | WS_VISIBLE | WS_TABSTOP | ES_PASSWORD
|
||||
PUSHBUTTON "Test Connection",ID_BUT_TESTCONNECTION,179,110,60,13, WS_VISIBLE | WS_TABSTOP
|
||||
PUSHBUTTON "Connect",ID_BUT_TESTCONNECTION,179,110,60,13, WS_VISIBLE | WS_TABSTOP
|
||||
END
|
||||
|
||||
IDD_OBJECT_SETTINGS DIALOGEX 0, 0, 430, 210
|
||||
@@ -92,25 +91,21 @@ BEGIN
|
||||
LTEXT "",IDC_ABOUT,80,90,250,100
|
||||
END
|
||||
|
||||
IDD_SERVER_PORT_DIALOG DIALOGEX 0, 0, 160, 90
|
||||
IDD_SERVER_PORT_DIALOG DIALOGEX 0, 0, 160, 55
|
||||
STYLE DS_SETFONT | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
EXSTYLE WS_EX_CONTEXTHELP
|
||||
CAPTION "Server and Port"
|
||||
CAPTION "OpenERP Connection"
|
||||
FONT 8, "Tahoma", 400, 0, 0x0
|
||||
BEGIN
|
||||
LTEXT "Server : ",IDC_STATIC,5,3,150,17
|
||||
EDITTEXT ID_SERVER,40,3,94,12,ES_AUTOHSCROLL | WS_TABSTOP
|
||||
EDITTEXT ID_SERVER,40,3,100,12,ES_AUTOHSCROLL | WS_TABSTOP
|
||||
LTEXT "Port : ",IDC_STATIC,5,18,100,17
|
||||
EDITTEXT ID_PORT,40,18,94,12,ES_AUTOHSCROLL | WS_TABSTOP
|
||||
GROUPBOX " Protocol ", IDC_STATIC_GROUP, 5, 35, 150, 30
|
||||
PUSHBUTTON "XML-RPC",IDR_XML_PROTOCOL,8,45,50,14,BS_AUTORADIOBUTTON | BST_CHECKED |WS_TABSTOP
|
||||
PUSHBUTTON "XML-RPCS",IDR_XMLS_PROTOCOL,55,45,50,14,BS_AUTORADIOBUTTON | WS_TABSTOP
|
||||
PUSHBUTTON "NET-RPC",IDR_NETRPC_PROTOCOL,105,45,45,14,BS_AUTORADIOBUTTON | WS_TABSTOP
|
||||
PUSHBUTTON "Close",IDCANCEL,60,70,45,14,WS_TABSTOP
|
||||
DEFPUSHBUTTON "OK",IDOK,110,70,45,14,WS_TABSTOP
|
||||
EDITTEXT ID_PORT,40,18,100,12,ES_AUTOHSCROLL | WS_TABSTOP
|
||||
PUSHBUTTON "Close",IDCANCEL,110,35,45,14,WS_TABSTOP
|
||||
DEFPUSHBUTTON "OK",IDOK,60,35,45,14,WS_TABSTOP
|
||||
END
|
||||
|
||||
IDD_SYNC DIALOGEX 0, 0, 470, 300
|
||||
IDD_SYNC DIALOGEX 0, 0, 470, 320
|
||||
STYLE DS_SETFONT | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
EXSTYLE WS_EX_CONTEXTHELP
|
||||
CAPTION "Archive to OpenERP"
|
||||
@@ -120,8 +115,9 @@ BEGIN
|
||||
LTEXT "Search for : ",IDC_STATIC,15,17,40,12
|
||||
EDITTEXT ID_SEARCH_TEXT,60,15,120,12,ES_AUTOHSCROLL | WS_TABSTOP// left top width height
|
||||
PUSHBUTTON "Search",ID_SEARCH,187,15,40,14,WS_TABSTOP
|
||||
LTEXT "Documents : ",IDC_STATIC,15,140,100,14
|
||||
CONTROL "List1",IDC_NAME_LIST,"SysListView32",WS_CHILD | WS_VISIBLE | WS_BORDER | LVS_SHOWSELALWAYS | LVS_REPORT | WS_TABSTOP, 15,150,234,110
|
||||
PUSHBUTTON "Upload to OpenERP",ID_MAKE_ATTACHMENT,160,270,85,14,WS_TABSTOP
|
||||
PUSHBUTTON "Archive to OpenERP",ID_MAKE_ATTACHMENT,160,270,85,14,WS_TABSTOP
|
||||
|
||||
GROUPBOX " Create a Document ", IDC_STATIC_GROUP, 263,5,202,100,WS_TABSTOP
|
||||
LTEXT "Type of Document : ",IDC_STATIC,266,25,100,12
|
||||
@@ -132,7 +128,7 @@ BEGIN
|
||||
GROUPBOX " Create a Contact ", IDC_STATIC_GROUP, 263, 110,202,185,WS_TABSTOP
|
||||
LTEXT "Create a New Contact : ",IDC_STATIC,280,140,100,12
|
||||
PUSHBUTTON "Create Contact",ID_CREATE_CONTACT,360,138,60,14,WS_TABSTOP
|
||||
PUSHBUTTON "Cancel",IDCANCEL,385,270,60,14,WS_TABSTOP
|
||||
PUSHBUTTON "Close",IDCANCEL,385,300,60,14,WS_TABSTOP
|
||||
END
|
||||
|
||||
IDD_NEW_CONTACT_DIALOG DIALOGEX 0, 0, 350, 190
|
||||
|
||||
@@ -37,7 +37,8 @@ def generateEML(mail):
|
||||
|
||||
eml_name= ustr(sub).encode('iso-8859-1')+'-'+str(mail.EntryID)[-9:]
|
||||
ls = ['*', '/', '\\', '<', '>', ':', '?', '"', '|', '\t', '\n']
|
||||
attachments_folder_path = os.path.abspath(os.path.dirname(__file__)+"\\dialogs\\resources\\attachments\\")
|
||||
mails_folder_path = os.path.abspath(os.path.dirname(__file__)+"\\dialogs\\resources\\mails\\")
|
||||
attachments_folder_path = mails_folder_path + "\\attachments\\"
|
||||
if not os.path.exists(attachments_folder_path):
|
||||
os.makedirs(attachments_folder_path)
|
||||
for i in xrange(1, attachments.Count+1):
|
||||
@@ -62,7 +63,7 @@ def generateEML(mail):
|
||||
print mail.lastErrorText()
|
||||
sys.exit()
|
||||
|
||||
mails_folder_path = os.path.abspath(os.path.dirname(__file__)+"\\dialogs\\resources\\mails\\")
|
||||
|
||||
if not os.path.exists(mails_folder_path):
|
||||
os.makedirs(mails_folder_path)
|
||||
for c in ls:
|
||||
|
||||
@@ -26,11 +26,11 @@ import os
|
||||
import pythoncom
|
||||
import time
|
||||
from manager import ustr
|
||||
|
||||
waittime = 10
|
||||
wait_count = 0
|
||||
wait_limit = 12
|
||||
|
||||
import binascii
|
||||
import base64
|
||||
def execute(connector, method, *args):
|
||||
global wait_count
|
||||
res = False
|
||||
@@ -119,7 +119,7 @@ class XMLRpcConn(object):
|
||||
|
||||
def InsertObj(self, obj_title,obj_name,image_path):
|
||||
self._obj_list=list(self._obj_list)
|
||||
self._obj_list.append((obj_title,obj_name,ustr(image_path).encode('iso-8859-1')))
|
||||
self._obj_list.append((obj_title,obj_name,ustr(image_path)))
|
||||
self._obj_list.sort(reverse=True)
|
||||
|
||||
def DeleteObject(self,sel_text):
|
||||
@@ -133,46 +133,53 @@ class XMLRpcConn(object):
|
||||
import win32ui, win32con
|
||||
conn = xmlrpclib.ServerProxy(self._uri + '/xmlrpc/object')
|
||||
import eml
|
||||
msg = ""
|
||||
ext_msg = ""
|
||||
new_msg = files = ext_msg =""
|
||||
eml_path=eml.generateEML(mail)
|
||||
att_name = ustr(eml_path.split('\\')[-1])
|
||||
cnt=1
|
||||
flag=False
|
||||
for rec in recs: #[('res.partner', 3, 'Agrolait')]
|
||||
cnt+=1
|
||||
obj = rec[0]
|
||||
obj_id = rec[1]
|
||||
ids=execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'ir.attachment','search',[('res_id','=',obj_id),('name','=',att_name)])
|
||||
object_ids = execute ( conn,'execute',self._dbname,int(self._uid),self._pwd,'ir.model','search',[('model','=',obj)])
|
||||
object_name = execute( conn,'execute',self._dbname,int(self._uid),self._pwd,'ir.model','read',object_ids,['name'])[0]['name']
|
||||
sub = ustr(mail.Subject)
|
||||
if ids:
|
||||
name=execute(conn,'execute',self._dbname,int(self._uid),self._pwd,obj,'read',obj_id,['name'])['name']
|
||||
ext_msg+=""" - File "{0}.eml" is already archived to {1} "{2}" .
|
||||
""".format(sub,object_name,name)
|
||||
continue
|
||||
if len(sub) > 60:
|
||||
l = 60 - len(sub)
|
||||
sub = sub[0:l]
|
||||
res={}
|
||||
res['res_model'] = obj
|
||||
content = "".join(open(eml_path,"r").readlines()).encode('base64')
|
||||
res['name'] = att_name
|
||||
res['datas_fname'] = sub+".eml"
|
||||
res['datas'] = content
|
||||
res['res_id'] = obj_id
|
||||
execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'ir.attachment','create',res)
|
||||
msg+=""" - File "{0}.eml" archived to {1} "{2}".
|
||||
""".format(sub,object_name,str(rec[2]))
|
||||
flag=True
|
||||
if flag:
|
||||
t = "Mail archived to OpenERP.\nArchive Summary : \n"
|
||||
if ext_msg != "" :
|
||||
t+="\nAlready Attached Documents : \n"+ext_msg +"\n"
|
||||
t+="Newly Attachment Documents:\n"+msg
|
||||
win32ui.MessageBox(t,"Archive To OpenERP",win32con.MB_ICONINFORMATION)
|
||||
attachments=mail.Attachments
|
||||
|
||||
for rec in recs: #[('res.partner', 3, 'Agrolait')]
|
||||
model = rec[0]
|
||||
res_id = rec[1]
|
||||
|
||||
object_ids = execute ( conn,'execute',self._dbname,int(self._uid),self._pwd,'ir.model','search',[('model','=',model)])
|
||||
object_name = execute( conn,'execute',self._dbname,int(self._uid),self._pwd,'ir.model','read',object_ids,['name'])[0]['name']
|
||||
|
||||
|
||||
#Reading the Object ir.model Name
|
||||
|
||||
ext_ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'mailgate.message','search',[('message_id','=',mail.EntryID),('model','=',model),('res_id','=',res_id)])
|
||||
if ext_ids:
|
||||
name = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,model,'read',res_id,['name'])['name']
|
||||
ext_msg += """This mail is already archived to {1} '{2}'.
|
||||
""".format(object_name,name)
|
||||
continue
|
||||
|
||||
msg = {
|
||||
'subject':mail.Subject,
|
||||
'date':str(mail.ReceivedTime),
|
||||
'body':mail.Body,
|
||||
'cc':mail.CC,
|
||||
'from':mail.SenderEmailAddress,
|
||||
'to':mail.To,
|
||||
'message-id':str(mail.EntryID),## we are use Entry_Id as a MessageID Because MessageID is not provided by Outlook API, http://msdn.microsoft.com/en-us/library/bb176688%28v=office.12%29.aspx
|
||||
'references':False,
|
||||
}
|
||||
result = {}
|
||||
if attachments:
|
||||
result = self.MakeAttachment([rec], mail)
|
||||
|
||||
attachment_ids = result.get(model, {}).get(res_id, [])
|
||||
ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'email.server.tools','history',model, res_id, msg, attachment_ids)
|
||||
|
||||
new_msg += """- {0} : {1}\n""".format(object_name,str(rec[2]))
|
||||
flag = True
|
||||
|
||||
if flag:
|
||||
t = ext_msg
|
||||
t += """Mail archived Successfully with attachments.\n"""+new_msg
|
||||
win32ui.MessageBox(t,"Archived to OpenERP",win32con.MB_ICONINFORMATION)
|
||||
return flag
|
||||
|
||||
def IsCRMInstalled(self):
|
||||
@@ -189,7 +196,7 @@ class XMLRpcConn(object):
|
||||
obj_list.append((-999, ustr('')))
|
||||
for id in ids:
|
||||
object = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.partner','read',[id],['id','name'])[0]
|
||||
obj_list.append((object['id'], ustr(object['name']).encode('iso-8859-1')))
|
||||
obj_list.append((object['id'], ustr(object['name'])))
|
||||
return obj_list
|
||||
|
||||
def GetObjectItems(self, search_list=[], search_text=''):
|
||||
@@ -203,17 +210,17 @@ class XMLRpcConn(object):
|
||||
ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,obj,'search',['|',('name','ilike',ustr(search_text)),('email','ilike',ustr(search_text))])
|
||||
recs = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,obj,'read',ids,['id','name','street','city'])
|
||||
for rec in recs:
|
||||
name = ustr(rec['name']).encode('iso-8859-1')
|
||||
name = ustr(rec['name'])
|
||||
if rec['street']:
|
||||
name += ', ' + ustr(rec['street']).encode('iso-8859-1')
|
||||
name += ', ' + ustr(rec['street'])
|
||||
if rec['city']:
|
||||
name += ', ' + ustr(rec['city']).encode('iso-8859-1')
|
||||
name += ', ' + ustr(rec['city'])
|
||||
res.append((obj,rec['id'],name,object_name))
|
||||
else:
|
||||
ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,obj,'search',[('name','ilike',ustr(search_text))])
|
||||
recs = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,obj,'read',ids,['id','name'])
|
||||
for rec in recs:
|
||||
name = ustr(rec['name']).encode('iso-8859-1')
|
||||
name = ustr(rec['name'])
|
||||
res.append((obj,rec['id'],name,object_name))
|
||||
return res
|
||||
|
||||
@@ -247,17 +254,22 @@ class XMLRpcConn(object):
|
||||
|
||||
def MakeAttachment(self, recs, mail):
|
||||
attachments = mail.Attachments
|
||||
result = {}
|
||||
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
|
||||
att_folder_path = os.path.abspath(os.path.dirname(__file__)+"\\dialogs\\resources\\attachments\\")
|
||||
if not os.path.exists(att_folder_path):
|
||||
os.makedirs(att_folder_path)
|
||||
for rec in recs: #[('res.partner', 3, 'Agrolait')]
|
||||
|
||||
obj = rec[0]
|
||||
obj_id = rec[1]
|
||||
res={}
|
||||
res['res_model'] = obj
|
||||
attachment_ids = []
|
||||
if obj not in result:
|
||||
result[obj] = {}
|
||||
for i in xrange(1, attachments.Count+1):
|
||||
fn = ustr(attachments[i].FileName).encode('iso-8859-1')
|
||||
fn = ustr(attachments[i].FileName)
|
||||
if len(fn) > 64:
|
||||
l = 64 - len(fn)
|
||||
f = fn.split('.')
|
||||
@@ -271,7 +283,10 @@ class XMLRpcConn(object):
|
||||
res['datas_fname'] = ustr(fn)
|
||||
res['datas'] = content
|
||||
res['res_id'] = obj_id
|
||||
execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'ir.attachment','create',res)
|
||||
id = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'ir.attachment','create',res)
|
||||
attachment_ids.append(id)
|
||||
result[obj].update({obj_id: attachment_ids})
|
||||
return result
|
||||
|
||||
def CreateContact(self, sel=None, res=None):
|
||||
res=eval(str(res))
|
||||
@@ -345,7 +360,7 @@ class XMLRpcConn(object):
|
||||
state_ids = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.country.state', 'search', [])
|
||||
for state_id in state_ids:
|
||||
obj = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.country.state', 'read', [state_id],['id','name'])[0]
|
||||
state_list.append((obj['id'], ustr(obj['name']).encode('iso-8859-1')))
|
||||
state_list.append((obj['id'], ustr(obj['name'])))
|
||||
return state_list
|
||||
|
||||
def GetAllCountry(self):
|
||||
@@ -356,5 +371,5 @@ class XMLRpcConn(object):
|
||||
country_ids = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.country', 'search', [])
|
||||
for country_id in country_ids:
|
||||
obj = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.country','read', [country_id], ['id','name'])[0]
|
||||
country_list.append((obj['id'], ustr(obj['name']).encode('iso-8859-1')))
|
||||
country_list.append((obj['id'], ustr(obj['name'])))
|
||||
return country_list
|
||||
|
||||
+74
-90
@@ -29,12 +29,12 @@ from osv import fields, osv
|
||||
class project_task_type(osv.osv):
|
||||
_name = 'project.task.type'
|
||||
_description = 'Task Stage'
|
||||
_order = 'sequence'
|
||||
_columns = {
|
||||
'name': fields.char('Stage Name', required=True, size=64, translate=True),
|
||||
'description': fields.text('Description'),
|
||||
'sequence': fields.integer('Sequence'),
|
||||
}
|
||||
_order = 'sequence'
|
||||
|
||||
_defaults = {
|
||||
'sequence': 1
|
||||
@@ -55,8 +55,7 @@ class project(osv.osv):
|
||||
LEFT JOIN account_analytic_account account ON account.id = project.analytic_account_id
|
||||
LEFT JOIN project_user_rel rel ON rel.project_id = project.analytic_account_id
|
||||
WHERE (account.user_id = %s or rel.uid = %s)"""%(user, user))
|
||||
res = cr.fetchall()
|
||||
return [(r[0]) for r in res]
|
||||
return [(r[0]) for r in cr.fetchall()]
|
||||
return super(project, self).search(cr, user, args, offset=offset, limit=limit, order=order,
|
||||
context=context, count=count)
|
||||
|
||||
@@ -66,10 +65,6 @@ class project(osv.osv):
|
||||
res[m.id] = (m.parent_id and (m.parent_id.name + '/') or '') + m.name
|
||||
return res
|
||||
|
||||
def check_recursion(self, cursor, user, ids, parent=None):
|
||||
return super(project, self).check_recursion(cursor, user, ids,
|
||||
parent=parent)
|
||||
|
||||
def onchange_partner_id(self, cr, uid, ids, part=False, context=None):
|
||||
partner_obj = self.pool.get('res.partner')
|
||||
if not part:
|
||||
@@ -80,30 +75,29 @@ class project(osv.osv):
|
||||
return {'value':{'contact_id': addr['contact'], 'pricelist_id': pricelist_id}}
|
||||
|
||||
def get_all_child_projects(self, cr, uid, ids, context=None):
|
||||
# Calculate child project for Given project id => For progress rate + planned time + Time spent
|
||||
cr.execute('''select prpc.id as id from account_analytic_account as p
|
||||
join account_analytic_account as c on p.id = c.parent_id
|
||||
join project_project as prp on prp.analytic_account_id = p.id
|
||||
join project_project as prpc on prpc.analytic_account_id = c.id
|
||||
where prp.id in %s''',(tuple(ids),))
|
||||
join account_analytic_account as c on p.id = c.parent_id
|
||||
join project_project as prp on prp.analytic_account_id = p.id
|
||||
join project_project as prpc on prpc.analytic_account_id = c.id
|
||||
where prp.id in %s''',(tuple(ids),))
|
||||
|
||||
child_ids = cr.fetchall()
|
||||
if child_ids:
|
||||
child_ids = [x[0] for x in child_ids]
|
||||
child_ids = self.get_all_child_projects(cr, uid, child_ids)
|
||||
child_ids = [x[0] for x in child_ids]
|
||||
child_ids = self.get_all_child_projects(cr, uid, child_ids)
|
||||
return ids + child_ids
|
||||
|
||||
return ids+child_ids
|
||||
|
||||
def _get_user_and_default_uom_ids(self, cr, uid):
|
||||
users_obj = self.pool.get('res.users')
|
||||
model_data_obj = self.pool.get('ir.model.data')
|
||||
|
||||
model_data_id = model_data_obj._get_id(cr, uid, 'product', 'uom_hour')
|
||||
default_uom = user_uom = model_data_obj.read(cr, uid, [model_data_id], ['res_id'])[0]['res_id']
|
||||
obj_tm = users_obj.browse(cr, uid, uid).company_id.project_time_mode_id
|
||||
if obj_tm:
|
||||
user_uom = obj_tm.id
|
||||
return user_uom, default_uom
|
||||
|
||||
|
||||
def _progress_rate(self, cr, uid, ids, names, arg, context=None):
|
||||
res = {}.fromkeys(ids, 0.0)
|
||||
progress = {}
|
||||
@@ -138,19 +132,19 @@ where prp.id in %s''',(tuple(ids),))
|
||||
p = tocompute.pop()
|
||||
for i in range(3):
|
||||
s[i] += progress.get(p, (0.0, 0.0, 0.0))[i]
|
||||
|
||||
uom_obj = self.pool.get('product.uom')
|
||||
|
||||
uom_obj = self.pool.get('product.uom')
|
||||
user_uom, def_uom = self._get_user_and_default_uom_ids(cr, uid)
|
||||
if user_uom != def_uom:
|
||||
s[0] = uom_obj._compute_qty(cr, uid, user_uom, s[0], def_uom)
|
||||
s[1] = uom_obj._compute_qty(cr, uid, user_uom, s[1], def_uom)
|
||||
s[2] = uom_obj._compute_qty(cr, uid, user_uom, s[2], def_uom)
|
||||
|
||||
|
||||
if project.state == 'close':
|
||||
progress_rate = 100.0
|
||||
else:
|
||||
progress_rate = s[1] and round(min(100.0 * s[2] / s[1], 99.99), 2)
|
||||
|
||||
|
||||
res[project.id] = {
|
||||
'planned_hours': s[0],
|
||||
'effective_hours': s[2],
|
||||
@@ -164,7 +158,7 @@ where prp.id in %s''',(tuple(ids),))
|
||||
if proj.tasks:
|
||||
raise osv.except_osv(_('Operation Not Permitted !'), _('You can not delete a project with tasks. I suggest you to deactivate it.'))
|
||||
return super(project, self).unlink(cr, uid, ids, *args, **kwargs)
|
||||
|
||||
|
||||
_columns = {
|
||||
'complete_name': fields.function(_complete_name, method=True, string="Project Name", type='char', size=250),
|
||||
'active': fields.boolean('Active', help="If the active field is set to true, it will allow you to hide the project without removing it."),
|
||||
@@ -253,21 +247,20 @@ where prp.id in %s''',(tuple(ids),))
|
||||
default['name'] = proj.name+_(' (copy)')
|
||||
res = super(project, self).copy(cr, uid, id, default, context)
|
||||
|
||||
task_ids = task_obj.search(cr, uid, [('project_id','=', res), ('active','=',True)])
|
||||
tasks = task_obj.browse(cr, uid, task_ids)
|
||||
for task in tasks:
|
||||
date_deadline = None
|
||||
if task.date_start:
|
||||
ds = date(*time.strptime(task.date_start,'%Y-%m-%d %H:%M:%S')[:3])
|
||||
if task.date_deadline:
|
||||
dd = date(*time.strptime(task.date_deadline,'%Y-%m-%d')[:3])
|
||||
diff = dd-ds
|
||||
date_deadline = (datetime.now()+diff).strftime('%Y-%m-%d %H:%M:%S')
|
||||
task_obj.write(cr, uid, task.id, {'active':True,
|
||||
'date_start': False,
|
||||
'date_end': False,
|
||||
'date_deadline':date_deadline,
|
||||
})
|
||||
# task_ids = task_obj.search(cr, uid, [('project_id','=', res), ('active','=',True)])
|
||||
# tasks = task_obj.browse(cr, uid, task_ids)
|
||||
# for task in tasks:
|
||||
# date_deadline = None
|
||||
# if task.date_start:
|
||||
# ds = date(*time.strptime(task.date_start,'%Y-%m-%d %H:%M:%S')[:3])
|
||||
# if task.date_deadline:
|
||||
# dd = date(*time.strptime(task.date_deadline,'%Y-%m-%d')[:3])
|
||||
# diff = dd-ds
|
||||
# date_deadline = (datetime.now()+diff).strftime('%Y-%m-%d %H:%M:%S')
|
||||
# task_obj.write(cr, uid, task.id, {'date_start': False,
|
||||
# 'date_end': False,
|
||||
# 'date_deadline':date_deadline,
|
||||
# })
|
||||
|
||||
return res
|
||||
|
||||
@@ -335,28 +328,29 @@ class task(osv.osv):
|
||||
_description = "Task"
|
||||
_log_create = True
|
||||
_date_name = "date_start"
|
||||
|
||||
|
||||
def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False):
|
||||
obj_project = self.pool.get('project.project')
|
||||
for domain in args:
|
||||
if domain[0] == 'project_id' and (not isinstance(domain[2], str)):
|
||||
id = isinstance(domain[2], list) and int(domain[2][0]) or int(domain[2])
|
||||
if id:
|
||||
if self.pool.get('project.project').read(cr, user, id, ['state'])['state'] == 'template':
|
||||
args.append(['active', '=', False])
|
||||
id = isinstance(domain[2], list) and domain[2][0] or domain[2]
|
||||
if id and isinstance(id, (long, int)):
|
||||
if obj_project.read(cr, user, id, ['state'])['state'] == 'template':
|
||||
args.append(('active', '=', False))
|
||||
return super(task, self).search(cr, user, args, offset=offset, limit=limit, order=order, context=context, count=count)
|
||||
|
||||
def _str_get(self, task, level=0, border='***', context=None):
|
||||
return border+' '+(task.user_id and task.user_id.name.upper() or '')+(level and (': L'+str(level)) or '')+(' - %.1fh / %.1fh'%(task.effective_hours or 0.0,task.planned_hours))+' '+border+'\n'+ \
|
||||
border[0]+' '+(task.name or '')+'\n'+ \
|
||||
(task.description or '')+'\n\n'
|
||||
|
||||
|
||||
# Compute: effective_hours, total_hours, progress
|
||||
def _hours_get(self, cr, uid, ids, field_names, args, context=None):
|
||||
project_obj = self.pool.get('project.project')
|
||||
res = {}
|
||||
cr.execute("SELECT task_id, COALESCE(SUM(hours),0) FROM project_task_work WHERE task_id IN %s GROUP BY task_id",(tuple(ids),))
|
||||
hours = dict(cr.fetchall())
|
||||
|
||||
|
||||
uom_obj = self.pool.get('product.uom')
|
||||
user_uom, default_uom = project_obj._get_user_and_default_uom_ids(cr, uid)
|
||||
if user_uom != default_uom:
|
||||
@@ -364,7 +358,7 @@ class task(osv.osv):
|
||||
if hours.get(task.id, False):
|
||||
dur_in_user_uom = uom_obj._compute_qty(cr, uid, default_uom, hours.get(task.id, 0.0), user_uom)
|
||||
hours[task.id] = dur_in_user_uom
|
||||
|
||||
|
||||
for task in self.browse(cr, uid, ids, context=context):
|
||||
res[task.id] = {'effective_hours': hours.get(task.id, 0.0), 'total_hours': task.remaining_hours + hours.get(task.id, 0.0)}
|
||||
res[task.id]['delay_hours'] = res[task.id]['total_hours'] - task.planned_hours
|
||||
@@ -412,7 +406,7 @@ class task(osv.osv):
|
||||
if task.project_id.active == False or task.project_id.state == 'template':
|
||||
res[task.id] = False
|
||||
return res
|
||||
|
||||
|
||||
_columns = {
|
||||
'active': fields.function(_is_template, method=True, store=True, string='Not a Template Task', type='boolean', help="This field is computed automatically and have the same behavior than the boolean 'active' field: if the task is linked to a template or unactivated project, it will be hidden unless specifically asked."),
|
||||
'name': fields.char('Task Summary', size=128, required=True),
|
||||
@@ -460,7 +454,7 @@ class task(osv.osv):
|
||||
_order = "sequence, priority, date_start, id"
|
||||
|
||||
_constraints = [
|
||||
(_check_dates, 'Error! task start-date must be lower then task end-date.', ['date_start', 'date_end'])
|
||||
(_check_dates, 'Error! Task start-date must be lower then task end-date.', ['date_start', 'date_end'])
|
||||
]
|
||||
#
|
||||
# Override view according to the company definition
|
||||
@@ -492,7 +486,6 @@ class task(osv.osv):
|
||||
for f in res['fields']:
|
||||
if 'Hours' in res['fields'][f]['string']:
|
||||
res['fields'][f]['string'] = res['fields'][f]['string'].replace('Hours',tm)
|
||||
|
||||
return res
|
||||
|
||||
def do_close(self, cr, uid, ids, *args):
|
||||
@@ -601,7 +594,6 @@ class task(osv.osv):
|
||||
self.write(cr, uid, ids, {'state': 'draft'})
|
||||
return True
|
||||
|
||||
|
||||
def do_pending(self, cr, uid, ids, *args):
|
||||
self.write(cr, uid, ids, {'state': 'pending'})
|
||||
for (id, name) in self.name_get(cr, uid, ids):
|
||||
@@ -635,7 +627,7 @@ task()
|
||||
|
||||
class project_work(osv.osv):
|
||||
_name = "project.task.work"
|
||||
_description = "Task Work"
|
||||
_description = "Project Task Work"
|
||||
_columns = {
|
||||
'name': fields.char('Work summary', size=128),
|
||||
'date': fields.datetime('Date'),
|
||||
@@ -651,34 +643,36 @@ class project_work(osv.osv):
|
||||
}
|
||||
|
||||
_order = "date desc"
|
||||
|
||||
|
||||
def create(self, cr, uid, vals, *args, **kwargs):
|
||||
if (not 'task_id' in vals) or (not 'hours' in vals):
|
||||
return super(project_work,self).create(cr, uid, vals, *args, **kwargs)
|
||||
if not vals['hours']:
|
||||
vals['hours'] = 0.00
|
||||
|
||||
project_obj = self.pool.get('project.project')
|
||||
uom_obj = self.pool.get('product.uom')
|
||||
|
||||
if (not 'task_id' in vals) or (not 'hours' in vals):
|
||||
return super(project_work, self).create(cr, uid, vals, *args, **kwargs)
|
||||
if not vals['hours']:
|
||||
vals['hours'] = 0.00
|
||||
|
||||
user_uom, default_uom = project_obj._get_user_and_default_uom_ids(cr, uid)
|
||||
duration = vals['hours']
|
||||
|
||||
|
||||
if user_uom != default_uom:
|
||||
duration = uom_obj._compute_qty(cr, uid, default_uom, duration, user_uom)
|
||||
cr.execute('update project_task set remaining_hours=remaining_hours - %s where id=%s', (duration, vals['task_id']))
|
||||
return super(project_work,self).create(cr, uid, vals, *args, **kwargs)
|
||||
|
||||
def write(self, cr, uid, ids, vals, context=None):
|
||||
project_obj = self.pool.get('project.project')
|
||||
uom_obj = self.pool.get('product.uom')
|
||||
|
||||
if context is None:
|
||||
context = {}
|
||||
if not vals['hours']:
|
||||
vals['hours'] = 0.00
|
||||
|
||||
project_obj = self.pool.get('project.project')
|
||||
uom_obj = self.pool.get('product.uom')
|
||||
user_uom, default_uom = project_obj._get_user_and_default_uom_ids(cr, uid)
|
||||
vals['hours'] = 0.00
|
||||
|
||||
user_uom, default_uom = project_obj._get_user_and_default_uom_ids(cr, uid)
|
||||
duration = vals['hours']
|
||||
|
||||
|
||||
if user_uom == default_uom:
|
||||
for work in self.browse(cr, uid, ids, context):
|
||||
cr.execute('update project_task set remaining_hours=remaining_hours - %s + (%s) where id=%s', (duration, work.hours, work.task_id.id))
|
||||
@@ -687,14 +681,14 @@ class project_work(osv.osv):
|
||||
duration = uom_obj._compute_qty(cr, uid, default_uom, duration, user_uom)
|
||||
del_work = uom_obj._compute_qty(cr, uid, default_uom, work.hours, user_uom)
|
||||
cr.execute('update project_task set remaining_hours=remaining_hours - %s + (%s) where id=%s', (duration, del_work, work.task_id.id))
|
||||
|
||||
|
||||
return super(project_work,self).write(cr, uid, ids, vals, context)
|
||||
|
||||
def unlink(self, cr, uid, ids, *args, **kwargs):
|
||||
context = kwargs.get('context', {})
|
||||
project_obj = self.pool.get('project.project')
|
||||
user_uom, default_uom = project_obj._get_user_and_default_uom_ids(cr, uid)
|
||||
|
||||
user_uom, default_uom = project_obj._get_user_and_default_uom_ids(cr, uid)
|
||||
|
||||
if user_uom == default_uom:
|
||||
for work in self.browse(cr, uid, ids, context):
|
||||
cr.execute('update project_task set remaining_hours=remaining_hours + %s where id=%s', (work.hours, work.task_id.id))
|
||||
@@ -709,64 +703,54 @@ project_work()
|
||||
class config_compute_remaining(osv.osv_memory):
|
||||
_name='config.compute.remaining'
|
||||
|
||||
def _get_remaining(self,cr, uid, ctx):
|
||||
task_obj = self.pool.get('project.task')
|
||||
if 'active_id' in ctx:
|
||||
return task_obj.browse(cr, uid, ctx['active_id'], context=ctx).remaining_hours
|
||||
def _get_remaining(self,cr, uid, context=None):
|
||||
if context and 'active_id' in context:
|
||||
return self.pool.get('project.task').browse(cr, uid, context['active_id'], context=context).remaining_hours
|
||||
return False
|
||||
|
||||
_columns = {
|
||||
'remaining_hours' : fields.float('Remaining Hours', digits=(16,2), help="Put here the remaining hours required to close the task."),
|
||||
}
|
||||
|
||||
def _get_analytic_account(self, cr, uid, context={}):
|
||||
if context.get('account_id', False):
|
||||
return context.get('account_id')
|
||||
return False
|
||||
|
||||
_defaults = {
|
||||
'account_id' : _get_analytic_account,
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'remaining_hours': _get_remaining
|
||||
}
|
||||
|
||||
|
||||
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
|
||||
users_obj = self.pool.get('res.users')
|
||||
obj_tm = users_obj.browse(cr, uid, uid, context).company_id.project_time_mode_id
|
||||
tm = obj_tm and obj_tm.name or 'Hours'
|
||||
|
||||
|
||||
res = super(config_compute_remaining, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar, submenu=submenu)
|
||||
|
||||
|
||||
if tm in ['Hours','Hour']:
|
||||
return res
|
||||
|
||||
|
||||
eview = etree.fromstring(res['arch'])
|
||||
|
||||
|
||||
def _check_rec(eview):
|
||||
if eview.attrib.get('widget','') == 'float_time':
|
||||
eview.set('widget','float')
|
||||
for child in eview:
|
||||
_check_rec(child)
|
||||
return True
|
||||
|
||||
|
||||
_check_rec(eview)
|
||||
|
||||
|
||||
res['arch'] = etree.tostring(eview)
|
||||
|
||||
|
||||
for f in res['fields']:
|
||||
if 'Hours' in res['fields'][f]['string']:
|
||||
res['fields'][f]['string'] = res['fields'][f]['string'].replace('Hours',tm)
|
||||
|
||||
return res
|
||||
|
||||
def compute_hours(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
task_obj = self.pool.get('project.task')
|
||||
request = self.pool.get('res.request')
|
||||
if 'active_id' in context:
|
||||
remaining_hrs=self.browse(cr,uid,ids)[0].remaining_hours
|
||||
remaining_hrs = self.browse(cr,uid,ids)[0].remaining_hours
|
||||
task_obj.write(cr,uid,context['active_id'],{'remaining_hours':remaining_hrs})
|
||||
if context.get('button_reactivate', False):
|
||||
tasks = task_obj.browse(cr, uid, [context['active_id']], context=context)
|
||||
@@ -786,7 +770,7 @@ class config_compute_remaining(osv.osv_memory):
|
||||
return {
|
||||
'type': 'ir.actions.act_window_close',
|
||||
}
|
||||
|
||||
|
||||
config_compute_remaining()
|
||||
|
||||
class message(osv.osv):
|
||||
|
||||
@@ -535,7 +535,6 @@ class purchase_order(osv.osv):
|
||||
'fiscal_position': porder.fiscal_position and porder.fiscal_position.id or False,
|
||||
})
|
||||
else:
|
||||
#order_infos['name'] += ', %s' % porder.name
|
||||
if porder.notes:
|
||||
order_infos['notes'] = (order_infos['notes'] or '') + ('\n%s' % (porder.notes,))
|
||||
if porder.origin:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). All Rights Reserved
|
||||
# $Id$
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
@@ -23,8 +23,6 @@
|
||||
import time
|
||||
|
||||
from osv import fields,osv
|
||||
from osv import orm
|
||||
import netsvc
|
||||
from tools.translate import _
|
||||
|
||||
class purchase_requisition(osv.osv):
|
||||
|
||||
@@ -23,9 +23,6 @@ import time
|
||||
from mx import DateTime
|
||||
|
||||
from osv import fields, osv
|
||||
from service import web_services
|
||||
import netsvc
|
||||
import pooler
|
||||
from osv.orm import browse_record, browse_null
|
||||
|
||||
class purchase_requisition_partner(osv.osv_memory):
|
||||
|
||||
@@ -276,12 +276,11 @@
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</section>
|
||||
<para style="terp_default_5cm_Above_Space">[[ (move_lines.state == 'done' or move_lines.state == 'confirmed') and removeParentNode('para') ]]</para>
|
||||
<para style="terp_default_Bold_9">Non Assigned Products: [[ ( move_lines.state == 'assigned' or move_lines.state == 'done' or move_lines.state == 'confirmed' ) and removeParentNode('para') ]]</para>
|
||||
<para style="terp_default_1cm_above_space">[[ (move_lines.state == 'done' or move_lines.state == 'confirmed') and removeParentNode('para') ]]</para>
|
||||
<section>
|
||||
<para style="terp_default_8">[[ repeatIn([line for line in picking.move_lines if (line.state != 'assigned' )],'move_lines') ]]</para>
|
||||
|
||||
<para style="terp_default_Bold_9">[[ ([line for line in picking.move_lines if (line.state == 'draft' )]) and 'Non Assigned Products:' or removeParentNode('para') ]]</para>
|
||||
<section>
|
||||
<blockTable colWidths="197.0,68.0,61.0,57,46.0,26.0,74.0" style="Move_Line_Content_Other_State">
|
||||
<para style="terp_default_8">[[ repeatIn([line for line in picking.move_lines if (line.state != 'assigned' )],'move_lines') ]]</para>
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_default_9">[ [[ move_lines.product_id.default_code ]] ] [[ move_lines.product_id.name ]] [[ move_lines.product_id.variants or '']]</para>
|
||||
|
||||
@@ -24,9 +24,6 @@ from tools.translate import _
|
||||
import tools
|
||||
from tools.sql import drop_view_if_exists
|
||||
|
||||
#
|
||||
# Check if it works with UoM ???
|
||||
#
|
||||
class stock_report_prodlots(osv.osv):
|
||||
_name = "stock.report.prodlots"
|
||||
_description = "Stock report by production lots"
|
||||
|
||||
@@ -24,7 +24,7 @@ import time
|
||||
from report.misc import choice_colors
|
||||
|
||||
#
|
||||
# dRAw a graph for stocks
|
||||
# Draw a graph for stocks
|
||||
#
|
||||
class stock_graph(object):
|
||||
def __init__(self, io):
|
||||
|
||||
@@ -20,13 +20,7 @@
|
||||
##############################################################################
|
||||
|
||||
from osv import fields, osv
|
||||
from service import web_services
|
||||
from tools.misc import UpdateableStr, UpdateableDict
|
||||
from tools.translate import _
|
||||
import netsvc
|
||||
import pooler
|
||||
import time
|
||||
import wizard
|
||||
|
||||
class stock_inventory_merge(osv.osv_memory):
|
||||
_name = "stock.inventory.merge"
|
||||
|
||||
@@ -186,8 +186,7 @@ class stock_partial_move(osv.osv_memory):
|
||||
res['move%s_product_qty'%(m.id)] = m.product_qty
|
||||
if 'move%s_product_uom'%(m.id) in fields:
|
||||
res['move%s_product_uom'%(m.id)] = m.product_uom.id
|
||||
|
||||
if (m.picking_id.type == 'out') and (m.product_id.cost_method == 'average'):
|
||||
if (m.picking_id.type == 'out') and (m.product_id.cost_method == 'average') and 'sale_id' in m.picking_id._columns.keys():
|
||||
price = 0
|
||||
if hasattr(m, 'sale_line_id') and m.sale_line_id:
|
||||
price = m.sale_line_id.price_unit
|
||||
@@ -201,7 +200,7 @@ class stock_partial_move(osv.osv_memory):
|
||||
if 'move%s_product_currency'%(m.id) in fields:
|
||||
res['move%s_product_currency'%(m.id)] = currency
|
||||
|
||||
if (m.picking_id.type == 'in') and (m.product_id.cost_method == 'average'):
|
||||
if (m.picking_id.type == 'in') and (m.product_id.cost_method == 'average') and 'purchase_id' in m.picking_id._columns.keys():
|
||||
price = 0
|
||||
if hasattr(m, 'purchase_line_id') and m.purchase_line_id:
|
||||
price = m.purchase_line_id.price_unit
|
||||
@@ -227,11 +226,6 @@ class stock_partial_move(osv.osv_memory):
|
||||
"""
|
||||
|
||||
rec_id = context and context.get('active_id', False)
|
||||
#tracking_lot = context.get('tracking_lot', False)
|
||||
#if tracking_lot:
|
||||
# tracking = self.pool.get('stock.tracking')
|
||||
# tracking_lot = tracking.get_create_tracking_lot(cr, uid,[rec_id], tracking_lot)
|
||||
# context ['tracking_lot'] = tracking_lot
|
||||
move_obj = self.pool.get('stock.move')
|
||||
move_ids = context.get('active_ids', False)
|
||||
partial = self.browse(cr, uid, ids[0], context)
|
||||
|
||||
Reference in New Issue
Block a user