[MERGE]: merging from same branch

bzr revid: mga@mga-20100316143942-sholqgyq90092tha
This commit is contained in:
Mantavya Gajjar 2010-03-16 20:09:42 +05:30
commit e14a00ee18
112 changed files with 4293 additions and 1980 deletions

View File

@ -668,7 +668,7 @@
<field eval="True" name="object"/>
</record>
<wizard id="action_move_journal_line_form" menu="False" model="account.move.line" name="account.move.journal" string="Making Entries by Line"/>
<wizard id="action_move_journal_line_form" menu="False" model="account.move.line" name="account.move.journal" string="Entries by Line"/>
<menuitem icon="STOCK_JUSTIFY_FILL" action="action_move_journal_line_form" id="menu_action_move_journal_line_form" parent="account.menu_finance_entries" type="wizard" sequence="5"/>
<!--
@ -974,7 +974,7 @@
<menuitem action="action_move_line_form" id="menu_action_move_line_form" parent="next_id_29"/>
<record id="action_move_line_form_encode_by_move" model="ir.actions.act_window">
<field name="name">Making Entries by Move</field>
<field name="name">Entries by Move</field>
<field name="res_model">account.move</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>

View File

@ -202,7 +202,7 @@
<field name="view_type">form</field>
<field name="view_id" ref="view_account_analytic_line_tree"/>
</record>
<wizard id="action_account_analytic_line" menu="False" model="account.analytic.line" name="account.analytic.line" string="Making Entries by Line"/>
<wizard id="action_account_analytic_line" menu="False" model="account.analytic.line" name="account.analytic.line" string="Entries by Line"/>
<menuitem id="next_id_41" name="Analytic Entries" parent="account.menu_finance_entries"/>
<menuitem type="wizard" icon="STOCK_JUSTIFY_FILL" action="action_account_analytic_line" id="account_entries_analytic_entries" parent="next_id_41"/>

View File

