[MERGE] forward port of branch saas-1 up to revid 8791 chs@openerp.com-20131009175454-j06y1ngylfbqyrpj
bzr revid: chs@openerp.com-20131009180337-cxgdt6zzd1z68ga9
This commit is contained in:
commit
273face907
|
@ -3047,6 +3047,20 @@ class wizard_multi_charts_accounts(osv.osv_memory):
|
|||
'complete_tax_set': fields.boolean('Complete Set of Taxes', help='This boolean helps you to choose if you want to propose to the user to encode the sales and purchase rates or use the usual m2o fields. This last choice assumes that the set of tax defined for the chosen template is complete'),
|
||||
}
|
||||
|
||||
|
||||
def _get_chart_parent_ids(self, cr, uid, chart_template, context=None):
|
||||
""" Returns the IDs of all ancestor charts, including the chart itself.
|
||||
(inverse of child_of operator)
|
||||
|
||||
:param browse_record chart_template: the account.chart.template record
|
||||
:return: the IDS of all ancestor charts, including the chart itself.
|
||||
"""
|
||||
result = [chart_template.id]
|
||||
while chart_template.parent_id:
|
||||
chart_template = chart_template.parent_id
|
||||
result.append(chart_template.id)
|
||||
return result
|
||||
|
||||
def onchange_tax_rate(self, cr, uid, ids, rate=False, context=None):
|
||||
return {'value': {'purchase_tax_rate': rate or False}}
|
||||
|
||||
|
@ -3060,12 +3074,17 @@ class wizard_multi_charts_accounts(osv.osv_memory):
|
|||
res['value'].update({'complete_tax_set': data.complete_tax_set, 'currency_id': currency_id})
|
||||
if data.complete_tax_set:
|
||||
# default tax is given by the lowest sequence. For same sequence we will take the latest created as it will be the case for tax created while isntalling the generic chart of account
|
||||
sale_tax_ids = tax_templ_obj.search(cr, uid, [("chart_template_id"
|
||||
, "=", chart_template_id), ('type_tax_use', 'in', ('sale','all'))], order="sequence, id desc")
|
||||
purchase_tax_ids = tax_templ_obj.search(cr, uid, [("chart_template_id"
|
||||
, "=", chart_template_id), ('type_tax_use', 'in', ('purchase','all'))], order="sequence, id desc")
|
||||
res['value'].update({'sale_tax': sale_tax_ids and sale_tax_ids[0] or False, 'purchase_tax': purchase_tax_ids and purchase_tax_ids[0] or False})
|
||||
|
||||
chart_ids = self._get_chart_parent_ids(cr, uid, data, context=context)
|
||||
base_tax_domain = [("chart_template_id", "in", chart_ids), ('parent_id', '=', False)]
|
||||
sale_tax_domain = base_tax_domain + [('type_tax_use', 'in', ('sale','all'))]
|
||||
purchase_tax_domain = base_tax_domain + [('type_tax_use', 'in', ('purchase','all'))]
|
||||
sale_tax_ids = tax_templ_obj.search(cr, uid, sale_tax_domain, order="sequence, id desc")
|
||||
purchase_tax_ids = tax_templ_obj.search(cr, uid, purchase_tax_domain, order="sequence, id desc")
|
||||
res['value'].update({'sale_tax': sale_tax_ids and sale_tax_ids[0] or False,
|
||||
'purchase_tax': purchase_tax_ids and purchase_tax_ids[0] or False})
|
||||
res.setdefault('domain', {})
|
||||
res['domain']['sale_tax'] = repr(sale_tax_domain)
|
||||
res['domain']['purchase_tax'] = repr(purchase_tax_domain)
|
||||
if data.code_digits:
|
||||
res['value'].update({'code_digits': data.code_digits})
|
||||
return res
|
||||
|
@ -3073,6 +3092,7 @@ class wizard_multi_charts_accounts(osv.osv_memory):
|
|||
def default_get(self, cr, uid, fields, context=None):
|
||||
res = super(wizard_multi_charts_accounts, self).default_get(cr, uid, fields, context=context)
|
||||
tax_templ_obj = self.pool.get('account.tax.template')
|
||||
account_chart_template = self.pool['account.chart.template']
|
||||
|
||||
if 'bank_accounts_id' in fields:
|
||||
res.update({'bank_accounts_id': [{'acc_name': _('Cash'), 'account_type': 'cash'},{'acc_name': _('Bank'), 'account_type': 'bank'}]})
|
||||
|
@ -3086,23 +3106,28 @@ class wizard_multi_charts_accounts(osv.osv_memory):
|
|||
currency_id = company_obj.on_change_country(cr, uid, company_id, country_id, context=context)['value']['currency_id']
|
||||
res.update({'currency_id': currency_id})
|
||||
|
||||
ids = self.pool.get('account.chart.template').search(cr, uid, [('visible', '=', True)], context=context)
|
||||
ids = account_chart_template.search(cr, uid, [('visible', '=', True)], context=context)
|
||||
if ids:
|
||||
#in order to set default chart which was last created set max of ids.
|
||||
chart_id = max(ids)
|
||||
if context.get("default_charts"):
|
||||
model_data = self.pool.get('ir.model.data').search_read(cr, uid, [('model','=','account.chart.template'),('module','=',context.get("default_charts"))], ['res_id'], context=context)
|
||||
if model_data:
|
||||
chart_id = model_data[0]['res_id']
|
||||
chart = account_chart_template.browse(cr, uid, chart_id, context=context)
|
||||
chart_hierarchy_ids = self._get_chart_parent_ids(cr, uid, chart, context=context)
|
||||
if 'chart_template_id' in fields:
|
||||
#in order to get set default chart which was last created set max of ids.
|
||||
chart_id = max(ids)
|
||||
if context.get("default_charts"):
|
||||
model_data = self.pool.get('ir.model.data').search_read(cr, uid, [('model','=','account.chart.template'),('module','=',context.get("default_charts"))], ['res_id'], context=context)
|
||||
if model_data:
|
||||
chart_id = model_data[0]['res_id']
|
||||
res.update({'only_one_chart_template': len(ids) == 1, 'chart_template_id': chart_id})
|
||||
res.update({'only_one_chart_template': len(ids) == 1,
|
||||
'chart_template_id': chart_id})
|
||||
if 'sale_tax' in fields:
|
||||
sale_tax_ids = tax_templ_obj.search(cr, uid, [("chart_template_id"
|
||||
, "=", ids[0]), ('type_tax_use', 'in', ('sale','all'))], order="sequence")
|
||||
sale_tax_ids = tax_templ_obj.search(cr, uid, [("chart_template_id", "in", chart_hierarchy_ids),
|
||||
('type_tax_use', 'in', ('sale','all'))],
|
||||
order="sequence")
|
||||
res.update({'sale_tax': sale_tax_ids and sale_tax_ids[0] or False})
|
||||
if 'purchase_tax' in fields:
|
||||
purchase_tax_ids = tax_templ_obj.search(cr, uid, [("chart_template_id"
|
||||
, "=", ids[0]), ('type_tax_use', 'in', ('purchase','all'))], order="sequence")
|
||||
purchase_tax_ids = tax_templ_obj.search(cr, uid, [("chart_template_id", "in", chart_hierarchy_ids),
|
||||
('type_tax_use', 'in', ('purchase','all'))],
|
||||
order="sequence")
|
||||
res.update({'purchase_tax': purchase_tax_ids and purchase_tax_ids[0] or False})
|
||||
res.update({
|
||||
'purchase_tax_rate': 15.0,
|
||||
|
@ -3370,12 +3395,7 @@ class wizard_multi_charts_accounts(osv.osv_memory):
|
|||
obj_tax_temp = self.pool.get('account.tax.template')
|
||||
chart_template = obj_wizard.chart_template_id
|
||||
vals = {}
|
||||
# get the ids of all the parents of the selected account chart template
|
||||
current_chart_template = chart_template
|
||||
all_parents = [current_chart_template.id]
|
||||
while current_chart_template.parent_id:
|
||||
current_chart_template = current_chart_template.parent_id
|
||||
all_parents.append(current_chart_template.id)
|
||||
all_parents = self._get_chart_parent_ids(cr, uid, chart_template, context=context)
|
||||
# create tax templates and tax code templates from purchase_tax_rate and sale_tax_rate fields
|
||||
if not chart_template.complete_tax_set:
|
||||
value = obj_wizard.sale_tax_rate
|
||||
|
|
|
@ -463,7 +463,7 @@
|
|||
<separator/>
|
||||
<filter domain="[('user_id','=',uid)]" help="My Invoices"/>
|
||||
<group expand="0" string="Group By...">
|
||||
<filter name="partner_id" string="Partner" domain="[]" context="{'group_by':'partner_id'}"/>
|
||||
<filter name="group_by_partner_id" string="Partner" domain="[]" context="{'group_by':'partner_id'}"/>
|
||||
<filter name="commercial_partner_id" string="Commercial Partner" domain="[]" context="{'group_by':'commercial_partner_id'}"/>
|
||||
<filter string="Responsible" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}"/>
|
||||
<filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'journal_id'}"/>
|
||||
|
|
|
@ -84,7 +84,7 @@ openerp.account.quickadd = function (instance) {
|
|||
},
|
||||
search_by_journal_period: function() {
|
||||
var self = this;
|
||||
var domain = ['|',['debit', '!=', 0], ['credit', '!=', 0]];
|
||||
var domain = [];
|
||||
if (self.current_journal !== null) domain.push(["journal_id", "=", self.current_journal]);
|
||||
if (self.current_period !== null) domain.push(["period_id", "=", self.current_period]);
|
||||
self.last_context["journal_id"] = self.current_journal === null ? false : self.current_journal;
|
||||
|
|
|
@ -130,7 +130,7 @@
|
|||
<separator/>
|
||||
<filter icon="terp-gtk-jump-to-ltr" string="To Review" domain="[('state','=','posted'), ('audit','=',False)]" help="To Review"/>
|
||||
<field name="partner_id" filter_domain="[('partner_id', 'child_of', self)]"/>
|
||||
<field name="journal_id" context="{'journal_id': self, 'set_visible':False}" />
|
||||
<field name="journal_id" widget="selection" context="{'journal_id': self, 'set_visible':False}" /> <!-- Keep widget=selection on this field to pass numeric `self` value, which is not the case for regular m2o widgets! -->
|
||||
<field name="period_id"/>
|
||||
<group expand="0" string="Group By...">
|
||||
<filter string="Partner" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/>
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<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"/>
|
||||
<field name="partner_id" string="Customer" filter_domain="[('partner_id','child_of',self)]"/>
|
||||
<field name="journal_id" context="{'journal_id': self, 'set_visible':False}" domain="[('type','in',('bank','cash'))]"/>
|
||||
<field name="journal_id" widget="selection" context="{'journal_id': self, 'set_visible':False}" domain="[('type','in',('bank','cash'))]"/> <!-- Keep widget=selection on this field to pass numeric `self` value, which is not the case for regular m2o widgets! -->
|
||||
<field name="period_id"/>
|
||||
<group expand="0" string="Group By...">
|
||||
<filter string="Customer" icon="terp-personal" domain="[]" context="{'group_by':'partner_id'}"/>
|
||||
|
@ -35,7 +35,7 @@
|
|||
<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"/>
|
||||
<field name="partner_id" string="Supplier" filter_domain="[('partner_id','child_of',self)]"/>
|
||||
<field name="journal_id" context="{'journal_id': self, 'set_visible':False}" domain="[('type','in',('bank','cash'))]"/>
|
||||
<field name="journal_id" widget="selection" context="{'journal_id': self, 'set_visible':False}" domain="[('type','in',('bank','cash'))]"/> <!-- Keep widget=selection on this field to pass numeric `self` value, which is not the case for regular m2o widgets! -->
|
||||
<field name="period_id"/>
|
||||
<group expand="0" string="Group By...">
|
||||
<filter string="Supplier" icon="terp-personal" domain="[]" context="{'group_by':'partner_id'}"/>
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<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"/>
|
||||
<field name="partner_id" string="Supplier" filter_domain="[('partner_id','child_of',self)]"/>
|
||||
<field name="journal_id" context="{'journal_id': self, 'set_visible':False}" domain="[('type','in',('purchase','purchase_refund'))]"/>
|
||||
<field name="journal_id" widget="selection" context="{'journal_id': self, 'set_visible':False}" domain="[('type','in',('purchase','purchase_refund'))]"/> <!-- Keep widget=selection on this field to pass numeric `self` value, which is not the case for regular m2o widgets! -->
|
||||
<field name="period_id"/>
|
||||
<group expand="0" string="Group By...">
|
||||
<filter string="Supplier" icon="terp-personal" domain="[]" context="{'group_by':'partner_id'}"/>
|
||||
|
@ -33,7 +33,7 @@
|
|||
<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"/>
|
||||
<field name="partner_id" string="Customer" filter_domain="[('partner_id','child_of',self)]"/>
|
||||
<field name="journal_id" context="{'journal_id': self, 'set_visible':False}" domain="[('type','in',('sale','sale_refund'))]"/>
|
||||
<field name="journal_id" widget="selection" context="{'journal_id': self, 'set_visible':False}" domain="[('type','in',('sale','sale_refund'))]"/> <!-- Keep widget=selection on this field to pass numeric `self` value, which is not the case for regular m2o widgets! -->
|
||||
<field name="period_id"/>
|
||||
<group expand="0" string="Group By...">
|
||||
<filter string="Customer" icon="terp-personal" domain="[]" context="{'group_by':'partner_id'}"/>
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
<record id="reset_password_email" model="email.template">
|
||||
<field name="name">Reset Password</field>
|
||||
<field name="model_id" ref="base.model_res_users"/>
|
||||
<field name="email_from"><![CDATA[${object.company_id.name} <${object.company_id.email}>]]></field>
|
||||
<field name="email_from"><![CDATA[${object.company_id.name} <${object.company_id.email or user.email}>]]></field>
|
||||
<field name="email_to">${object.email}</field>
|
||||
<field name="subject">Password reset</field>
|
||||
<field name="body_html"><![CDATA[
|
||||
|
@ -37,7 +37,7 @@
|
|||
<record id="set_password_email" model="email.template">
|
||||
<field name="name">OpenERP Enterprise Connection</field>
|
||||
<field name="model_id" ref="base.model_res_users"/>
|
||||
<field name="email_from"><![CDATA[${object.company_id.name} <${object.company_id.email}>]]></field>
|
||||
<field name="email_from"><![CDATA[${object.company_id.name} <${object.company_id.email or user.email}>]]></field>
|
||||
<field name="email_to">${object.email}</field>
|
||||
<field name="subject"><![CDATA[${object.company_id.name} invitation to connect on OpenERP]]></field>
|
||||
<field name="body_html">
|
||||
|
|
|
@ -79,7 +79,15 @@
|
|||
I click on "Create Invoice" button of "Invoice analytic Line" wizard to create invoice.
|
||||
-
|
||||
!python {model: hr.timesheet.invoice.create}: |
|
||||
self.do_create(cr, uid, [ref("hr_timesheet_invoice_create_0")], {"active_ids": [ref("hr_timesheet_invoice.account_analytic_line_developyamlforhrmodule0")]})
|
||||
action_result = self.do_create(cr, uid, [ref("hr_timesheet_invoice_create_0")], {
|
||||
"active_ids": [ref("hr_timesheet_invoice.account_analytic_line_developyamlforhrmodule0")]
|
||||
})
|
||||
invoice_pool = self.pool.get('account.invoice')
|
||||
invoice_domain = action_result['domain']
|
||||
invoice_ids = invoice_pool.search(cr, uid, invoice_domain)
|
||||
invoice_pool.write(cr, uid, invoice_ids, {'origin': 'test-hrtsic0_id_'+str( ref("hr_timesheet_invoice_create_0")) \
|
||||
+ '_aaldyfhrm0_id_'+str( ref("hr_timesheet_invoice.account_analytic_line_developyamlforhrmodule0") ) })
|
||||
|
||||
-
|
||||
I check that Invoice is created for this timesheet.
|
||||
-
|
||||
|
@ -90,7 +98,9 @@
|
|||
partner = aline.account_id.partner_id.id
|
||||
|
||||
invoice_obj = self.pool.get('account.invoice')
|
||||
invoice_ids = invoice_obj.search(cr, uid, [('partner_id', '=', partner)])
|
||||
invoice_ids = invoice_obj.search(cr, uid, [('partner_id', '=', partner),
|
||||
('origin', '=', 'test-hrtsic0_id_'+str( ref("hr_timesheet_invoice_create_0")) + '_aaldyfhrm0_id_'+str( ref("hr_timesheet_invoice.account_analytic_line_developyamlforhrmodule0") ))
|
||||
])
|
||||
invoice_id = invoice_obj.browse(cr, uid, invoice_ids)[0]
|
||||
|
||||
for invoice in invoice_id.invoice_line:
|
||||
|
@ -102,4 +112,4 @@
|
|||
assert aline.invoice_id, "Invoice created, but analytic line wasn't updated."
|
||||
assert aline.invoice_id == invoice_id, "Invoice doesn't match the one at analytic line"
|
||||
assert invoice_id.amount_untaxed == 187.5, "Invoice amount mismatch: %s" % invoice_id.amount_untaxed
|
||||
assert invoice_id.amount_tax == 50, "Invoice tax mismatch: %s" % invoice_id.amount_tax
|
||||
assert invoice_id.amount_tax == 50, "Invoice tax mismatch: %s" % invoice_id.amount_tax
|
||||
|
|
|
@ -78,7 +78,14 @@
|
|||
I click on "Create Invoice" button of "Invoice analytic Line" wizard to create invoice.
|
||||
-
|
||||
!python {model: hr.timesheet.invoice.create}: |
|
||||
self.do_create(cr, uid, [ref("hr_timesheet_invoice_create_0")], {"active_ids": [ref("hr_timesheet_invoice.account_analytic_line_developyamlforhrmodule1")]})
|
||||
action_result = self.do_create(cr, uid, [ref("hr_timesheet_invoice_create_0")], {
|
||||
"active_ids": [ref("hr_timesheet_invoice.account_analytic_line_developyamlforhrmodule1")]
|
||||
})
|
||||
invoice_pool = self.pool.get('account.invoice')
|
||||
invoice_domain = action_result['domain']
|
||||
invoice_ids = invoice_pool.search(cr, uid, invoice_domain)
|
||||
invoice_pool.write(cr, uid, invoice_ids, {'origin': 'test-hrtsic0_id_'+str( ref("hr_timesheet_invoice_create_0"))\
|
||||
+ '_aaldyfhrm1_id_'+str( ref("hr_timesheet_invoice.account_analytic_line_developyamlforhrmodule1") ) })
|
||||
-
|
||||
I check that Invoice is created for this timesheet.
|
||||
-
|
||||
|
@ -89,7 +96,10 @@
|
|||
partner = aline.account_id.partner_id.id
|
||||
|
||||
invoice_obj = self.pool.get('account.invoice')
|
||||
invoice_ids = invoice_obj.search(cr, uid, [('partner_id', '=', partner)])
|
||||
invoice_ids = invoice_obj.search(cr, uid, [('partner_id', '=', partner),
|
||||
('origin', '=', 'test-hrtsic0_id_'+str( ref("hr_timesheet_invoice_create_0")) + '_aaldyfhrm1_id_'+str( ref("hr_timesheet_invoice.account_analytic_line_developyamlforhrmodule1") ))
|
||||
])
|
||||
|
||||
invoice_id = invoice_obj.browse(cr, uid, invoice_ids)[0]
|
||||
|
||||
for invoice in invoice_id.invoice_line:
|
||||
|
@ -101,4 +111,4 @@
|
|||
assert aline.invoice_id, "Invoice created, but analytic line wasn't updated."
|
||||
assert aline.invoice_id == invoice_id, "Invoice doesn't match the one at analytic line"
|
||||
assert invoice_id.amount_untaxed == 187.5, "Invoice amount mismatch: %s" % invoice_id.amount_untaxed
|
||||
assert invoice_id.amount_tax == 40, "Invoice tax mismatch: %s" % invoice_id.amount_tax
|
||||
assert invoice_id.amount_tax == 40, "Invoice tax mismatch: %s" % invoice_id.amount_tax
|
||||
|
|
|
@ -242,6 +242,22 @@
|
|||
<field ref="tax_code_template_ipi" name="ref_tax_code_id"/>
|
||||
</record>
|
||||
|
||||
<record id="tax_template_out_ipi24" model="account.tax.template">
|
||||
<field name="description">IPI 24%</field>
|
||||
<field name="name">IPI Saída 24%</field>
|
||||
<field name="amount">0.24</field>
|
||||
<field name="type_tax_use">sale</field>
|
||||
<field ref="account_template_201010301" name="account_collected_id"/>
|
||||
<field ref="account_template_101050502" name="account_paid_id"/>
|
||||
<field eval="0" name="price_include"/>
|
||||
<field eval="0" name="tax_discount"/>
|
||||
<field ref="l10n_br_account_chart_template" name="chart_template_id"/>
|
||||
<field ref="tax_code_template_ipi" name="base_code_id"/>
|
||||
<field ref="tax_code_template_ipi" name="tax_code_id"/>
|
||||
<field ref="tax_code_template_ipi" name="ref_base_code_id"/>
|
||||
<field ref="tax_code_template_ipi" name="ref_tax_code_id"/>
|
||||
</record>
|
||||
|
||||
<record id="tax_template_out_ipi25" model="account.tax.template">
|
||||
<field name="description">IPI 25%</field>
|
||||
<field name="name">IPI Saída 25%</field>
|
||||
|
@ -386,6 +402,22 @@
|
|||
<field ref="tax_code_template_ipi" name="ref_tax_code_id"/>
|
||||
</record>
|
||||
|
||||
<record id="tax_template_out_ipi300" model="account.tax.template">
|
||||
<field name="description">IPI 300%</field>
|
||||
<field name="name">IPI Saída 300%</field>
|
||||
<field name="amount">3.00</field>
|
||||
<field name="type_tax_use">sale</field>
|
||||
<field ref="account_template_201010301" name="account_collected_id"/>
|
||||
<field ref="account_template_101050502" name="account_paid_id"/>
|
||||
<field eval="0" name="price_include"/>
|
||||
<field eval="0" name="tax_discount"/>
|
||||
<field ref="l10n_br_account_chart_template" name="chart_template_id"/>
|
||||
<field ref="tax_code_template_ipi" name="base_code_id"/>
|
||||
<field ref="tax_code_template_ipi" name="tax_code_id"/>
|
||||
<field ref="tax_code_template_ipi" name="ref_base_code_id"/>
|
||||
<field ref="tax_code_template_ipi" name="ref_tax_code_id"/>
|
||||
</record>
|
||||
|
||||
<record id="tax_template_out_ipi330" model="account.tax.template">
|
||||
<field name="description">IPI 330%</field>
|
||||
<field name="name">IPI Saída 330%</field>
|
||||
|
@ -642,6 +674,22 @@
|
|||
<field ref="tax_code_template_ipi" name="ref_tax_code_id"/>
|
||||
</record>
|
||||
|
||||
<record id="tax_template_in_ipi24" model="account.tax.template">
|
||||
<field name="description">IPI 24%</field>
|
||||
<field name="name">IPI Entrada 24%</field>
|
||||
<field name="amount">0.24</field>
|
||||
<field name="type_tax_use">purchase</field>
|
||||
<field ref="account_template_101050502" name="account_collected_id"/>
|
||||
<field ref="account_template_201010301" name="account_paid_id"/>
|
||||
<field eval="0" name="price_include"/>
|
||||
<field eval="0" name="tax_discount"/>
|
||||
<field ref="l10n_br_account_chart_template" name="chart_template_id"/>
|
||||
<field ref="tax_code_template_ipi" name="base_code_id"/>
|
||||
<field ref="tax_code_template_ipi" name="tax_code_id"/>
|
||||
<field ref="tax_code_template_ipi" name="ref_base_code_id"/>
|
||||
<field ref="tax_code_template_ipi" name="ref_tax_code_id"/>
|
||||
</record>
|
||||
|
||||
<record id="tax_template_in_ipi25" model="account.tax.template">
|
||||
<field name="description">IPI 25%</field>
|
||||
<field name="name">IPI Entrada 25%</field>
|
||||
|
@ -786,6 +834,22 @@
|
|||
<field ref="tax_code_template_ipi" name="ref_tax_code_id"/>
|
||||
</record>
|
||||
|
||||
<record id="tax_template_in_ipi300" model="account.tax.template">
|
||||
<field name="description">IPI 300%</field>
|
||||
<field name="name">IPI Entrada 300%</field>
|
||||
<field name="amount">3.00</field>
|
||||
<field name="type_tax_use">purchase</field>
|
||||
<field ref="account_template_101050502" name="account_collected_id"/>
|
||||
<field ref="account_template_201010301" name="account_paid_id"/>
|
||||
<field eval="0" name="price_include"/>
|
||||
<field eval="0" name="tax_discount"/>
|
||||
<field ref="l10n_br_account_chart_template" name="chart_template_id"/>
|
||||
<field ref="tax_code_template_ipi" name="base_code_id"/>
|
||||
<field ref="tax_code_template_ipi" name="tax_code_id"/>
|
||||
<field ref="tax_code_template_ipi" name="ref_base_code_id"/>
|
||||
<field ref="tax_code_template_ipi" name="ref_tax_code_id"/>
|
||||
</record>
|
||||
|
||||
<record id="tax_template_in_ipi330" model="account.tax.template">
|
||||
<field name="description">IPI 330%</field>
|
||||
<field name="name">IPI Entrada 330%</field>
|
||||
|
|
|
@ -75,3 +75,21 @@ IVC21Idet40,template_impcode_pagata_21det40,IVA a credito 21% detraibile 40% (im
|
|||
IVC21det50,template_ivacode_pagata_21det50,IVA a credito 21% detraibile 50%,template_ivacode_pagata
|
||||
IVC21Ndet50,template_ivacode_pagata_21det50ind,IVA a credito 21% detraibile 50% (indetraibile),template_ivacode_pagata_ind
|
||||
IVC21Idet50,template_impcode_pagata_21det50,IVA a credito 21% detraibile 50% (imponibile),template_impcode_pagata
|
||||
IVC22,template_ivacode_pagata_22,IVA a credito 22%,template_ivacode_pagata
|
||||
IVC22I,template_impcode_pagata_22,IVA a credito 22% (imponibile),template_impcode_pagata
|
||||
IVD22,template_ivacode_riscossa_22,IVA a debito 22%,template_ivacode_riscossa
|
||||
IVD22I,template_impcode_riscossa_22,IVA a debito 22% (imponibile),template_impcode_riscossa
|
||||
IVC22ind,template_ivacode_pagata_22ind,IVA a credito 22% indetraibile,template_ivacode_pagata_ind
|
||||
IVC22Iind,template_impcode_pagata_22ind,IVA a credito 22% indetraibile (imponibile),template_impcode_pagata
|
||||
IVC22det10,template_ivacode_pagata_22det10,IVA a credito 22% detraibile 10%,template_ivacode_pagata
|
||||
IVC22Ndet10,template_ivacode_pagata_22det10ind,IVA a credito 22% detraibile 10% (indetraibile),template_ivacode_pagata_ind
|
||||
IVC22Idet10,template_impcode_pagata_22det10,IVA a credito 22% detraibile 10% (imponibile),template_impcode_pagata
|
||||
IVC22det15,template_ivacode_pagata_22det15,IVA a credito 22% detraibile 15%,template_ivacode_pagata
|
||||
IVC22Ndet15,template_ivacode_pagata_22det15ind,IVA a credito 22% detraibile 15% (indetraibile),template_ivacode_pagata_ind
|
||||
IVC22Idet15,template_impcode_pagata_22det15,IVA a credito 22% detraibile 15% (imponibile),template_impcode_pagata
|
||||
IVC22det40,template_ivacode_pagata_22det40,IVA a credito 22% detraibile 40%,template_ivacode_pagata
|
||||
IVC22Ndet40,template_ivacode_pagata_22det40ind,IVA a credito 22% detraibile 40% (indetraibile),template_ivacode_pagata_ind
|
||||
IVC22Idet40,template_impcode_pagata_22det40,IVA a credito 22% detraibile 40% (imponibile),template_impcode_pagata
|
||||
IVC22det50,template_ivacode_pagata_22det50,IVA a credito 22% detraibile 50%,template_ivacode_pagata
|
||||
IVC22Ndet50,template_ivacode_pagata_22det50ind,IVA a credito 22% detraibile 50% (indetraibile),template_ivacode_pagata_ind
|
||||
IVC22Idet50,template_impcode_pagata_22det50,IVA a credito 22% detraibile 50% (imponibile),template_impcode_pagata
|
||||
|
|
|
|
@ -1,6 +1,8 @@
|
|||
id,description,chart_template_id:id,name,sequence,amount,parent_id:id,child_depend,type,account_collected_id:id,account_paid_id:id,type_tax_use,base_code_id:id,tax_code_id:id,ref_base_code_id:id,ref_tax_code_id:id,ref_base_sign,ref_tax_sign,price_include,base_sign,tax_sign
|
||||
21v,21v,l10n_it_chart_template_generic,Iva al 21% (debito),1,0.21,,False,percent,2601,2601,sale,template_impcode_riscossa_21,template_ivacode_riscossa_21,template_impcode_riscossa_21,template_ivacode_riscossa_21,-1,-1,False,1,1
|
||||
21a,21a,l10n_it_chart_template_generic,Iva al 21% (credito),2,0.21,,False,percent,1601,1601,purchase,template_impcode_pagata_21,template_ivacode_pagata_21,template_impcode_pagata_21,template_ivacode_pagata_21,1,1,False,-1,-1
|
||||
22v,22v,l10n_it_chart_template_generic,Iva al 22% (debito),1,0.22,,False,percent,2601,2601,sale,template_impcode_riscossa_22,template_ivacode_riscossa_22,template_impcode_riscossa_22,template_ivacode_riscossa_22,-1,-1,False,1,1
|
||||
22a,22a,l10n_it_chart_template_generic,Iva al 22% (credito),2,0.22,,False,percent,1601,1601,purchase,template_impcode_pagata_22,template_ivacode_pagata_22,template_impcode_pagata_22,template_ivacode_pagata_22,1,1,False,-1,-1
|
||||
21v,21v,l10n_it_chart_template_generic,Iva al 21% (debito),3,0.21,,False,percent,2601,2601,sale,template_impcode_riscossa_21,template_ivacode_riscossa_21,template_impcode_riscossa_21,template_ivacode_riscossa_21,-1,-1,False,1,1
|
||||
21a,21a,l10n_it_chart_template_generic,Iva al 21% (credito),4,0.21,,False,percent,1601,1601,purchase,template_impcode_pagata_21,template_ivacode_pagata_21,template_impcode_pagata_21,template_ivacode_pagata_21,1,1,False,-1,-1
|
||||
20v,20v,l10n_it_chart_template_generic,Iva al 20% (debito),3,0.2,,False,percent,2601,2601,sale,template_impcode_riscossa_20,template_ivacode_riscossa_20,template_impcode_riscossa_20,template_ivacode_riscossa_20,-1,-1,False,1,1
|
||||
20a,20a,l10n_it_chart_template_generic,Iva al 20% (credito),4,0.2,,False,percent,1601,1601,purchase,template_impcode_pagata_20,template_ivacode_pagata_20,template_impcode_pagata_20,template_ivacode_pagata_20,1,1,False,-1,-1
|
||||
10v,10v,l10n_it_chart_template_generic,Iva al 10% (debito),5,0.1,,False,percent,2601,2601,sale,template_impcode_riscossa_10,template_ivacode_riscossa_10,template_impcode_riscossa_10,template_ivacode_riscossa_10,-1,-1,False,1,1
|
||||
|
@ -25,8 +27,8 @@ id,description,chart_template_id:id,name,sequence,amount,parent_id:id,child_depe
|
|||
20I5,20I5,l10n_it_chart_template_generic,IVA al 20% detraibile al 50%,14,0.2,,True,percent,,,purchase,template_impcode_pagata_20det50,,template_impcode_pagata_20det50,,1,1,False,-1,-1
|
||||
20I5b,20I5b,l10n_it_chart_template_generic,IVA al 20% detraibile al 50% (D),200,0,20I5,False,balance,1601,1601,purchase,,template_ivacode_pagata_20det50,,template_ivacode_pagata_20det50,1,1,False,-1,-1
|
||||
20I5a,20I5a,l10n_it_chart_template_generic,IVA al 20% detraibile al 50% (I),100,0.5,20I5,False,percent,,,purchase,,template_ivacode_pagata_20det50ind,,template_ivacode_pagata_20det50ind,1,1,False,-1,-1
|
||||
22v,22v,l10n_it_chart_template_generic,Iva 2% (debito),15,0.02,,False,percent,2601,2601,sale,template_impcode_riscossa_2,template_ivacode_riscossa_2,template_impcode_riscossa_2,template_ivacode_riscossa_2,-1,-1,False,1,1
|
||||
22a,22a,l10n_it_chart_template_generic,Iva 2% (credito),16,0.02,,False,percent,1601,1601,purchase,template_impcode_pagata_2,template_ivacode_pagata_2,template_impcode_pagata_2,template_ivacode_pagata_2,1,1,False,-1,-1
|
||||
2v,2v,l10n_it_chart_template_generic,Iva 2% (debito),15,0.02,,False,percent,2601,2601,sale,template_impcode_riscossa_2,template_ivacode_riscossa_2,template_impcode_riscossa_2,template_ivacode_riscossa_2,-1,-1,False,1,1
|
||||
2a,2a,l10n_it_chart_template_generic,Iva 2% (credito),16,0.02,,False,percent,1601,1601,purchase,template_impcode_pagata_2,template_ivacode_pagata_2,template_impcode_pagata_2,template_ivacode_pagata_2,1,1,False,-1,-1
|
||||
4v,4v,l10n_it_chart_template_generic,Iva 4% (debito),17,0.04,,False,percent,2601,2601,sale,template_impcode_riscossa_4,template_ivacode_riscossa_4,template_impcode_riscossa_4,template_ivacode_riscossa_4,-1,-1,False,1,1
|
||||
4a,4a,l10n_it_chart_template_generic,Iva 4% (credito),18,0.04,,False,percent,1601,1601,purchase,template_impcode_pagata_4,template_ivacode_pagata_4,template_impcode_pagata_4,template_ivacode_pagata_4,1,1,False,-1,-1
|
||||
4AO,4AO,l10n_it_chart_template_generic,Iva al 4% indetraibile,19,0.04,,True,percent,,,purchase,template_impcode_pagata_4ind,,template_impcode_pagata_4ind,,1,1,False,-1,-1
|
||||
|
@ -42,11 +44,12 @@ id,description,chart_template_id:id,name,sequence,amount,parent_id:id,child_depe
|
|||
00a,00a,l10n_it_chart_template_generic,Fuori Campo IVA (credito),23,0,,False,percent,1601,1601,purchase,template_impcode_pagata_0,template_ivacode_pagata_0,template_impcode_pagata_0,template_ivacode_pagata_0,1,1,False,-1,-1
|
||||
00art15v,00art15v,l10n_it_chart_template_generic,Imponibile Escluso Art.15 (debito),22,0,,False,percent,2601,2601,sale,template_impcode_riscossa_art15,template_ivacode_riscossa_art15,template_impcode_riscossa_art15,template_ivacode_riscossa_art15,-1,-1,False,1,1
|
||||
00art15a,00art15a,l10n_it_chart_template_generic,Imponibile Escluso Art.15 (credito),23,0,,False,percent,1601,1601,purchase,template_impcode_pagata_art15,template_ivacode_pagata_art15,template_impcode_pagata_art15,template_ivacode_pagata_art15,1,1,False,-1,-1
|
||||
21v INC,21v INC,l10n_it_chart_template_generic,Iva al 21% (debito) INC,24,0.21,,False,percent,l10n_it.2601,l10n_it.2601,sale,l10n_it.template_impcode_riscossa_21,l10n_it.template_ivacode_riscossa_21,l10n_it.template_impcode_riscossa_21,l10n_it.template_ivacode_riscossa_21,-1,-1,True,1,1
|
||||
22v INC,22v INC,l10n_it_chart_template_generic,Iva al 22% (debito) INC,24,0.22,,False,percent,l10n_it.2601,l10n_it.2601,sale,l10n_it.template_impcode_riscossa_22,l10n_it.template_ivacode_riscossa_22,l10n_it.template_impcode_riscossa_22,l10n_it.template_ivacode_riscossa_22,-1,-1,True,1,1
|
||||
21v INC,21v INC,l10n_it_chart_template_generic,Iva al 21% (debito) INC,25,0.21,,False,percent,l10n_it.2601,l10n_it.2601,sale,l10n_it.template_impcode_riscossa_21,l10n_it.template_ivacode_riscossa_21,l10n_it.template_impcode_riscossa_21,l10n_it.template_ivacode_riscossa_21,-1,-1,True,1,1
|
||||
20v INC,20v INC,l10n_it_chart_template_generic,Iva al 20% (debito) INC,25,0.2,,False,percent,l10n_it.2601,l10n_it.2601,sale,l10n_it.template_impcode_riscossa_20,l10n_it.template_ivacode_riscossa_20,l10n_it.template_impcode_riscossa_20,l10n_it.template_ivacode_riscossa_20,-1,-1,True,1,1
|
||||
10v INC,10v INC,l10n_it_chart_template_generic,Iva al 10% (debito) INC,26,0.1,,False,percent,l10n_it.2601,l10n_it.2601,sale,l10n_it.template_impcode_riscossa_10,l10n_it.template_ivacode_riscossa_10,l10n_it.template_impcode_riscossa_10,l10n_it.template_ivacode_riscossa_10,-1,-1,True,1,1
|
||||
12v INC,12v INC,l10n_it_chart_template_generic,Iva 12% (debito) INC,27,0.12,,False,percent,l10n_it.2601,l10n_it.2601,sale,l10n_it.template_impcode_riscossa_12,l10n_it.template_ivacode_riscossa_12,l10n_it.template_impcode_riscossa_12,l10n_it.template_ivacode_riscossa_12,-1,-1,True,1,1
|
||||
22v INC,22v INC,l10n_it_chart_template_generic,Iva 2% (debito) INC,28,0.02,,False,percent,l10n_it.2601,l10n_it.2601,sale,l10n_it.template_impcode_riscossa_2,l10n_it.template_ivacode_riscossa_2,l10n_it.template_impcode_riscossa_2,l10n_it.template_ivacode_riscossa_2,-1,-1,True,1,1
|
||||
2v INC,2v INC,l10n_it_chart_template_generic,Iva 2% (debito) INC,28,0.02,,False,percent,l10n_it.2601,l10n_it.2601,sale,l10n_it.template_impcode_riscossa_2,l10n_it.template_ivacode_riscossa_2,l10n_it.template_impcode_riscossa_2,l10n_it.template_ivacode_riscossa_2,-1,-1,True,1,1
|
||||
4v INC,4v INC,l10n_it_chart_template_generic,Iva 4% (debito) INC,29,0.04,,False,percent,l10n_it.2601,l10n_it.2601,sale,l10n_it.template_impcode_riscossa_4,l10n_it.template_ivacode_riscossa_4,l10n_it.template_impcode_riscossa_4,l10n_it.template_ivacode_riscossa_4,-1,-1,True,1,1
|
||||
00v INC,00v INC,l10n_it_chart_template_generic,Fuori Campo IVA (debito) INC,30,0,,False,percent,l10n_it.2601,l10n_it.2601,sale,l10n_it.template_impcode_riscossa_0,l10n_it.template_ivacode_riscossa_0,l10n_it.template_impcode_riscossa_0,l10n_it.template_ivacode_riscossa_0,-1,-1,True,1,1
|
||||
2110,2110,l10n_it_chart_template_generic,Iva al 21% detraibile 10%,31,0.21,,True,percent,,,purchase,template_impcode_pagata_21det10,,template_impcode_pagata_21det10,,1,1,False,-1,-1
|
||||
|
@ -64,3 +67,18 @@ id,description,chart_template_id:id,name,sequence,amount,parent_id:id,child_depe
|
|||
21I5,21I5,l10n_it_chart_template_generic,IVA al 21% detraibile al 50%,35,0.21,,True,percent,,,purchase,template_impcode_pagata_21det50,,template_impcode_pagata_21det50,,1,1,False,-1,-1
|
||||
21I5b,21I5b,l10n_it_chart_template_generic,IVA al 21% detraibile al 50% (D),200,0,21I5,False,balance,1601,1601,purchase,,template_ivacode_pagata_21det50,,template_ivacode_pagata_21det50,1,1,False,-1,-1
|
||||
21I5a,21I5a,l10n_it_chart_template_generic,IVA al 21% detraibile al 50% (I),100,0.5,21I5,False,percent,,,purchase,,template_ivacode_pagata_21det50ind,,template_ivacode_pagata_21det50ind,1,1,False,-1,-1
|
||||
2210,2210,l10n_it_chart_template_generic,Iva al 22% detraibile 10%,31,0.22,,True,percent,,,purchase,template_impcode_pagata_22det10,,template_impcode_pagata_22det10,,1,1,False,-1,-1
|
||||
2210b,2210b,l10n_it_chart_template_generic,Iva al 22% detraibile 10% (D),200,0,2210,False,balance,1601,1601,purchase,,template_ivacode_pagata_22det10,,template_ivacode_pagata_22det10,1,1,False,-1,-1
|
||||
2210a,2210a,l10n_it_chart_template_generic,Iva al 22% detraibile 10% (I),100,0.9,2210,False,percent,,,purchase,,template_ivacode_pagata_22det10ind,,template_ivacode_pagata_22det10ind,1,1,False,-1,-1
|
||||
2215,2215,l10n_it_chart_template_generic,Iva al 22% detraibile 15%,32,0.22,,True,percent,,,purchase,template_impcode_pagata_22det15,,template_impcode_pagata_22det15,,1,1,False,-1,-1
|
||||
2215b,2215b,l10n_it_chart_template_generic,Iva al 22% detraibile 15% (D),200,0,2215,False,balance,1601,1601,purchase,,template_ivacode_pagata_22det15,,template_ivacode_pagata_22det15,1,1,False,-1,-1
|
||||
2215a,2215a,l10n_it_chart_template_generic,Iva al 22% detraibile 15% (I),100,0.85,2215,False,percent,,,purchase,,template_ivacode_pagata_22det15ind,,template_ivacode_pagata_22det15ind,1,1,False,-1,-1
|
||||
2240,2240,l10n_it_chart_template_generic,Iva al 22% detraibile 40%,33,0.22,,True,percent,,,purchase,template_impcode_pagata_22det40,,template_impcode_pagata_22det40,,1,1,False,-1,-1
|
||||
2240b,2240b,l10n_it_chart_template_generic,Iva al 22% detraibile 40% (D),200,0,2240,False,balance,1601,1601,purchase,,template_ivacode_pagata_22det40,,template_ivacode_pagata_22det40,1,1,False,-1,-1
|
||||
2240a,2240a,l10n_it_chart_template_generic,Iva al 22% detraibile 40% (I),100,0.6,2240,False,percent,,,purchase,,template_ivacode_pagata_22det40ind,,template_ivacode_pagata_22det40ind,1,1,False,-1,-1
|
||||
22AO,22AO,l10n_it_chart_template_generic,Iva al 22% indetraibile,34,0.22,,True,percent,,,purchase,template_impcode_pagata_22ind,,template_impcode_pagata_22ind,,1,1,False,-1,-1
|
||||
22AOb,22AOb,l10n_it_chart_template_generic,Iva al 22% indetraibile (D),200,0,22AO,False,balance,1601,1601,purchase,,template_ivacode_pagata_22ind,,template_ivacode_pagata_22ind,1,1,False,-1,-1
|
||||
22AOa,22AOa,l10n_it_chart_template_generic,Iva al 22% indetraibile (I),100,1,22AO,False,percent,,,purchase,,template_ivacode_pagata_22ind,,template_ivacode_pagata_22ind,1,1,False,-1,-1
|
||||
22I5,22I5,l10n_it_chart_template_generic,IVA al 22% detraibile al 50%,35,0.22,,True,percent,,,purchase,template_impcode_pagata_22det50,,template_impcode_pagata_22det50,,1,1,False,-1,-1
|
||||
22I5b,22I5b,l10n_it_chart_template_generic,IVA al 22% detraibile al 50% (D),200,0,22I5,False,balance,1601,1601,purchase,,template_ivacode_pagata_22det50,,template_ivacode_pagata_22det50,1,1,False,-1,-1
|
||||
22I5a,22I5a,l10n_it_chart_template_generic,IVA al 22% detraibile al 50% (I),100,0.5,22I5,False,percent,,,purchase,,template_ivacode_pagata_22det50ind,,template_ivacode_pagata_22det50ind,1,1,False,-1,-1
|
||||
|
|
|
|
@ -1174,8 +1174,8 @@ class mail_thread(osv.AbstractModel):
|
|||
if email and not partner:
|
||||
# get partner info from email
|
||||
partner_info = self.message_partner_info_from_emails(cr, uid, obj.id, [email], context=context)[0]
|
||||
if partner_info.get('partner_id'):
|
||||
partner = self.pool.get('res.partner').browse(cr, SUPERUSER_ID, [partner_info.get('partner_id')], context=context)[0]
|
||||
if partner_info and partner_info[0].get('partner_id'):
|
||||
partner = self.pool.get('res.partner').browse(cr, SUPERUSER_ID, [partner_info[0]['partner_id']], context=context)[0]
|
||||
if email and email in [val[1] for val in result[obj.id]]: # already existing email -> skip
|
||||
return result
|
||||
if partner and partner in obj.message_follower_ids: # recipient already in the followers -> skip
|
||||
|
|
|
@ -6,8 +6,8 @@ import urllib
|
|||
import urllib2
|
||||
|
||||
import openerp
|
||||
from openerp import release
|
||||
from openerp.osv import fields, osv
|
||||
from openerp import release, SUPERUSER_ID
|
||||
from openerp.osv import osv
|
||||
from openerp.tools.translate import _
|
||||
from openerp.tools.safe_eval import safe_eval
|
||||
from openerp.tools.config import config
|
||||
|
@ -86,25 +86,26 @@ class publisher_warranty_contract(osv.osv):
|
|||
try:
|
||||
try:
|
||||
result = get_sys_logs(self, cr, uid)
|
||||
except Exception, ex:
|
||||
except Exception:
|
||||
if cron_mode: # we don't want to see any stack trace in cron
|
||||
return False
|
||||
_logger.debug("Exception while sending a get logs messages", exc_info=1)
|
||||
raise osv.except_osv(_("Error"), _("Error during communication with the publisher warranty server."))
|
||||
limit_date = (datetime.datetime.now() - _PREVIOUS_LOG_CHECK).strftime(misc.DEFAULT_SERVER_DATETIME_FORMAT)
|
||||
# old behavior based on res.log; now on mail.message, that is not necessarily installed
|
||||
proxy = self.pool.get('mail.message')
|
||||
|
||||
model, res_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'mail', 'group_all_employees')
|
||||
|
||||
IMD = self.pool['ir.model.data']
|
||||
user = self.pool['res.users'].browse(cr, SUPERUSER_ID, SUPERUSER_ID)
|
||||
try:
|
||||
poster = IMD.get_object(cr, SUPERUSER_ID, 'mail', 'group_all_employees')
|
||||
except ValueError:
|
||||
# Cannot found group, post the message on the wall of the admin
|
||||
poster = user
|
||||
if not poster.exists():
|
||||
return True
|
||||
for message in result["messages"]:
|
||||
values = {
|
||||
'body' : message,
|
||||
'model' : 'mail.group',
|
||||
'res_id' : res_id,
|
||||
'user_id' : False,
|
||||
}
|
||||
proxy.create(cr, uid, values, context=context)
|
||||
try:
|
||||
poster.message_post(body=message, subtype='mt_comment', partner_ids=[user.partner_id.id])
|
||||
except Exception:
|
||||
_logger.warning('Cannot send ping message', exc_info=True)
|
||||
except Exception:
|
||||
if cron_mode:
|
||||
return False # we don't want to see any stack trace in cron
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#
|
||||
##############################################################################
|
||||
|
||||
from openerp import SUPERUSER_ID
|
||||
from openerp.osv import osv, fields
|
||||
from openerp.tools import html2plaintext
|
||||
|
||||
|
@ -188,18 +189,15 @@ class res_users(osv.Model):
|
|||
_inherit = ['res.users']
|
||||
def create(self, cr, uid, data, context=None):
|
||||
user_id = super(res_users, self).create(cr, uid, data, context=context)
|
||||
user = self.browse(cr, uid, uid, context=context)
|
||||
note_obj = self.pool.get('note.stage')
|
||||
data_obj = self.pool.get('ir.model.data')
|
||||
model_id = data_obj.get_object_reference(cr, uid, 'base', 'group_user') #Employee Group
|
||||
group_id = model_id and model_id[1] or False
|
||||
if group_id in [x.id for x in user.groups_id]:
|
||||
for note_xml_id in ['note_stage_00','note_stage_01','note_stage_02','note_stage_03','note_stage_04']:
|
||||
note_obj = self.pool['note.stage']
|
||||
data_obj = self.pool['ir.model.data']
|
||||
is_employee = self.has_group(cr, user_id, 'base.group_user')
|
||||
if is_employee:
|
||||
for n in range(5):
|
||||
xmlid = 'note_stage_%02d' % (n,)
|
||||
try:
|
||||
data_id = data_obj._get_id(cr, uid, 'note', note_xml_id)
|
||||
_model, stage_id = data_obj.get_object_reference(cr, SUPERUSER_ID, 'note', xmlid)
|
||||
except ValueError:
|
||||
continue
|
||||
stage_id = data_obj.browse(cr, uid, data_id, context=context).res_id
|
||||
note_obj.copy(cr, uid, stage_id, default = {
|
||||
'user_id': user_id}, context=context)
|
||||
note_obj.copy(cr, SUPERUSER_ID, stage_id, default={'user_id': user_id}, context=context)
|
||||
return user_id
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Business Applications
|
||||
# Copyright (c) 2013-TODAY OpenERP S.A. <http://openerp.com>
|
||||
#
|
||||
# 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 . import test_note
|
||||
|
||||
checks = [
|
||||
test_note,
|
||||
]
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -0,0 +1,43 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Business Applications
|
||||
# Copyright (c) 2013-TODAY OpenERP S.A. <http://openerp.com>
|
||||
#
|
||||
# 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 openerp.tests import common
|
||||
|
||||
class TestNote(common.TransactionCase):
|
||||
|
||||
def test_bug_lp_1156215(self):
|
||||
"""ensure any users can create new users"""
|
||||
cr, uid = self.cr, self.uid
|
||||
IMD = self.registry('ir.model.data')
|
||||
Users = self.registry('res.users')
|
||||
|
||||
_, demo_user = IMD.get_object_reference(cr, uid, 'base', 'user_demo')
|
||||
_, group_id = IMD.get_object_reference(cr, uid, 'base', 'group_erp_manager')
|
||||
|
||||
Users.write(cr, uid, [demo_user], {
|
||||
'groups_id': [(4, group_id)],
|
||||
})
|
||||
|
||||
# must not fail
|
||||
Users.create(cr, demo_user, {
|
||||
'name': 'test bug lp:1156215',
|
||||
'login': 'lp_1156215',
|
||||
})
|
|
@ -371,7 +371,6 @@ class procurement_order(osv.osv):
|
|||
ctx_wkf = dict(context or {})
|
||||
ctx_wkf['workflow.trg_write.%s' % self._name] = False
|
||||
self.write(cr, uid, [procurement.id], {'message': message},context=ctx_wkf)
|
||||
self.message_post(cr, uid, [procurement.id], body=message, context=context)
|
||||
return ok
|
||||
|
||||
def step_workflow(self, cr, uid, ids, context=None):
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<filter string="Can be Sold" name="filter_to_sell" icon="terp-accessories-archiver-minus" domain="[('sale_ok','=',1)]"/>
|
||||
<field name="categ_id"/>
|
||||
<group expand="0" string="Context...">
|
||||
<field name="pricelist_id" context="{'pricelist': self}" filter_domain="[]" groups="product.group_sale_pricelist"/>
|
||||
<field name="pricelist_id" widget="selection" context="{'pricelist': self}" filter_domain="[]" groups="product.group_sale_pricelist"/> <!-- Keep widget=selection on this field to pass numeric `self` value, which is not the case for regular m2o widgets! -->
|
||||
<field name="company_id" groups="base.group_multi_company"/>
|
||||
</group>
|
||||
<group expand='0' string='Group by...'>
|
||||
|
|
|
@ -1041,28 +1041,25 @@ class procurement_order(osv.osv):
|
|||
partner_obj = self.pool.get('res.partner')
|
||||
user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
|
||||
for procurement in self.browse(cr, uid, ids, context=context):
|
||||
if not procurement.product_id.seller_ids:
|
||||
message = _('No supplier defined for this product !')
|
||||
self.message_post(cr, uid, [procurement.id], body=message)
|
||||
cr.execute('update procurement_order set message=%s where id=%s', (message, procurement.id))
|
||||
return False
|
||||
message = ''
|
||||
partner = procurement.product_id.seller_id #Taken Main Supplier of Product of Procurement.
|
||||
|
||||
if not partner:
|
||||
if not procurement.product_id.seller_ids:
|
||||
message = _('No supplier defined for this product !')
|
||||
elif not partner:
|
||||
message = _('No default supplier defined for this product')
|
||||
self.message_post(cr, uid, [procurement.id], body=message)
|
||||
cr.execute('update procurement_order set message=%s where id=%s', (message, procurement.id))
|
||||
elif not partner_obj.address_get(cr, uid, [partner.id], ['delivery'])['delivery']:
|
||||
message = _('No address defined for the supplier')
|
||||
|
||||
if message:
|
||||
if procurement.message != message:
|
||||
cr.execute('update procurement_order set message=%s where id=%s', (message, procurement.id))
|
||||
return False
|
||||
|
||||
if user.company_id and user.company_id.partner_id:
|
||||
if partner.id == user.company_id.partner_id.id:
|
||||
raise osv.except_osv(_('Configuration Error!'), _('The product "%s" has been defined with your company as reseller which seems to be a configuration error!' % procurement.product_id.name))
|
||||
|
||||
address_id = partner_obj.address_get(cr, uid, [partner.id], ['delivery'])['delivery']
|
||||
if not address_id:
|
||||
message = _('No address defined for the supplier')
|
||||
self.message_post(cr, uid, [procurement.id], body=message)
|
||||
cr.execute('update procurement_order set message=%s where id=%s', (message, procurement.id))
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
|
|
|
@ -36,7 +36,6 @@
|
|||
|
||||
<record id="group_mrp_properties" model="res.groups">
|
||||
<field name="name">Properties on lines</field>
|
||||
<field name="users" eval="[(4, ref('base.user_root'))]"/>
|
||||
<field name="category_id" ref="base.module_category_hidden"/>
|
||||
</record>
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
<field name="inherit_id" ref="product.product_search_form_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="pricelist_id" position="before">
|
||||
<field name="location_id" context="{'location': self}"/>
|
||||
<field name="warehouse_id" context="{'warehouse': self}"/>
|
||||
<field name="location_id" widget="selection" context="{'location': self}"/>
|
||||
<field name="warehouse_id" widget="selection" context="{'warehouse': self}"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
|
|
@ -73,6 +73,8 @@ class stock_location(osv.osv):
|
|||
_parent_order = 'posz,name'
|
||||
_order = 'parent_left'
|
||||
|
||||
# TODO: implement name_search() in a way that matches the results of name_get!
|
||||
|
||||
def name_get(self, cr, uid, ids, context=None):
|
||||
# always return the full hierarchical name
|
||||
res = self._complete_name(cr, uid, ids, 'complete_name', None, context=context)
|
||||
|
|
Loading…
Reference in New Issue