From: Alexis de Lattre Date: Thu, 29 Nov 2012 22:26:45 +0000 (+0100) Subject: Merge with addons/trunk revno 8168. X-Git-Tag: 7.0-server~642^2^2 X-Git-Url: http://git.inspyration.org/?a=commitdiff_plain;h=cad4abe56ceba2ebed236efa86755a48a61c1003;p=odoo%2Fodoo.git Merge with addons/trunk revno 8168. Adapt demo data to the rename of partner XML IDs in server/trunk. bzr revid: alexis@via.ecp.fr-20121129222645-lm5ujxf4a1a83aoz --- cad4abe56ceba2ebed236efa86755a48a61c1003 diff --cc addons/account/account.py index 4ce2ddb,438dff4..6958d79 --- a/addons/account/account.py +++ b/addons/account/account.py @@@ -2307,15 -2302,10 +2302,15 @@@ class account_model(osv.osv) date_maturity = context.get('date',time.strftime('%Y-%m-%d')) if line.date_maturity == 'partner': if not line.partner_id: - raise osv.except_osv(_('Error !'), _("Maturity date of entry line generated by model line '%s' of model '%s' is based on partner payment term!" \ + raise osv.except_osv(_('Error!'), _("Maturity date of entry line generated by model line '%s' of model '%s' is based on partner payment term!" \ "\nPlease define partner on it!")%(line.name, model.name)) - if line.partner_id.property_payment_term: + + payment_term_id = False + if model.journal_id.type in ('purchase', 'purchase_refund') and line.partner_id.property_supplier_payment_term: + payment_term_id = line.partner_id.property_supplier_payment_term.id + elif line.partner_id.property_payment_term: payment_term_id = line.partner_id.property_payment_term.id + if payment_term_id: pterm_list = pt_obj.compute(cr, uid, payment_term_id, value=1, date_ref=date_maturity) if pterm_list: pterm_list = [l[0] for l in pterm_list] diff --cc addons/account/account_invoice.py index 3e73a73,8d13ec9..38799dd --- a/addons/account/account_invoice.py +++ b/addons/account/account_invoice.py @@@ -206,17 -207,17 +207,17 @@@ class account_invoice(osv.osv) ('open','Open'), ('paid','Paid'), ('cancel','Cancelled'), - ],'State', select=True, readonly=True, - help=' * The \'Draft\' state is used when a user is encoding a new and unconfirmed Invoice. \ - \n* The \'Pro-forma\' when invoice is in Pro-forma state,invoice does not have an invoice number. \ - \n* The \'Open\' state is used when user create invoice,a invoice number is generated.Its in open state till user does not pay invoice. \ - \n* The \'Paid\' state is set automatically when the invoice is paid. Its related journal entries may or may not be reconciled. \ - \n* The \'Cancelled\' state is used when user cancel invoice.'), + ],'Status', select=True, readonly=True, + help=' * The \'Draft\' status is used when a user is encoding a new and unconfirmed Invoice. \ + \n* The \'Pro-forma\' when invoice is in Pro-forma status,invoice does not have an invoice number. \ + \n* The \'Open\' status is used when user create invoice,a invoice number is generated.Its in open status till user does not pay invoice. \ + \n* The \'Paid\' status is set automatically when the invoice is paid. Its related journal entries may or may not be reconciled. \ + \n* The \'Cancelled\' status is used when user cancel invoice.'), 'sent': fields.boolean('Sent', readonly=True, help="It indicates that the invoice has been sent."), 'date_invoice': fields.date('Invoice Date', readonly=True, states={'draft':[('readonly',False)]}, select=True, help="Keep empty to use the current date"), - 'date_due': fields.date('Due Date', states={'paid':[('readonly',True)], 'open':[('readonly',True)], 'close':[('readonly',True)]}, select=True, + 'date_due': fields.date('Due Date', readonly=True, states={'draft':[('readonly',False)]}, select=True, help="If you use payment terms, the due date will be computed automatically at the generation "\ - "of accounting entries. If you keep the payment term and the due date empty, it means direct payment. The payment term may compute several due dates, for example 50% now, 50% in one month."), + "of accounting entries. If you want to force a due date, make sure that the payment term is not set on the invoice. If you keep the payment term and the due date empty, it means direct payment."), 'partner_id': fields.many2one('res.partner', 'Partner', change_default=True, readonly=True, required=True, states={'draft':[('readonly',False)]}), 'payment_term': fields.many2one('account.payment.term', 'Payment Term',readonly=True, states={'draft':[('readonly',False)]}, help="If you use payment terms, the due date will be computed automatically at the generation "\ diff --cc addons/account/demo/account_demo.xml index 2cae1eb,0dff40c..8b0f026 --- a/addons/account/demo/account_demo.xml +++ b/addons/account/demo/account_demo.xml @@@ -131,21 -131,5 +131,21 @@@ + + - ++ + + - ++ + + + + + + - ++ + + + diff --cc addons/account/partner.py index 67f20b3,3355363..b5e0a95 --- a/addons/account/partner.py +++ b/addons/account/partner.py @@@ -180,19 -215,12 +215,19 @@@ class res_partner(osv.osv) 'account.payment.term', type='many2one', relation='account.payment.term', - string ='Payment Term', + string ='Customer Payment Term', view_load=True, - help="This payment term will be used instead of the default one for the current partner"), + help="This payment term will be used instead of the default one for sale orders and customer invoices"), + 'property_supplier_payment_term': fields.property( + 'account.payment.term', + type='many2one', + relation='account.payment.term', + string ='Supplier Payment Term', + view_load=True, + help="This payment term will be used instead of the default one for purchase orders and supplier invoices"), 'ref_companies': fields.one2many('res.company', 'partner_id', 'Companies that refers to partner'), - 'last_reconciliation_date': fields.datetime('Latest Reconciliation Date', help='Date on which the partner accounting entries were reconciled last time') + 'last_reconciliation_date': fields.datetime('Latest Reconciliation Date', help='Date on which the partner accounting entries were fully reconciled last time. It differs from the date of the last reconciliation made for this partner, as here we depict the fact that nothing more was to be reconciled at this date. This can be achieved in 2 ways: either the last debit/credit entry was reconciled, either the user pressed the button "Fully Reconciled" in the manual reconciliation process') } res_partner() diff --cc addons/auth_signup/signup.py index 0000000,0000000..3819a63 new file mode 100644 --- /dev/null +++ b/addons/auth_signup/signup.py @@@ -1,0 -1,0 +1,57 @@@ ++from openerp.osv import osv, fields ++ ++class res_users(osv.Model): ++ _inherit = 'res.users' ++ ++ _sql_constraints = [ ++ ('email_uniq', 'UNIQUE (user_email)', 'You can not have two users with the same email!') ++ ] ++ ++class signup_signup(osv.TransientModel): ++ _name = 'signup.signup' ++ _columns = { ++ 'name': fields.char('Name', size=64), ++ 'email': fields.char('Email', size=64), ++ 'password': fields.char('Password', size=64), ++ 'password_confirmation': fields.char('Confirm Password', size=64), ++ 'state': fields.selection([(x, x) for x in 'draft done missmatch'.split()], required=True), ++ } ++ _defaults = { ++ 'state': 'draft', ++ } ++ ++ def create(self, cr, uid, values, context=None): ++ # NOTE here, invalid values raises exceptions to avoid storing ++ # sensitive data into the database (which then are available to anyone) ++ if values['password'] != values['password_confirmation']: ++ raise osv.except_osv('Error', 'Passwords missmatch') ++ ++ new_user = { ++ 'name': values['name'], ++ 'login': values['email'], ++ 'user_email': values['email'], ++ 'password': values['password'], ++ 'active': True, ++ } ++ ++ user_template_id = self.pool.get('ir.config_parameter').get_param(cr, uid, 'signup.user_template_id', 0) ++ if user_template_id: ++ self.pool.get('res.users').copy(cr, 1, user_template_id, new_user, context=context) ++ else: ++ self.pool.get('res.users').create(cr, 1, new_user, context=context) ++ ++ # Dont store the password ++ values = {'state': 'done'} ++ return super(signup_signup, self).create(cr, uid, values, context) ++ ++ def signup(self, cr, uid, ids, context=None): ++ return { ++ 'type': 'ir.actions.client', ++ 'tag': 'login', ++ } ++ ++ def onchange_pw(self, cr, uid, ids, pw, cpw, context=None): ++ if pw != cpw: ++ return {'value': {'state': 'missmatch'}} ++ return {'value': {'state': 'draft'}} ++ diff --cc addons/auth_signup/signup.xml index 0000000,5d92c78..3dacf85 mode 000000,100644..100644 --- a/addons/auth_signup/signup.xml +++ b/addons/auth_signup/signup.xml @@@ -1,0 -1,42 +1,41 @@@ + + + - + + signup.signup.form + signup.signup + form + +
- ++ + + + + + + +
Passwords missmatch
+
+ +