Feedback 1143: SST-11: neues Feld in Zahlungsbedingungen

develop
Ahmed Aly 2017-12-05 11:24:49 +01:00
parent 45e9b0d76a
commit 27f19ad365
3 changed files with 30 additions and 1 deletions

View File

@ -31,3 +31,9 @@ class AccountInvoiceLine(models.Model):
if vals.get('product_id', False) and not vals.get('intrastat_id', False):
vals.update(intrastat_id=self.env['product.template'].browse(vals['product_id']).intrastat_id.id)
return super(AccountInvoiceLine, self).create(vals)
class AccountPaymentTerm(models.Model):
_inherit = 'account.payment.term'
code = fields.Char(string='Code')

View File

@ -124,6 +124,15 @@ class Partner(models.Model):
else:
raise ValidationError(_("Die Branche \'%s\' kann nicht zugeordnet werden" % vals['partner_sector_id']))
if vals.get('property_payment_term_id', False):
payment_term = self.env['account.payment.term'].search(
[('code', '=', vals['property_payment_term_id'])])
if payment_term:
vals['property_payment_term_id'] = payment_term.id
else:
raise ValidationError(_("Die Zahlungsbedingung mit dem Code \'%s\' kann nicht zugeordnet werden" % vals[
'property_payment_term_id']))
return vals
@api.model
@ -169,7 +178,8 @@ class Partner(models.Model):
})
portal_url = tools.config.get('portal_url')
application_id = tools.config.get('portal_secret')
response = requests.post(portal_url + '/api/v1/set-discounts/?secret=' + application_id, data=json.dumps(data))
response = requests.post(portal_url + '/api/v1/set-discounts/?secret=' + application_id,
data=json.dumps(data))
if response.status_code != 200:
raise ValidationError(_('Rabatt konnte nicht gesetzt werden.'))

View File

@ -12,4 +12,17 @@
</field>
</record>
<record id="account_payment_term_form_view" model="ir.ui.view">
<field name="name">account_payment_term_form_view</field>
<field name="model">account.payment.term</field>
<field name="inherit_id" ref="account.view_payment_term_form"/>
<field name="arch" type="xml">
<field name="name" position="after">
<field name="code"/>
</field>
</field>
</record>
</odoo>