[FIX]: merge from the trunk addons branch
bzr revid: mga@tinyerp.com-20100915085306-xhzqy8d42hrsjt2i
This commit is contained in:
@@ -29,6 +29,25 @@ 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:
|
||||
for line in vals['line_ids']:
|
||||
seq += 1
|
||||
line[2]['sequence'] = seq
|
||||
vals[seq - 1] = line
|
||||
return super(account_bank_statement, self).create(cr, uid, vals, context=context)
|
||||
|
||||
def write(self, cr, uid, ids, vals, context=None):
|
||||
res = super(account_bank_statement, self).write(cr, uid, ids, vals, context=context)
|
||||
for statement in self.browse(cr, uid, ids, context):
|
||||
seq = 0
|
||||
for line in statement.line_ids:
|
||||
seq += 1
|
||||
if not line.sequence:
|
||||
self.pool.get('account.bank.statement.line').write(cr, uid, [line.id], {'sequence': seq}, context=context)
|
||||
return res
|
||||
|
||||
def button_import_invoice(self, cr, uid, ids, context=None):
|
||||
mod_obj = self.pool.get('ir.model.data')
|
||||
if context is None:
|
||||
@@ -141,7 +160,7 @@ class account_bank_statement(osv.osv):
|
||||
'balance_end_real': fields.float('Ending Balance', digits_compute=dp.get_precision('Account'),
|
||||
states={'confirm':[('readonly', True)]}),
|
||||
'balance_end': fields.function(_end_balance, method=True, string='Balance'),
|
||||
'company_id': fields.related('journal_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True),
|
||||
'company_id': fields.related('journal_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True, readonly=True),
|
||||
'line_ids': fields.one2many('account.bank.statement.line',
|
||||
'statement_id', 'Statement lines',
|
||||
states={'confirm':[('readonly', True)]}),
|
||||
@@ -717,7 +736,6 @@ class account_bank_statement_line(osv.osv):
|
||||
'name': lambda self,cr,uid,context={}: self.pool.get('ir.sequence').get(cr, uid, 'account.bank.statement.line'),
|
||||
'date': lambda *a: time.strftime('%Y-%m-%d'),
|
||||
'type': lambda *a: 'general',
|
||||
'sequence': lambda *a: 10,
|
||||
}
|
||||
|
||||
account_bank_statement_line()
|
||||
|
||||
@@ -204,7 +204,6 @@ class account_cash_statement(osv.osv):
|
||||
return res
|
||||
|
||||
_columns = {
|
||||
'company_id':fields.many2one('res.company', 'Company', required=True, states={'draft': [('readonly', False)]}, readonly=True,),
|
||||
'journal_id': fields.many2one('account.journal', 'Journal', required=True, states={'draft': [('readonly', False)]}, readonly=True, domain=[('type', '=', 'cash')]),
|
||||
'balance_end_real': fields.float('Closing Balance', digits_compute=dp.get_precision('Account'), states={'confirm':[('readonly', True)]}, help="closing balance entered by the cashbox verifier"),
|
||||
'state': fields.selection(
|
||||
@@ -224,22 +223,18 @@ class account_cash_statement(osv.osv):
|
||||
'state': lambda *a: 'draft',
|
||||
'date': lambda *a:time.strftime("%Y-%m-%d %H:%M:%S"),
|
||||
'user_id': lambda self, cr, uid, context=None: uid,
|
||||
'company_id': _get_company,
|
||||
'starting_details_ids':_get_cash_open_box_lines,
|
||||
'ending_details_ids':_get_default_cash_close_box_lines
|
||||
}
|
||||
|
||||
def create(self, cr, uid, vals, context=None):
|
||||
company_id = vals and vals.get('company_id',False)
|
||||
if company_id:
|
||||
sql = [
|
||||
('company_id', '=', vals['company_id']),
|
||||
sql = [
|
||||
('journal_id', '=', vals['journal_id']),
|
||||
('state', '=', 'open')
|
||||
]
|
||||
open_jrnl = self.search(cr, uid, sql)
|
||||
if open_jrnl:
|
||||
raise osv.except_osv('Error', _('You can not have two open register for the same journal'))
|
||||
]
|
||||
open_jrnl = self.search(cr, uid, sql)
|
||||
if open_jrnl:
|
||||
raise osv.except_osv('Error', _('You can not have two open register for the same journal'))
|
||||
|
||||
if self.pool.get('account.journal').browse(cr, uid, vals['journal_id']).type == 'cash':
|
||||
lines = end_lines = self._get_cash_close_box_lines(cr, uid, [], context)
|
||||
|
||||
@@ -524,15 +524,15 @@
|
||||
<page string="Transaction">
|
||||
<field colspan="4" name="line_ids" nolabel="1">
|
||||
<tree editable="bottom" string="Statement lines">
|
||||
<field name="sequence"/>
|
||||
<field name="sequence" readonly="1"/>
|
||||
<field name="date"/>
|
||||
<field name="ref"/>
|
||||
<field name="name"/>
|
||||
<field name="type"/>
|
||||
<field name="partner_id" on_change="onchange_partner_id(partner_id, type, parent.currency, {'amount': amount})"/>
|
||||
<field domain="[('journal_id','=',parent.journal_id)]" name="account_id"/>
|
||||
<field name="analytic_account_id" groups="base.group_extended"/>
|
||||
<field name="amount"/>
|
||||
<field name="analytic_account_id"/>
|
||||
<field context="{'partner_id': partner_id, 'amount': amount, 'account_id': account_id, 'currency_id': parent.currency, 'journal_id': parent.journal_id, 'date':date}" name="reconcile_id"/>
|
||||
<field invisible="1" name="reconcile_amount"/>
|
||||
</tree>
|
||||
@@ -546,7 +546,7 @@
|
||||
<field name="amount"/>
|
||||
<field context="{'partner_id':partner_id,'amount':amount,'account_id':account_id,'currency_id': parent.currency,'journal_id':parent.journal_id, 'date':date}" name="reconcile_id"/>
|
||||
<field name="ref"/>
|
||||
<field name="sequence"/>
|
||||
<field name="sequence" readonly="0"/>
|
||||
<separator colspan="4" string="Notes"/>
|
||||
<field colspan="4" name="note" nolabel="1"/>
|
||||
</form>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<field name="type">form</field>
|
||||
<field name="inherit_id" ref="account.product_normal_form_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="/form/notebook/page/field[@name='property_account_expense']" position="after">
|
||||
<xpath expr="/form/notebook/page/group/field[@name='property_account_expense']" position="after">
|
||||
<field name="property_account_creditor_price_difference" domain="[('type','<>','view'),('type','<>','consolidation')]" attrs="{'readonly':[('purchase_ok','=',0)]}" />
|
||||
<newline/>
|
||||
</xpath>
|
||||
|
||||
@@ -41,7 +41,6 @@
|
||||
"voucher_sequence.xml",
|
||||
"voucher_workflow.xml",
|
||||
"voucher_report.xml",
|
||||
"wizard/account_voucher_open_view.xml",
|
||||
"wizard/account_voucher_unreconcile_view.xml",
|
||||
"voucher_view.xml",
|
||||
"voucher_payment_receipt_view.xml",
|
||||
@@ -53,7 +52,6 @@
|
||||
"test/sales_receipt.yml",
|
||||
"test/sales_payment.yml",
|
||||
],
|
||||
|
||||
'certificate': '0037580727101',
|
||||
"active": False,
|
||||
"installable": True,
|
||||
|
||||
@@ -122,7 +122,7 @@ class account_voucher(osv.osv):
|
||||
\n* The \'Cancelled\' state is used when user cancel voucher.'),
|
||||
'amount': fields.float('Total', digits=(16, 2), required=True, readonly=True, states={'draft':[('readonly',False)]}),
|
||||
'tax_amount':fields.float('Tax Amount', digits=(14,2), readonly=True, states={'draft':[('readonly',False)]}),
|
||||
'reference': fields.char('Ref #', size=64, readonly=True, states={'draft':[('readonly',False)]}, help="Transaction referance number."),
|
||||
'reference': fields.char('Ref #', size=64, readonly=True, states={'draft':[('readonly',False)]}, help="Transaction reference number."),
|
||||
'number': fields.related('move_id', 'name', type="char", readonly=True, string='Number'),
|
||||
'move_id':fields.many2one('account.move', 'Account Entry'),
|
||||
'move_ids': fields.related('move_id','line_id', type='many2many', relation='account.move.line', string='Journal Items', readonly=True),
|
||||
@@ -177,7 +177,7 @@ class account_voucher(osv.osv):
|
||||
total_tax = 0.0
|
||||
|
||||
if not tax[0].price_include:
|
||||
for tax_line in tax_pool.compute_all(cr, uid, tax, voucher_amount, 1).get('taxes'):
|
||||
for tax_line in tax_pool.compute_all(cr, uid, tax, voucher_amount, 1).get('taxes',[]):
|
||||
total_tax += tax_line.get('amount')
|
||||
total += total_tax
|
||||
else:
|
||||
@@ -186,7 +186,7 @@ class account_voucher(osv.osv):
|
||||
line_total = 0.0
|
||||
line_tax = 0.0
|
||||
|
||||
for tax_line in tax_pool.compute_all(cr, uid, tax, line.untax_amount or line.amount, 1).get('taxes'):
|
||||
for tax_line in tax_pool.compute_all(cr, uid, tax, line.untax_amount or line.amount, 1).get('taxes',[]):
|
||||
line_tax += tax_line.get('amount')
|
||||
line_total += tax_line.get('price_unit')
|
||||
total_tax += line_tax
|
||||
@@ -228,7 +228,7 @@ class account_voucher(osv.osv):
|
||||
tax = tax_pool.browse(cr, uid, taxes)
|
||||
|
||||
if not tax[0].price_include:
|
||||
for tax_line in tax_pool.compute_all(cr, uid, tax, voucher_total, 1).get('taxes'):
|
||||
for tax_line in tax_pool.compute_all(cr, uid, tax, voucher_total, 1).get('taxes',[]):
|
||||
total_tax += tax_line.get('amount')
|
||||
total += total_tax
|
||||
|
||||
@@ -661,49 +661,6 @@ class account_voucher(osv.osv):
|
||||
default['date'] = time.strftime('%Y-%m-%d')
|
||||
return super(account_voucher, self).copy(cr, uid, id, default, context)
|
||||
|
||||
# TODO
|
||||
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
|
||||
"""
|
||||
Returns views and fields for current model where view will depend on {view_type}.
|
||||
@param view_id: list of fields, which required to read signatures
|
||||
@param view_type: defines a view type. it can be one of (form, tree, graph, calender, gantt, search, mdx)
|
||||
@param context: context arguments, like lang, time zone
|
||||
@param toolbar: contains a list of reports, wizards, and links related to current model
|
||||
|
||||
@return: Returns a dict that contains definition for fields, views, and toolbars
|
||||
"""
|
||||
data_pool = self.pool.get('ir.model.data')
|
||||
journal_pool = self.pool.get('account.journal')
|
||||
voucher_type = {
|
||||
'sale':'view_sale_receipt_form',
|
||||
'purchase':'view_purchase_receipt_form',
|
||||
'payment':'view_vendor_payment_form',
|
||||
'receipt':'view_vendor_receipt_form'
|
||||
}
|
||||
if view_type == 'form':
|
||||
tview = voucher_type.get(context.get('type'))
|
||||
tview = tview or 'view_voucher_form'
|
||||
result = data_pool._get_id(cr, uid, 'account_voucher', tview)
|
||||
view_id = data_pool.browse(cr, uid, result, context=context).res_id
|
||||
|
||||
res = super(account_voucher, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar, submenu)
|
||||
|
||||
#Restrict the list of journal view in search view
|
||||
if view_type == 'search':
|
||||
type_search = {
|
||||
'bank':[('type','in',['bank','cash'])],
|
||||
'cash':[('type','in',['bank','cash'])],
|
||||
'sale':[('type','in',['sale','sale_refund'])],
|
||||
'purchase':[('type','in',['purchase','purchase_refund'])],
|
||||
'expense':[('type','in',['purchase'])],
|
||||
'sale_refund':[('type','in',['sale','sale_refund'])],
|
||||
'purchase_refund':[('type','in',['purchase','purchase_refund'])]
|
||||
}
|
||||
domain = type_search.get(context.get('journal_type'))
|
||||
journal_list = journal_pool.name_search(cr, uid, '', domain)
|
||||
res['fields']['journal_id']['selection'] = journal_list
|
||||
return res
|
||||
|
||||
account_voucher()
|
||||
|
||||
class account_voucher_line(osv.osv):
|
||||
|
||||
@@ -1,6 +1,86 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="view_voucher_filter_customer_pay" model="ir.ui.view">
|
||||
<field name="name">account.voucher.customer.pay.select</field>
|
||||
<field name="model">account.voucher</field>
|
||||
<field name="type">search</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Search Vouchers">
|
||||
<group col='8' colspan='4'>
|
||||
<filter icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Draft Vouchers"/>
|
||||
<filter icon="terp-camera_test" string="Posted" domain="[('state','=','posted')]" help="Posted Vouchers"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter icon="terp-stock_effects-object-colorize" string="To Review" domain="[('state','=','posted')]" groups="base.group_extended" help="To Review"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="date"/>
|
||||
<field name="number"/>
|
||||
<field name="partner_id" string="Customer"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group col='8' colspan='4'>
|
||||
<field name="journal_id" widget="selection" context="{'journal_id': self, 'set_visible':False}" domain="[('type','in',('bank','cash'))]"/>
|
||||
<field name="period_id" groups="base.group_extended"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Extended options..." col='8' colspan='4'>
|
||||
<field name="reference"/>
|
||||
<field name="name"/>
|
||||
<field name="narration"/>
|
||||
<field name="amount"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Group By..." colspan="4" col="10">
|
||||
<filter string="Customer" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/>
|
||||
<filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'journal_id'}"/>
|
||||
<filter string="Period" icon="terp-go-month" domain="[]" context="{'group_by':'period_id','visible':True}"/>
|
||||
<filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="view_voucher_filter_vendor_pay" model="ir.ui.view">
|
||||
<field name="name">account.voucher.purchase.pay.select</field>
|
||||
<field name="model">account.voucher</field>
|
||||
<field name="type">search</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Search Vouchers">
|
||||
<group col='8' colspan='4'>
|
||||
<filter icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Draft Vouchers"/>
|
||||
<filter icon="terp-camera_test" string="Posted" domain="[('state','=','posted')]" help="Posted Vouchers"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter icon="terp-stock_effects-object-colorize" string="To Review" domain="[('state','=','posted')]" groups="base.group_extended" help="To Review"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="date"/>
|
||||
<field name="number"/>
|
||||
<field name="partner_id" string="Supplier"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group col='8' colspan='4'>
|
||||
<field name="journal_id" widget="selection" context="{'journal_id': self, 'set_visible':False}" domain="[('type','in',('bank','cash'))]"/>
|
||||
<field name="period_id" groups="base.group_extended"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Extended options..." col='8' colspan='4'>
|
||||
<field name="reference"/>
|
||||
<field name="name"/>
|
||||
<field name="narration"/>
|
||||
<field name="amount"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Group By..." colspan="4" col="10">
|
||||
<filter string="Supplier" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/>
|
||||
<filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'journal_id'}"/>
|
||||
<filter string="Period" icon="terp-go-month" domain="[]" context="{'group_by':'period_id','visible':True}"/>
|
||||
<filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="view_vendor_payment_form">
|
||||
<field name="name">account.voucher.payment.form</field>
|
||||
<field name="model">account.voucher</field>
|
||||
@@ -85,13 +165,27 @@
|
||||
|
||||
<record id="action_vendor_payment" model="ir.actions.act_window">
|
||||
<field name="name">Vendor Payment</field>
|
||||
<field name="res_model">account.voucher.open</field>
|
||||
<field name="res_model">account.voucher</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="domain">[('journal_id.type', 'in', ['bank', 'cash']), ('type','=','payment')]</field>
|
||||
<field name="context">{'journal_type':'bank', 'type':'payment'}</field>
|
||||
<field name="view_id" ref="account_open_vouchers_view"/>
|
||||
<field name="target">new</field>
|
||||
<field name="context">{'type':'payment'}</field>
|
||||
<field name="view_id" eval="False"/>
|
||||
<field name="search_view_id" ref="view_voucher_filter_vendor_pay"/>
|
||||
<field name="target">current</field>
|
||||
</record>
|
||||
<record id="action_vendor_payment_tree" model="ir.actions.act_window.view">
|
||||
<field eval="1" name="sequence"/>
|
||||
<field name="view_mode">tree</field>
|
||||
<field name="act_window_id" ref="action_vendor_payment"/>
|
||||
</record>
|
||||
<record id="action_vendor_payment_form" model="ir.actions.act_window.view">
|
||||
<field eval="2" name="sequence"/>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="view_vendor_payment_form"/>
|
||||
<field name="act_window_id" ref="action_vendor_payment"/>
|
||||
</record>
|
||||
|
||||
|
||||
<menuitem action="action_vendor_payment" icon="STOCK_JUSTIFY_FILL" sequence="12"
|
||||
id="menu_action_vendor_payment" parent="account.menu_finance_payables"/>
|
||||
|
||||
@@ -177,13 +271,26 @@
|
||||
|
||||
<record id="action_vendor_receipt" model="ir.actions.act_window">
|
||||
<field name="name">Sales Payment</field>
|
||||
<field name="res_model">account.voucher.open</field>
|
||||
<field name="res_model">account.voucher</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="domain">[('journal_id.type', 'in', ['bank', 'cash']), ('type','=','receipt')]</field>
|
||||
<field name="context">{'journal_type':'bank', 'type':'receipt'}</field>
|
||||
<field name="view_id" ref="account_open_vouchers_view"/>
|
||||
<field name="target">new</field>
|
||||
<field name="context">{'type':'receipt'}</field>
|
||||
<field name="search_view_id" ref="view_voucher_filter_customer_pay"/>
|
||||
<field name="view_id" eval="False"/>
|
||||
<field name="target">current</field>
|
||||
</record>
|
||||
<record id="action_vendor_receipt_tree" model="ir.actions.act_window.view">
|
||||
<field eval="1" name="sequence"/>
|
||||
<field name="view_mode">tree</field>
|
||||
<field name="act_window_id" ref="action_vendor_receipt"/>
|
||||
</record>
|
||||
<record id="action_vendor_receipt_form" model="ir.actions.act_window.view">
|
||||
<field eval="2" name="sequence"/>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="view_vendor_receipt_form"/>
|
||||
<field name="act_window_id" ref="action_vendor_receipt"/>
|
||||
</record>
|
||||
|
||||
<menuitem action="action_vendor_receipt" icon="STOCK_JUSTIFY_FILL" sequence="12"
|
||||
id="menu_action_vendor_receipt" parent="account.menu_finance_receivables"/>
|
||||
</data>
|
||||
|
||||
@@ -1,16 +1,96 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record id="view_voucher_filter_vendor" model="ir.ui.view">
|
||||
<field name="name">account.voucher.purchase.select</field>
|
||||
<field name="model">account.voucher</field>
|
||||
<field name="type">search</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Search Vouchers">
|
||||
<group col='8' colspan='4'>
|
||||
<filter icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Draft Vouchers"/>
|
||||
<filter icon="terp-camera_test" string="Posted" domain="[('state','=','posted')]" help="Posted Vouchers"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter icon="terp-stock_effects-object-colorize" string="To Review" domain="[('state','=','posted')]" groups="base.group_extended" help="To Review"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="date"/>
|
||||
<field name="number"/>
|
||||
<field name="partner_id" string="Supplier"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group col='8' colspan='4'>
|
||||
<field name="journal_id" widget="selection" context="{'journal_id': self, 'set_visible':False}" domain="[('type','in',('purchase','purchase_refund'))]"/>
|
||||
<field name="period_id" groups="base.group_extended"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Extended options..." col='8' colspan='4'>
|
||||
<field name="reference"/>
|
||||
<field name="name"/>
|
||||
<field name="narration"/>
|
||||
<field name="amount"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Group By..." colspan="4" col="10">
|
||||
<filter string="Supplier" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/>
|
||||
<filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'journal_id'}"/>
|
||||
<filter string="Period" icon="terp-go-month" domain="[]" context="{'group_by':'period_id','visible':True}"/>
|
||||
<filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="view_voucher_filter_sale" model="ir.ui.view">
|
||||
<field name="name">account.voucher.sale.select</field>
|
||||
<field name="model">account.voucher</field>
|
||||
<field name="type">search</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Search Vouchers">
|
||||
<group col='8' colspan='4'>
|
||||
<filter icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Draft Vouchers"/>
|
||||
<filter icon="terp-camera_test" string="Posted" domain="[('state','=','posted')]" help="Posted Vouchers"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter icon="terp-stock_effects-object-colorize" string="To Review" domain="[('state','=','posted')]" groups="base.group_extended" help="To Review"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="date"/>
|
||||
<field name="number"/>
|
||||
<field name="partner_id" string="Customer"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group col='8' colspan='4'>
|
||||
<field name="journal_id" widget="selection" context="{'journal_id': self, 'set_visible':False}" domain="[('type','in',('sale','sale_refund'))]"/>
|
||||
<field name="period_id" groups="base.group_extended"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Extended options..." col='8' colspan='4'>
|
||||
<field name="reference"/>
|
||||
<field name="name"/>
|
||||
<field name="narration"/>
|
||||
<field name="amount"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Group By..." colspan="4" col="10">
|
||||
<filter string="Customer" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/>
|
||||
<filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'journal_id'}"/>
|
||||
<filter string="Period" icon="terp-go-month" domain="[]" context="{'group_by':'period_id','visible':True}"/>
|
||||
<filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="act_pay_voucher" model="ir.actions.act_window">
|
||||
<field name="name">Sales Payment</field>
|
||||
<field name="res_model">account.voucher</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="domain">[('journal_id.type', 'in', ['bank', 'cash']), ('type','=','receipt'), ('partner_id','=',partner_id)]</field>
|
||||
<field name="context">{'journal_type':'bank', 'type':'receipt', 'partner_id': partner_id, 'referance':referance}</field>
|
||||
<field name="context">{'type':'receipt', 'partner_id': partner_id, 'default_reference':reference}</field>
|
||||
<field name="view_id" ref="view_vendor_receipt_form"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="view_sale_receipt_form">
|
||||
<field name="name">account.voucher.sale.form</field>
|
||||
<field name="model">account.voucher</field>
|
||||
@@ -74,7 +154,7 @@
|
||||
<button name="cancel_voucher" string="Cancel" states="draft,proforma" icon="gtk-cancel"/>
|
||||
<button name="cancel_voucher" string="Cancel" type="object" states="posted" icon="terp-stock_effects-object-colorize" confirm="Are you sure to confirm this record ?"/>
|
||||
<button name="proforma_voucher" string="Post" states="draft" icon="terp-camera_test"/>
|
||||
<button icon="terp-dolar_ok!" name="%(act_pay_voucher)d" context="{'title':'Sales Payment', 'journal_type':'bank', 'type':'receipt', 'partner_id': partner_id}" type="action" string="Pay" attrs="{'invisible':[('pay_now','!=','pay_now'),('state','!=','posted')]}"/>
|
||||
<button icon="terp-dolar_ok!" name="%(act_pay_voucher)d" context="{'title':'Sales Payment', 'type':'receipt', 'partner_id': partner_id}" type="action" string="Pay" attrs="{'invisible':[('pay_now','!=','pay_now'),('state','!=','posted')]}"/>
|
||||
<button name="action_cancel_draft" type="object" states="cancel" string="Set to Draft" icon="terp-stock_effects-object-colorize"/>
|
||||
</group>
|
||||
</form>
|
||||
@@ -84,23 +164,38 @@
|
||||
<!-- Sales Voucher -->
|
||||
<record id="action_sale_receipt" model="ir.actions.act_window">
|
||||
<field name="name">Sales Receipt</field>
|
||||
<field name="res_model">account.voucher.open</field>
|
||||
<field name="res_model">account.voucher</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="domain">[('journal_id.type','in',['sale','sale_refund']), ('type','=','sale')]</field>
|
||||
<field name="context">{'journal_type':'sale', 'type':'sale'}</field>
|
||||
<field name="view_id" ref="account_open_vouchers_view"/>
|
||||
<field name="target">new</field>
|
||||
<field name="context">{'type':'sale'}</field>
|
||||
<field name="view_id" eval="False"/>
|
||||
<field name="search_view_id" ref="view_voucher_filter_sale"/>
|
||||
<field name="target">current</field>
|
||||
</record>
|
||||
<record id="action_sale_receipt_tree" model="ir.actions.act_window.view">
|
||||
<field eval="1" name="sequence"/>
|
||||
<field name="view_mode">tree</field>
|
||||
<field name="act_window_id" ref="action_sale_receipt"/>
|
||||
</record>
|
||||
<record id="action_sale_receipt_form" model="ir.actions.act_window.view">
|
||||
<field eval="2" name="sequence"/>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="view_sale_receipt_form"/>
|
||||
<field name="act_window_id" ref="action_sale_receipt"/>
|
||||
</record>
|
||||
|
||||
<menuitem id="menu_action_sale_receipt" icon="STOCK_JUSTIFY_FILL"
|
||||
action="action_sale_receipt" parent="account.menu_finance_receivables" sequence="10"/>
|
||||
|
||||
action="action_sale_receipt"
|
||||
parent="account.menu_finance_receivables"
|
||||
sequence="10"/>
|
||||
|
||||
<!-- Purchase Vouchers -->
|
||||
<record id="act_pay_bills" model="ir.actions.act_window">
|
||||
<field name="name">Bill Payment</field>
|
||||
<field name="res_model">account.voucher</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="domain">[('journal_id.type', 'in', ['bank', 'cash']), ('type','=','payment'), ('partner_id','=',partner_id)]</field>
|
||||
<field name="context">{'journal_type':'bank', 'type':'payment', 'partner_id': partner_id, 'referance':referance}</field>
|
||||
<field name="context">{'type':'payment', 'partner_id': partner_id, 'default_reference':reference}</field>
|
||||
<field name="view_id" ref="view_vendor_payment_form"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
@@ -161,7 +256,7 @@
|
||||
<button name="cancel_voucher" string="Cancel" states="draft,proforma" icon="gtk-cancel"/>
|
||||
<button name="cancel_voucher" string="Cancel" type="object" states="posted" icon="terp-stock_effects-object-colorize" confirm="Are you sure to confirm this record ?"/>
|
||||
<button name="proforma_voucher" string="Post" states="draft" icon="terp-camera_test"/>
|
||||
<button icon="terp-dolar_ok!" name="%(act_pay_bills)d" context="{'title':'Bill Payment', 'journal_type':'bank', 'type':'payment', 'partner_id': partner_id}" type="action" string="Pay Bill" attrs="{'invisible':[('state','!=','posted')]}"/>
|
||||
<button icon="terp-dolar_ok!" name="%(act_pay_bills)d" context="{'title':'Bill Payment', 'type':'payment', 'partner_id': partner_id}" type="action" string="Pay Bill" attrs="{'invisible':[('state','!=','posted')]}"/>
|
||||
<button name="action_cancel_draft" type="object" states="cancel" string="Set to Draft" icon="terp-stock_effects-object-colorize"/>
|
||||
</group>
|
||||
</form>
|
||||
@@ -169,13 +264,26 @@
|
||||
</record>
|
||||
<record id="action_purchase_receipt" model="ir.actions.act_window">
|
||||
<field name="name">Vendor Bills</field>
|
||||
<field name="res_model">account.voucher.open</field>
|
||||
<field name="res_model">account.voucher</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="domain">[('journal_id.type','in',['purchase','purchase_refund']), ('type','=','purchase')]</field>
|
||||
<field name="context">{'journal_type':'purchase', 'type':'purchase'}</field>
|
||||
<field name="view_id" ref="account_open_vouchers_view"/>
|
||||
<field name="target">new</field>
|
||||
<field name="context">{'type':'purchase'}</field>
|
||||
<field name="view_id" eval="False"/>
|
||||
<field name="search_view_id" eval="view_voucher_filter_vendor"/>
|
||||
<field name="target">current</field>
|
||||
</record>
|
||||
<record id="action_purchase_receipt_tree" model="ir.actions.act_window.view">
|
||||
<field eval="1" name="sequence"/>
|
||||
<field name="view_mode">tree</field>
|
||||
<field name="act_window_id" ref="action_purchase_receipt"/>
|
||||
</record>
|
||||
<record id="action_purchase_receipt_form" model="ir.actions.act_window.view">
|
||||
<field eval="2" name="sequence"/>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="view_purchase_receipt_form"/>
|
||||
<field name="act_window_id" ref="action_purchase_receipt"/>
|
||||
</record>
|
||||
|
||||
<menuitem id="menu_action_purchase_receipt" icon="STOCK_JUSTIFY_FILL"
|
||||
action="action_purchase_receipt" parent="account.menu_finance_payables" sequence="10"/>
|
||||
|
||||
|
||||
@@ -37,23 +37,13 @@
|
||||
</group>
|
||||
<notebook colspan="4">
|
||||
<page string="Voucher Entry">
|
||||
<field name="line_cr_ids" attrs="{'invisible':[('type','in',['purchase', 'payment', False])]}" on_change="onchange_price(line_cr_ids, False, partner_id)" default_get="{'journal_id':journal_id, 'type':type, 'partner_id':partner_id}" colspan="4" nolabel="1" height="180">
|
||||
<tree string="Sales and Receipt" editable="top">
|
||||
<field name="line_ids" default_get="{'journal_id':journal_id, 'type':type, 'partner_id':partner_id}" colspan="4" nolabel="1" height="180">
|
||||
<tree string="Voucher Items" editable="bottom">
|
||||
<field name="account_id"/>
|
||||
<field name="name"/>
|
||||
<field name="amount" sum="Total Amount"/>
|
||||
<field name="type" groups="base.group_extended"/>
|
||||
<field name="account_analytic_id" domain="[('parent_id','!=',False)]" groups="base.group_extended"/>
|
||||
</tree>
|
||||
</field>
|
||||
|
||||
<field name="line_dr_ids" attrs="{'invisible':[('type','in',['sale', 'receipt', False])]}" on_change="onchange_price(line_dr_ids, False, partner_id)" default_get="{'journal_id':journal_id, 'type':type, 'partner_id':partner_id}" colspan="4" nolabel="1" height="180">
|
||||
<tree string="Purchase and Payments" editable="top">
|
||||
<field name="account_id"/>
|
||||
<field name="name"/>
|
||||
<field name="amount" sum="Total Amount"/>
|
||||
<field name="type" groups="base.group_extended"/>
|
||||
<field name="account_analytic_id" domain="[('parent_id','!=',False)]" groups="base.group_extended"/>
|
||||
<field name="type"/>
|
||||
<field name="account_analytic_id" groups="base.group_extended"/>
|
||||
</tree>
|
||||
</field>
|
||||
<group col="2" colspan="3">
|
||||
@@ -64,8 +54,8 @@
|
||||
<group col="2" colspan="1" >
|
||||
<separator string="Other Information" colspan="2"/>
|
||||
<field name="number"/>
|
||||
<field name="date" select="1" on_change="onchange_date(date)"/>
|
||||
<field name="currency_id" select="1" attrs="{'readonly':[('type','in',['sale', 'purchase'])]}"/>
|
||||
<field name="date" on_change="onchange_date(date)"/>
|
||||
<field name="currency_id" attrs="{'readonly':[('type','in',['sale', 'purchase'])]}"/>
|
||||
</group>
|
||||
<group col="4" colspan="1" attrs="{'invisible':[('type','in',['payment', 'receipt', False])]}">
|
||||
<separator string="Total" colspan="4"/>
|
||||
@@ -76,7 +66,7 @@
|
||||
</page>
|
||||
<page string="Journal Items" groups="base.group_extended" attrs="{'invisible': [('state','!=','posted')]}">
|
||||
<group col="6" colspan="4">
|
||||
<field name="company_id" select="1" widget="selection" groups="base.group_multi_company"/>
|
||||
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
|
||||
<field name="period_id"/>
|
||||
<field name="audit"/>
|
||||
</group>
|
||||
@@ -99,48 +89,7 @@
|
||||
<field name="name">account.voucher.select</field>
|
||||
<field name="model">account.voucher</field>
|
||||
<field name="type">search</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Search Vouchers">
|
||||
<group col='8' colspan='4'>
|
||||
<filter icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Draft Vouchers"/>
|
||||
<filter icon="terp-check" string="Proforma" domain="[('state','=','proforma')]" help="Proforma Vouchers"/>
|
||||
<filter icon="terp-camera_test" string="Posted" domain="[('state','=','posted')]" help="Posted Vouchers"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter icon="terp-stock_effects-object-colorize" string="To Review" domain="[('state','=','posted')]" groups="base.group_extended" help="To Review"/>
|
||||
<filter icon="gtk-cancel" string="Cancel" domain="[('state','=','cancel')]" help="Cancel Vouchers" groups="base.group_extended"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="date" select='1'/>
|
||||
<field name="number" select='1'/>
|
||||
<field name="partner_id" select='1'/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group col='8' colspan='4'>
|
||||
<field name="journal_id" widget="selection" context="{'journal_id': self, 'set_visible':False}" />
|
||||
<field name="period_id" context="{'period_id': self}" groups="base.group_extended"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Extended options..." col='8' colspan='4'>
|
||||
<field name="reference" select="1"/>
|
||||
<field name="name" select='1'/>
|
||||
<field name="narration" select="1"/>
|
||||
<field name="amount" select="1"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Group By..." col='8' colspan='4'>
|
||||
<filter string="Partner" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/>
|
||||
<filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'journal_id'}"/>
|
||||
<filter string="Period" icon="terp-go-month" domain="[]" context="{'group_by':'period_id'}"/>
|
||||
<filter string="Type" icon="terp-stock_symbol-selection" domain="[]" context="{'group_by':'type', 'set_visible':True}"/>
|
||||
<filter string="States" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_voucher_filter_new" model="ir.ui.view">
|
||||
<field name="name">account.voucher.select</field>
|
||||
<field name="model">account.voucher</field>
|
||||
<field name="type">search</field>
|
||||
<field name="priority">1</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Search Vouchers">
|
||||
<group col='8' colspan='4'>
|
||||
@@ -149,9 +98,9 @@
|
||||
<separator orientation="vertical"/>
|
||||
<filter icon="terp-stock_effects-object-colorize" string="To Review" domain="[('state','=','posted')]" groups="base.group_extended" help="To Review"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="date" select='1'/>
|
||||
<field name="number" select='1'/>
|
||||
<field name="partner_id" select='1'/>
|
||||
<field name="date"/>
|
||||
<field name="number"/>
|
||||
<field name="partner_id"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group col='8' colspan='4'>
|
||||
@@ -160,17 +109,17 @@
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Extended options..." col='8' colspan='4'>
|
||||
<field name="reference" select="1"/>
|
||||
<field name="name" select='1'/>
|
||||
<field name="narration" select="1"/>
|
||||
<field name="amount" select="1"/>
|
||||
<field name="reference"/>
|
||||
<field name="name"/>
|
||||
<field name="narration"/>
|
||||
<field name="amount"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Group By..." colspan="12" col="10">
|
||||
<group expand="0" string="Group By..." colspan="4" col="10">
|
||||
<filter string="Partner" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/>
|
||||
<filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'journal_id'}"/>
|
||||
<filter string="Period" icon="terp-go-month" domain="[]" context="{'group_by':'period_id','visible':True}"/>
|
||||
<filter string="States" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
|
||||
<filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
@@ -216,7 +165,7 @@
|
||||
<field name="view_id" eval="view_voucher_tree"/>
|
||||
<field name="domain">[('state','=','posted')]</field>
|
||||
<field name="context">{'state':'posted'}</field>
|
||||
<field name="search_view_id" ref="view_voucher_filter_new"/>
|
||||
<field name="search_view_id" ref="view_voucher_filter"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
|
||||
@@ -19,5 +19,4 @@
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import account_voucher_open
|
||||
import account_voucher_unreconcile
|
||||
|
||||
@@ -1,147 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import fields, osv
|
||||
from tools.translate import _
|
||||
import tools
|
||||
|
||||
class account_voucher_open(osv.osv_memory):
|
||||
_name = "account.voucher.open"
|
||||
_description = "Account Voucher"
|
||||
|
||||
def _get_period(self, cr, uid, context={}):
|
||||
"""
|
||||
Return default account period value
|
||||
"""
|
||||
ids = self.pool.get('account.period').find(cr, uid, context=context)
|
||||
period_id = False
|
||||
if len(ids):
|
||||
period_id = ids[0]
|
||||
return period_id
|
||||
|
||||
def _get_journal(self, cr, uid, context={}):
|
||||
"""
|
||||
Return journal based on the journal type
|
||||
"""
|
||||
journal_id = False
|
||||
|
||||
journal_pool = self.pool.get('account.journal')
|
||||
if context.get('journal_type', False):
|
||||
jids = journal_pool.search(cr, uid, [('type','=', context.get('journal_type'))])
|
||||
journal_id = jids[0]
|
||||
return journal_id
|
||||
|
||||
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
|
||||
"""
|
||||
Returns views and fields for current model where view will depend on {view_type}.
|
||||
@param cr: A database cursor
|
||||
@param user: ID of the user currently logged in
|
||||
@param view_id: list of fields, which required to read signatures
|
||||
@param view_type: defines a view type. it can be one of (form, tree, graph, calender, gantt, search, mdx)
|
||||
@param context: context arguments, like lang, time zone
|
||||
@param toolbar: contains a list of reports, wizards, and links related to current model
|
||||
|
||||
@return: Returns a dict that contains definition for fields, views, and toolbars
|
||||
"""
|
||||
res = super(account_voucher_open, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar, submenu)
|
||||
|
||||
if not view_id:
|
||||
return res
|
||||
|
||||
period_pool = self.pool.get('account.period')
|
||||
journal_pool = self.pool.get('account.journal')
|
||||
|
||||
journal_id = self._get_journal(cr, uid, context)
|
||||
period_id = self._get_period(cr, uid, context)
|
||||
|
||||
journal = False
|
||||
if journal_id:
|
||||
journal = journal_pool.read(cr, uid, [journal_id], ['name'])[0]['name']
|
||||
else:
|
||||
journal = "All"
|
||||
|
||||
period = False
|
||||
if period_id:
|
||||
period = period_pool.browse(cr, uid, [period_id], ['name'])[0]['name']
|
||||
|
||||
menu = self.pool.get('ir.ui.menu').browse(cr, uid, context.get('active_id'))
|
||||
name = menu.name
|
||||
|
||||
view = """<?xml version="1.0" encoding="utf-8"?>
|
||||
<form string="Standard entries">
|
||||
<separator string="Open %s !" colspan="4"/>
|
||||
<group colspan="4" >
|
||||
<label width="300" string="Journal : %s"/>
|
||||
<newline/>
|
||||
<label width="300" string="Period : %s"/>
|
||||
</group>
|
||||
<group colspan="4" col="4">
|
||||
<label string ="" colspan="2"/>
|
||||
<button icon="terp-gtk-go-back-rtl" string="Ok" name="action_open_window" type="object"/>
|
||||
</group>
|
||||
</form>""" % (str(name), str(journal), str(period))
|
||||
|
||||
res.update({
|
||||
'arch':view
|
||||
})
|
||||
return res
|
||||
|
||||
def action_open_window(self, cr, uid, ids, context=None):
|
||||
"""
|
||||
This function Open action move line window on given period and Journal/Payment Mode
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param ids: account move journal’s ID or list of IDs
|
||||
@return: dictionary of Open action move line window on given period and Journal/Payment Mode
|
||||
"""
|
||||
|
||||
period_pool = self.pool.get('account.journal.period')
|
||||
data_pool = self.pool.get('ir.model.data')
|
||||
journal_pool = self.pool.get('account.journal')
|
||||
|
||||
if context is None:
|
||||
context = {}
|
||||
|
||||
journal_id = self._get_journal(cr, uid, context)
|
||||
period_id = self._get_period(cr, uid, context)
|
||||
|
||||
menu = self.pool.get('ir.ui.menu').browse(cr, uid, context.get('active_id'))
|
||||
name = context.get('title', menu.name)
|
||||
|
||||
result = data_pool._get_id(cr, uid, 'account_voucher', 'view_voucher_filter_new')
|
||||
res_id = data_pool.browse(cr, uid, result, context=context).res_id
|
||||
|
||||
res = {
|
||||
'domain':menu.action.domain,
|
||||
'name': name,
|
||||
'view_type': 'form',
|
||||
'view_mode': 'tree,graph,form',
|
||||
'res_model': 'account.voucher',
|
||||
'view_id': False,
|
||||
'context': "{'search_default_journal_id':%d, 'search_default_period_id':%d, 'partner_id':%s}" % (journal_id, period_id, context.get('partner_id',False)),
|
||||
'type': 'ir.actions.act_window',
|
||||
'search_view_id': res_id
|
||||
}
|
||||
return res
|
||||
|
||||
account_voucher_open()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -1,26 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="account_open_vouchers_view" model="ir.ui.view">
|
||||
<field name="name">Open Vouchers</field>
|
||||
<field name="model">account.voucher.open</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Open Vouchers">
|
||||
<separator string="Open Vouchers !" colspan="4"/>
|
||||
<group colspan="4" >
|
||||
<label width="300" string="Journal :"/>
|
||||
<newline/>
|
||||
<label width="300" string="Period :"/>
|
||||
</group>
|
||||
<group colspan="4" col="4">
|
||||
<label string ="" colspan="2"/>
|
||||
<button icon="terp-gtk-go-back-rtl" string="Ok" name="action_open_window" type="object"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -208,7 +208,7 @@ class audittrail_objects_proxy(osv_pool):
|
||||
else:
|
||||
field_ids = field_pool.search(cr, uid, [('name', '=', field_name), ('model_id', '=', model.id)])
|
||||
field_id = field_ids and field_ids[0] or False
|
||||
assert field_id, _("'%s' field is not exits in '%s' model" %(field_name, model.model))
|
||||
assert field_id, _("'%s' field does not exist in '%s' model" %(field_name, model.model))
|
||||
|
||||
field = field_pool.read(cr, uid, field_id)
|
||||
relation_model = field['relation']
|
||||
@@ -254,7 +254,7 @@ class audittrail_objects_proxy(osv_pool):
|
||||
else:
|
||||
field_ids = field_pool.search(cr, uid, [('name', '=', line['name']), ('model_id', '=', model.id)])
|
||||
field_id = field_ids and field_ids[0] or False
|
||||
assert field_id, _("'%s' field is not exits in '%s' model" %(line['name'], model.model))
|
||||
assert field_id, _("'%s' field does not exist in '%s' model" %(line['name'], model.model))
|
||||
|
||||
field = field_pool.read(cr, uid, field_id)
|
||||
old_value = 'old_value' in line and line['old_value'] or ''
|
||||
@@ -303,7 +303,7 @@ class audittrail_objects_proxy(osv_pool):
|
||||
|
||||
model_ids = model_pool.search(cr, uid, [('model', '=', model)])
|
||||
model_id = model_ids and model_ids[0] or False
|
||||
assert model_id, _("'%s' Model is not exits..." %(model))
|
||||
assert model_id, _("'%s' Model does not exist..." %(model))
|
||||
model = model_pool.browse(cr, uid, model_id)
|
||||
|
||||
if method in ('create'):
|
||||
|
||||
@@ -85,7 +85,6 @@ Create dashboard for CRM that includes:
|
||||
|
||||
'wizard/crm_send_email_view.xml',
|
||||
'wizard/crm_forward_to_partner_view.xml',
|
||||
'wizard/crm_custom_create_menu_view.xml',
|
||||
'wizard/crm_merge_opportunities_view.xml',
|
||||
|
||||
'crm_view.xml',
|
||||
|
||||
+1
-1
@@ -499,7 +499,7 @@ class crm_case_section(osv.osv):
|
||||
|
||||
_name = "crm.case.section"
|
||||
_description = "Sales Teams"
|
||||
_order = "name"
|
||||
_order = "parent_id, name"
|
||||
|
||||
_columns = {
|
||||
'name': fields.char('Sales Team', size=64, required=True, translate=True),
|
||||
|
||||
@@ -65,7 +65,6 @@
|
||||
string="Convert to Opportunity"
|
||||
help="Convert to Opportunity"
|
||||
icon="gtk-index"
|
||||
colspan="2"
|
||||
type="object"/>
|
||||
<newline />
|
||||
<field name="section_id" widget="selection" />
|
||||
|
||||
@@ -30,7 +30,6 @@ import crm_phonecall_to_partner
|
||||
import crm_phonecall_to_opportunity
|
||||
import crm_partner_to_opportunity
|
||||
|
||||
import crm_custom_create_menu
|
||||
import crm_merge_opportunities
|
||||
|
||||
|
||||
|
||||
@@ -1,78 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import fields,osv
|
||||
|
||||
|
||||
class crm_case_custom_create_menu(osv.osv_memory):
|
||||
'''
|
||||
Create menu for custom Cases
|
||||
'''
|
||||
_name = 'crm.custom.create.menu'
|
||||
_description = 'Create menu for custom Cases'
|
||||
|
||||
_columns = {
|
||||
'name': fields.char('Menu Name', size=64, required=True),
|
||||
'menu_parent_id': fields.many2one('ir.ui.menu', 'Parent Menu', required=True),
|
||||
'section_id': fields.many2one('crm.case.section.custom', 'Section', required=True),
|
||||
'view_form': fields.many2one('ir.ui.view', 'Form View', domain=[('type','=','form'),('model','=','crm.case.custom')]),
|
||||
'view_tree': fields.many2one('ir.ui.view', 'Tree View', domain=[('type','=','tree'),('model','=','crm.case.custom')]),
|
||||
'view_calendar': fields.many2one('ir.ui.view', 'Calendar View', domain=[('type','=','calendar'),('model','=','crm.case.custom')]),
|
||||
'view_search': fields.many2one('ir.ui.view', 'Search View', domain=[('type','=','search'),('model','=','crm.case.custom')]),
|
||||
}
|
||||
|
||||
def menu_create(self, cr, uid, ids, context=None):
|
||||
"""
|
||||
Creates Menus for selected custom section
|
||||
"""
|
||||
data_obj = self.pool.get('ir.model.data')
|
||||
for this in self.browse(cr, uid, ids, context=context):
|
||||
domain = [('section_id', '=', this.section_id.id)]
|
||||
view_mode = [this.view_tree and 'tree', this.view_form and 'form', this.view_calendar and 'calendar']
|
||||
view_mode = filter(None , view_mode)
|
||||
action_id = self.pool.get('ir.actions.act_window').create(cr,uid, {
|
||||
'name': this.name,
|
||||
'res_model': 'crm.case.custom',
|
||||
'domain': domain,
|
||||
'view_type': 'form',
|
||||
'view_mode': ','.join(view_mode),
|
||||
'search_view_id': this.view_search.id or False,
|
||||
'context': {'default_section_id': this.section_id.id, 'default_user_id': uid}
|
||||
})
|
||||
menu_id=self.pool.get('ir.ui.menu').create(cr, uid, {
|
||||
'name': this.name,
|
||||
'parent_id': this.menu_parent_id.id,
|
||||
'icon': 'STOCK_JUSTIFY_FILL'
|
||||
})
|
||||
self.pool.get('ir.values').create(cr, uid, {
|
||||
'name': 'Custom Cases',
|
||||
'key2': 'tree_but_open',
|
||||
'model': 'ir.ui.menu',
|
||||
'res_id': menu_id,
|
||||
'value': 'ir.actions.act_window,%d'%action_id,
|
||||
'object': True
|
||||
})
|
||||
return {}
|
||||
|
||||
crm_case_custom_create_menu()
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -1,36 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record model="ir.ui.view" id="crm_custom_create_menu_form">
|
||||
<field name="name">crm.custom.create.menu.form</field>
|
||||
<field name="model">crm.custom.create.menu</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Create Menu for Custom Cases">
|
||||
<separator string="Menu Information" colspan="4"/>
|
||||
<field name="name"/>
|
||||
<field name="menu_parent_id"/>
|
||||
<field name="section_id"/>
|
||||
<separator string="Select Views (Empty for Default)" colspan="4"/>
|
||||
<field name="view_form"/>
|
||||
<field name="view_tree"/>
|
||||
<field name="view_calendar"/>
|
||||
<field name="view_search"/>
|
||||
<separator string="" colspan="4"/>
|
||||
<label string="" colspan="2"/>
|
||||
<button special="cancel" string="_Cancel" icon="gtk-cancel"/>
|
||||
<button name="menu_create" string="Create _Menu" type="object" icon='gtk-ok'/>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window" id="crm_custom_create_menu_action">
|
||||
<field name="name">Create Menu</field>
|
||||
<field name="res_model">crm.custom.create.menu</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -286,7 +286,7 @@
|
||||
<field name="model">sale.order</field>
|
||||
<field name="inherit_id" ref="sale.view_order_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="/form/notebook/page[@string='Sale Order']/group[1]/button[@name='button_dummy']" position="after">
|
||||
<xpath expr="/form/notebook/page[@string='Sales Order']/group[1]/button[@name='button_dummy']" position="after">
|
||||
<button name="%(action_delivery_cost)d" states="draft" string="Delivery Costs" type="action" icon="gtk-add" context="{'order_id':id}"/>
|
||||
</xpath>
|
||||
</field>
|
||||
|
||||
Reference in New Issue
Block a user