[FIX] point of sale addons fixes + YAML test improve
bzr revid: fp@tinyerp.com-20120716164129-6u8ejw0h6rw3fstq
This commit is contained in:
parent
2d67ef5f55
commit
5e0cce7d55
|
@ -61,6 +61,7 @@ Main features :
|
|||
'wizard/pos_session_opening.xml',
|
||||
'point_of_sale_report.xml',
|
||||
'point_of_sale_view.xml',
|
||||
'point_of_sale_data.xml',
|
||||
'report/pos_order_report_view.xml',
|
||||
'point_of_sale_sequence.xml',
|
||||
'point_of_sale_workflow.xml',
|
||||
|
@ -80,7 +81,6 @@ Main features :
|
|||
],
|
||||
'installable': True,
|
||||
'application': True,
|
||||
'certificate' : '001156338024966477869',
|
||||
# Web client
|
||||
'js': [
|
||||
'static/lib/backbone/backbone-0.9.2.js',
|
||||
|
|
|
@ -77,7 +77,7 @@ class pos_config(osv.osv):
|
|||
help="This sequence is automatically created by OpenERP but you can change it "\
|
||||
"to customize the reference numbers of your orders."),
|
||||
'session_ids': fields.one2many('pos.session', 'config_id', 'Sessions'),
|
||||
'group_by' : fields.boolean('Group By', help="Check this if you want to group the Journal Items by Product while a Session"),
|
||||
'group_by' : fields.boolean('Group By', help="Check this if you want to group the Journal Items by Product while closing a Session"),
|
||||
}
|
||||
|
||||
def name_get(self, cr, uid, ids, context=None):
|
||||
|
@ -97,6 +97,10 @@ class pos_config(osv.osv):
|
|||
return result
|
||||
|
||||
|
||||
def _default_payment_journal(self, cr, uid, context=None):
|
||||
res = self.pool.get('account.journal').search(cr, uid, [('type', 'in', ('bank','cash'))], limit=2)
|
||||
return res or []
|
||||
|
||||
def _default_sale_journal(self, cr, uid, context=None):
|
||||
res = self.pool.get('account.journal').search(cr, uid, [('type', '=', 'sale')], limit=1)
|
||||
return res and res[0] or False
|
||||
|
@ -109,6 +113,7 @@ class pos_config(osv.osv):
|
|||
'state' : POS_CONFIG_STATE[0][0],
|
||||
'shop_id': _default_shop,
|
||||
'journal_id': _default_sale_journal,
|
||||
'journal_ids': _default_payment_journal,
|
||||
'group_by' : True,
|
||||
}
|
||||
|
||||
|
@ -544,6 +549,7 @@ class pos_order(osv.osv):
|
|||
def _default_session(self, cr, uid, context=None):
|
||||
so = self.pool.get('pos.session')
|
||||
session_ids = so.search(cr, uid, [('state','=', 'opened'), ('user_id','=',uid)], context=context)
|
||||
print 'Default Session', session_ids
|
||||
return session_ids and session_ids[0] or False
|
||||
|
||||
def _default_pricelist(self, cr, uid, context=None):
|
||||
|
|
|
@ -3,15 +3,9 @@
|
|||
<data>
|
||||
|
||||
|
||||
<menuitem
|
||||
id="stock.next_id_61"
|
||||
name="Reporting"
|
||||
parent="stock.menu_stock_root" groups="base.group_user"/>
|
||||
|
||||
<menuitem action="stock.action_picking_tree" id="stock.menu_action_picking_tree"
|
||||
parent="stock.menu_stock_root" sequence="19" groups="res_groups_posuser0"/>
|
||||
<menuitem parent="stock.next_id_61" action="stock.action_stock_line_date"
|
||||
id="stock.menu_report_stock_line_date" groups="base.group_user"/>
|
||||
<record model="pos.config" id="pos_config_main">
|
||||
<field name="name">Main PoS</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
|
@ -31,6 +31,26 @@
|
|||
-
|
||||
!record {model: product.product, id: product.product_product_pc2}:
|
||||
taxes_id: [account_tax_05_incl]
|
||||
-
|
||||
I create a new session
|
||||
-
|
||||
!record {model: pos.session, id: pos_order_session0}:
|
||||
user_id: 1
|
||||
config_id: point_of_sale.pos_config_main
|
||||
-
|
||||
I open a new PoS Session wizard
|
||||
-
|
||||
!record {model: pos.session.opening, id: pos_order_session_wizard0}:
|
||||
pos_config_id: point_of_sale.pos_config_main
|
||||
-
|
||||
I click on create a new session button
|
||||
-
|
||||
!python {model: pos.session.opening}: |
|
||||
self.open_existing_session_cb(cr, uid, [ref('pos_order_session_wizard0')])
|
||||
-
|
||||
I open the session after having counted the money
|
||||
-
|
||||
!workflow {model: pos.session, action: open, ref: pos_order_session0}
|
||||
-
|
||||
I create a PoS order with 2 units of PC1 at 450 EUR (Tax Incl) and 3 units of PC2 at 300 EUR. (Tax Excl)
|
||||
-
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
-
|
||||
!python {model: pos.order}: |
|
||||
import netsvc, tools, os
|
||||
(data, format) = netsvc.LocalService('report.pos.details_summary').create(cr, uid, [ref('point_of_sale.order_pos1'), ref('point_of_sale.order_pos2')], {}, {})
|
||||
(data, format) = netsvc.LocalService('report.pos.details_summary').create(cr, uid, [ref('point_of_sale.pos_order_pos1')], {}, {})
|
||||
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)
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
|||
-
|
||||
!python {model: pos.order}: |
|
||||
import netsvc, tools, os
|
||||
(data, format) = netsvc.LocalService('report.pos.invoice').create(cr, uid, [ref('point_of_sale.pos_order_pos11')], {}, {})
|
||||
(data, format) = netsvc.LocalService('report.pos.invoice').create(cr, uid, [ref('point_of_sale.pos_order_pos1')], {}, {})
|
||||
if tools.config['test_report_directory']:
|
||||
file(os.path.join(tools.config['test_report_directory'], 'point_of_sale-invoice report'+format), 'wb+').write(data)
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
|||
-
|
||||
!python {model: pos.order}: |
|
||||
import netsvc, tools, os
|
||||
(data, format) = netsvc.LocalService('report.pos.lines').create(cr, uid, [ref('point_of_sale.order_pos1'), ref('point_of_sale.order_pos2')], {}, {})
|
||||
(data, format) = netsvc.LocalService('report.pos.lines').create(cr, uid, [ref('point_of_sale.pos_order_pos1')], {}, {})
|
||||
if tools.config['test_report_directory']:
|
||||
file(os.path.join(tools.config['test_report_directory'], 'point_of_sale-lines report'+format), 'wb+').write(data)
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
|||
-
|
||||
!python {model: pos.order}: |
|
||||
import netsvc, tools, os
|
||||
(data, format) = netsvc.LocalService('report.pos.receipt').create(cr, uid, [ref('point_of_sale.order_pos1'), ref('point_of_sale.order_pos2')], {}, {})
|
||||
(data, format) = netsvc.LocalService('report.pos.receipt').create(cr, uid, [ref('point_of_sale.pos_order_pos1')], {}, {})
|
||||
if tools.config['test_report_directory']:
|
||||
file(os.path.join(tools.config['test_report_directory'], 'point_of_sale-receipt report'+format), 'wb+').write(data)
|
||||
|
||||
|
@ -51,7 +51,7 @@
|
|||
!python {model: pos.order}: |
|
||||
import netsvc, tools, os, time
|
||||
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) = netsvc.LocalService('report.pos.sales.user').create(cr, uid, [ref('point_of_sale.order_pos1'), ref('point_of_sale.order_pos2')], data_dict, {})
|
||||
(data, format) = netsvc.LocalService('report.pos.sales.user').create(cr, uid, [ref('point_of_sale.pos_order_pos1')], 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)
|
||||
-
|
||||
|
@ -68,6 +68,6 @@
|
|||
!python {model: pos.order}: |
|
||||
import netsvc, tools, os, time
|
||||
data_dict = {'model':'ir.ui.menu', 'form':{'user_id':[ref('base.user_root'),ref('base.user_demo')] }}
|
||||
(data, format) = netsvc.LocalService('report.pos.payment.report.user').create(cr, uid, [ref('point_of_sale.order_pos1'), ref('point_of_sale.order_pos2')], data_dict, {})
|
||||
(data, format) = netsvc.LocalService('report.pos.payment.report.user').create(cr, uid, [ref('point_of_sale.pos_order_pos1')], 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)
|
||||
|
|
|
@ -99,14 +99,18 @@ class pos_make_payment(osv.osv_memory):
|
|||
def _default_journal(self, cr, uid, context=None):
|
||||
if not context:
|
||||
context = {}
|
||||
pos_session_id = context.get('pos_session_id', False) or False
|
||||
|
||||
if isinstance(pos_session_id, (long, int)):
|
||||
session = self.pool.get('pos.session').browse(cr, uid, pos_session_id, context=context)
|
||||
session = False
|
||||
order_obj = self.pool.get('pos.order')
|
||||
active_id = context and context.get('active_id', False)
|
||||
if active_id:
|
||||
order = order_obj.browse(cr, uid, active_id, context=context)
|
||||
session = order.session_id
|
||||
print 'Session', session, 'Active ID', active_id
|
||||
if session:
|
||||
print 'JIDS', session.config_id.journal_ids
|
||||
for journal in session.config_id.journal_ids:
|
||||
if journal.type == 'cash':
|
||||
return journal.id
|
||||
|
||||
print 'Return False'
|
||||
return False
|
||||
|
||||
def _default_amount(self, cr, uid, context=None):
|
||||
|
|
|
@ -22,7 +22,9 @@ class pos_session_opening(osv.osv_memory):
|
|||
'config_id' : wizard.pos_config_id.id,
|
||||
}
|
||||
session_id = proxy.create(cr, uid, values, context=context)
|
||||
print 'Created Session', session_id, values
|
||||
return self._open_session(session_id)
|
||||
print wizard.pos_session_id
|
||||
return self._open_session(wizard.pos_session_id.id)
|
||||
|
||||
def open_existing_session_cb(self, cr, uid, ids, context=None):
|
||||
|
|
Loading…
Reference in New Issue