[REM] point_of_sale: Removed unused object 'pos.payment' as Payment is now done with 'account.bank.statement' object from account.
bzr revid: uco@tinyerp.com-20101005063026-eew1c2snhawv1not
This commit is contained in:
parent
67659ea471
commit
01bda9b4b4
|
@ -175,9 +175,8 @@ class pos_order(osv.osv):
|
|||
cur_obj = self.pool.get('res.currency')
|
||||
cur = order.pricelist_id.currency_id
|
||||
for payment in order.statement_ids:
|
||||
res[order.id]['amount_paid'] += payment.amount
|
||||
for payment in order.payments:
|
||||
res[order.id]['amount_return'] += (payment.amount < 0 and payment.amount or 0)
|
||||
res[order.id]['amount_paid'] += payment.amount
|
||||
res[order.id]['amount_return'] += (payment.amount < 0 and payment.amount or 0)
|
||||
for line in order.lines:
|
||||
if order.price_type!='tax_excluded':
|
||||
res[order.id]['amount_tax'] = reduce(lambda x, y: x+round(y['amount'], 2),
|
||||
|
@ -221,7 +220,6 @@ class pos_order(osv.osv):
|
|||
default = {}
|
||||
default.update({
|
||||
'state': 'draft',
|
||||
'payments': [],
|
||||
'partner_id': False,
|
||||
'invoice_id': False,
|
||||
'account_move': False,
|
||||
|
@ -285,7 +283,6 @@ class pos_order(osv.osv):
|
|||
('tax_excluded','Tax excluded')
|
||||
], 'Price method', required=True),
|
||||
'statement_ids': fields.one2many('account.bank.statement.line','pos_statement_id','Payments',states={'draft': [('readonly', False)]},readonly=True),
|
||||
'payments': fields.one2many('pos.payment', 'order_id', 'Order Payments', states={'draft': [('readonly', False)]}, readonly=True),
|
||||
'pricelist_id': fields.many2one('product.pricelist', 'Pricelist', required=True, states={'draft': [('readonly', False)]}, readonly=True),
|
||||
'partner_id': fields.many2one( 'res.partner', 'Customer', change_default=True, select=1, states={'draft': [('readonly', False)], 'paid': [('readonly', False)]}),
|
||||
'state': fields.selection([('draft', 'Quotation'), ('payment', 'Payment'),
|
||||
|
@ -1265,55 +1262,6 @@ class pos_order_line(osv.osv):
|
|||
|
||||
pos_order_line()
|
||||
|
||||
|
||||
class pos_payment(osv.osv):
|
||||
_name = 'pos.payment'
|
||||
_description = 'Pos Payment'
|
||||
|
||||
def _journal_get(self, cr, uid, context=None):
|
||||
obj = self.pool.get('account.journal')
|
||||
ids = obj.search(cr, uid, [('type', '=', 'cash')])
|
||||
res = obj.read(cr, uid, ids, ['id', 'name'], context)
|
||||
res = [(r['id'], r['name']) for r in res]
|
||||
return res
|
||||
|
||||
def _journal_default(self, cr, uid, context=None):
|
||||
journal_list = self.pool.get('account.journal').search(cr, uid, [('type', '=', 'cash')])
|
||||
if journal_list:
|
||||
return journal_list[0]
|
||||
else:
|
||||
return False
|
||||
|
||||
_columns = {
|
||||
'name': fields.char('Description', size=64),
|
||||
'order_id': fields.many2one('pos.order', 'Order Ref', required=True, ondelete='cascade'),
|
||||
'journal_id': fields.many2one('account.journal', "Journal", required=True),
|
||||
'payment_id': fields.many2one('account.payment.term','Payment Term', select=True),
|
||||
'payment_nb': fields.char('Piece Number', size=32),
|
||||
'payment_name': fields.char('Payment Name', size=32),
|
||||
'payment_date': fields.date('Payment Date', required=True),
|
||||
'amount': fields.float('Amount', required=True),
|
||||
}
|
||||
_defaults = {
|
||||
'name': lambda obj, cr, uid, context: obj.pool.get('ir.sequence').get(cr, uid, 'pos.payment'),
|
||||
'journal_id': _journal_default,
|
||||
'payment_date': lambda *a: time.strftime('%Y-%m-%d'),
|
||||
}
|
||||
|
||||
def create(self, cr, user, vals, context=None):
|
||||
if vals.get('journal_id') and vals.get('amount'):
|
||||
return super(pos_payment, self).create(cr, user, vals, context)
|
||||
return False
|
||||
|
||||
def write(self, cr, user, ids, values, context=None):
|
||||
if 'amount' in values and not values['amount']:
|
||||
return False
|
||||
if 'journal_id' in values and not values['journal_id']:
|
||||
return False
|
||||
return super(pos_payment, self).write(cr, user, ids, values, context)
|
||||
|
||||
pos_payment()
|
||||
|
||||
class product_product(osv.osv):
|
||||
_inherit = 'product.product'
|
||||
_columns = {
|
||||
|
|
|
@ -17,17 +17,6 @@
|
|||
<field name="padding">3</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.sequence.type" id="seq_type_pos_payment">
|
||||
<field name="name">POS Payment</field>
|
||||
<field name="code">pos.payment</field>
|
||||
</record>
|
||||
<record model="ir.sequence" id="seq_pos_payment">
|
||||
<field name="name">POS Payment</field>
|
||||
<field name="code">pos.payment</field>
|
||||
<field name="prefix">Payment/</field>
|
||||
<field name="padding">2</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.sequence.type" id="seq_type_pos_order_line">
|
||||
<field name="name">POS order line</field>
|
||||
<field name="code">pos.order.line</field>
|
||||
|
|
|
@ -61,10 +61,10 @@ class pos_details_summary(report_sxw.rml_parse):
|
|||
|
||||
result = {}
|
||||
for obj in objects:
|
||||
for payment in obj.payments:
|
||||
if gift_journal_id and gift_journal_id == payment.journal_id.id:
|
||||
for payment in obj.statement_ids:
|
||||
if gift_journal_id and gift_journal_id == payment.statement_id.journal_id.id:
|
||||
continue
|
||||
result[payment.journal_id.name] = result.get(payment.journal_id.name, 0.0) + payment.amount
|
||||
result[payment.statement_id.journal_id.name] = result.get(payment.statement_id.journal_id.name, 0.0) + payment.amount
|
||||
return result
|
||||
|
||||
def _paid_total(self, objects):
|
||||
|
|
|
@ -161,7 +161,7 @@
|
|||
<blockTable colWidths="97.0,78.0" style="Table_Amount">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_default_2">[[ repeatIn(o.payments,'d') ]]</para>
|
||||
<para style="terp_default_2">[[ repeatIn(o.statement_ids,'d') ]]</para>
|
||||
<para style="terp_default_Bold_9_Right1">[[ d.name ]]:</para>
|
||||
</td>
|
||||
<td>
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
"access_pos_order_line","pos.order.line","model_pos_order_line","group_pos_user",1,1,1,1
|
||||
"access_pos_order_manager","pos.order manager","model_pos_order","group_pos_manager",1,0,0,0
|
||||
"access_pos_order_line_manager","pos.order.line manager","model_pos_order_line","group_pos_manager",1,1,1,1
|
||||
"access_pos_payment","pos.payment","model_pos_payment","group_pos_user",1,1,1,1
|
||||
"access_report_transaction_pos","report.transaction.pos","model_report_transaction_pos","group_pos_manager",1,1,1,1
|
||||
"access_pos_config_journal_manager","pos.config.journal.manager","model_pos_config_journal","group_pos_manager",1,1,1,1
|
||||
"access_account_journal_pos_manager","account.journal pos_manager","account.model_account_journal","group_pos_manager",1,1,1,0
|
||||
|
@ -61,11 +60,9 @@
|
|||
"access_pos_order_line_system","pos.order.line system","model_pos_order_line","base.group_system",1,0,0,0
|
||||
"access_account_bank_statement_line_manager","account.bank.statement.line manager","account.model_account_bank_statement_line","group_pos_manager",1,1,1,1
|
||||
"access_account_invoice_manager","account.invoice manager","account.model_account_invoice","group_pos_manager",1,1,1,1
|
||||
"access_pos_payment_manager","pos.payment manager","model_pos_payment","group_pos_manager",1,0,0,0
|
||||
"access_report_transaction_pos_system","report.transaction.pos system","model_report_transaction_pos","base.group_system",1,1,1,1
|
||||
"access_account_bank_statement_line_system","account.bank.statement.line system","account.model_account_bank_statement_line","base.group_system",1,0,0,0
|
||||
"access_product_product_supplierinfo","product.supplierinfo system","product.model_product_supplierinfo","base.group_system",1,0,0,0
|
||||
"access_pos_payment_system","pos.payment system","model_pos_payment","base.group_system",1,0,0,0
|
||||
"access_product_product_supplierinfo_manager","product.supplierinfo manager","product.model_product_supplierinfo","group_pos_manager",1,0,0,0
|
||||
"access_product_product_supplierinfo_user","product.supplierinfo user","product.model_product_supplierinfo","group_pos_user",1,0,0,0
|
||||
"access_product_product_packaging_system","product.packaging system","product.model_product_packaging","base.group_system",1,0,0,0
|
||||
|
|
|
Loading…
Reference in New Issue