diff --git a/addons/point_of_sale/__init__.py b/addons/point_of_sale/__init__.py
index 7a786ebb5f1..b8c887f6750 100644
--- a/addons/point_of_sale/__init__.py
+++ b/addons/point_of_sale/__init__.py
@@ -19,14 +19,12 @@
#
##############################################################################
-import point_of_sale
import account_bank_statement
+import controllers
+import point_of_sale
+import report
import res_users
import res_partner
import wizard
-import report
-
-import controllers
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/point_of_sale/__openerp__.py b/addons/point_of_sale/__openerp__.py
index fa42a19e209..9f3a023f062 100644
--- a/addons/point_of_sale/__openerp__.py
+++ b/addons/point_of_sale/__openerp__.py
@@ -19,7 +19,6 @@
#
##############################################################################
-
{
'name': 'Point of Sale',
'version': '1.0.1',
@@ -51,19 +50,15 @@ Main Features
'images': ['images/pos_touch_screen.jpeg', 'images/pos_session.jpeg', 'images/pos_analysis.jpeg','images/sale_order_pos.jpeg','images/product_pos.jpeg'],
'depends': ['sale_stock'],
'data': [
+ 'data/report_paperformat.xml',
'security/point_of_sale_security.xml',
'security/ir.model.access.csv',
- 'wizard/pos_details.xml',
+ 'wizard/pos_box.xml',
'wizard/pos_confirm.xml',
+ 'wizard/pos_details.xml',
'wizard/pos_discount.xml',
'wizard/pos_open_statement.xml',
- 'wizard/pos_payment_report_user_view.xml',
- 'wizard/pos_sales_user.xml',
- 'wizard/pos_receipt_view.xml',
- 'wizard/pos_payment_report_user.xml',
- 'wizard/pos_payment_report.xml',
'wizard/pos_payment.xml',
- 'wizard/pos_box.xml',
'wizard/pos_session_opening.xml',
'point_of_sale_report.xml',
'point_of_sale_view.xml',
@@ -75,16 +70,24 @@ Main Features
'account_statement_report.xml',
'res_users_view.xml',
'res_partner_view.xml',
+ 'views/report_statement.xml',
+ 'views/report_usersproduct.xml',
+ 'views/report_closedcashbox.xml',
+ 'views/report_receipt.xml',
+ 'views/report_saleslines.xml',
+ 'views/report_detailsofsales.xml',
+ 'views/report_payment.xml',
],
'demo': [
'point_of_sale_demo.xml',
'account_statement_demo.xml',
- 'test/00_register_open.yml'
],
'test': [
+ 'test/00_register_open.yml',
'test/01_order_to_payment.yml',
'test/02_order_to_invoice.yml',
- 'test/point_of_sale_report.yml'
+ 'test/point_of_sale_report.yml',
+ 'test/account_statement_reports.yml',
],
'installable': True,
'application': True,
diff --git a/addons/point_of_sale/account_statement_report.xml b/addons/point_of_sale/account_statement_report.xml
index a81d51a2679..2f08ee7f6d8 100644
--- a/addons/point_of_sale/account_statement_report.xml
+++ b/addons/point_of_sale/account_statement_report.xml
@@ -1,60 +1,29 @@
-
+
-
+ name="point_of_sale.report_usersproduct"
+ file="point_of_sale.report_usersproduct"
+ report_type="qweb-pdf"
+ />
-
-
-
-
-
-
-
-
-
-
+ name="point_of_sale.report_closedcashbox"
+ file="point_of_sale.report_closedcashbox"
+ report_type="qweb-pdf"
+ />
diff --git a/addons/point_of_sale/controllers/__init__.py b/addons/point_of_sale/controllers/__init__.py
index b5f0bcc9ec6..d37b070a7b2 100644
--- a/addons/point_of_sale/controllers/__init__.py
+++ b/addons/point_of_sale/controllers/__init__.py
@@ -1,3 +1,2 @@
import main
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/point_of_sale/data/report_paperformat.xml b/addons/point_of_sale/data/report_paperformat.xml
new file mode 100644
index 00000000000..089506f1d2b
--- /dev/null
+++ b/addons/point_of_sale/data/report_paperformat.xml
@@ -0,0 +1,20 @@
+
+
+
+
+ Point Of Sale Receipt
+
+ custom
+ 150
+ 60
+ Portrait
+ 3
+ 3
+ 3
+ 3
+
+ 3
+ 130
+
+
+
diff --git a/addons/point_of_sale/point_of_sale.py b/addons/point_of_sale/point_of_sale.py
index f18edf39e85..72b6a30c2ed 100644
--- a/addons/point_of_sale/point_of_sale.py
+++ b/addons/point_of_sale/point_of_sale.py
@@ -605,7 +605,6 @@ class pos_order(osv.osv):
return {'value': {'pricelist_id': pricelist}}
def _amount_all(self, cr, uid, ids, name, args, context=None):
- tax_obj = self.pool.get('account.tax')
cur_obj = self.pool.get('res.currency')
res = {}
for order in self.browse(cr, uid, ids, context=context):
@@ -858,9 +857,7 @@ class pos_order(osv.osv):
'qty': -order_line.qty
}, context=context)
- new_order = ','.join(map(str,clone_list))
abs = {
- #'domain': "[('id', 'in', ["+new_order+"])]",
'name': _('Return Products'),
'view_type': 'form',
'view_mode': 'form',
diff --git a/addons/point_of_sale/point_of_sale_data.xml b/addons/point_of_sale/point_of_sale_data.xml
index b8d1e6db82d..2bdf8739af3 100644
--- a/addons/point_of_sale/point_of_sale_data.xml
+++ b/addons/point_of_sale/point_of_sale_data.xml
@@ -1,8 +1,6 @@
-
-
-
+
If you install the PoS proxy you will be able to interface OpenERP with retail hardware: barcode scanners, printers, cash registers, weighing machines, credit card payment terminals.
]]>
-
diff --git a/addons/point_of_sale/point_of_sale_report.xml b/addons/point_of_sale/point_of_sale_report.xml
index 94c2e946e90..a4c1f4648a3 100644
--- a/addons/point_of_sale/point_of_sale_report.xml
+++ b/addons/point_of_sale/point_of_sale_report.xml
@@ -1,86 +1,62 @@
+
+
+
+
+
+
+
+
+ />
+ />
-
-
-
-
-
-
-
-
-
-
+ report_type="qweb-pdf"
+ name="point_of_sale.report_payment"
+ file="point_of_sale.report_payment"
+ />
diff --git a/addons/point_of_sale/report/__init__.py b/addons/point_of_sale/report/__init__.py
index 3d8f93ae724..aa8d4c080d8 100644
--- a/addons/point_of_sale/report/__init__.py
+++ b/addons/point_of_sale/report/__init__.py
@@ -26,11 +26,7 @@ import pos_receipt
import pos_invoice
import pos_lines
import pos_details
-import pos_details_summary
import pos_payment_report
-import pos_sales_user
-import pos_sales_user_today
-import pos_payment_report_user
import pos_report
import pos_order_report
diff --git a/addons/point_of_sale/report/account_statement.py b/addons/point_of_sale/report/account_statement.py
index c9de91dbbbf..253469f6c89 100644
--- a/addons/point_of_sale/report/account_statement.py
+++ b/addons/point_of_sale/report/account_statement.py
@@ -20,8 +20,10 @@
##############################################################################
import time
+from openerp.osv import osv
from openerp.report import report_sxw
+
class account_statement(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
@@ -46,6 +48,11 @@ class account_statement(report_sxw.rml_parse):
total += line.amount
return total
-report_sxw.report_sxw('report.account.statement', 'account.bank.statement', 'addons/statement/report/account_statement.rml', parser=account_statement,header='internal')
+
+class report_account_statement(osv.AbstractModel):
+ _name = 'report.point_of_sale.report_statement'
+ _inherit = 'report.abstract_report'
+ _template = 'point_of_sale.report_statement'
+ _wrapped_report_class = account_statement
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/point_of_sale/report/account_statement.rml b/addons/point_of_sale/report/account_statement.rml
deleted file mode 100644
index 0b633f3f7c4..00000000000
--- a/addons/point_of_sale/report/account_statement.rml
+++ /dev/null
@@ -1,285 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Name
- |
-
- Partner
- |
-
- Amount
- |
-
-
-
- [[ repeatIn(objects,'statement') ]]
- Statement
-
-
-
- Statement Name
- |
-
- Journal
- |
-
- Company
- |
-
- User
- |
-
-
-
-
-
- [[ statement.name ]]
- |
-
- [[ statement.journal_id.name ]]
- |
-
- [[ statement.company_id.name ]]
- |
-
- [[ statement.user_id.name ]]
- |
-
-
-
-
-
-
-
-
- Opening Date
- |
-
- Closing Date
- |
-
- Starting Balance
- |
-
- Ending Balance
- |
-
-
-
-
-
- [[ formatLang(statement.date,date=True) ]]
- |
-
- [[ formatLang(statement.closing_date,date_time=True)]]
- |
-
- [[ formatLang(statement.balance_start, dp='Account', currency_obj = company.currency_id) ]]
- |
-
- [[ formatLang(statement.balance_end_real, dp='Account', currency_obj = company.currency_id) ]]
- |
-
-
-
-
-
-
-
-
- Name
- |
-
- Partner
- |
-
- Amount
- |
-
-
-
- [[ repeatIn(statement.line_ids,'line_ids') and ' ' or removeParentNode('blockTable') ]]
-
- [[ repeatIn(get_data(statement), 'line_ids')]]
-
-
-
- [[ line_ids.name ]]
- |
-
- [[ line_ids.partner_id.name ]]
- |
-
- [[ formatLang(line_ids.amount, dp='Account', currency_obj=company.currency_id) ]]
- |
-
-
-
-
-
-
-
-
-
-
- |
-
- Total :
- |
-
- [[ formatLang(get_total(statement.line_ids), dp='Account', currency_obj = company.currency_id) ]]
- |
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/addons/point_of_sale/report/all_closed_cashbox_of_the_day.py b/addons/point_of_sale/report/all_closed_cashbox_of_the_day.py
index 8559d2571d6..1bb51e82048 100644
--- a/addons/point_of_sale/report/all_closed_cashbox_of_the_day.py
+++ b/addons/point_of_sale/report/all_closed_cashbox_of_the_day.py
@@ -20,8 +20,10 @@
##############################################################################
import time
+from openerp.osv import osv
from openerp.report import report_sxw
+
class all_closed_cashbox_of_the_day(report_sxw.rml_parse):
#TOFIX: sql injection problem: SQL Request must be pass from sql injection...
def __init__(self, cr, uid, name, context):
@@ -39,14 +41,14 @@ class all_closed_cashbox_of_the_day(report_sxw.rml_parse):
})
def _get_user(self, line_ids):
- sql = "select name from res_users where id = %d"%(line_ids['create_uid'])
+ sql = "select login from res_users where id = %d"%(line_ids['create_uid'])
self.cr.execute(sql)
user = self.cr.fetchone()
return user[0]
def _get_data(self, user):
data = {}
- sql = """ SELECT abs.journal_id,abs.id,abs.date,abs.closing_date,abs.name as statement,aj.name as journal,ap.name as period,ru.name as user,rc.name as company,
+ sql = """ SELECT abs.journal_id,abs.id,abs.date,abs.closing_date,abs.name as statement,aj.name as journal,ap.name as period,ru.partner_id as user,rc.name as company,
abs.state,abs.balance_end_real FROM account_bank_statement as abs
LEFT JOIN account_journal as aj ON aj.id = abs.journal_id
LEFT JOIN account_period as ap ON ap.id = abs.period_id
@@ -67,7 +69,7 @@ class all_closed_cashbox_of_the_day(report_sxw.rml_parse):
def _get_bal(self, data):
res = {}
- sql =""" select sum(pieces*number) as bal from account_cashbox_line where starting_id = %d """%(data['id'])
+ sql =""" select sum(pieces*number_closing) as bal from account_cashbox_line where bank_statement_id = %d """%(data['id'])
self.cr.execute(sql)
res = self.cr.dictfetchall()
if res:
@@ -115,7 +117,7 @@ class all_closed_cashbox_of_the_day(report_sxw.rml_parse):
res = self.cr.dictfetchall()
for r in res:
total_ending_bal += (r['net_total'] or 0.0)
- sql1 =""" select sum(pieces*number) as bal from account_cashbox_line where starting_id = %d"""%(r['id'])
+ sql1 =""" select sum(pieces*number_closing) as bal from account_cashbox_line where bank_statement_id = %d"""%(r['id'])
self.cr.execute(sql1)
data = self.cr.dictfetchall()
if data[0]['bal']:
@@ -135,6 +137,11 @@ class all_closed_cashbox_of_the_day(report_sxw.rml_parse):
res = self.cr.dictfetchall()
return res[0]['net_total'] or 0.0
-report_sxw.report_sxw('report.all.closed.cashbox.of.the.day', 'account.bank.statement', 'addons/point_of_sale/report/all_closed_cashbox_of_the_day.rml', parser=all_closed_cashbox_of_the_day,header='internal')
+
+class report_closed_cashbox(osv.AbstractModel):
+ _name = 'report.point_of_sale.report_closedcashbox'
+ _inherit = 'report.abstract_report'
+ _template = 'point_of_sale.report_closedcashbox'
+ _wrapped_report_class = all_closed_cashbox_of_the_day
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/point_of_sale/report/all_closed_cashbox_of_the_day.rml b/addons/point_of_sale/report/all_closed_cashbox_of_the_day.rml
deleted file mode 100644
index 4f16031c8b3..00000000000
--- a/addons/point_of_sale/report/all_closed_cashbox_of_the_day.rml
+++ /dev/null
@@ -1,249 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- [[ repeatIn(objects,'statement') ]]
-
-
-
-
-
-
- Today's Closed Cashbox
-
-
-
-
-
-
- Company
- |
-
- User
- |
-
-
-
-
-
- [[ company.name ]]
- |
-
- [[ user.name ]]
- |
-
-
-
-
-
-
-
-
- St.Name
- |
-
- Journal
- |
-
- Opening Date
- |
-
- Closing Date
- |
-
- Starting Balance
- |
-
- Ending Balance
- |
-
-
-
-
-
- Total:
- |
-
-
-
-
- |
-
-
-
-
- |
-
-
-
-
- |
-
- [[ formatLang(get_net_total_starting(user)[1], currency_obj = company.currency_id)]]
- |
-
- [[ formatLang(get_net_total(user), currency_obj = company.currency_id)]]
- |
-
-
-
- [[ repeatIn(get_data(user),'statement') ]]
-
-
-
- [[ statement['statement'] ]]
- |
-
- [[ statement['journal'] ]]
- |
-
- [[ statement['date'] ]]
- |
-
- [[ statement['closing_date'] ]]
- |
-
- [[ formatLang(get_bal(statement), currency_obj = company.currency_id)]]
- |
-
- [[ formatLang(get_sub_total(user,statement['journal_id'],statement['date']), currency_obj = company.currency_id )]]
- |
-
-
-
- [[ repeatIn(get_lines(statement),'line_ids') ]]
-
-
-
- [[ line_ids['name'] ]]
-
-
-
- |
-
- [[ get_partner(line_ids) or removeParentNode('font') ]]
- |
-
- [[ get_user(line_ids) or removeParentNode('font') ]]
- |
-
-
-
-
- |
-
- [[ formatLang(line_ids['amount'], currency_obj = company.currency_id)]]
- |
-
-
-
-
-
-
-
-
-
diff --git a/addons/point_of_sale/report/pos_details.py b/addons/point_of_sale/report/pos_details.py
index cf1e7731bff..1c1f46ac0b7 100644
--- a/addons/point_of_sale/report/pos_details.py
+++ b/addons/point_of_sale/report/pos_details.py
@@ -20,8 +20,10 @@
##############################################################################
import time
+from openerp.osv import osv
from openerp.report import report_sxw
+
class pos_details(report_sxw.rml_parse):
def _get_invoice(self, inv_id):
@@ -180,7 +182,7 @@ class pos_details(report_sxw.rml_parse):
'strip_name': self._strip_name,
'getpayments': self._get_payments,
'getsumdisc': self._get_sum_discount,
- 'gettotalofthaday': self._total_of_the_day,
+ 'gettotaloftheday': self._total_of_the_day,
'gettaxamount': self._get_tax_amount,
'pos_sales_details':self._pos_sales_details,
'getqtytotal2': self._get_qty_total_2,
@@ -191,6 +193,11 @@ class pos_details(report_sxw.rml_parse):
'get_user_names': self._get_user_names,
})
-report_sxw.report_sxw('report.pos.details', 'pos.order', 'addons/point_of_sale_singer/report/pos_details.rml', parser=pos_details, header='internal')
+
+class report_pos_details(osv.AbstractModel):
+ _name = 'report.point_of_sale.report_detailsofsales'
+ _inherit = 'report.abstract_report'
+ _template = 'point_of_sale.report_detailsofsales'
+ _wrapped_report_class = pos_details
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/point_of_sale/report/pos_details.rml b/addons/point_of_sale/report/pos_details.rml
deleted file mode 100644
index 6360dc25b12..00000000000
--- a/addons/point_of_sale/report/pos_details.rml
+++ /dev/null
@@ -1,400 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Details of Sales
-
-
-
-
-
-
- Company
- |
-
- Users
- |
-
- Print Date
- |
-
- Start Period
- |
-
- End Period
- |
-
-
-
-
-
- [[ company.name ]]
- |
-
- [[ get_user_names(data['form']['user_ids']) or 'All' ]]
- |
-
- [[ formatLang(time.strftime('%Y-%m-%d'),date=True) ]]
- |
-
- [[ formatLang(data['form']['date_start'],date=True) ]]
- |
-
- [[ formatLang(data['form']['date_end'],date=True) ]]
- |
-
-
-
-
-
-
-
-
- Date
- |
-
- Order
- |
-
- Product
- |
-
- Price
- |
-
- Qty
- |
-
- Disc(%)
- |
-
- Invoiced
- |
-
-
-
- [[ repeatIn(pos_sales_details(data['form']), 'line_ids') ]]
-
-
-
- [[ formatLang(line_ids['date_order'],date_time = True) ]]
- |
-
- [[ line_ids['pos_name'] ]]
- |
-
- [ [[ line_ids['code'] ]] ] [[ line_ids['name'] ]]
- |
-
- [[ formatLang(line_ids['price_unit'], dp='Sale Price', currency_obj = company.currency_id) ]]
- |
-
- [[ formatLang(line_ids['qty']) ]] [[ line_ids['uom'] ]]
- |
-
- [[ formatLang(line_ids['discount'], dp='Sale Price') ]]
- |
-
- [[ getinvoice(line_ids['invoice_id']) or removeParentNode('font') ]]
- |
-
-
-
-
-
-
-
-
-
- Taxes
- |
-
-
-
-
- |
-
-
-
- [[ repeatIn(gettaxamount(data['form']), 'p')]]
-
-
-
- [[ p['name'] or removeParentNode('para') ]]
- |
-
- [[ formatLang(p['amount'], currency_obj = company.currency_id) or removeParentNode('tr') ]]
- |
-
-
-
-
-
-
-
-
-
-
-
-
- Payment
- |
-
-
-
-
- |
-
-
-
- [[ repeatIn(getpayments(data['form']), 'p') ]]
-
-
-
- [[ p['name'] or removeParentNode('para') ]]
- |
-
- [[ formatLang(p['sum'], dp='Account', currency_obj = company.currency_id) or removeParentNode('tr') ]]
- |
-
-
-
-
-
-
-
-
-
-
-
-
- Summary
- |
-
-
-
-
- |
-
-
-
-
-
- Sales total(Revenue)
- |
-
- [[ formatLang(getsalestotal2(), dp='Sale Price', currency_obj = company.currency_id) ]]
- |
-
-
-
- Qty of product
- |
-
- [[ formatLang(getqtytotal2()) ]]
- |
-
-
-
- Total invoiced
- |
-
- [[ formatLang(getsuminvoice2(data['form']), dp='Sale Price', currency_obj = company.currency_id) ]]
- |
-
-
-
- Total discount
- |
-
- [[ formatLang(getsumdisc(data['form']), dp='Sale Price', currency_obj = company.currency_id) ]]
- |
-
-
-
- Total paid
- |
-
- [[ formatLang(getpaidtotal2(), dp='Sale Price', currency_obj = company.currency_id) ]]
- |
-
-
-
- Total of the day
- |
-
- [[ formatLang(gettotalofthaday(data['form']), dp='Sale Price', currency_obj = company.currency_id) ]]
- |
-
-
-
-
-
-
-
diff --git a/addons/point_of_sale/report/pos_details_summary.py b/addons/point_of_sale/report/pos_details_summary.py
deleted file mode 100644
index d6600926bd6..00000000000
--- a/addons/point_of_sale/report/pos_details_summary.py
+++ /dev/null
@@ -1,129 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# 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 .
-#
-##############################################################################
-
-import time
-from openerp.report import report_sxw
-
-class pos_details_summary(report_sxw.rml_parse):
- def __init__(self, cr, uid, name, context):
- super(pos_details_summary, self).__init__(cr, uid, name, context=context)
- self.total = 0.0
- self.localcontext.update({
- 'time': time,
- 'strip_name': self._strip_name,
- 'getpayments': self._get_payments,
- 'getqtytotal': self._get_qty_total,
- 'getsumdisc': self._get_sum_discount,
- 'getpaidtotal': self._paid_total,
- 'gettotalofthaday': self._total_of_the_day,
- 'getsuminvoice': self._sum_invoice,
- 'gettaxamount': self._get_tax_amount,
- 'getsalestotal': self._get_sales_total,
- 'getstartperiod': self._get_start_period,
- 'getendperiod': self._get_end_period,
- 'getcompany':self.get_company
- })
-
- def get_company(self, objects):
- comp=[obj.company_id.name for obj in objects]
- return '%s' % (comp[0])
-
- def _get_qty_total(self, objects):
- #code for the sum of qty_total
- return reduce(lambda acc, object:
- acc + reduce(
- lambda sum_qty, line:
- sum_qty + line.qty,
- object.lines,
- 0 ),
- objects,
- 0)
-
- def _get_sum_discount(self, objects):
- #code for the sum of discount value
- return reduce(lambda acc, object:
- acc + reduce(
- lambda sum_dis, line:
- sum_dis + ((line.price_unit * line.qty ) * (line.discount / 100)),
- object.lines,
- 0.0),
- objects,
- 0.0 )
-
- def _get_payments(self, objects):
- result = {}
- for obj in objects:
- for statement in obj.statement_ids:
- if statement.journal_id:
- result[statement.journal_id] = result.get(statement.journal_id, 0.0) + statement.amount
- return result
-
- def _paid_total(self, objects):
- return sum(self._get_payments(objects).values(), 0.0)
-
- def _total_of_the_day(self, objects):
- total_paid = self._paid_total(objects)
- total_invoiced = self._sum_invoice(objects)
- return total_paid - total_invoiced
-
- def _sum_invoice(self, objects):
- return reduce(lambda acc, obj:
- acc + obj.invoice_id.amount_total,
- [o for o in objects if o.invoice_id and o.invoice_id.number],
- 0.0)
-
- def _ellipsis(self, string, maxlen=100, ellipsis = '...'):
- ellipsis = ellipsis or ''
- return string[:maxlen - len(ellipsis) ] + (ellipsis, '')[len(string) < maxlen]
-
- def _strip_name(self, name, maxlen=50):
- return self._ellipsis(name, maxlen, ' ...')
-
- def _get_tax_amount(self, objects):
- res = {}
- for order in objects:
- for line in order.lines:
- for tax in line.product_id.taxes_id:
- res[tax.name] = res.setdefault(tax.name, 0.0) + (line.price_subtotal_incl - line.price_subtotal)
- return res
-
- def _get_sales_total(self, objects):
- return reduce(lambda x, o: x + len(o.lines), objects, 0)
-
- def _get_start_period(self, objects):
- date_orders = sorted([obj.date_order for obj in objects])
- min_date = date_orders[0]
- return '%s' % min_date
-
-
- def _get_end_period(self, objects):
- date_orders = sorted([obj.date_order for obj in objects])
- max_date = date_orders[-1]
- return '%s' % max_date
-
-
-report_sxw.report_sxw('report.pos.details_summary',
- 'pos.order',
- 'addons/point_of_sale/report/pos_details_summary.rml',
- parser=pos_details_summary,
- header='internal')
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/point_of_sale/report/pos_details_summary.rml b/addons/point_of_sale/report/pos_details_summary.rml
deleted file mode 100644
index 6564f821010..00000000000
--- a/addons/point_of_sale/report/pos_details_summary.rml
+++ /dev/null
@@ -1,315 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Details of Sales
-
-
-
-
-
-
- Company
- |
-
- Print Date
- |
-
- Start Period
- |
-
- End Period
- |
-
-
-
-
-
- [[ company.name ]]
- |
-
- [[ formatLang(time.strftime('%Y-%m-%d'),date=True) ]]
- |
-
- [[ '%s' % getstartperiod(objects) ]]
- |
-
- [[ '%s' % getendperiod(objects) ]]
- |
-
-
-
-
-
-
-
-
-
- Mode of Taxes
- |
-
-
-
-
- |
-
-
-
- [[ repeatIn(gettaxamount(objects).items(),'p') ]]
-
-
-
- [[ p[0] ]]
- |
-
- [[ formatLang(p[1], currency_obj=company.currency_id) ]]
- |
-
-
-
-
-
-
-
-
-
-
-
-
- Mode of Payment
- |
-
-
-
-
- |
-
-
-
- [[ repeatIn(getpayments(objects).items(),'t') ]]
-
-
-
- [[ t[0].name ]]
- |
-
- [[ formatLang(t[1], currency_obj=company.currency_id) ]]
- |
-
-
-
-
-
-
-
-
-
-
-
-
- Summary
- |
-
-
-
-
- |
-
-
-
-
-
- Sales total
- |
-
- [[ '%d' % getsalestotal(objects) ]]
- |
-
-
-
- Qty of product
- |
-
- [[ '%d' % getqtytotal(objects) ]]
- |
-
-
-
- Total invoiced
- |
-
- [[ formatLang(getsuminvoice(objects), currency_obj=company.currency_id) ]]
- |
-
-
-
- Total discount
- |
-
- [[ formatLang(getsumdisc(objects), currency_obj=company.currency_id) ]]
- |
-
-
-
- Total paid
- |
-
- [[ formatLang(getpaidtotal(objects), currency_obj=company.currency_id) ]]
- |
-
-
-
- Total of the day
- |
-
- [[ formatLang(gettotalofthaday(objects), currency_obj=company.currency_id) ]]
- |
-
-
-
-
-
-
-
diff --git a/addons/point_of_sale/report/pos_invoice.py b/addons/point_of_sale/report/pos_invoice.py
index 60f4f233729..6ab06c4e99f 100644
--- a/addons/point_of_sale/report/pos_invoice.py
+++ b/addons/point_of_sale/report/pos_invoice.py
@@ -2,7 +2,7 @@
##############################################################################
#
# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
+# Copyright (C) 2014-Today OpenERP SA ().
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
@@ -19,40 +19,36 @@
#
##############################################################################
-import time
-
-from openerp.report import report_sxw
from openerp.osv import osv
from openerp.tools.translate import _
-class pos_invoice(report_sxw.rml_parse):
- def __init__(self, cr, uid, name, context):
- super(pos_invoice, self).__init__(cr, uid, name, context=context)
- self.localcontext.update({
- 'time': time,
- })
+class PosInvoiceReport(osv.AbstractModel):
+ _name = 'report.point_of_sale.report_invoice'
- def set_context(self, objects, data, ids, report_type=None):
- super(pos_invoice, self).set_context(objects, data, ids, report_type)
- iids = []
- nids = []
+ def render_html(self, cr, uid, ids, data=None, context=None):
+ if context is None:
+ context = {}
- for order in objects:
- order.write({'nb_print': order.nb_print + 1})
+ report_obj = self.pool['report']
+ report = report_obj._get_report_from_name(cr, uid, 'account.report_invoice')
+ selected_posorders = self.pool['pos.order'].browse(cr, uid, ids, context=context)
- if order.invoice_id and order.invoice_id not in iids:
- if not order.invoice_id:
- raise osv.except_osv(_('Error!'), _('Please create an invoice for this sale.'))
- iids.append(order.invoice_id)
- nids.append(order.invoice_id.id)
- data['ids'] = nids
- self.datas = data
- self.ids = nids
- self.objects = iids
- self.localcontext['data'] = data
- self.localcontext['objects'] = iids
+ invoiced_posorders = []
+ invoiced_posorders_ids = []
+ for order in selected_posorders:
+ if order.invoice_id:
+ invoiced_posorders.append(order)
+ invoiced_posorders_ids.append(order.id)
-report_sxw.report_sxw('report.pos.invoice', 'pos.order', 'addons/account/report/account_print_invoice.rml', parser= pos_invoice)
+ if not invoiced_posorders:
+ raise osv.except_osv(_('Error!'), _('Please create an invoice for this sale.'))
+
+ docargs = {
+ 'doc_ids': invoiced_posorders_ids,
+ 'doc_model': report.model,
+ 'docs': invoiced_posorders,
+ }
+ return report_obj.render(cr, uid, invoiced_posorders_ids, 'account.report_invoice', docargs, context=context)
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/point_of_sale/report/pos_lines.py b/addons/point_of_sale/report/pos_lines.py
index f20ccfd1ec2..b4cf512cbe8 100644
--- a/addons/point_of_sale/report/pos_lines.py
+++ b/addons/point_of_sale/report/pos_lines.py
@@ -20,8 +20,10 @@
##############################################################################
import time
+from openerp.osv import osv
from openerp.report import report_sxw
+
class pos_lines(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
@@ -50,6 +52,11 @@ class pos_lines(report_sxw.rml_parse):
res=self.cr.fetchone()[0]
return res
-report_sxw.report_sxw('report.pos.lines', 'pos.order', 'addons/point_of_sale/report/pos_lines.rml', parser=pos_lines,header='internal')
+
+class report_pos_lines(osv.AbstractModel):
+ _name = 'report.point_of_sale.report_saleslines'
+ _inherit = 'report.abstract_report'
+ _template = 'point_of_sale.report_saleslines'
+ _wrapped_report_class = pos_lines
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/point_of_sale/report/pos_lines.rml b/addons/point_of_sale/report/pos_lines.rml
deleted file mode 100644
index 1ed8e33eede..00000000000
--- a/addons/point_of_sale/report/pos_lines.rml
+++ /dev/null
@@ -1,239 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- [[repeatIn(objects,'o')]]
- [[ setLang(o.partner_id.lang) ]]
- Sales lines
-
-
-
-
-
-
- Company
- |
-
- Print Date
- |
-
- No. Of Articles
- |
-
-
-
-
-
- [[ company.name ]]
- |
-
- [[ formatLang(time.strftime('%Y-%m-%d'),date = True) ]]
- |
-
- [[ formatLang(total_quantity(o)) ]]
- |
-
-
-
-
-
-
-
-
-
-
-
- Description
- |
-
- Tax
- |
-
- Quantity
- |
-
- Unit Price
- |
-
- Disc. (%)
- |
-
- Price
- |
-
-
-
- [[repeatIn(o.lines,'l')]]
-
-
-
- [ [[l.product_id.code]] ] [[l.product_id.name]]
- |
-
- [[taxes(l)]]
- |
-
- [[ formatLang(l.qty) ]] [[l.product_id.uom_id.name]]
- |
-
- [[ formatLang(l.price_unit) ]]
- |
-
- [[ formatLang(l.discount) ]]
- |
-
- [[ formatLang(l.price_subtotal, currency_obj=o.pricelist_id.currency_id) ]]
- |
-
-
-
-
-
-
-
-
-
- |
-
- Net Total :
- |
-
- [[ formatLang(o.amount_total, currency_obj=o.pricelist_id.currency_id) ]]
- |
-
-
-
-
-
-
- |
-
- Taxes :
- |
-
- [[ formatLang(o.amount_tax, currency_obj=o.pricelist_id.currency_id) ]]
- |
-
-
-
-
-
-
- |
-
- Total:
- |
-
- [[ formatLang(o.amount_total + o.amount_tax, currency_obj=o.pricelist_id.currency_id) ]]
- |
-
-
-
-
-
-
-
diff --git a/addons/point_of_sale/report/pos_payment_report.py b/addons/point_of_sale/report/pos_payment_report.py
index e52694c9d01..5fbc8d5971e 100644
--- a/addons/point_of_sale/report/pos_payment_report.py
+++ b/addons/point_of_sale/report/pos_payment_report.py
@@ -20,8 +20,10 @@
##############################################################################
import time
+from openerp.osv import osv
from openerp.report import report_sxw
+
class pos_payment_report(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
@@ -59,6 +61,11 @@ class pos_payment_report(report_sxw.rml_parse):
def _pos_payment_total(self, o):
return self.total
-report_sxw.report_sxw('report.pos.payment.report', 'pos.order', 'addons/point_of_sale/report/pos_payment_report.rml', parser=pos_payment_report,header='internal')
+
+class report_pos_payment(osv.AbstractModel):
+ _name = 'report.point_of_sale.report_payment'
+ _inherit = 'report.abstract_report'
+ _template = 'point_of_sale.report_payment'
+ _wrapped_report_class = pos_payment_report
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/point_of_sale/report/pos_payment_report.rml b/addons/point_of_sale/report/pos_payment_report.rml
deleted file mode 100644
index bcc4b9ec261..00000000000
--- a/addons/point_of_sale/report/pos_payment_report.rml
+++ /dev/null
@@ -1,209 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Payment For Sale
-
-
-
-
-
-
-
-
-
- Company
- |
-
- Print Date
- |
-
-
-
-
-
- [[ company.name ]]
- |
-
- [[ formatLang(time.strftime('%Y-%m-%d'),date = True) ]]
- |
-
-
-
-
-
-
-
-
-
-
-
- Product
- |
-
- Qty
- |
-
- Disc.(%)
- |
-
- Unit Price
- |
-
- Total
- |
-
-
-
- [[ repeatIn(objects,'o') ]]
-
- [[ repeatIn(pos_payment(o), 'line_ids') ]]
-
-
-
- [ [[ line_ids['code'] ]] ] [[ line_ids['name'] ]]
- |
-
- [[ formatLang(line_ids['qty']) ]] [[line_ids['uom'] ]]
- |
-
- [[ formatLang(line_ids['discount']) ]]
- |
-
- [[ formatLang(line_ids['price_unit']) ]]
- |
-
- [[ formatLang(line_ids['total'], currency_obj = company.currency_id) ]]
- |
-
-
-
-
-
-
-
-
-
-
-
- |
-
- Net Total:
- |
-
- [[ formatLang(pos_payment_total(o), currency_obj = company.currency_id) or removeParentNode('blockTable')]]
- |
-
-
-
-
diff --git a/addons/point_of_sale/report/pos_payment_report_user.py b/addons/point_of_sale/report/pos_payment_report_user.py
deleted file mode 100644
index d3928df4a84..00000000000
--- a/addons/point_of_sale/report/pos_payment_report_user.py
+++ /dev/null
@@ -1,64 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# 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 .
-#
-##############################################################################
-
-import time
-from openerp.report import report_sxw
-
-class pos_payment_report_user(report_sxw.rml_parse):
-
- def __init__(self, cr, uid, name, context):
- super(pos_payment_report_user, self).__init__(cr, uid, name, context=context)
- self.total = 0.0
- self.localcontext.update({
- 'time': time,
- 'pos_payment_user': self.__pos_payment_user__,
- 'pos_payment_user_total':self.__pos_payment_user__total__,
- })
-
- def __pos_payment_user__(self, form):
- data={}
- ids = form['user_id']
- sql = "select pt.name,pp.default_code as code,pol.qty,pu.name as uom,pol.discount,pol.price_unit, " \
- "(pol.price_unit * pol.qty * (1 - (pol.discount) / 100.0)) as total " \
- "from pos_order as po,pos_order_line as pol,product_product as pp,product_template as pt,product_uom as pu " \
- "where pt.id=pp.product_tmpl_id and pp.id=pol.product_id and po.id = pol.order_id and pu.id=pt.uom_id " \
- "and po.state in ('paid','invoiced') and to_char(date_trunc('day',po.date_order),'YYYY-MM-DD')::date = current_date " \
- "and po.user_id IN %s"
- self.cr.execute (sql, (tuple(ids), ))
- data=self.cr.dictfetchall()
- return data
-
- def __pos_payment_user__total__(self, form):
- res=[]
- ids = form['user_id']
- self.cr.execute ("select sum(pol.price_unit * pol.qty * (1 - (pol.discount) / 100.0)) " \
- "from pos_order as po,pos_order_line as pol,product_product as pp,product_template as pt " \
- "where pt.id=pp.product_tmpl_id and pp.id=pol.product_id and po.id = pol.order_id " \
- "and po.state='paid' and to_char(date_trunc('day',po.date_order),'YYYY-MM-DD')::date = current_date " \
- "and po.user_id IN %s",(tuple(ids),))
- res=self.cr.fetchone()
- res = res and res[0] or 0.0
-
- return res
-
-report_sxw.report_sxw('report.pos.payment.report.user', 'pos.order', 'addons/point_of_sale/report/pos_payment_report_user.rml', parser=pos_payment_report_user,header='internal')
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/point_of_sale/report/pos_payment_report_user.rml b/addons/point_of_sale/report/pos_payment_report_user.rml
deleted file mode 100644
index 3671408b760..00000000000
--- a/addons/point_of_sale/report/pos_payment_report_user.rml
+++ /dev/null
@@ -1,205 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- [[ repeatIn(objects,'order') ]]
-
-
-
-
-
-
- Payment By User
-
-
-
-
-
-
- Company
- |
-
- Print Date
- |
-
-
-
-
-
- [[ company.name ]]
- |
-
- [[ formatLang(time.strftime('%Y-%m-%d'),date = True) ]]
- |
-
-
-
-
-
-
-
-
-
-
-
- Product
- |
-
- Qty
- |
-
- Disc(%)
- |
-
- Unit Price
- |
-
- Total
- |
-
-
-
- [[ repeatIn(pos_payment_user(data['form']), 'line_ids') ]]
-
-
-
- [ [[ line_ids['code'] ]] ] [[ line_ids['name'] ]]
- |
-
- [[ formatLang(line_ids['qty']) ]] [[line_ids['uom'] ]]
- |
-
- [[ formatLang(line_ids['discount']) ]]
- |
-
- [[ formatLang(line_ids['price_unit']) ]]
- |
-
- [[ formatLang(line_ids['total'], currency_obj = company.currency_id)]]
- |
-
-
-
-
-
-
-
-
-
- |
-
-
-
-
- |
-
-
-
-
- |
-
- Total:
- |
-
- [[ formatLang(pos_payment_user_total(data['form']), currency_obj = company.currency_id) or removeParentNode('blockTable')]]
- |
-
-
-
-
-
-
-
diff --git a/addons/point_of_sale/report/pos_receipt.py b/addons/point_of_sale/report/pos_receipt.py
index bc9d1853f5b..bba15843a0e 100644
--- a/addons/point_of_sale/report/pos_receipt.py
+++ b/addons/point_of_sale/report/pos_receipt.py
@@ -20,14 +20,17 @@
##############################################################################
import time
+from openerp.osv import osv
from openerp.report import report_sxw
+
def titlize(journal_name):
words = journal_name.split()
while words.pop() != 'journal':
continue
return ' '.join(words)
+
class order(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
@@ -71,6 +74,11 @@ class order(report_sxw.rml_parse):
data = self.cr.dictfetchall()
return data
-report_sxw.report_sxw('report.pos.receipt', 'pos.order', 'addons/point_of_sale/report/pos_receipt.rml', parser=order, header=False)
+
+class report_order_receipt(osv.AbstractModel):
+ _name = 'report.point_of_sale.report_receipt'
+ _inherit = 'report.abstract_report'
+ _template = 'point_of_sale.report_receipt'
+ _wrapped_report_class = order
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/point_of_sale/report/pos_receipt.rml b/addons/point_of_sale/report/pos_receipt.rml
deleted file mode 100644
index 02b8a5b1a1a..00000000000
--- a/addons/point_of_sale/report/pos_receipt.rml
+++ /dev/null
@@ -1,171 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- [[ repeatIn(objects,'o') ]]
- [[o.user_id.company_id.name]]
- [[ address and display_address(address)]]
- Tel : [[ address and address.phone ]]
- User : [[ o.user_id.name ]]
- Warehouse : [[ o.warehouse_id.name ]]
- Date : [[ o.date_order ]]
-
-
-
-
-
-
-
-
-
- N° : [[ o.name ]]
-
-
-
- Description
- |
-
- Qty
- |
-
- Price
- |
-
-
-
- [[ repeatIn(o.lines,'line') ]]
- [[ line.product_id.name ]]
-
- With a [[ line and line.discount == 0.0 and removeParentNode('font') ]] ([[ '%.2f' % line.discount ]]) % discount.
-
-
-
-
- |
-
- [[o.state=='cancel' and o.statement_ids and '-' or '']][['%.f' % line.qty ]]
- |
-
- [[o.state=='cancel' and o.statement_ids and '-' or '']][[ formatLang(net(line.id), currency_obj=company.currency_id) ]] [[ line and line.discount == 0.0 and removeParentNode('font') ]] ([[ formatLang(line.discount, currency_obj=company.currency_id) ]])
- |
-
-
-
-
-
- Taxes :
- |
-
- [[o.state=='cancel' and o.statement_ids and '-' or '']][[formatLang(o.amount_tax, currency_obj=company.currency_id)]]
- |
-
-
-
-
-
- Total :
- |
-
- [[o.state=='cancel' and o.statement_ids and '-' or '']][[formatLang(o.amount_total, currency_obj=company.currency_id)]]
- |
-
-
-
-
-
- Payment Mode
- |
-
-
-
-
- |
-
- Amount
- |
-
-
-
- [[ repeatIn(get_journal_amt(o),'d') ]]
- [[ d['name'] ]]
- |
-
-
-
-
- |
-
- [[ formatLang(d['amt'] or 0, currency_obj=company.currency_id) ]]
- |
-
-
-
-
diff --git a/addons/point_of_sale/report/pos_sales_user.py b/addons/point_of_sale/report/pos_sales_user.py
deleted file mode 100644
index 1da46cc3a22..00000000000
--- a/addons/point_of_sale/report/pos_sales_user.py
+++ /dev/null
@@ -1,50 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# 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 .
-#
-##############################################################################
-
-import time
-from openerp.report import report_sxw
-
-class pos_sales_user(report_sxw.rml_parse):
-
- def __init__(self, cr, uid, name, context):
- super(pos_sales_user, self).__init__(cr, uid, name, context=context)
- self.total = 0.0
- self.localcontext.update({
- 'time': time,
- 'get_data':self._get_data,
-
- })
-
- def _get_data(self, form):
- dt1 = form['date_start'] + ' 00:00:00'
- dt2 = form['date_end'] + ' 23:59:59'
- data={}
- self.cr.execute("select po.name as pos,po.date_order,rp.name as user,po.state,rc.name " \
- "from pos_order as po,res_users as ru,res_company as rc, res_partner as rp " \
- "where po.date_order >= %s and po.date_order <= %s " \
- "and po.company_id=rc.id and po.user_id=ru.id and po.user_id IN %s and ru.partner_id = rp.id" \
- ,(dt1,dt2,tuple(form['user_id'])))
-
- return self.cr.dictfetchall()
-
-report_sxw.report_sxw('report.pos.sales.user', 'pos.order', 'addons/point_of_sale/report/pos_sales_user.rml', parser=pos_sales_user,header='internal')
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/point_of_sale/report/pos_sales_user.rml b/addons/point_of_sale/report/pos_sales_user.rml
deleted file mode 100644
index 8684ea11662..00000000000
--- a/addons/point_of_sale/report/pos_sales_user.rml
+++ /dev/null
@@ -1,175 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- [[ repeatIn(objects,'order') ]]
-
-
-
-
-
-
- Sales Report
-
-
-
-
-
-
- Company
- |
-
- Print Date
- |
-
-
-
-
-
- [[ company.name ]]
- |
-
- [[ formatLang(time.strftime('%Y-%m-%d'),date = True) ]]
- |
-
-
-
-
-
-
-
-
-
-
-
- Name
- |
-
- Date Order
- |
-
- User
- |
-
- Status
- |
-
- Company
- |
-
-
-
- [[ repeatIn(get_data(data['form']), 'line_ids')]]
-
-
-
- [[ line_ids['pos'] ]]
- |
-
- [[ formatLang(line_ids['date_order'],date_time = True) ]]
- |
-
- [[ line_ids['user'] ]]
- |
-
- [[ line_ids['state'] ]]
- |
-
- [[ line_ids['name'] ]]
- |
-
-
-
-
-
-
-
-
diff --git a/addons/point_of_sale/report/pos_sales_user_today.py b/addons/point_of_sale/report/pos_sales_user_today.py
deleted file mode 100644
index 521fbd0adda..00000000000
--- a/addons/point_of_sale/report/pos_sales_user_today.py
+++ /dev/null
@@ -1,50 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# 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 .
-#
-##############################################################################
-
-import time
-from openerp.report import report_sxw
-
-class pos_sales_user_today(report_sxw.rml_parse):
-
- def __init__(self, cr, uid, name, context):
- super(pos_sales_user_today, self).__init__(cr, uid, name, context=context)
- self.total = 0.0
- self.localcontext.update({
- 'time': time,
- 'get_data':self._get_data,
-
- })
-
- def _get_data(self, form):
- data={}
- ids = form['user_id']
-
- self.cr.execute("select po.name as pos,po.date_order,ru.name as user,po.state,rc.name " \
- "from pos_order as po,res_users as ru,res_company as rc " \
- "where to_char(date_trunc('day',po.date_order),'YYYY-MM-DD')::date = current_date " \
- "and po.company_id=rc.id and po.user_id=ru.id and po.user_id IN %s", (tuple(ids), ))
-
- data = self.cr.dictfetchall()
- return data
-
-report_sxw.report_sxw('report.pos.sales.user.today', 'pos.order', 'addons/point_of_sale/report/pos_sales_user_today.rml', parser=pos_sales_user_today,header='internal')
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/point_of_sale/report/pos_sales_user_today.rml b/addons/point_of_sale/report/pos_sales_user_today.rml
deleted file mode 100644
index d036d2d4813..00000000000
--- a/addons/point_of_sale/report/pos_sales_user_today.rml
+++ /dev/null
@@ -1,175 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- [[ repeatIn(objects,'order') ]]
-
-
-
-
-
-
- Today's Sales By User
-
-
-
-
-
-
- Company
- |
-
- Print Date
- |
-
-
-
-
-
- [[ company.name ]]
- |
-
- [[ formatLang(time.strftime('%Y-%m-%d'),date = True) ]]
- |
-
-
-
-
-
-
-
-
-
-
-
- Name
- |
-
- Date Order
- |
-
- User
- |
-
- Status
- |
-
- Company
- |
-
-
-
- [[ repeatIn(get_data(data['form']), 'line_ids')]]
-
-
-
- [[ line_ids['pos'] ]]
- |
-
- [[ formatLang(line_ids['date_order'],date_time = True) ]]
- |
-
- [[ line_ids['user'] ]]
- |
-
- [[ line_ids['state'] ]]
- |
-
- [[ line_ids['name'] ]]
- |
-
-
-
-
-
-
-
-
diff --git a/addons/point_of_sale/report/pos_users_product.py b/addons/point_of_sale/report/pos_users_product.py
index 9dfc89a618d..ba77e327fae 100644
--- a/addons/point_of_sale/report/pos_users_product.py
+++ b/addons/point_of_sale/report/pos_users_product.py
@@ -20,8 +20,10 @@
##############################################################################
import time
+from openerp.osv import osv
from openerp.report import report_sxw
+
class pos_user_product(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
@@ -52,17 +54,27 @@ class pos_user_product(report_sxw.rml_parse):
return data
def _get_user(self, object):
+ names = []
+ users_obj = self.pool['res.users']
for o in object:
- sql = """select ru.name from account_bank_statement as abs,res_users ru
+ sql = """select ru.id from account_bank_statement as abs,res_users ru
where abs.user_id = ru.id
and abs.id = %d"""%(o.id)
self.cr.execute(sql)
data = self.cr.fetchone()
- return data[0]
+ if data:
+ user = users_obj.browse(self.cr, self.uid, data[0])
+ names.append(user.partner_id.name)
+ return list(set(names))
def _get_total(self, o):
return self.total
-report_sxw.report_sxw('report.pos.user.product', 'account.bank.statement', 'addons/statement/report/pos_users_product.rml', parser=pos_user_product,header='internal')
+
+class report_pos_user_product(osv.AbstractModel):
+ _name = 'report.point_of_sale.report_usersproduct'
+ _inherit = 'report.abstract_report'
+ _template = 'point_of_sale.report_usersproduct'
+ _wrapped_report_class = pos_user_product
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/point_of_sale/report/pos_users_product.py.WORK b/addons/point_of_sale/report/pos_users_product.py.WORK
deleted file mode 100644
index 51ab021e650..00000000000
--- a/addons/point_of_sale/report/pos_users_product.py.WORK
+++ /dev/null
@@ -1,68 +0,0 @@
-# -*- encoding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2009 Tiny SPRL (). 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 .
-#
-##############################################################################
-import time
-from report import report_sxw
-
-
-class pos_user_product(report_sxw.rml_parse):
-
- def __init__(self, cr, uid, name, context):
- super(pos_user_product, self).__init__(cr, uid, name, context)
- self.total = 0.0
- self.localcontext.update({
- 'time': time,
- 'get_data':self._get_data,
- 'get_user':self._get_user,
- 'get_total':self._get_total,
-
- })
- def _get_data(self,object):
- data={}
- for o in object :
- sql1=""" SELECT distinct(o.id) from account_bank_statement s, account_bank_statement_line l,pos_order o,pos_order_line i where i.order_id=o.id and o.state in ('paid','invoiced') and l.statement_id=s.id and l.pos_statement_id=o.id and s.id=%d"""%(o.id)
- self.cr.execute(sql1)
- data = self.cr.dictfetchall()
- a_l=[]
- for r in data:
- if r['id']:
- a_l.append(r['id'])
- a = ','.join(map(str,a_l))
- if len(a_l):
- sql2="""SELECT sum(qty) as qty,l.price_unit*sum(l.qty) as amt,t.name as name from product_product p, product_template t, pos_order_line l where order_id in (%s) and p.product_tmpl_id=t.id and l.product_id=p.id group by t.name, l.price_unit"""%(a)
- self.cr.execute(sql2)
- data = self.cr.dictfetchall()
- for d in data:
- self.total += d['amt']
- return data
-
- def _get_user(self,object):
- for o in object :
- sql = """select ru.name from account_bank_statement as abs,res_users ru
- where abs.user_id = ru.id
- and abs.id = %d"""%(o.id)
- self.cr.execute(sql)
- data = self.cr.fetchone()
- return data[0]
- def _get_total(self):
- return self.total
-
-report_sxw.report_sxw('report.pos.user.product', 'account.bank.statement', 'addons/statement/report/pos_users_product.rml', parser=pos_user_product)
diff --git a/addons/point_of_sale/report/pos_users_product.rml b/addons/point_of_sale/report/pos_users_product.rml
deleted file mode 100644
index 9758e924ada..00000000000
--- a/addons/point_of_sale/report/pos_users_product.rml
+++ /dev/null
@@ -1,219 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- [[ repeatIn(objects,'statement') ]]
-
-
-
-
-
-
- User's Product
-
-
-
-
-
-
-
-
-
- User
- |
-
- Company
- |
-
- Print Date
- |
-
- Starting Date
- |
-
- Ending Date
- |
-
-
-
-
-
- [[ get_user(objects) ]]
- |
-
- [[ company.name ]]
- |
-
- [[ formatLang(time.strftime('%Y-%m-%d'),date = True) ]]
- |
-
- [[ formatLang(statement.date,date = True) ]]
- |
-
- [[ formatLang(statement.closing_date,date_time = True) ]]
- |
-
-
-
-
-
-
-
-
- Product
- |
-
- Qty
- |
-
- Amount
- |
-
-
-
- [[ repeatIn(get_data(statement), 'line_ids') and ' ' or removeParentNode('blockTable') ]]
-
- [[ repeatIn(get_data(statement), 'line_ids')]]
-
-
-
- [ [[line_ids['code'] ]] ] [[ line_ids['name'] ]]
- |
-
- [[ formatLang(line_ids['qty']) ]] [[line_ids['uom'] ]]
- |
-
- [[ formatLang(line_ids['amt'], currency_obj = company.currency_id) ]]
- |
-
-
-
-
-
-
-
-
-
-
- |
-
- Total :
- |
-
- [[ formatLang(get_total(statement), currency_obj = company.currency_id) ]]
- |
-
-
-
-
-
-
-
diff --git a/addons/point_of_sale/test/02_order_to_invoice.yml b/addons/point_of_sale/test/02_order_to_invoice.yml
index bd76eb08a9c..ea63b24c58c 100644
--- a/addons/point_of_sale/test/02_order_to_invoice.yml
+++ b/addons/point_of_sale/test/02_order_to_invoice.yml
@@ -36,11 +36,16 @@
- state == 'paid'
- not invoice_id
-
- I generate the invoice by pressing the Invoice button that calls the workflow
+ I set the order as invoiced
-
!workflow {model: pos.order, action: invoice, ref: pos_order_pos1}
+-
+ I generate an invoice from the order
+-
+ !python {model: pos.order}: |
+ invoice = self.action_invoice(cr, uid, [ref('pos_order_pos1')])
-
I test that the total of the attached invoice is correct
-
- !assert {model: pos.order, id: pos_order_pos1, string: Invoice not correct}:
- - amount_total == (450*2 + 300*3*1.05)*0.95
+ !assert {model: pos.order, id: pos_order_pos1, string: Invoice inconsistent with its origin order}:
+ - invoice_id.amount_total == 1795.5
diff --git a/addons/point_of_sale/test/account_statement_reports.yml b/addons/point_of_sale/test/account_statement_reports.yml
new file mode 100644
index 00000000000..30eb7d5741d
--- /dev/null
+++ b/addons/point_of_sale/test/account_statement_reports.yml
@@ -0,0 +1,83 @@
+-
+ In order to test Bank Statement feature of account I create a bank statement line and confirm it and check it's move created
+-
+ I select the period and journal for the bank statement
+-
+ !python {model: account.bank.statement}: |
+ import time
+ journal = self._default_journal_id(cr, uid, {'lang': u'en_US', 'tz': False, 'active_model': 'ir.ui.menu',
+ 'journal_type': 'bank', 'period_id': time.strftime('%m'), 'active_ids': [ref('account.menu_bank_statement_tree')], 'active_id': ref('account.menu_bank_statement_tree')})
+ assert journal, 'Journal has not been selected'
+-
+ I create a bank statement with Opening and Closing balance 0.
+-
+ !record {model: account.bank.statement, id: account_bank_statement_0}:
+ balance_end_real: 0.0
+ balance_start: 0.0
+ date: !eval time.strftime('%Y-%m-%d')
+ journal_id: account.bank_journal
+-
+ I create bank statement line
+-
+ !python {model: account.bank.statement.line}: |
+ partner = self.onchange_partner_id(cr, uid, [], ref('base.res_partner_4'), context=None)
+ vals = {
+ 'account_id': partner['value']['account_id'],
+ 'amount': 1000.0,
+ 'partner_id': ref('base.res_partner_4'),
+ 'statement_id': ref('account_bank_statement_0'),
+ 'name': 'EXT001'
+ }
+ vals.update(partner.get('value',{}))
+ line_id = self.create(cr, uid, vals)
+ assert line_id, "Account bank statement line has not been created"
+-
+ I compute bank statement using Compute button
+-
+ !python {model: account.bank.statement}: |
+ self.button_dummy(cr, uid, [ref("account_bank_statement_0")])
+
+-
+ I modify the bank statement and set the Closing Balance.
+-
+ !record {model: account.bank.statement, id: account_bank_statement_0}:
+ balance_end_real: 1000.0
+
+-
+ I confirm the bank statement using Confirm button
+-
+ !python {model: account.bank.statement}: |
+ self.button_confirm_bank(cr, uid, [ref("account_bank_statement_0")])
+-
+ Print the account statement report
+-
+ !python {model: account.bank.statement}: |
+ import os
+ import openerp.report
+ from openerp import tools
+ data, format = openerp.report.render_report(cr, uid, [ref('account_bank_statement_0')], 'point_of_sale.report_statement', {}, {})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'point_of_sale-statement.'+format), 'wb+').write(data)
+
+-
+ Print the closed cashbox of the day report
+-
+ !python {model: account.bank.statement}: |
+ import os
+ import openerp.report
+ from openerp import tools
+ data, format = openerp.report.render_report(cr, uid, [ref('account_bank_statement_0')], 'point_of_sale.report_closedcashbox', {}, {})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'point_of_sale-closedcashbox.'+format), 'wb+').write(data)
+
+-
+ Printing the user s product report
+-
+ !python {model: account.bank.statement}: |
+ import os
+ import openerp.report
+ from openerp import tools
+ data, format = openerp.report.render_report(cr, uid, [ref('account_bank_statement_0')], 'point_of_sale.report_usersproduct', {}, {})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'point_of_sale-usersproduct.'+format), 'wb+').write(data)
+
diff --git a/addons/point_of_sale/test/point_of_sale_report.yml b/addons/point_of_sale/test/point_of_sale_report.yml
index af034c8f23e..0dda85879c6 100644
--- a/addons/point_of_sale/test/point_of_sale_report.yml
+++ b/addons/point_of_sale/test/point_of_sale_report.yml
@@ -1,14 +1,3 @@
--
- In order to test the PDF reports defined on a Point Of Sale,we will print a POS Detail Summary Report
--
- !python {model: pos.order}: |
- import os
- import openerp.report
- from openerp import tools
- data, format = openerp.report.render_report(cr, uid, [ref('point_of_sale.pos_order_pos1')], 'pos.details_summary', {}, {})
- if tools.config['test_report_directory']:
- file(os.path.join(tools.config['test_report_directory'], 'point_of_sale-details_summary report'+format), 'wb+').write(data)
-
-
In order to test the PDF reports defined on a Point Of Sale, we will print a POS Invoice Report
-
@@ -16,7 +5,7 @@
import os
import openerp.report
from openerp import tools
- data, format = openerp.report.render_report(cr, uid, [ref('point_of_sale.pos_order_pos1')], 'pos.invoice', {}, {})
+ data, format = openerp.report.render_report(cr, uid, [ref('pos_order_pos1')], 'point_of_sale.report_invoice', {}, {})
if tools.config['test_report_directory']:
file(os.path.join(tools.config['test_report_directory'], 'point_of_sale-invoice report'+format), 'wb+').write(data)
@@ -27,7 +16,7 @@
import os
import openerp.report
from openerp import tools
- data, format = openerp.report.render_report(cr, uid, [ref('point_of_sale.pos_order_pos1')], 'pos.lines', {}, {})
+ data, format = openerp.report.render_report(cr, uid, [ref('pos_order_pos1')], 'point_of_sale.report_saleslines', {}, {})
if tools.config['test_report_directory']:
file(os.path.join(tools.config['test_report_directory'], 'point_of_sale-lines report'+format), 'wb+').write(data)
@@ -38,7 +27,7 @@
import os
import openerp.report
from openerp import tools
- data, format = openerp.report.render_report(cr, uid, [ref('point_of_sale.pos_order_pos1')], 'pos.receipt', {}, {})
+ data, format = openerp.report.render_report(cr, uid, [ref('pos_order_pos1')], 'point_of_sale.report_receipt', {}, {})
if tools.config['test_report_directory']:
file(os.path.join(tools.config['test_report_directory'], 'point_of_sale-receipt report'+format), 'wb+').write(data)
@@ -53,17 +42,6 @@
from openerp.tools import test_reports
test_reports.try_report_action(cr, uid, 'action_report_pos_details',wiz_data=data_dict, context=ctx, our_module='point_of_sale')
--
- In order to test the PDF reports defined on a Point of Sale, we will print a POS Sales User Report
--
- !python {model: pos.order}: |
- import os, time
- import openerp.report
- from openerp import tools
- data_dict = {'model':'ir.ui.menu', 'form':{'date_start': time.strftime('%Y-%m-%d'), 'date_end': time.strftime('%Y-%m-%d'),'user_id':[ref('base.user_root')] }}
- data, format = openerp.report.render_report(cr, uid, [ref('point_of_sale.pos_order_pos1')], 'pos.sales.user', data_dict, {})
- if tools.config['test_report_directory']:
- file(os.path.join(tools.config['test_report_directory'], 'point_of_sale-sales_user_report'+format), 'wb+').write(data)
-
In order to test the PDF reports defined on a Point of Sale, we will print a POS Payment Report
-
@@ -71,17 +49,6 @@
import os, time
import openerp.report
from openerp import tools
- data, format = openerp.report.render_report(cr, uid, [ref('point_of_sale.pos_order_pos0')], 'pos.payment.report', {}, {})
+ data, format = openerp.report.render_report(cr, uid, [ref('pos_order_pos0')], 'point_of_sale.report_payment', {}, {})
if tools.config['test_report_directory']:
file(os.path.join(tools.config['test_report_directory'], 'point_of_sale-payment_report'+format), 'wb+').write(data)
--
- In order to test the PDF reports defined on a Point of Sale, we will print a POS Payment User Report
--
- !python {model: pos.order}: |
- import os, time
- import openerp.report
- from openerp import tools
- data_dict = {'model':'ir.ui.menu', 'form':{'user_id':[ref('base.user_root'),ref('base.user_demo')] }}
- data, format = openerp.report.render_report(cr, uid, [ref('point_of_sale.pos_order_pos1')], 'pos.payment.report.user', data_dict, {})
- if tools.config['test_report_directory']:
- file(os.path.join(tools.config['test_report_directory'], 'point_of_sale-payment_user_report'+format), 'wb+').write(data)
diff --git a/addons/point_of_sale/views/report_closedcashbox.xml b/addons/point_of_sale/views/report_closedcashbox.xml
new file mode 100644
index 00000000000..4b936468341
--- /dev/null
+++ b/addons/point_of_sale/views/report_closedcashbox.xml
@@ -0,0 +1,68 @@
+
+
+
+
+
+
+
+
+
Today's Closed Cashbox
+
User:
+
+
+
+
+ St.Name |
+ Journal |
+ Opening Date |
+ Closing Date |
+ Starting Balance |
+ Ending Balance |
+
+
+ Total: |
+ |
+
+
+ |
+
+
+ |
+
+
+
+
+
+ |
+ |
+ |
+ |
+
+
+
+
+ |
+
+
+
+
+ |
+
+
+ |
+ |
+ |
+
+
+ |
+
+
+
+
+
+
+
+
+
+
+
diff --git a/addons/point_of_sale/views/report_detailsofsales.xml b/addons/point_of_sale/views/report_detailsofsales.xml
new file mode 100644
index 00000000000..5f9fa48752d
--- /dev/null
+++ b/addons/point_of_sale/views/report_detailsofsales.xml
@@ -0,0 +1,140 @@
+
+
+
+
+
+
+
+
Details of Sales
+
+
+
+ Company:
+
+
+
+ Users:
+
+
+
+ Print Date:
+
+
+
+
+
+ Start Period:
+
+
+
+ End Period:
+
+
+
+
+
+
+ Date |
+ Order |
+ Product |
+ Price |
+ Qty |
+ Disc(%) |
+ Invoiced |
+
+
+
+
+
+ |
+
+
+ |
+
+ [
+
+ ]
+
+ |
+
+
+ |
+
+
+
+ |
+
+
+ |
+
+
+
+
+ |
+
+
+
+
+
+ Taxes |
+
+ |
+
+
+ |
+
+
+ Payment |
+
+
+ |
+
+
+ |
+
+
+ Summary |
+
+
+ Sales total(Revenue) |
+
+
+ |
+
+
+ Qty of product |
+
+
+ |
+
+
+ Total invoiced |
+
+
+ |
+
+
+ Total discount |
+
+
+ |
+
+
+ Total paid |
+
+
+ |
+
+
+ Total of the day |
+
+
+ |
+
+
+
+
+
+
+
+
diff --git a/addons/point_of_sale/views/report_payment.xml b/addons/point_of_sale/views/report_payment.xml
new file mode 100644
index 00000000000..82bc4f7c35b
--- /dev/null
+++ b/addons/point_of_sale/views/report_payment.xml
@@ -0,0 +1,90 @@
+
+
+
+
+
+
+
+
Today's Payments
+
+
+
+ Company:
+
+
+
+ Print date:
+
+
+
+
+
+
+
+
+
+ Product
+ |
+
+ Qty
+ |
+
+ Disc.(%)
+ |
+
+ Unit Price
+ |
+
+ Total
+ |
+
+
+
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+
+
+
+
+
+
+ Net Total:
+ |
+
+
+ |
+
+
+
+
+
+
+
+
+
+
+
diff --git a/addons/point_of_sale/views/report_receipt.xml b/addons/point_of_sale/views/report_receipt.xml
new file mode 100644
index 00000000000..70b2d8a3dc4
--- /dev/null
+++ b/addons/point_of_sale/views/report_receipt.xml
@@ -0,0 +1,92 @@
+
+
+
+
+
+
+
+
+
+
+
+ User:
+ Warehouse:
+ Date:
+
+
+
+
+
+
+
+
+
+ Description |
+ Quantity |
+ Price |
+
+
+
+
+ |
+
+
+
+
+ |
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+ Taxes |
+
+
+ |
+
+
+ Total |
+
+
+ |
+
+
+
+
+
+
+
+
+ Payment Mode |
+ Amount |
+
+
+
+
+
+
+ |
+
+
+ |
+
+
+
+
+
+
+
+
+
diff --git a/addons/point_of_sale/views/report_saleslines.xml b/addons/point_of_sale/views/report_saleslines.xml
new file mode 100644
index 00000000000..a3f479c5d84
--- /dev/null
+++ b/addons/point_of_sale/views/report_saleslines.xml
@@ -0,0 +1,98 @@
+
+
+
+
+
+
+
+
+
POS Lines
+
+
+
+ Company:
+
+
+
+ Print date:
+
+
+
+ No. Of Articles:
+
+
+
+
+
+
+
+ Description |
+ Tax |
+ Quantity |
+ Unit Price |
+ Disc. (%) |
+ Price |
+
+
+
+
+
+
+ []
+
+
+ |
+
+
+ |
+
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+
+
+
+
+
+
+ Total Without Taxes |
+
+
+ |
+
+
+ Taxes |
+
+
+ |
+
+
+ Total |
+
+
+ |
+
+
+
+
+
+
+
+
+
+
+
diff --git a/addons/point_of_sale/views/report_statement.xml b/addons/point_of_sale/views/report_statement.xml
new file mode 100644
index 00000000000..4234d0b997b
--- /dev/null
+++ b/addons/point_of_sale/views/report_statement.xml
@@ -0,0 +1,85 @@
+
+
+
+
+
+
+
+
+
Statement
+
+
+
+ Statement Name:
+
+
+
+ Journal:
+
+
+
+ Company:
+
+
+
+ User:
+
+
+
+
+
+
+ Opening Date:
+
+
+
+ Closing Date:
+
+
+
+ Starting Balance:
+
+
+
+ Ending Balance:
+
+
+
+
+
+
+
+ Name |
+ Partner |
+ Amount |
+
+
+
+
+ |
+ |
+
+
+ |
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/addons/point_of_sale/views/report_usersproduct.xml b/addons/point_of_sale/views/report_usersproduct.xml
new file mode 100644
index 00000000000..9a3614e43d3
--- /dev/null
+++ b/addons/point_of_sale/views/report_usersproduct.xml
@@ -0,0 +1,79 @@
+
+
+
+
+
+
+
+
+
User's Product
+
+
+
+ User:
+
+
+
+ Company:
+
+
+
+ Print Date:
+
+
+
+ Starting Date:
+
+
+
+
+
+
+
+
+
+ Product |
+ Qty |
+ Amount |
+
+
+
+
+
+ []
+
+
+ |
+
+
+
+ |
+
+
+ |
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/addons/point_of_sale/wizard/__init__.py b/addons/point_of_sale/wizard/__init__.py
index 0f97a054533..744170cebef 100644
--- a/addons/point_of_sale/wizard/__init__.py
+++ b/addons/point_of_sale/wizard/__init__.py
@@ -19,18 +19,12 @@
#
##############################################################################
+import pos_box
import pos_confirm
+import pos_details
import pos_discount
import pos_open_statement
-import pos_details
-import pos_sales_user
-import pos_sales_user_today
-import pos_receipt
-import pos_payment_report_user
-import pos_payment_report
import pos_payment
import pos_session_opening
-import pos_box
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/point_of_sale/wizard/pos_box.py b/addons/point_of_sale/wizard/pos_box.py
index e1fa90844d7..ad6719343d8 100644
--- a/addons/point_of_sale/wizard/pos_box.py
+++ b/addons/point_of_sale/wizard/pos_box.py
@@ -1,5 +1,5 @@
-from openerp.osv import osv, fields
+from openerp.osv import osv
from openerp.tools.translate import _
from openerp.addons.account.wizard.pos_box import CashBox
diff --git a/addons/point_of_sale/wizard/pos_box_entries.py b/addons/point_of_sale/wizard/pos_box_entries.py
deleted file mode 100644
index 8ca4f01b006..00000000000
--- a/addons/point_of_sale/wizard/pos_box_entries.py
+++ /dev/null
@@ -1,146 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# 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 .
-#
-##############################################################################
-
-import time
-
-from openerp.osv import osv, fields
-from openerp.tools.translate import _
-
-
-def get_journal(self, cr, uid, context=None):
- """
- 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
- """
-
- journal_obj = self.pool.get('account.journal')
- statement_obj = self.pool.get('account.bank.statement')
-
- j_ids = journal_obj.search(cr, uid, [('journal_user','=',1)], context=context)
- obj_ids = statement_obj.search(cr, uid, [('state', '=', 'open'), ('user_id', '=', uid), ('journal_id', 'in', j_ids)], context=context)
- res = statement_obj.read(cr, uid, obj_ids, ['journal_id'], context=context)
- res = [(r['journal_id']) for r in res]
- if not len(res) and context:
- raise osv.except_osv(_('Error!'), _('You do not have any open cash register. You must create a payment method or open a cash register.'))
- 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=None):
- """
- 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
- """
- product_obj = self.pool.get('product.product')
- ids = product_obj.search(cr, uid, [('income_pdt', '=', True)], context=context)
- res = product_obj.read(cr, uid, ids, ['id', 'name'], context=context)
- res = [(r['id'], r['name']) for r in res]
- res.insert(0, ('', ''))
-
- return res
-
- _columns = {
- 'name': fields.char('Reason', size=32, required=True),
- 'journal_id': fields.many2one('account.journal', 'Cash Register', required=True, domain="[('journal_id.type', '=', 'cash')]"),
- 'product_id': fields.selection(_get_income_product, "Operation", required=True, size=-1),
- 'amount': fields.float('Amount', digits=(16, 2), required=True),
- 'ref': fields.char('Ref', size=32),
- 'session_id' : fields.many2one('pos.session', 'Session'),
- 'user_id' : fields.many2one('res.users', 'User'),
- }
-
- def _default_session_id(self, cr, uid, context=None):
- return context and context.get('active_id', False) or False
-
- def _default_cash_register(self, cr, uid, context=None):
-
- #import pdb
- #pdb.set_trace()
- if not context:
- context = {}
- result = context.get('active_id', False) or False
-
- return result
-
- _defaults = {
- #'session_id' : _default_session_id,
- #'journal_id': _default_cash_register,
- #'product_id': 1,
- 'user_id' : lambda obj, cr, uid, context: uid,
- }
-
- def get_in(self, cr, uid, ids, context=None):
- """
- 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')
- 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, context=context):
- vals = {}
- curr_company = res_obj.browse(cr, uid, uid, context=context).company_id.id
- statement_id = statement_obj.search(cr, uid, [('journal_id', '=', int(data['journal_id'])), ('company_id', '=', curr_company), ('user_id', '=', uid), ('state', '=', 'open')], context=context)
- if not statement_id:
- raise osv.except_osv(_('Error!'), _('You have to open at least one cashbox.'))
-
- product = product_obj.browse(cr, uid, int(data['product_id']))
- acc_id = product.property_account_income or product.categ_id.property_account_income_categ
- if not acc_id:
- raise osv.except_osv(_('Error!'), _('Please check that income 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,
- }, context=context)
-
- vals['statement_id'] = statement_id
- vals['journal_id'] = data['journal_id']
- if acc_id:
- vals['account_id'] = acc_id.id
- vals['amount'] = data['amount'] or 0.0
- vals['ref'] = "%s" % (data['ref'] or '')
- vals['name'] = "%s: %s " % (product_obj.browse(cr, uid, data['product_id'], context=context).name, data['name'].decode('utf8'))
- bank_statement.create(cr, uid, vals, context=context)
- return {}
-
-
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/point_of_sale/wizard/pos_box_entries.xml b/addons/point_of_sale/wizard/pos_box_entries.xml
deleted file mode 100644
index 913f3b17b20..00000000000
--- a/addons/point_of_sale/wizard/pos_box_entries.xml
+++ /dev/null
@@ -1,50 +0,0 @@
-
-
-
-
-
-
- Box Entries
- pos.box.entries
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/addons/point_of_sale/wizard/pos_box_out.py b/addons/point_of_sale/wizard/pos_box_out.py
deleted file mode 100644
index 51c3993183b..00000000000
--- a/addons/point_of_sale/wizard/pos_box_out.py
+++ /dev/null
@@ -1,105 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# 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 .
-#
-##############################################################################
-
-import time
-from datetime import datetime
-from dateutil.relativedelta import relativedelta
-
-from openerp.osv import fields, osv
-from openerp.tools.translate import _
-import 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=None):
- """
- 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
- """
- product_obj = self.pool.get('product.product')
- company_id = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.id
- ids = product_obj.search(cr, uid, ['&', ('expense_pdt', '=', True), '|', ('company_id', '=', company_id), ('company_id', '=', None)], context=context)
- res = product_obj.read(cr, uid, ids, ['id', 'name'], context=context)
- res = [(r['id'], r['name']) for r in res]
- return res
-
- _columns = {
- 'name': fields.char('Description / Reason', size=32, required=True),
- 'journal_id': fields.selection(pos_box_entries.get_journal, "Cash Register", required=True, size=-1),
- 'product_id': fields.selection(_get_expense_product, "Operation", required=True, size=-1),
- 'amount': fields.float('Amount', digits=(16, 2), required=True),
- 'session_id' : fields.many2one('pos.session', 'Session'),
- 'user_id' : fields.many2one('res.users', 'User'),
- }
- _defaults = {
- 'journal_id': 1,
- 'product_id': 1,
- 'user_id' : lambda obj, cr, uid, context: uid,
- }
- def get_out(self, cr, uid, ids, context=None):
-
- """
- 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
- """
- vals = {}
- statement_obj = self.pool.get('account.bank.statement')
- statement_line_obj = self.pool.get('account.bank.statement.line')
- product_obj = self.pool.get('product.product')
- res_obj = self.pool.get('res.users')
- for data in self.read(cr, uid, ids, context=context):
- curr_company = res_obj.browse(cr, uid, uid, context=context).company_id.id
- statement_ids = statement_obj.search(cr, uid, [('journal_id', '=', data['journal_id']), ('company_id', '=', curr_company), ('user_id', '=', uid), ('state', '=', 'open')], context=context)
- monday = (datetime.today() + relativedelta(weekday=0)).strftime('%Y-%m-%d')
- sunday = (datetime.today() + relativedelta(weekday=6)).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)], context=context)
- stat_done = statement_obj.browse(cr, uid, done_statmt, context=context)
- am = 0.0
- product = product_obj.browse(cr, uid, data['product_id'], context=context)
- acc_id = product.property_account_expense or product.categ_id.property_account_expense_categ
- if not acc_id:
- raise osv.except_osv(_('Error!'), _('please check that account is set to %s.')%(product.name))
- if not statement_ids:
- raise osv.except_osv(_('Error!'), _('You have to open at least one cashbox.'))
- vals['statement_id'] = statement_ids[0]
- vals['journal_id'] = data['journal_id']
- vals['account_id'] = acc_id.id
- amount = data['amount'] or 0.0
- if data['amount'] > 0:
- amount = -data['amount']
- vals['amount'] = amount
- vals['name'] = "%s: %s " % (product.name, data['name'])
- statement_line_obj.create(cr, uid, vals, context=context)
- return {}
-
-
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/point_of_sale/wizard/pos_box_out.xml b/addons/point_of_sale/wizard/pos_box_out.xml
deleted file mode 100644
index 750630ac4db..00000000000
--- a/addons/point_of_sale/wizard/pos_box_out.xml
+++ /dev/null
@@ -1,48 +0,0 @@
-
-
-
-
-
-
- Box Out
- pos.box.out
-
-
-
-
-
-
-
-
-
-
-
diff --git a/addons/point_of_sale/wizard/pos_confirm.py b/addons/point_of_sale/wizard/pos_confirm.py
index 6a031f54f61..d1ecdfb4e0e 100644
--- a/addons/point_of_sale/wizard/pos_confirm.py
+++ b/addons/point_of_sale/wizard/pos_confirm.py
@@ -50,4 +50,3 @@ class pos_confirm(osv.osv_memory):
return {}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/point_of_sale/wizard/pos_confirm.xml b/addons/point_of_sale/wizard/pos_confirm.xml
index 626c99e1069..77eead67bce 100644
--- a/addons/point_of_sale/wizard/pos_confirm.xml
+++ b/addons/point_of_sale/wizard/pos_confirm.xml
@@ -17,16 +17,5 @@
-
-
diff --git a/addons/point_of_sale/wizard/pos_details.py b/addons/point_of_sale/wizard/pos_details.py
index bfd6e7c4ca7..1d34cd5c346 100644
--- a/addons/point_of_sale/wizard/pos_details.py
+++ b/addons/point_of_sale/wizard/pos_details.py
@@ -20,9 +20,9 @@
##############################################################################
import time
-
from openerp.osv import osv, fields
+
class pos_details(osv.osv_memory):
_name = 'pos.details'
_description = 'Sales Details'
@@ -54,12 +54,6 @@ class pos_details(osv.osv_memory):
datas['form'] = res
if res.get('id',False):
datas['ids']=[res['id']]
- return {
- 'type': 'ir.actions.report.xml',
- 'report_name': 'pos.details',
- 'datas': datas,
- }
-
+ return self.pool['report'].get_action(cr, uid, [], 'point_of_sale.report_detailsofsales', data=datas, context=context)
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/point_of_sale/wizard/pos_discount.py b/addons/point_of_sale/wizard/pos_discount.py
index d60b2766644..735e4c1681e 100644
--- a/addons/point_of_sale/wizard/pos_discount.py
+++ b/addons/point_of_sale/wizard/pos_discount.py
@@ -21,6 +21,7 @@
from openerp.osv import osv, fields
+
class pos_discount(osv.osv_memory):
_name = 'pos.discount'
_description = 'Add a Global Discount'
@@ -31,21 +32,6 @@ class pos_discount(osv.osv_memory):
'discount': 5,
}
-# def view_init(self, cr, uid, fields_list, context=None):
-# """
-# Creates view dynamically and adding fields at runtime.
-# @param self: The object pointer.
-# @param cr: A database cursor
-# @param uid: ID of the user currently logged in
-# @param context: A standard dictionary
-# @return: New arch of view with new columns.
-# """
-# if context is None:
-# context = {}
-# super(pos_discount, self).view_init(cr, uid, fields_list, context=context)
-# record_id = context and context.get('active_id', False) or False
-# True
-
def apply_discount(self, cr, uid, ids, context=None):
"""
To give the discount of product and check the.
@@ -68,5 +54,4 @@ class pos_discount(osv.osv_memory):
order_line_ref.write(cr, uid, [x.id for x in order.lines], {'discount':this.discount}, context=context)
return {}
-
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/point_of_sale/wizard/pos_payment.py b/addons/point_of_sale/wizard/pos_payment.py
index 02223153290..fc03ff4a281 100644
--- a/addons/point_of_sale/wizard/pos_payment.py
+++ b/addons/point_of_sale/wizard/pos_payment.py
@@ -21,11 +21,10 @@
import time
-import pos_box_entries
-
from openerp.osv import osv, fields
from openerp.tools.translate import _
+
class account_journal(osv.osv):
_inherit = 'account.journal'
@@ -43,6 +42,7 @@ class account_journal(osv.osv):
return super(account_journal, self).search(cr, uid, args, offset=offset, limit=limit, order=order, context=context, count=count)
+
class pos_make_payment(osv.osv_memory):
_name = 'pos.make.payment'
_description = 'Point of Sale Payment'
@@ -53,7 +53,6 @@ class pos_make_payment(osv.osv_memory):
"""
context = context or {}
order_obj = self.pool.get('pos.order')
- obj_partner = self.pool.get('res.partner')
active_id = context and context.get('active_id', False)
order = order_obj.browse(cr, uid, active_id, context=context)
@@ -128,6 +127,4 @@ class pos_make_payment(osv.osv_memory):
'amount': _default_amount,
}
-
-
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/point_of_sale/wizard/pos_payment_report.py b/addons/point_of_sale/wizard/pos_payment_report.py
deleted file mode 100644
index a591fd4ce5f..00000000000
--- a/addons/point_of_sale/wizard/pos_payment_report.py
+++ /dev/null
@@ -1,48 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# 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 .
-#
-##############################################################################
-
-from openerp.osv import osv
-
-class pos_payment_report(osv.osv_memory):
- _name = 'pos.payment.report'
- _description = 'Payment Report'
-
- 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
- """
- if context is None:
- context = {}
- datas = {'ids': context.get('active_ids', [])}
- return {
- 'type': 'ir.actions.report.xml',
- 'report_name': 'pos.payment.report',
- 'datas': datas,
- }
-
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/point_of_sale/wizard/pos_payment_report.xml b/addons/point_of_sale/wizard/pos_payment_report.xml
deleted file mode 100644
index 6ba34ffab8c..00000000000
--- a/addons/point_of_sale/wizard/pos_payment_report.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-
-
-
-
- Payment Report
- pos.payment.report
-
-
-
-
-
-
- Payment Report
- ir.actions.act_window
- pos.payment.report
- form
- form
- new
-
-
-
-
-
diff --git a/addons/point_of_sale/wizard/pos_payment_report_user.py b/addons/point_of_sale/wizard/pos_payment_report_user.py
deleted file mode 100644
index 37a62783ed2..00000000000
--- a/addons/point_of_sale/wizard/pos_payment_report_user.py
+++ /dev/null
@@ -1,54 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# 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 .
-#
-##############################################################################
-
-from openerp.osv import osv, fields
-
-class pos_payment_report_user(osv.osv_memory):
- _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
- """
- if context is None:
- context = {}
- datas = {'ids': context.get('active_ids', [])}
- res = self.read(cr, uid, ids, ['user_id'], context=context)
- 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', 'Salesperson')
- }
-
-
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/point_of_sale/wizard/pos_payment_report_user.xml b/addons/point_of_sale/wizard/pos_payment_report_user.xml
deleted file mode 100644
index 3f109616b34..00000000000
--- a/addons/point_of_sale/wizard/pos_payment_report_user.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-
-
-
-
- Payment Report
- pos.payment.report
-
-
-
-
-
-
-
- Pyament Report
- ir.actions.act_window
- pos.payment.report
- form
- form
- new
-
-
-
-
diff --git a/addons/point_of_sale/wizard/pos_payment_report_user_view.xml b/addons/point_of_sale/wizard/pos_payment_report_user_view.xml
deleted file mode 100644
index 3ec4db98305..00000000000
--- a/addons/point_of_sale/wizard/pos_payment_report_user_view.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-
-
- pos.payment.report.user.form
- pos.payment.report.user
-
-
-
-
-
- Sales lines by Users
- ir.actions.act_window
- pos.payment.report.user
- form
- form
- new
-
-
-
diff --git a/addons/point_of_sale/wizard/pos_receipt.py b/addons/point_of_sale/wizard/pos_receipt.py
deleted file mode 100644
index 3e6714f3ac7..00000000000
--- a/addons/point_of_sale/wizard/pos_receipt.py
+++ /dev/null
@@ -1,59 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# 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 .
-#
-##############################################################################
-
-from openerp.osv import osv
-from openerp.tools.translate import _
-
-class pos_receipt(osv.osv_memory):
- _name = 'pos.receipt'
- _description = 'Point of sale receipt'
-
- def view_init(self, cr, uid, fields_list, context=None):
- """
- Creates view dynamically and adding fields at runtime.
- @param self: The object pointer.
- @param cr: A database cursor
- @param uid: ID of the user currently logged in
- @param context: A standard dictionary
- @return: New arch of view with new columns.
- """
- order_lst = self. pool.get('pos.order').browse(cr, uid, context['active_id'], context=context)
-
- 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
- """
- if context is None:
- context = {}
- datas = {'ids': context.get('active_ids', [])}
- return {
- 'type': 'ir.actions.report.xml',
- 'report_name': 'pos.receipt',
- 'datas': datas,
- }
-
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/point_of_sale/wizard/pos_receipt_view.xml b/addons/point_of_sale/wizard/pos_receipt_view.xml
deleted file mode 100644
index ed7c4ac1d93..00000000000
--- a/addons/point_of_sale/wizard/pos_receipt_view.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
-
-
-
- Receipt
- pos.receipt
-
-
-
-
-
-
- Receipt
- pos.receipt
- form
- form
- new
-
-
-
diff --git a/addons/point_of_sale/wizard/pos_return.py b/addons/point_of_sale/wizard/pos_return.py
deleted file mode 100644
index 92bb6721f08..00000000000
--- a/addons/point_of_sale/wizard/pos_return.py
+++ /dev/null
@@ -1,323 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# 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 .
-#
-##############################################################################
-
-from openerp.osv import osv,fields
-from openerp.tools.translate import _
-import time
-
-class pos_return(osv.osv_memory):
- _name = 'pos.return'
- _description = 'Point of sale return'
- _columns = {
- 'pos_moves_ids' : fields.one2many('pos.return.memory', 'pos_moves_id', 'Moves'),
- }
-
- 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.
-
- """
- res = super(pos_return, self).default_get(cr, uid, fields, context=context)
- order_obj = self.pool.get('pos.order')
- if context is None:
- context={}
- active_ids = context.get('active_ids')
- result=[]
- for order in order_obj.browse(cr, uid, active_ids, context=context):
- for line in order.lines:
- result.append({
- 'product_id' : line.product_id.id,
- 'quantity' : line.qty,
- 'line_id':line.id
- })
- res.update({'pos_moves_ids': result})
- return res
-
- def create_returns(self, cr, uid, data, context=None):
- """
- @param self: The object pointer.
- @param cr: A database cursor
- @param uid: ID of the user currently logged in
- @param context: A standard dictionary
-
- @return: Return the add product form again for adding more product
-
- """
- if context is None:
- context = {}
- current_rec = self.browse(cr, uid, data, context=context)[0]
- order_obj =self.pool.get('pos.order')
- line_obj = self.pool.get('pos.order.line')
- pos_current = order_obj.browse(cr, uid, context.get('active_id'), context=context)
- for pos_line in pos_current.lines:
- for record in current_rec.pos_moves_ids:
- if pos_line.id == record.line_id:
- less_qty = record.quantity
- line_obj.write(cr, uid, pos_line.id, {'qty':pos_line.qty - less_qty}, context=context)
- return {
- 'name': _('Add Product'),
- 'view_type': 'form',
- 'view_mode': 'form',
- 'res_model': 'pos.add.product',
- 'view_id': False,
- 'target':'new',
- 'views': False,
- 'context': context,
- 'type': 'ir.actions.act_window',
- }
- def create_returns2(self, cr, uid, ids, context=None):
-
- if context is None:
- context = {}
- active_id = context.get('active_id', False)
- order_obj =self.pool.get('pos.order')
- line_obj = self.pool.get('pos.order.line')
- picking_obj = self.pool.get('stock.picking')
- stock_move_obj = self.pool.get('stock.move')
- property_obj= self.pool.get("ir.property")
- uom_obj =self. pool.get('product.uom')
- statementl_obj = self.pool.get('account.bank.statement.line')
- #Todo :Need to clean the code
- if active_id:
- data = self.browse(cr, uid, ids, context=context)[0]
- date_cur = time.strftime('%Y-%m-%d %H:%M:%S')
-
- for order_id in order_obj.browse(cr, uid, [active_id], context=context):
- source_stock_id = property_obj.get(cr, uid, 'property_stock_customer', 'res.partner', context=context).id
- cr.execute("SELECT s.id FROM stock_location s, stock_warehouse w "
- "WHERE w.lot_stock_id=s.id AND w.id=%s ",
- (order_id.warehouse_id.id,))
- res = cr.fetchone()
- location_id = res and res[0] or None
- new_picking = picking_obj.copy(cr, uid, order_id.picking_id.id, {'name':'%s (return)' % order_id.name,
- 'move_lines': [],
- 'state':'draft',
- 'type': 'in',
- 'partner_id': order_id.partner_id.id,
- 'date': date_cur })
- new_order = order_obj.copy(cr, uid, order_id.id, {'name': 'Refund %s'%order_id.name,
- 'lines':[],
- 'statement_ids':[],
- 'picking_id':[]})
- account_def = property_obj.get(cr, uid, 'property_account_payable', 'res.partner', context=context)
- amount = 0.0
- for line in order_id.lines:
- for record in data.pos_moves_ids:
- if line.id == record.line_id:
- qty = record.quantity
- amount += qty * line.price_unit
- stock_move_obj.create(cr, uid, {
- 'product_qty': qty ,
- 'product_uos_qty': uom_obj._compute_qty(cr, uid, qty ,line.product_id.uom_id.id),
- 'picking_id': new_picking,
- 'product_uom': line.product_id.uom_id.id,
- 'location_id': source_stock_id,
- 'product_id': line.product_id.id,
- 'location_dest_id': location_id,
- 'name': '%s (return)' %order_id.name,
- 'date': date_cur
- })
- if qty != 0.0:
- line_obj.copy(cr, uid, line.id, {'qty': -qty, 'order_id': new_order})
- statementl_obj.create(cr, uid, {
- 'name': 'Refund %s'%order_id.name,
- 'statement_id': order_id.statement_ids[0].statement_id.id,
- 'pos_statement_id': new_order,
- 'date': fields.date.context_today(self, cr, uid, context=context),
- 'account_id': order_id.partner_id and order_id.partner_id.property_account_payable \
- and order_id.partner_id.property_account_payable.id or account_def.id,
- 'amount': -amount,
- })
- order_obj.write(cr,uid, [active_id,new_order], {'state': 'done'})
- picking_obj.signal_button_confirm(cr, uid, [new_picking])
- picking_obj.force_assign(cr, uid, [new_picking], context)
- act = {
- 'domain': "[('id', 'in', ["+str(new_order)+"])]",
- 'name': 'Refunded Orders',
- 'view_type': 'form',
- 'view_mode': 'tree,form',
- 'res_model': 'pos.order',
- 'auto_refresh':0,
- 'res_id':new_order,
- 'view_id': False,
- 'context':context,
- 'type': 'ir.actions.act_window'
- }
- return act
-
-
-class add_product(osv.osv_memory):
- _inherit = 'pos.add.product'
- def select_product(self, cr, uid, ids, context=None):
- """
- 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
- """
- if context is None:
- context = {}
-
- active_id=context.get('active_id', False)
- data = self.read(cr, uid, ids)
- data = data and data[0] or False
- if active_id:
- order_obj = self.pool.get('pos.order')
- picking_obj = self.pool.get('stock.picking')
- stock_move_obj = self.pool.get('stock.move')
- property_obj= self.pool.get("ir.property")
- date_cur=time.strftime('%Y-%m-%d')
- uom_obj = self.pool.get('product.uom')
- prod_obj=self.pool.get('product.product')
- order_obj.add_product(cr, uid, active_id, data['product_id'], data['quantity'], context=context)
-
- for order_id in order_obj.browse(cr, uid, [active_id], context=context):
- prod=data['product_id']
- qty=data['quantity']
- stock_dest_id = property_obj.get(cr, uid, 'property_stock_customer', 'res.partner', context=context).id
- cr.execute("SELECT s.id FROM stock_location s, stock_warehouse w "
- "WHERE w.lot_stock_id=s.id AND w.id=%s ",
- (order_id.warehouse_id.id,))
- res=cr.fetchone()
- location_id=res and res[0] or None
- prod_id=prod_obj.browse(cr, uid, prod, context=context)
- new_picking=picking_obj.create(cr, uid, {
- 'name':'%s (Added)' %order_id.name,
- 'move_lines':[],
- 'state':'draft',
- 'type':'out',
- 'date':date_cur
- })
- stock_move_obj.create(cr, uid, {
- 'product_qty': qty,
- 'product_uos_qty': uom_obj._compute_qty(cr, uid, prod_id.uom_id.id, qty, prod_id.uom_id.id),
- 'picking_id':new_picking,
- 'product_uom':prod_id.uom_id.id,
- 'location_id':location_id,
- 'product_id':prod_id.id,
- 'location_dest_id':stock_dest_id,
- 'name':'%s (return)' %order_id.name,
- 'date':date_cur
- })
-
- picking_obj.signal_button_confirm(cr, uid, [new_picking])
- picking_obj.force_assign(cr, uid, [new_picking], context)
- order_obj.write(cr,uid,active_id,{'picking_id':new_picking})
-
- return {
- 'name': _('Add Product'),
- 'view_type': 'form',
- 'view_mode': 'form',
- 'res_model': 'pos.add.product',
- 'view_id': False,
- 'target':'new',
- 'context':context,
- 'views': False,
- 'type': 'ir.actions.act_window',
- }
-
- def close_action(self, cr, uid, ids, context=None):
- if context is None: context = {}
- active_ids=context.get('active_ids', False)
- order_obj = self.pool.get('pos.order')
- lines_obj = self.pool.get('pos.order.line')
- picking_obj = self.pool.get('stock.picking')
- stock_move_obj = self.pool.get('stock.move')
- property_obj= self.pool.get("ir.property")
- invoice_obj=self.pool.get('account.invoice')
- date_cur=time.strftime('%Y-%m-%d %H:%M:%S')
- uom_obj = self.pool.get('product.uom')
- return_boj=self.pool.get('pos.return')
- return_id = return_boj.search(cr,uid,[])
- data = {}
- if return_id:
- data = return_boj.read(cr,uid,return_id,[])[0]
-
- self_data = self.browse(cr, uid, ids, context=context)[0]
- order_obj.add_product(cr, uid, active_ids[0], self_data.product_id.id, self_data.quantity, context=context)
-
- for order_id in order_obj.browse(cr, uid, active_ids, context=context):
- stock_dest_id = property_obj.get(cr, uid, 'property_stock_customer', 'res.partner', context=context).id
- cr.execute("SELECT s.id FROM stock_location s, stock_warehouse w "
- " WHERE w.lot_stock_id=s.id AND w.id=%s ",
- (order_id.warehouse_id.id,))
- res=cr.fetchone()
- location_id=res and res[0] or None
-
- if order_id.invoice_id:
- invoice_obj.refund(cr, uid, [order_id.invoice_id.id], time.strftime('%Y-%m-%d'), False, order_id.name, context=context)
- new_picking=picking_obj.create(cr, uid, {
- 'name':'%s (return)' %order_id.name,
- 'move_lines':[], 'state':'draft',
- 'type':'in',
- 'date':date_cur
- })
- for line in order_id.lines:
- key= 'return%s' % line.id
- if line.id:
- if data.has_key(key):
- qty = data[key]
- lines_obj.write(cr,uid,[line.id], {
- 'qty':line.qty-(data[key] or 0.0)
- })
- else:
- qty = line.qty
- stock_move_obj.create(cr, uid, {
- 'product_qty': qty,
- 'product_uos_qty': uom_obj._compute_qty(cr, uid, qty, line.product_id.uom_id.id),
- 'picking_id':new_picking,
- 'product_uom':line.product_id.uom_id.id,
- 'location_id':location_id,
- 'product_id':line.product_id.id,
- 'location_dest_id':stock_dest_id,
- 'name':'%s (return)' % order_id.name,
- 'date':date_cur,
- })
- picking_obj.signal_button_confirm(cr, uid, [new_picking])
- picking_obj.force_assign(cr, uid, [new_picking], context)
- obj=order_obj.browse(cr,uid, active_ids[0])
- context.update({'return':'return'})
-
- if obj.amount_total != obj.amount_paid:
- return {
- 'name': _('Make Payment'),
- 'context ':context,
- 'view_type': 'form',
- 'view_mode': 'form',
- 'res_model': 'pos.make.payment',
- 'view_id': False,
- 'target': 'new',
- 'views': False,
- 'type': 'ir.actions.act_window',
- }
- return True
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/point_of_sale/wizard/pos_return_view.xml b/addons/point_of_sale/wizard/pos_return_view.xml
deleted file mode 100644
index 62e2f3012d9..00000000000
--- a/addons/point_of_sale/wizard/pos_return_view.xml
+++ /dev/null
@@ -1,53 +0,0 @@
-
-
-
-
- pos.return
- pos.return
-
-
-
-
-
-
- Return lines
- pos.return
- form
- form
- new
-
-
-
- pos.return.memory
- pos.return.memory
-
-
-
-
-
-
-
-
-
-
- pos.return.memory
- pos.return.memory
-
-
-
-
-
-
-
diff --git a/addons/point_of_sale/wizard/pos_sales_user.py b/addons/point_of_sale/wizard/pos_sales_user.py
deleted file mode 100644
index e8ece7a7953..00000000000
--- a/addons/point_of_sale/wizard/pos_sales_user.py
+++ /dev/null
@@ -1,60 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# 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 .
-#
-##############################################################################
-
-from openerp.osv import osv, fields
-from openerp.tools.translate import _
-
-
-class pos_sale_user(osv.osv_memory):
- _name = 'pos.sale.user'
- _description = 'Sale by User'
-
- _columns = {
- 'date_start': fields.date('Date Start', required=True),
- 'date_end': fields.date('Date End', required=True),
- 'user_id': fields.many2many('res.users', 'sale_user_rel', 'user_id', 'uid', 'Salesperson'),
- }
-
- 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 : return report
- """
- if context is None:
- context = {}
-
- datas = {'ids': context.get('active_ids', [])}
- res = self.read(cr, uid, ids, ['date_start', 'date_end', 'user_id'], context=context)
- res = res and res[0] or {}
- datas['form'] = res
- return {
- 'type': 'ir.actions.report.xml',
- 'report_name': 'pos.sales.user',
- 'datas': datas,
- }
-
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/point_of_sale/wizard/pos_sales_user.xml b/addons/point_of_sale/wizard/pos_sales_user.xml
deleted file mode 100644
index 2623c426cb8..00000000000
--- a/addons/point_of_sale/wizard/pos_sales_user.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-
-
-
-
-
-
- Sale By User
- pos.sale.user
-
-
-
-
-
-
-
- Sale by User
- ir.actions.act_window
- pos.sale.user
- form
- form
- new
-
-
-
-
diff --git a/addons/point_of_sale/wizard/pos_sales_user_current_user.py b/addons/point_of_sale/wizard/pos_sales_user_current_user.py
deleted file mode 100644
index d6178ff6a50..00000000000
--- a/addons/point_of_sale/wizard/pos_sales_user_current_user.py
+++ /dev/null
@@ -1,58 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# 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 .
-#
-##############################################################################
-
-from openerp.osv import osv
-from openerp.tools.translate import _
-
-
-class pos_sales_user_today_current_user(osv.osv_memory):
- _name = 'pos.sales.user.today.current_user'
- _description = 'Sales Details'
-
- _columns = {
- }
-
- 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
- """
- if context is None:
- context = {}
-
- datas = {'ids': context.get('active_ids', [])}
- res = self.read(cr, uid, ids, [], context=context)
- res = res and res[0] or {}
- datas['form'] = res
-
- return {
- 'type': 'ir.actions.report.xml',
- 'report_name': 'pos.sales.user.today.current.user',
- 'datas': datas,
- }
-
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/point_of_sale/wizard/pos_sales_user_today.py b/addons/point_of_sale/wizard/pos_sales_user_today.py
deleted file mode 100644
index 65e4182daed..00000000000
--- a/addons/point_of_sale/wizard/pos_sales_user_today.py
+++ /dev/null
@@ -1,57 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# 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 .
-#
-##############################################################################
-
-from openerp.osv import osv, fields
-
-
-class pos_sales_user_today(osv.osv_memory):
- _name = 'pos.sales.user.today'
- _description = 'Sales User Today'
-
- _columns = {
- 'user_id': fields.many2many('res.users', 'sale_user_rel_today', 'user_id', 'uid', 'Salesperson'),
- }
-
- 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
- """
- if context is None:
- context = {}
-
- datas = {'ids': context.get('active_ids', [])}
- res = self.read(cr, uid, ids, ['user_id'], context=context)
- res = res and res[0] or {}
- datas['form'] = res
- return {
- 'type': 'ir.actions.report.xml',
- 'report_name': 'pos.sales.user.today',
- 'datas': datas,
- }
-
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/report/controllers/main.py b/addons/report/controllers/main.py
index d3a683cccdc..95a1ea7636a 100644
--- a/addons/report/controllers/main.py
+++ b/addons/report/controllers/main.py
@@ -20,6 +20,8 @@
##############################################################################
from openerp.addons.web.http import Controller, route, request
+from openerp.addons.web.controllers.main import _serialize_exception
+from openerp.osv import osv
import simplejson
from werkzeug import exceptions, url_decode
@@ -97,32 +99,40 @@ class ReportController(Controller):
"""
requestcontent = simplejson.loads(data)
url, type = requestcontent[0], requestcontent[1]
+ try:
+ if type == 'qweb-pdf':
+ reportname = url.split('/report/pdf/')[1].split('?')[0]
- if type == 'qweb-pdf':
- reportname = url.split('/report/pdf/')[1].split('?')[0]
+ docids = None
+ if '/' in reportname:
+ reportname, docids = reportname.split('/')
- docids = None
- if '/' in reportname:
- reportname, docids = reportname.split('/')
+ if docids:
+ # Generic report:
+ response = self.report_routes(reportname, docids=docids, converter='pdf')
+ else:
+ # Particular report:
+ data = url_decode(url.split('?')[1]).items() # decoding the args represented in JSON
+ response = self.report_routes(reportname, converter='pdf', **dict(data))
- if docids:
- # Generic report:
- response = self.report_routes(reportname, docids=docids, converter='pdf')
+ response.headers.add('Content-Disposition', 'attachment; filename=%s.pdf;' % reportname)
+ response.set_cookie('fileToken', token)
+ return response
+ elif type =='controller':
+ reqheaders = Headers(request.httprequest.headers)
+ response = Client(request.httprequest.app, BaseResponse).get(url, headers=reqheaders, follow_redirects=True)
+ response.set_cookie('fileToken', token)
+ return response
else:
- # Particular report:
- data = url_decode(url.split('?')[1]).items() # decoding the args represented in JSON
- response = self.report_routes(reportname, converter='pdf', **dict(data))
-
- response.headers.add('Content-Disposition', 'attachment; filename=%s.pdf;' % reportname)
- response.set_cookie('fileToken', token)
- return response
- elif type =='controller':
- reqheaders = Headers(request.httprequest.headers)
- response = Client(request.httprequest.app, BaseResponse).get(url, headers=reqheaders, follow_redirects=True)
- response.set_cookie('fileToken', token)
- return response
- else:
- return
+ return
+ except osv.except_osv, e:
+ se = _serialize_exception(e)
+ error = {
+ 'code': 200,
+ 'message': "OpenERP Server Error",
+ 'data': se
+ }
+ return request.make_response(simplejson.dumps(error))
@route(['/report/check_wkhtmltopdf'], type='json', auth="user")
def check_wkhtmltopdf(self):
diff --git a/addons/report/static/src/js/qwebactionmanager.js b/addons/report/static/src/js/qwebactionmanager.js
index 7e55661be86..37a0fae6ea6 100644
--- a/addons/report/static/src/js/qwebactionmanager.js
+++ b/addons/report/static/src/js/qwebactionmanager.js
@@ -78,8 +78,7 @@ openerp.report = function(instance) {
}
return trigger_download(self.session, response, c);
});
- }
- else if (action.report_type == 'controller') {
+ } else if (action.report_type == 'controller') {
return trigger_download(self.session, response, c);
}
}