[FIX] point_of_sale: Add some basic elements for new features

bzr revid: stw@openerp.com-20120416090122-52h5qt0tyga70p3r
This commit is contained in:
Stephane Wirtel 2012-04-16 11:01:22 +02:00
parent 71f6177e3c
commit 24687ac6bc
8 changed files with 56 additions and 18 deletions

View File

@ -26,7 +26,6 @@ from tools.translate import _
import decimal_precision as dp
class account_bank_statement(osv.osv):
def create(self, cr, uid, vals, context=None):
seq = 0
if 'line_ids' in vals:

View File

@ -327,6 +327,31 @@ class account_cash_statement(osv.osv):
cash_box_line_pool.write(cr, uid, [end.id], {'number': 0})
return True
def button_load_cashbox_line(self, cr, uid, ids, context=None):
if not ids:
return False
return True
account_cash_statement()
class account_journal(osv.osv):
_inherit = 'account.journal'
_columns = {
'cashbox_line_ids' : fields.one2many('account.journal.cashbox.line', 'journal_id', 'CashBox'),
}
account_journal()
class account_journal_cashbox_line(osv.osv):
_name = 'account.journal.cashbox.line'
_rec_name = 'value'
_columns = {
'value' : fields.float('Value'),
'journal_id' : fields.many2one('account.journal', 'Journal', required=True, select=1),
}
account_journal_cashbox_line()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -504,6 +504,13 @@
<separator colspan="4" string="Accounts Allowed (empty for no control)"/>
<field colspan="4" name="account_control_ids" nolabel="1"/>
</page>
<page string="Cash Box">
<field name="cashbox_line_ids" nolabel="1">
<tree string="CashBox Lines" editable="bottom">
<field name="value" />
</tree>
</field>
</page>
</notebook>
</form>
</field>
@ -2653,6 +2660,9 @@ action = pool.get('res.config').next(cr, uid, [], context)
</field>
</page>
<page string="CashBox">
<button name="load_cashbox_lines" type="object" string="Load CashBox Lines" />
<field name="cashbox_line_ids" />
<newline />
<group col="2" colspan="2" expand="1">
<field name="starting_details_ids" nolabel="1" colspan="2" attrs="{'readonly':[('state','!=','draft')]}">
<tree string = "Opening Balance" editable="bottom">

View File

@ -25,13 +25,16 @@ from osv import fields, osv
class account_journal(osv.osv):
_inherit = 'account.journal'
_columns = {
'auto_cash': fields.boolean('Automatic Opening', help="This field authorize the automatic creation of the cashbox, without control of the initial balance."),
'check_dtls': fields.boolean('Control Balance Before Closing', help="This field authorize Validation of Cashbox without controlling the closing balance."),
'journal_user': fields.boolean('PoS Payment Method', help="Check this box if this journal define a payment method that can be used in point of sales."),
'opening_control': fields.boolean('Opening Control'),
'closing_control': fields.boolean('Closing Control'),
'internal_account_id' : fields.many2one('account.account', 'Internal Transfers Account', select=1),
}
_defaults = {
'check_dtls': False,
'auto_cash': True,
'opening_control' : True,
'closing_control' : True,
}
account_journal()
@ -39,14 +42,14 @@ account_journal()
class account_cash_statement(osv.osv):
_inherit = 'account.bank.statement'
def _equal_balance(self, cr, uid, cash_id, context=None):
statement = self.browse(cr, uid, cash_id, context=context)
if not statement.journal_id.check_dtls:
return True
if statement.journal_id.check_dtls and (statement.balance_end != statement.balance_end_cash):
return False
else:
return True
#def _equal_balance(self, cr, uid, cash_id, context=None):
# statement = self.browse(cr, uid, cash_id, context=context)
# if not statement.journal_id.check_dtls:
# return True
# if statement.journal_id.check_dtls and (statement.balance_end != statement.balance_end_cash):
# return False
# else:
# return True
def _get_cash_open_box_lines(self, cr, uid, context=None):
res = super(account_cash_statement,self)._get_cash_open_box_lines(cr, uid, context)

View File

@ -12,8 +12,9 @@
<group col="6" colspan="4">
<separator colspan="6" string="Extended Configuration"/>
<field name="journal_user"/>
<field name="auto_cash"/>
<field name="check_dtls"/>
<field name="opening_control" />
<field name="closing_control" />
<field name="internal_account_id" />
</group>
</page>
</xpath>

View File

@ -242,7 +242,7 @@ class pos_order(osv.osv):
'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)]}),
'session_id' : fields.many2one('pos.session', 'Session', required=True, select=1),
#'session_id' : fields.many2one('pos.session', 'Session', required=True, select=1),
'state': fields.selection([('draft', 'New'),
('cancel', 'Cancelled'),

View File

@ -88,7 +88,7 @@ openerp.point_of_sale = function(db) {
this.fetch('product.product', ['name', 'list_price', 'pos_categ_id', 'taxes_id', 'product_image_small'], [['pos_categ_id', '!=', 'false']]),
this.fetch('account.bank.statement', ['account_id', 'currency', 'journal_id', 'state', 'name'],
[['state', '=', 'open'], ['user_id', '=', this.session.uid]]),
this.fetch('account.journal', ['auto_cash', 'check_dtls', 'currency', 'name', 'type']),
this.fetch('account.journal', ['opening_control', 'closing_control', 'currency', 'name', 'type']),
this.fetch('account.tax', ['amount', 'price_include', 'type']),
this.get_app_data())
.pipe(_.bind(this.build_tree, this));

View File

@ -65,7 +65,7 @@ class pos_open_statement(osv.osv_memory):
statement_id = statement_obj.create(cr, uid, data, context=context)
st_ids.append(int(statement_id))
if journal.auto_cash:
if journal.opening_control:
statement_obj.button_open(cr, uid, [statement_id], context)
tree_res = mod_obj.get_object_reference(cr, uid, 'point_of_sale', 'view_cash_statement_pos_tree')