[IMP] point_of_sale:

* receipt report: now prints Salesman name, Order Date and Receipt Printing Date
 * Date Ordered is now a datetime (was formerly a date field)
 * added a Salesman field (not readonly) to supplement the 'Logged in User' field (readonly)
   because sometimes the salesman is not always the same person as the logged in user

bzr revid: olt@tinyerp.com-20090617133224-6jwmzpbrsuqlqk4g
This commit is contained in:
Olivier Laurent 2009-06-17 15:32:24 +02:00
parent 55d34b33f5
commit 0b555a2325
4 changed files with 25 additions and 27 deletions

View File

@ -152,18 +152,18 @@ class pos_order(osv.osv):
states={'draft': [('readonly', False)]}, readonly=True),
'shop_id': fields.many2one('sale.shop', 'Shop', required=True,
states={'draft': [('readonly', False)]}, readonly=True),
'date_order': fields.date('Date Ordered', readonly=True),
'date_order': fields.datetime('Date Ordered', readonly=True),
'date_validity': fields.date('Validity Date', required=True),
'user_id': fields.many2one('res.users', 'Salesman',
readonly=True),
'user_id': fields.many2one('res.users', 'Logged in User', readonly=True,
help="This is the logged in user (not necessarily the salesman)."),
'salesman_id': fields.many2one('res.users', 'Salesman',
help="This is the salesman actually making the order."),
'amount_tax': fields.function(_amount_tax, method=True, string='Taxes'),
'amount_total': fields.function(_amount_total, method=True,
string='Total'),
'amount_total': fields.function(_amount_total, method=True, string='Total'),
'amount_paid': fields.function(_total_payment, 'Paid',
states={'draft': [('readonly', False)]}, readonly=True,
method=True),
'amount_return': fields.function(_total_return, 'Returned',
method=True),
'amount_return': fields.function(_total_return, 'Returned', method=True),
'lines': fields.one2many('pos.order.line', 'order_id',
'Order Lines', states={'draft': [('readonly', False)]},
readonly=True),
@ -181,10 +181,8 @@ class pos_order(osv.osv):
('paid', 'Paid'), ('done', 'Done'), ('invoiced', 'Invoiced')], 'State',
readonly=True, ),
'invoice_id': fields.many2one('account.invoice', 'Invoice', readonly=True),
'account_move': fields.many2one('account.move', 'Account Entry',
readonly=True),
'pickings': fields.one2many('stock.picking', 'pos_order', 'Picking',
readonly=True),
'account_move': fields.many2one('account.move', 'Account Entry', readonly=True),
'pickings': fields.one2many('stock.picking', 'pos_order', 'Picking', readonly=True),
'last_out_picking': fields.many2one('stock.picking',
'Last Output Picking',
readonly=True),
@ -211,7 +209,7 @@ class pos_order(osv.osv):
'state': lambda *a: 'draft',
'name': lambda obj, cr, uid, context: obj.pool.get('ir.sequence')\
.get(cr, uid, 'pos.order'),
'date_order': lambda *a: time.strftime('%Y-%m-%d'),
'date_order': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
'date_validity': lambda *a: (DateTime.now() + DateTime.RelativeDateTime(months=+6)).strftime('%Y-%m-%d'),
'nb_print': lambda *a: 0,
'sale_journal': _sale_journal_get,
@ -417,9 +415,6 @@ class pos_order(osv.osv):
def add_payment(self, cr, uid, order_id, data, context=None):
"""Create a new payment for the order"""
print data
order = self.browse(cr, uid, order_id, context)
if order.invoice_wanted and not order.partner_id:
raise osv.except_osv(_('Error'), _('Cannot create invoice without a partner.'))

View File

@ -11,6 +11,7 @@
<page string="Order lines">
<field name="partner_id" on_change="onchange_partner_pricelist(partner_id)"/>
<field name="pricelist_id" domain="[('type','=','sale')]"/>
<field name="salesman_id" />
<field name="lines" colspan="4" nolabel="1">
<tree string="Order lines" editable="bottom">
<field name="product_id" on_change="onchange_product_id(parent.pricelist_id,product_id,qty,parent.partner_id)" width="275"/>
@ -32,8 +33,8 @@
<field name="amount_tax"/>
<field name="amount_total"/>
<button name="%(pos_discount)d"
string="D_iscount"
<button name="%(pos_add_product)d"
string="_Add product"
type="action" states="draft"/>
<button name="dummy_button"
@ -47,8 +48,8 @@
<field name="state" select="2"/>
<button name="%(pos_add_product)d"
string="_Add product"
<button name="%(pos_discount)d"
string="D_iscount"
type="action" states="draft"/>
<button name="%(pos_payment)d"
@ -96,7 +97,7 @@
<page string="Other">
<field name="shop_id" />
<field name="name" select="1"/>
<field name="date_order" select="1"/>
<field name="date_order" select="1" />
<field name="date_validity" />
<field name="user_id" />
@ -119,7 +120,7 @@
<field name="res_model">pos.order</field>
<field name="view_type">form</field>
<field name="view_id" ref="view_pos_pos_form"/>
<field name="domain">[ ('date_order','>=',time.strftime('%Y-%m-%d')) ]</field>
<field name="domain">[ ('date_order','>=',time.strftime('%Y-%m-%d 00:00:00')) ]</field>
</record>
@ -175,7 +176,7 @@
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_pos_order_tree"/>
<field name="domain">[('date_order','=', time.strftime('%Y-%m-%d'))]</field>
<field name="domain">[('date_order','=', time.strftime('%Y-%m-%d 00:00:00'))]</field>
</record>
<menuitem name="Orders of the day" parent="menu_point_ofsale" id="menu_action_pos_order_tree2" action="action_pos_order_tree2"/>

View File

@ -33,9 +33,10 @@ class pos_invoice(report_sxw.rml_parse):
self.localcontext.update({
'time': time,
})
print
def preprocess(self, objects, data, ids):
super(pos_invoice, self).preprocess(objects, data, ids)
def set_context(self, objects, data, ids, report_type=None):
super(pos_invoice, self).set_context(objects, data, ids, report_type)
iids = []
nids = []
@ -55,5 +56,5 @@ class pos_invoice(report_sxw.rml_parse):
self.localcontext['data'] = data
self.localcontext['objects'] = iids
report_sxw.report_sxw('report.pos.invoice', 'pos.order', 'addons/point_of_sale/report/pos_invoice.rml', parser= pos_invoice)
report_sxw.report_sxw('report.pos.invoice', 'pos.order', 'addons/account/report/invoice.rml', parser= pos_invoice)

View File

@ -82,8 +82,9 @@
<para style="terp_default_Centre_9">[[ address and address.country_id.name ]]</para>
<para style="terp_default_Centre_9">Tel : [[ address and address.phone ]]</para>
<para style="terp_default_Centre_9">E-mail : [[ address and address.email ]]</para>
<para style="terp_default_Centre_9">User : [[ o.user_id.name ]]</para>
<para style="terp_default_Centre_9">Date : [[ time.strftime('%d/%m/%Y %H:%M') ]]</para>
<para style="terp_default_Centre_9">User : [[ o.salesman_id.name ]]</para>
<para style="terp_default_Centre_9">Sale Date : [[ o.date_order ]]</para>
<para style="terp_default_Centre_9">Receipt Printing Date : [[ time.strftime('%d/%m/%Y %H:%M') ]]</para>
<para style="terp_default_Centre_9">
<font color="white"> </font>
</para>