Merge lp:~openerp-dev/openobject-addons/trunk-bug-800100-mdi into lp:openobject-addons

Proposed by DJ Patel (OpenERP)
Status: Merged
Approved by: Raphael Collet (OpenERP)
Approved revision: no longer in the source branch.
Merged at revision: 5738
Proposed branch: lp:~openerp-dev/openobject-addons/trunk-bug-800100-mdi
Merge into: lp:openobject-addons
Diff against target: 103 lines (+15/-6)
5 files modified
account/account_invoice.py (+3/-0)
mrp/mrp.py (+4/-1)
purchase/purchase.py (+1/-1)
sale/sale.py (+1/-1)
stock/stock.py (+6/-3)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/trunk-bug-800100-mdi
Reviewer Review Type Date Requested Status
DJ Patel (OpenERP) (community) Needs Resubmitting
Mustufa Rangwala (Open ERP) (community) Needs Fixing
Purnendu Singh (OpenERP) (community) Approve
Raphael Collet (OpenERP) (community) Needs Fixing
qdp (OpenERP) Pending
Review via email: mp+81671@code.launchpad.net

Description of the change

Hello Sir,

I have fix the issue: https://bugs.launchpad.net/openobject-addons/+bug/800100 "Sale: Constraint Error-Order Reference must be unique per company".

I changes the constraint for sale order and purchase order.

Thanks and Regards,

Divyesh Makwana(MDI)

To post a comment you must log in.
Revision history for this message
Raphael Collet (OpenERP) (rco-openerp) wrote :

Please remove the "space fixes". Those are not bugfixes, and make the diff harder to read.

Now please fix those real problems:
- in account.invoice, 'number' is a related field and is not present in the table;
- in sale.order, 'company_id' is a related field and is not present in the table.

Thanks,
Raphael

review: Needs Fixing
Revision history for this message
DJ Patel (OpenERP) (mdi-openerp) wrote :

Hello Raphael Collet,

As per you suggestion

- in account.invoice, 'number' is a related field and is not present in the table;
- in sale.order, 'company_id' is a related field and is not present in the table.

but in both field defination, the store=True is there.
So, Both the fields are present in table.
will you please check once more.

Thanks and Regards,

Divyesh Makwana(MDI)

Revision history for this message
DJ Patel (OpenERP) (mdi-openerp) :
review: Needs Resubmitting
Revision history for this message
Purnendu Singh (OpenERP) (purnendu-singh) wrote :

seems ok now

review: Approve
Revision history for this message
Mustufa Rangwala (Open ERP) (mra-tinyerp) wrote :

Improve the string in stock.py.
change Order Reference to Reference.

Thanks,
Mustufa

review: Needs Fixing
Revision history for this message
DJ Patel (OpenERP) (mdi-openerp) :
review: Needs Resubmitting

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account/account_invoice.py'
2--- account/account_invoice.py 2011-11-16 10:51:15 +0000
3+++ account/account_invoice.py 2011-11-17 11:06:32 +0000
4@@ -286,6 +286,9 @@
5 'internal_number': False,
6 'user_id': lambda s, cr, u, c: u,
7 }
8+ _sql_constraints = [
9+ ('number_uniq', 'unique(number, company_id)', 'Invoice Number must be unique per Company!'),
10+ ]
11
12 def fields_view_get(self, cr, uid, view_id=None, view_type=False, context=None, toolbar=False, submenu=False):
13 journal_obj = self.pool.get('account.journal')
14
15=== modified file 'mrp/mrp.py'
16--- mrp/mrp.py 2011-11-13 10:03:46 +0000
17+++ mrp/mrp.py 2011-11-17 11:06:32 +0000
18@@ -272,7 +272,7 @@
19 if context is None:
20 context = {}
21 context['lang'] = self.pool.get('res.users').browse(cr,uid,uid).context_lang
22-
23+
24 if product_id:
25 prod = self.pool.get('product.product').browse(cr, uid, product_id, context=context)
26 v = {'name': prod.name, 'product_uom': prod.uom_id.id}
27@@ -491,6 +491,9 @@
28 'name': lambda x, y, z, c: x.pool.get('ir.sequence').get(y, z, 'mrp.production') or '/',
29 'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'mrp.production', context=c),
30 }
31+ _sql_constraints = [
32+ ('name_uniq', 'unique(name, company_id)', 'Reference must be unique per Company!'),
33+ ]
34 _order = 'priority desc, date_planned asc';
35
36 def _check_qty(self, cr, uid, ids, context=None):
37
38=== modified file 'purchase/purchase.py'
39--- purchase/purchase.py 2011-11-15 15:32:01 +0000
40+++ purchase/purchase.py 2011-11-17 11:06:32 +0000
41@@ -227,7 +227,7 @@
42 'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'purchase.order', context=c),
43 }
44 _sql_constraints = [
45- ('name_uniq', 'unique(name)', 'Order Reference must be unique !'),
46+ ('name_uniq', 'unique(name, company_id)', 'Order Reference must be unique per Company!'),
47 ]
48 _name = "purchase.order"
49 _description = "Purchase Order"
50
51=== modified file 'sale/sale.py'
52--- sale/sale.py 2011-11-16 18:54:43 +0000
53+++ sale/sale.py 2011-11-17 11:06:32 +0000
54@@ -280,7 +280,7 @@
55 'partner_shipping_id': lambda self, cr, uid, context: context.get('partner_id', False) and self.pool.get('res.partner').address_get(cr, uid, [context['partner_id']], ['delivery'])['delivery'],
56 }
57 _sql_constraints = [
58- ('name_uniq', 'unique(name)', 'Order Reference must be unique !'),
59+ ('name_uniq', 'unique(name, company_id)', 'Order Reference must be unique per Company!'),
60 ]
61 _order = 'name desc'
62
63
64=== modified file 'stock/stock.py'
65--- stock/stock.py 2011-11-15 09:50:27 +0000
66+++ stock/stock.py 2011-11-17 11:06:32 +0000
67@@ -661,6 +661,9 @@
68 'date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
69 'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'stock.picking', context=c)
70 }
71+ _sql_constraints = [
72+ ('name_uniq', 'unique(name, company_id)', 'Reference must be unique per Company!'),
73+ ]
74
75 def action_process(self, cr, uid, ids, context=None):
76 if context is None: context = {}
77@@ -1798,7 +1801,7 @@
78
79 def onchange_date(self, cr, uid, ids, date, date_expected, context=None):
80 """ On change of Scheduled Date gives a Move date.
81- @param date_expected: Scheduled Date
82+ @param date_expected: Scheduled Date
83 @param date: Move Date
84 @return: Move Date
85 """
86@@ -2261,7 +2264,7 @@
87 return super(stock_move, self).unlink(
88 cr, uid, ids, context=ctx)
89
90- # _create_lot function is not used anywhere
91+ # _create_lot function is not used anywhere
92 def _create_lot(self, cr, uid, ids, product_id, prefix=False):
93 """ Creates production lot
94 @return: Production lot id
95@@ -2307,7 +2310,7 @@
96 self.action_done(cr, uid, res)
97 return res
98
99- # action_split function is not used anywhere
100+ # action_split function is not used anywhere
101 def action_split(self, cr, uid, ids, quantity, split_by_qty=1, prefix=False, with_lot=True, context=None):
102 """ Split Stock Move lines into production lot which specified split by quantity.
103 @param cr: the database cursor

Subscribers

People subscribed via source and target branches

to all changes: