[MERGE] Sync with addons/trunk.
bzr revid: tde@openerp.com-20121029135531-8x3mx84jtv42p454
This commit is contained in:
commit
061fd61d64
|
@ -39,7 +39,6 @@ class account_analytic_line(osv.osv):
|
||||||
}
|
}
|
||||||
|
|
||||||
_defaults = {
|
_defaults = {
|
||||||
'date': fields.date.context_today,
|
|
||||||
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'account.analytic.line', context=c),
|
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'account.analytic.line', context=c),
|
||||||
}
|
}
|
||||||
_order = 'date desc'
|
_order = 'date desc'
|
||||||
|
|
|
@ -865,8 +865,11 @@ class account_invoice(osv.osv):
|
||||||
self.check_tax_lines(cr, uid, inv, compute_taxes, ait_obj)
|
self.check_tax_lines(cr, uid, inv, compute_taxes, ait_obj)
|
||||||
|
|
||||||
# I disabled the check_total feature
|
# I disabled the check_total feature
|
||||||
#if inv.type in ('in_invoice', 'in_refund') and abs(inv.check_total - inv.amount_total) >= (inv.currency_id.rounding/2.0):
|
group_check_total_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'account', 'group_supplier_inv_check_total')[1]
|
||||||
# raise osv.except_osv(_('Bad total !'), _('Please verify the price of the invoice !\nThe real total does not match the computed total.'))
|
group_check_total = self.pool.get('res.groups').browse(cr, uid, group_check_total_id, context=context)
|
||||||
|
if group_check_total and uid in [x.id for x in group_check_total.users]:
|
||||||
|
if (inv.type in ('in_invoice', 'in_refund') and abs(inv.check_total - inv.amount_total) >= (inv.currency_id.rounding/2.0)):
|
||||||
|
raise osv.except_osv(_('Bad total !'), _('Please verify the price of the invoice !\nThe encoded total does not match the computed total.'))
|
||||||
|
|
||||||
if inv.payment_term:
|
if inv.payment_term:
|
||||||
total_fixed = total_percent = 0
|
total_fixed = total_percent = 0
|
||||||
|
|
|
@ -186,6 +186,7 @@
|
||||||
<field name="journal_id" groups="account.group_account_user"
|
<field name="journal_id" groups="account.group_account_user"
|
||||||
on_change="onchange_journal_id(journal_id, context)" widget="selection"/>
|
on_change="onchange_journal_id(journal_id, context)" widget="selection"/>
|
||||||
<field name="currency_id" groups="base.group_multi_currency"/>
|
<field name="currency_id" groups="base.group_multi_currency"/>
|
||||||
|
<field name="check_total" groups="account.group_supplier_inv_check_total"/>
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
<notebook>
|
<notebook>
|
||||||
|
|
|
@ -120,6 +120,8 @@ class account_config_settings(osv.osv_memory):
|
||||||
'group_analytic_accounting': fields.boolean('Analytic accounting',
|
'group_analytic_accounting': fields.boolean('Analytic accounting',
|
||||||
implied_group='analytic.group_analytic_accounting',
|
implied_group='analytic.group_analytic_accounting',
|
||||||
help="Allows you to use the analytic accounting."),
|
help="Allows you to use the analytic accounting."),
|
||||||
|
'group_check_supplier_invoice_total': fields.boolean('Check the total of supplier invoices',
|
||||||
|
implied_group="account.group_supplier_inv_check_total"),
|
||||||
}
|
}
|
||||||
|
|
||||||
def _default_company(self, cr, uid, context=None):
|
def _default_company(self, cr, uid, context=None):
|
||||||
|
|
|
@ -220,6 +220,10 @@
|
||||||
<field name="module_account_check_writing" class="oe_inline"/>
|
<field name="module_account_check_writing" class="oe_inline"/>
|
||||||
<label for="module_account_check_writing"/>
|
<label for="module_account_check_writing"/>
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
<field name="group_check_supplier_invoice_total" class="oe_inline"/>
|
||||||
|
<label for="group_check_supplier_invoice_total"/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</group>
|
</group>
|
||||||
<separator string="Bank & Cash"/>
|
<separator string="Bank & Cash"/>
|
||||||
|
|
|
@ -26,6 +26,11 @@
|
||||||
<field name="category_id" ref="base.module_category_hidden"/>
|
<field name="category_id" ref="base.module_category_hidden"/>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
<record id="group_supplier_inv_check_total" model="res.groups">
|
||||||
|
<field name="name">Check Total on supplier invoices</field>
|
||||||
|
<field name="category_id" ref="base.module_category_hidden"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
<record id="account_move_comp_rule" model="ir.rule">
|
<record id="account_move_comp_rule" model="ir.rule">
|
||||||
<field name="name">Account Entry</field>
|
<field name="name">Account Entry</field>
|
||||||
<field name="model_id" ref="model_account_move"/>
|
<field name="model_id" ref="model_account_move"/>
|
||||||
|
|
|
@ -988,11 +988,11 @@ class account_voucher(osv.osv):
|
||||||
if amount_residual > 0:
|
if amount_residual > 0:
|
||||||
account_id = line.voucher_id.company_id.expense_currency_exchange_account_id
|
account_id = line.voucher_id.company_id.expense_currency_exchange_account_id
|
||||||
if not account_id:
|
if not account_id:
|
||||||
raise osv.except_osv(_('Warning!'),_("First you have to configure the 'Expense Currency Rate' on the company, then create accounting entry for currency rate difference."))
|
raise osv.except_osv(_('Insufficient Configuration!'),_("You should configure the 'Loss Exchange Rate Account' in the accounting settings, to manage automatically the booking of accounting entries related to differences between exchange rates."))
|
||||||
else:
|
else:
|
||||||
account_id = line.voucher_id.company_id.income_currency_exchange_account_id
|
account_id = line.voucher_id.company_id.income_currency_exchange_account_id
|
||||||
if not account_id:
|
if not account_id:
|
||||||
raise osv.except_osv(_('Warning!'),_("First you have to configure the 'Income Currency Rate' on the company, then create accounting entry for currency rate difference."))
|
raise osv.except_osv(_('Insufficient Configuration!'),_("You should configure the 'Gain Exchange Rate Account' in the accounting settings, to manage automatically the booking of accounting entries related to differences between exchange rates."))
|
||||||
# Even if the amount_currency is never filled, we need to pass the foreign currency because otherwise
|
# Even if the amount_currency is never filled, we need to pass the foreign currency because otherwise
|
||||||
# the receivable/payable account may have a secondary currency, which render this field mandatory
|
# the receivable/payable account may have a secondary currency, which render this field mandatory
|
||||||
account_currency_id = company_currency <> current_currency and current_currency or False
|
account_currency_id = company_currency <> current_currency and current_currency or False
|
||||||
|
|
|
@ -305,8 +305,15 @@ class account_analytic_line(osv.osv):
|
||||||
'company_id': fields.related('account_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True, readonly=True),
|
'company_id': fields.related('account_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True, readonly=True),
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def _get_default_date(self, cr, uid, context=None):
|
||||||
|
return fields.date.context_today(self, cr, uid, context=context)
|
||||||
|
|
||||||
|
def __get_default_date(self, cr, uid, context=None):
|
||||||
|
return self._get_default_date(cr, uid, context=context)
|
||||||
|
|
||||||
_defaults = {
|
_defaults = {
|
||||||
'date': lambda *a: time.strftime('%Y-%m-%d'),
|
'date': __get_default_date,
|
||||||
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'account.analytic.line', context=c),
|
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'account.analytic.line', context=c),
|
||||||
'amount': 0.00
|
'amount': 0.00
|
||||||
}
|
}
|
||||||
|
|
|
@ -223,16 +223,26 @@ class hr_timesheet_sheet(osv.osv):
|
||||||
|
|
||||||
hr_timesheet_sheet()
|
hr_timesheet_sheet()
|
||||||
|
|
||||||
|
class account_analytic_line(osv.osv):
|
||||||
class hr_timesheet_line(osv.osv):
|
_inherit = "account.analytic.line"
|
||||||
_inherit = "hr.analytic.timesheet"
|
|
||||||
|
|
||||||
def _get_default_date(self, cr, uid, context=None):
|
def _get_default_date(self, cr, uid, context=None):
|
||||||
if context is None:
|
if context is None:
|
||||||
context = {}
|
context = {}
|
||||||
if 'date' in context:
|
#get the default date (should be: today)
|
||||||
return context['date']
|
res = super(account_analytic_line, self)._get_default_date(cr, uid, context=context)
|
||||||
return time.strftime('%Y-%m-%d')
|
#if we got the dates from and to from the timesheet and if the default date is in between, we use the default
|
||||||
|
#but if the default isn't included in those dates, we use the date start of the timesheet as default
|
||||||
|
if context.get('timesheet_date_from') and context.get('timesheet_date_to'):
|
||||||
|
if context['timesheet_date_from'] <= res <= context['timesheet_date_to']:
|
||||||
|
return res
|
||||||
|
return context.get('timesheet_date_from')
|
||||||
|
#if we don't get the dates from the timesheet, we return the default value from super()
|
||||||
|
return res
|
||||||
|
|
||||||
|
|
||||||
|
class hr_timesheet_line(osv.osv):
|
||||||
|
_inherit = "hr.analytic.timesheet"
|
||||||
|
|
||||||
def _sheet(self, cursor, user, ids, name, args, context=None):
|
def _sheet(self, cursor, user, ids, name, args, context=None):
|
||||||
sheet_obj = self.pool.get('hr_timesheet_sheet.sheet')
|
sheet_obj = self.pool.get('hr_timesheet_sheet.sheet')
|
||||||
|
@ -278,9 +288,6 @@ class hr_timesheet_line(osv.osv):
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
_defaults = {
|
|
||||||
'date': _get_default_date,
|
|
||||||
}
|
|
||||||
|
|
||||||
def _check_sheet_state(self, cr, uid, ids, context=None):
|
def _check_sheet_state(self, cr, uid, ids, context=None):
|
||||||
if context is None:
|
if context is None:
|
||||||
|
|
|
@ -103,7 +103,7 @@
|
||||||
</widget>
|
</widget>
|
||||||
</page>
|
</page>
|
||||||
<page string="Details">
|
<page string="Details">
|
||||||
<field context="{'user_id':user_id}" name="timesheet_ids" nolabel="1">
|
<field context="{'user_id':user_id, 'timesheet_date_from': date_from, 'timesheet_date_to': date_to}}" name="timesheet_ids" nolabel="1">
|
||||||
<tree editable="top" string="Timesheet Activities">
|
<tree editable="top" string="Timesheet Activities">
|
||||||
<field name="date"/>
|
<field name="date"/>
|
||||||
<field domain="[('type','in',['normal', 'contract']), ('state', '<>', 'close'),('use_timesheets','=',1)]" name="account_id" on_change="on_change_account_id(account_id, user_id)" context="{'default_use_timesheets': 1}"/>
|
<field domain="[('type','in',['normal', 'contract']), ('state', '<>', 'close'),('use_timesheets','=',1)]" name="account_id" on_change="on_change_account_id(account_id, user_id)" context="{'default_use_timesheets': 1}"/>
|
||||||
|
|
|
@ -37,7 +37,7 @@ modules.
|
||||||
'author': 'OpenERP SA',
|
'author': 'OpenERP SA',
|
||||||
'website': 'http://www.openerp.com',
|
'website': 'http://www.openerp.com',
|
||||||
'images': ['images/crm_statistics_dashboard.jpeg', 'images/opportunity_to_quote.jpeg'],
|
'images': ['images/crm_statistics_dashboard.jpeg', 'images/opportunity_to_quote.jpeg'],
|
||||||
'depends': ['sale_stock', 'crm'],
|
'depends': ['sale', 'crm'],
|
||||||
'data': [
|
'data': [
|
||||||
'wizard/crm_make_sale_view.xml',
|
'wizard/crm_make_sale_view.xml',
|
||||||
'sale_crm_view.xml',
|
'sale_crm_view.xml',
|
||||||
|
|
|
@ -31,7 +31,7 @@ Price and Cost Price.
|
||||||
""",
|
""",
|
||||||
'author':'OpenERP SA',
|
'author':'OpenERP SA',
|
||||||
'images':['images/sale_margin.jpeg'],
|
'images':['images/sale_margin.jpeg'],
|
||||||
'depends':['sale_stock'],
|
'depends':['sale'],
|
||||||
'demo':['sale_margin_demo.xml'],
|
'demo':['sale_margin_demo.xml'],
|
||||||
'test': ['test/sale_margin.yml'],
|
'test': ['test/sale_margin.yml'],
|
||||||
'data':['security/ir.model.access.csv','sale_margin_view.xml'],
|
'data':['security/ir.model.access.csv','sale_margin_view.xml'],
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
product_uom: product.product_uom_unit
|
product_uom: product.product_uom_unit
|
||||||
product_uom_qty: 100.0
|
product_uom_qty: 100.0
|
||||||
state: draft
|
state: draft
|
||||||
delay: 7.0
|
|
||||||
product_id: product.product_product_24
|
product_id: product.product_product_24
|
||||||
product_uos_qty: 100.0
|
product_uos_qty: 100.0
|
||||||
th_weight: 0.0
|
th_weight: 0.0
|
||||||
|
@ -23,7 +22,6 @@
|
||||||
partner_id: base.res_partner_4
|
partner_id: base.res_partner_4
|
||||||
partner_invoice_id: base.res_partner_address_7
|
partner_invoice_id: base.res_partner_address_7
|
||||||
partner_shipping_id: base.res_partner_address_7
|
partner_shipping_id: base.res_partner_address_7
|
||||||
picking_policy: direct
|
|
||||||
pricelist_id: product.list0
|
pricelist_id: product.list0
|
||||||
shop_id: sale.sale_shop_1
|
shop_id: sale.sale_shop_1
|
||||||
-
|
-
|
||||||
|
|
|
@ -618,7 +618,7 @@ class stock_picking(osv.osv):
|
||||||
|
|
||||||
def create(self, cr, user, vals, context=None):
|
def create(self, cr, user, vals, context=None):
|
||||||
if ('name' not in vals) or (vals.get('name')=='/'):
|
if ('name' not in vals) or (vals.get('name')=='/'):
|
||||||
seq_obj_name = 'stock.picking.' + vals['type']
|
seq_obj_name = self._name
|
||||||
vals['name'] = self.pool.get('ir.sequence').get(cr, user, seq_obj_name)
|
vals['name'] = self.pool.get('ir.sequence').get(cr, user, seq_obj_name)
|
||||||
new_id = super(stock_picking, self).create(cr, user, vals, context)
|
new_id = super(stock_picking, self).create(cr, user, vals, context)
|
||||||
if new_id:
|
if new_id:
|
||||||
|
|
|
@ -82,7 +82,7 @@ instance.web_shortcuts.Shortcuts = instance.web.Widget.extend({
|
||||||
// TODO: Use do_action({menu_id: id, type: 'ir.actions.menu'})
|
// TODO: Use do_action({menu_id: id, type: 'ir.actions.menu'})
|
||||||
self.rpc('/web/menu/action', {'menu_id': id}).then(function(ir_menu_data) {
|
self.rpc('/web/menu/action', {'menu_id': id}).then(function(ir_menu_data) {
|
||||||
if (ir_menu_data.action.length){
|
if (ir_menu_data.action.length){
|
||||||
instance.webclient.user_menu.on_action({action_id: ir_menu_data.action[0][2].id});
|
instance.webclient.on_menu_action({action_id: ir_menu_data.action[0][2].id});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.$el.find('.oe_systray_shortcuts').trigger('mouseout');
|
this.$el.find('.oe_systray_shortcuts').trigger('mouseout');
|
||||||
|
|
Loading…
Reference in New Issue