[MERGE] Merge with main branch
bzr revid: mra@tinyerp.com-20100401104421-7s9xvi6s623y4nhb
This commit is contained in:
@@ -62,6 +62,7 @@ Main features :
|
||||
'wizard/pos_payment_report_user.xml',
|
||||
'wizard/pos_payment_report.xml',
|
||||
'wizard/pos_payment.xml',
|
||||
'wizard/pos_scan_product_view.xml',
|
||||
'pos_report.xml',
|
||||
'pos_wizard.xml',
|
||||
'pos_view.xml',
|
||||
|
||||
@@ -1360,7 +1360,7 @@ class report_sales_by_margin_pos(osv.osv):
|
||||
# 'pos_name': fields.char('POS Order', size=64, readonly=True),
|
||||
'product_name':fields.char('Product Name', size=64, readonly=True),
|
||||
'date_order': fields.date('Order Date',required=True, select=True),
|
||||
'amount': fields.float('Total', readonly=True, select=True),
|
||||
# 'amount': fields.float('Total', readonly=True, select=True),
|
||||
'user_id': fields.many2one('res.users', 'User', readonly=True, select=True),
|
||||
'qty': fields.float('Qty', readonly=True, select=True),
|
||||
'net_margin_per_qty':fields.float('Net margin per Qty', readonly=True, select=True),
|
||||
@@ -1409,7 +1409,7 @@ class report_sales_by_margin_pos_month(osv.osv):
|
||||
# 'pos_name': fields.char('POS Order', size=64, readonly=True),
|
||||
'product_name':fields.char('Product Name', size=64, readonly=True),
|
||||
'date_order': fields.date('Order Date',required=True, select=True),
|
||||
'amount': fields.float('Total', readonly=True, select=True),
|
||||
#'amount': fields.float('Total', readonly=True, select=True),
|
||||
'user_id': fields.many2one('res.users', 'User', readonly=True, select=True),
|
||||
'qty': fields.float('Qty', readonly=True, select=True),
|
||||
'net_margin_per_qty':fields.float('Net margin per Qty', readonly=True, select=True),
|
||||
|
||||
@@ -27,4 +27,14 @@
|
||||
"access_pos_open_statement","pos.close.statement","model_pos_close_statement","point_of_sale.group_pos_user",1,0,0,0
|
||||
"acess_pos_box_entries ","pos.box.entries ","model_pos_box_entries","point_of_sale.group_pos_user",1,0,0,0
|
||||
"access_pos_box_out","pos.box.out","model_pos_box_out","point_of_sale.group_pos_user",1,0,0,0
|
||||
"acess_pos_details ","pos.details ","model_pos_details","point_of_sale.group_pos_user",1,0,0,0
|
||||
"access_pos_details ","pos.details ","model_pos_details","point_of_sale.group_pos_user",1,0,0,0
|
||||
"access_pos_details ","pos.details ","model_pos_details","point_of_sale.group_pos_user",1,0,0,0
|
||||
"access_pos_sale_user","pos.sale.user","model_pos_sale_user","point_of_sale.group_pos_user",1,0,0,0
|
||||
"access_pos_sale_user","pos.sales.user.today","model_pos_sales_user_today","point_of_sale.group_pos_user",1,0,0,0
|
||||
"access_pos_sales_user_today_current_user","pos.sales.user.today.current_user","model_pos_sales_user_today_current_user","point_of_sale.group_pos_user",1,0,0,0
|
||||
"access_all_closed_cashbox_of_the_day","all.closed.cashbox.of.the.day","model_all_closed_cashbox_of_the_day","point_of_sale.group_pos_user",1,0,0,0
|
||||
"access_pos_receipt","pos.receipt ","model_pos_receipt","point_of_sale.group_pos_user",1,0,0,0
|
||||
"access_pos_payment_report_user","pos.payment.report.user","model_pos_payment_report_user","point_of_sale.group_pos_user",1,0,0,0
|
||||
"access_pos_payment_report_date ","pos.payment.report.date ","model_pos_payment_report_date","point_of_sale.group_pos_user",1,0,0,0
|
||||
"access_pos_make_payment","pos.make.payment","model_pos_make_payment","point_of_sale.group_pos_user",1,0,0,0
|
||||
"access_pos_scan_product","pos.scan.product","model_pos_scan_product","point_of_sale.group_pos_user",1,0,0,0
|
||||
|
||||
|
@@ -20,11 +20,8 @@
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
#import wizard_pos_payment
|
||||
import wizard_default_journal
|
||||
import wizard_scan_product
|
||||
import wizard_return
|
||||
#import wizard_open_statement
|
||||
|
||||
import pos_add_product
|
||||
import pos_confirm
|
||||
import pos_discount
|
||||
@@ -43,6 +40,7 @@ import pos_payment_report_user
|
||||
import pos_payment_report_date
|
||||
import pos_payment_report
|
||||
import pos_payment
|
||||
import pos_scan_product
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ class pos_make_payment(osv.osv_memory):
|
||||
<label string="Do you want to print the Receipt?" colspan="4"/>
|
||||
<separator colspan="4"/>
|
||||
<button icon="gtk-cancel" special="cancel" string="No" readonly="0"/>
|
||||
<button name="print_report" string="Print Receipt" type="object" icon="gtk-ok"/>
|
||||
<button name="print_report" string="Print Receipt" type="object" icon="gtk-print"/>
|
||||
</group>
|
||||
</form>
|
||||
"""
|
||||
@@ -143,7 +143,11 @@ class pos_make_payment(osv.osv_memory):
|
||||
if order.partner_id and order.invoice_wanted:
|
||||
return self.create_invoice(cr, uid, ids, context)
|
||||
else:
|
||||
return self.print_report(cr, uid, ids, context)
|
||||
order_obj.write(cr, uid, [record_id],{'state':'paid'})
|
||||
return self.print_report(cr, uid, ids, context)
|
||||
if order.amount_paid > 0.0:
|
||||
self.pool.get('pos.order').write(cr, uid, [record_id],{'state':'advance'})
|
||||
return self.print_report(cr, uid, ids, context)
|
||||
return {}
|
||||
|
||||
def create_invoice(self, cr, uid, ids, context):
|
||||
|
||||
@@ -8,10 +8,8 @@
|
||||
<field name="model">pos.payment.report</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="POS Details :">
|
||||
<form string="Payment Report">
|
||||
<group col="2" colspan="4">
|
||||
<field name="date_start"/>
|
||||
<field name="date_end"/>
|
||||
<button icon='gtk-cancel' special="cancel"
|
||||
string="Close" />
|
||||
<button name="print_report" string="Print Report"
|
||||
@@ -24,7 +22,7 @@
|
||||
<record id="action_pos_payment_report" model="ir.actions.act_window">
|
||||
<field name="name">Payment Report</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">pos.details</field>
|
||||
<field name="res_model">pos.payment.report</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
|
||||
@@ -2,37 +2,30 @@
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<!-- pos.details -->
|
||||
<!-- Pos Receipt -->
|
||||
|
||||
<record id="view_pos_receipt" model="ir.ui.view">
|
||||
<field name="name">Receipt</field>
|
||||
<field name="model">pos.receipt</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Receipt :">
|
||||
<button icon='gtk-cancel' special="cancel"
|
||||
string="Close" />
|
||||
<button name="print_report" string="Print Report"
|
||||
colspan="1" type="object" icon="gtk-ok" />
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
<record id="view_pos_receipt" model="ir.ui.view">
|
||||
<field name="name">Receipt</field>
|
||||
<field name="model">pos.receipt</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Receipt :">
|
||||
<button icon='gtk-cancel' special="cancel"
|
||||
string="Close" />
|
||||
<button name="print_report" string="Print Report"
|
||||
colspan="1" type="object" icon="gtk-print" />
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<act_window name="Print Receipt"
|
||||
res_model="pos.receipt"
|
||||
src_model="pos.order"
|
||||
view_mode="form"
|
||||
target="new"
|
||||
key2="client_action_multi"
|
||||
id="action_report_pos_receipt"/>
|
||||
|
||||
<!--record id="action_report_pos_receipt" model="ir.actions.act_window">
|
||||
<record id="action_report_pos_receipt" model="ir.actions.act_window">
|
||||
<field name="name">Receipt</field>
|
||||
<field name="res_model">pos.receipt</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record-->
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -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 osv,fields
|
||||
from tools.translate import _
|
||||
|
||||
class pos_scan_product(osv.osv_memory):
|
||||
_name = 'pos.scan.product'
|
||||
_description = 'Scan product'
|
||||
_columns = {
|
||||
'gencod': fields.char('Barcode',size=13,required= True)
|
||||
}
|
||||
def scan(self, cr, uid, ids, context):
|
||||
"""
|
||||
To get the gencod and scan 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 : retrun gencod
|
||||
"""
|
||||
|
||||
data=self.read(cr, uid, ids)[0]
|
||||
record_id = context and context.get('active_id',False)
|
||||
result =self. pool.get('pos.order.line')._scan_product(cr, uid, data['gencod'], 1, record_id)
|
||||
return {'gencod': False}
|
||||
|
||||
pos_scan_product()
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record id="view_pos_scan_product" model="ir.ui.view">
|
||||
<field name="name">Scan product</field>
|
||||
<field name="model">pos.scan.product</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Scan product">
|
||||
<group col="2" colspan="4">
|
||||
<label string="Scan Barcode" colspan="4"/>
|
||||
<field name="gencod" colspan="4" nolabel="1"/>
|
||||
<button icon='gtk-cancel' special="cancel"
|
||||
string="Close" />
|
||||
<button name="scan" string="Add"
|
||||
colspan="1" type="object" icon="gtk-ok" />
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="action_pos_scan_product" model="ir.actions.act_window">
|
||||
<field name="name">Scan product</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">pos.scan.product</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -1,128 +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 pooler
|
||||
|
||||
|
||||
def _get_default_journal_selection(self, cr, uid, context):
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
obj = pool.get('account.journal')
|
||||
ids = obj.search(cr, uid, [('type', '=', 'cash')])
|
||||
res = obj.read(cr, uid, ids, ['id', 'name'], context)
|
||||
res = [(r['id'], r['name']) for r in res]
|
||||
res.insert(0, ('', ''))
|
||||
return res
|
||||
|
||||
default_journal_form = '''<?xml version="1.0"?>
|
||||
<form string="Select default journals">
|
||||
<field name="default_journal" />
|
||||
<newline />
|
||||
<field name="default_journal_rebate" />
|
||||
<newline />
|
||||
<field name="default_journal_gift" />
|
||||
<newline />
|
||||
</form>'''
|
||||
|
||||
default_journal_fields = {
|
||||
'default_journal': {'string': 'Default journal', 'type': 'selection',
|
||||
'selection': _get_default_journal_selection,
|
||||
},
|
||||
'default_journal_rebate': {'string': 'Default rebate journal', 'type': 'selection',
|
||||
'selection': _get_default_journal_selection,
|
||||
},
|
||||
'default_journal_gift': {'string': 'Default gift journal', 'type': 'selection',
|
||||
'selection': _get_default_journal_selection,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
class wizard_default_journal(wizard.interface):
|
||||
|
||||
def _set_default_journal(self, cr, uid, data, context):
|
||||
|
||||
def _update_default_journal_config(journal_type, journal_code, journal_descr, journal_codes, data):
|
||||
default_journal_id = data.get('form', {}).get(journal_type) or None
|
||||
dico = dict(name=journal_descr, code=journal_code, journal_id=default_journal_id)
|
||||
if default_journal_id:
|
||||
if journal_code in journal_codes:
|
||||
ids = [obj.id for obj in objs if obj.code == journal_code]
|
||||
pos_config_journal.write(cr, uid, ids, dico, context)
|
||||
else:
|
||||
pos_config_journal.create(cr, uid, dico, context)
|
||||
else:
|
||||
ids = [obj.id for obj in objs if obj.code == journal_code]
|
||||
pos_config_journal.write(cr, uid, ids, dico, context)
|
||||
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
pos_config_journal = pool.get('pos.config.journal')
|
||||
ids = pos_config_journal.search(cr, uid, [])
|
||||
objs = pos_config_journal.browse(cr, uid, ids)
|
||||
journal_codes = [str(obj.code) for obj in objs]
|
||||
|
||||
_update_default_journal_config('default_journal', 'DEFAULT', 'Default journal', journal_codes, data)
|
||||
_update_default_journal_config('default_journal_rebate', 'REBATE', 'Default rebate journal', journal_codes, data)
|
||||
_update_default_journal_config('default_journal_gift', 'GIFT', 'Default gift journal', journal_codes, data)
|
||||
|
||||
return {}
|
||||
|
||||
def _get_defaults(self, cr, uid, data, context):
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
pos_config_journal = pool.get('pos.config.journal')
|
||||
ids = pos_config_journal.search(cr, uid, [])
|
||||
objs = pos_config_journal.browse(cr, uid, ids)
|
||||
journal_codes = {}
|
||||
for obj in objs:
|
||||
journal_codes[obj.code] = int(obj.journal_id.id)
|
||||
|
||||
form = data['form']
|
||||
form['default_journal'] = journal_codes.get('DEFAULT') or False
|
||||
form['default_journal_rebate'] = journal_codes.get('REBATE') or False
|
||||
form['default_journal_gift'] = journal_codes.get('GIFT') or False
|
||||
|
||||
return form
|
||||
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [_get_defaults],
|
||||
'result': {
|
||||
'type': 'form',
|
||||
'arch': default_journal_form,
|
||||
'fields': default_journal_fields,
|
||||
'state': [
|
||||
('end', 'Cancel'),
|
||||
('set_default_journal', 'Define default journals')
|
||||
]
|
||||
}
|
||||
},
|
||||
'set_default_journal': {
|
||||
'actions': [_set_default_journal],
|
||||
'result': {
|
||||
'type': 'state',
|
||||
'state': "end",
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
wizard_default_journal('pos.config.journal')
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -1,72 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
|
||||
# Copyright (c) 2008 Sylëam Info Services. (http://www.syleam.fr) All Rights Reserved.
|
||||
#
|
||||
# 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_gencod = """<?xml version="1.0"?>
|
||||
<form string="Scan product">
|
||||
<label string="Scan Barcode" colspan="4"/>
|
||||
<field name="gencod" colspan="4" nolabel="1"/>
|
||||
</form>
|
||||
"""
|
||||
|
||||
fields_gencod = {
|
||||
'gencod': {'string': 'Barcode',
|
||||
'type': 'char',
|
||||
'size': 13,
|
||||
'required': True}
|
||||
}
|
||||
|
||||
|
||||
def _scan(self, cr, uid, data, context):
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
result = pool.get('pos.order.line')._scan_product(cr, uid, data['form']['gencod'], 1, data['id'])
|
||||
return {'gencod': False}
|
||||
|
||||
|
||||
def _pre_init(self, cr, uid, data, context):
|
||||
return {'gencod': False}
|
||||
|
||||
|
||||
class pos_scan_product(wizard.interface):
|
||||
states = {
|
||||
'init': {'actions' : [_pre_init],
|
||||
'result': {
|
||||
'type': 'form',
|
||||
'arch': form_gencod,
|
||||
'fields': fields_gencod,
|
||||
'state': [('end', 'Cancel','gtk-cancel'),
|
||||
('add', 'Add', 'gtk-ok', True)],
|
||||
}
|
||||
},
|
||||
'add': {'actions' : [_scan],
|
||||
'result': {
|
||||
'type': 'state',
|
||||
'state': 'init',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pos_scan_product('pos.scan_product')
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
Reference in New Issue
Block a user