[IMP] account: Merge the opening_control and closing_control flags in cash_control
[IMP] account: In the case where the bank statement is a cash register, we can get the coins of the last register. [IMP] account: Hide the 'Available Coins' if the journal hasn't the cash_control flag. [FIX] account: Use some default values for the profit/loss and internal account. [IMP] point_of_sale: Avoid to have two payment methods with the cash_control in a pos.config object. [REF] point_of_sale: Refactor the computation code of the cash_journal, cash_register and cash_control flags. [IMP] point_of_sale: Store the difference in the right account if the journal of the statement is a cash_control or nota. [FIX] point_of_sale: Use the session name instead of the order name for the account.bank.statement.line . [IMP] point_of_sale: [DEMO] Define the default payment_methods for the pos.config. bzr revid: stw@openerp.com-20120828112116-lblikdcn92lcpc7w
This commit is contained in:
parent
4e31d1be93
commit
768d9cdb7e
|
@ -746,9 +746,11 @@ class account_journal(osv.osv):
|
||||||
'profit_account_id' : fields.many2one('account.account', 'Profit Account'),
|
'profit_account_id' : fields.many2one('account.account', 'Profit Account'),
|
||||||
'loss_account_id' : fields.many2one('account.account', 'Loss Account'),
|
'loss_account_id' : fields.many2one('account.account', 'Loss Account'),
|
||||||
'internal_account_id' : fields.many2one('account.account', 'Internal Transfers Account', select=1),
|
'internal_account_id' : fields.many2one('account.account', 'Internal Transfers Account', select=1),
|
||||||
|
'cash_control' : fields.boolean('Cash Control', help='If you want the journal should be control at opening/closing, check this option'),
|
||||||
}
|
}
|
||||||
|
|
||||||
_defaults = {
|
_defaults = {
|
||||||
|
'cash_control' : False,
|
||||||
'with_last_closing_balance' : False,
|
'with_last_closing_balance' : False,
|
||||||
'user_id': lambda self, cr, uid, context: uid,
|
'user_id': lambda self, cr, uid, context: uid,
|
||||||
'company_id': lambda self, cr, uid, c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id,
|
'company_id': lambda self, cr, uid, c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id,
|
||||||
|
|
|
@ -194,12 +194,27 @@ class account_cash_statement(osv.osv):
|
||||||
journal = self.pool.get('account.journal').browse(cr, uid, vals['journal_id'], context=context)
|
journal = self.pool.get('account.journal').browse(cr, uid, vals['journal_id'], context=context)
|
||||||
if journal and (journal.type == 'cash') and not vals.get('details_ids'):
|
if journal and (journal.type == 'cash') and not vals.get('details_ids'):
|
||||||
vals['details_ids'] = []
|
vals['details_ids'] = []
|
||||||
|
|
||||||
|
last_pieces = None
|
||||||
|
|
||||||
|
if journal.with_last_closing_balance == True:
|
||||||
|
domain = [('journal_id', '=', journal.id),
|
||||||
|
('state', '=', 'confirm')]
|
||||||
|
last_bank_statement_ids = self.search(cr, uid, domain, limit=1, order='create_date desc', context=context)
|
||||||
|
if last_bank_statement_ids:
|
||||||
|
last_bank_statement = self.browse(cr, uid, last_bank_statement_ids[0], context=context)
|
||||||
|
|
||||||
|
last_pieces = dict(
|
||||||
|
(line.pieces, line.number_closing) for line in last_bank_statement.details_ids
|
||||||
|
)
|
||||||
|
|
||||||
for value in journal.cashbox_line_ids:
|
for value in journal.cashbox_line_ids:
|
||||||
nested_values = {
|
nested_values = {
|
||||||
'number_closing' : 0,
|
'number_closing' : 0,
|
||||||
'number_opening' : 0,
|
'number_opening' : last_pieces.get(value.pieces, 0) if isinstance(last_pieces, dict) else 0,
|
||||||
'pieces' : value.pieces
|
'pieces' : value.pieces
|
||||||
}
|
}
|
||||||
|
|
||||||
vals['details_ids'].append([0, False, nested_values])
|
vals['details_ids'].append([0, False, nested_values])
|
||||||
|
|
||||||
res_id = super(account_cash_statement, self).create(cr, uid, vals, context=context)
|
res_id = super(account_cash_statement, self).create(cr, uid, vals, context=context)
|
||||||
|
|
|
@ -515,7 +515,7 @@
|
||||||
<separator colspan="4" string="Accounts Allowed (empty for no control)"/>
|
<separator colspan="4" string="Accounts Allowed (empty for no control)"/>
|
||||||
<field colspan="4" name="account_control_ids" nolabel="1"/>
|
<field colspan="4" name="account_control_ids" nolabel="1"/>
|
||||||
</page>
|
</page>
|
||||||
<page string="Cash Registers" attrs="{'invisible':[('type', '!=', 'cash')]}">
|
<page string="Cash Registers">
|
||||||
<group>
|
<group>
|
||||||
<group string="Accounts">
|
<group string="Accounts">
|
||||||
<field name="profit_account_id"/>
|
<field name="profit_account_id"/>
|
||||||
|
@ -524,10 +524,11 @@
|
||||||
</group>
|
</group>
|
||||||
<group string="Miscellaneous">
|
<group string="Miscellaneous">
|
||||||
<field name="with_last_closing_balance"/>
|
<field name="with_last_closing_balance"/>
|
||||||
|
<field name="cash_control"/>
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
<separator string="Available Coins" colspan="4" />
|
<separator string="Available Coins" colspan="4" attrs="{'invisible' : [('cash_control', '=', False)] }"/>
|
||||||
<field name="cashbox_line_ids" nolabel="1" string="Unit Of Currency Definition" colspan="4">
|
<field name="cashbox_line_ids" nolabel="1" string="Unit Of Currency Definition" colspan="4" attrs="{'invisible' : [('cash_control', '=', False)]}">
|
||||||
<tree string="CashBox Lines" editable="bottom">
|
<tree string="CashBox Lines" editable="bottom">
|
||||||
<field name="pieces" />
|
<field name="pieces" />
|
||||||
</tree>
|
</tree>
|
||||||
|
|
|
@ -381,6 +381,10 @@
|
||||||
<field name="name">Cash Journal - (test)</field>
|
<field name="name">Cash Journal - (test)</field>
|
||||||
<field name="code">TCSH</field>
|
<field name="code">TCSH</field>
|
||||||
<field name="type">cash</field>
|
<field name="type">cash</field>
|
||||||
|
<field name="profit_account_id" model="account.account" ref="rsa" />
|
||||||
|
<field name="loss_account_id" model="account.account" ref="rsa" />
|
||||||
|
<field name="internal_account_id" model="account.account" ref="chart0" />
|
||||||
|
<field name="cash_control" eval="True" />
|
||||||
<field name="view_id" ref="account_journal_bank_view"/>
|
<field name="view_id" ref="account_journal_bank_view"/>
|
||||||
<field name="sequence_id" ref="sequence_cash_journal"/>
|
<field name="sequence_id" ref="sequence_cash_journal"/>
|
||||||
<field model="account.account" name="default_debit_account_id" ref="cash"/>
|
<field model="account.account" name="default_debit_account_id" ref="cash"/>
|
||||||
|
|
|
@ -27,15 +27,10 @@ class account_journal(osv.osv):
|
||||||
_columns = {
|
_columns = {
|
||||||
'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."),
|
'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', help="If you want the journal should be control at opening, check this option"),
|
|
||||||
'closing_control': fields.boolean('Closing Control', help="If you want the journal should be control at closing, check this option"),
|
|
||||||
|
|
||||||
'amount_authorized_diff' : fields.float('Amount Authorized Difference'),
|
'amount_authorized_diff' : fields.float('Amount Authorized Difference'),
|
||||||
'self_checkout_payment_method' : fields.boolean('Self Checkout Payment Method'),
|
'self_checkout_payment_method' : fields.boolean('Self Checkout Payment Method'),
|
||||||
}
|
}
|
||||||
_defaults = {
|
_defaults = {
|
||||||
'opening_control' : False,
|
|
||||||
'closing_control' : False,
|
|
||||||
'self_checkout_payment_method' : False,
|
'self_checkout_payment_method' : False,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,6 +41,7 @@ class account_cash_statement(osv.osv):
|
||||||
_columns = {
|
_columns = {
|
||||||
'pos_session_id' : fields.many2one('pos.session'),
|
'pos_session_id' : fields.many2one('pos.session'),
|
||||||
}
|
}
|
||||||
|
|
||||||
account_cash_statement()
|
account_cash_statement()
|
||||||
|
|
||||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -10,8 +10,6 @@
|
||||||
<page string="Point of Sale">
|
<page string="Point of Sale">
|
||||||
<group col="4" colspan="4">
|
<group col="4" colspan="4">
|
||||||
<field name="journal_user"/>
|
<field name="journal_user"/>
|
||||||
<field name="opening_control"/>
|
|
||||||
<field name="closing_control"/>
|
|
||||||
<field name="amount_authorized_diff"/>
|
<field name="amount_authorized_diff"/>
|
||||||
<field name="self_checkout_payment_method" />
|
<field name="self_checkout_payment_method" />
|
||||||
</group>
|
</group>
|
||||||
|
@ -113,37 +111,5 @@
|
||||||
<field name="view_id" ref="account.view_bank_statement_form2"/>
|
<field name="view_id" ref="account.view_bank_statement_form2"/>
|
||||||
<field name="act_window_id" ref="action_new_bank_statement_all_tree"/>
|
<field name="act_window_id" ref="action_new_bank_statement_all_tree"/>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<!--
|
|
||||||
<menuitem name="Cash Register Management" parent="point_of_sale.menu_point_root"
|
|
||||||
id="menu_point_open_config" sequence="10"/>
|
|
||||||
<menuitem
|
|
||||||
name="Open Cash Registers" parent="menu_point_open_config"
|
|
||||||
string="Open Cash Registers"
|
|
||||||
action="action_pos_open_statement"
|
|
||||||
id="menu_open_statement" sequence="1" />
|
|
||||||
|
|
||||||
<menuitem
|
|
||||||
name="Close Cash Registers" parent="menu_point_open_config"
|
|
||||||
string="Close Cash Registers"
|
|
||||||
action="action_pos_close_statement"
|
|
||||||
id="menu_close_statement" sequence="2" />
|
|
||||||
|
|
||||||
<menuitem
|
|
||||||
parent="menu_point_open_config"
|
|
||||||
action="action_pos_confirm"
|
|
||||||
id="menu_wizard_pos_confirm" sequence="8" />
|
|
||||||
|
|
||||||
|
|
||||||
<menuitem
|
|
||||||
name="List of Cash Registers"
|
|
||||||
parent="menu_point_open_config"
|
|
||||||
action="action_new_bank_statement_all_tree"
|
|
||||||
id="menu_all_menu_all_register"
|
|
||||||
sequence="4"
|
|
||||||
/>
|
|
||||||
-->
|
|
||||||
|
|
||||||
|
|
||||||
</data>
|
</data>
|
||||||
</openerp>
|
</openerp>
|
||||||
|
|
|
@ -74,6 +74,17 @@ class pos_config(osv.osv):
|
||||||
'group_by' : fields.boolean('Group Journal Items', help="Check this if you want to group the Journal Items by Product while closing a Session"),
|
'group_by' : fields.boolean('Group Journal Items', help="Check this if you want to group the Journal Items by Product while closing a Session"),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def _check_cash_control(self, cr, uid, ids, context=None):
|
||||||
|
return all(
|
||||||
|
(sum(int(journal.cash_control) for journal in record.journal_ids) <= 1)
|
||||||
|
for record in self.browse(cr, uid, ids, context=context)
|
||||||
|
)
|
||||||
|
|
||||||
|
_constraints = [
|
||||||
|
(_check_cash_control, "You cannot have two cash controls in one Point Of Sale !", ['journal_ids']),
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
def name_get(self, cr, uid, ids, context=None):
|
def name_get(self, cr, uid, ids, context=None):
|
||||||
result = []
|
result = []
|
||||||
states = {
|
states = {
|
||||||
|
@ -90,11 +101,6 @@ class pos_config(osv.osv):
|
||||||
result.append((record.id, record.name + ' ('+session.user_id.name+')')) #, '+states[session.state]+')'))
|
result.append((record.id, record.name + ' ('+session.user_id.name+')')) #, '+states[session.state]+')'))
|
||||||
return result
|
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):
|
def _default_sale_journal(self, cr, uid, context=None):
|
||||||
res = self.pool.get('account.journal').search(cr, uid, [('type', '=', 'sale')], limit=1)
|
res = self.pool.get('account.journal').search(cr, uid, [('type', '=', 'sale')], limit=1)
|
||||||
return res and res[0] or False
|
return res and res[0] or False
|
||||||
|
@ -107,7 +113,6 @@ class pos_config(osv.osv):
|
||||||
'state' : POS_CONFIG_STATE[0][0],
|
'state' : POS_CONFIG_STATE[0][0],
|
||||||
'shop_id': _default_shop,
|
'shop_id': _default_shop,
|
||||||
'journal_id': _default_sale_journal,
|
'journal_id': _default_sale_journal,
|
||||||
'journal_ids': _default_payment_journal,
|
|
||||||
'group_by' : True,
|
'group_by' : True,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,45 +153,20 @@ class pos_session(osv.osv):
|
||||||
('closed', 'Closed & Posted'),
|
('closed', 'Closed & Posted'),
|
||||||
]
|
]
|
||||||
|
|
||||||
def _compute_cash_journal_id(self, cr, uid, ids, fieldnames, args, context=None):
|
def _compute_cash_all(self, cr, uid, ids, fieldnames, args, context=None):
|
||||||
result = dict.fromkeys(ids, False)
|
result = dict()
|
||||||
for record in self.browse(cr, uid, ids, context=context):
|
|
||||||
for st in record.statement_ids:
|
|
||||||
if st.journal_id.type == 'cash':
|
|
||||||
result[record.id] = st.journal_id.id
|
|
||||||
break
|
|
||||||
return result
|
|
||||||
|
|
||||||
def _compute_cash_register_id(self, cr, uid, ids, fieldnames, args, context=None):
|
|
||||||
result = dict.fromkeys(ids, False)
|
|
||||||
for record in self.browse(cr, uid, ids, context=context):
|
|
||||||
for st in record.statement_ids:
|
|
||||||
if st.journal_id.type == 'cash':
|
|
||||||
result[record.id] = st.id
|
|
||||||
break
|
|
||||||
return result
|
|
||||||
|
|
||||||
def _compute_controls(self, cr, uid, ids, fieldnames, args, context=None):
|
|
||||||
result = {}
|
|
||||||
|
|
||||||
for record in self.browse(cr, uid, ids, context=context):
|
for record in self.browse(cr, uid, ids, context=context):
|
||||||
has_opening_control = False
|
result[record.id] = {
|
||||||
has_closing_control = False
|
'cash_journal_id' : False,
|
||||||
|
'cash_register_id' : False,
|
||||||
for journal in record.config_id.journal_ids:
|
'cash_control' : False,
|
||||||
if journal.opening_control == True:
|
|
||||||
has_opening_control = True
|
|
||||||
if journal.closing_control == True:
|
|
||||||
has_closing_control = True
|
|
||||||
|
|
||||||
if has_opening_control and has_closing_control:
|
|
||||||
break
|
|
||||||
|
|
||||||
values = {
|
|
||||||
'has_opening_control': has_opening_control,
|
|
||||||
'has_closing_control': has_closing_control,
|
|
||||||
}
|
}
|
||||||
result[record.id] = values
|
for st in record.statement_ids:
|
||||||
|
if st.journal_id.cash_control == True:
|
||||||
|
result[record.id]['cash_control'] = True
|
||||||
|
result[record.id]['cash_journal_id'] = st.journal_id.id
|
||||||
|
result[record.id]['cash_register_id'] = st.id
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
@ -212,12 +192,17 @@ class pos_session(osv.osv):
|
||||||
required=True, readonly=True,
|
required=True, readonly=True,
|
||||||
select=1),
|
select=1),
|
||||||
|
|
||||||
'cash_journal_id' : fields.function(_compute_cash_journal_id, method=True,
|
'cash_control' : fields.function(_compute_cash_all,
|
||||||
type='many2one', relation='account.journal',
|
multi='cash',
|
||||||
string='Cash Journal', store=True),
|
type='boolean', string='Has Cash Control'),
|
||||||
'cash_register_id' : fields.function(_compute_cash_register_id, method=True,
|
'cash_journal_id' : fields.function(_compute_cash_all,
|
||||||
type='many2one', relation='account.bank.statement',
|
multi='cash',
|
||||||
string='Cash Register', store=True),
|
type='many2one', relation='account.journal',
|
||||||
|
string='Cash Journal', store=True),
|
||||||
|
'cash_register_id' : fields.function(_compute_cash_all,
|
||||||
|
multi='cash',
|
||||||
|
type='many2one', relation='account.bank.statement',
|
||||||
|
string='Cash Register', store=True),
|
||||||
|
|
||||||
'opening_details_ids' : fields.related('cash_register_id', 'opening_details_ids',
|
'opening_details_ids' : fields.related('cash_register_id', 'opening_details_ids',
|
||||||
type='one2many', relation='account.cashbox.line',
|
type='one2many', relation='account.cashbox.line',
|
||||||
|
@ -261,8 +246,6 @@ class pos_session(osv.osv):
|
||||||
'order_ids' : fields.one2many('pos.order', 'session_id', 'Orders'),
|
'order_ids' : fields.one2many('pos.order', 'session_id', 'Orders'),
|
||||||
|
|
||||||
'statement_ids' : fields.one2many('account.bank.statement', 'pos_session_id', 'Bank Statement', readonly=True),
|
'statement_ids' : fields.one2many('account.bank.statement', 'pos_session_id', 'Bank Statement', readonly=True),
|
||||||
'has_opening_control' : fields.function(_compute_controls, string='Has Opening Control', multi='control', type='boolean'),
|
|
||||||
'has_closing_control' : fields.function(_compute_controls, string='Has Closing Control', multi='control', type='boolean'),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_defaults = {
|
_defaults = {
|
||||||
|
@ -372,10 +355,8 @@ class pos_session(osv.osv):
|
||||||
def wkf_action_closing_control(self, cr, uid, ids, context=None):
|
def wkf_action_closing_control(self, cr, uid, ids, context=None):
|
||||||
for session in self.browse(cr, uid, ids, context=context):
|
for session in self.browse(cr, uid, ids, context=context):
|
||||||
for statement in session.statement_ids:
|
for statement in session.statement_ids:
|
||||||
if statement.id <> session.cash_register_id.id:
|
if statement != session.cash_register_id and statement.balance_end != statement.balance_end_real:
|
||||||
if statement.balance_end<>statement.balance_end_real:
|
self.pool.get('account.bank.statement').write(cr, uid, [statement.id], {'balance_end_real': statement.balance_end})
|
||||||
self.pool.get('account.bank.statement').write(cr, uid,
|
|
||||||
[statement.id], {'balance_end_real': statement.balance_end})
|
|
||||||
return self.write(cr, uid, ids, {'state' : 'closing_control', 'stop_at' : time.strftime('%Y-%m-%d %H:%M:%S')}, context=context)
|
return self.write(cr, uid, ids, {'state' : 'closing_control', 'stop_at' : time.strftime('%Y-%m-%d %H:%M:%S')}, context=context)
|
||||||
|
|
||||||
def wkf_action_close(self, cr, uid, ids, context=None):
|
def wkf_action_close(self, cr, uid, ids, context=None):
|
||||||
|
@ -388,7 +369,7 @@ class pos_session(osv.osv):
|
||||||
if not self.pool.get('ir.model.access').check_groups(cr, uid, "point_of_sale.group_pos_manager"):
|
if not self.pool.get('ir.model.access').check_groups(cr, uid, "point_of_sale.group_pos_manager"):
|
||||||
raise osv.except_osv( _('Error!'),
|
raise osv.except_osv( _('Error!'),
|
||||||
_("Your ending balance is too different from the theorical cash closing (%.2f), the maximum allowed is: %.2f. You can contact your manager to force it.") % (st.difference, st.journal_id.amount_authorized_diff))
|
_("Your ending balance is too different from the theorical cash closing (%.2f), the maximum allowed is: %.2f. You can contact your manager to force it.") % (st.difference, st.journal_id.amount_authorized_diff))
|
||||||
if st.difference:
|
if st.difference and st.journal_id.cash_control == True:
|
||||||
if st.difference > 0.0:
|
if st.difference > 0.0:
|
||||||
name= _('Point of Sale Profit')
|
name= _('Point of Sale Profit')
|
||||||
account_id = st.journal_id.profit_account_id.id
|
account_id = st.journal_id.profit_account_id.id
|
||||||
|
@ -695,7 +676,7 @@ class pos_order(osv.osv):
|
||||||
}
|
}
|
||||||
if 'payment_date' in data:
|
if 'payment_date' in data:
|
||||||
args['date'] = data['payment_date']
|
args['date'] = data['payment_date']
|
||||||
args['name'] = order.name
|
args['name'] = order.session_id.name
|
||||||
if data.get('payment_name', False):
|
if data.get('payment_name', False):
|
||||||
args['name'] = args['name'] + ': ' + data['payment_name']
|
args['name'] = args['name'] + ': ' + data['payment_name']
|
||||||
account_def = property_obj.get(cr, uid, 'property_account_receivable', 'res.partner', context=context)
|
account_def = property_obj.get(cr, uid, 'property_account_receivable', 'res.partner', context=context)
|
||||||
|
@ -1084,6 +1065,7 @@ class account_bank_statement_line(osv.osv):
|
||||||
_columns= {
|
_columns= {
|
||||||
'pos_statement_id': fields.many2one('pos.order', ondelete='cascade'),
|
'pos_statement_id': fields.many2one('pos.order', ondelete='cascade'),
|
||||||
}
|
}
|
||||||
|
|
||||||
account_bank_statement_line()
|
account_bank_statement_line()
|
||||||
|
|
||||||
class pos_order_line(osv.osv):
|
class pos_order_line(osv.osv):
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<field name="groups_id" eval="[(4,ref('group_pos_user'))]"/>
|
<field name="groups_id" eval="[(4,ref('group_pos_user'))]"/>
|
||||||
<field name="ean13">0410200000005</field>
|
<field name="ean13">0410200000005</field>
|
||||||
</record>
|
</record>
|
||||||
<record id="account.cash_journal" model="account.journal">
|
<record id="account.cash_journal" model="account.journal">
|
||||||
<field eval="True" name="journal_user"/>
|
<field eval="True" name="journal_user"/>
|
||||||
</record>
|
</record>
|
||||||
<record id="base.user_jsmith" model="res.users">
|
<record id="base.user_jsmith" model="res.users">
|
||||||
|
@ -36,6 +36,10 @@
|
||||||
<field name="groups_id" eval="[(4,ref('group_pos_user'))]"/>
|
<field name="groups_id" eval="[(4,ref('group_pos_user'))]"/>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
<record model="pos.config" id="pos_config_main">
|
||||||
|
<field name="journal_ids" eval="[(6, 0, [ref('account.cash_journal'), ref('account.bank_journal')])]" />
|
||||||
|
</record>
|
||||||
|
|
||||||
<!-- Resource: pos.category -->
|
<!-- Resource: pos.category -->
|
||||||
|
|
||||||
<record id="beverage" model="pos.category">
|
<record id="beverage" model="pos.category">
|
||||||
|
|
|
@ -791,8 +791,7 @@
|
||||||
<field name="code" />
|
<field name="code" />
|
||||||
<field name="name" />
|
<field name="name" />
|
||||||
<field name="type" />
|
<field name="type" />
|
||||||
<field name="opening_control" />
|
<field name="cash_control" />
|
||||||
<field name="closing_control" />
|
|
||||||
</tree>
|
</tree>
|
||||||
</field>
|
</field>
|
||||||
<group string="Material Interfaces" >
|
<group string="Material Interfaces" >
|
||||||
|
@ -878,10 +877,10 @@
|
||||||
<header>
|
<header>
|
||||||
<button name="open" type="workflow" string="Validate & Open Session" states="opening_control" class="oe_highlight"/>
|
<button name="open" type="workflow" string="Validate & Open Session" states="opening_control" class="oe_highlight"/>
|
||||||
<button name="cashbox_control" type="workflow" string="End of Session"
|
<button name="cashbox_control" type="workflow" string="End of Session"
|
||||||
attrs="{'invisible' : [('has_closing_control', '=', False),('state', '=', 'opened')]}"
|
attrs="{'invisible' : ['|', ('cash_control', '=', False),('state', '!=', 'opened')]}"
|
||||||
class="oe_highlight" />
|
class="oe_highlight" />
|
||||||
<button name="close" type="workflow" string="Validate Closing & Post Entries"
|
<button name="close" type="workflow" string="Validate Closing & Post Entries"
|
||||||
attrs="{'invisible' : [('has_closing_control', '=', True),('state', '=', 'opened')]}"
|
attrs="{'invisible' : ['|', ('cash_control', '=', True),('state', '!=', 'opened')]}"
|
||||||
class="oe_highlight" />
|
class="oe_highlight" />
|
||||||
<button name="close" type="workflow" string="Validate Closing & Post Entries" states="closing_control"
|
<button name="close" type="workflow" string="Validate Closing & Post Entries" states="closing_control"
|
||||||
class="oe_highlight" />
|
class="oe_highlight" />
|
||||||
|
@ -900,8 +899,7 @@
|
||||||
<field name="name" attrs="{'invisible': [('name','=','/')]}" class="oe_inline"/>
|
<field name="name" attrs="{'invisible': [('name','=','/')]}" class="oe_inline"/>
|
||||||
</h1>
|
</h1>
|
||||||
<group>
|
<group>
|
||||||
<field name="has_opening_control" invisible="1" />
|
<field name="cash_control" invisible="1" />
|
||||||
<field name="has_closing_control" invisible="1" />
|
|
||||||
<group>
|
<group>
|
||||||
<field name="user_id"/>
|
<field name="user_id"/>
|
||||||
<field name="config_id" attrs="{'invisible' : [('config_id', '<>', False)]}"/>
|
<field name="config_id" attrs="{'invisible' : [('config_id', '<>', False)]}"/>
|
||||||
|
@ -912,20 +910,20 @@
|
||||||
</group>
|
</group>
|
||||||
<newline/>
|
<newline/>
|
||||||
|
|
||||||
<group string="Opening Cash Control">
|
<group string="Opening Cash Control" attrs="{'invisible' : [('cash_control', '=', False)]}">
|
||||||
<field name="opening_details_ids" nolabel="1" colspan="2" attrs="{'readonly' : [('state', 'not in', ('opening_control',))]}">
|
<field name="opening_details_ids" nolabel="1" colspan="2" attrs="{'readonly' : [('state', 'not in', ('opening_control',))]}">
|
||||||
<tree string="Opening Cashbox Lines" editable="bottom">
|
<tree string="Opening Cashbox Lines" editable="bottom">
|
||||||
<field name="pieces" readonly="1" />
|
<field name="pieces" readonly="1" />
|
||||||
<field name="number_opening" string="Opening Unit Numbers" on_change="on_change_sub_opening(pieces, number_opening)" />
|
<field name="number_opening" on_change="on_change_sub_opening(pieces, number_opening)" />
|
||||||
<field name="subtotal_opening" string="Opening Subtotal" sum="Total"/>
|
<field name="subtotal_opening" string="Opening Subtotal" sum="Total"/>
|
||||||
</tree>
|
</tree>
|
||||||
</field>
|
</field>
|
||||||
</group>
|
</group>
|
||||||
<group string="Closing Cash Control" attrs="{'invisible': [('state', '=', 'opening_control')]}">
|
<group string="Closing Cash Control" attrs="{'invisible': [('state', '!=', 'closing_control')]}">
|
||||||
<field name="details_ids" nolabel="1" colspan="2">
|
<field name="details_ids" nolabel="1" colspan="2">
|
||||||
<tree string="Cashbox Lines" editable="bottom">
|
<tree string="Cashbox Lines" editable="bottom">
|
||||||
<field name="pieces" readonly="1" />
|
<field name="pieces" readonly="1" />
|
||||||
<field name="number_closing"/>
|
<field name="number_closing" />
|
||||||
<field name="subtotal_closing"/>
|
<field name="subtotal_closing"/>
|
||||||
</tree>
|
</tree>
|
||||||
</field>
|
</field>
|
||||||
|
|
|
@ -126,14 +126,14 @@
|
||||||
<field name="act_from" ref="act_start" />
|
<field name="act_from" ref="act_start" />
|
||||||
<field name="act_to" ref="act_opening_control" />
|
<field name="act_to" ref="act_opening_control" />
|
||||||
<field name="signal" eval="False" /> <!-- >start_to_opening_control</field> -->
|
<field name="signal" eval="False" /> <!-- >start_to_opening_control</field> -->
|
||||||
<field name="condition">has_opening_control == True</field>
|
<field name="condition">cash_control == True</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record model="workflow.transition" id="trans_start_to_open">
|
<record model="workflow.transition" id="trans_start_to_open">
|
||||||
<field name="act_from" ref="act_start" />
|
<field name="act_from" ref="act_start" />
|
||||||
<field name="act_to" ref="act_open" />
|
<field name="act_to" ref="act_open" />
|
||||||
<field name="signal" eval="False" />
|
<field name="signal" eval="False" />
|
||||||
<field name="condition">has_opening_control == False</field>
|
<field name="condition">cash_control == False</field>
|
||||||
</record>
|
</record>
|
||||||
<!-- state:opening_control -> signal:open -> state:opened -> signal:cashbox_control -> state:closing_control -> signal:close -> state:close -->
|
<!-- state:opening_control -> signal:open -> state:opened -> signal:cashbox_control -> state:closing_control -> signal:close -> state:close -->
|
||||||
|
|
||||||
|
@ -147,14 +147,14 @@
|
||||||
<field name="act_from" ref="act_open" />
|
<field name="act_from" ref="act_open" />
|
||||||
<field name="act_to" ref="act_closing_control" />
|
<field name="act_to" ref="act_closing_control" />
|
||||||
<field name="signal">cashbox_control</field>
|
<field name="signal">cashbox_control</field>
|
||||||
<field name="condition">has_closing_control == True</field>
|
<field name="condition">cash_control == True</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record model="workflow.transition" id="trans_open_to_close">
|
<record model="workflow.transition" id="trans_open_to_close">
|
||||||
<field name="act_from" ref="act_open" />
|
<field name="act_from" ref="act_open" />
|
||||||
<field name="act_to" ref="act_close" />
|
<field name="act_to" ref="act_close" />
|
||||||
<field name="signal">close</field>
|
<field name="signal">close</field>
|
||||||
<field name="condition">has_closing_control == False</field>
|
<field name="condition">cash_control == False</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record model="workflow.transition" id="trans_closing_control_to_close">
|
<record model="workflow.transition" id="trans_closing_control_to_close">
|
||||||
|
|
|
@ -65,7 +65,7 @@ class pos_open_statement(osv.osv_memory):
|
||||||
statement_id = statement_obj.create(cr, uid, data, context=context)
|
statement_id = statement_obj.create(cr, uid, data, context=context)
|
||||||
st_ids.append(int(statement_id))
|
st_ids.append(int(statement_id))
|
||||||
|
|
||||||
if journal.opening_control:
|
if journal.cash_control:
|
||||||
statement_obj.button_open(cr, uid, [statement_id], context)
|
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')
|
tree_res = mod_obj.get_object_reference(cr, uid, 'point_of_sale', 'view_cash_statement_pos_tree')
|
||||||
|
|
Loading…
Reference in New Issue