[MERGE] merge with dev-addons3

bzr revid: psi@tinyerp.co.in-20101220132723-bh3zrqzkq397tiej
This commit is contained in:
psi (Open ERP)
2010-12-20 18:57:23 +05:30
10 changed files with 34 additions and 84 deletions
+3 -3
View File
@@ -310,7 +310,7 @@
<button name='%(action_account_state_open)d' type='action' string='Re-Open' states='paid' icon="gtk-convert" groups="base.group_no_one"/>
<button name="invoice_proforma2" states="draft" string="PRO-FORMA" icon="terp-gtk-media-pause" groups="account.group_account_user"/>
<button name="invoice_open" states="draft,proforma2" string="Validate" icon="gtk-go-forward"/>
<button name="%(account_invoices)d" string="Invoices" type="action" icon="gtk-print"/>
<button name="%(account_invoices)d" string="Print Invoice" type="action" icon="gtk-print"/>
</group>
</group>
</page>
@@ -466,7 +466,7 @@
<menuitem action="action_invoice_tree2" id="menu_action_invoice_tree2" parent="menu_finance_payables"/>
<record id="action_invoice_tree3" model="ir.actions.act_window">
<field name="name">Credit Memo</field>
<field name="name">Customer Refunds</field>
<field name="res_model">account.invoice</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form,calendar,graph</field>
@@ -474,7 +474,7 @@
<field name="domain">[('type','=','out_refund')]</field>
<field name="context">{'type':'out_refund', 'journal_type': 'sale_refund'}</field>
<field name="search_view_id" ref="view_account_invoice_filter"/>
<field name="help">Credit Memo helps you manage the credit notes issued/to be issued for your customers. A refund invoice is a document that cancels an invoice or a part of it. You can easily generate refunds and reconcile them from the invoice form.</field>
<field name="help">This menu helps you manage the credit notes issued/to be issued for your customers. A refund invoice is a document that cancels an invoice or a part of it. You can easily generate refunds and reconcile them from the invoice form.</field>
</record>
<record id="action_invoice_tree3_view1" model="ir.actions.act_window.view">
+1 -1
View File
@@ -2446,7 +2446,7 @@
<attribute name='string'></attribute>
</xpath>
<group string="res_config_contents" position="replace">
<field name="company_id" widget="selection" groups="base.group_extended"/>
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
<field name ="code_digits" groups="base.group_extended"/>
<field name="chart_template_id" widget="selection" on_change="onchange_chart_template_id(chart_template_id)"/>
<field name ="seq_journal" groups="base.group_extended"/>
+3 -13
View File
@@ -1397,30 +1397,20 @@ class account_invoice_line(osv.osv):
a = res.product_tmpl_id.property_account_expense.id
if not a:
a = res.categ_id.property_account_expense_categ.id
a = fpos_obj.map_account(cr, uid, fpos, a)
if a:
result['account_id'] = a
tax_ids = tax_obj.search(cr, uid, [('company_id', '=', company_id)])
if type in ('out_invoice', 'out_refund'):
sale_taxes_def = map(lambda x: x.id, res.taxes_id)
sale_tax_ids = [tax for tax in tax_ids if tax in sale_taxes_def]
sale_taxes = tax_obj.browse(cr, uid, sale_tax_ids)
sale_taxes_all = sale_taxes and sale_taxes or (a and self.pool.get('account.account').browse(cr, uid, a).tax_ids or False)
tax_id = fpos_obj.map_tax(cr, uid, fpos, sale_taxes_all)
taxes = res.taxes_id and res.taxes_id or (a and self.pool.get('account.account').browse(cr, uid, a, context=context).tax_ids or False)
else:
pur_taxes_def = map(lambda x: x.id, res.supplier_taxes_id)
pur_tax_ids = [tax for tax in tax_ids if tax in pur_taxes_def]
pur_taxes = tax_obj.browse(cr, uid, pur_tax_ids)
pur_taxes_all = pur_taxes and pur_taxes or (a and self.pool.get('account.account').browse(cr, uid, a).tax_ids or False)
tax_id = fpos_obj.map_tax(cr, uid, fpos, pur_taxes_all)
taxes = res.supplier_taxes_id and res.supplier_taxes_id or (a and self.pool.get('account.account').browse(cr, uid, a, context=context).tax_ids or False)
tax_id = fpos_obj.map_tax(cr, uid, fpos, taxes)
if type in ('in_invoice', 'in_refund'):
result.update( {'price_unit': price_unit or res.standard_price,'invoice_line_tax_id': tax_id} )
else:
result.update({'price_unit': res.list_price, 'invoice_line_tax_id': tax_id})
# if not name:
result['name'] = res.partner_ref
domain = {}
+1 -1
View File
@@ -79,7 +79,7 @@
<field name="name">Tax multi-company</field>
<field model="ir.model" name="model_id" ref="model_account_tax"/>
<field eval="True" name="global"/>
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
<field name="domain_force">['|',('company_id','=',False),('company_id','=',user.company_id.id)]</field>
</record>
<record id="tax_code_comp_rule" model="ir.rule">
+2 -2
View File
@@ -72,8 +72,8 @@
"access_account_account_product_manager","account.account product manager","model_account_account","product.group_product_manager",1,0,0,0
"access_account_journal_product_manager","account.journal product manager","model_account_journal","product.group_product_manager",1,0,0,0
"access_account_fiscal_position_product_manager","account.fiscal.position account.manager","model_account_fiscal_position","account.group_account_manager",1,1,1,1
"access_account_fiscal_position_tax_product_manager","account.fiscal.position.tax account.manager","model_account_fiscal_position_tax","account.group_account_manager",1,0,0,0
"access_account_fiscal_position_account_product_manager","account.fiscal.position account.manager","model_account_fiscal_position_account","account.group_account_manager",1,0,0,0
"access_account_fiscal_position_tax_product_manager","account.fiscal.position.tax account.manager","model_account_fiscal_position_tax","account.group_account_manager",1,1,1,1
"access_account_fiscal_position_account_product_manager","account.fiscal.position account.manager","model_account_fiscal_position_account","account.group_account_manager",1,1,1,1
"access_account_fiscal_position","account.fiscal.position all","model_account_fiscal_position","base.group_user",1,0,0,0
"access_account_fiscal_position_tax","account.fiscal.position.tax all","model_account_fiscal_position_tax","base.group_user",1,0,0,0
"access_account_fiscal_position_account","account.fiscal.position all","model_account_fiscal_position_account","base.group_user",1,0,0,0
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
72 access_account_account_product_manager account.account product manager model_account_account product.group_product_manager 1 0 0 0
73 access_account_journal_product_manager account.journal product manager model_account_journal product.group_product_manager 1 0 0 0
74 access_account_fiscal_position_product_manager account.fiscal.position account.manager model_account_fiscal_position account.group_account_manager 1 1 1 1
75 access_account_fiscal_position_tax_product_manager account.fiscal.position.tax account.manager model_account_fiscal_position_tax account.group_account_manager 1 0 1 0 1 0 1
76 access_account_fiscal_position_account_product_manager account.fiscal.position account.manager model_account_fiscal_position_account account.group_account_manager 1 0 1 0 1 0 1
77 access_account_fiscal_position account.fiscal.position all model_account_fiscal_position base.group_user 1 0 0 0
78 access_account_fiscal_position_tax account.fiscal.position.tax all model_account_fiscal_position_tax base.group_user 1 0 0 0
79 access_account_fiscal_position_account account.fiscal.position all model_account_fiscal_position_account base.group_user 1 0 0 0
+22 -49
View File
@@ -155,9 +155,7 @@ class hr_holidays(osv.osv):
'department_id':fields.related('employee_id', 'department_id', string='Department', type='many2one', relation='hr.department', readonly=True, store=True),
'category_id': fields.many2one('hr.employee.category', "Category", help='Category Of employee'),
'holiday_type': fields.selection([('employee','By Employee'),('category','By Employee Category')], 'Allocation Type', help='By Employee: Allocation/Request for individual Employee, By Employee Category: Allocation/Request for group of employees in category', required=True),
'manager_id2': fields.many2one('hr.employee', 'Second Approval', readonly=True, help='This area is automaticly filled by the user who validate the leave with second level (If Leave type need second validation)'),
# Todo: Add below field in view?
'category_holiday_id': fields.many2one('hr.holidays', 'Holiday', help='For allocation By Employee Category (Link between Employee Category holiday and related holidays for employees of that category)')
'manager_id2': fields.many2one('hr.employee', 'Second Approval', readonly=True, help='This area is automaticly filled by the user who validate the leave with second level (If Leave type need second validation)')
}
_defaults = {
@@ -169,14 +167,6 @@ class hr_holidays(osv.osv):
'holiday_type': 'employee'
}
def _get_category_leave_ids(self, cr, uid, ids):
"""Returns the leaves taken by the employees of the category if holiday type is 'category'."""
leave_ids = []
for record in self.browse(cr, uid, ids):
if record.holiday_type == 'category' and record.type == 'remove':
leave_ids += self.search(cr, uid, [('category_holiday_id', '=', record.id)])
return leave_ids
def _create_resource_leave(self, cr, uid, vals, context=None):
'''This method will create entry in resource calendar leave object at the time of holidays validated '''
obj_res_leave = self.pool.get('resource.calendar.leaves')
@@ -240,6 +230,7 @@ class hr_holidays(osv.osv):
list_ids = [ lr.id for lr in record.linked_request_ids]
self.holidays_cancel(cr, uid, list_ids)
self.unlink(cr, uid, list_ids)
return True
def _check_date(self, cr, uid, ids, context=None):
for rec in self.read(cr, uid, ids, ['number_of_days_temp', 'date_from','date_to', 'type']):
@@ -257,7 +248,6 @@ class hr_holidays(osv.osv):
def unlink(self, cr, uid, ids, context=None):
self._update_user_holidays(cr, uid, ids)
ids += self._get_category_leave_ids(cr, uid, ids)
self._remove_resouce_leave(cr, uid, ids, context=context)
return super(hr_holidays, self).unlink(cr, uid, ids, context)
@@ -341,32 +331,35 @@ class hr_holidays(osv.osv):
'holiday_id': record.id
}
self._create_resource_leave(cr, uid, vals)
elif record.holiday_type == 'category' and record.type == 'remove':
elif record.holiday_type == 'category':
# Create leave/allocation request for employees in the category
emp_ids = obj_emp.search(cr, uid, [('category_ids', '=', record.category_id.id)])
leave_ids = []
for emp in obj_emp.browse(cr, uid, emp_ids):
vals = {
'name': record.name,
'date_from': record.date_from,
'date_to': record.date_to,
'calendar_id': emp.calendar_id.id,
'company_id': emp.company_id.id,
'resource_id': emp.resource_id.id,
'holiday_id':record.id
}
# self._create_resource_leave(cr, uid, vals)
# Validate all the leave requests of the category
for leave_id in self.search(cr, uid, [('category_holiday_id', '=', record.id)]):
wf_service.trg_validate(uid, 'hr.holidays', leave_id, 'validate', cr)
'name': record.name,
'type': record.type,
'holiday_type': 'employee',
'holiday_status_id': record.holiday_status_id.id,
'date_from': record.date_from,
'date_to': record.date_to,
'notes': record.notes,
'number_of_days_temp': record.number_of_days_temp,
'parent_id': record.id,
'employee_id': emp.id
}
leave_ids.append(self.create(cr, uid, vals, context=None))
# Confirm and validate all the leave requests of the category
for leave_id in leave_ids:
wf_service.trg_validate(uid, 'hr.holidays', leave_id, 'confirm', cr)
wf_service.trg_validate(uid, 'hr.holidays', leave_id, 'validate', cr)
return True
def holidays_confirm(self, cr, uid, ids, *args):
obj_hr_holiday_status = self.pool.get('hr.holidays.status')
obj_emp = self.pool.get('hr.employee')
wf_service = netsvc.LocalService("workflow")
for record in self.browse(cr, uid, ids):
user_id = False
leave_asked = record.number_of_days_temp
leave_ids = []
if record.holiday_type == 'employee' and record.type == 'remove':
if record.employee_id and not record.holiday_status_id.limit:
leaves_rest = obj_hr_holiday_status.get_days( cr, uid, [record.holiday_status_id.id], record.employee_id.id, False)[record.holiday_status_id.id]['remaining_leaves']
@@ -379,23 +372,6 @@ class hr_holidays(osv.osv):
if leaves_rest < leave_asked:
raise osv.except_osv(_('Warning!'),_('You cannot validate leaves for category %s while there are too few remaining leave days.') % (record.category_id.name))
nb = -(record.number_of_days_temp)
# Create leave request for employees in the category
emp_ids = obj_emp.search(cr, uid, [('category_ids', '=', record.category_id.id)])
for emp in obj_emp.browse(cr, uid, emp_ids):
vals = {
'name': record.name,
'holiday_status_id': record.holiday_status_id.id,
'date_from': record.date_from,
'date_to': record.date_to,
'notes': record.notes,
'number_of_days_temp': record.number_of_days_temp,
'category_holiday_id': record.id,
'employee_id': emp.id
}
leave_ids.append(self.create(cr, uid, vals, context=None))
# Confirm all the leave requests of the category
for leave_id in leave_ids:
wf_service.trg_validate(uid, 'hr.holidays', leave_id, 'confirm', cr)
else:
nb = record.number_of_days_temp
@@ -420,11 +396,8 @@ class hr_holidays(osv.osv):
def holidays_cancel(self, cr, uid, ids, *args):
self._update_user_holidays(cr, uid, ids)
self._remove_resouce_leave(cr, uid, ids)
self.write(cr, uid, ids, {'state': 'cancel'})
leave_ids = self._get_category_leave_ids(cr, uid, ids)
if leave_ids:
self.unlink(cr, uid, leave_ids) # unlink all the leave requests of the category
self._remove_resouce_leave(cr, uid, ids)
return True
def holidays_draft(self, cr, uid, ids, *args):
-12
View File
@@ -87,18 +87,6 @@
<!-- End Passport Views -->
<!-- Employee View -->
<record id="view_employee_bank_form" model="ir.ui.view">
<field name="name">res.partner.bank.form</field>
<field name="model">res.partner.bank</field>
<field name="type">form</field>
<field name="inherit_id" ref="base.view_partner_bank_form"/>
<field name="arch" type="xml">
<field name="partner_id" position="replace">
<field name="partner_id"/>
</field>
</field>
</record>
<record id="hr_contract.hr_hr_employee_view_form2" model="ir.ui.view">
<field name="name">hr.hr.employee.view.form2</field>
<field name="model">hr.employee</field>
+1 -1
View File
@@ -162,7 +162,7 @@
<group colspan="2" col="2">
<separator string="Invoice Control" colspan="2"/>
<field name="invoice_method"/>
<field name="invoice_id" groups="base.group_extended" context="{'journal_type':'purchase', 'type':'in_invoice'}"/>
<field name="invoice_id" groups="base.group_extended" readonly="1" context="{'journal_type':'purchase', 'type':'in_invoice'}"/>
<field name="fiscal_position" widget="selection"/>
</group>
<newline/>
-1
View File
@@ -724,7 +724,6 @@ class sale_order(osv.osv):
})
proc_ids.append(proc_id)
self.pool.get('sale.order.line').write(cr, uid, [line.id], {'procurement_id': proc_id})
if order.state == 'shipping_except':
for pick in order.picking_ids:
for move in pick.move_lines:
+1 -1
View File
@@ -27,7 +27,7 @@
This module provides features to improve the layout of the Sales Order.
It gives you the possibility to
* order all the lines of an sales order
* order all the lines of a sales order
* add titles, comment lines, sub total lines
* draw horizontal lines and put page breaks