# -*- coding: utf-8 -*-
##############################################################################
-#
+#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# 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/>.
#
##############################################################################
-import netsvc
-from osv import osv,fields
+from osv import osv, fields
from tools.translate import _
+
class add_product(osv.osv_memory):
_name = 'pos.add.product'
_description = 'Add Product'
_columns = {
- 'product_id': fields.many2one('product.product', 'Product',required=True),
- 'quantity': fields.float('Quantity ', required=True),
+ 'product_id': fields.many2one('product.product', 'Product', required=True),
+ 'quantity': fields.float('Quantity ', required=True),
}
_defaults = {
- 'quantity': lambda *a: 1,
- }
-
+ 'quantity': lambda *a: 1,
+ }
+
def select_product(self, cr, uid, ids, context):
- """
- To get the product and quantity and add in order .
+ """
+ To get the product and quantity and add in 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 : Retrun the add product form again for adding more product
- """
+ @param context: A standard dictionary
+ @return : Return 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)
+ record_id = context and context.get('active_id', False)
assert record_id, _('Active ID is not found')
if record_id:
- order_obj = self.pool.get('pos.order')
- order_obj.add_product(cr, uid, record_id, this.product_id.id,this.quantity,context=context)
-
- return {
- 'name': _('Add Product'),
- 'view_type': 'form',
- 'view_mode': 'form',
- 'res_model': 'pos.add.product',
- 'view_id': False,
- 'target':'new',
- 'views': False,
- 'type': 'ir.actions.act_window',
- }
+ order_obj = self.pool.get('pos.order')
+ order_obj.add_product(cr, uid, record_id, this.product_id.id, this.quantity, context=context)
+
+ return {
+ 'name': _('Add Product'),
+ 'view_type': 'form',
+ 'view_mode': 'form',
+ 'res_model': 'pos.add.product',
+ 'view_id': False,
+ 'target': 'new',
+ 'views': False,
+ 'type': 'ir.actions.act_window',
+ }
+
add_product()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# -*- coding: utf-8 -*-
##############################################################################
-#
+#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# 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/>.
#
##############################################################################
-import netsvc
-from osv import osv,fields
-from tools.translate import _
-from tools.misc import UpdateableStr
-from mx import DateTime
-from tools.translate import _
+from osv import osv, fields
import time
+from tools.translate import _
+
-def get_journal(self,cr,uid,context):
- """
- Make the selection list of Cash Journal .
+def get_journal(self, cr, uid, context):
+ """
+ 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
- """
-
+ @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.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):
-
- """
- Make the selection list of purchasing products.
+
+ def _get_income_product(self, cr, uid, context):
+
+ """
+ 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
- """
+ @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),
+ '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):
-
- """
- Create the entry of statement in journal .
+ def get_in(self, cr, uid, ids, context):
+ """
+ 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
- """
+ @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')
+ 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')])
+ 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
+
+ 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))
+ 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,
+ 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']
+ args['journal_id'] = data['journal_id']
if acc_id:
- args['account_id'] = acc_id.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
+ 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)
-
+ statement_line_id = bank_statement.create(cr, uid, args)
+
return {}
-pos_box_entries()
+
+pos_box_entries()
+
# -*- coding: utf-8 -*-
##############################################################################
-#
+#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# 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/>.
#
##############################################################################
-import netsvc
-from osv import osv,fields
+from osv import osv, fields
+import time
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):
-
- """
- Make the selection list of expense product.
+
+ def _get_expense_product(self, cr, uid, context):
+
+ """
+ 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
- """
+ @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
-
+ 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),
+ '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):
-
- """
- Create the entries in the CashBox .
+
+ """
+ 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
- """
+ @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')
+ 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
+ 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
+
+ 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
+ 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
+
+ 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))
+ 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'))
+ 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,
+ 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']
+ 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
+ args['account_id'] = acc_id.id
+ amount = data['amount'] or 0.0
if data['amount'] > 0:
- amount= -data['amount']
+ amount = -data['amount']
args['amount'] = amount
- if productp_obj.browse(cr,uid,data['product_id']).am_out:
+ 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
+ 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()
\ No newline at end of file
+pos_box_out()
+
# -*- coding: utf-8 -*-
##############################################################################
-#
+#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# 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/>.
#
##############################################################################
-import netsvc
-from osv import osv,fields
+from osv import osv
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):
- """
- Close the statements
+ """
+ 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
+ @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)
+ 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)
+ 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:
\ No newline at end of file
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
# -*- coding: utf-8 -*-
##############################################################################
-#
+#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# 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/>.
#
##############################################################################
import netsvc
-from osv import osv,fields
+from osv import osv
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):
- """
- Confirm the order and close the sales .
+ """
+ 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
+ @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)
+ """
+
+ record_id = context and context.get('active_id', False)
if record_id:
if isinstance(record_id, (int, long)):
- record_id=[record_id]
+ 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})
+ 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:
# -*- coding: utf-8 -*-
##############################################################################
-#
+#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# 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/>.
#
##############################################################################
-import netsvc
-from osv import osv,fields
+from osv import osv, fields
from tools.translate import _
-from mx import DateTime
import time
+
class pos_details(osv.osv_memory):
_name = 'pos.details'
_description = 'Sales Details'
_columns = {
- 'date_start': fields.date('Date Start',required=True),
- 'date_end': fields.date('Date End',required=True)
+ 'date_start': fields.date('Date Start', required=True),
+ 'date_end': fields.date('Date End', required=True)
}
_defaults = {
- 'date_start': lambda *a: time.strftime('%Y-%m-%d'),
- 'date_end': lambda *a: time.strftime('%Y-%m-%d'),
- }
+ 'date_start': lambda *a: time.strftime('%Y-%m-%d'),
+ 'date_end': lambda *a: time.strftime('%Y-%m-%d'),
+ }
+
def print_report(self, cr, uid, ids, context={}):
- """
- To get the date and print the report
+ """
+ To get the date and print the report
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
- @param context: A standard dictionary
+ @param context: A standard dictionary
@return : retrun report
"""
-
- datas = {'ids' : context.get('active_ids', [])}
- res = self.read(cr, uid, ids, ['date_start','date_end'], context)
- res = res and res[0] or {}
+
+ datas = {'ids': context.get('active_ids', [])}
+ res = self.read(cr, uid, ids, ['date_start', 'date_end'], context)
+ res = res and res[0] or {}
datas['form'] = res
-
- return {
- 'type':'ir.actions.report.xml',
- 'report_name':'pos.details',
- 'datas':datas,
+
+ return {
+ 'type': 'ir.actions.report.xml',
+ 'report_name': 'pos.details',
+ 'datas': datas,
}
+
pos_details()
+
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# -*- coding: utf-8 -*-
##############################################################################
-#
+#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# 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/>.
#
##############################################################################
-import netsvc
-from osv import osv,fields
+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),
+ 'discount_notes': fields.char('Discount Notes', size= 128, required=True),
}
_defaults = {
'discount': lambda *a: 5,
}
-
+
def apply_discount(self, cr, uid, ids, context):
- """
+ """
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
+ @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)
if isinstance(record_id, (int, long)):
- record_id=[record_id]
-
+ record_id = [record_id]
+
order_ref = self.pool.get('pos.order')
- order_line_ref =self.pool.get('pos.order.line')
-
+ 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 :
+
+ 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:
+ elif company_discount >= applied_discount:
notice = 'Minimum Discount'
else:
notice = this.discount_notes
-
+
res_new = {
}
-
+
if this.discount <= company_discount:
res_new = {
'discount': this.discount,
res_new = {
'discount': this.discount,
'notice': notice,
- 'price_ded': line.price_unit * line.qty * (this.discount or 0) * 0.01 or 0.0
+ 'price_ded': line.price_unit * line.qty * (this.discount or 0) * 0.01 or 0.0
}
-
+
order_line_ref.write(cr, uid, [line.id], res_new, context=context)
return {}
# def check_discount(self, cr, uid, record_id, discount, context):
-# """
-# Check the discount of define by company .
+# """
+# 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
+# @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 :
# if prod_disc <= company_disc :
# return 'apply_discount'
# else :
-# return 'disc_discount'
+# return 'disc_discount'
+
pos_discount()
+
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# -*- coding: utf-8 -*-
##############################################################################
-#
+#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# 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/>.
#
##############################################################################
-import netsvc
-from osv import osv,fields
+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),
+ '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):
- """
- Select the picking order and add the in Point of sale order
+ """
+ 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
+ @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)
-
+ 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')
-
+ proxy_order_line = self.pool.get('pos.order.line')
+
if record_id:
- order=proxy_pos.browse(cr, uid, record_id, context)
-
+ 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"))
-
+ 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,
+ '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,
'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:
\ No newline at end of file
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
# -*- coding: utf-8 -*-
##############################################################################
-#
+#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# 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/>.
#
##############################################################################
-import netsvc
-from osv import osv,fields
+from osv import osv
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):
- """
- Open the statements
+ """
+ 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')
+ @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)
+ 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)])
+ 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) ))
+ 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
+ order by id desc limit 1""" % (journal.id, company_id)
cr.execute(sql)
st_id = cr.fetchone()
- number=''
- sequence_obj=self.pool.get('ir.sequence')
+ 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')))
+ 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]
+ 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])
+ 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'})
+ 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,
- })
+ 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:
\ No newline at end of file
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
# -*- coding: utf-8 -*-
##############################################################################
-#
+#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# 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/>.
#
##############################################################################
import netsvc
-from osv import osv,fields
+from osv import osv, fields
from tools.translate import _
import pos_box_entries
import time
-from decimal import Decimal
-from tools.translate import _
-import pos_receipt
+
class pos_make_payment(osv.osv_memory):
_name = 'pos.make.payment'
_description = 'Point of Sale Payment'
-
- def default_get(self, cr, uid, fields, context):
- """
+
+ def default_get(self, cr, uid, fields, context=None):
+ """
To get default values for the object.
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
- @param fields: List of fields for which we want default values
- @param context: A standard dictionary
- @return: A dictionary which of fields with values.
+ @param fields: List of fields for which we want default values
+ @param context: A standard dictionary
+ @return: A dictionary which of fields with values.
"""
+ if context is None:
+ context = {}
+
res = super(pos_make_payment, self).default_get(cr, uid, fields, context=context)
- record_id = context and context.get('active_id',False)
+ record_id = context and context.get('active_id', False)
j_obj = self.pool.get('account.journal')
- company_id = self.pool.get('res.users').browse(cr,uid,uid).company_id.id
+ company_id = self.pool.get('res.users').browse(cr, uid, uid).company_id.id
journal = j_obj.search(cr, uid, [('type', '=', 'cash'), ('company_id', '=', company_id)])
if journal:
journal = journal[0]
else:
journal = None
- wf_service = netsvc.LocalService("workflow")
-
order = self.pool.get('pos.order').browse(cr, uid, record_id, context)
#get amount to pay
amount = order.amount_total - order.amount_paid
-
- if amount<=0.0:
- context.update({'flag':True})
- self.pool.get('pos.order').action_paid(cr,uid,[record_id],context)
+
+ if amount <= 0.0:
+ context.update({'flag': True})
+ self.pool.get('pos.order').action_paid(cr, uid, [record_id], context)
elif order.amount_paid > 0.0:
- self.pool.get('pos.order').write(cr, uid, [record_id],{'state':'advance'})
-
+ self.pool.get('pos.order').write(cr, uid, [record_id], {'state': 'advance'})
+
invoice_wanted_checked = False
-
+
current_date = time.strftime('%Y-%m-%d')
-
+
if 'journal' in fields:
- res.update({'journal':journal})
+ res.update({'journal': journal})
if 'amount' in fields:
- res.update({'amount':amount})
+ res.update({'amount': amount})
if 'invoice_wanted' in fields:
- res.update({'invoice_wanted':invoice_wanted_checked})
+ res.update({'invoice_wanted': invoice_wanted_checked})
if 'payment_date' in fields:
- res.update({'payment_date':current_date})
- if 'payment_name' in fields:
- res.update({'payment_name':'Payment'})
+ res.update({'payment_date': current_date})
+ if 'payment_name' in fields:
+ res.update({'payment_name': 'Payment'})
return res
+
def view_init(self, cr, uid, fields_list, context=None):
res = super(pos_make_payment, self).view_init(cr, uid, fields_list, context=context)
- record_id = context and context.get('active_id', False) or False
+ record_id = context and context.get('active_id', False) or False
order = self.pool.get('pos.order').browse(cr, uid, record_id)
if not order.lines:
- raise osv.except_osv('Error!','No Order Lines ')
+ raise osv.except_osv('Error!', 'No Order Lines ')
True
-
+
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
- """
+ """
Changes the view dynamically
-
+
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
- @param context: A standard dictionary
-
+ @param context: A standard dictionary
+
@return: New arch of view.
-
+
"""
- record_id = context and context.get('record_id', False) or False
- res = super(pos_make_payment, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar,submenu=False)
-
+ record_id = context and context.get('record_id', False) or False
+ res = super(pos_make_payment, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=False)
+
if record_id:
order = self.pool.get('pos.order').browse(cr, uid, record_id)
amount = order.amount_total - order.amount_paid
- if amount==0.0:
+ if amount == 0.0:
res['arch'] = """ <form string="Make Payment" colspan="4">
<group col="2" colspan="2">
<label string="Do you want to print the Receipt?" colspan="4"/>
<button icon="gtk-cancel" special="cancel" string="No" readonly="0"/>
<button name="print_report" string="Print Receipt" type="object" icon="gtk-ok"/>
</group>
- </form>
+ </form>
"""
return res
def check(self, cr, uid, ids, context=None):
-
+
"""Check the order:
if the order is not paid: continue payment,
if the order is paid print invoice (if wanted) or ticket.
"""
- record_id = context and context.get('active_id',False)
+ record_id = context and context.get('active_id', False)
order_obj = self.pool.get('pos.order')
- jrnl_obj = self.pool.get('account.journal')
+ jrnl_obj = self.pool.get('account.journal')
order = order_obj.browse(cr, uid, record_id, context)
amount = order.amount_total - order.amount_paid
- data = self.read(cr, uid, ids)[0]
-
+ data = self.read(cr, uid, ids)[0]
+
# Todo need to check ...
- if amount !=0.0:
+ if amount != 0.0:
invoice_wanted = data['invoice_wanted']
- jrnl_used=False
- if data.get('journal',False):
- jrnl_used=jrnl_obj.browse(cr,uid,data['journal'])
order_obj.write(cr, uid, [record_id], {'invoice_wanted': invoice_wanted})
- order_obj.add_payment(cr, uid, record_id, data, context=context)
-
- if amount<=0.0:
- context.update({'flag':True})
- order_obj.action_paid(cr,uid,[record_id],context)
+ order_obj.add_payment(cr, uid, record_id, data, context=context)
+
+ if amount <= 0.0:
+ context.update({'flag': True})
+ order_obj.action_paid(cr, uid, [record_id], context)
if order_obj.test_paid(cr, uid, [record_id]):
if order.partner_id and order.invoice_wanted:
- return self.create_invoice(cr,uid,ids,context)
+ return self.create_invoice(cr, uid, ids, context)
else:
- return self.print_report(cr, uid, ids, context)
+ return self.print_report(cr, uid, ids, context)
return {}
-
def create_invoice(self, cr, uid, ids, context):
wf_service = netsvc.LocalService("workflow")
- record_ids = context and context.get('active_ids',False)
+ record_ids = context and context.get('active_ids', False)
for i in record_ids:
wf_service.trg_validate(uid, 'pos.order', i, 'invoice', cr)
- datas = {'ids' : context.get('active_ids', [])}
- return {
- 'type' : 'ir.actions.report.xml',
- 'report_name':'pos.invoice',
- 'datas' : datas,
- }
-
+ datas = {'ids': context.get('active_ids', [])}
+ return {
+ 'type': 'ir.actions.report.xml',
+ 'report_name': 'pos.invoice',
+ 'datas': datas,
+ }
+
def print_report(self, cr, uid, ids, context=None):
- if not context:
- context={}
- """
- @summary: To get the date and print the report
+ """
+ @summary: To get the date and print the report
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
- @param context: A standard dictionary
+ @param context: A standard dictionary
@return : retrun report
- """
- datas = {'ids' : context.get('active_ids',[])}
- res = {}
+ """
+ if context is None:
+ context = {}
+
+ datas = {'ids': context.get('active_ids', [])}
+ res = {}
datas['form'] = res
- return {
- 'type' : 'ir.actions.report.xml',
- 'report_name':'pos.receipt',
- 'datas' : datas,
- }
-
+ return {
+ 'type': 'ir.actions.report.xml',
+ 'report_name': 'pos.receipt',
+ 'datas': datas,
+ }
+
def trigger_wkf(self, cr, uid, data, context):
- record_id = context and context.get('active_id',False)
+ record_id = context and context.get('active_id', False)
wf_service = netsvc.LocalService("workflow")
wf_service.trg_validate(uid, 'pos.order', record_id, 'payment', cr)
return {}
-
+
_columns = {
- 'journal':fields.selection(pos_box_entries.get_journal, "Journal",required=True),
- 'product_id': fields.many2one('product.product', "Acompte"),
- 'amount':fields.float('Amount', digits=(16,2) ,required= True),
- 'payment_name': fields.char('Payment name', size=32, required=True),
- 'payment_date': fields.date('Payment date', required=True),
- 'is_acc': fields.boolean('Accompte'),
- 'invoice_wanted': fields.boolean('Invoice'),
- 'num_sale':fields.char('Num.File', size=32),
- }
-
+ 'journal': fields.selection(pos_box_entries.get_journal, "Journal", required=True),
+ 'product_id': fields.many2one('product.product', "Acompte"),
+ 'amount': fields.float('Amount', digits=(16, 2), required= True),
+ 'payment_name': fields.char('Payment name', size=32, required=True),
+ 'payment_date': fields.date('Payment date', required=True),
+ 'is_acc': fields.boolean('Accompte'),
+ 'invoice_wanted': fields.boolean('Invoice'),
+ 'num_sale': fields.char('Num.File', size=32),
+ }
+
pos_make_payment()
+
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
#
##############################################################################
-import pooler
-import netsvc
-import wizard
-import time# -*- 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 osv import osv
from tools.translate import _
-from mx import DateTime
-import time
+
class pos_payment_report(osv.osv_memory):
_name = 'pos.payment.report'
_description = 'Payment Report'
def print_report(self, cr, uid, ids, context={}):
- """
- To get the date and print the report
+ """
+ To get the date and print the report
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
- @param context: A standard dictionary
+ @param context: A standard dictionary
@return : retrun report
"""
-
- datas = {'ids' : context.get('active_ids', [])}
- return {
- 'type':'ir.actions.report.xml',
- 'report_name':'pos.payment.report',
- 'datas':datas,
+
+ datas = {'ids': context.get('active_ids', [])}
+ return {
+ 'type': 'ir.actions.report.xml',
+ 'report_name': 'pos.payment.report',
+ 'datas': datas,
}
+
pos_payment_report()
+
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
from osv import osv
from osv import fields
import time
+
+
class pos_payment_report_date(osv.osv_memory):
- '''
- Open ERP Model
- '''
- _name = 'pos.payment.report.date'
- _description = 'POS Payment Report according to date'
- def print_report(self, cr, uid, ids, context=None):
+ '''
+ Open ERP Model
+ '''
+ _name = 'pos.payment.report.date'
+ _description = 'POS Payment Report according to date'
+ def print_report(self, cr, uid, ids, context=None):
- """
- To get the date and print the report
- @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 : retrun report
- """
- datas = {'ids' : context.get('active_ids',[])}
- res = self.read(cr, uid, ids, ['date_start','date_end','user_id'])
- res = res and res[0] or {}
- datas['form'] = res
+ """
+ To get the date and print the report
+ @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 : retrun report
+ """
+ datas = {'ids': context.get('active_ids', [])}
+ res = self.read(cr, uid, ids, ['date_start', 'date_end', 'user_id'])
+ res = res and res[0] or {}
+ datas['form'] = res
- return {
- 'type' : 'ir.actions.report.xml',
- 'report_name':'pos.payment.report.date',
- 'datas' : datas,
- }
-
- _columns = {
- 'date_start': fields.date('Start Date', required=True),
- 'date_end': fields.date('End Date', required=True),
- 'user_id':fields.many2many('res.users','res_user_sale','user_id','sale_id','Salesman')
- }
- _defaults = {
- 'date_start': lambda *a: time.strftime('%Y-%m-%d'),
- 'date_end': lambda *a: time.strftime('%Y-%m-%d'),
+ return {
+ 'type': 'ir.actions.report.xml',
+ 'report_name': 'pos.payment.report.date',
+ 'datas': datas,
}
+
+ _columns = {
+ 'date_start': fields.date('Start Date', required=True),
+ 'date_end': fields.date('End Date', required=True),
+ 'user_id': fields.many2many('res.users', 'res_user_sale', 'user_id', 'sale_id', 'Salesman')
+ }
+ _defaults = {
+ 'date_start': lambda *a: time.strftime('%Y-%m-%d'),
+ 'date_end': lambda *a: time.strftime('%Y-%m-%d'),
+ }
+
pos_payment_report_date()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
from osv import osv
from osv import fields
+
class pos_payment_report_user(osv.osv_memory):
- '''
- Open ERP Model
- '''
- _name = 'pos.payment.report.user'
- _description = 'Sales lines by Users'
- def print_report(self, cr, uid, ids, context=None):
-
- """
- To get the date and print the report
- @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 : retrun report
- """
- datas = {'ids' : context.get('active_ids',[])}
- res = self.read(cr, uid, ids, ['user_id'])
- res = res and res[0] or {}
- datas['form'] = res
-
- return {
- 'type' : 'ir.actions.report.xml',
- 'report_name':'pos.payment.report.user',
- 'datas' : datas,
- }
-
- _columns = {
- 'user_id':fields.many2many('res.users','res_user_sale','user_id','sale_id','Salesman')
+ '''
+ Open ERP Model
+ '''
+ _name = 'pos.payment.report.user'
+ _description = 'Sales lines by Users'
+ def print_report(self, cr, uid, ids, context=None):
+
+ """
+ To get the date and print the report
+ @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 : retrun report
+ """
+ datas = {'ids': context.get('active_ids', [])}
+ res = self.read(cr, uid, ids, ['user_id'])
+ res = res and res[0] or {}
+ datas['form'] = res
+
+ return {
+ 'type': 'ir.actions.report.xml',
+ 'report_name': 'pos.payment.report.user',
+ 'datas': datas,
}
-pos_payment_report_user()
\ No newline at end of file
+
+ _columns = {
+ 'user_id': fields.many2many('res.users', 'res_user_sale', 'user_id', 'sale_id', 'Salesman')
+ }
+
+pos_payment_report_user()
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
-import netsvc
-from osv import osv,fields
+
+from osv import osv
from tools.translate import _
-from mx import DateTime
-import time
class pos_receipt(osv.osv_memory):
_name = 'pos.receipt'
_description = 'Point of sale receipt'
_columns = {
-
+
}
- def view_init(self, cr , uid , fields_list, context=None):
- order_lst =self. pool.get('pos.order').browse(cr,uid,context['active_id'])
+
+ def view_init(self, cr, uid, fields_list, context=None):
+ order_lst = self. pool.get('pos.order').browse(cr, uid, context['active_id'])
for order in order_lst:
if order.state_2 in ('to_verify'):
raise osv.except_osv(_('Error!', 'Can not print the receipt because of discount and/or payment '))
- True
+ True
+
def print_report(self, cr, uid, ids, context=None):
- """
- To get the date and print the report
+ """
+ To get the date and print the report
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
- @param context: A standard dictionary
+ @param context: A standard dictionary
@return : retrun report
- """
- datas = {'ids' : context.get('active_ids',[])}
- res = {}
+ """
+ datas = {'ids': context.get('active_ids', [])}
+ res = {}
datas['form'] = res
-
- return {
- 'type' : 'ir.actions.report.xml',
- 'report_name':'pos.receipt',
- 'datas' : datas,
+
+ return {
+ 'type': 'ir.actions.report.xml',
+ 'report_name': 'pos.receipt',
+ 'datas': datas,
}
pos_receipt()
-
-
-