@ -39,7 +39,7 @@ def _action_open_window(self, cr, uid, data, context):
id = mod_obj.read(cr, uid, result, ['res_id'])
return {
'name': _('Analytic Entries'),
'name': _('Analytic Entries by line'),
'view_type': 'form',
"view_mode": 'tree,form',
'res_model': 'account.analytic.line',
@ -71,11 +71,11 @@ class account_analytic_line(wizard.interface):
}
states = {
'init': {
'init': {
'actions': [],
'result': {'type': 'form', 'arch':form1, 'fields':form1_fields, 'state': [('end', 'Cancel','gtk-cancel'),('open', 'Open Entries','gtk-ok')]}
},
'open': {
'open': {
'actions': [],
'result': {'type': 'action', 'action': _action_open_window, 'state':'end'}
}

View File

@ -34,6 +34,16 @@
'init_xml': ['auction_sequence.xml'],
'update_xml': [
'security/ir.model.access.csv',
'wizard/auction_lots_able_view.xml',
'wizard/auction_lots_enable_view.xml',
'wizard/auction_lots_make_invoice_buyer_view.xml',
'wizard/auction_lots_make_invoice_view.xml',
'wizard/auction_taken_view.xml',
'wizard/auction_lots_auction_move_view.xml',
'wizard/auction_pay_buy_view.xml',
'wizard/auction_payer_sel_view.xml',
'wizard/auction_lots_sms_send_view.xml',
'auction_view.xml',
'auction_report.xml',
'auction_wizard.xml'

View File

@ -478,13 +478,15 @@ class auction_lots(osv.osv):
result = [ (r['id'], str(r['obj_num'])+' - '+r['name']) for r in self.read(cr, user, ids, ['name','obj_num'])]
return result
def name_search(self, cr, user, name, args=[], operator='ilike', context={}):
def name_search(self, cr, user, name, args=None, operator='ilike', context={}):
if not args:
args = []
try:
ids = self.search(cr, user, [('obj_num','=',int(name))]+ args)
ids = self.search(cr, user, [('obj_num','=',int(name))] + args)
except:
ids = []
if not ids:
ids = self.search(cr, user, [('name',operator,name)]+ args)
ids = self.search(cr, user, [('name',operator,name)] + args)
return self.name_get(cr, user, ids)
def _sum_taxes_by_type_and_id(self, taxes):

View File

@ -3,7 +3,8 @@
<data>
<menuitem name="Auction Management" id="auction_menu_root" icon="terp-purchase"/>
<menuitem name="Configuration" parent="auction_menu_root" id="auction_config_menu" sequence="7"/>
<menuitem name="Tools Bar Codes" id="auction_outils_menu" parent="auction_menu_root" sequence="5" />
<menuitem name="Deliveries Management" action="action_auction_taken" id="menu_wizard_emporte" parent="auction_outils_menu"/>
=======================================================
Auction Management/Configuration/artist
=======================================================
@ -203,6 +204,7 @@
<field name="lot_est2"/>
<field name="product_id"/>
<field name="state" readonly="1"/>
</form>
</field>
</record>
@ -277,7 +279,7 @@
<separator string="Description" colspan="4"/>
<field name="obj_desc" colspan="4" nolabel="1" select="2"/>
<field name="state" colspan="1" select="2"/>
<group col="4" colspan="2">
<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"/>
@ -330,7 +332,6 @@
<field name="date"/>
</tree>
</field>
</page>
<page string="Bids">
<field name="bid_lines" colspan="4" nolabel="1" editable="top">
@ -340,9 +341,7 @@
<field name="call"/>
</tree>
</field>
</page>
</notebook>
</form>
</field>

View File

@ -1,8 +1,8 @@
<?xml version="1.0"?>
<openerp>
<data>
<!--<delete model="ir.actions.wizard" search="[('wiz_name','like','auction.lots.')]"/>-->
<!-- Following wizard is remaining to implement in osv_memory-->
<!--
<wizard string="Send to website"
model="auction.lots"
name="auction.lots.send.aie"
@ -20,45 +20,6 @@
multi="1"
id="wizard_map_user"/>
<wizard string="Change Auction Date"
model="auction.lots"
name="auction.lots.auction_move"
multi="1"
id="wizard_change_auction"/>
<!--wizard string="Pay objects of the seller"
model="auction.lots"
name="auction.pay.sel"
id="wizard_lots_pay"/-->
<wizard string="Pay objects of the buyer"
model="auction.lots"
name="auction.pay.buy"
id="wizard_pay"/>
<wizard
string="Gestion emporte"
model="auction.dates"
name="auction.taken"
multi="1"
id="wizard_emporte"/>
<menuitem name="Tools Bar Codes"
id="auction_outils_menu"
parent="auction_menu_root" sequence="5"
/>
<menuitem name="Deliveries Management"
action="wizard_emporte"
type="wizard"
id="menu_wizard_emporte"
parent="auction_outils_menu"
/>
<!--wizard string="Cancel payment"
model="auction.lots"
name="auction.lots.cancel"
multi="1"
id="wizard_cancel_pay"/-->
<wizard string="Numerotation (per lot)"
model="auction.lots"
@ -72,56 +33,13 @@
multi="1"
id="wizard_numerotate_automatic"/>
<wizard string="SMS Send"
model="auction.lots"
name="auction.lots.sms_send"
multi="1"
id="wizard_sms"/>
<!--wizard string="Invoice"
model="auction.lots"
name="auction.lots.invoice"
multi="1"
id="wizard_invoicing"/-->
<wizard string="Invoice Seller objects"
model="auction.lots"
name="auction.lots.make_invoice"
multi="1"
id="wizard_invoice"/>
<wizard string="Invoice Buyer objects"
model="auction.lots"
name="auction.lots.make_invoice_buyer"
id="wizard_invoice_buyer1"/>
<wizard string="Unmark as taken away"
model="auction.lots"
name="auction.lots.enable"
multi="1"
id="auction_wizard_enable_taken"/>
<wizard string="Mark as taken away"
model="auction.lots"
name="auction.lots.able"
multi="1"
id="auction_wizard_able_taken"/>
<wizard
id="auction_catalog_flagy"
string="Auction Catalog Flagey"
model="auction.dates"
name="auction.catalog.flagey"
keyword="client_print_multi"/>
<wizard string="Mark as paid for seller"
model="auction.lots"
name="auction.payer.sel"
multi="1"
id="auction_wizard_payer_sel"/>
-->
</data>
</openerp>

View File

@ -22,3 +22,13 @@
"access_report_object_encoded","report.object.encoded","model_report_object_encoded","base.group_user",1,0,0,0
"access_report_object_encoded_manager","report.object.encoded.manager","model_report_object_encoded_manager","base.group_user",1,0,0,0
"access_report_unclassified_objects","report.unclassified.objects","model_report_unclassified_objects","base.group_user",1,0,0,0
"access_auction_lots_able","auction.lots.able","model_auction_lots_able","base.group_user",1,0,0,0
"access_auction_lots_auction_move","auction.lots.auction.move","model_auction_lots_auction_move","base.group_user",1,0,0,0
"access_auction_lots_enable","auction.lots.enable","model_auction_lots_enable","base.group_user",1,0,0,0
"access_auction_lots_make_invoice_buyer","auction.lots.make.invoice.buyer","model_auction_lots_make_invoice_buyer","base.group_user",1,0,0,0
"access_auction_lots_make_invoice","auction.lots.make.invoice","model_auction_lots_make_invoice","base.group_user",1,0,0,0
"access_auction_lots_sms_send","auction.lots.sms.send","model_auction_lots_sms_send","base.group_user",1,0,0,0
"access_auction_pay_buy","auction.pay.buy","model_auction_pay_buy","base.group_user",1,0,0,0
"acess_auction_payer","auction.payer","model_auction_payer","base.group_user",1,0,0,0
"access_auction_pay_sel","auction.pay.sel","model_auction_payer_sel","base.group_user",1,0,0,0
"acess_auction_taken","auction.taken","model_auction_taken","base.group_user",1,0,0,0

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
22 access_report_object_encoded report.object.encoded model_report_object_encoded base.group_user 1 0 0 0
23 access_report_object_encoded_manager report.object.encoded.manager model_report_object_encoded_manager base.group_user 1 0 0 0
24 access_report_unclassified_objects report.unclassified.objects model_report_unclassified_objects base.group_user 1 0 0 0
25 access_auction_lots_able auction.lots.able model_auction_lots_able base.group_user 1 0 0 0
26 access_auction_lots_auction_move auction.lots.auction.move model_auction_lots_auction_move base.group_user 1 0 0 0
27 access_auction_lots_enable auction.lots.enable model_auction_lots_enable base.group_user 1 0 0 0
28 access_auction_lots_make_invoice_buyer auction.lots.make.invoice.buyer model_auction_lots_make_invoice_buyer base.group_user 1 0 0 0
29 access_auction_lots_make_invoice auction.lots.make.invoice model_auction_lots_make_invoice base.group_user 1 0 0 0
30 access_auction_lots_sms_send auction.lots.sms.send model_auction_lots_sms_send base.group_user 1 0 0 0
31 access_auction_pay_buy auction.pay.buy model_auction_pay_buy base.group_user 1 0 0 0
32 acess_auction_payer auction.payer model_auction_payer base.group_user 1 0 0 0
33 access_auction_pay_sel auction.pay.sel model_auction_payer_sel base.group_user 1 0 0 0
34 acess_auction_taken auction.taken model_auction_taken base.group_user 1 0 0 0

View File

@ -19,24 +19,27 @@
#
##############################################################################
import wizard_aie_send
import wizard_aie_send_result
import wizard_lots_buyer_map
import wizard_lots_cancel
import wizard_lots_invoice
import wizard_lots_numerotate
import wizard_lots_pay
import wizard_pay
import wizard_lots_sms
import wizard_lot_date_move
import wizard_auction_journal
import wizard_auction_invoice_buyer
import wizard_transfer_unsold_object
import auction_wizard_enable_taken
import auction_wizard_able_taken
import auction_catalog_flagey
#import wizard_lots_barcode
import wizard_emporte
import wizard_payer
#import wizard_aie_send
#import wizard_aie_send_result
#import wizard_lots_buyer_map
#import wizard_lots_cancel
#import wizard_lots_invoice
#import wizard_lots_numerotate
#import wizard_lots_pay
#import wizard_pay
#import wizard_lot_date_move
#import wizard_transfer_unsold_object
#import auction_catalog_flagey
import auction_lots_able
import auction_lots_enable
import auction_lots_make_invoice_buyer
import auction_lots_make_invoice
import auction_taken
import auction_lots_auction_move
import auction_pay_buy
import auction_payer_sel
import auction_lots_sms_send
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,44 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# 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
# 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/>.
#
##############################################################################
from osv import fields, osv
from tools.translate import _
import netsvc
import pooler
import time
import tools
import wizard
class auction_lots_able(osv.osv_memory):
_name = "auction.lots.able"
_description = "Lots able"
def confirm_able(self, cr, uid, ids, context={}):
"""
This function Update auction lots object and set taken away field true.
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of auction lots ables IDs.
"""
self.pool.get('auction.lots').write(cr, uid, context['active_ids'], {'ach_emp':True})
return {}
auction_lots_able()

View File

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_auction_lots_able" model="ir.ui.view">
<field name="name">auction.lots.able.form</field>
<field name="model">auction.lots.able</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Confirm">
<group colspan="4" >
<separator string="Confirmation set taken away" colspan="4"/>
<newline/>
</group>
<separator string="" colspan="4" />
<group colspan="4" col="6">
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
<button icon="gtk-goto-last" string="Able Taken away" name="confirm_able" type="object"/>
</group>
</form>
</field>
</record>
<act_window name="Mark as taken away"
res_model="auction.lots.able"
src_model="auction.lots"
view_mode="form"
target="new"
key2="client_action_multi"
id="action_auction_lots_able"/>
</data>
</openerp>

View File

@ -0,0 +1,88 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# 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
# 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/>.
#
##############################################################################
from osv import fields, osv
from tools.translate import _
import netsvc
import pooler
import time
import tools
import wizard
class auction_lots_auction_move(osv.osv_memory):
_name = "auction.lots.auction.move"
_description = "Auction move "
_columns= {
'auction_id':fields.many2one('auction.dates', 'Auction Date', required=True),
}
def _top(self, cr, uid, ids, context={}):
refs = self.pool.get('auction.lots')
rec_ids = refs.browse(cr, uid, context['active_ids'])
for rec in rec_ids:
if not rec.auction_id:
raise osv.except_osv('Error !', 'You can not move a lot that has no auction date')
return {}
def auction_move_set(self, cr, uid, ids, context={}):
"""
This Function update auction date on auction lots to given auction date.
erase the auction lots's object adjudication price and its buyer and change state to draft.
create new entry in auction lot history.
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of auction lots auction moves IDs.
"""
refs = self.pool.get('auction.lots')
auction_bid_line_obj = self.pool.get('auction.bid_line')
auction_lot_history_obj = self.pool.get('auction.lot.history')
auction_lots_obj = self.pool.get('auction.lots')
for datas in self.read(cr, uid, ids):
if not (datas['auction_id'] and len(context['active_ids'])) :
return {}
rec_ids = refs.browse(cr, uid, context['active_ids'])
line_ids = auction_bid_line_obj.search(cr, uid, [('lot_id', 'in', context['active_ids'])])
# pooler.get_pool(cr.dbname).get('auction.bid_line').unlink(cr, uid, line_ids)
for rec in rec_ids:
new_id = auction_lot_history_obj.create(cr, uid, {
'auction_id': rec.auction_id.id,
'lot_id': rec.id,
'price': rec.obj_ret
})
up_auction = auction_lots_obj.write(cr, uid, [rec.id], {
'auction_id':datas['auction_id'],
'obj_ret': None,
'obj_price': None,
'ach_login': None,
'ach_uid': None,
'ach_inv_id': None,
'sel_inv_id': None,
'obj_num': None,
'state': 'draft'})
return {}
auction_lots_auction_move()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_auction_lots_auction_move" model="ir.ui.view">
<field name="name">auction.lots.auction.move.form</field>
<field name="model">auction.lots.auction.move</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Change Auction Date">
<group colspan="4" >
<label string="Warning, this will erase the object adjudication price and its buyer !" colspan="2"/>
<newline/>
<field name="auction_id"/>
</group>
<separator string="" colspan="4" />
<group colspan="4" col="6">
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
<button icon="gtk-redo" string="Move to Auction date" name="auction_move_set" type="object"/>
</group>
</form>
</field>
</record>
<act_window name="Change Auction Date"
res_model="auction.lots.auction.move"
src_model="auction.lots"
view_mode="form"
target="new"
key2="client_action_multi"
id="action_auction_lots_auction_move"/>
</data>
</openerp>

View File

@ -0,0 +1,47 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# 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
# 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/>.
#
##############################################################################
from osv import fields, osv
from tools.translate import _
import netsvc
import pooler
import time
import tools
import wizard
class auction_lots_enable(osv.osv_memory):
_name = "auction.lots.enable"
_description = "Lots Enable"
_columns= {
'confirm_en':fields.integer('Catalog Number')
}
def confirm_enable(self, cr, uid, ids, context={}):
"""
This function Update auction lots object and set taken away field False.
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of auction lots enables IDs.
"""
self.pool.get('auction.lots').write(cr, uid, context['active_id'], {'ach_emp':False})
return {}
auction_lots_enable()

View File

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_auction_lots_enable" model="ir.ui.view">
<field name="name">auction.lots.enable.form</field>
<field name="model">auction.lots.enable</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Confirm">
<group colspan="4" >
<separator string="Confirmation enable taken away" colspan="4"/>
<newline/>
</group>
<separator string="" colspan="4" />
<group colspan="4" col="6">
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
<button icon="gtk-goto-last" string="Enable Taken away" name="confirm_enable" type="object"/>
</group>
</form>
</field>
</record>
<act_window name="Unmark as taken away"
res_model="auction.lots.enable"
src_model="auction.lots"
view_mode="form"
target="new"
key2="client_action_multi"
id="action_auction_lots_enable"/>
</data>
</openerp>

View File

@ -0,0 +1,94 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# 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
# 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/>.
#
##############################################################################
from osv import fields, osv
from tools.translate import _
import netsvc
import pooler
import time
import tools
import wizard
class auction_lots_make_invoice(osv.osv_memory):
def _value_amount(self, cr, uid, context={}):
"""
For Amount default value
@return:default auction lots amount value in amount fields.
"""
lots= self.pool.get('auction.lots').browse(cr, uid, context['active_ids'])
amount_total=0.0
for lot in lots:
amount_total+=lot.seller_price
return amount_total
def _value_object(self, cr, uid, context={}):
"""
For object default value.
@return:length of id in Object field.
"""
object = len(context['active_ids'])
return object
def makeInvoices(self, cr, uid, ids, context):
"""
seller invoice :Create an invoice.
@param cr: the current row, from the database cursor.
@param uid: the current users ID for security checks.
@param ids: List of Auction lots make invoices IDs
@return: dictionary of account invoice form.
"""
order_obj = self.pool.get('auction.lots')
mod_obj = self.pool.get('ir.model.data')
for data in self.read(cr, uid, ids):
result = mod_obj._get_id(cr, uid, 'account', 'view_account_invoice_filter')
id = mod_obj.read(cr, uid, result, ['res_id'])
newinv = []
ids = order_obj.seller_trans_create(cr, uid, context['active_ids'], context)
cr.commit()
return {
'domain': "[('id','in', ["+','.join(map(str, ids))+"])]",
'name': 'Seller invoices',
'view_type': 'form',
'view_mode': 'tree,form',
'res_model': 'account.invoice',
'view_id': False,
'context': "{'type':'out_refund'}",
'type': 'ir.actions.act_window',
'search_view_id': id['res_id']
}
_name = "auction.lots.make.invoice"
_description = "Make invoice"
_columns= {
'amount': fields.float('Invoiced Amount', required =True, readonly=True),
'objects':fields.integer('# of objects', required =True, readonly=True),
'number':fields.char('Invoice Number', size=64),
}
_defaults={
'amount':_value_amount,
'objects':_value_object,
'number':lambda *a: False,
}
auction_lots_make_invoice()

View File

@ -0,0 +1,110 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# 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
# 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/>.
#
##############################################################################
from osv import fields, osv
from tools.translate import _
import netsvc
import pooler
import time
import tools
import wizard
class auction_lots_make_invoice_buyer(osv.osv_memory):
def _value_amount(self, cr, uid, context={}):
"""
For Amount default value
@return:default auction lots amount value in amount fields.
"""
lots= self.pool.get('auction.lots').browse(cr, uid, context['active_ids'])
amount_total=0.0
for lot in lots:
amount_total+=lot.buyer_price
return amount_total
def _value_object(self, cr, uid, context={}):
"""
For object default value.
@return:length of id in Object field.
"""
object = len(context['active_ids'])
return object
def _value_buyer_id(self, cr, uid, context={}):
"""
For default buyer id value
@return:auction lots buyer id in buyer id field.
"""
lots= self.pool.get('auction.lots').browse(cr, uid, context['active_ids'])
for lot in lots:
buyer=lot and lot.ach_uid.id or False
return buyer
def makeInvoices(self, cr, uid, ids, context):
"""
Create an invoice for selected lots (IDS) to BUYER_ID .
@param cr: the current row, from the database cursor.
@param uid: the current users ID for security checks.
@param ids: List of Auction lots make invoice buyers IDs
@return: dictionary of account invoice form.
"""
newinv = []
order_obj = self.pool.get('auction.lots')
mod_obj = self.pool.get('ir.model.data')
for data in self.read(cr, uid, ids):
result = mod_obj._get_id(cr, uid, 'account', 'view_account_invoice_filter')
id = mod_obj.read(cr, uid, result, ['res_id'])
lots = order_obj.browse(cr, uid, context['active_ids'])
invoice_number = data['number']
for lot in lots:
up_auction = order_obj.write(cr, uid, [lot.id], {'ach_uid':data['buyer_id']})
ids = order_obj.lots_invoice(cr, uid, context['active_ids'], context, data['number'])
cr.commit()
return {
'domain': "[('id','in', ["+','.join(map(str, ids))+"])]",
'name': 'Buyer invoices',
'view_type': 'form',
'view_mode': 'tree,form',
'res_model': 'account.invoice',
'view_id': False,
'context': "{'type':'in_refund'}",
'type': 'ir.actions.act_window',
'search_view_id': id['res_id']
}
_name = "auction.lots.make.invoice.buyer"
_description = "Make invoice buyer "
_columns= {
'amount': fields.float('Invoiced Amount', required =True, readonly=True),
'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={
'amount':_value_amount,
'objects':_value_object,
'number':lambda *a: False,
'buyer_id':_value_buyer_id
}
auction_lots_make_invoice_buyer()

View File

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_auction_lots_make_invoice_buyer" model="ir.ui.view">
<field name="name">auction.lots.make.invoice.buyer.form</field>
<field name="model">auction.lots.make.invoice.buyer</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Paid">
<group 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" />
<group colspan="4" col="6">
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
<button icon="gtk-ok" string="Create invoices" name="makeInvoices" type="object"/>
</group>
</form>
</field>
</record>
<act_window name="Invoice Buyer objects"
res_model="auction.lots.make.invoice.buyer"
src_model="auction.lots"
view_mode="form"
target="new"
key2="client_action_multi"
id="action_auction_lots_make_invoice_buyer"/>
</data>
</openerp>

View File

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_auction_lots_make_invoice" model="ir.ui.view">
<field name="name">auction.lots.make.invoice.form</field>
<field name="model">auction.lots.make.invoice</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Paid">
<group colspan="4" >
<field name="amount"/>
<field name="objects"/>
<field name="number" colspan="3"/>
</group>
<separator string="" colspan="4" />
<group colspan="4" col="6">
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
<button icon="gtk-ok" string="Create invoices" name="makeInvoices" type="object"/>
</group>
</form>
</field>
</record>
<act_window name="Invoice Seller objects"
res_model="auction.lots.make.invoice"
src_model="auction.lots"
view_mode="form"
target="new"
key2="client_action_multi"
id="action_auction_lots_make_invoice"/>
</data>
</openerp>

View File

@ -0,0 +1,79 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# 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
# 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/>.
#
##############################################################################
from osv import fields, osv
from tools.translate import _
import netsvc
import pooler
import time
import tools
import wizard
class auction_lots_sms_send(osv.osv_memory):
_name = "auction.lots.sms.send"
_description = "Sms send "
_columns= {
'app_id':fields.char('API ID', size=64, required=True),
'user':fields.char('Login', size=64, required=True),
'password':fields.char('Password', size=64, required=True),
'text':fields.text('SMS Message', required=True)
}
def sms_send(self, cr, uid, ids, context):
"""
to send sms
@param cr: the current row, from the database cursor.
@param uid: the current users ID for security checks.
@param ids: the ID or list of IDs
@param context: A standard dictionary
@return: number indicating the acknowledgement
"""
lot_obj = self.pool.get('auction.lots')
partner_obj = self.pool.get('res.partner')
partner_address_obj = self.pool.get('res.partner.address')
for datas in self.read(cr, uid, ids):
lots = lot_obj.read(cr, uid, context['active_ids'], ['obj_num','obj_price','ach_uid'])
print "lots",lots, [l['ach_uid'][0] for l in lots if l['ach_uid']]
res = partner_obj.read(cr, uid, [l['ach_uid'][0] for l in lots if l['ach_uid']], ['gsm'], context)
nbr = 0
for r in res:
add = partner_obj.address_get(cr, uid, [r['id']])['default']
addr = partner_address_obj.browse(cr, uid, add)
to = addr.mobile
if to:
tools.smssend(data['user'], data['password'], data['app_id'], unicode(data['text'], 'utf-8').encode('latin1'), to)
nbr += 1
return {'sms_sent': nbr}
if to:
tools.smssend(data['user'], data['password'], data['app_id'], unicode(data['text'], 'utf-8').encode('latin1'), to)
nbr += 1
return {'sms_sent': nbr}
#
auction_lots_sms_send()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_auction_lots_sms_send" model="ir.ui.view">
<field name="name">auction.lots.sms.send.form</field>
<field name="model">auction.lots.sms.send</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="SMS - Gateway: clickatell','Bulk SMS send">
<group colspan="4" >
<separator string="SMS - Gateway: clickatell','Bulk SMS send" colspan="4"/>
<field name="app_id"/>
<newline/>
<field name="user"/>
<field name="password"/>
<newline/>
<field name="text" colspan="3"/>
</group>
<separator string="" colspan="4" />
<group colspan="4" col="6">
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
<button icon="gtk-go-back" string="Send SMS" name="sms_send" type="object"/>
</group>
</form>
</field>
</record>
<act_window name="SMS Send"
res_model="auction.lots.sms.send"
src_model="auction.lots"
view_mode="form"
target="new"
key2="client_action_multi"
id="action_auction_lots_sms_send"/>
</data>
</openerp>

View File

@ -0,0 +1,117 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# 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
# 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/>.
#
##############################################################################
from osv import fields, osv
from tools.translate import _
import netsvc
import pooler
import time
import tools
import wizard
class auction_pay_buy(osv.osv_memory):
def _start(self, cr, uid, context):
rec = self.pool.get('auction.lots').browse(cr, uid, context['active_ids'], context)
amount1 = 0.0
for r in rec:
amount1+= r.buyer_price
if r.is_ok:
raise osv.except_osv('Error !', 'Some lots of the selection are already paid.')
return amount1
def _value_buyer_id(self, cr, uid, context={}):
"""
For default buyer id value
@return:auction lots buyer id in buyer id field.
"""
lots= self.pool.get('auction.lots').browse(cr, uid, context['active_ids'])
for lot in lots:
buyer=lot and lot.ach_uid.id or False
return buyer
def pay_and_reconcile(self, cr, uid, ids, context):
"""
Pay and Reconcile
@param cr: the current row, from the database cursor.
@param uid: the current users ID for security checks.
@param ids: the ID or list of IDs
@param context: A standard dictionary
@return:
"""
lot_obj = self.pool.get('auction.lots')
bank_statement_line_obj = self.pool.get('account.bank.statement.line')
for datas in self.read(cr, uid, ids):
if not abs(datas['total'] - (datas['amount'] + datas['amount2'] + datas['amount3'])) <0.01:
rest = datas['total']-(datas['amount'] + datas['amount2'] + datas['amount3'])
raise osv.except_osv('Payment aborted !', 'You should pay all the total: "%.2f" are missing to accomplish the payment.' %(round(rest, 2)))
lots = lot_obj.browse(cr, uid, context['active_ids'], context)
ref_bk_s = bank_statement_line_obj
for lot in lots:
if datas['buyer_id']:
lot_obj.write(cr, uid, [lot.id], {'ach_uid':datas['buyer_id']})
if not lot.auction_id:
raise osv.except_osv('Error !', 'No auction date for "%s": Please set one.'%(lot.name))
lot_obj.write(cr, uid, [lot.id], {'is_ok':True})
for st, stamount in [('statement_id1', 'amount'), ('statement_id2', 'amount2'), ('statement_id3', 'amount3')]:
if datas[st]:
new_id = ref_bk_s.create(cr, uid, {
'name':'Buyer:'+ str(lot.ach_login or '')+', auction:'+ lots[0].auction_id.name,
'date': time.strftime('%Y-%m-%d'),
'partner_id': datas['buyer_id'] or False,
'type':'customer',
'statement_id': datas[st],
'account_id': lot.auction_id.acc_income.id,
'amount': datas[stamount]
})
for lot in lots:
lot_obj.write(cr, uid, [lot.id], {'statement_id':[(4, new_id)]})
return {}
_name = "auction.pay.buy"
_description = "Pay buy"
_columns= {
'amount': fields.float('Amount paid', digits= (16, int(tools.config['price_accuracy']))),
'buyer_id':fields.many2one('res.partner', 'Buyer'),
'statement_id1':fields.many2one('account.bank.statement', 'Statement', required=True),
'amount2': fields.float('Amount paid', digits= (16, int(tools.config['price_accuracy']))),
'statement_id2':fields.many2one('account.bank.statement', 'Statement'),
'amount3': fields.float('Amount paid', digits = (16, int(tools.config['price_accuracy']))),
'statement_id3':fields.many2one('account.bank.statement', 'Statement'),
'total': fields.float('Amount paid', digits = (16, int(tools.config['price_accuracy'])), readonly =True),
}
_defaults={
'amount' : _start,
'total' : _start,
'buyer_id' : _value_buyer_id
}
auction_pay_buy()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_auction_pay_buy" model="ir.ui.view">
<field name="name">auction.pay.buy.form</field>
<field name="model">auction.pay.buy</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Pay objects">
<group 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-cancel" special="cancel" string="Cancel"/>
<button icon="gtk-yes" string="Pay" name="pay_and_reconcile" type="object"/>
</group>
</form>
</field>
</record>
<act_window name="Pay objects of the buyer"
res_model="auction.pay.buy"
src_model="auction.lots"
view_mode="form"
target="new"
key2="client_action_multi"
id="action_auction_pay_buy"/>
</data>
</openerp>

View File

@ -0,0 +1,62 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# 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
# 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/>.
#
##############################################################################
from osv import fields, osv
from tools.translate import _
import netsvc
import pooler
import time
import tools
import wizard
class auction_pay_sel(osv.osv_memory):
_name = "auction.pay.sel"
_description = "Pay Invoice"
_columns= {
'amount': fields.float('Amount paid', digits= (16, int(tools.config['price_accuracy'])), required=True),
'dest_account_id':fields.many2one('account.account', 'Payment to Account', required=True, domain= [('type', '=', 'cash')]),
'journal_id':fields.many2one('account.journal', 'Journal', required=True),
'period_id':fields.many2one('account.period', 'Period', required=True),
}
def pay_and_reconcile(self, cr, uid, ids, context):
"""
Pay and Reconcile
@param cr: the current row, from the database cursor.
@param uid: the current users ID for security checks.
@param ids: the ID or list of IDs
@param context: A standard dictionary
@return:
"""
lot = self.pool.get('auction.lots').browse(cr, uid, context['active_id'], context)
invoice_obj = self.pool.get('account.invoice')
for datas in self.read(cr, uid, ids):
account_id = datas.get('writeoff_acc_id', False)
period_id = datas.get('period_id', False)
journal_id = datas.get('journal_id', False)
if lot.sel_inv_id:
p = invoice_obj.pay_and_reconcile(['lot.sel_inv_id.id'], datas['amount'], datas['dest_account_id'], journal_id, account_id, period_id, journal_id, context)
# lots.sel_inv_id.pay_and_reconcile(cr,uid,data[id], form['amount'], form['dest_account_id'], journal_id, account_id, period_id, journal_id, context)
return {}
auction_pay_sel()

View File

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_auction_pay_sel" model="ir.ui.view">
<field name="name">auction.pay.sel.form</field>
<field name="model">auction.pay.sel</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Pay invoice">
<group colspan="4" >
<field name="amount"/>
<field name="dest_account_id"/>
<field name="journal_id"/>
<field name="period_id"/>
</group>
<separator string="" colspan="4" />
<group colspan="4" col="6">
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
<button icon="gtk-yes" string="Pay" name="pay_and_reconcile" type="object"/>
</group>
</form>
</field>
</record>
<record id="action_auction_pay_sel" model="ir.actions.act_window">
<field name="name">Pay objects of the seller</field>
<field name="res_model">auction.pay.sel</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_auction_pay_sel"/>
<field name="target">new</field>
</record>
</data>
</openerp>

View File

@ -19,43 +19,42 @@
#
##############################################################################
import wizard
from osv import fields, osv
from tools.translate import _
import netsvc
import pooler
take_form = """<?xml version="1.0"?>
<form title="Confirm">
<separator string="Confirmation set taken away" colspan="4"/>
<newline/>
</form>
"""
import time
import tools
import wizard
take_fields = {
# 'confirm_en': {'string':'Catalog Number', 'type':'integer'},
}
def _confirm_able(self,cr,uid,data,context={}):
res={}
pool = pooler.get_pool(cr.dbname)
pool.get('auction.lots').write(cr,uid,data['ids'],{'ach_emp':True})
return {}
class able_take_away(wizard.interface):
states = {
'init' : {
'actions' : [],
'result' : {
'type' : 'form',
'arch' : take_form,
'fields' : take_fields,
'state' : [('end', 'Cancel'),('go', 'Able Taken away')]}
},
'go' : {
'actions' : [_confirm_able],
'result' : {'type' : 'state', 'state' : 'end'}
},
}
able_take_away('auction.lots.able')
class auction_payer(osv.osv_memory):
_name = "auction.payer"
_description = "Auction payer"
def payer(self, cr, uid, ids, context):
self.pool.get('auction.lots').write(cr, uid, context['active_ids'], {'is_ok':True, 'state':'paid'})
return {}
auction_payer()
class auction_payer_sel(osv.osv_memory):
"""
For Mark as payment for seller
"""
_name = "auction.payer.sel"
_description = "Auction payment for seller"
def payer_sel(self, cr, uid, ids, context):
"""
This function Update auction lots object and seller paid true.
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of auction payer sels IDs.
"""
self.pool.get('auction.lots').write(cr, uid, context['active_ids'], {'paid_vnd':True})
return {}
auction_payer_sel()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_auction_payer" model="ir.ui.view">
<field name="name">auction.payer.form</field>
<field name="model">auction.payer</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Check payment for buyer">
<separator string="" colspan="4" />
<group colspan="4" col="2">
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
<button icon = "gtk-yes" string="Pay" name="payer" type="object"/>
</group>
</form>
</field>
</record>
<record id="view_auction_payer_sel" model="ir.ui.view">
<field name="name">auction.payer.sel.form</field>
<field name="model">auction.payer.sel</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Check payment for seller">
<separator string="" colspan="4" />
<group colspan="4" col="6">
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
<button icon="gtk-yes" string="Pay" name="payer_sel" type="object"/>
</group>
</form>
</field>
</record>
<act_window name="Mark as paid for seller"
res_model="auction.payer.sel"
src_model="auction.lots"
view_mode="form"
target="new"
key2="client_action_multi"
id="action_auction_payer_sel"/>
</data>
</openerp>

View File

@ -0,0 +1,57 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# 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
# 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/>.
#
##############################################################################
from osv import fields, osv
from tools.translate import _
import netsvc
import pooler
import time
import tools
import wizard
class auction_taken(osv.osv_memory):
"""
Auction lots taken.
"""
_name = "auction.taken"
_description = "Auction taken"
_columns = {
'lot_ids':fields.many2many('auction.lots', 'auction_taken_rel', 'taken_id', 'lot_id', 'Lots Emportes'),
}
def _to_xml(s):
return s.replace('&','&amp;').replace('<','&lt;').replace('>','&gt;')
def process(self, cr, uid, ids, context):
"""
Update Auction lots state to taken_away.
@param cr: the current row, from the database cursor.
@param uid: the current users ID for security checks.
@param ids: List of Auction takens IDs
@return: dictionary of lot_ids fields with empty list
"""
lot_obj = self.pool.get('auction.lots')
for data in self.read(cr, uid, ids):
if data['lot_ids']:
lot_obj.write(cr, uid, data['lot_ids'], {'state':'taken_away'})
return {'lot_ids': []}
auction_taken()

View File

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_auction_taken" model="ir.ui.view">
<field name="name">auction.taken.form</field>
<field name="model">auction.taken</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Mark Lots">
<group colspan="4" >
<label string="Select lots which are Sold" colspan="4"/>
<field name="lot_ids" nolabel="1" colspan="4" domain="[('state','=','sold')]"/>
</group>
<separator string="" colspan="4" />
<group colspan="4" col="6">
<button icon="gtk-ok" string="OK" name="process" type="object" />
</group>
</form>
</field>
</record>
<record id="action_auction_taken" model="ir.actions.act_window">
<field name="name">Gestion emporte</field>
<field name="res_model">auction.taken</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_auction_taken"/>
<field name="target">new</field>
</record>
<!-- <menuitem name="Tools Bar Codes"
id="auction_outils_menu"
parent="auction_menu_root" sequence="5"
/>
<menuitem name="Deliveries Management"
action="action_auction_taken"
id="menu_wizard_emporte"
parent="auction_outils_menu"
/> -->
</data>
</openerp>

View File

@ -1,61 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# 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
# 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/>.
#
##############################################################################
import wizard
import netsvc
import pooler
#field name="confirm_en"/>
take_form = """<?xml version="1.0"?>
<form title="Confirm">
<separator string="Confirmation enable taken away" colspan="4"/>
<newline/>
</form>
"""
take_fields = {
'confirm_en': {'string':'Catalog Number', 'type':'integer'},
}
def _confirm_enable(self,cr,uid,data,context={}):
pool = pooler.get_pool(cr.dbname)
pool.get('auction.lots').write(cr,uid,data['ids'],{'ach_emp':False})
return {}
class enable_take_away(wizard.interface):
states = {
'init' : {
'actions' : [],
'result' : {
'type' : 'form',
'arch' : take_form,
'fields' : take_fields,
'state' : [ ('end', 'Cancel'),('go', 'Enable Taken away')]}
},
'go' : {
'actions' : [_confirm_enable],
'result' : {'type' : 'state', 'state' : 'end'}
},
}
enable_take_away('auction.lots.enable')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,111 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# 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
# 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/>.
#
##############################################################################
import wizard
import netsvc
import pooler
invoice_form = '''<?xml version="1.0"?>
<form title="Paid ?">
<field name="amount"/>
<field name="objects"/>
<field name="number"/>
<label string="(Keep empty for automatic number)" colspan="2"/>
<field name="buyer_id"/>
</form>'''
invoice_fields = {
'amount': {'string':'Invoiced Amount', 'type':'float', 'required':True, 'readonly':True},
'objects': {'string':'# of objects', 'type':'integer', 'required':True, 'readonly':True},
'number': {'string':'Invoice Number', 'type':'char'},
'buyer_id':{'string': 'Buyer', 'type': 'many2one', 'relation':'res.partner'}
}
def _values(self,cr,uid, datas,context={}):
pool = pooler.get_pool(cr.dbname)
lots= pool.get('auction.lots').browse(cr,uid,datas['ids'])
# price = 0.0
amount_total=0.0
# pt_tax=pooler.get_pool(cr.dbname).get('account.tax')
for lot in lots:
buyer=lot and lot.ach_uid.id or False
amount_total+=lot.buyer_price
# taxes = lot.product_id.taxes_id
# if lot.author_right:
# taxes.append(lot.author_right)
# if lot.auction_id:
# taxes += lot.auction_id.buyer_costs
# tax=pt_tax.compute(cr,uid,taxes,lot.obj_price,1)
# for t in tax:
# amount_total+=t['amount']
# amount_total+=lot.obj_price
# up_auction=pooler.get_pool(cr.dbname).get('auction.lots').write(cr,uid,[lot.id],{'ach_uid':datas['form']['buyer_id']})
invoice_number = False
return {'objects':len(datas['ids']), 'amount':amount_total, 'number':invoice_number,'buyer_id':buyer}
def _makeInvoices(self, cr, uid, data, context):
newinv = []
pool = pooler.get_pool(cr.dbname)
order_obj = pool.get('auction.lots')
mod_obj = pool.get('ir.model.data')
result = mod_obj._get_id(cr, uid, 'account', 'view_account_invoice_filter')
id = mod_obj.read(cr, uid, result, ['res_id'])
lots= order_obj.browse(cr,uid,data['ids'])
invoice_number=data['form']['number']
for lot in lots:
up_auction=pooler.get_pool(cr.dbname).get('auction.lots').write(cr,uid,[lot.id],{'ach_uid':data['form']['buyer_id']})
ids = order_obj.lots_invoice(cr, uid, data['ids'],context,data['form']['number'])
# ids = order_obj.lots_invoice(cr, uid, data['ids'],context,invoice_number)
cr.commit()
return {
'domain': "[('id','in', ["+','.join(map(str, ids))+"])]",
'name': 'Buyer invoices',
'view_type': 'form',
'view_mode': 'tree,form',
'res_model': 'account.invoice',
'view_id': False,
'context': "{'type':'in_refund'}",
'type': 'ir.actions.act_window',
'search_view_id': id['res_id']
}
return {}
class make_invoice(wizard.interface):
states = {
'init' : {
'actions' : [_values],
'result' : {'type' : 'form',
'arch' : invoice_form,
'fields' : invoice_fields,
'state' : [('end', 'Cancel'),('invoice', 'Create invoices')]}
},
'invoice' : {
'actions' : [],
'result' : {'type' : 'action',
'action' : _makeInvoices}
},
}
make_invoice("auction.lots.make_invoice_buyer")
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,105 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# 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
# 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/>.
#
##############################################################################
import wizard
import netsvc
import pooler
invoice_form = '''<?xml version="1.0"?>
<form title="Paid ?">
<field name="amount"/>
<field name="objects"/>
<field name="number" colspan="3"/>
</form>'''
invoice_fields = {
'amount': {'string':'Invoiced Amount', 'type':'float', 'required':True, 'readonly':True},
'objects': {'string':'# of objects', 'type':'integer', 'required':True, 'readonly':True},
'number': {'string':'Invoice Number', 'type':'integer'},
}
def _values(self,cr,uid, datas,context={}):
lots= pooler.get_pool(cr.dbname).get('auction.lots').browse(cr,uid,datas['ids'])
# service = netsvc.LocalService("object_proxy")
# lots = service.execute(cr,uid, 'auction.lots', 'read', datas['ids'])
# auction = service.execute(cr,uid, 'auction.dates', 'read', [lots[0]['auction_id'][0]])[0]
price = 0.0
amount_total=0.0
pt_tax=pooler.get_pool(cr.dbname).get('account.tax')
for lot in lots:
# taxes = lot.product_id.taxes_id
# if lot.bord_vnd_id.tax_id:
# taxes.append(lot.bord_vnd_id.tax_id)
# if lot.auction_id:
# taxes += lot.auction_id.seller_costs
# tax=pt_tax.compute(cr,uid,taxes,lot.obj_price,1)
# for t in tax:
# amount_total+=t['amount']
# amount_total+=lot.obj_price
amount_total+=lot.seller_price
#TODO: recuperer id next invoice (de la sequence)???
invoice_number = False
return {'objects':len(datas['ids']), 'amount':amount_total, 'number':invoice_number}
def _makeInvoices(self, cr, uid, data, context):
pool = pooler.get_pool(cr.dbname)
order_obj = pool.get('auction.lots')
mod_obj = pool.get('ir.model.data')
result = mod_obj._get_id(cr, uid, 'account', 'view_account_invoice_filter')
id = mod_obj.read(cr, uid, result, ['res_id'])
newinv = []
ids = order_obj.seller_trans_create(cr, uid, data['ids'],context)
cr.commit()
return {
'domain': "[('id','in', ["+','.join(map(str, ids))+"])]",
'name': 'Seller invoices',
'view_type': 'form',
'view_mode': 'tree,form',
'res_model': 'account.invoice',
'view_id': False,
'context': "{'type':'out_refund'}",
'type': 'ir.actions.act_window',
'search_view_id': id['res_id']
}
return {}
class make_invoice(wizard.interface):
states = {
'init' : {
'actions' : [_values],
'result' : {'type' : 'form',
'arch' : invoice_form,
'fields' : invoice_fields,
'state' : [('end', 'Cancel'),('invoice', 'Create invoices')]}
},
'invoice' : {
'actions' : [_makeInvoices],
'result' : {'type' : 'action',
'action' : _makeInvoices,
'state' : 'end'}
},
}
make_invoice("auction.lots.make_invoice")
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,73 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# 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
# 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/>.
#
##############################################################################
import wizard
import netsvc
import pooler
from tools.misc import UpdateableStr
# Dossier
_lot_arch = """<?xml version="1.0"?>
<form string="Mark Lots" height="500" width="1000">
<label string="Select lots which are Sold" colspan="4"/>
<field name="lot_ids" nolabel="1" colspan="4" domain="[('state','=','sold')]"/>
</form>
"""
_lot_fields = {
'lot_ids': {'string':'Lots Emportes','relation':'auction.lots','type':'many2many'}
}
def _to_xml(s):
return s.replace('&','&amp;').replace('<','&lt;').replace('>','&gt;')
def _process(self, cr, uid, data, context):
pool = pooler.get_pool(cr.dbname)
lot_obj = pool.get('auction.lots')
if data['form']['lot_ids']:
lot_obj.write(cr, uid, data['form']['lot_ids'][0][2], {'state':'taken_away'})
return {'lot_ids': []}
class wizard_reprint(wizard.interface):
states = {
'valid': {
'actions': [_process],
'result': {'type':'state', 'state':'init'}
},
'init': {
'actions': [],
'result': {
'type':'form',
'arch': _lot_arch,
'fields': _lot_fields,
'state': [
('valid',' OK ')
],
}
}
}
wizard_reprint('auction.taken')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,96 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# 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
# 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/>.
#
##############################################################################
import wizard
import netsvc
import pooler
import sql_db
auction_move = '''<?xml version="1.0"?>
<form string="Change Auction Date">
<group col="1" colspan="2">
<label string="Warning, this will erase the object adjudication price and its buyer !" colspan="2"/>
</group>
<newline/>
<field name="auction_id"/>
</form>'''
auction_move_fields = {
'auction_id': {'string':'Auction Date', 'type':'many2one', 'required':True, 'relation':'auction.dates'},
}
#def _auction_move_set(self, uid, datas):
# if datas['form']['auction_id']:
# cr = sql_db.db.cursor()
# cr.execute('update auction_lots set auction_id=%s, obj_price=NULL, ach_login=NULL, ach_uid=NULL, ach_pay_id=NULL, ach_inv_id=NULL, state=%s where id in ('+','.join(map(str, datas['ids']))+')', (str(datas['form']['auction_id']), 'draft'))
# cr.execute('delete from auction_bid_line where lot_id in ('+','.join(map(str, datas['ids']))+')')
# cr.commit()
# cr.close()
# return {}
def _top(self,cr,uid,datas,context={}):
refs = pooler.get_pool(cr.dbname).get('auction.lots')
rec_ids = refs.browse(cr,uid,datas['ids'])
for rec in rec_ids:
if not rec.auction_id:
raise wizard.except_wizard('Error !','You can not move a lot that has no auction date')
return {}
def _auction_move_set(self,cr,uid,datas,context={}):
if not (datas['form']['auction_id'] and len(datas['ids'])) :
return {}
refs = pooler.get_pool(cr.dbname).get('auction.lots')
rec_ids = refs.browse(cr,uid,datas['ids'])
line_ids= pooler.get_pool(cr.dbname).get('auction.bid_line').search(cr,uid,[('lot_id','in',datas['ids'])])
# pooler.get_pool(cr.dbname).get('auction.bid_line').unlink(cr, uid, line_ids)
for rec in rec_ids:
new_id=pooler.get_pool(cr.dbname).get('auction.lot.history').create(cr,uid,{
'auction_id':rec.auction_id.id,
'lot_id':rec.id,
'price': rec.obj_ret
})
up_auction=pooler.get_pool(cr.dbname).get('auction.lots').write(cr,uid,[rec.id],{
'auction_id':datas['form']['auction_id'],
'obj_ret':None,
'obj_price':None,
'ach_login':None,
'ach_uid':None,
'ach_inv_id':None,
'sel_inv_id':None,
'obj_num':None,
'state':'draft'})
return {}
class wiz_auc_lots_auction_move(wizard.interface):
states = {
'init': {
'actions': [_top],
'result': {'type': 'form', 'arch':auction_move, 'fields': auction_move_fields, 'state':[('set_date', 'Move to Auction date'),('end','Cancel')]}
},
'set_date': {
'actions': [_auction_move_set],
'result': {'type': 'state', 'state':'end'}
}
}
wiz_auc_lots_auction_move('auction.lots.auction_move')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,103 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# 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
# 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/>.
#
##############################################################################
import wizard
import netsvc
import netsvc
import osv
import time
import pooler
invoice_form = '''<?xml version="1.0"?>
<form string="Pay invoice">
<field name="amount"/>
<field name="dest_account_id"/>
<field name="journal_id"/>
<field name="period_id"/>
</form>'''
invoice_fields = {
'amount': {'string': 'Amount paid', 'type':'float', 'required':True},
'dest_account_id': {'string':'Payment to Account', 'type':'many2one', 'required':True, 'relation':'account.account', 'domain':[('type','=','cash')]},
'journal_id': {'string': 'Journal', 'type': 'many2one', 'relation':'account.journal', 'required':True},
'period_id': {'string': 'Period', 'type': 'many2one', 'relation':'account.period', 'required':True},
}
#def pay_n_check(self, cr, uid, data, context):
#
# auction = pool.get('auction.lots').browse(cr,uid,data['id'],context)
# try:
#
# for lot in auction:
#
# if not lot.auction_id :
# raise osv.except_osv("Error","No payment defined for this auction.")
# i=1
# tot= 0
# for payment in auction:
# if not payment.journal_id :
# raise osv.except_osv("Error","No journal defined for the payment line %d" % (i,))
# if not payment.ach_inv_id.amount :
# raise osv.except_osv("Error","No amount defined for the payment line %d." % (i,))
# i+=1
# tot+= payment.ach_inv_id.amount
# if abs(float(tot)) - abs(float(lot.obj_ret)) > 10**-6:
# raise osv.except_osv("Error","The amount paid does not match the total amount")
# else:
# for lot in auction:
# if not lot.journal_id :
# raise osv.except_osv("Error","Please choose a journal for the auction ("+lot.name+").")
# pool.get('auction.lots').create(cr,uid,{
# 'auction_id': lot.auction.id,
# 'journal_id': lot.journal_id,
#
# })
# except osv.except_osv, e:
# raise wizard.except_wizard(e.name, e.name)
# return True
def _pay_and_reconcile(self, cr, uid, data, context):
pool = pooler.get_pool(cr.dbname)
lot = pool.get('auction.lots').browse(cr,uid,data['id'],context)
form = data['form']
account_id = form.get('writeoff_acc_id', False)
period_id = form.get('period_id', False)
journal_id = form.get('journal_id', False)
if lot.sel_inv_id:
p=pool.get('account.invoice').pay_and_reconcile(['lot.sel_inv_id.id'], form['amount'], form['dest_account_id'], journal_id, account_id, period_id, journal_id, context)
# lots.sel_inv_id.pay_and_reconcile(cr,uid,data[id], form['amount'], form['dest_account_id'], journal_id, account_id, period_id, journal_id, context)
return {}
class wiz_auc_lots_pay(wizard.interface):
states = {
'init': {
'actions': [],
'result': {'type': 'form', 'arch':invoice_form, 'fields': invoice_fields, 'state':[ ('pay','Pay'), ('end','Cancel')]}
},
'pay': {
'actions': [_pay_and_reconcile],
'result': {'type': 'state', 'state':'end'}
}}
wiz_auc_lots_pay('auction.pay.sel');
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,150 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# 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
# 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/>.
#
##############################################################################
import wizard
import netsvc
import urllib
sms_send_form = '''<?xml version="1.0"?>
<form title="%s">
<separator string="%s" colspan="4"/>
<field name="app_id"/>
<newline/>
<field name="user"/>
<field name="password"/>
<newline/>
<field name="text" colspan="3"/>
</form>''' % ('SMS - Gateway: clickatell', 'Bulk SMS send')
sms_send_fields = {
'app_id': {'string':'API ID', 'type':'char', 'required':True},
'user': {'string':'Login', 'type':'char', 'required':True},
'password': {'string':'Password', 'type':'char', 'required':True},
'text': {'string':'SMS Message', 'type':'text', 'required':True, 'value':'Les lots [lots] vous ont etes adjuges. -- Rops'}
}
##############################################################################
#
# Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
# Fabien Pinckaers <fp@tiny.Be>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# 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 2
# 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, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
import wizard
import netsvc
import pooler
sms_send_form = '''<?xml version="1.0"?>
<form string="%s">
<separator string="%s" colspan="4"/>
<field name="app_id"/>
<newline/>
<field name="user"/>
<field name="password"/>
<newline/>
<field name="text" colspan="3"/>
</form>''' % ('SMS - Gateway: clickatell','Bulk SMS send')
sms_send_fields = {
'app_id': {'string':'API ID', 'type':'char', 'required':True},
'user': {'string':'Login', 'type':'char', 'required':True},
'password': {'string':'Password', 'type':'char', 'required':True},
'text': {'string':'SMS Message', 'type':'text', 'required':True}
}
def _sms_send(self, cr, uid, data, context):
service = netsvc.LocalService("object_proxy")
lots = service.execute(cr.dbname,uid, 'auction.lots', 'read', data['ids'], ['obj_num','obj_price','ach_uid'])
res = service.execute(cr.dbname,uid, 'res.partner', 'read', [l['ach_uid'] for l in lots if l['ach_uid']], ['gsm'])
#res = service.execute(cr.dbname, uid, 'res.partner', 'read', data['ids'], ['gsm'])
# service = netsvc.LocalService("object_proxy")
# pool=pooler.get_pool(cr.dbname)
# lots=pool.get('auction.lots').browse(cr,uid,data['id'],context)
# r=lots.ach_uid.id
nbr = 0
for r in res:
to = r['mobile']
if to:
tools.smssend(data['form']['user'], data['form']['password'], data['form']['app_id'], unicode(data['form']['text'], 'utf-8').encode('latin1'), to)
nbr += 1
return {'sms_sent': nbr}
if to:
tools.smssend(data['form']['user'], data['form']['password'], data['form']['app_id'], unicode(data['form']['text'], 'utf-8').encode('latin1'), to)
nbr += 1
return {'sms_sent': nbr}
#
#def _sms_send(self, uid, datas):
# service = netsvc.LocalService("object_proxy")
# pool=pooler.ger_pool(cr.dbname)
# lots=pool.get('auction.lots').browse(cr,uid,datas['ids'],context)
# #lots = service.execute(uid, 'auction.lots', 'read', datas['ids'], ['obj_num','obj_price','ach_uid'])
# #part = service.execute(uid, 'res.partner', 'read', [l['ach_uid'] for l in lots if l['ach_uid']], ['gsm'])
#
# part =ach_uid.id
# part = map(lambda x: (x.id,x.mobile), part)
# for l in lots:
# part.append(str(l.obj_num)+'-%dEUR' % int(l.obj_price))
#
# for p in part.values():
# to = p.mobile
# if to:
# params = urllib.urlencode({'user': datas['form']['user'], 'password': datas['form']['password'], 'api_id': datas['form']['app_id'], 'text':unicode(datas['form']['text'].replace('[lots]',', '.join(p['lots'])), 'utf-8').encode('latin1'), 'to':to})
# f = urllib.urlopen("http://196.7.150.220/http/sendmsg", params)
# nbr+=1
# return {'sms_sent':nbr}
class lots_sms(wizard.interface):
states = {
'init': {
'actions': [],
'result': {'type': 'form', 'arch':sms_send_form, 'fields': sms_send_fields, 'state':[('send','Send SMS'), ('end','Cancel')]}
},
'send': {
'actions': [_sms_send],
'result': {'type': 'state', 'state':'end'}
}
}
lots_sms('auction.lots.sms_send');
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,109 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# 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
# 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/>.
#
##############################################################################
import wizard
import netsvc
import netsvc
import osv
import time
import pooler
pay_form = '''<?xml version="1.0"?>
<form string="Pay objects">
<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"/>
</form>'''
def _start(self,cr,uid,data,context):
pool = pooler.get_pool(cr.dbname)
rec=pool.get('auction.lots').browse(cr,uid,data['ids'],context)
amount1=0.0
for r in rec:
amount1+=r.buyer_price
buyer= r and r.ach_uid.id or False
if r.is_ok:
raise wizard.except_wizard('Error !', 'Some lots of the selection are already paid.')
return {'amount':amount1, 'total':amount1,'buyer_id':buyer}
pay_fields = {
'amount': {'string': 'Amount paid', 'type':'float'},
'buyer_id': {'string': 'Buyer', 'type': 'many2one', 'relation':'res.partner'},
'statement_id1': {'string':'Statement', 'type':'many2one', 'required':True, 'relation':'account.bank.statement'},
'amount2': {'string': 'Amount paid', 'type':'float'},
'statement_id2': {'string':'Statement', 'type':'many2one', 'relation':'account.bank.statement'},
'amount3': {'string': 'Amount paid', 'type':'float'},
'statement_id3': {'string':'Statement', 'type':'many2one', 'relation':'account.bank.statement'},
'total': {'string': 'Amount to paid', 'type':'float','readonly':True}
}
def _pay_and_reconcile(self, cr, uid, data, context):
if not abs(data['form']['total'] - (data['form']['amount']+data['form']['amount2']+data['form']['amount3']))<0.01:
rest=data['form']['total']-(data['form']['amount']+data['form']['amount2']+data['form']['amount3'])
raise wizard.except_wizard('Payment aborted !', 'You should pay all the total: "%.2f" are missing to accomplish the payment.' %(round(rest,2)))
pool = pooler.get_pool(cr.dbname)
lots = pool.get('auction.lots').browse(cr,uid,data['ids'],context)
ref_bk_s=pooler.get_pool(cr.dbname).get('account.bank.statement.line')
for lot in lots:
if data['form']['buyer_id']:
pool.get('auction.lots').write(cr,uid,[lot.id],{'ach_uid':data['form']['buyer_id']})
if not lot.auction_id:
raise wizard.except_wizard('Error !', 'No auction date for "%s": Please set one.'%(lot.name))
pool.get('auction.lots').write(cr,uid,[lot.id],{'is_ok':True})
for st,stamount in [('statement_id1','amount'),('statement_id2','amount2'),('statement_id3','amount3')]:
if data['form'][st]:
new_id=ref_bk_s.create(cr,uid,{
'name':'Buyer:'+str(lot.ach_login or '')+', auction:'+ lots[0].auction_id.name,
'date': time.strftime('%Y-%m-%d'),
'partner_id':data['form']['buyer_id'] or False,
'type':'customer',
'statement_id':data['form'][st],
'account_id':lot.auction_id.acc_income.id,
'amount':data['form'][stamount]
})
for lot in lots:
pool.get('auction.lots').write(cr,uid,[lot.id],{'statement_id':[(4,new_id)]})
return {}
class wiz_auc_lots_pay(wizard.interface):
states = {
'init': {
'actions': [_start],
'result': {'type': 'form', 'arch':pay_form, 'fields': pay_fields, 'state':[('end','Cancel'),('pay','Pay')]}
},
'pay': {
'actions': [_pay_and_reconcile],
'result': {'type': 'state', 'state':'end'}
}}
wiz_auc_lots_pay('auction.pay.buy')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,79 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# 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
# 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/>.
#
##############################################################################
import wizard
import netsvc
import netsvc
import osv
import time
import pooler
pay_form = '''<?xml version="1.0"?>
<form string="Check payment for buyer">
</form>'''
pay_fields = {
}
pay_form1 = '''<?xml version="1.0"?>
<form string="Check payment for seller">
</form>'''
pay_fields1 = {
}
def _payer(self, cr, uid, data, context):
pool = pooler.get_pool(cr.dbname)
pool.get('auction.lots').write(cr,uid,data['ids'],{'is_ok':True, 'state':'paid'})
return {}
def _payer_sel(self, cr, uid, data, context):
pool = pooler.get_pool(cr.dbname)
pool.get('auction.lots').write(cr,uid,data['ids'],{'paid_vnd':True})
return {}
class wiz_auc_pay(wizard.interface):
states = {
'init': {
'actions': [],
'result': {'type': 'form', 'arch':pay_form, 'fields': pay_fields, 'state':[('end','Cancel'),('pay','Pay')]}
},
'pay': {
'actions': [_payer],
'result': {'type': 'state', 'state':'end'}
}}
wiz_auc_pay('auction.payer')
class wiz_auc_pay_sel(wizard.interface):
states = {
'init': {
'actions': [],
'result': {'type': 'form', 'arch':pay_form1, 'fields': pay_fields1, 'state':[('end','Cancel'),('pay2','Pay')]}
},
'pay2': {
'actions': [_payer_sel],
'result': {'type': 'state', 'state':'end'}
}}
wiz_auc_pay_sel('auction.payer.sel')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -111,15 +111,19 @@ class base_module_record(osv.osv):
return obj.module+'.'+obj.name, obj.noupdate
def _create_record(self, cr, uid, doc, model, data, record_id, noupdate=False):
data_pool = self.pool.get('ir.model.data')
model_pool = self.pool.get(model)
record = doc.createElement('record')
record.setAttribute("id", record_id)
record.setAttribute("model", model)
record_list = [record]
lids = self.pool.get('ir.model.data').search(cr, uid, [('model','=',model)])
res = self.pool.get('ir.model.data').read(cr, uid, lids[:1], ['module'])
lids = data_pool.search(cr, uid, [('model','=',model)])
res = data_pool.read(cr, uid, lids[:1], ['module'])
if res:
self.depends[res[0]['module']]=True
fields = self.pool.get(model).fields_get(cr, uid)
fields = model_pool.fields_get(cr, uid)
for key,val in data.items():
if not (val or (fields[key]['type']=='boolean')):
continue
@ -142,9 +146,11 @@ class base_module_record(osv.osv):
id,update = self._get_id(cr, uid, fields[key]['relation'], val)
noupdate = noupdate or update
if not id:
relation_pool = self.pool.get(fields[key]['relation'])
field.setAttribute("model", fields[key]['relation'])
fld_nm = self.pool.get(fields[key]['relation'])._rec_name
name = self.pool.get(fields[key]['relation']).read(cr, uid, val,[fld_nm])[fld_nm] or False
fld_nm = relation_pool._rec_name
name = relation_pool.read(cr, uid, val,[fld_nm])[fld_nm] or False
field.setAttribute("search", str([(str(fld_nm) ,'=', name)]))
else:
field.setAttribute("ref", id)
@ -152,10 +158,10 @@ class base_module_record(osv.osv):
elif fields[key]['type'] in ('one2many',):
for valitem in (val or []):
if valitem[0] in (0,1):
if key in self.pool.get(model)._columns:
fname = self.pool.get(model)._columns[key]._fields_id
if key in model_pool._columns:
fname = model_pool._columns[key]._fields_id
else:
fname = self.pool.get(model)._inherit_fields[key][2]._fields_id
fname = model_pool._inherit_fields[key][2]._fields_id
valitem[2][fname] = record_id
newid,update = self._get_id(cr, uid, fields[key]['relation'], valitem[1])
if not newid:
@ -190,14 +196,18 @@ class base_module_record(osv.osv):
def _create_yaml_record(self, cr, uid, model, data, record_id):
record={'model': model, 'id': str(record_id)}
lids = self.pool.get('ir.model.data').search(cr, uid, [('model','=',model)])
res = self.pool.get('ir.model.data').read(cr, uid, lids[:1], ['module'])
model_pool = self.pool.get(model)
data_pool = self.pool.get('ir.model.data')
lids = data_pool.search(cr, uid, [('model','=',model)])
res = data_pool.read(cr, uid, lids[:1], ['module'])
attrs={}
if res:
self.depends[res[0]['module']]=True
fields = self.pool.get(model).fields_get(cr, uid)
fields = model_pool.fields_get(cr, uid)
defaults={}
defaults[model] = self.pool.get(model).default_get(cr, uid, data)
defaults[model] = model_pool.default_get(cr, uid, data)
for key,val in data.items():
if ((key in defaults[model]) and (val == defaults[model][key])) and not(fields[key].get('required',False)):
continue
@ -210,19 +220,19 @@ class base_module_record(osv.osv):
elif fields[key]['type'] in ('integer','float'):
attrs[key] = val
elif fields[key]['type'] in ('many2one',):
if type(val) in (type(''),type(u'')):
if type(val) in (type(''), type(u'')):
id = val
else:
id,update = self._get_id(cr, uid, fields[key]['relation'], val)
id, update = self._get_id(cr, uid, fields[key]['relation'], val)
attrs[key] = str(id)
elif fields[key]['type'] in ('one2many',):
items=[[]]
for valitem in (val or []):
if valitem[0] in (0,1):
if key in self.pool.get(model)._columns:
fname = self.pool.get(model)._columns[key]._fields_id
if key in model_pool._columns:
fname = model_pool._columns[key]._fields_id
else:
fname = self.pool.get(model)._inherit_fields[key][2]._fields_id
fname = model_pool._inherit_fields[key][2]._fields_id
valitem[2][fname] = record_id
newid,update = self._get_id(cr, uid, fields[key]['relation'], valitem[1])
if not newid:

View File

@ -45,7 +45,7 @@ class ir_action_report_xml(osv.osv):
res[data.get('id')] = False
return res
def _model_search(self, cr, uid, obj, name, args):
def _model_search(self, cr, uid, obj, name, args, context={}):
if not len(args):
return []
model_id= args[0][2]

View File

@ -64,8 +64,7 @@ class document_directory(osv.osv):
def _get_root_directory(self, cr,uid, context=None):
objid=self.pool.get('ir.model.data')
try:
mid = objid._get_id(cr, uid, 'document', 'dir_root')
return False # TODO: check why not display root dir
mid = objid._get_id(cr, uid, 'document', 'dir_root')
if not mid:
return False
except Exception, e:
@ -199,8 +198,8 @@ class document_directory(osv.osv):
path.append(duri[0])
duri = duri[1:]
did = nid[0]
return (nodes.node_dir(path, nparent,ncontext,self.browse(cr,uid,did, context)), duri)
root_node = did and self.browse(cr,uid,did, context) or False
return (nodes.node_dir(path, nparent,ncontext, root_node), duri)
nid = self.search(cr,uid,[('parent_id','=',did),('name','=',duri[0]),('type','=','ressource')], context=context)

View File

@ -49,18 +49,17 @@ class node_context(object):
context """
cached_roots = {}
def __init__(self, cr, uid, context=None):
# we don't cache the cr!
def __init__(self, cr, uid, context=None):
self.dbname = cr.dbname
self.uid = uid
self.context = context
self._dirobj = pooler.get_pool(cr.dbname).get('document.directory')
assert self._dirobj
self.rootdir = self._dirobj._get_root_directory(cr,uid,context)
self.rootdir = False #self._dirobj._get_root_directory(cr,uid,context)
def get_uri(self, cr, uri):
""" Although this fn passes back to doc.dir, it is needed since
it is a potential caching point """
it is a potential caching point """
(ndir, duri) = self._dirobj._locate_child(cr,self.uid, self.rootdir,uri, None, self)
while duri:
ndir = ndir.child(cr, duri[0])
@ -168,23 +167,23 @@ class node_dir(node_class):
our_type = 'collection'
def __init__(self,path, parent, context, dirr, dctx=None):
super(node_dir,self).__init__(path, parent,context)
self.dir_id = dirr.id
self.dir_id = dirr and dirr.id or False
#todo: more info from dirr
self.mimetype = 'application/x-directory'
# 'httpd/unix-directory'
self.create_date = dirr.create_date
self.domain = dirr.domain
self.res_model = dirr.ressource_type_id and dirr.ressource_type_id.model or False
self.create_date = dirr and dirr.create_date or False
self.domain = dirr and dirr.domain or []
self.res_model = dirr and dirr.ressource_type_id and dirr.ressource_type_id.model or False
# TODO: the write date should be MAX(file.write)..
self.write_date = dirr.write_date or dirr.create_date
self.write_date = dirr and (dirr.write_date or dirr.create_date) or False
self.content_length = 0
if dctx:
self.dctx.update(dctx)
dc2 = self.context.context
dc2.update(self.dctx)
dc2['dir_id'] = self.dir_id
self.displayname = dirr.name
if dirr.dctx_ids:
self.displayname = dirr and dirr.name or False
if dirr and dirr.dctx_ids:
for dfld in dirr.dctx_ids:
try:
self.dctx['dctx_' + dfld.field] = safe_eval(dfld.expr,dc2)

View File

@ -162,7 +162,7 @@
<field name="arch" type="xml">
<tree string="Registration">
<field name="id"/>
<field name="create_date"/>
<field name="date"/>
<field name="event_id"/>
<field name="partner_id"/>
<field name="nb_register"/>
@ -331,7 +331,7 @@
</record>
<record model="ir.actions.act_window" id="action_event_registration">
<field name="name">Registration by Event</field>
<field name="name">Events On Registrations</field>
<field name="res_model">report.event.registration</field>
<field name="view_type">form</field>
<field name="view_mode">tree,graph</field>

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
#
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
@ -15,7 +15,7 @@
# 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/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
@ -43,7 +43,7 @@ def _create_duplicate(self, cr, uid, data, context):
event_obj=pooler.get_pool(cr.dbname).get('event.event')
project_obj = pooler.get_pool(cr.dbname).get('project.project')
duplicate_project_id= project_obj.copy(cr, uid,data['form']['project_id'], {'active': True})
project_obj.write(cr, uid, [duplicate_project_id], {'name': "copy of " + project_obj.browse(cr, uid, duplicate_project_id, context).name , 'date_start':time.strftime('%Y-%m-%d'),'date_end': event_obj.browse(cr, uid, [data['id']])[0].date_begin[0:10] })
project_obj.write(cr, uid, [duplicate_project_id], {'name': "copy of " + project_obj.browse(cr, uid, duplicate_project_id, context).name , 'date_start':time.strftime('%Y-%m-%d'),'date': event_obj.browse(cr, uid, [data['id']])[0].date_begin[0:10] })
event_obj.write(cr, uid, [data['id']], {'project_id': duplicate_project_id })
return {}

View File

@ -308,6 +308,17 @@
</field>
</field>
</record>
<record id="view_attendance_tree_who" model="ir.ui.view">
<field name="name">hr.attendance.tree</field>
<field name="model">hr.attendance</field>
<field name="type">tree</field>
<field name="inherit_id" ref="hr_attendance.view_attendance_who"/>
<field name="arch" type="xml">
<field name="action_desc" position="after">
<field name="sheet_id"/>
</field>
</field>
</record>
<act_window domain="[('sheet_id', '=', active_id)]" id="act_hr_timesheet_sheet_sheet_by_day" name="Timesheet by Account" res_model="hr_timesheet_sheet.sheet.account" src_model="hr_timesheet_sheet.sheet"/>
<!-- <act_window domain="[('sheet_id', '=', active_id)]" id="act_hr_timesheet_sheet_sheet_by_account" name="Timesheet by Day" res_model="hr_timesheet_sheet.sheet.day" src_model="hr_timesheet_sheet.sheet"/> -->

View File

@ -188,7 +188,9 @@ class mrp_bom(osv.osv):
'revision_type': fields.selection([('numeric','numeric indices'),('alpha','alphabetical indices')], 'Index type'),
'child_ids': fields.function(_child_compute,relation='mrp.bom', method=True, string="BoM Hierarchy", type='many2many'),
'child_complete_ids': fields.function(_child_compute,relation='mrp.bom', method=True, string="BoM Hierarchy", type='many2many'),
'company_id': fields.many2one('res.company','Company',required=True),
'company_id': fields.many2one('res.company','Company',required=True),
'multi_level_bom': fields.boolean('Multi-level BoM'),
}
_defaults = {
'active': lambda *a: 1,
@ -196,7 +198,8 @@ class mrp_bom(osv.osv):
'product_qty': lambda *a: 1.0,
'product_rounding': lambda *a: 1.0,
'type': lambda *a: 'normal',
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'mrp.bom', context=c),
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'mrp.bom', context=c),
'multi_level_bom': lambda *a: 0,
}
_order = "sequence"
_sql_constraints = [
@ -697,7 +700,9 @@ class mrp_production(osv.osv):
pick_type = 'out'
address_id = routing_loc.address_id and routing_loc.address_id.id or False
routing_loc = routing_loc.id
pick_name = self.pool.get('ir.sequence').get(cr, uid, 'stock.picking.'+pick_type)
picking_id = self.pool.get('stock.picking').create(cr, uid, {
'name': pick_name,
'origin': (production.origin or '').split(':')[0] +':'+production.name,
'type': pick_type,
'move_type': 'one',
@ -1256,7 +1261,7 @@ class stock_warehouse_orderpoint(osv.osv):
"a requisition to bring the virtual stock to the Max Quantity."),
'qty_multiple': fields.integer('Qty Multiple', required=True,
help="The requisition quantity will by rounded up to this multiple."),
'procurement_id': fields.many2one('mrp.procurement', 'Purchase Order'),
'procurement_id': fields.many2one('mrp.procurement', 'Latest Requisition'),
'company_id': fields.many2one('res.company','Company',required=True),
}
_defaults = {

View File

@ -242,19 +242,21 @@
<field name="arch" type="xml">
<form string="Bill of Material">
<group colspan="4" col="6">
<field name="product_id" on_change="onchange_product_id(product_id, name)" select="1"/>
<field name="name" select="1"/>
<field name="code" select="1"/>
<field name="company_id" select="1" groups="base.group_multi_company" widget="selection"/>
<field name="product_id" on_change="onchange_product_id(product_id, name)" select="1"/>
<field name="name" select="1"/>
<field name="code" select="1"/>
<field name="company_id" select="1" groups="base.group_multi_company" widget="selection"/>
</group>
<newline/>
<field name="product_uom"/>
<field name="product_qty"/>
<newline/>
<field name="product_uos" groups="product.group_uos"/>
<field name="product_uos_qty" groups="product.group_uos"/>
<field name="routing_id" select="2" groups="base.group_extended"/>
<field name="type" groups="base.group_extended"/>
<group colspan="4" col="6">
<field name="product_uom"/>
<field name="product_qty"/>
<field name="multi_level_bom"/>
</group>
<notebook colspan="4">
<page string="General Information">
<field colspan="4" name="bom_lines" nolabel="1" widget="one2many_list"/>
@ -274,6 +276,9 @@
<field name="product_efficiency"/>
<field colspan="4" name="property_ids" nolabel="2" groups="base.group_extended"/>
</page>
<page string="Multi-Level BoM" attrs="{'invisible':[('multi_level_bom','=',False)]}">
<field colspan="4" name="child_ids" nolabel="1" string="BoM Hierarchy"/>
</page>
</notebook>
</form>
</field>

View File

@ -55,7 +55,7 @@ class change_production_qty(osv.osv_memory):
prod = prod_obj.browse(cr, uid, record_id)
if prod.state in ('in_production','cancel', 'done'):
raise osv.except_osv(_('Warning !'), _('The production is in "%s" state. You can not change the production quantity anymore') % (prod.state).upper() )
res['product_qty'] = prod.product_qty
return res
@ -101,9 +101,6 @@ class change_production_qty(osv.osv_memory):
for r in res[0]:
if r['product_id']== move.product_id.id:
move_lines_obj.write(cr, uid,move.id, {'product_qty' : r['product_qty']})
for m in prod.move_created_ids:
move_lines_obj.write(cr, uid,m.id, {'product_qty': wiz_qty.product_qty})

View File

@ -71,9 +71,14 @@ class make_procurement(osv.osv_memory):
"""
user = self.pool.get('res.users').browse(cr, uid, uid, context).login
wh_obj = self.pool.get('stock.warehouse')
procurement_obj = self.pool.get('mrp.procurement')
wf_service = netsvc.LocalService("workflow")
data_obj = self.pool.get('ir.model.data')
for proc in self.browse(cr, uid, ids):
wh = self.pool.get('stock.warehouse').browse(cr, uid, proc.warehouse_id.id, context)
procure_id = self.pool.get('mrp.procurement').create(cr, uid, {
wh = wh_obj.browse(cr, uid, proc.warehouse_id.id, context)
procure_id = procurement_obj.create(cr, uid, {
'name':'INT: '+str(user),
'date_planned': proc.date_planned,
'product_id': proc.product_id.id,
@ -82,12 +87,13 @@ class make_procurement(osv.osv_memory):
'location_id': wh.lot_stock_id.id,
'procure_method':'make_to_order',
})
wf_service = netsvc.LocalService("workflow")
wf_service.trg_validate(uid, 'mrp.procurement', procure_id, 'button_confirm', cr)
data_obj = self.pool.get('ir.model.data')
id2 = data_obj._get_id(cr, uid, 'mrp', 'mrp_procurement_tree_view')
id3 = data_obj._get_id(cr, uid, 'mrp', 'mrp_procurement_form_view')
if id2:
id2 = data_obj.browse(cr, uid, id2, context=context).res_id
if id3:

View File

@ -34,6 +34,16 @@ class mrp_product_produce(osv.osv_memory):
}
def _get_product_qty(self, cr, uid, context):
"""
@summary: to obtain product quantity
@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: quantity
"""
prod = self.pool.get('mrp.production').browse(cr, uid,
context['active_id'], context=context)
done = 0.0
@ -47,6 +57,17 @@ class mrp_product_produce(osv.osv_memory):
}
def do_produce(self, cr, uid, ids, context={}):
"""
@summary: to check the product type
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param ids: the ID or list of IDs if we want more than one
@param context: A standard dictionary
@return:
"""
prod_obj = self.pool.get('mrp.production')
move_ids = context['active_ids']
for data in self.read(cr, uid, ids):

View File

@ -398,7 +398,9 @@ class mrp_repair(osv.osv):
self.pool.get('mrp.repair.line').write(cr, uid, [move.id], {'move_id': move_id})
if repair.deliver_bool:
pick_name = self.pool.get('ir.sequence').get(cr, uid, 'stock.picking.out')
picking = self.pool.get('stock.picking').create(cr, uid, {
'name': pick_name,
'origin': repair.name,
'state': 'draft',
'move_type': 'one',

View File

@ -397,7 +397,7 @@
<blockTable colWidths="534.0" style="Table8">
<tr>
<td>
<para style="P3">[[ format(o.quotation_notes) or '' ]]</para>
<para style="P3">[[ format(o.quotation_notes) or removeParentNode('blockTable') ]]</para>
</td>
</tr>
</blockTable>

View File

@ -5,3 +5,7 @@
"access_mrp_repair_line_manager","MRP Repair Line manager","model_mrp_repair_line","stock.group_stock_manager",1,1,1,1
"access_mrp_repair_fee_user","MRP Repair Fee user","model_mrp_repair_fee","stock.group_stock_user",1,0,0,0
"access_mrp_repair_fee_manager","MRP Repair Fee manager","model_mrp_repair_fee","stock.group_stock_manager",1,1,1,1
"access_mrp_repair_cancel_user","mrp.repair.cancel user","model_mrp_repair_cancel","stock.group_stock_user",1,0,0,0
"access_mrp_repair_cancel_manager","mrp.repair.cancel manager","model_mrp_repair_cancel","stock.group_stock_manager",1,1,1,1
"access_mrp_repair_make_invoice_user","mrp.repair.make_invoice user","model_mrp_repair_make_invoice","stock.group_stock_user",1,0,0,0
"access_mrp_repair_make_invoice_manager","mrp.repair.make_invoice manager","model_mrp_repair_make_invoice","stock.group_stock_manager",1,1,1,1

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
5 access_mrp_repair_line_manager MRP Repair Line manager model_mrp_repair_line stock.group_stock_manager 1 1 1 1
6 access_mrp_repair_fee_user MRP Repair Fee user model_mrp_repair_fee stock.group_stock_user 1 0 0 0
7 access_mrp_repair_fee_manager MRP Repair Fee manager model_mrp_repair_fee stock.group_stock_manager 1 1 1 1
8 access_mrp_repair_cancel_user mrp.repair.cancel user model_mrp_repair_cancel stock.group_stock_user 1 0 0 0
9 access_mrp_repair_cancel_manager mrp.repair.cancel manager model_mrp_repair_cancel stock.group_stock_manager 1 1 1 1
10 access_mrp_repair_make_invoice_user mrp.repair.make_invoice user model_mrp_repair_make_invoice stock.group_stock_user 1 0 0 0
11 access_mrp_repair_make_invoice_manager mrp.repair.make_invoice manager model_mrp_repair_make_invoice stock.group_stock_manager 1 1 1 1

View File

@ -44,6 +44,13 @@ Main features :
'pos_report.xml',
'pos_wizard.xml',
'wizard/pos_add_product.xml',
'wizard/pos_confirm.xml',
'wizard/pos_discount.xml',
'wizard/pos_get_sale.xml',
'wizard/pos_open_statement.xml',
'wizard/pos_close_statement.xml',
'wizard/pos_box_entries.xml',
'wizard/pos_box_out.xml',
'pos_view.xml',
'pos_sequence.xml',
'posrule_data.xml',

View File

@ -125,14 +125,17 @@ class account_bank_statement(osv.osv):
}
def create(self, cr, uid, vals, context=None):
open_jrnl = self.search(cr, uid, [('company_id', '=', vals['company_id']), ('journal_id', '=', vals['journal_id']), ('state', '=', 'open')])
if open_jrnl:
raise osv.except_osv('Error', u'Une caisse de type espèce est déjà ouverte')
if 'starting_details_ids' in vals:
vals['starting_details_ids'] = starting_details_ids = map(list, vals['starting_details_ids'])
for i in starting_details_ids:
if i and i[0] and i[1]:
i[0], i[1] = 0, 0
company_id = vals and vals.get('company_id',False)
if company_id:
open_jrnl = self.search(cr, uid, [('company_id', '=', vals['company_id']), ('journal_id', '=', vals['journal_id']), ('state', '=', 'open')])
if open_jrnl:
raise osv.except_osv('Error', u'Une caisse de type espèce est déjà ouverte')
if 'starting_details_ids' in vals:
vals['starting_details_ids'] = starting_details_ids = map(list, vals['starting_details_ids'])
for i in starting_details_ids:
if i and i[0] and i[1]:
i[0], i[1] = 0, 0
res = super(account_bank_statement, self).create(cr, uid, vals, context=context)
return res

View File

@ -43,7 +43,7 @@
<group colspan="4" col="7">
<field name="amount_tax"/>
<field name="amount_total"/>
<button name="%(pos_discount)d" string="D_iscount" type="action" states="draft"/>
<button name="%(action_pos_discount)d" string="D_iscount" type="action" states="draft"/>
<button name="dummy_button" string="Compute" type="object" />
</group>
@ -830,31 +830,31 @@ invoiced
action="action_product_output"
id="products_for_output_operations"/>
<wizard
<!-- <wizard
string="Refloat Box entries"
model="account.bank.statement"
name="pos.entry"
menu="False"
id="pos_entries"/>
id="pos_entries"/>-->
<menuitem name="Register Management" parent="menu_point_root"
id="menu_point_config" sequence="3"/>
<menuitem
name="Input Operations" parent="menu_point_config"
string="Refloat"
action="pos_entries"
type="wizard"
id="menu_wizard_enter_jrnl" sequence="2" />
<wizard
action="action_box_entries"
id="menu_wizard_enter_jrnl" sequence="3" />
<!-- <wizard
string="Enter negative operations"
model="account.bank.statement"
name="pos.out"
menu="False"
id="pos_entries2"/>
id="pos_entries2"/>-->
<menuitem
name="Output Operations" parent="menu_point_config"
string="Refloat"
action="pos_entries2"
type="wizard"
action="action_box_out"
id="menu_wizard_enter_jrnl2" sequence="3" />
<!-- <menuitem name="Sales Waiting Validation" parent="menu_point_config" id="menu_point_ofsale_date_payment"-->

View File

@ -30,17 +30,9 @@
<!--<wizard string="Cancel" model="pos.order"
name="pos.cancel" id="pos_cancel" multi="True"/>-->
<wizard
string="Confirm"
model="pos.order"
name="pos.confirm"
id="pos_confirm"
multi="True"
menu="True"
/>
<!--
<wizard string="Discount" model="pos.order"
name="pos.discount" id="pos_discount" menu="False"/>
name="pos.discount" id="pos_discount" menu="False"/>-->
<!-- <wizard id="wizard_pos_payment_report" menu="False"
model="pos.order" name="pos.payment.report" string="All paid lines for the current User"/-->
@ -68,18 +60,12 @@
<wizard string="Scan Product" model="pos.order"
name="pos.scan_product" id="pos_scan_product"/-->
<wizard
<!-- <wizard
id="close_statement"
model="account.bank.statement"
menu="False"
menu="True"
name="statement.close"
string="Close Statements"/>
<wizard
id="open_statement"
model="account.bank.statement"
menu="False"
name="statement.open"
string="Open Statements"/>
string="Close Statements"/>-->
<wizard

View File

@ -417,12 +417,13 @@
<menuitem name="Cashboxes to Close" parent="menu_pos_bank_statment_tree"
action="action_cashboxes_to_close" id="menu_cashboxes_to_close_tree" groups="base.group_extended"/>
<menuitem
name="Open Statements" parent="point_of_sale.menu_point_config"
string="Open Statements"
action="open_statement"
type="wizard"
id="menu_open_statement" sequence="3" />
name="Open Registers" parent="point_of_sale.menu_point_config"
string="Open Register"
action="action_pos_open_statement"
id="menu_open_statement" sequence="1" />
<menuitem icon="STOCK_PRINT"
action="wizard_all_closed_cashbox_of_the_day"
id="menu_all_closed_cashbox_of_the_day"
@ -430,10 +431,9 @@
type="wizard"/>
<menuitem
name="Close Statements" parent="point_of_sale.menu_point_config"
string="Close Statements"
action="close_statement"
type="wizard"
id="menu_close_statement" sequence="3" />
name="Close Register" parent="point_of_sale.menu_point_config"
string="Close Register"
action="action_pos_close_statement"
id="menu_close_statement" sequence="2" />
</data>
</openerp>

View File

@ -1,9 +1,9 @@
<openerp>
<data>
<wizard
<!-- <wizard
id="close_statement"
model="account.bank.statement"
menu="False"
menu="True"
name="statement.close"
string="Close Statements"/>
<menuitem
@ -12,19 +12,9 @@
action="close_statement"
type="wizard"
id="menu_close_statement" sequence="4" />
<wizard
id="open_statement"
model="account.bank.statement"
menu="False"
name="statement.open"
string="Open Register"/>
<menuitem
name="Open Register" parent="point_of_sale.menu_point_config"
string="Open Register"
action="open_statement"
type="wizard"
id="menu_open_statement" sequence="1" />
-->
<wizard
id="wizard_all_closed_cashbox_of_the_day"

View File

@ -22,10 +22,6 @@
import wizard_pos_payment
import wizard_default_journal
import wizard_refund_order
import wizard_confirm
import wizard_discount
import wizard_get_sale
import wizard_scan_product
import wizard_receipt
import wizard_return
@ -36,8 +32,15 @@ import wizard_pos_payment_report_date
import wizard_pos_payment_report_user
import wizard_pos_sales_user_current_user
import wizard_pos_details
import wizard_open_statement
#import wizard_open_statement
import wizard_all_closed_cashbox_of_the_day
import pos_add_product
import pos_confirm
import pos_discount
import pos_get_sale
import pos_open_statement
import pos_close_statement
import pos_box_entries
import pos_box_out
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -42,7 +42,7 @@ class add_product(osv.osv_memory):
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param context: A standard dictionary
@return : Retrun the add product form again for addin more product
@return : Retrun the add product form again for adding more product
"""
this = self.browse(cr, uid, ids[0], context=context)
record_id = context and context.get('active_id',False)

View File

@ -0,0 +1,133 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# 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
# 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/>.
#
##############################################################################
import netsvc
from osv import osv,fields
from tools.translate import _
from tools.misc import UpdateableStr
from mx import DateTime
from tools.translate import _
def get_journal(self,cr,uid,context):
"""
@summary: Make the selection list of Cash Journal .
@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 list of journal
"""
obj = self.pool.get('account.journal')
user = self.pool.get('res.users').browse(cr, uid, uid)
ids = obj.search(cr, uid, [('type', '=', 'cash'), ('company_id', '=', user.company_id.id)])
res = obj.read(cr, uid, ids, ['id', 'name'], context)
res = [(r['id'], r['name']) for r in res]
res.insert(0, ('', ''))
return res
class pos_box_entries(osv.osv_memory):
_name = 'pos.box.entries'
_description = 'Pos Box Entries'
def _get_income_product(self,cr,uid,context):
"""
@summary: Make the selection list of purchasing products.
@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 of operation of product
"""
obj = self.pool.get('product.product')
ids = obj.search(cr, uid, [('income_pdt', '=', True)])
res = obj.read(cr, uid, ids, ['id', 'name'], context)
res = [(r['id'], r['name']) for r in res]
res.insert(0, ('', ''))
return res
_columns = {
'name': fields.char('Name', size=32,required=True),
'journal_id': fields.selection(get_journal, "Journal",required=True),
'product_id': fields.selection(_get_income_product, "Operation",required=True),
'amount' :fields.float('Amount', digits=(16,2)),
'ref':fields.char('Ref', size=32),
}
_defaults = {
'journal_id': lambda *a: 1,
'product_id': lambda *a: 1,
}
def get_in(self, cr, uid, ids, context):
"""
@summary: Create the entry of statement in journal .
@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 of operation of product
"""
statement_obj = self.pool.get('account.bank.statement')
product_obj = self.pool.get('product.template')
res_obj = self.pool.get('res.users')
product_obj=self.pool.get('product.product')
bank_statement=self.pool.get('account.bank.statement.line')
for data in self.read(cr, uid, ids):
args = {}
curr_company = res_obj.browse(cr,uid,uid).company_id.id
statement_id = statement_obj.search(cr,uid, [('journal_id','=',data['journal_id']),('company_id','=',curr_company),('user_id','=',uid),('state','=','open')])
if not statement_id:
raise osv.except_osv(_('Error !'), _('You have to open at least one cashbox'))
product = product_obj.browse(cr, uid, data['product_id'])
acc_id = product_obj.browse(cr,uid,data['product_id']).property_account_income
if not acc_id:
raise osv.except_osv(_('Error !'), _('please check that account is set to %s')%(product_obj.browse(cr,uid,data['product_id']).name))
if statement_id:
statement_id = statement_id[0]
if not statement_id:
statement_id = statement_obj.create(cr,uid,{'date':time.strftime('%Y-%m-%d 00:00:00'),
'journal_id':data['journal_id'],
'company_id':curr_company,
'user_id':uid,
})
args['statement_id'] = statement_id
args['journal_id'] = data['journal_id']
if acc_id:
args['account_id'] = acc_id.id
args['amount'] = data['amount'] or 0.0
args['ref'] = "%s" %(data['ref'] or '')
args['name'] = "%s: %s "% (product_obj.browse(cr,uid,data['product_id']).name, data['name'].decode('utf8'))
address_u = res_obj.browse(cr,uid,uid).address_id
if address_u:
partner_id = address_u.partner_id and address_u.partner_id.id or None
args['partner_id'] = partner_id
statement_line_id =bank_statement.create(cr, uid, args)
return {}
pos_box_entries()

View File

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- Box Entries -->
<record id="view_box_entries" model="ir.ui.view">
<field name="name">Box Entries</field>
<field name="model">pos.box.entries</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Entrée de caisse">
<separator string="Please fill these fields for entries to the box:" colspan="4"/>
<field name="name"/>
<field name="journal_id"/>
<field name="product_id"/>
<field name="amount"/>
<field name="ref"/>
<group colspan="4" col="2">
<button icon='gtk-cancel' special="cancel"
string="Close" />
<button name="get_in" string="Make Entries in the CashBox"
colspan="1" type="object" icon="gtk-ok" />
</group>
</form>
</field>
</record>
<record id="action_box_entries" model="ir.actions.act_window">
<field name="name">Box Entries</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">pos.box.entries</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
</data>
</openerp>

View File

@ -0,0 +1,132 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# 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
# 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/>.
#
##############################################################################
import netsvc
from osv import osv,fields
from tools.translate import _
from tools.misc import UpdateableStr
from mx import DateTime
from tools.translate import _
import pos_box_entries
print dir(pos_box_entries)
class pos_box_out(osv.osv_memory):
_name = 'pos.box.out'
_description = 'Pos Box Out'
def _get_expense_product(self,cr,uid,context):
"""
@summary: Make the selection list of expense product.
@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 of operation of product
"""
obj = self.pool.get('product.product')
company_id = self.pool.get('res.users').browse(cr, uid, uid).company_id.id
ids = obj.search(cr, uid, ['&', ('expense_pdt', '=', True), '|', ('company_id', '=', company_id), ('company_id', '=', None)])
res = obj.read(cr, uid, ids, ['id', 'name'], context)
res = [(r['id'], r['name']) for r in res]
res.insert(0, ('', ''))
return res
_columns = {
'name': fields.char('Name', size=32,required=True),
'journal_id': fields.selection(pos_box_entries.get_journal, "Journal",required=True),
'product_id': fields.selection(_get_expense_product, "Operation",required=True),
'amount' :fields.float('Amount', digits=(16,2)),
'ref':fields.char('Ref', size=32),
}
_defaults = {
'journal_id': lambda *a: 1,
'product_id': lambda *a: 1,
}
def get_out(self, cr, uid, ids, context):
"""
@summary: Create the entries in the CashBox .
@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 of operation of product
"""
args = {}
statement_obj= self.pool.get('account.bank.statement')
statement_line_obj=self.pool.get('account.bank.statement.line')
product_obj= self.pool.get('product.template')
productp_obj= self.pool.get('product.product')
res_obj = self.pool.get('res.users')
for data in self.read(cr, uid, ids):
curr_company = res_obj.browse(cr,uid,uid).company_id.id
statement_id = statement_obj.search(cr,uid, [('journal_id','=',data['journal_id']),('company_id','=',curr_company),('user_id','=',uid),('state','=','open')])
monday = (DateTime.now() + DateTime.RelativeDateTime(weekday=(DateTime.Monday,0))).strftime('%Y-%m-%d')
sunday = (DateTime.now() + DateTime.RelativeDateTime(weekday=(DateTime.Sunday,0))).strftime('%Y-%m-%d')
done_statmt = statement_obj.search(cr,uid, [('date','>=',monday+' 00:00:00'),('date','<=',sunday+' 23:59:59'),('journal_id','=',data['journal_id']),('company_id','=',curr_company),('user_id','=',uid)])
stat_done = statement_obj.browse(cr,uid, done_statmt)
address_u = res_obj.browse(cr,uid,uid).address_id
am = 0.0
amount_check = productp_obj.browse(cr,uid,data['product_id']).am_out or False
for st in stat_done:
for s in st.line_ids:
if address_u and s.partner_id==address_u.partner_id and s.am_out:
am+=s.amount
if (-data['amount'] or 0.0)+ am <-(res_obj.browse(cr,uid,uid).company_id.max_diff or 0.0) and amount_check:
val = (res_obj.browse(cr,uid,uid).company_id.max_diff or 0.0)+ am
raise osv.except_osv(_('Error !'), _('The maximum value you can still withdraw is exceeded. \n Remaining value is equal to %d ')%(val))
acc_id = product_obj.browse(cr,uid,data['product_id']).property_account_income
if not acc_id:
raise osv.except_osv(_('Error !'), _('please check that account is set to %s')%(product_obj.browse(cr,uid,data['product_id']).name))
if not statement_id:
raise osv.except_osv(_('Error !'), _('You have to open at least one cashbox'))
if statement_id:
statement_id = statement_id[0]
if not statement_id:
statement_id = statement_obj.create(cr,uid,{'date':time.strftime('%Y-%m-%d 00:00:00'),
'journal_id':data['journal_id'],
'company_id':curr_company,
'user_id':uid,
})
args['statement_id']= statement_id
args['journal_id']= data['journal_id']
if acc_id:
args['account_id']= acc_id.id
amount= data['amount'] or 0.0
if data['amount'] > 0:
amount= -data['amount']
args['amount'] = amount
if productp_obj.browse(cr,uid,data['product_id']).am_out:
args['am_out'] = True
args['ref'] = data['ref'] or ''
args['name'] = "%s: %s "%(product_obj.browse(cr,uid,data['product_id']).name, data['name'].decode('utf8'))
address_u = res_obj.browse(cr,uid,uid).address_id
if address_u:
partner_id = address_u.partner_id and address_u.partner_id.id or None
args['partner_id'] = partner_id
statement_line_id = statement_line_obj.create(cr, uid, args)
return {}
pos_box_out()

View File

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- Box Entries -->
<record id="view_pos_box_out" model="ir.ui.view">
<field name="name">Box Out</field>
<field name="model">pos.box.out</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Sortie de caisse">
<separator string="Please fill these fields for entries to the box:" colspan="4"/>
<field name="name"/>
<field name="journal_id"/>
<field name="product_id"/>
<field name="amount"/>
<field name="ref"/>
<group colspan="4" col="2">
<button icon='gtk-cancel' special="cancel"
string="Close" />
<button name="get_out" string="Make Entries in the CashBox"
colspan="1" type="object" icon="gtk-ok" />
</group>
</form>
</field>
</record>
<record id="action_box_out" model="ir.actions.act_window">
<field name="name">Box Out</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">pos.box.out</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
</data>
</openerp>

View File

@ -0,0 +1,52 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# 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
# 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/>.
#
##############################################################################
import netsvc
from osv import osv,fields
from tools.translate import _
import time
class pos_close_statement(osv.osv_memory):
_name = 'pos.close.statement'
_description = 'Close Statements'
def close_statement(self, cr, uid, ids, context):
"""
@summary: Close the statements
@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 : Blank Dictionary
"""
company_id=self.pool.get('res.users').browse(cr,uid,uid).company_id.id
statement_obj = self.pool.get('account.bank.statement')
singer_obj = self.pool.get('singer.statement')
journal_obj=self.pool.get('account.journal')
journal_lst=journal_obj.search(cr,uid,[('company_id','=',company_id),('auto_cash','=',True),('check_dtls','=',False)])
journal_ids=journal_obj.browse(cr,uid, journal_lst)
for journal in journal_ids:
ids = statement_obj.search(cr, uid, [('state','!=','confirm'),('user_id','=',uid),('journal_id','=',journal.id)])
statement_obj.button_confirm(cr,uid,ids)
return {}
pos_close_statement()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- Point of Sale Confirm -->
<record id="view_pos_close_statement" model="ir.ui.view">
<field name="name">Close Statements</field>
<field name="model">pos.close.statement</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Close Statements">
<label string="Are you sure you want to close the statements ?" colspan="2"/>
<newline/>
<button icon='gtk-cancel' special="cancel"
string="No" />
<button name="close_statement" string="Yes"
colspan="1" type="object" icon="gtk-ok"/>
</form>
</field>
</record>
<act_window name="Close Statements"
res_model="pos.close.statement"
src_model="account.bank.statement"
view_mode="form"
target="new"
key2="client_action_multi"
id="act_pos_open_statement"/>
<record id="action_pos_close_statement" model="ir.actions.act_window">
<field name="name">Close Register</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">pos.close.statement</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
</data>
</openerp>

View File

@ -0,0 +1,60 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# 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
# 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/>.
#
##############################################################################
import netsvc
from osv import osv,fields
from tools.translate import _
class pos_confirm(osv.osv_memory):
_name = 'pos.confirm'
_description = 'Point of Sale Confirm'
def action_confirm(self, cr, uid, ids, context):
"""
@summary: Confirm the order and close the sales .
@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 :Blank dictionary
"""
this = self.browse(cr, uid, ids[0], context=context)
record_id = context and context.get('active_id',False)
if record_id:
if isinstance(record_id, (int, long)):
record_id=[record_id]
if record_id:
company_id=self.pool.get('res.users').browse(cr,uid,uid).company_id
order_obj = self.pool.get('pos.order')
for order_id in order_obj.browse(cr, uid, record_id, context=context):
if order_id.state =='paid':
order_obj.write(cr,uid,[order_id.id],{'journal_entry':True})
order_obj.create_account_move(cr, uid, [order_id.id], context=context)
wf_service = netsvc.LocalService("workflow")
for i in record_id:
wf_service.trg_validate(uid, 'pos.order', i, 'done', cr)
return {}
pos_confirm()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- Point of Sale Confirm -->
<record id="view_pos_confirm" model="ir.ui.view">
<field name="name">Sale Confirm</field>
<field name="model">pos.confirm</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Open Statements">
<label string="Are you sure you want to close your sales ?" colspan="2"/>
<newline/>
<button icon='gtk-cancel' special="cancel"
string="No" />
<button name="action_confirm" string="Yes"
colspan="1" type="object" icon="gtk-ok"/>
</form>
</field>
</record>
<record id="action_pos_confirm" model="ir.actions.act_window">
<field name="name">Sale Confirm</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">pos.confirm</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
<record model="ir.values" id="values_pos_confirm">
<field name="model_id" ref="point_of_sale.model_pos_order" />
<field name="object" eval="1" />
<field name="name">Sale Confirm</field>
<field name="key2">client_action_multi</field>
<field name="value" eval="'ir.actions.act_window,' + str(ref('action_pos_confirm'))"/>
<field name="key">action</field>
<field name="model">pos.order</field>
</record>
</data>
</openerp>

View File

@ -0,0 +1,104 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# 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
# 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/>.
#
##############################################################################
import netsvc
from osv import osv,fields
from tools.translate import _
class pos_discount(osv.osv_memory):
_name = 'pos.discount'
_description = 'Add Discount'
_columns = {
'discount': fields.float('Discount ', required=True),
'discount_notes': fields.char('Discount Notes',size= 128, required=True),
}
_defaults = {
'discount': lambda *a: 5,
}
def apply_discount(self, cr, uid, ids, context):
"""
@summary: To give the discount of product and check the .
@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 : nothing
"""
this = self.browse(cr, uid, ids[0], context=context)
record_id = context and context.get('record_id',False)
if isinstance(record_id, (int, long)):
record_id=[record_id]
order_ref = self.pool.get('pos.order')
order_line_ref =self.pool.get('pos.order.line')
for order in order_ref.browse(cr, uid, record_id, context=context):
for line in order.lines :
company_discount = order.company_id.company_discount
applied_discount =this.discount
if applied_discount == 0.00:
notice = 'No Discount'
elif company_discount >= applied_discount:
notice = 'Minimum Discount'
else:
notice = this.discount_notes
if self.check_discount(cr, uid, record_id,this.discount,context) == 'apply_discount':
order_line_ref.write(cr, uid, [line.id],
{'discount': this.discount,
'price_ded':line.price_unit*line.qty*(this.discount or 0)*0.01 or 0.0,
'notice':notice
},
context=context,)
else :
order_line_ref.write(cr, uid, [line.id],
{'discount': this.discount,
'notice': notice,
'price_ded':line.price_unit*line.qty*(this.discount or 0)*0.01 or 0.0
},
context=context,)
return {}
def check_discount(self, cr, uid, record_id,discount, context):
"""
@summary: Check the discount of define by company .
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param record_id:Current Order id
@param discount:Select Discount
@param context: A standard dictionary
@return : retrun to apply and used the company discount base on condition
"""
order_ref = self.pool.get('pos.order')
for order in order_ref.browse(cr, uid, record_id, context=context):
company_disc = order.company_id.company_discount
for line in order.lines :
prod_disc = discount
if prod_disc <= company_disc :
return 'apply_discount'
else :
return 'disc_discount'
pos_discount()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- Add Product -->
<record id="view_pos_discount" model="ir.ui.view">
<field name="name">Apply Discount</field>
<field name="model">pos.discount</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Apply Discount">
<group col="2" colspan="4">
<field name="discount"/>
<field name="discount_notes"/>
<button icon='gtk-cancel' special="cancel"
string="Close" />
<button name="apply_discount" string="Apply Discount"
colspan="1" type="object" icon="gtk-ok" />
</group>
</form>
</field>
</record>
<record id="action_pos_discount" model="ir.actions.act_window">
<field name="name">Apply Discount</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">pos.discount</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
<field name="context">{'record_id' : active_id}</field>
</record>
</data>
</openerp>

View File

@ -0,0 +1,79 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# 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
# 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/>.
#
##############################################################################
import netsvc
from osv import osv,fields
from tools.translate import _
class pos_get_sale(osv.osv_memory):
_name = 'pos.get.sale'
_description = 'Get From Sale'
_columns = {
'picking_id': fields.many2one('stock.picking', 'Sale Order', domain=[('state','in',('assigned','confirmed')), ('type', '=', 'out')],context="{'contact_display':'partner'}",required=True),
}
def sale_complete(self, cr, uid, ids, context):
"""
@summary: Select the picking order and add the in Point of sale order
@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 : nothing
"""
this = self.browse(cr, uid, ids[0], context=context)
record_id = context and context.get('active_id',False)
proxy_pos = self.pool.get('pos.order')
proxy_pick = self.pool.get('stock.picking')
proxy_order_line=self.pool.get('pos.order.line')
if record_id:
order=proxy_pos.browse(cr, uid, record_id, context)
if order.state in ('paid', 'invoiced'):
raise osv.except_osv(_('UserError '), _("You can't modify this order. It has already been paid"))
for pick in proxy_pick.browse(cr, uid, [this.picking_id.id], context):
proxy_pos.write(cr, uid, record_id, {
'last_out_picking':this.picking_id.id,
'partner_id': pick.address_id and pick.address_id.partner_id.id
})
order = proxy_pick.write(cr, uid, [this.picking_id.id], {
'invoice_state': 'none',
'pos_order': record_id
})
for line in pick.move_lines:
proxy_order_line.create(cr, uid, {
'name': line.sale_line_id.name,
'order_id': record_id,
'qty': line.product_qty,
'product_id': line.product_id.id,
'price_unit': line.sale_line_id.price_unit,
'discount': line.sale_line_id.discount,
})
return {}
pos_get_sale()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- Select an Open Sale Order -->
<record id="view_pos_get_sale" model="ir.ui.view">
<field name="name">Open Sale Order</field>
<field name="model">pos.get.sale</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Select an Open Sale Order">
<field name="picking_id"/>
<newline/>
<group col="2" colspan="4">
<button icon='gtk-cancel' special="cancel"
string="Cancel" />
<button name="sale_complete" string="Confirm"
colspan="1" type="object" icon="gtk-ok" />
</group>
</form>
</field>
</record>
<record id="action_pos_get_sale" model="ir.actions.act_window">
<field name="name">Select an Open Sale Order</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">pos.get.sale</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
</data>
</openerp>

View File

@ -0,0 +1,90 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# 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
# 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/>.
#
##############################################################################
import netsvc
from osv import osv,fields
from tools.translate import _
import time
class pos_open_statement(osv.osv_memory):
_name = 'pos.open.statement'
_description = 'Open Statements'
def open_statement(self, cr, uid, ids, context):
"""
@summary: open the statements
@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 : Blank Directory
"""
company_id=self.pool.get('res.users').browse(cr,uid,uid).company_id.id
statement_obj =self.pool.get('account.bank.statement')
singer_obj = self.pool.get('singer.statement')
journal_obj=self.pool.get('account.journal')
journal_lst=journal_obj.search(cr,uid,[('company_id','=',company_id),('auto_cash','=',True)])
journal_ids=journal_obj.browse(cr,uid, journal_lst)
for journal in journal_ids:
ids = statement_obj.search(cr, uid, [('state','!=','confirm'),('user_id','=',uid),('journal_id','=',journal.id)])
if len(ids):
raise osv.except_osv(_('Message'),_('You can not open a Cashbox for "%s". \n Please close the cashbox related to. '%(journal.name) ))
sql = """ Select id from account_bank_statement
where journal_id=%d
and company_id =%d
order by id desc limit 1"""%(journal.id,company_id)
singer_ids=None
cr.execute(sql)
st_id = cr.fetchone()
number=''
sequence_obj=self.pool.get('ir.sequence')
if journal.statement_sequence_id:
number = sequence_obj.get_id(cr, uid, journal.id)
else:
number = sequence_obj.get(cr, uid,
'account.bank.statement')
# statement_id=statement_obj.create(cr,uid,{'journal_id':journal.id,
# 'company_id':company_id,
# 'user_id':uid,
# 'state':'open',
# 'name':number
# })
period=statement_obj._get_period(cr,uid,context) or None
cr.execute("INSERT INTO account_bank_statement(journal_id,company_id,user_id,state,name, period_id,date) VALUES(%d,%d,%d,'open','%s',%d,'%s')"%(journal.id,company_id,uid,number, period, time.strftime('%Y-%m-%d %H:%M:%S')))
cr.commit()
cr.execute("select id from account_bank_statement where journal_id=%d and company_id=%d and user_id=%d and state='open' and name='%s'"%(journal.id,company_id,uid,number))
statement_id=cr.fetchone()[0]
if st_id:
statemt_id=statement_obj.browse(cr,uid,st_id[0])
if statemt_id and statemt_id.ending_details_ids:
statement_obj.write(cr, uid,[statement_id], {'balance_start':statemt_id.balance_end,
'state':'open'})
if statemt_id.ending_details_ids:
for i in statemt_id.ending_details_ids:
c=singer_obj.create(cr,uid, { 'pieces':i.pieces,
'number':i.number,
'starting_id':statement_id,
})
cr.commit()
return {}
pos_open_statement()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- Point of Sale Confirm -->
<record id="view_pos_open_statement" model="ir.ui.view">
<field name="name">Open Statements</field>
<field name="model">pos.open.statement</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Open Statements">
<label string="Are you sure you want to open the statements ?" colspan="2"/>
<newline/>
<button icon='gtk-cancel' special="cancel"
string="No" />
<button name="open_statement" string="Yes"
colspan="1" type="object" icon="gtk-ok"/>
</form>
</field>
</record>
<act_window name="Open Statements"
res_model="pos.open.statement"
src_model="account.bank.statement"
view_mode="form"
target="new"
key2="client_action_multi"
id="act_pos_open_statement"/>
<record id="action_pos_open_statement" model="ir.actions.act_window">
<field name="name">Open Register</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">pos.open.statement</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
</data>
</openerp>

View File

@ -1,78 +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/>.
#
##############################################################################
import wizard
import netsvc
import pooler
import time
_form = """<?xml version="1.0"?>
<form string="Open Statements">
<label string="Are you sure you want to close your sales ?" colspan="2"/>
</form>
"""
_fields = {}
def _confirm(self, cr, uid, data, context):
pool = pooler.get_pool(cr.dbname)
company_id=pool.get('res.users').browse(cr,uid,uid).company_id
order_obj = pool.get('pos.order')
for order_id in order_obj.browse(cr, uid, data['ids'], context=context):
if order_id.state =='paid':
order_obj.write(cr,uid,[order_id.id],{'journal_entry':True})
order_obj.create_account_move(cr, uid, [order_id.id], context=context)
wf_service = netsvc.LocalService("workflow")
for i in data['ids']:
wf_service.trg_validate(uid, 'pos.order', i, 'done', cr)
return {}
def _get_state(self, cr, uid, data, context):
action = 'invoice'
return action
class pos_confirm(wizard.interface):
states = {
'init': {
'actions': [],
'result': {
'type': 'form',
'arch': _form,
'fields': _fields,
'state': (('end', 'No','gtk-cancel'),
('open', 'Yes', 'gtk-ok', True)
)
}
},
'open': {
'actions': [_confirm],
'result': {
'type': 'state',
'state':'end'}
},
}
pos_confirm('pos.confirm')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,145 +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/>.
#
##############################################################################
import pooler
import wizard
_form = """<?xml version="1.0"?>
<form string="Discount :">
<field name="discount"/>
</form>
"""
disc_form = """<?xml version="1.0"?>
<form string="Discount Notes :">
<label colspan="2" string="Reason For Giving Discount" align="0.0"/>
<newline/>
<field name="note" nolabel="1"/>
</form>
"""
_fields = {
'discount': {
'string': 'Discount percentage',
'type': 'float',
'required': True,
'default': lambda *args: 5
},
}
disc_fields = {
'note': {
'string': 'Discount Notes',
'type': 'char',
'size': 128,
'required': True
},
}
class discount_wizard(wizard.interface):
def apply_discount(self, cr, uid, data, context):
pool = pooler.get_pool(cr.dbname)
order_ref = pool.get('pos.order')
order_line_ref = pool.get('pos.order.line')
for order in order_ref.browse(cr, uid, data['ids'], context=context):
for line in order.lines :
company_discount = order.company_id.company_discount
applied_discount =data['form']['discount']
if applied_discount == 0.00:
notice = 'No Discount'
elif company_discount >= applied_discount:
notice = 'Minimum Discount'
else:
notice = data['form']['note']
if self.check_discount(cr, uid, data, context) == 'apply_discount':
order_line_ref.write(cr, uid, [line.id],
{'discount': data['form']['discount'],
'price_ded':line.price_unit*line.qty*(data['form']['discount'] or 0)*0.01 or 0.0,
'notice':notice
},
context=context,)
else :
order_line_ref.write(cr, uid, [line.id],
{'discount': data['form']['discount'],
'notice': notice,
'price_ded':line.price_unit*line.qty*(data['form']['discount'] or 0)*0.01 or 0.0
},
context=context,)
return {}
def check_discount(self, cr, uid, data, context):
pool = pooler.get_pool(cr.dbname)
order_ref = pool.get('pos.order')
for order in order_ref.browse(cr, uid, data['ids'], context=context):
company_disc = order.company_id.company_discount
for line in order.lines :
prod_disc = data['form']['discount']
if prod_disc <= company_disc :
return 'apply_discount'
else :
return 'disc_discount'
states = {
'init': {
'actions': [],
'result': {
'type': 'form',
'arch': _form,
'fields': _fields,
'state': (('end', 'Cancel'),
('check_disc', 'Apply Discount', 'gtk-ok', True)
)
}
},
'check_disc': {
'actions': [],
'result': {'type':'choice','next_state':check_discount}
},
'disc_discount': {
'actions': [],
'result': {
'type': 'form',
'arch': disc_form,
'fields':disc_fields,
'state': (('end', 'Cancel'),
('apply_discount', 'Apply Discount', 'gtk-ok', True)
)
}
},
'apply_discount': {
'actions': [],
'result': {
'type': 'action',
'action': apply_discount,
'state': "end",
}
},
}
discount_wizard('pos.discount')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,95 +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/>.
#
##############################################################################
import pooler
import wizard
from tools.translate import _
picking_form = """<?xml version="1.0"?>
<form string="Select an Open Sale Order">
<field name="picking_id" domain="[('state','in',('assigned','confirmed')), ('type', '=', 'out')]" context="{'contact_display':'partner'}"/>
</form>
"""
picking_fields = {
'picking_id': {'string': 'Sale Order', 'type': 'many2one', 'relation': 'stock.picking', 'required': True}
}
def _sale_complete(self, cr, uid, data, context):
pool = pooler.get_pool(cr.dbname)
order = pool.get('pos.order').browse(cr, uid, data['id'], context)
if order.state in ('paid', 'invoiced'):
raise wizard.except_wizard(_('UserError'), _("You can't modify this order. It has already been paid"))
pick = pool.get('stock.picking').browse(cr, uid, data['form']['picking_id'], context)
pool.get('pos.order').write(cr, uid, data['id'], {
'last_out_picking': data['form']['picking_id'],
'partner_id': pick.address_id and pick.address_id.partner_id.id
})
order = pool.get('stock.picking').write(cr, uid, [data['form']['picking_id']], {
'invoice_state': 'none',
'pos_order': data['id']
})
for line in pick.move_lines:
pool.get('pos.order.line').create(cr, uid, {
'name': line.sale_line_id.name,
'order_id': data['id'],
'qty': line.product_qty,
'product_id': line.product_id.id,
'price_unit': line.sale_line_id.price_unit,
'discount': line.sale_line_id.discount,
})
return {}
class pos_sale_get(wizard.interface):
states = {
'init': {
'actions': [],
'result': {
'type': 'form',
'arch': picking_form,
'fields': picking_fields,
'state': (('end', 'Cancel'),
('set', 'Confirm', 'gtk-ok', True)
)
}
},
'set': {
'actions': [_sale_complete],
'result': {
'type': 'state',
'state': "end",
}
},
}
pos_sale_get('pos.sale.get')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,147 +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/>.
#
##############################################################################
import pooler
import wizard
from tools.translate import _
import time
statement_form = """<?xml version="1.0"?>
<form string="Open Statements">
<label string="Are you sure you want to open the statements ?" colspan="2"/>
</form>
"""
statement_form_close = """<?xml version="1.0"?>
<form string="Close Statements">
<label string="Are you sure you want to close the statements ?" colspan="2"/>
</form>
"""
statement_fields = {}
def _close_statement(self, cr, uid, data, context):
pool = pooler.get_pool(cr.dbname)
company_id=pool.get('res.users').browse(cr,uid,uid).company_id.id
statement_obj = pool.get('account.bank.statement')
singer_obj = pool.get('singer.statement')
journal_obj=pool.get('account.journal')
journal_lst=journal_obj.search(cr,uid,[('company_id','=',company_id),('auto_cash','=',True),('check_dtls','=',False)])
journal_ids=journal_obj.browse(cr,uid, journal_lst)
for journal in journal_ids:
ids = statement_obj.search(cr, uid, [('state','!=','confirm'),('user_id','=',uid),('journal_id','=',journal.id)])
statement_obj.button_confirm(cr,uid,ids)
return {}
def _open_statement(self, cr, uid, data, context):
pool = pooler.get_pool(cr.dbname)
company_id=pool.get('res.users').browse(cr,uid,uid).company_id.id
statement_obj = pool.get('account.bank.statement')
singer_obj = pool.get('singer.statement')
journal_obj=pool.get('account.journal')
journal_lst=journal_obj.search(cr,uid,[('company_id','=',company_id),('auto_cash','=',True)])
journal_ids=journal_obj.browse(cr,uid, journal_lst)
for journal in journal_ids:
ids = statement_obj.search(cr, uid, [('state','!=','confirm'),('user_id','=',uid),('journal_id','=',journal.id)])
if len(ids):
raise wizard.except_wizard(_('Message'),_('You can not open a Cashbox for "%s". \n Please close the cashbox related to. '%(journal.name) ))
sql = """ Select id from account_bank_statement
where journal_id=%d
and company_id =%d
order by id desc limit 1"""%(journal.id,company_id)
singer_ids=None
cr.execute(sql)
st_id = cr.fetchone()
number=''
if journal.statement_sequence_id:
number = pool.get('ir.sequence').get_id(cr, uid, journal.id)
else:
number = pool.get('ir.sequence').get(cr, uid,
'account.bank.statement')
# statement_id=statement_obj.create(cr,uid,{'journal_id':journal.id,
# 'company_id':company_id,
# 'user_id':uid,
# 'state':'open',
# 'name':number
# })
period=statement_obj._get_period(cr,uid,context) or None
cr.execute("INSERT INTO account_bank_statement(journal_id,company_id,user_id,state,name, period_id,date) VALUES(%d,%d,%d,'open','%s',%d,'%s')"%(journal.id,company_id,uid,number, period, time.strftime('%Y-%m-%d %H:%M:%S')))
cr.commit()
cr.execute("select id from account_bank_statement where journal_id=%d and company_id=%d and user_id=%d and state='open' and name='%s'"%(journal.id,company_id,uid,number))
statement_id=cr.fetchone()[0]
if st_id:
statemt_id=statement_obj.browse(cr,uid,st_id[0])
if statemt_id and statemt_id.ending_details_ids:
statement_obj.write(cr, uid,[statement_id], {'balance_start':statemt_id.balance_end,
'state':'open'})
if statemt_id.ending_details_ids:
for i in statemt_id.ending_details_ids:
c=singer_obj.create(cr,uid, { 'pieces':i.pieces,
'number':i.number,
'starting_id':statement_id,
})
cr.commit()
return {}
class statement_open(wizard.interface):
states = {
'init': {
'actions': [],
'result': {
'type': 'form',
'arch': statement_form,
'fields': statement_fields,
'state': (('end', 'No','gtk-cancel'),
('open', 'Yes', 'gtk-ok', True)
)
}
},
'open': {
'actions': [_open_statement],
'result': {
'type': 'state',
# 'action' :_open_statement,
'state':'end'}
},
}
statement_open('statement.open')
class statement_close(wizard.interface):
states = {
'init': {
'actions': [],
'result': {
'type': 'form',
'arch': statement_form_close,
'fields': statement_fields,
'state': (('end', 'No','gtk-cancel'),
('open', 'Yes', 'gtk-ok', True)
)
}
},
'open': {
'actions': [_close_statement],
'result': {
'type': 'state',
'state':'end'}
},
}
statement_close('statement.close')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,232 +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/>.
#
##############################################################################
import time
import netsvc
from tools.misc import UpdateableStr
import wizard
import pooler
from mx import DateTime
from tools.translate import _
entry_form = '''<?xml version="1.0"?>
<form string="%s">
<separator string="Please fill these fields for entries to the box:" colspan="4"/>
<newline/>
<field name="name"/>
<field name="ref"/>
<field name="journal_id"/>
<field name="amount"/>
<field name="product_id"/>
</form>
'''
def _get_journal(self,cr,uid,context):
pool = pooler.get_pool(cr.dbname)
obj = pool.get('account.journal')
user = pool.get('res.users').browse(cr, uid, uid)
ids = obj.search(cr, uid, [('type', '=', 'cash'), ('company_id', '=', user.company_id.id)])
res = obj.read(cr, uid, ids, ['id', 'name'], context)
res = [(r['id'], r['name']) for r in res]
res.insert(0, ('', ''))
return res
def _get_pdt(self,cr,uid,context):
pool = pooler.get_pool(cr.dbname)
obj = pool.get('product.product')
ids = obj.search(cr, uid, [('income_pdt', '=', True)])
res = obj.read(cr, uid, ids, ['id', 'name'], context)
res = [(r['id'], r['name']) for r in res]
res.insert(0, ('', ''))
return res
def _get_pdt_exp(self,cr,uid,context):
pool = pooler.get_pool(cr.dbname)
obj = pool.get('product.product')
company_id = pool.get('res.users').browse(cr, uid, uid).company_id.id
ids = obj.search(cr, uid, ['&', ('expense_pdt', '=', True), '|', ('company_id', '=', company_id), ('company_id', '=', None)])
res = obj.read(cr, uid, ids, ['id', 'name'], context)
res = [(r['id'], r['name']) for r in res]
res.insert(0, ('', ''))
return res
entry_fields = {
'journal_id': {'string': 'Journal', 'type': 'selection', 'selection': _get_journal, 'required':True},
'product_id': {'string': 'Operation', 'type': 'selection', 'selection':_get_pdt , 'required':True},
'amount': {'string': 'Amount', 'type': 'float'},
'name': {'string': 'Name', 'type': 'char', 'size': '32', 'required':True},
'ref': {'string': 'Ref.', 'type': 'char', 'size': '32'},
}
out_fields = {
'journal_id': {'string': 'Journal', 'type': 'selection', 'selection': _get_journal, 'required':True},
'product_id': {'string': 'Operation', 'type': 'selection', 'selection':_get_pdt_exp , 'required':True},
'amount': {'string': 'Amount', 'type': 'float'},
'name': {'string': 'Name', 'type': 'char', 'size': '32', 'required':True},
'ref': {'string': 'Ref.', 'type': 'char', 'size': '32'},
}
def _get_out(self, cr, uid, data, context):
args = {}
pool = pooler.get_pool(cr.dbname)
statement_obj= pool.get('account.bank.statement')
product_obj= pool.get('product.template')
productp_obj= pool.get('product.product')
res_obj = pool.get('res.users')
curr_company = res_obj.browse(cr,uid,uid).company_id.id
statement_id = statement_obj.search(cr,uid, [('journal_id','=',data['form']['journal_id']),('company_id','=',curr_company),('user_id','=',uid),('state','=','open')])
monday = (DateTime.now() + DateTime.RelativeDateTime(weekday=(DateTime.Monday,0))).strftime('%Y-%m-%d')
sunday = (DateTime.now() + DateTime.RelativeDateTime(weekday=(DateTime.Sunday,0))).strftime('%Y-%m-%d')
done_statmt = statement_obj.search(cr,uid, [('date','>=',monday+' 00:00:00'),('date','<=',sunday+' 23:59:59'),('journal_id','=',data['form']['journal_id']),('company_id','=',curr_company),('user_id','=',uid)])
stat_done = statement_obj.browse(cr,uid, done_statmt)
address_u = pool.get('res.users').browse(cr,uid,uid).address_id
am = 0.0
amount_check = productp_obj.browse(cr,uid,data['form']['product_id']).am_out or False
for st in stat_done:
for s in st.line_ids:
if address_u and s.partner_id==address_u.partner_id and s.am_out:
am+=s.amount
if (-data['form']['amount'] or 0.0)+ am <-(res_obj.browse(cr,uid,uid).company_id.max_diff or 0.0) and amount_check:
val = (res_obj.browse(cr,uid,uid).company_id.max_diff or 0.0)+ am
raise wizard.except_wizard(_('Error !'), _('The maximum value you can still withdraw is exceeded. \n Remaining value is equal to %d ')%(val))
acc_id = product_obj.browse(cr,uid,data['form']['product_id']).property_account_income
if not acc_id:
raise wizard.except_wizard(_('Error !'), _('please check that account is set to %s')%(product_obj.browse(cr,uid,data['form']['product_id']).name))
if not statement_id:
raise wizard.except_wizard(_('Error !'), _('You have to open at least one cashbox'))
if statement_id:
statement_id = statement_id[0]
if not statement_id:
statement_id = statement_obj.create(cr,uid,{'date':time.strftime('%Y-%m-%d 00:00:00'),
'journal_id':data['form']['journal_id'],
'company_id':curr_company,
'user_id':uid,
})
args['statement_id']= statement_id
args['journal_id']= data['form']['journal_id']
if acc_id:
args['account_id']= acc_id.id
amount= data['form']['amount'] or 0.0
if data['form']['amount'] > 0:
amount= -data['form']['amount']
args['amount'] = amount
if productp_obj.browse(cr,uid,data['form']['product_id']).am_out:
args['am_out'] = True
args['ref'] = data['form']['ref'] or ''
args['name'] = "%s: %s "%(product_obj.browse(cr,uid,data['form']['product_id']).name, data['form']['name'].decode('utf8'))
address_u = pool.get('res.users').browse(cr,uid,uid).address_id
if address_u:
partner_id = address_u.partner_id and address_u.partner_id.id or None
args['partner_id'] = partner_id
statement_line_id = pool.get('account.bank.statement.line').create(cr, uid, args)
return {}
def _get_in(self, cr, uid, data, context):
args = {}
pool = pooler.get_pool(cr.dbname)
statement_obj = pool.get('account.bank.statement')
product_obj = pool.get('product.template')
res_obj = pool.get('res.users')
curr_company = res_obj.browse(cr,uid,uid).company_id.id
statement_id = statement_obj.search(cr,uid, [('journal_id','=',data['form']['journal_id']),('company_id','=',curr_company),('user_id','=',uid),('state','=','open')])
if not statement_id:
raise wizard.except_wizard(_('Error !'), _('You have to open at least one cashbox'))
product = pool.get('product.product').browse(cr, uid, data['form']['product_id'])
acc_id = product_obj.browse(cr,uid,data['form']['product_id']).property_account_income
if not acc_id:
raise wizard.except_wizard(_('Error !'), _('please check that account is set to %s')%(product_obj.browse(cr,uid,data['form']['product_id']).name))
if statement_id:
statement_id = statement_id[0]
if not statement_id:
statement_id = statement_obj.create(cr,uid,{'date':time.strftime('%Y-%m-%d 00:00:00'),
'journal_id':data['form']['journal_id'],
'company_id':curr_company,
'user_id':uid,
})
args['statement_id'] = statement_id
args['journal_id'] = data['form']['journal_id']
if acc_id:
args['account_id'] = acc_id.id
args['amount'] = data['form']['amount'] or 0.0
args['ref'] = "%s" %(data['form']['ref'] or '')
args['name'] = "%s: %s "% (product_obj.browse(cr,uid,data['form']['product_id']).name, data['form']['name'].decode('utf8'))
address_u = pool.get('res.users').browse(cr,uid,uid).address_id
if address_u:
partner_id = address_u.partner_id and address_u.partner_id.id or None
args['partner_id'] = partner_id
statement_line_id = pool.get('account.bank.statement.line').create(cr, uid, args)
return {}
class box_entries(wizard.interface):
states = {
'init': {
'actions': [],
'result': {
'type': 'form',
'arch': entry_form % u'Entrée de caisse',
'fields': entry_fields,
'state': [('end', 'Cancel', 'gtk-cancel'), ('next', 'Make entries in the Cashbox', 'gtk-ok')]
}
},
'next': {
'actions': [],
'result': {
'type': 'action',
'action': _get_in,
'state': 'end'
}
},
}
box_entries('pos.entry')
class box_out(wizard.interface):
states = {
'init': {
'actions': [],
'result': {
'type': 'form',
'arch': entry_form % u'Sortie de caisse',
'fields': out_fields,
'state': [('end', 'Cancel', 'gtk-cancel'), ('next', 'Make Entries in the CashBox', 'gtk-ok')]
}
},
'next': {
'actions': [],
'result': {
'type': 'action',
'action': _get_out,
'state': 'end'
}
},
}
box_out('pos.out')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -82,9 +82,9 @@ class product_uom(osv.osv):
'name': fields.char('Name', size=64, required=True, translate=True),
'category_id': fields.many2one('product.uom.categ', 'UoM Category', required=True, ondelete='cascade',
help="Unit of Measure of a category can be converted between each others in the same category."),
'factor': fields.float('Rate', digits=(12, 6), required=True,
'factor': fields.float('Ratio', digits=(12, 6), required=True,
help='The coefficient for the formula:\n' \
'1 (base unit) = coeff (this unit). Rate = 1 / Factor.'),
'1 (base unit) = coeff (this unit). Ratio = 1 / Factor.'),
'factor_inv': fields.function(_factor, digits=(12, 6),
method=True, string='Factor',
help='The coefficient for the formula:\n' \
@ -93,6 +93,9 @@ class product_uom(osv.osv):
'rounding': fields.float('Rounding Precision', digits=(16, 3), required=True,
help="The computed quantity will be a multiple of this value. Use 1.0 for products that can not be split."),
'active': fields.boolean('Active', help="If the active field is set to true, it will allow you to hide the unit of measure without removing it."),
'uom_factor': fields.selection([('bigger','Bigger than the Default'),
('smaller','Smaller than the Default'),
('','')],'UoM Factor'),
}
_defaults = {
@ -100,6 +103,7 @@ class product_uom(osv.osv):
'factor_inv': lambda *a: 1.0,
'active': lambda *a: 1,
'rounding': lambda *a: 0.01,
'uom_factor': lambda *a: 'smaller',
}
_sql_constraints = [

View File

@ -21,25 +21,31 @@
<field name="category_id" ref="product_uom_categ_unit"/>
<field name="name">PCE</field>
<field name="factor">1.0</field>
<field name="factor_inv">1.0</field>
<field name="factor_inv_data">1.0</field>
</record>
<record id="product_uom_kgm" model="product.uom">
<field name="category_id" ref="product_uom_categ_kgm"/>
<field name="name">KGM</field>
<field name="factor">1.0</field>
<field name="factor_inv">1.0</field>
<field name="factor_inv_data">1.0</field>
</record>
<record id="uom_hour" model="product.uom">
<field name="name">Hour</field>
<field eval="uom_categ_wtime" name="category_id"/>
<field name="factor">8.0</field>
<field name="factor_inv">1.0</field>
<field name="factor_inv_data">1.0</field>
</record>
<record id="uom_day" model="product.uom">
<field name="name">Day</field>
<field eval="uom_categ_wtime" name="category_id"/>
<field name="factor">1.0</field>
<field name="factor_inv">1.0</field>
<field name="factor_inv_data">1.0</field>
</record>
<record id="product_uom_ton" model="product.uom">
<field name="category_id" ref="product_uom_categ_kgm"/>
<field name="name">TON</field>
<field name="factor">1.0</field>
<field name="factor_inv_data">1.0</field>
</record>
<!--

View File

@ -302,9 +302,11 @@
<form string="Units of Measure">
<field name="name" select="1"/>
<field name="category_id" select="1"/>
<field name="factor" select="1"/>
<field name="factor_inv" select="1"/>
<field name="factor" select="1" attrs="{'readonly':[('uom_factor','=','bigger')]}"/>
<field name="factor_inv_data" select="1" string="Factor Data" attrs="{'readonly':[('uom_factor','=','smaller')]}"/>
<field name="factor_inv" invisible="1"/>
<field name="rounding"/>
<field name="uom_factor"/>
<field name="active"/>
</form>
</field>

View File

@ -1,12 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<menuitem id="base.next_id_64" name="Reporting" parent="base.menu_base_partner" sequence="8"/>
<menuitem
action="product_margin_action"
id="menu_mrp_property_action"
parent="base.next_id_64" />
<record model="ir.ui.view" id="view_product_margin_graph">
<field name="name">product.margin.graph</field>

View File

@ -38,7 +38,7 @@ class product_margin(osv.osv_memory):
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: the account ID or list of IDs if we want more than one
@param ids: the ID or list of IDs if we want more than one
@return:
"""
@ -73,7 +73,7 @@ class product_margin(osv.osv_memory):
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: the account ID or list of IDs if we want more than one
@param ids: the ID or list of IDs if we want more than one
@return:
"""

View File

@ -18,14 +18,16 @@
</form>
</field>
</record>
<record id="product_margin_action" model="ir.actions.act_window">
<field name="name">Product Margine</field>
<field name="type">ir.actions.act_window</field>
<field name="target">new</field>
<field name="res_model">product.margin</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="product_margin_form_view"/>
</record>
<!--
<act_window name="Test Wizard"
res_model="product.margin"
src_model="product.product"
view_mode="form"
target="new"
key2="client_action_multi"
id="product_margin_act_window"/>
-->
</data>
</openerp>
</openerp>

View File

@ -1,14 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="1">
<!--
Resource: project.project
-->
<record id="base.main_company" model="res.company">
<field name="project_time_mode_id" ref="product.uom_hour"></field>
</record>
<!-- Task Types -->
<record id="project_tt_specification" model="project.task.type">
<field name="sequence">1</field>
@ -26,7 +26,7 @@
<field name="sequence">4</field>
<field name="name">Merge</field>
</record>
<!-- Projects -->
<record id="project_project_9" model="project.project">
<field name="warn_manager">1</field>
@ -39,7 +39,6 @@
<field name="priority">10</field>
<field name="parent_id" ref="project_project_9"/>
<field name="name">Study + Prototype</field>
<field model="account.analytic.account" name="category_id" search="[('name','=', 'Seagate P1')]"/>
<field name="manager" ref="base.user_root"/>
<field eval="[(6, 0, [ref('project_tt_specification'),ref('project_tt_development')])]" name="type_ids"/>
</record>
@ -47,7 +46,6 @@
<field name="priority">20</field>
<field name="parent_id" ref="project_project_9"/>
<field name="name">Specific Developements</field>
<field model="account.analytic.account" name="category_id" search="[('name','=', 'Seagate P1')]"/>
<field name="manager" ref="base.user_root"/>
<field eval="[(6, 0, [ref('project_tt_specification'), ref('project_tt_development')])]" name="type_ids"/>
</record>
@ -55,11 +53,10 @@
<field name="priority">30</field>
<field name="parent_id" ref="project_project_9"/>
<field name="name">Install, data import, configuration</field>
<field model="account.analytic.account" name="category_id" search="[('name','=', 'Seagate P1')]"/>
<field name="manager" ref="base.user_root"/>
<field eval="[(6, 0, [ref('project_tt_development')])]" name="type_ids"/>
</record>
<!-- Tasks -->
<record id="project_task_116" model="project.task">
<field name="planned_hours">38.0</field>

View File

@ -8,7 +8,10 @@ class project_issue_report(osv.osv):
_columns = {
'categ_id': fields.many2one('crm.case.categ', 'Category', domain="[('section_id','=',section_id),('object_id.model', '=', 'project.issue.report')]"),
'stage_id': fields.many2one ('crm.case.stage', 'Stage', domain="[('object_id.model', '=', 'project.issue.report')]"),
'nbr': fields.integer('# of Issues', reaadonly=True),
'probability': fields.float('Avg. Probability', readonly=True),
'amount_revenue': fields.float('Est.Revenue', readonly=True),
'amount_costs': fields.float('Est.Cost', readonly=True),
'amount_revenue_prob': fields.float('Est. Rev*Prob.', readonly=True),
'delay_close': fields.char('Delay to close', size=20, readonly=True),
}
def init(self, cr):
@ -25,6 +28,10 @@ class project_issue_report(osv.osv):
c.categ_id,
c.stage_id,
count(*) as nbr,
sum(planned_revenue) as amount_revenue,
sum(planned_cost) as amount_costs,
sum(planned_revenue*probability/100)::decimal(16,2) as amount_revenue_prob,
avg(probability)::decimal(16,2) as probability,
to_char(avg(date_closed-c.create_date), 'DD"d" HH24:MI:SS') as delay_close
from
project_issue c

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
#
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
@ -15,7 +15,7 @@
# 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/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
@ -29,12 +29,12 @@ class project_project(osv.osv):
_description = 'project.project'
def write(self, cr, uid, ids,vals, *args, **kwargs):
if 'date_end' in vals and vals['date_end']:
if 'date' in vals and vals['date']:
data_project = self.browse(cr,uid,ids)
for prj in data_project:
c= date(*time.strptime(vals['date_end'],'%Y-%m-%d')[:3])
if prj.date_end:
d= date(*time.strptime(prj.date_end,'%Y-%m-%d')[:3])
c= date(*time.strptime(vals['date'],'%Y-%m-%d')[:3])
if prj.date:
d= date(*time.strptime(prj.date,'%Y-%m-%d')[:3])
for task in prj.tasks:
start_dt = (datetime(*time.strptime(task.date_start,'%Y-%m-%d %H:%M:%S')[:6])+(c-d)).strftime('%Y-%m-%d %H:%M:%S')
if task.date_deadline:
@ -42,7 +42,7 @@ class project_project(osv.osv):
self.pool.get('project.task').write(cr,uid,task.id,{'date_start':start_dt, 'date_deadline':deadline_dt})
else:
self.pool.get('project.task').write(cr,uid,task.id,{'date_start':start_dt})
return super(project_project,self).write(cr, uid, ids,vals, *args, **kwargs)
return super(project_project,self).write(cr, uid, ids, vals, *args, **kwargs)
project_project()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -394,7 +394,9 @@ class purchase_order(osv.osv):
istate = 'none'
if order.invoice_method=='picking':
istate = '2binvoiced'
pick_name = self.pool.get('ir.sequence').get(cr, uid, 'stock.picking.in')
picking_id = self.pool.get('stock.picking').create(cr, uid, {
'name': pick_name,
'origin': order.name+((order.origin and (':'+order.origin)) or ''),
'type': 'in',
'address_id': order.dest_address_id.id or order.partner_address_id.id,

View File

@ -593,7 +593,9 @@ class sale_order(osv.osv):
location_id = order.shop_id.warehouse_id.lot_stock_id.id
if not picking_id:
loc_dest_id = order.partner_id.property_stock_customer.id
pick_name = self.pool.get('ir.sequence').get(cr, uid, 'stock.picking.out')
picking_id = self.pool.get('stock.picking').create(cr, uid, {
'name': pick_name,
'origin': order.name,
'type': 'out',
'state': 'auto',

View File

@ -21,3 +21,10 @@
"access_sale_order_line_manager","sale.order.line.manager","model_sale_order_line","group_sale_manager",1,1,1,1
"access_sale_report","sale.report","model_sale_report","group_sale_user",1,1,1,0
"access_sale_report_manager","sale.report","model_sale_report","group_sale_manager",1,1,1,1
"access_sale_order_line_make_invoice","sale.order.line.make.invoice","model_sale_order_line_make_invoice","group_sale_user",1,1,1,0
"access_sale_order_line_make_invoice_manager","sale.order.line.make.invoice","model_sale_order_line_make_invoice","group_sale_manager",1,1,1,1
"access_sale_advance_payment_inv","sale.advance.payment.inv","model_sale_advance_payment_inv","group_sale_user",1,1,1,0
"access_sale_advance_payment_inv_manager","sale.advance.payment.inv","model_sale_advance_payment_inv","group_sale_manager",1,1,1,1
"access_sale_open_invoice","sale.open.invoice","model_sale_open_invoice","group_sale_user",1,1,1,0
"access_sale_open_invoice_manager","sale.open.invoice","model_sale_open_invoice","group_sale_manager",1,1,1,1

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
21 access_sale_order_line_manager sale.order.line.manager model_sale_order_line group_sale_manager 1 1 1 1
22 access_sale_report sale.report model_sale_report group_sale_user 1 1 1 0
23 access_sale_report_manager sale.report model_sale_report group_sale_manager 1 1 1 1
24 access_sale_order_line_make_invoice sale.order.line.make.invoice model_sale_order_line_make_invoice group_sale_user 1 1 1 0
25 access_sale_order_line_make_invoice_manager sale.order.line.make.invoice model_sale_order_line_make_invoice group_sale_manager 1 1 1 1
26 access_sale_advance_payment_inv sale.advance.payment.inv model_sale_advance_payment_inv group_sale_user 1 1 1 0
27 access_sale_advance_payment_inv_manager sale.advance.payment.inv model_sale_advance_payment_inv group_sale_manager 1 1 1 1
28 access_sale_open_invoice sale.open.invoice model_sale_open_invoice group_sale_user 1 1 1 0
29 access_sale_open_invoice_manager sale.open.invoice model_sale_open_invoice group_sale_manager 1 1 1 1
30

View File

@ -36,12 +36,34 @@ class sale_order_line_make_invoice(osv.osv_memory):
'grouped' : lambda *a: False
}
def makeInvoices(self, cr, uid, ids, context):
def make_invoices(self, cr, uid, ids, context):
"""
@summary: To make invoices.
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param ids: the ID or list of IDs
@param context: A standard dictionary
@return: A dictionary which of fields with values.
"""
res = False
invoices = {}
#TODO: merge with sale.py/make_invoice
def make_invoice(order, lines):
"""
@summary: To make invoices.
@param order:
@param lines:
@return:
"""
a = order.partner_id.property_account_receivable.id
if order.partner_id and order.partner_id.property_payment_term.id:
pay_term = order.partner_id.property_payment_term.id
@ -65,26 +87,28 @@ class sale_order_line_make_invoice(osv.osv_memory):
inv_id = self.pool.get('account.invoice').create(cr, uid, inv)
return inv_id
for line in self.pool.get('sale.order.line').browse(cr,uid,context['active_ids']):
sales_order_line_obj = self.pool.get('sale.order.line')
sales_order_obj = self.pool.get('sale.order')
wf_service = netsvc.LocalService('workflow')
for line in sales_order_line_obj.browse(cr,uid,context['active_ids']):
if (not line.invoiced) and (line.state not in ('draft','cancel')):
if not line.order_id.id in invoices:
invoices[line.order_id.id] = []
line_id = self.pool.get('sale.order.line').invoice_line_create(cr, uid,
line_id = sales_order_line_obj.invoice_line_create(cr, uid,
[line.id])
for lid in line_id:
invoices[line.order_id.id].append((line, lid))
self.pool.get('sale.order.line').write(cr, uid, [line.id],
sales_order_line_obj.write(cr, uid, [line.id],
{'invoiced': True})
flag = True
data_sale = self.pool.get('sale.order').browse(cr,uid,line.order_id.id)
data_sale = sales_order_obj.browse(cr,uid,line.order_id.id)
for line in data_sale.order_line:
if not line.invoiced:
flag = False
break
if flag:
wf_service = netsvc.LocalService('workflow')
wf_service.trg_validate(uid, 'sale.order', line.order_id.id, 'all_lines', cr)
self.pool.get('sale.order').write(cr,uid,[line.order_id.id],{'state' : 'progress'})
sales_order_obj.write(cr,uid,[line.order_id.id],{'state' : 'progress'})
for result in invoices.values():
order = result[0][0].order_id

View File

@ -38,10 +38,24 @@ class sale_advance_payment_inv(osv.osv_memory):
_default = {
'qtty' : lambda *a: 1
}
def createInvoices(self, cr, uid, ids, context={}):
def create_invoices(self, cr, uid, ids, context={}):
"""
@summary: To create invoices.
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param ids: the ID or list of IDs if we want more than one
@param context: A standard dictionary
@return:
"""
list_inv = []
obj_sale = self.pool.get('sale.order')
obj_lines = self.pool.get('account.invoice.line')
inv_obj = self.pool.get('account.invoice')
for sale_adv_obj in self.browse(cr, uid, ids):
for sale in obj_sale.browse(cr, uid, context['active_ids']):
address_contact = False
@ -83,7 +97,7 @@ class sale_advance_payment_inv(osv.osv_memory):
'payment_term':sale.payment_term.id,
'fiscal_position': sale.partner_id.property_account_position.id
}
inv_obj = self.pool.get('account.invoice')
inv_id = inv_obj.create(cr, uid, inv)
for inv in sale.invoice_ids:
@ -128,15 +142,27 @@ class sale_open_invoice(osv.osv_memory):
}
def open_invoice(self, cr, uid, ids, context):
"""
@summary: To open invoice.
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param ids: the ID or list of IDs if we want more than one
@param context: A standard dictionary
@return:
"""
mod_obj = self.pool.get('ir.model.data')
invoices = []
#TODO: Can not get invoice ids here
for advance_pay in self.browse(cr, uid, ids):
result = mod_obj._get_id(cr, uid, 'account', 'view_account_invoice_filter')
id = mod_obj.read(cr, uid, result, ['res_id'])
model_data_ids = self.pool.get('ir.model.data').search(cr, uid,
model_data_ids = mod_obj.search(cr, uid,
[('model', '=', 'ir.ui.view'), ('name', '=', 'invoice_form')])
resource_id = self.pool.get('ir.model.data').read(cr, uid, model_data_ids,
resource_id = mod_obj.read(cr, uid, model_data_ids,
fields=['res_id'])[0]['res_id']
return {
# 'domain': "[('id','in', ["+','.join(map(str, invoices))+"])]", # TODO

View File

@ -28,4 +28,9 @@
"access_stock_move_consume","stock.move.consume","model_stock_move_consume","stock.group_stock_user",1,0,0,0
"access_stock_move_scrap","stock.move.scrap","model_stock_move_scrap","stock.group_stock_user",1,0,0,0
"access_stock_move_split","stock.move.split","model_stock_move_split","stock.group_stock_user",1,0,0,0
"access_stock_move_split_lines","stock.move.split.lines","model_stock_move_split_lines","stock.group_stock_user",1,0,0,0
"access_stock_move_split_lines","stock.move.split.lines","model_stock_move_split_lines","stock.group_stock_user",1,0,0,0
"access_stock_inventory_set_stock_zero","stock.inventory.set.stock.zero","model_stock_inventory_set_stock_zero","stock.group_stock_user",1,0,0,0
"access_stock_fill_inventory","stock.fill.inventory","model_stock_fill_inventory","stock.group_stock_user",1,0,0,0
"access_stock_inventory_line_split","stock.inventory.line.split","model_stock_inventory_line_split","stock.group_stock_user",1,0,0,0
"access_stock_invoice_onshipping","stock.invoice.onshipping","model_stock_invoice_onshipping","stock.group_stock_user",1,0,0,0
"access_stock_location_product","stock.location.product","model_stock_location_product","stock.group_stock_user",1,0,0,0

Can't render this file because it contains an unexpected character in line 25 and column 121.

View File

@ -1474,7 +1474,7 @@ class stock_move(osv.osv):
ir_sequence_obj = self.pool.get('ir.sequence')
sequence = ir_sequence_obj.get(cr, uid, 'stock.lot.serial')
if not sequence:
raise wizard.except_wizard(_('Error!'), _('No production sequence defined'))
raise osv.except_osv(_('Error!'), _('No production sequence defined'))
prodlot_id = prodlot_obj.create(cr, uid, {'name': sequence, 'prefix': prefix}, {'product_id': product_id})
prodlot = prodlot_obj.browse(cr, uid, prodlot_id)
ref = ','.join(map(lambda x:str(x),ids))
@ -1713,8 +1713,10 @@ class stock_inventory_line(osv.osv):
'product_uom': fields.many2one('product.uom', 'Product UOM', required=True),
'product_qty': fields.float('Quantity'),
'company_id': fields.related('inventory_id','company_id',type='many2one',relation='res.company',string='Company',store=True),
'prod_lot_id': fields.many2one('stock.production.lot', 'Production Lot', domain="[('product_id','=',product_id)]")
'prod_lot_id': fields.many2one('stock.production.lot', 'Production Lot', domain="[('product_id','=',product_id)]"),
'state': fields.related('inventory_id','state',type='char',string='State',readonly=True),
}
def on_change_product_id(self, cr, uid, ids, location_id, product, uom=False):
if not product:
return {}

View File

@ -2,18 +2,47 @@
<openerp>
<data noupdate="1">
<!--
Sequences for pickings
Sequence types for pickings
-->
<record id="seq_type_picking" model="ir.sequence.type">
<field name="name">Picking</field>
<field name="code">stock.picking</field>
<record id="seq_type_picking_in" model="ir.sequence.type">
<field name="name">Picking IN</field>
<field name="code">stock.picking.in</field>
</record>
<record id="seq_type_picking_out" model="ir.sequence.type">
<field name="name">Picking OUT</field>
<field name="code">stock.picking.out</field>
</record>
<record id="seq_type_picking_internal" model="ir.sequence.type">
<field name="name">Picking INT</field>
<field name="code">stock.picking.internal</field>
</record>
<record id="seq_picking" model="ir.sequence">
<field name="name">Picking</field>
<field name="code">stock.picking</field>
<field name="prefix">PACK</field>
<!--
Sequences for pickings
-->
<record id="seq_picking_in" model="ir.sequence">
<field name="name">Picking IN</field>
<field name="code">stock.picking.in</field>
<field name="prefix">IN/</field>
<field name="padding">5</field>
</record>
<record id="seq_picking_out" model="ir.sequence">
<field name="name">Picking OUT</field>
<field name="code">stock.picking.out</field>
<field name="prefix">OUT/</field>
<field name="padding">5</field>
</record>
<record id="seq_picking_internal" model="ir.sequence">
<field name="name">Picking INT</field>
<field name="code">stock.picking.internal</field>
<field name="prefix">INT/</field>
<field name="padding">5</field>
</record>
<!--

View File

@ -18,7 +18,11 @@
<field name="product_qty"/>
<field name="product_uom"/>
<field name="prod_lot_id"/>
<button name="%(stock.action_view_stock_inventory_line_split)d"
string="Split inventory lines"
type="action" icon="gtk-justify-fill"/>
<field name="location_id"/>
</tree>
</field>
</record>
@ -87,6 +91,10 @@
<field name="product_uom"/>
<field name="prod_lot_id"/>
<field colspan="4" domain="[('usage','=','internal')]" name="location_id" select="1"/>
<field name="state" invisible="1"/>
<button name="%(stock.action_view_stock_inventory_line_split)d"
string="Split inventory lines"
type="action" icon="gtk-justify-fill" states="draft"/>
</tree>
<form string="Inventory Lines">
<field colspan="4" context="location=location_id,uom=product_uom" name="product_id" on_change="on_change_product_id(location_id,product_id,product_uom)" select="1" domain="[('type','&lt;&gt;','service')]"/>
@ -581,7 +589,19 @@
<field name="min_date" select="1"/>
<field name="type"/>
<field name="company_id" select="1" groups="base.group_multi_company" widget="selection"/>
</group>
<button name="%(make_picking)d"
states="confirmed,assigned"
string="Make Picking"
type="action"
icon="gtk-go-forward"
help="Make Picking" colspan="2"/>
<button name="%(return_picking)d"
states="done"
string="Return Picking"
type="action"
icon="gtk-go-back"
help="Return Picking" colspan="2"/>
</group>
<notebook colspan="4">
<page string="General Information">
<field colspan="4" name="move_lines" nolabel="1" widget="one2many_list" default_get="{'move_line':move_lines, 'address_out_id': address_id}">
@ -737,8 +757,19 @@
<field name="min_date" select="1"/>
<field name="type"/>
<field name="company_id" select="1" groups="base.group_multi_company" widget="selection"/>
</group>
<button name="%(make_picking)d"
states="assigned"
string="Make Picking"
type="action"
icon="gtk-go-forward"
help="Make Picking" colspan="2"/>
<button name="%(return_picking)d"
states="done"
string="Return Picking"
type="action"
icon="gtk-go-back"
help="Return Picking" colspan="2"/>
</group>
<notebook colspan="4">
<page string="General Information">
<field colspan="4" name="move_lines" nolabel="1" widget="one2many_list" default_get="{'move_line':move_lines, 'address_out_id': address_id}">
@ -921,7 +952,19 @@
<field name="backorder_id" select="2" readonly="1"/>
<field name="origin" select="2" readonly="1"/>
<field name="company_id" select="1" groups="base.group_multi_company" widget="selection"/>
</group>
<button name="%(make_picking)d"
states="assigned"
string="Make Picking"
type="action"
icon="gtk-go-forward"
help="Make Picking" colspan="2"/>
<button name="%(return_picking)d"
states="done"
string="Return Picking"
type="action"
icon="gtk-go-back"
help="Return Picking" colspan="2"/>
</group>
<notebook colspan="4">
<page string="General Information">
<field colspan="4" name="move_lines" nolabel="1" widget="one2many_list" default_get="{'move_line':move_lines, 'address_out_id': address_id}">
@ -1101,7 +1144,19 @@
<field name="invoice_state" select="2" string="Invoice Control"/>
<field name="type"/>
<field name="company_id" select="1" groups="base.group_multi_company" widget="selection"/>
</group>
<button name="%(make_picking)d"
states="confirmed,assigned"
string="Make Picking"
type="action"
icon="gtk-go-forward"
help="Make Picking" colspan="2"/>
<button name="%(return_picking)d"
states="done"
string="Return Picking"
type="action"
icon="gtk-go-back"
help="Return Picking" colspan="2"/>
</group>
<notebook colspan="4">
<page string="General Information">
<field colspan="4" name="move_lines" nolabel="1" widget="one2many_list" default_get="{'move_line':move_lines, 'address_in_id': address_id}">

View File

@ -17,10 +17,27 @@
<wizard
id="partial_picking"
model="stock.picking"
multi="True"
menu="False"
keyword="client_action_multi"
name="stock.partial_picking"
string="Partial picking"/>
<wizard
id="make_picking"
model="stock.picking"
menu="False"
keyword="client_action_multi"
name="stock.picking.make"
string="Make Picking"/>
<wizard
id="return_picking"
model="stock.picking"
menu="False"
keyword="client_action_multi"
name="stock.return.picking"
string="Return picking"/>
<wizard
id="partial_move"
model="stock.move"
@ -35,14 +52,6 @@
name="stock.inventory.line.split"
string="Split inventory lines"/>
<wizard id="make_picking" model="stock.picking" multi="True" name="stock.picking.make" string="Make picking"/>
<wizard
id="return_picking"
model="stock.picking"
name="stock.return.picking"
string="Return picking"/>
<wizard
string="Merge inventories"
model="stock.inventory"

View File

@ -38,8 +38,22 @@ class stock_fill_inventory(osv.osv_memory):
}
def fill_inventory(self, cr, uid, ids, context):
"""
@summary: To fill stock inventory according to products available in the selected locations..
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param ids: the ID or list of IDs if we want more than one
@param context: A standard dictionary
@return:
"""
inventory_line_obj = self.pool.get('stock.inventory.line')
location_obj = self.pool.get('stock.location')
product_obj = self.pool.get('product.product')
stock_location_obj = self.pool.get('stock.location')
for fill_inventory in self.browse(cr, uid, ids):
res = {}
res_location = {}
@ -59,10 +73,10 @@ class stock_fill_inventory(osv.osv_memory):
for location in res_location.keys():
res = res_location[location]
for product_id in res.keys():
prod = self.pool.get('product.product').browse(cr, uid, [product_id])[0]
prod = product_obj.browse(cr, uid, [product_id])[0]
uom = prod.uom_id.id
context.update({'uom': uom})
amount = self.pool.get('stock.location')._product_get(cr, uid,
amount = stock_location_obj._product_get(cr, uid,
location, [product_id], context=context)[product_id]
if(amount):

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